diff --git a/src/EnergyPlus/AirflowNetworkBalanceManager.cc b/src/EnergyPlus/AirflowNetworkBalanceManager.cc index 9abf852186c..cb154afcce8 100644 --- a/src/EnergyPlus/AirflowNetworkBalanceManager.cc +++ b/src/EnergyPlus/AirflowNetworkBalanceManager.cc @@ -6872,7 +6872,7 @@ namespace AirflowNetworkBalanceManager { Real64 TSurfj = TH(1, 1, ZoneSurfNum); Real64 TSurfj_K = TSurfj + KelvinConv; - Real64 ZoneSurfEmissivity = dataConstruction.Construct(Surface(ZoneSurfNum).Construction).InsideAbsorpThermal; + Real64 ZoneSurfEmissivity = state.dataConstruction->Construct(Surface(ZoneSurfNum).Construction).InsideAbsorpThermal; Real64 ZoneSurfArea = Surface(ZoneSurfNum).Area; Real64 DuctEmissivity = VFObj.DuctEmittance; diff --git a/src/EnergyPlus/Construction.cc b/src/EnergyPlus/Construction.cc index 7b4f640ee4d..aa84e016c81 100644 --- a/src/EnergyPlus/Construction.cc +++ b/src/EnergyPlus/Construction.cc @@ -57,11 +57,9 @@ namespace EnergyPlus { -ConstructionData dataConstruction; - namespace Construction { - void ConstructionProps::calculateTransferFunction(bool & ErrorsFound, bool & DoCTFErrorReport) { + void ConstructionProps::calculateTransferFunction(EnergyPlusData &state, bool & ErrorsFound, bool & DoCTFErrorReport) { // SUBROUTINE INFORMATION: // AUTHOR Russ Taylor @@ -410,7 +408,7 @@ namespace Construction { // previously this loop would go from 1..currentConstructionIndex-1 // instead of that, we'll loop through the list and stop when we get to the current construction // should be the same behavior, we're just checking it by address - for (auto & otherConstruction : dataConstruction.Construct) { + for (auto & otherConstruction : state.dataConstruction->Construct) { if (&otherConstruction == this) break; // If a source or sink is present in this construction, do not allow any diff --git a/src/EnergyPlus/Construction.hh b/src/EnergyPlus/Construction.hh index 1472894b798..dd4a416a8d3 100644 --- a/src/EnergyPlus/Construction.hh +++ b/src/EnergyPlus/Construction.hh @@ -60,7 +60,6 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -struct ConstructionData; namespace Construction { @@ -312,7 +311,7 @@ namespace Construction { s0.allocate(3, 4); } - void calculateTransferFunction(bool & ErrorsFound, bool & DoCTFErrorReport); + void calculateTransferFunction(EnergyPlusData &state, bool & ErrorsFound, bool & DoCTFErrorReport); void calculateExponentialMatrix(); // Time step of the resulting CTFs @@ -341,8 +340,6 @@ namespace Construction { } }; -extern ConstructionData dataConstruction; - } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/ConvectionCoefficients.cc b/src/EnergyPlus/ConvectionCoefficients.cc index 36bd56f60f7..5a4452ed0aa 100644 --- a/src/EnergyPlus/ConvectionCoefficients.cc +++ b/src/EnergyPlus/ConvectionCoefficients.cc @@ -61,7 +61,6 @@ #include // EnergyPlus Headers -#include #include #include #include @@ -245,7 +244,7 @@ namespace ConvectionCoefficients { // Ceiling Diffuser and Trombe Wall only make sense at Zone Level // Interior convection coeffs are first calculated here and then at surface level if (SELECT_CASE_var == CeilingDiffuser) { - CalcCeilingDiffuserIntConvCoeff(ZoneNum, SurfaceTemperatures); + CalcCeilingDiffuserIntConvCoeff(state, ZoneNum, SurfaceTemperatures); } else if (SELECT_CASE_var == TrombeWall) { CalcTrombeWallIntConvCoeff(ZoneNum, SurfaceTemperatures); @@ -288,7 +287,7 @@ namespace ConvectionCoefficients { if (HConvIn(SurfNum) < LowHConvLimit) HConvIn(SurfNum) = LowHConvLimit; } else if (SELECT_CASE_var1 == ASHRAETARP) { - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) { + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) { CalcASHRAEDetailedIntConvCoeff(SurfNum, SurfaceTemperatures(SurfNum), MAT(ZoneNum)); } else { CalcISO15099WindowIntConvCoeff(SurfNum, SurfaceTemperatures(SurfNum), MAT(ZoneNum)); @@ -1218,7 +1217,7 @@ namespace ConvectionCoefficients { UserIntConvectionCoeffs(TotIntConvCoeff).WhichSurface = -999; for (int surfNum : DataSurfaces::AllHTSurfaceList) { auto &surf = Surface(surfNum); - if (dataConstruction.Construct(surf.Construction).TypeIsAirBoundaryIRTSurface) { + if (state.dataConstruction->Construct(surf.Construction).TypeIsAirBoundaryIRTSurface) { surf.IntConvCoeff = TotIntConvCoeff; } } @@ -1347,7 +1346,7 @@ namespace ConvectionCoefficients { if (HcInt_ConvectionTypesMap.find(equationName) != HcInt_ConvectionTypesMap.end()) { IntValue = HcInt_ConvectionTypesMap.at(equationName); if ((equationName == "SIMPLE") || (equationName == "TARP") || (equationName == "ADAPTIVECONVECTIONALGORITHM")) { - ApplyConvectionValue(Alphas(1), "INSIDE", -IntValue); + ApplyConvectionValue(state, Alphas(1), "INSIDE", -IntValue); } else if (equationName == "VALUE") { ++TotIntConvCoeff; UserIntConvectionCoeffs(TotIntConvCoeff).SurfaceName = Alphas(1); @@ -1478,7 +1477,7 @@ namespace ConvectionCoefficients { if (HcExt_ConvectionTypesMap.find(equationName) != HcExt_ConvectionTypesMap.end()) { ExtValue = HcExt_ConvectionTypesMap.at(equationName); if (equationName == "SIMPLE" || equationName == "TARP" || equationName == "MOWITT" || equationName == "DOE-2" || equationName == "ADAPTIVECONVECTIONALGORITHM" ) { - ApplyConvectionValue(Alphas(1), "OUTSIDE", -ExtValue); + ApplyConvectionValue(state, Alphas(1), "OUTSIDE", -ExtValue); } else if (equationName == "VALUE") { // SimpleValueAssignment via UserExtConvectionCoeffs array ++TotExtConvCoeff; @@ -1500,7 +1499,7 @@ namespace ConvectionCoefficients { ShowContinueError("Since VALUE is used for \"" + cAlphaFieldNames(FieldNo + 2) + "\", " + cAlphaFieldNames(Ptr + 2) + '=' + Alphas(Ptr + 2) + " is ignored."); } - ApplyConvectionValue(Alphas(1), "OUTSIDE", TotExtConvCoeff); + ApplyConvectionValue(state, Alphas(1), "OUTSIDE", TotExtConvCoeff); } else if (equationName == "SCHEDULE") { ++TotExtConvCoeff; UserExtConvectionCoeffs(TotExtConvCoeff).SurfaceName = Alphas(Ptr); @@ -1514,7 +1513,7 @@ namespace ConvectionCoefficients { } else { UserExtConvectionCoeffs(TotExtConvCoeff).ScheduleName = Alphas(Ptr + 2); } - ApplyConvectionValue(Alphas(1), "OUTSIDE", TotExtConvCoeff); + ApplyConvectionValue(state, Alphas(1), "OUTSIDE", TotExtConvCoeff); } else if (ExtValue == HcExt_UserCurve) { // User curve ++TotExtConvCoeff; UserExtConvectionCoeffs(TotExtConvCoeff).SurfaceName = Alphas(Ptr); @@ -1528,7 +1527,7 @@ namespace ConvectionCoefficients { ErrorsFound = true; } PotentialAssignedValue = TotExtConvCoeff; - ApplyConvectionValue(Alphas(1), "OUTSIDE", TotExtConvCoeff); + ApplyConvectionValue(state, Alphas(1), "OUTSIDE", TotExtConvCoeff); } else if (ExtValue > HcExt_UserCurve) { // specificmodel @@ -1538,7 +1537,7 @@ namespace ConvectionCoefficients { UserExtConvectionCoeffs(TotExtConvCoeff).OverrideType = ConvCoefSpecifiedModel; UserExtConvectionCoeffs(TotExtConvCoeff).HcModelEq = ExtValue; PotentialAssignedValue = TotExtConvCoeff; - ApplyConvectionValue(Alphas(1), "OUTSIDE", TotExtConvCoeff); + ApplyConvectionValue(state, Alphas(1), "OUTSIDE", TotExtConvCoeff); } else { ++TotExtConvCoeff; UserExtConvectionCoeffs(TotExtConvCoeff).SurfaceName = Alphas(Ptr); @@ -1546,7 +1545,7 @@ namespace ConvectionCoefficients { UserExtConvectionCoeffs(TotExtConvCoeff).OverrideType = ConvCoefSpecifiedModel; UserExtConvectionCoeffs(TotExtConvCoeff).HcModelEq = ExtValue; PotentialAssignedValue = TotExtConvCoeff; - ApplyConvectionValue(Alphas(1), "OUTSIDE", TotExtConvCoeff); + ApplyConvectionValue(state, Alphas(1), "OUTSIDE", TotExtConvCoeff); } } else { @@ -1559,7 +1558,7 @@ namespace ConvectionCoefficients { if (HcInt_ConvectionTypesMap.find(equationName) != HcInt_ConvectionTypesMap.end()){ IntValue = HcInt_ConvectionTypesMap.at(equationName); if ((equationName == "SIMPLE") || (equationName == "TARP") || (equationName == "ADAPTIVECONVECTIONALGORITHM")) { - ApplyConvectionValue(Alphas(1), "INSIDE", -IntValue); + ApplyConvectionValue(state, Alphas(1), "INSIDE", -IntValue); } else if (equationName == "VALUE") { // SimpleValueAssignment via UserExtConvectionCoeffs array ++TotIntConvCoeff; @@ -1581,7 +1580,7 @@ namespace ConvectionCoefficients { ShowContinueError("Since VALUE is used for \"" + cAlphaFieldNames(FieldNo + 2) + "\", " + cAlphaFieldNames(Ptr + 2) + '=' + Alphas(Ptr + 2) + " is ignored."); } - ApplyConvectionValue(Alphas(1), "INSIDE", TotIntConvCoeff); + ApplyConvectionValue(state, Alphas(1), "INSIDE", TotIntConvCoeff); } else if (equationName == "SCHEDULE") { ++TotIntConvCoeff; UserIntConvectionCoeffs(TotIntConvCoeff).SurfaceName = Alphas(Ptr); @@ -1595,7 +1594,7 @@ namespace ConvectionCoefficients { } else { UserIntConvectionCoeffs(TotIntConvCoeff).ScheduleName = Alphas(Ptr + 2); } - ApplyConvectionValue(Alphas(1), "INSIDE", TotIntConvCoeff); + ApplyConvectionValue(state, Alphas(1), "INSIDE", TotIntConvCoeff); } else if (IntValue == HcInt_UserCurve) { ++TotIntConvCoeff; UserIntConvectionCoeffs(TotIntConvCoeff).SurfaceName = Alphas(Ptr); @@ -1610,7 +1609,7 @@ namespace ConvectionCoefficients { ErrorsFound = true; } PotentialAssignedValue = TotIntConvCoeff; - ApplyConvectionValue(Alphas(1), "INSIDE", TotIntConvCoeff); + ApplyConvectionValue(state, Alphas(1), "INSIDE", TotIntConvCoeff); } else if (IntValue > HcInt_UserCurve) { // specificmodel ++TotIntConvCoeff; @@ -1619,7 +1618,7 @@ namespace ConvectionCoefficients { UserIntConvectionCoeffs(TotIntConvCoeff).OverrideType = ConvCoefSpecifiedModel; UserIntConvectionCoeffs(TotIntConvCoeff).HcModelEq = IntValue; PotentialAssignedValue = TotIntConvCoeff; - ApplyConvectionValue(Alphas(1), "INSIDE", TotIntConvCoeff); + ApplyConvectionValue(state, Alphas(1), "INSIDE", TotIntConvCoeff); } else { // treat CeilingDiffuser and TrombeWall special @@ -1845,7 +1844,7 @@ namespace ConvectionCoefficients { SetupAdaptiveConvectionStaticMetaData(state); } - void ApplyConvectionValue(std::string const &SurfaceTypes, std::string const &ConvectionType, int const Value) + void ApplyConvectionValue(EnergyPlusData &state, std::string const &SurfaceTypes, std::string const &ConvectionType, int const Value) { // SUBROUTINE INFORMATION: @@ -1923,7 +1922,7 @@ namespace ConvectionCoefficients { for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; if (ConvectionType == "OUTSIDE") { if (Surface(SurfNum).OSCPtr > 0) continue; @@ -2147,7 +2146,7 @@ namespace ConvectionCoefficients { for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; if (ConvectionType == "OUTSIDE") { if (Surface(SurfNum).OSCPtr > 0) continue; @@ -2695,7 +2694,8 @@ namespace ConvectionCoefficients { return ACH; } - Real64 CalcCeilingDiffuserIntConvCoeff(Real64 const ACH, // [1/hr] air system air change rate + Real64 CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &EP_UNUSED(state), + Real64 const ACH, // [1/hr] air system air change rate Real64 const Tsurf, Real64 const Tair, Real64 const cosTilt, @@ -2743,7 +2743,8 @@ namespace ConvectionCoefficients { } } - void CalcCeilingDiffuserIntConvCoeff(int const ZoneNum, + void CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &state, + int const ZoneNum, const Array1D &SurfaceTemperatures) // zone number for which coefficients are being calculated { @@ -2755,18 +2756,19 @@ namespace ConvectionCoefficients { if (!Surface(SurfNum).HeatTransSurf) continue; // Skip non-heat transfer surfaces if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) { - SurfaceGeometry::kivaManager.surfaceConvMap[SurfNum].in = [=](double Tsurf, double Tamb, double, double, double cosTilt) -> double { + SurfaceGeometry::kivaManager.surfaceConvMap[SurfNum].in = [=, &state](double Tsurf, double Tamb, double, double, double cosTilt) -> double { return CalcCeilingDiffuserIntConvCoeff( - ACH, Tsurf, Tamb, cosTilt, AirHumRat, Surface(SurfNum).Height, dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow); + state, ACH, Tsurf, Tamb, cosTilt, AirHumRat, Surface(SurfNum).Height, state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow); }; } else { - HConvIn(SurfNum) = CalcCeilingDiffuserIntConvCoeff(ACH, + HConvIn(SurfNum) = CalcCeilingDiffuserIntConvCoeff(state, + ACH, SurfaceTemperatures(SurfNum), DataHeatBalFanSys::MAT(ZoneNum), Surface(SurfNum).CosTilt, AirHumRat, Surface(SurfNum).Height, - dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow); + state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow); // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems) if (HConvIn(SurfNum) < LowHConvLimit) HConvIn(SurfNum) = LowHConvLimit; } @@ -2776,7 +2778,8 @@ namespace ConvectionCoefficients { // CalcCeilingDiffuserInletCorr should replace CalcCeilingDiffuser (above), if ZoneTempPredictorCorrector can // ever be made to work correctly with the inlet air temperature. - void CalcCeilingDiffuserInletCorr(int const ZoneNum, // Zone number + void CalcCeilingDiffuserInletCorr(EnergyPlusData &state, + int const ZoneNum, // Zone number const Array1S &SurfaceTemperatures // For CalcASHRAEDetailed, if called ) { @@ -2840,7 +2843,7 @@ namespace ConvectionCoefficients { if (!Surface(SurfNum).HeatTransSurf) continue; // Skip non-heat transfer surfaces if (ACH <= 3.0) { // Use the other convection algorithm - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) { + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) { CalcASHRAEDetailedIntConvCoeff(SurfNum, SurfaceTemperatures(SurfNum), MAT(ZoneNum)); } else { CalcISO15099WindowIntConvCoeff(SurfNum, SurfaceTemperatures(SurfNum), MAT(ZoneNum)); @@ -4356,7 +4359,7 @@ namespace ConvectionCoefficients { Surface(SurfNum).CosTilt, AirHumRat, Surface(SurfNum).Height, - dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow); + state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow); } Surface(SurfNum).TAirRef = ZoneMeanAirTemp; } else if (SELECT_CASE_var == HcInt_FisherPedersenCeilDiffuserCeiling) { @@ -4374,7 +4377,7 @@ namespace ConvectionCoefficients { Surface(SurfNum).CosTilt, AirHumRat, Surface(SurfNum).Height, - dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow); + state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow); } Surface(SurfNum).TAirRef = ZoneMeanAirTemp; } else if (SELECT_CASE_var == HcInt_FisherPedersenCeilDiffuserWalls) { @@ -4392,7 +4395,7 @@ namespace ConvectionCoefficients { Surface(SurfNum).CosTilt, AirHumRat, Surface(SurfNum).Height, - dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow); + state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow); } if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) { HnFn = [=](double, double, double, double, double) -> double { return tmpHc; }; @@ -4731,7 +4734,7 @@ namespace ConvectionCoefficients { SurfWindSpeed = Surface(SurfNum).WindSpeed; } - int Roughness = dataMaterial.Material(dataConstruction.Construct(Surface(SurfNum).Construction).LayerPoint(1)).Roughness; + int Roughness = dataMaterial.Material(state.dataConstruction->Construct(Surface(SurfNum).Construction).LayerPoint(1)).Roughness; auto const SELECT_CASE_var(ForcedConvModelEqNum); @@ -6118,7 +6121,7 @@ namespace ConvectionCoefficients { if (UserCurve.HcFnTempDiffDivHeightCurveNum > 0) { HcFnTempDiffDivHeight = CurveValue(state, UserCurve.HcFnTempDiffDivHeightCurveNum, (std::abs(TH(2, 1, SurfNum) - tmpAirTemp) / Surface(SurfNum).IntConvZoneWallHeight)); - HcFnTempDiffDivHeightFn = [&](double Tsurf, double Tamb, double, double, double) -> double { + HcFnTempDiffDivHeightFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double { return CurveValue(state, UserCurve.HcFnTempDiffDivHeightCurveNum, std::abs(Tsurf - Tamb) / Surface(SurfNum).IntConvZoneWallHeight); }; } @@ -6215,7 +6218,7 @@ namespace ConvectionCoefficients { HnFnTempDiffDivHeight = CurveValue(state, UserCurve.HnFnTempDiffDivHeightCurveNum, ((std::abs(TH(1, 1, SurfNum) - Surface(SurfNum).OutDryBulbTemp)) / Surface(SurfNum).OutConvFaceHeight)); - HnFnTempDiffDivHeightFn = [&](double Tsurf, double Tamb, double, double, double) -> double { + HnFnTempDiffDivHeightFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double { return CurveValue(state, UserCurve.HnFnTempDiffDivHeightCurveNum, ((std::abs(Tsurf - Tamb)) / Surface(SurfNum).OutConvFaceHeight)); }; } @@ -8140,7 +8143,7 @@ namespace ConvectionCoefficients { Real64 x; // distance to roof edge toward wind direction - int const RoughnessIndex = dataMaterial.Material(dataConstruction.Construct(Surface(SurfNum).Construction).LayerPoint(1)).Roughness; + int const RoughnessIndex = dataMaterial.Material(state.dataConstruction->Construct(Surface(SurfNum).Construction).LayerPoint(1)).Roughness; // find x, don't know x. avoid time consuming geometry algorithm x = std::sqrt(RoofArea) / 2.0; // quick simplification, geometry routines to develop diff --git a/src/EnergyPlus/ConvectionCoefficients.hh b/src/EnergyPlus/ConvectionCoefficients.hh index 672e0d24da0..9e8344e0621 100644 --- a/src/EnergyPlus/ConvectionCoefficients.hh +++ b/src/EnergyPlus/ConvectionCoefficients.hh @@ -450,7 +450,7 @@ namespace ConvectionCoefficients { void GetUserConvectionCoefficients(EnergyPlusData &state); - void ApplyConvectionValue(std::string const &SurfaceTypes, std::string const &ConvectionType, int Value); + void ApplyConvectionValue(EnergyPlusData &state, std::string const &SurfaceTypes, std::string const &ConvectionType, int Value); Real64 CalcASHRAESimpExtConvectCoeff(int Roughness, // Integer index for roughness, relates to parameter array indices Real64 SurfWindSpeed // Current wind speed, m/s @@ -485,7 +485,8 @@ namespace ConvectionCoefficients { Real64 CalcCeilingDiffuserACH(int ZoneNum); - Real64 CalcCeilingDiffuserIntConvCoeff(Real64 ACH, // [1/hr] air system air change rate + Real64 CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &state, + Real64 ACH, // [1/hr] air system air change rate Real64 Tsurf, Real64 Tair, Real64 cosTilt, @@ -493,12 +494,13 @@ namespace ConvectionCoefficients { Real64 height, bool isWindow=false); - void CalcCeilingDiffuserIntConvCoeff(int ZoneNum, const Array1D &SurfaceTemperatures); // zone number for which coefficients are being calculated + void CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &state, int ZoneNum, const Array1D &SurfaceTemperatures); // zone number for which coefficients are being calculated // CalcCeilingDiffuserInletCorr should replace CalcCeilingDiffuser (above), if ZoneTempPredictorCorrector can // ever be made to work correctly with the inlet air temperature. - void CalcCeilingDiffuserInletCorr(int ZoneNum, // Zone number + void CalcCeilingDiffuserInletCorr(EnergyPlusData &state, + int ZoneNum, // Zone number Array1D &SurfaceTemperatures // For CalcASHRAEDetailed, if called ); diff --git a/src/EnergyPlus/CostEstimateManager.cc b/src/EnergyPlus/CostEstimateManager.cc index 7dfa9f42d46..b2797784d19 100644 --- a/src/EnergyPlus/CostEstimateManager.cc +++ b/src/EnergyPlus/CostEstimateManager.cc @@ -277,7 +277,7 @@ namespace CostEstimateManager { } ThisConstructStr = state.dataCostEstimateManager->CostLineItem(Item).ParentObjName; - ThisConstructID = UtilityRoutines::FindItem(ThisConstructStr, dataConstruction.Construct); + ThisConstructID = UtilityRoutines::FindItem(ThisConstructStr, state.dataConstruction->Construct); if (ThisConstructID == 0) { // do any surfaces have the specified construction? If not issue warning. ShowWarningError("ComponentCost:LineItem: \"" + state.dataCostEstimateManager->CostLineItem(Item).LineName + "\" Construction=\"" + state.dataCostEstimateManager->CostLineItem(Item).ParentObjName + "\", no surfaces have the Construction specified"); @@ -540,7 +540,7 @@ namespace CostEstimateManager { } else if (SELECT_CASE_var == "CONSTRUCTION") { ThisConstructStr = state.dataCostEstimateManager->CostLineItem(Item).ParentObjName; - ThisConstructID = UtilityRoutines::FindItem(ThisConstructStr, dataConstruction.Construct); + ThisConstructID = UtilityRoutines::FindItem(ThisConstructStr, state.dataConstruction->Construct); // need to determine unique surfacs... some surfaces are shared by zones and hence doubled uniqueSurfMask.dimension(TotSurfaces, true); // init to true and change duplicates to false SurfMultipleARR.dimension(TotSurfaces, 1.0); diff --git a/src/EnergyPlus/DElightManagerF.cc b/src/EnergyPlus/DElightManagerF.cc index 2a54eba6714..44c77bd5b80 100644 --- a/src/EnergyPlus/DElightManagerF.cc +++ b/src/EnergyPlus/DElightManagerF.cc @@ -334,7 +334,7 @@ namespace DElightManagerF { // Is this Surface exposed to the exterior? if (surf.ExtSolar) { // Get the index for the outside (i.e., 1st) Material Layer for this Construction - iMatlLayer = dataConstruction.Construct(iconstruct).LayerPoint(1); + iMatlLayer = state.dataConstruction->Construct(iconstruct).LayerPoint(1); // Get the outside visible reflectance of this material layer // (since Construct(iconstruct)%ReflectVisDiffFront always appears to == 0.0) rExtVisRefl = 1.0 - dataMaterial.Material(iMatlLayer).AbsorpVisible; @@ -349,7 +349,7 @@ namespace DElightManagerF { cNameWOBlanks, surf.Azimuth, surf.Tilt, - dataConstruction.Construct(iconstruct).ReflectVisDiffBack, + state.dataConstruction->Construct(iconstruct).ReflectVisDiffBack, rExtVisRefl, surf.Sides); @@ -650,14 +650,14 @@ namespace DElightManagerF { print(delightInFile, Format_921, iWndoConstIndexes(iconst) + 10000, - dataConstruction.Construct(iWndoConstIndexes(iconst)).TransDiffVis, - dataConstruction.Construct(iWndoConstIndexes(iconst)).ReflectVisDiffBack, - dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(1), - dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(2), - dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(3), - dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(4), - dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(5), - dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(6)); + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransDiffVis, + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).ReflectVisDiffBack, + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(1), + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(2), + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(3), + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(4), + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(5), + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(6)); } // Glass Type loop diff --git a/src/EnergyPlus/Data/CommonIncludes.hh b/src/EnergyPlus/Data/CommonIncludes.hh index 047e6a74685..09fa9992c1c 100644 --- a/src/EnergyPlus/Data/CommonIncludes.hh +++ b/src/EnergyPlus/Data/CommonIncludes.hh @@ -69,6 +69,7 @@ #include #include #include +#include #include #include #include @@ -81,6 +82,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/src/EnergyPlus/Data/EnergyPlusData.cc b/src/EnergyPlus/Data/EnergyPlusData.cc index f938cb66cc7..f6c87bd49fc 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.cc +++ b/src/EnergyPlus/Data/EnergyPlusData.cc @@ -72,6 +72,7 @@ namespace EnergyPlus { this->dataChillerIndirectAbsorption = std::unique_ptr(new ChillerIndirectAbsoprtionData); this->dataChillerReformulatedEIR = std::unique_ptr(new ChillerReformulatedEIRData); this->dataCondenserLoopTowers = std::unique_ptr(new CondenserLoopTowersData); + this->dataConstruction = std::unique_ptr(new ConstructionData); this->dataConvectionCoefficient = std::unique_ptr(new ConvectionCoefficientsData); this->dataCoolTower = std::unique_ptr(new CoolTowerData); this->dataCostEstimateManager = std::unique_ptr(new CostEstimateManagerData); @@ -83,6 +84,8 @@ namespace EnergyPlus { this->dataGlobal = std::unique_ptr(new DataGlobal); this->dataPipes = std::unique_ptr(new PipesData); this->dataPlantChillers = std::unique_ptr(new PlantChillersData); + this->dataVariableSpeedCoils = std::unique_ptr(new VariableSpeedCoilsData); + this->dataVentilatedSlab = std::unique_ptr(new VentilatedSlabData); this->dataWaterCoils = std::unique_ptr(new WaterCoilsData); this->dataWaterManager = std::unique_ptr(new WaterManagerData); this->dataWaterThermalTanks = std::unique_ptr(new WaterThermalTanksData); @@ -120,6 +123,7 @@ namespace EnergyPlus { this->dataChillerIndirectAbsorption->clear_state(); this->dataChillerReformulatedEIR->clear_state(); this->dataCondenserLoopTowers->clear_state(); + this->dataConstruction->clear_state(); this->dataConvectionCoefficient->clear_state(); this->dataCoolTower->clear_state(); this->dataCostEstimateManager->clear_state(); @@ -131,6 +135,8 @@ namespace EnergyPlus { this->dataGlobal->clear_state(); this->dataPipes->clear_state(); this->dataPlantChillers->clear_state(); + this->dataVariableSpeedCoils->clear_state(); + this->dataVentilatedSlab->clear_state(); this->dataWaterCoils->clear_state(); this->dataWaterManager->clear_state(); this->dataWaterThermalTanks->clear_state(); diff --git a/src/EnergyPlus/Data/EnergyPlusData.hh b/src/EnergyPlus/Data/EnergyPlusData.hh index 283c0ac89ac..4ad3118d812 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.hh +++ b/src/EnergyPlus/Data/EnergyPlusData.hh @@ -80,6 +80,7 @@ struct ChillerGasAbsorptionData; struct ChillerIndirectAbsoprtionData; struct ChillerReformulatedEIRData; struct CondenserLoopTowersData; +struct ConstructionData; struct ConvectionCoefficientsData; struct CoolTowerData; struct CostEstimateManagerData; @@ -92,6 +93,8 @@ struct ExteriorEnergyUseData; struct FansData; struct PipesData; struct PlantChillersData; +struct VariableSpeedCoilsData; +struct VentilatedSlabData; struct WaterCoilsData; struct WaterManagerData; struct WaterThermalTanksData; @@ -131,6 +134,7 @@ struct EnergyPlusData : BaseGlobalStruct { std::unique_ptr dataChillerIndirectAbsorption; std::unique_ptr dataChillerReformulatedEIR; std::unique_ptr dataCondenserLoopTowers; + std::unique_ptr dataConstruction; std::unique_ptr dataConvectionCoefficient; std::unique_ptr dataCoolTower; std::unique_ptr dataCostEstimateManager; @@ -143,6 +147,8 @@ struct EnergyPlusData : BaseGlobalStruct { std::unique_ptr dataFans; std::unique_ptr dataPipes; std::unique_ptr dataPlantChillers; + std::unique_ptr dataVariableSpeedCoils; + std::unique_ptr dataVentilatedSlab; std::unique_ptr dataWaterCoils; std::unique_ptr dataWaterManager; std::unique_ptr dataWaterThermalTanks; diff --git a/src/EnergyPlus/DataHeatBalance.cc b/src/EnergyPlus/DataHeatBalance.cc index d002250a826..0acf4e5c5d5 100644 --- a/src/EnergyPlus/DataHeatBalance.cc +++ b/src/EnergyPlus/DataHeatBalance.cc @@ -1225,7 +1225,8 @@ namespace DataHeatBalance { } } - void CheckAndSetConstructionProperties(int const ConstrNum, // Construction number to be set/checked + void CheckAndSetConstructionProperties(EnergyPlusData &state, + int const ConstrNum, // Construction number to be set/checked bool &ErrorsFound // error flag that is set when certain errors have occurred ) { @@ -1258,39 +1259,39 @@ namespace DataHeatBalance { bool ValidBGShadeBlindConst; // True if a valid window construction with between-glass shade/blind int GlassLayNum; // Glass layer number - TotLayers = dataConstruction.Construct(ConstrNum).TotLayers; + TotLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; if (TotLayers == 0) return; // error condition, hopefully caught elsewhere InsideLayer = TotLayers; - if (dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer) <= 0) return; // Error condition + if (state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer) <= 0) return; // Error condition // window screen is not allowed on inside layer - dataConstruction.Construct(ConstrNum).DayltPropPtr = 0; - InsideMaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer); + state.dataConstruction->Construct(ConstrNum).DayltPropPtr = 0; + InsideMaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer); if (InsideMaterNum != 0) { - dataConstruction.Construct(ConstrNum).InsideAbsorpVis = dataMaterial.Material(InsideMaterNum).AbsorpVisible; - dataConstruction.Construct(ConstrNum).InsideAbsorpSolar = dataMaterial.Material(InsideMaterNum).AbsorpSolar; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpVis = dataMaterial.Material(InsideMaterNum).AbsorpVisible; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar = dataMaterial.Material(InsideMaterNum).AbsorpSolar; // Following line applies only to opaque surfaces; it is recalculated later for windows. - dataConstruction.Construct(ConstrNum).ReflectVisDiffBack = 1.0 - dataMaterial.Material(InsideMaterNum).AbsorpVisible; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack = 1.0 - dataMaterial.Material(InsideMaterNum).AbsorpVisible; } - OutsideMaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(1); + OutsideMaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(1); if (OutsideMaterNum != 0) { - dataConstruction.Construct(ConstrNum).OutsideAbsorpVis = dataMaterial.Material(OutsideMaterNum).AbsorpVisible; - dataConstruction.Construct(ConstrNum).OutsideAbsorpSolar = dataMaterial.Material(OutsideMaterNum).AbsorpSolar; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpVis = dataMaterial.Material(OutsideMaterNum).AbsorpVisible; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpSolar = dataMaterial.Material(OutsideMaterNum).AbsorpSolar; } - dataConstruction.Construct(ConstrNum).TotSolidLayers = 0; - dataConstruction.Construct(ConstrNum).TotGlassLayers = 0; - dataConstruction.Construct(ConstrNum).AbsDiffShade = 0.0; + state.dataConstruction->Construct(ConstrNum).TotSolidLayers = 0; + state.dataConstruction->Construct(ConstrNum).TotGlassLayers = 0; + state.dataConstruction->Construct(ConstrNum).AbsDiffShade = 0.0; // Check if any layer is glass, gas, shade, screen or blind; if so it is considered a window construction for // purposes of error checking. - dataConstruction.Construct(ConstrNum).TypeIsWindow = false; + state.dataConstruction->Construct(ConstrNum).TypeIsWindow = false; for (Layer = 1; Layer <= TotLayers; ++Layer) { - MaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later switch (dataMaterial.Material(MaterNum).Group) { case WindowGlass: @@ -1308,21 +1309,21 @@ namespace DataHeatBalance { case ScreenEquivalentLayer: case BlindEquivalentLayer: case GapEquivalentLayer: - dataConstruction.Construct(ConstrNum).TypeIsWindow = true; + state.dataConstruction->Construct(ConstrNum).TypeIsWindow = true; } } if (InsideMaterNum == 0) return; if (OutsideMaterNum == 0) return; - if (dataConstruction.Construct(ConstrNum).TypeIsWindow) { + if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) { - dataConstruction.Construct(ConstrNum).NumCTFTerms = 0; - dataConstruction.Construct(ConstrNum).NumHistories = 0; + state.dataConstruction->Construct(ConstrNum).NumCTFTerms = 0; + state.dataConstruction->Construct(ConstrNum).NumHistories = 0; WrongMaterialsMix = false; WrongWindowLayering = false; for (Layer = 1; Layer <= TotLayers; ++Layer) { - MaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later switch (dataMaterial.Material(MaterNum).Group) { case WindowGlass: @@ -1347,26 +1348,26 @@ namespace DataHeatBalance { } if (WrongMaterialsMix) { // Illegal material for a window construction - ShowSevereError("Error: Window construction=" + dataConstruction.Construct(ConstrNum).Name + + ShowSevereError("Error: Window construction=" + state.dataConstruction->Construct(ConstrNum).Name + " has materials other than glass, gas, shade, screen, blind, complex shading, complex gap, or simple system."); ErrorsFound = true; // Do not check number of layers for BSDF type of window since that can be handled - } else if ((TotLayers > 8) && (!dataConstruction.Construct(ConstrNum).WindowTypeBSDF) && - (!dataConstruction.Construct(ConstrNum).WindowTypeEQL)) { // Too many layers for a window construction - ShowSevereError("CheckAndSetConstructionProperties: Window construction=" + dataConstruction.Construct(ConstrNum).Name + + } else if ((TotLayers > 8) && (!state.dataConstruction->Construct(ConstrNum).WindowTypeBSDF) && + (!state.dataConstruction->Construct(ConstrNum).WindowTypeEQL)) { // Too many layers for a window construction + ShowSevereError("CheckAndSetConstructionProperties: Window construction=" + state.dataConstruction->Construct(ConstrNum).Name + " has too many layers (max of 8 allowed -- 4 glass + 3 gap + 1 shading device)."); ErrorsFound = true; } else if (TotLayers == 1) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == Shade || dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowGas || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowGasMixture || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowBlind || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == Screen || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == ComplexWindowShade || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == ComplexWindowGap) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == Shade || dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowGas || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowGasMixture || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowBlind || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == Screen || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == ComplexWindowShade || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == ComplexWindowGap) { ShowSevereError( - "CheckAndSetConstructionProperties: The single-layer window construction=" + dataConstruction.Construct(ConstrNum).Name + + "CheckAndSetConstructionProperties: The single-layer window construction=" + state.dataConstruction->Construct(ConstrNum).Name + " has a gas, complex gap, shade, complex shade, screen or blind material; it should be glass of simple glazing system."); ErrorsFound = true; } @@ -1378,7 +1379,7 @@ namespace DataHeatBalance { TotShadeLayers = 0; // Includes shades, blinds, and screens TotGasLayers = 0; for (Layer = 1; Layer <= TotLayers; ++Layer) { - MaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later if (dataMaterial.Material(MaterNum).Group == WindowGlass) ++TotGlassLayers; if (dataMaterial.Material(MaterNum).Group == WindowSimpleGlazing) ++TotGlassLayers; @@ -1389,7 +1390,7 @@ namespace DataHeatBalance { dataMaterial.Material(MaterNum).Group == ComplexWindowGap) ++TotGasLayers; if (Layer < TotLayers) { - MaterNumNext = dataConstruction.Construct(ConstrNum).LayerPoint(Layer + 1); + MaterNumNext = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer + 1); // Adjacent layers of same type not allowed if (MaterNumNext == 0) continue; if (dataMaterial.Material(MaterNum).Group == dataMaterial.Material(MaterNumNext).Group) WrongWindowLayering = true; @@ -1398,34 +1399,34 @@ namespace DataHeatBalance { // It is not necessary to check rest of BSDF window structure since that is performed inside TARCOG90 routine. // That routine also allow structures which are not allowed in rest of this routine - if (dataConstruction.Construct(ConstrNum).WindowTypeBSDF) { - dataConstruction.Construct(ConstrNum).TotGlassLayers = TotGlassLayers; - dataConstruction.Construct(ConstrNum).TotSolidLayers = TotGlassLayers + TotShadeLayers; - dataConstruction.Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer)).AbsorpThermalBack; - dataConstruction.Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; + if (state.dataConstruction->Construct(ConstrNum).WindowTypeBSDF) { + state.dataConstruction->Construct(ConstrNum).TotGlassLayers = TotGlassLayers; + state.dataConstruction->Construct(ConstrNum).TotSolidLayers = TotGlassLayers + TotShadeLayers; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer)).AbsorpThermalBack; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; return; } - if (dataConstruction.Construct(ConstrNum).WindowTypeEQL) { - dataConstruction.Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer)).AbsorpThermalBack; - dataConstruction.Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; + if (state.dataConstruction->Construct(ConstrNum).WindowTypeEQL) { + state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer)).AbsorpThermalBack; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; return; } - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowGas || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowGasMixture || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers)).Group == WindowGas || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers)).Group == WindowGasMixture) + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowGas || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowGasMixture || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers)).Group == WindowGas || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers)).Group == WindowGasMixture) WrongWindowLayering = true; // Gas cannot be first or last layer if (TotShadeLayers > 1) WrongWindowLayering = true; // At most one shade, screen or blind allowed // If there is a diffusing glass layer no shade, screen or blind is allowed for (Layer = 1; Layer <= TotLayers; ++Layer) { - MaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later if (dataMaterial.Material(MaterNum).SolarDiffusing && TotShadeLayers > 0) { ErrorsFound = true; - ShowSevereError("CheckAndSetConstructionProperties: Window construction=" + dataConstruction.Construct(ConstrNum).Name); + ShowSevereError("CheckAndSetConstructionProperties: Window construction=" + state.dataConstruction->Construct(ConstrNum).Name); ShowContinueError("has diffusing glass=" + dataMaterial.Material(MaterNum).Name + " and a shade, screen or blind layer."); break; } @@ -1435,13 +1436,13 @@ namespace DataHeatBalance { if (TotGlassLayers > 1) { GlassLayNum = 0; for (Layer = 1; Layer <= TotLayers; ++Layer) { - MaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later if (dataMaterial.Material(MaterNum).Group == WindowGlass) { ++GlassLayNum; if (GlassLayNum < TotGlassLayers && dataMaterial.Material(MaterNum).SolarDiffusing) { ErrorsFound = true; - ShowSevereError("CheckAndSetConstructionProperties: Window construction=" + dataConstruction.Construct(ConstrNum).Name); + ShowSevereError("CheckAndSetConstructionProperties: Window construction=" + state.dataConstruction->Construct(ConstrNum).Name); ShowContinueError("has diffusing glass=" + dataMaterial.Material(MaterNum).Name + " that is not the innermost glass layer."); } } @@ -1449,17 +1450,17 @@ namespace DataHeatBalance { } // interior window screen is not allowed. Check for invalid between-glass screen is checked below. - if (TotShadeLayers == 1 && dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers)).Group == Screen && TotLayers != 1) { + if (TotShadeLayers == 1 && dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers)).Group == Screen && TotLayers != 1) { WrongWindowLayering = true; } // Consistency checks for a construction with a between-glass shade or blind - if (TotShadeLayers == 1 && dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != Shade && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != WindowBlind && dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != Screen && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers)).Group != Shade && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers)).Group != WindowBlind && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers)).Group != ComplexWindowShade && !WrongWindowLayering) { + if (TotShadeLayers == 1 && dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != Shade && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != WindowBlind && dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != Screen && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers)).Group != Shade && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers)).Group != WindowBlind && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers)).Group != ComplexWindowShade && !WrongWindowLayering) { // This is a construction with a between-glass shade or blind @@ -1472,48 +1473,48 @@ namespace DataHeatBalance { if (TotLayers != 5) { WrongWindowLayering = true; } else { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowGlass && - (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(2)).Group == WindowGas || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(2)).Group == WindowGasMixture) && - ((dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(3)).Group == Shade || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(3)).Group == WindowBlind) && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(3)).Group != Screen) && - (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(4)).Group == WindowGas || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(4)).Group == WindowGasMixture) && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(5)).Group == WindowGlass) + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowGlass && + (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(2)).Group == WindowGas || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(2)).Group == WindowGasMixture) && + ((dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3)).Group == Shade || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3)).Group == WindowBlind) && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3)).Group != Screen) && + (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(4)).Group == WindowGas || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(4)).Group == WindowGasMixture) && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5)).Group == WindowGlass) ValidBGShadeBlindConst = true; } } else { // TotGlassLayers = 3 if (TotLayers != 7) { WrongWindowLayering = true; } else { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowGlass && - (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(2)).Group == WindowGas || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(2)).Group == WindowGasMixture) && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(3)).Group == WindowGlass && - (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(4)).Group == WindowGas || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(4)).Group == WindowGasMixture) && - ((dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(5)).Group == Shade || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(5)).Group == WindowBlind) && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(5)).Group != Screen) && - (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(6)).Group == WindowGas || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(6)).Group == WindowGasMixture) && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(7)).Group == WindowGlass) + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowGlass && + (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(2)).Group == WindowGas || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(2)).Group == WindowGasMixture) && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3)).Group == WindowGlass && + (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(4)).Group == WindowGas || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(4)).Group == WindowGasMixture) && + ((dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5)).Group == Shade || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5)).Group == WindowBlind) && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5)).Group != Screen) && + (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(6)).Group == WindowGas || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(6)).Group == WindowGasMixture) && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(7)).Group == WindowGlass) ValidBGShadeBlindConst = true; } } // End of check if TotGlassLayers = 2 or 3 if (!ValidBGShadeBlindConst) WrongWindowLayering = true; if (!WrongWindowLayering) { LayNumSh = 2 * TotGlassLayers - 1; - MatSh = dataConstruction.Construct(ConstrNum).LayerPoint(LayNumSh); + MatSh = state.dataConstruction->Construct(ConstrNum).LayerPoint(LayNumSh); // For double pane, shade/blind must be layer #3. // For triple pane, it must be layer #5 (i.e., between two inner panes). if (dataMaterial.Material(MatSh).Group != Shade && dataMaterial.Material(MatSh).Group != WindowBlind) WrongWindowLayering = true; if (TotLayers != 2 * TotGlassLayers + 1) WrongWindowLayering = true; if (!WrongWindowLayering) { // Gas on either side of a between-glass shade/blind must be the same - MatGapL = dataConstruction.Construct(ConstrNum).LayerPoint(LayNumSh - 1); - MatGapR = dataConstruction.Construct(ConstrNum).LayerPoint(LayNumSh + 1); + MatGapL = state.dataConstruction->Construct(ConstrNum).LayerPoint(LayNumSh - 1); + MatGapR = state.dataConstruction->Construct(ConstrNum).LayerPoint(LayNumSh + 1); for (IGas = 1; IGas <= 5; ++IGas) { if ((dataMaterial.Material(MatGapL).GasType(IGas) != dataMaterial.Material(MatGapR).GasType(IGas)) || (dataMaterial.Material(MatGapL).GasFract(IGas) != dataMaterial.Material(MatGapR).GasFract(IGas))) @@ -1526,7 +1527,7 @@ namespace DataHeatBalance { if (BlNum > 0) { if ((dataMaterial.Material(MatGapL).Thickness + dataMaterial.Material(MatGapR).Thickness) < Blind(BlNum).SlatWidth) { ErrorsFound = true; - ShowSevereError("CheckAndSetConstructionProperties: For window construction " + dataConstruction.Construct(ConstrNum).Name); + ShowSevereError("CheckAndSetConstructionProperties: For window construction " + state.dataConstruction->Construct(ConstrNum).Name); ShowContinueError("the slat width of the between-glass blind is greater than"); ShowContinueError("the sum of the widths of the gas layers adjacent to the blind."); } @@ -1538,20 +1539,20 @@ namespace DataHeatBalance { } // End of check if construction has between-glass shade/blind // Check Simple Windows, - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowSimpleGlazing) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowSimpleGlazing) { if (TotLayers > 1) { // check that none of the other layers are glazing or gas for (Layer = 1; Layer <= TotLayers; ++Layer) { - MaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later if (dataMaterial.Material(MaterNum).Group == WindowGlass) { ErrorsFound = true; - ShowSevereError("CheckAndSetConstructionProperties: Error in window construction " + dataConstruction.Construct(ConstrNum).Name + "--"); + ShowSevereError("CheckAndSetConstructionProperties: Error in window construction " + state.dataConstruction->Construct(ConstrNum).Name + "--"); ShowContinueError("For simple window constructions, no other glazing layers are allowed."); } if (dataMaterial.Material(MaterNum).Group == WindowGas) { ErrorsFound = true; - ShowSevereError("CheckAndSetConstructionProperties: Error in window construction " + dataConstruction.Construct(ConstrNum).Name + "--"); + ShowSevereError("CheckAndSetConstructionProperties: Error in window construction " + state.dataConstruction->Construct(ConstrNum).Name + "--"); ShowContinueError("For simple window constructions, no other gas layers are allowed."); } } @@ -1559,7 +1560,7 @@ namespace DataHeatBalance { } if (WrongWindowLayering) { - ShowSevereError("CheckAndSetConstructionProperties: Error in window construction " + dataConstruction.Construct(ConstrNum).Name + "--"); + ShowSevereError("CheckAndSetConstructionProperties: Error in window construction " + state.dataConstruction->Construct(ConstrNum).Name + "--"); ShowContinueError(" For multi-layer window constructions the following rules apply:"); ShowContinueError(" --The first and last layer must be a solid layer (glass or shade/screen/blind),"); ShowContinueError(" --Adjacent glass layers must be separated by one and only one gas layer,"); @@ -1579,76 +1580,77 @@ namespace DataHeatBalance { ErrorsFound = true; } - dataConstruction.Construct(ConstrNum).TotGlassLayers = TotGlassLayers; - dataConstruction.Construct(ConstrNum).TotSolidLayers = TotGlassLayers + TotShadeLayers; + state.dataConstruction->Construct(ConstrNum).TotGlassLayers = TotGlassLayers; + state.dataConstruction->Construct(ConstrNum).TotSolidLayers = TotGlassLayers + TotShadeLayers; // In following, InsideLayer is layer number of inside glass and InsideAbsorpThermal applies // only to inside glass; it is corrected later in InitGlassOpticalCalculations // if construction has inside shade or blind. - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer)).Group == Shade || - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer)).Group == WindowBlind) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer)).Group == Shade || + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer)).Group == WindowBlind) { --InsideLayer; } if (InsideLayer > 0) { - InsideMaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer); - dataConstruction.Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer)).AbsorpThermalBack; + InsideMaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer); + state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer)).AbsorpThermalBack; } if (InsideMaterNum != 0) { - dataConstruction.Construct(ConstrNum).InsideAbsorpVis = dataMaterial.Material(InsideMaterNum).AbsorpVisible; - dataConstruction.Construct(ConstrNum).InsideAbsorpSolar = dataMaterial.Material(InsideMaterNum).AbsorpSolar; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpVis = dataMaterial.Material(InsideMaterNum).AbsorpVisible; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar = dataMaterial.Material(InsideMaterNum).AbsorpSolar; } - if ((dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowGlass) || - (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowSimpleGlazing)) { // Glass - dataConstruction.Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; + if ((dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowGlass) || + (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowSimpleGlazing)) { // Glass + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; } else { // Exterior shade, blind or screen - dataConstruction.Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; } } else { // Opaque surface - dataConstruction.Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer)).AbsorpThermal; - dataConstruction.Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer)).AbsorpThermal; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; } - dataConstruction.Construct(ConstrNum).OutsideRoughness = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Roughness; + state.dataConstruction->Construct(ConstrNum).OutsideRoughness = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Roughness; - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == Air) { - ShowSevereError("CheckAndSetConstructionProperties: Outside Layer is Air for construction " + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError(" Error in material " + dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Name); + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == Air) { + ShowSevereError("CheckAndSetConstructionProperties: Outside Layer is Air for construction " + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError(" Error in material " + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Name); ErrorsFound = true; } if (InsideLayer > 0) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer)).Group == Air) { - ShowSevereError("CheckAndSetConstructionProperties: Inside Layer is Air for construction " + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError(" Error in material " + dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(InsideLayer)).Name); + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer)).Group == Air) { + ShowSevereError("CheckAndSetConstructionProperties: Inside Layer is Air for construction " + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError(" Error in material " + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(InsideLayer)).Name); ErrorsFound = true; } } - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == EcoRoof) { - dataConstruction.Construct(ConstrNum).TypeIsEcoRoof = true; + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == EcoRoof) { + state.dataConstruction->Construct(ConstrNum).TypeIsEcoRoof = true; // need to check EcoRoof is not non-outside layer for (Layer = 2; Layer <= TotLayers; ++Layer) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).Group == EcoRoof) { - ShowSevereError("CheckAndSetConstructionProperties: Interior Layer is EcoRoof for construction " + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError(" Error in material " + dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).Name); + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).Group == EcoRoof) { + ShowSevereError("CheckAndSetConstructionProperties: Interior Layer is EcoRoof for construction " + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError(" Error in material " + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).Name); ErrorsFound = true; } } } - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == IRTMaterial) { - dataConstruction.Construct(ConstrNum).TypeIsIRT = true; - if (dataConstruction.Construct(ConstrNum).TotLayers != 1) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == IRTMaterial) { + state.dataConstruction->Construct(ConstrNum).TypeIsIRT = true; + if (state.dataConstruction->Construct(ConstrNum).TotLayers != 1) { ShowSevereError("CheckAndSetConstructionProperties: Infrared Transparent (IRT) Construction is limited to 1 layer " + - dataConstruction.Construct(ConstrNum).Name); + state.dataConstruction->Construct(ConstrNum).Name); ShowContinueError(" Too many layers in referenced construction."); ErrorsFound = true; } } } - int AssignReverseConstructionNumber(int const ConstrNum, // Existing Construction number of first surface + int AssignReverseConstructionNumber(EnergyPlusData &state, + int const ConstrNum, // Existing Construction number of first surface bool &ErrorsFound) { @@ -1699,12 +1701,12 @@ namespace DataHeatBalance { return NewConstrNum; } - dataConstruction.Construct(ConstrNum).IsUsed = true; + state.dataConstruction->Construct(ConstrNum).IsUsed = true; nLayer = 0; LayerPoint = 0; - for (Loop = dataConstruction.Construct(ConstrNum).TotLayers; Loop >= 1; --Loop) { + for (Loop = state.dataConstruction->Construct(ConstrNum).TotLayers; Loop >= 1; --Loop) { ++nLayer; - LayerPoint(nLayer) = dataConstruction.Construct(ConstrNum).LayerPoint(Loop); + LayerPoint(nLayer) = state.dataConstruction->Construct(ConstrNum).LayerPoint(Loop); } // now, got thru and see if there is a match already.... @@ -1712,7 +1714,7 @@ namespace DataHeatBalance { for (Loop = 1; Loop <= TotConstructs; ++Loop) { Found = true; for (nLayer = 1; nLayer <= Construction::MaxLayersInConstruct; ++nLayer) { - if (dataConstruction.Construct(Loop).LayerPoint(nLayer) != LayerPoint(nLayer)) { + if (state.dataConstruction->Construct(Loop).LayerPoint(nLayer) != LayerPoint(nLayer)) { Found = false; break; } @@ -1726,20 +1728,20 @@ namespace DataHeatBalance { // if need new one, bunch o stuff if (NewConstrNum == 0) { ++TotConstructs; - dataConstruction.Construct.redimension(TotConstructs); + state.dataConstruction->Construct.redimension(TotConstructs); NominalRforNominalUCalculation.redimension(TotConstructs); NominalRforNominalUCalculation(TotConstructs) = 0.0; NominalU.redimension(TotConstructs); NominalU(TotConstructs) = 0.0; // Put in new attributes NewConstrNum = TotConstructs; - dataConstruction.Construct(NewConstrNum).IsUsed = true; - dataConstruction.Construct(TotConstructs) = dataConstruction.Construct(ConstrNum); // preserve some of the attributes. + state.dataConstruction->Construct(NewConstrNum).IsUsed = true; + state.dataConstruction->Construct(TotConstructs) = state.dataConstruction->Construct(ConstrNum); // preserve some of the attributes. // replace others... - dataConstruction.Construct(TotConstructs).Name = "iz-" + dataConstruction.Construct(ConstrNum).Name; - dataConstruction.Construct(TotConstructs).TotLayers = dataConstruction.Construct(ConstrNum).TotLayers; + state.dataConstruction->Construct(TotConstructs).Name = "iz-" + state.dataConstruction->Construct(ConstrNum).Name; + state.dataConstruction->Construct(TotConstructs).TotLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; for (nLayer = 1; nLayer <= Construction::MaxLayersInConstruct; ++nLayer) { - dataConstruction.Construct(TotConstructs).LayerPoint(nLayer) = LayerPoint(nLayer); + state.dataConstruction->Construct(TotConstructs).LayerPoint(nLayer) = LayerPoint(nLayer); if (LayerPoint(nLayer) != 0) { NominalRforNominalUCalculation(TotConstructs) += NominalR(LayerPoint(nLayer)); } @@ -1751,7 +1753,7 @@ namespace DataHeatBalance { NominalU(TotConstructs) = 1.0 / NominalRforNominalUCalculation(TotConstructs); } - CheckAndSetConstructionProperties(TotConstructs, ErrorsFound); + CheckAndSetConstructionProperties(state, TotConstructs, ErrorsFound); } return NewConstrNum; @@ -2365,7 +2367,7 @@ namespace DataHeatBalance { return NominalUwithConvCoeffs; } - void SetFlagForWindowConstructionWithShadeOrBlindLayer() + void SetFlagForWindowConstructionWithShadeOrBlindLayer(EnergyPlusData &state) { // PURPOSE OF THIS SUBROUTINE: @@ -2413,10 +2415,10 @@ namespace DataHeatBalance { if (Surface(loopSurfNum).activeShadedConstruction == 0) continue; ConstrNum = Surface(loopSurfNum).activeShadedConstruction; - if (dataConstruction.Construct(ConstrNum).TypeIsWindow) { - NumLayers = dataConstruction.Construct(ConstrNum).TotLayers; + if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) { + NumLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; for (Layer = 1; Layer <= NumLayers; ++Layer) { - MaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); if (MaterNum == 0) continue; if (dataMaterial.Material(MaterNum).Group == Shade || dataMaterial.Material(MaterNum).Group == WindowBlind) DataSurfaces::SurfWinHasShadeOrBlindLayer(loopSurfNum) = true; diff --git a/src/EnergyPlus/DataHeatBalance.hh b/src/EnergyPlus/DataHeatBalance.hh index c112de3554b..c358f050419 100644 --- a/src/EnergyPlus/DataHeatBalance.hh +++ b/src/EnergyPlus/DataHeatBalance.hh @@ -2211,11 +2211,13 @@ namespace DataHeatBalance { void SetZoneWindDirAt(); - void CheckAndSetConstructionProperties(int ConstrNum, // Construction number to be set/checked + void CheckAndSetConstructionProperties(EnergyPlusData &state, + int ConstrNum, // Construction number to be set/checked bool &ErrorsFound // error flag that is set when certain errors have occurred ); - int AssignReverseConstructionNumber(int ConstrNum, // Existing Construction number of first surface + int AssignReverseConstructionNumber(EnergyPlusData &state, + int ConstrNum, // Existing Construction number of first surface bool &ErrorsFound); void AddVariableSlatBlind(int inBlindNumber, // current Blind Number/pointer to name @@ -2235,7 +2237,7 @@ namespace DataHeatBalance { bool &isValid // returns true if result is valid ); - void SetFlagForWindowConstructionWithShadeOrBlindLayer(); + void SetFlagForWindowConstructionWithShadeOrBlindLayer(EnergyPlusData &state); } // namespace DataHeatBalance diff --git a/src/EnergyPlus/DataSurfaces.cc b/src/EnergyPlus/DataSurfaces.cc index 3ea428f7467..c00845b0dcc 100644 --- a/src/EnergyPlus/DataSurfaces.cc +++ b/src/EnergyPlus/DataSurfaces.cc @@ -1012,7 +1012,7 @@ namespace DataSurfaces { return SurfQRadSWOutIncidentSkyDiffuse(t_SurfNum) + SurfQRadSWOutIncidentGndDiffuse(t_SurfNum) + QS(Surface(t_SurfNum).SolarEnclIndex); } - int SurfaceData::getTotLayers() const + int SurfaceData::getTotLayers(EnergyPlusData &state) const { // SUBROUTINE INFORMATION: // AUTHOR Simon Vidanovic @@ -1023,7 +1023,7 @@ namespace DataSurfaces { // PURPOSE OF THIS SUBROUTINE: // Returns total number of layer for current surface - auto &construction(dataConstruction.Construct(Construction)); + auto &construction(state.dataConstruction->Construct(Construction)); return construction.TotLayers; } diff --git a/src/EnergyPlus/DataSurfaces.hh b/src/EnergyPlus/DataSurfaces.hh index eb471069d0c..e4aeed822a9 100644 --- a/src/EnergyPlus/DataSurfaces.hh +++ b/src/EnergyPlus/DataSurfaces.hh @@ -978,7 +978,7 @@ namespace DataSurfaces { static Real64 getSWDiffuseIncident(const int t_SurfNum); - int getTotLayers() const; + int getTotLayers(EnergyPlusData &state) const; Real64 get_average_height() const; diff --git a/src/EnergyPlus/DaylightingDevices.cc b/src/EnergyPlus/DaylightingDevices.cc index a80e05affce..a36898f3a64 100644 --- a/src/EnergyPlus/DaylightingDevices.cc +++ b/src/EnergyPlus/DaylightingDevices.cc @@ -292,8 +292,8 @@ namespace DaylightingDevices { for (PipeNum = 1; PipeNum <= NumOfTDDPipes; ++PipeNum) { // Initialize optical properties TDDPipe(PipeNum).AspectRatio = TDDPipe(PipeNum).TotLength / TDDPipe(PipeNum).Diameter; - TDDPipe(PipeNum).ReflectVis = 1.0 - dataConstruction.Construct(TDDPipe(PipeNum).Construction).InsideAbsorpVis; - TDDPipe(PipeNum).ReflectSol = 1.0 - dataConstruction.Construct(TDDPipe(PipeNum).Construction).InsideAbsorpSolar; + TDDPipe(PipeNum).ReflectVis = 1.0 - state.dataConstruction->Construct(TDDPipe(PipeNum).Construction).InsideAbsorpVis; + TDDPipe(PipeNum).ReflectSol = 1.0 - state.dataConstruction->Construct(TDDPipe(PipeNum).Construction).InsideAbsorpSolar; // Calculate the beam transmittance table for visible and solar spectrum // First time thru use the visible reflectance @@ -342,8 +342,8 @@ namespace DaylightingDevices { } // Loop // Calculate the solar isotropic diffuse and horizon transmittances. These values are constant for a given TDD. - TDDPipe(PipeNum).TransSolIso = CalcTDDTransSolIso(PipeNum); - TDDPipe(PipeNum).TransSolHorizon = CalcTDDTransSolHorizon(PipeNum); + TDDPipe(PipeNum).TransSolIso = CalcTDDTransSolIso(state, PipeNum); + TDDPipe(PipeNum).TransSolHorizon = CalcTDDTransSolHorizon(state, PipeNum); // Initialize thermal properties SumTZoneLengths = 0.0; @@ -432,8 +432,8 @@ namespace DaylightingDevices { ShelfSurf = Shelf(ShelfNum).OutSurf; if (ShelfSurf > 0) { - Shelf(ShelfNum).OutReflectVis = 1.0 - dataConstruction.Construct(Shelf(ShelfNum).Construction).OutsideAbsorpVis; - Shelf(ShelfNum).OutReflectSol = 1.0 - dataConstruction.Construct(Shelf(ShelfNum).Construction).OutsideAbsorpSolar; + Shelf(ShelfNum).OutReflectVis = 1.0 - state.dataConstruction->Construct(Shelf(ShelfNum).Construction).OutsideAbsorpVis; + Shelf(ShelfNum).OutReflectSol = 1.0 - state.dataConstruction->Construct(Shelf(ShelfNum).Construction).OutsideAbsorpSolar; if (Shelf(ShelfNum).ViewFactor < 0) CalcViewFactorToShelf(ShelfNum); @@ -550,9 +550,9 @@ namespace DaylightingDevices { ErrorsFound = true; } - if (dataConstruction.Construct(Surface(SurfNum).Construction).TotGlassLayers > 1) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TotGlassLayers > 1) { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Dome " + cAlphaArgs(2) + " construction (" + - dataConstruction.Construct(Surface(SurfNum).Construction).Name + ") must have only 1 glass layer."); + state.dataConstruction->Construct(Surface(SurfNum).Construction).Name + ") must have only 1 glass layer."); ErrorsFound = true; } @@ -568,7 +568,7 @@ namespace DaylightingDevices { ErrorsFound = true; } - if (dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Dome " + cAlphaArgs(2) + " Equivalent Layer Window is not supported."); ErrorsFound = true; @@ -603,17 +603,17 @@ namespace DaylightingDevices { ErrorsFound = true; } - if (dataConstruction.Construct(Surface(SurfNum).Construction).TotGlassLayers > 1) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TotGlassLayers > 1) { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Diffuser " + cAlphaArgs(3) + " construction (" + - dataConstruction.Construct(Surface(SurfNum).Construction).Name + ") must have only 1 glass layer."); + state.dataConstruction->Construct(Surface(SurfNum).Construction).Name + ") must have only 1 glass layer."); ErrorsFound = true; } - if (dataConstruction.Construct(Surface(SurfNum).Construction).TransDiff <= 1.0e-10) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TransDiff <= 1.0e-10) { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Diffuser " + cAlphaArgs(3) + " construction (" + - dataConstruction.Construct(Surface(SurfNum).Construction).Name + ") invalid value."); + state.dataConstruction->Construct(Surface(SurfNum).Construction).Name + ") invalid value."); ShowContinueError("Diffuse solar transmittance of construction [" + - RoundSigDigits(dataConstruction.Construct(Surface(SurfNum).Construction).TransDiff, 4) + "] too small for calculations."); + RoundSigDigits(state.dataConstruction->Construct(Surface(SurfNum).Construction).TransDiff, 4) + "] too small for calculations."); ErrorsFound = true; } @@ -644,7 +644,7 @@ namespace DaylightingDevices { ErrorsFound = true; } - if (dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Diffuser " + cAlphaArgs(2) + " Equivalent Layer Window is not supported."); ErrorsFound = true; @@ -657,13 +657,13 @@ namespace DaylightingDevices { } // Construction - TDDPipe(PipeNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(4), dataConstruction.Construct); + TDDPipe(PipeNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(4), state.dataConstruction->Construct); if (TDDPipe(PipeNum).Construction == 0) { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Pipe construction " + cAlphaArgs(4) + " not found."); ErrorsFound = true; } else { - dataConstruction.Construct(TDDPipe(PipeNum).Construction).IsUsed = true; + state.dataConstruction->Construct(TDDPipe(PipeNum).Construction).IsUsed = true; } if (rNumericArgs(1) > 0) { @@ -831,7 +831,7 @@ namespace DaylightingDevices { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Window " + cAlphaArgs(2) + " must have 4 sides."); ErrorsFound = true; } - if (dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Window " + cAlphaArgs(2) + " Equivalent Layer Window is not supported."); ErrorsFound = true; @@ -897,19 +897,19 @@ namespace DaylightingDevices { // Get outside shelf construction (required if outside shelf is specified) if (cAlphaArgs(5) != "") { - ConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(5), dataConstruction.Construct); + ConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(5), state.dataConstruction->Construct); if (ConstrNum == 0) { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Outside shelf construction " + cAlphaArgs(5) + " not found."); ErrorsFound = true; - } else if (dataConstruction.Construct(ConstrNum).TypeIsWindow) { + } else if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + ": Outside shelf construction " + cAlphaArgs(5) + " must not have WindowMaterial:Glazing."); ErrorsFound = true; } else { Shelf(ShelfNum).Construction = ConstrNum; - dataConstruction.Construct(ConstrNum).IsUsed = true; + state.dataConstruction->Construct(ConstrNum).IsUsed = true; } } else { ShowSevereError(cCurrentModuleObject + " = " + cAlphaArgs(1) + @@ -936,7 +936,7 @@ namespace DaylightingDevices { Surface(SurfNum).BaseSurf = SurfNum; Surface(SurfNum).HeatTransSurf = true; Surface(SurfNum).Construction = ConstrNum; // Kludge to allow shading surface to be a heat transfer surface - dataConstruction.Construct(ConstrNum).IsUsed = true; + state.dataConstruction->Construct(ConstrNum).IsUsed = true; } } @@ -1032,7 +1032,7 @@ namespace DaylightingDevices { return CalcPipeTransBeam; } - Real64 CalcTDDTransSolIso(int const PipeNum) // TDD pipe object number + Real64 CalcTDDTransSolIso(EnergyPlusData &state, int const PipeNum) // TDD pipe object number { // SUBROUTINE INFORMATION: @@ -1084,7 +1084,7 @@ namespace DaylightingDevices { Real64 P = COSI; // Angular distribution function: P = COS(Incident Angle) for diffuse isotropic // Calculate total TDD transmittance for given angle - trans = TransTDD(PipeNum, COSI, SolarBeam); + trans = TransTDD(state, PipeNum, COSI, SolarBeam); FluxInc += P * SINI * dPH; FluxTrans += trans * P * SINI * dPH; @@ -1097,7 +1097,7 @@ namespace DaylightingDevices { return CalcTDDTransSolIso; } - Real64 CalcTDDTransSolHorizon(int const PipeNum) // TDD pipe object number + Real64 CalcTDDTransSolHorizon(EnergyPlusData &state, int const PipeNum) // TDD pipe object number { // SUBROUTINE INFORMATION: @@ -1152,7 +1152,7 @@ namespace DaylightingDevices { Real64 COSI = CosPhi * std::cos(TH - Theta); // Cosine of the incident angle // Calculate total TDD transmittance for given angle - Real64 trans = TransTDD(PipeNum, COSI, SolarBeam); // Total beam solar transmittance of TDD + Real64 trans = TransTDD(state, PipeNum, COSI, SolarBeam); // Total beam solar transmittance of TDD FluxInc += COSI * dTH; FluxTrans += trans * COSI * dTH; @@ -1163,13 +1163,14 @@ namespace DaylightingDevices { CalcTDDTransSolHorizon = FluxTrans / FluxInc; } else { // Dome is nearly horizontal and has almost no view of the horizon - CalcTDDTransSolHorizon = 0.0; // = TransTDD(PipeNum, ???, SolarBeam) ! Could change to an angle near the horizon + CalcTDDTransSolHorizon = 0.0; // = TransTDD(state, PipeNum, ???, SolarBeam) ! Could change to an angle near the horizon } return CalcTDDTransSolHorizon; } - Real64 CalcTDDTransSolAniso(int const PipeNum, // TDD pipe object number + Real64 CalcTDDTransSolAniso(EnergyPlusData &state, + int const PipeNum, // TDD pipe object number Real64 const COSI // Cosine of the incident angle ) { @@ -1238,7 +1239,7 @@ namespace DaylightingDevices { } CircumSolarRad = MultCircumSolar(DomeSurf) * SunlitFrac(TimeStep, HourOfDay, DomeSurf); - AnisoSkyTDDMult = TDDPipe(PipeNum).TransSolIso * IsoSkyRad + TransTDD(PipeNum, COSI, SolarBeam) * CircumSolarRad + + AnisoSkyTDDMult = TDDPipe(PipeNum).TransSolIso * IsoSkyRad + TransTDD(state, PipeNum, COSI, SolarBeam) * CircumSolarRad + TDDPipe(PipeNum).TransSolHorizon * HorizonRad; if (AnisoSkyMult(DomeSurf) > 0.0) { @@ -1250,7 +1251,8 @@ namespace DaylightingDevices { return CalcTDDTransSolAniso; } - Real64 TransTDD(int const PipeNum, // TDD pipe object number + Real64 TransTDD(EnergyPlusData &state, + int const PipeNum, // TDD pipe object number Real64 const COSI, // Cosine of the incident angle int const RadiationType // Radiation type flag ) @@ -1309,21 +1311,21 @@ namespace DaylightingDevices { auto const SELECT_CASE_var(RadiationType); if (SELECT_CASE_var == VisibleBeam) { - transDome = POLYF(COSI, dataConstruction.Construct(constDome).TransVisBeamCoef); + transDome = POLYF(COSI, state.dataConstruction->Construct(constDome).TransVisBeamCoef); transPipe = InterpolatePipeTransBeam(COSI, TDDPipe(PipeNum).PipeTransVisBeam); - transDiff = dataConstruction.Construct(constDiff).TransDiffVis; // May want to change to POLYF also! + transDiff = state.dataConstruction->Construct(constDiff).TransDiffVis; // May want to change to POLYF also! TransTDD = transDome * transPipe * transDiff; } else if (SELECT_CASE_var == SolarBeam) { - transDome = POLYF(COSI, dataConstruction.Construct(constDome).TransSolBeamCoef); + transDome = POLYF(COSI, state.dataConstruction->Construct(constDome).TransSolBeamCoef); transPipe = InterpolatePipeTransBeam(COSI, TDDPipe(PipeNum).PipeTransSolBeam); - transDiff = dataConstruction.Construct(constDiff).TransDiff; // May want to change to POLYF also! + transDiff = state.dataConstruction->Construct(constDiff).TransDiff; // May want to change to POLYF also! TransTDD = transDome * transPipe * transDiff; } else if (SELECT_CASE_var == SolarAniso) { - TransTDD = CalcTDDTransSolAniso(PipeNum, COSI); + TransTDD = CalcTDDTransSolAniso(state, PipeNum, COSI); } else if (SELECT_CASE_var == SolarIso) { TransTDD = TDDPipe(PipeNum).TransSolIso; @@ -1434,7 +1436,7 @@ namespace DaylightingDevices { return FindTDDPipe; } - void DistributeTDDAbsorbedSolar() + void DistributeTDDAbsorbedSolar(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -1479,7 +1481,7 @@ namespace DaylightingDevices { // FLOW: for (PipeNum = 1; PipeNum <= NumOfTDDPipes; ++PipeNum) { DiffSurf = TDDPipe(PipeNum).Diffuser; - transDiff = dataConstruction.Construct(Surface(DiffSurf).Construction).TransDiff; + transDiff = state.dataConstruction->Construct(Surface(DiffSurf).Construction).TransDiff; // Calculate diffuse solar reflected back up the pipe by the inside surface of the TDD:DIFFUSER // All solar arriving at the diffuser is assumed to be isotropically diffuse by this point diff --git a/src/EnergyPlus/DaylightingDevices.hh b/src/EnergyPlus/DaylightingDevices.hh index 2245ef70a7a..1675cc0b0e0 100644 --- a/src/EnergyPlus/DaylightingDevices.hh +++ b/src/EnergyPlus/DaylightingDevices.hh @@ -81,15 +81,17 @@ namespace DaylightingDevices { Real64 const Theta // Angle of entry in radians ); - Real64 CalcTDDTransSolIso(int const PipeNum); // TDD pipe object number + Real64 CalcTDDTransSolIso(EnergyPlusData &state, int const PipeNum); // TDD pipe object number - Real64 CalcTDDTransSolHorizon(int const PipeNum); // TDD pipe object number + Real64 CalcTDDTransSolHorizon(EnergyPlusData &state, int const PipeNum); // TDD pipe object number - Real64 CalcTDDTransSolAniso(int const PipeNum, // TDD pipe object number + Real64 CalcTDDTransSolAniso(EnergyPlusData &state, + int const PipeNum, // TDD pipe object number Real64 const COSI // Cosine of the incident angle ); - Real64 TransTDD(int const PipeNum, // TDD pipe object number + Real64 TransTDD(EnergyPlusData &state, + int const PipeNum, // TDD pipe object number Real64 const COSI, // Cosine of the incident angle int const RadiationType // Radiation type flag ); @@ -100,7 +102,7 @@ namespace DaylightingDevices { int FindTDDPipe(int const WinNum); - void DistributeTDDAbsorbedSolar(); + void DistributeTDDAbsorbedSolar(EnergyPlusData &state); void CalcViewFactorToShelf(int const ShelfNum); // Daylighting shelf object number diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index 33ff7e641d4..f831aff4a31 100644 --- a/src/EnergyPlus/DaylightingManager.cc +++ b/src/EnergyPlus/DaylightingManager.cc @@ -283,7 +283,7 @@ namespace DaylightingManager { CreateDFSReportFile = true; } - void DayltgAveInteriorReflectance(int &ZoneNum) // Zone number + void DayltgAveInteriorReflectance(EnergyPlusData &state, int &ZoneNum) // Zone number { // SUBROUTINE INFORMATION: @@ -358,7 +358,7 @@ namespace DaylightingManager { AInsTot += AREA + SurfWinFrameArea(ISurf) * (1.0 + 0.5 * SurfWinProjCorrFrIn(ISurf)) + SurfWinDividerArea(ISurf) * (1.0 + SurfWinProjCorrDivIn(ISurf)); ARHTOT += - AREA * dataConstruction.Construct(Surface(ISurf).Construction).ReflectVisDiffBack + + AREA * state.dataConstruction->Construct(Surface(ISurf).Construction).ReflectVisDiffBack + SurfWinFrameArea(ISurf) * (1.0 + 0.5 * SurfWinProjCorrFrIn(ISurf)) * (1.0 - SurfWinFrameSolAbsorp(ISurf)) + SurfWinDividerArea(ISurf) * (1.0 + SurfWinProjCorrDivIn(ISurf)) * (1.0 - SurfWinDividerSolAbsorp(ISurf)); ITILT = 3; // Ceiling @@ -367,7 +367,7 @@ namespace DaylightingManager { AR(ITILT) += AREA + SurfWinFrameArea(ISurf) * (1.0 + 0.5 * SurfWinProjCorrFrIn(ISurf)) + SurfWinDividerArea(ISurf) * (1.0 + SurfWinProjCorrDivIn(ISurf)); ARH(ITILT) += - AREA * dataConstruction.Construct(Surface(ISurf).Construction).ReflectVisDiffBack + + AREA * state.dataConstruction->Construct(Surface(ISurf).Construction).ReflectVisDiffBack + SurfWinFrameArea(ISurf) * (1.0 + 0.5 * SurfWinProjCorrFrIn(ISurf)) * (1.0 - SurfWinFrameSolAbsorp(ISurf)) + SurfWinDividerArea(ISurf) * (1.0 + SurfWinProjCorrDivIn(ISurf)) * (1.0 - SurfWinDividerSolAbsorp(ISurf)); } @@ -388,7 +388,7 @@ namespace DaylightingManager { // Initialize gross area of surface (including subsurfaces) ATWL = Surface(ISurf).Area; // This is the surface area less subsurfaces // Area * reflectance for this surface, excluding attached windows and doors - ARHTWL = Surface(ISurf).Area * dataConstruction.Construct(Surface(ISurf).Construction).ReflectVisDiffBack; + ARHTWL = Surface(ISurf).Area * state.dataConstruction->Construct(Surface(ISurf).Construction).ReflectVisDiffBack; // Tilt index if (Surface(ISurf).Tilt > 45.0 && Surface(ISurf).Tilt < 135.0) { ITILT = 2; // Wall @@ -403,7 +403,7 @@ namespace DaylightingManager { Surface(IWinDr).BaseSurf == ISurf) { ATWL += Surface(IWinDr).Area + SurfWinFrameArea(IWinDr) * (1.0 + 0.5 * SurfWinProjCorrFrIn(IWinDr)) + SurfWinDividerArea(IWinDr) * (1.0 + SurfWinProjCorrDivIn(IWinDr)); - ARHTWL += Surface(IWinDr).Area * dataConstruction.Construct(Surface(IWinDr).Construction).ReflectVisDiffBack + + ARHTWL += Surface(IWinDr).Area * state.dataConstruction->Construct(Surface(IWinDr).Construction).ReflectVisDiffBack + SurfWinFrameArea(IWinDr) * (1.0 + 0.5 * SurfWinProjCorrFrIn(IWinDr)) * (1.0 - SurfWinFrameSolAbsorp(IWinDr)) + SurfWinDividerArea(IWinDr) * (1.0 + SurfWinProjCorrDivIn(IWinDr)) * @@ -617,7 +617,7 @@ namespace DaylightingManager { // but with adjacent zones having daylighting controls. if ((ZoneDaylight(ZoneNum).TotalDaylRefPoints > 0 && ZoneDaylight(ZoneNum).NumOfDayltgExtWins > 0) || ZoneDaylight(ZoneNum).AdjZoneHasDayltgCtrl) { - DayltgAveInteriorReflectance(ZoneNum); + DayltgAveInteriorReflectance(state, ZoneNum); } } } @@ -1109,7 +1109,8 @@ namespace DaylightingManager { // ------------- for (loopwin = 1; loopwin <= ZoneDaylight(ZoneNum).NumOfDayltgExtWins; ++loopwin) { - FigureDayltgCoeffsAtPointsSetupForWindow(ZoneNum, + FigureDayltgCoeffsAtPointsSetupForWindow(state, + ZoneNum, IL, loopwin, CalledForRefPoint, @@ -1519,7 +1520,8 @@ namespace DaylightingManager { for (loopwin = 1; loopwin <= ZoneDaylight(ZoneNum).NumOfDayltgExtWins; ++loopwin) { - FigureDayltgCoeffsAtPointsSetupForWindow(ZoneNum, + FigureDayltgCoeffsAtPointsSetupForWindow(state, + ZoneNum, IL, loopwin, CalledForMapPoint, @@ -1735,7 +1737,8 @@ namespace DaylightingManager { } // MapNum } - void FigureDayltgCoeffsAtPointsSetupForWindow(int const ZoneNum, + void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, + int const ZoneNum, int const iRefPoint, int const loopwin, int const CalledFrom, // indicate which type of routine called this routine @@ -1874,9 +1877,9 @@ namespace DaylightingManager { // at base TC layer temperature. During each time step calculations at DayltgInteriorIllum, // DayltgInteriorMapIllum, and DayltgGlare, the daylight and glare factors are adjusted by the visible // transmittance ratio = VT of actual TC window based on last hour TC layer temperature / VT of the base TC window - if (dataConstruction.Construct(IConst).TCFlag == 1) { + if (state.dataConstruction->Construct(IConst).TCFlag == 1) { // For thermochromic windows, use the base window construction at base temperature of the TC layer - IConst = dataConstruction.Construct(IConst).TCMasterConst; + IConst = state.dataConstruction->Construct(IConst).TCMasterConst; } ICtrl = Surface(IWin).activeWindowShadingControl; @@ -1916,7 +1919,7 @@ namespace DaylightingManager { LSHCAL = 0; // Visible transmittance at normal incidence - SurfWinVisTransSelected(IWin) = POLYF(1.0, dataConstruction.Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); + SurfWinVisTransSelected(IWin) = POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); // For windows with switchable glazing, ratio of visible transmittance at normal // incidence for fully switched (dark) state to that of unswitched state SurfWinVisTransRatio(IWin) = 1.0; @@ -1924,7 +1927,7 @@ namespace DaylightingManager { if (ShType == WSC_ST_SwitchableGlazing) { IConstShaded = Surface(IWin).activeShadedConstruction; SurfWinVisTransRatio(IWin) = - SafeDivide(POLYF(1.0, dataConstruction.Construct(IConstShaded).TransVisBeamCoef), POLYF(1.0, dataConstruction.Construct(IConst).TransVisBeamCoef)); + SafeDivide(POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef), POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef)); } } @@ -2357,12 +2360,12 @@ namespace DaylightingManager { // Look up the TDD:DOME object PipeNum = SurfWinTDDPipeNum(IWin); // Unshaded visible transmittance of TDD for a single ray from sky/ground element - TVISB = TransTDD(PipeNum, COSB, VisibleBeam) * SurfWinGlazedFrac(IWin); + TVISB = TransTDD(state, PipeNum, COSB, VisibleBeam) * SurfWinGlazedFrac(IWin); } else { // Regular window if (SurfWinWindowModelType(IWin) != WindowBSDFModel) { // Vis trans of glass for COSB incidence angle - TVISB = POLYF(COSB, dataConstruction.Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); + TVISB = POLYF(COSB, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); } else { // Complex fenestration needs to use different equation for visible transmittance. That will be calculated later // in the code since it depends on different incoming directions. For now, just put zero to differentiate from @@ -2383,7 +2386,7 @@ namespace DaylightingManager { IntWinHitNum = 0; continue; } - TVISIntWin = POLYF(COSBIntWin, dataConstruction.Construct(Surface(IntWin).Construction).TransVisBeamCoef); + TVISIntWin = POLYF(COSBIntWin, state.dataConstruction->Construct(Surface(IntWin).Construction).TransVisBeamCoef); TVISB *= TVISIntWin; break; // Ray passes thru interior window; exit from DO loop } @@ -3521,9 +3524,9 @@ namespace DaylightingManager { if (SurfWinWindowModelType(IWin) != WindowBSDFModel) { if (LSHCAL == 1) DayltgInterReflectedIllum(state, ISunPos, iHour, ZoneNum, IWin2); } else { - if (LSHCAL == 1) DayltgInterReflectedIllumComplexFenestration(IWin2, WinEl, iHour, ZoneNum, iRefPoint, CalledFrom, MapNum); + if (LSHCAL == 1) DayltgInterReflectedIllumComplexFenestration(state, IWin2, WinEl, iHour, ZoneNum, iRefPoint, CalledFrom, MapNum); if (COSB <= 0.0) return; - DayltgDirectIllumComplexFenestration(IWin, WinEl, iHour, ZoneNum, iRefPoint, CalledFrom, MapNum); + DayltgDirectIllumComplexFenestration(state, IWin, WinEl, iHour, ZoneNum, iRefPoint, CalledFrom, MapNum); // Call direct sun component only once since calculation is done for entire window if (WinEl == (NWX * NWY)) { DayltgDirectSunDiskComplexFenestration( @@ -3569,7 +3572,7 @@ namespace DaylightingManager { // Beam solar reflected from nearest obstruction - DayltgSurfaceLumFromSun(iHour, Ray, NearestHitSurfNum, NearestHitPt, LumAtHitPtFrSun); + DayltgSurfaceLumFromSun(state, iHour, Ray, NearestHitSurfNum, NearestHitPt, LumAtHitPtFrSun); AVWLSU(iHour, 1) += LumAtHitPtFrSun * TVISB; if (PHRAY >= 0.0) EDIRSU(iHour, 1) += LumAtHitPtFrSun * DOMEGA_Ray_3 * TVISB; @@ -3578,13 +3581,13 @@ namespace DaylightingManager { ObsConstrNum = Surface(NearestHitSurfNum).Construction; if (ObsConstrNum > 0) { // Exterior building surface is nearest hit - if (!dataConstruction.Construct(ObsConstrNum).TypeIsWindow) { + if (!state.dataConstruction->Construct(ObsConstrNum).TypeIsWindow) { // Obstruction is not a window, i.e., is an opaque surface - ObsVisRefl = 1.0 - dataMaterial.Material(dataConstruction.Construct(ObsConstrNum).LayerPoint(1)).AbsorpVisible; + ObsVisRefl = 1.0 - dataMaterial.Material(state.dataConstruction->Construct(ObsConstrNum).LayerPoint(1)).AbsorpVisible; } else { // Obstruction is a window; assume it is bare if (SurfWinStormWinFlag(NearestHitSurfNum) == 1) ObsConstrNum = Surface(NearestHitSurfNum).StormWinConstruction; - ObsVisRefl = dataConstruction.Construct(ObsConstrNum).ReflectVisDiffFront; + ObsVisRefl = state.dataConstruction->Construct(ObsConstrNum).ReflectVisDiffFront; } } else { // Shadowing surface is nearest hit @@ -3595,7 +3598,7 @@ namespace DaylightingManager { ObsVisRefl = Surface(NearestHitSurfNum).ShadowSurfDiffuseVisRefl; if (Surface(NearestHitSurfNum).ShadowSurfGlazingConstruct > 0) ObsVisRefl += Surface(NearestHitSurfNum).ShadowSurfGlazingFrac * - dataConstruction.Construct(Surface(NearestHitSurfNum).ShadowSurfGlazingConstruct).ReflectVisDiffFront; + state.dataConstruction->Construct(Surface(NearestHitSurfNum).ShadowSurfGlazingConstruct).ReflectVisDiffFront; } } NearestHitSurfNumX = NearestHitSurfNum; @@ -3751,7 +3754,7 @@ namespace DaylightingManager { IntWinDiskHitNum = 0; continue; } - TVISIntWinDisk = POLYF(COSBIntWin, dataConstruction.Construct(Surface(IntWinDisk).Construction).TransVisBeamCoef); + TVISIntWinDisk = POLYF(COSBIntWin, state.dataConstruction->Construct(Surface(IntWinDisk).Construction).TransVisBeamCoef); break; } } @@ -3810,7 +3813,7 @@ namespace DaylightingManager { } else { // Beam transmittance for bare window and all types of blinds TVISS = - POLYF(COSI, dataConstruction.Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); + POLYF(COSI, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); if (ExtWinType == AdjZoneExtWin && hitIntWinDisk) TVISS *= TVISIntWinDisk; } @@ -3973,13 +3976,13 @@ namespace DaylightingManager { if (Surface(ReflSurfNum).Class == SurfaceClass_Window) { ConstrNumRefl = Surface(ReflSurfNum).Construction; if (SurfWinStormWinFlag(ReflSurfNum) == 1) ConstrNumRefl = Surface(ReflSurfNum).StormWinConstruction; - SpecReflectance = POLYF(std::abs(CosIncAngRefl), dataConstruction.Construct(ConstrNumRefl).ReflSolBeamFrontCoef); + SpecReflectance = POLYF(std::abs(CosIncAngRefl), state.dataConstruction->Construct(ConstrNumRefl).ReflSolBeamFrontCoef); } if (Surface(ReflSurfNum).ShadowingSurf && Surface(ReflSurfNum).ShadowSurfGlazingConstruct > 0) SpecReflectance = Surface(ReflSurfNum).ShadowSurfGlazingFrac * POLYF(std::abs(CosIncAngRefl), - dataConstruction.Construct(Surface(ReflSurfNum).ShadowSurfGlazingConstruct).ReflSolBeamFrontCoef); - TVisRefl = POLYF(CosIncAngRec, dataConstruction.Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * + state.dataConstruction->Construct(Surface(ReflSurfNum).ShadowSurfGlazingConstruct).ReflSolBeamFrontCoef); + TVisRefl = POLYF(CosIncAngRec, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); EDIRSUdisk(iHour, 1) += SunVecMir(3) * SpecReflectance * TVisRefl; // Bare window @@ -6223,7 +6226,7 @@ namespace DaylightingManager { } } - void DayltgInteriorIllum(int &ZoneNum) // Zone number + void DayltgInteriorIllum(EnergyPlusData &state, int &ZoneNum) // Zone number { // SUBROUTINE INFORMATION: @@ -6395,13 +6398,13 @@ namespace DaylightingManager { VTRatio = 1.0; if (NREFPT > 0) { IConst = Surface(IWin).Construction; - if (dataConstruction.Construct(IConst).TCFlag == 1) { + if (state.dataConstruction->Construct(IConst).TCFlag == 1) { // For thermochromic windows, daylight and glare factors are always calculated // based on the master construction. They need to be adjusted by the VTRatio, including: // ZoneDaylight()%DaylIllFacSky, DaylIllFacSun, DaylIllFacSunDisk; DaylBackFacSky, // DaylBackFacSun, DaylBackFacSunDisk, DaylSourceFacSky, DaylSourceFacSun, DaylSourceFacSunDisk - VTNow = POLYF(1.0, dataConstruction.Construct(IConst).TransVisBeamCoef); - VTMaster = POLYF(1.0, dataConstruction.Construct(dataConstruction.Construct(IConst).TCMasterConst).TransVisBeamCoef); + VTNow = POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef); + VTMaster = POLYF(1.0, state.dataConstruction->Construct(state.dataConstruction->Construct(IConst).TCMasterConst).TransVisBeamCoef); VTRatio = VTNow / VTMaster; } } @@ -6767,11 +6770,11 @@ namespace DaylightingManager { IConst = Surface(IWin).Construction; if (SurfWinStormWinFlag(IWin) == 1) IConst = Surface(IWin).StormWinConstruction; // Vis trans at normal incidence of unswitched glass - TVIS1(igroup) = POLYF(1.0, dataConstruction.Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); + TVIS1(igroup) = POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); // Vis trans at normal incidence of fully switched glass IConstShaded = Surface(IWin).activeShadedConstruction; - TVIS2(igroup) = POLYF(1.0, dataConstruction.Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); + TVIS2(igroup) = POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); // Reset shading flag to indicate that window is shaded by being partially or fully switched SurfWinShadingFlag(IWin) = SwitchableGlazing; @@ -6925,11 +6928,11 @@ namespace DaylightingManager { IConst = Surface(IWin).Construction; // Vis trans at normal incidence of unswitched glass - TVIS1(igroup) = POLYF(1.0, dataConstruction.Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); + TVIS1(igroup) = POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); // Vis trans at normal incidence of fully switched glass IConstShaded = Surface(IWin).activeShadedConstruction; - TVIS2(igroup) = POLYF(1.0, dataConstruction.Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); + TVIS2(igroup) = POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); } } } @@ -7917,7 +7920,7 @@ namespace DaylightingManager { if (NearestHitSurfNum > 0) { // Beam solar reflected from nearest obstruction. - DayltgSurfaceLumFromSun(IHR, U, NearestHitSurfNum, NearestHitPt, LumAtHitPtFrSun); + DayltgSurfaceLumFromSun(state, IHR, U, NearestHitSurfNum, NearestHitPt, LumAtHitPtFrSun); ZSUObsRefl = LumAtHitPtFrSun * COSB * DA; ZSU += ZSUObsRefl; @@ -7925,14 +7928,14 @@ namespace DaylightingManager { ObsConstrNum = Surface(NearestHitSurfNum).Construction; if (ObsConstrNum > 0) { // Exterior building surface is nearest hit - if (!dataConstruction.Construct(ObsConstrNum).TypeIsWindow) { + if (!state.dataConstruction->Construct(ObsConstrNum).TypeIsWindow) { // Obstruction is not a window, i.e., is an opaque surface - ObsVisRefl = 1.0 - dataMaterial.Material(dataConstruction.Construct(ObsConstrNum).LayerPoint(1)).AbsorpVisible; + ObsVisRefl = 1.0 - dataMaterial.Material(state.dataConstruction->Construct(ObsConstrNum).LayerPoint(1)).AbsorpVisible; } else { // Obstruction is a window; assume it is bare if (SurfWinStormWinFlag(NearestHitSurfNum) == 1) ObsConstrNum = Surface(NearestHitSurfNum).StormWinConstruction; - ObsVisRefl = dataConstruction.Construct(ObsConstrNum).ReflectVisDiffFront; + ObsVisRefl = state.dataConstruction->Construct(ObsConstrNum).ReflectVisDiffFront; } } else { // Shadowing surface is nearest hit @@ -7943,7 +7946,7 @@ namespace DaylightingManager { ObsVisRefl = Surface(NearestHitSurfNum).ShadowSurfDiffuseVisRefl; if (Surface(NearestHitSurfNum).ShadowSurfGlazingConstruct > 0) ObsVisRefl += Surface(NearestHitSurfNum).ShadowSurfGlazingFrac * - dataConstruction.Construct(Surface(NearestHitSurfNum).ShadowSurfGlazingConstruct).ReflectVisDiffFront; + state.dataConstruction->Construct(Surface(NearestHitSurfNum).ShadowSurfGlazingConstruct).ReflectVisDiffFront; // Note in the above that ShadowSurfDiffuseVisRefl is the reflectance of opaque part of // shadowing surface times (1 - ShadowSurfGlazingFrac) } @@ -7975,7 +7978,7 @@ namespace DaylightingManager { if (SurfWinOriginalClass(IWin) == SurfaceClass_TDD_Dome) { // Unshaded visible transmittance of TDD for a single ray from sky/ground element - TVISBR = TransTDD(PipeNum, COSB, VisibleBeam) * SurfWinGlazedFrac(IWin); + TVISBR = TransTDD(state, PipeNum, COSB, VisibleBeam) * SurfWinGlazedFrac(IWin); // Make all transmitted light diffuse for a TDD with a bare diffuser for (ISky = 1; ISky <= 4; ++ISky) { @@ -8001,7 +8004,7 @@ namespace DaylightingManager { } else { // Bare window // Transmittance of bare window for this sky/ground element - TVISBR = POLYF(COSB, dataConstruction.Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); + TVISBR = POLYF(COSB, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); if (InShelfSurf > 0) { // Inside daylighting shelf // Daylighting shelf simplification: All light is diffuse @@ -8029,7 +8032,7 @@ namespace DaylightingManager { // cosine of incidence angle of light from sky or ground element for COSBintWin = SPH * std::sin(SurfWinPhi(IntWinNum)) + CPH * std::cos(SurfWinPhi(IntWinNum)) * std::cos(TH - SurfWinTheta(IntWinNum)); - TVISBR *= POLYF(COSBintWin, dataConstruction.Construct(Surface(IntWinNum).Construction).TransVisBeamCoef); + TVISBR *= POLYF(COSBintWin, state.dataConstruction->Construct(Surface(IntWinNum).Construction).TransVisBeamCoef); break; } } @@ -8096,19 +8099,19 @@ namespace DaylightingManager { if (ShadeOn) { // Shade if (SurfWinOriginalClass(IWin) == SurfaceClass_TDD_Dome) { // Shaded visible transmittance of TDD for a single ray from sky/ground element - TransMult(1) = TransTDD(PipeNum, COSB, VisibleBeam) * SurfWinGlazedFrac(IWin); + TransMult(1) = TransTDD(state, PipeNum, COSB, VisibleBeam) * SurfWinGlazedFrac(IWin); } else { // Shade only, no TDD // Calculate transmittance of the combined window and shading device for this sky/ground element - TransMult(1) = POLYF(COSB, dataConstruction.Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * + TransMult(1) = POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); } } else if (ScreenOn) { // Screen: get beam-beam, beam-diffuse and diffuse-diffuse vis trans/ref of screen and glazing system CalcScreenTransmittance(IWin, (PH - SurfWinPhi(IWin)), (TH - SurfWinTheta(IWin))); - ReflGlDiffDiffFront = dataConstruction.Construct(IConst).ReflectVisDiffFront; + ReflGlDiffDiffFront = state.dataConstruction->Construct(IConst).ReflectVisDiffFront; ReflScDiffDiffBack = SurfaceScreens(SurfWinScreenNumber(IWin)).DifReflectVis; TransScBmDiffFront = SurfaceScreens(SurfWinScreenNumber(IWin)).BmDifTransVis; - TransMult(1) = TransScBmDiffFront * SurfWinGlazedFrac(IWin) * dataConstruction.Construct(IConst).TransDiffVis / + TransMult(1) = TransScBmDiffFront * SurfWinGlazedFrac(IWin) * state.dataConstruction->Construct(IConst).TransDiffVis / (1 - ReflGlDiffDiffFront * ReflScDiffDiffBack) * SurfWinLightWellEff(IWin); TransBmBmMult(1) = SurfaceScreens(SurfWinScreenNumber(IWin)).BmBmTransVis; @@ -8124,7 +8127,7 @@ namespace DaylightingManager { TransBlBmDiffFront = InterpProfAng(ProfAng, Blind(BlNum).VisFrontBeamDiffTrans(JB, {1, 37})); if (ShType == WSC_ST_InteriorBlind) { // Interior blind - ReflGlDiffDiffBack = dataConstruction.Construct(IConst).ReflectVisDiffBack; + ReflGlDiffDiffBack = state.dataConstruction->Construct(IConst).ReflectVisDiffBack; ReflBlBmDiffFront = InterpProfAng(ProfAng, Blind(BlNum).VisFrontBeamDiffRefl(JB, {1, 37})); ReflBlDiffDiffFront = Blind(BlNum).VisFrontDiffDiffRefl(JB); TransBlDiffDiffFront = Blind(BlNum).VisFrontDiffDiffTrans(JB); @@ -8132,28 +8135,28 @@ namespace DaylightingManager { (1.0 - ReflBlDiffDiffFront * ReflGlDiffDiffBack)); } else if (ShType == WSC_ST_ExteriorBlind) { // Exterior blind - ReflGlDiffDiffFront = dataConstruction.Construct(IConst).ReflectVisDiffFront; + ReflGlDiffDiffFront = state.dataConstruction->Construct(IConst).ReflectVisDiffFront; ReflBlDiffDiffBack = Blind(BlNum).VisBackDiffDiffRefl(JB); - TransMult(JB) = TransBlBmDiffFront * SurfWinGlazedFrac(IWin) * dataConstruction.Construct(IConst).TransDiffVis / + TransMult(JB) = TransBlBmDiffFront * SurfWinGlazedFrac(IWin) * state.dataConstruction->Construct(IConst).TransDiffVis / (1.0 - ReflGlDiffDiffFront * ReflBlDiffDiffBack) * SurfWinLightWellEff(IWin); } else { // Between-glass blind - t1 = POLYF(COSB, dataConstruction.Construct(IConst).tBareVisCoef({1, 6}, 1)); - td2 = dataConstruction.Construct(IConst).tBareVisDiff(2); - rbd1 = dataConstruction.Construct(IConst).rbBareVisDiff(1); - rfd2 = dataConstruction.Construct(IConst).rfBareVisDiff(2); + t1 = POLYF(COSB, state.dataConstruction->Construct(IConst).tBareVisCoef({1, 6}, 1)); + td2 = state.dataConstruction->Construct(IConst).tBareVisDiff(2); + rbd1 = state.dataConstruction->Construct(IConst).rbBareVisDiff(1); + rfd2 = state.dataConstruction->Construct(IConst).rfBareVisDiff(2); tfshBd = InterpProfAng(ProfAng, Blind(BlNum).VisFrontBeamDiffTrans(JB, {1, 37})); tfshd = Blind(BlNum).VisFrontDiffDiffTrans(JB); rfshB = InterpProfAng(ProfAng, Blind(BlNum).VisFrontBeamDiffRefl(JB, {1, 37})); rbshd = Blind(BlNum).VisFrontDiffDiffRefl(JB); - if (dataConstruction.Construct(IConst).TotGlassLayers == 2) { // 2 glass layers + if (state.dataConstruction->Construct(IConst).TotGlassLayers == 2) { // 2 glass layers TransMult(JB) = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * SurfWinLightWellEff(IWin); } else { // 3 glass layers; blind between layers 2 and 3 - t2 = POLYF(COSB, dataConstruction.Construct(IConst).tBareVisCoef({1, 6}, 2)); - td3 = dataConstruction.Construct(IConst).tBareVisDiff(3); - rfd3 = dataConstruction.Construct(IConst).rfBareVisDiff(3); - rbd2 = dataConstruction.Construct(IConst).rbBareVisDiff(2); + t2 = POLYF(COSB, state.dataConstruction->Construct(IConst).tBareVisCoef({1, 6}, 2)); + td3 = state.dataConstruction->Construct(IConst).tBareVisDiff(3); + rfd3 = state.dataConstruction->Construct(IConst).rfBareVisDiff(3); + rbd2 = state.dataConstruction->Construct(IConst).rbBareVisDiff(2); TransMult(JB) = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * SurfWinLightWellEff(IWin); } @@ -8171,7 +8174,7 @@ namespace DaylightingManager { } else { // Diffusing glass TransMult(1) = - POLYF(COSB, dataConstruction.Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); + POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); } // End of check if shade, blind or diffusing glass if (SurfWinOriginalClass(IWin) == SurfaceClass_TDD_Dome) { @@ -8215,7 +8218,7 @@ namespace DaylightingManager { // Add exterior diffuse illuminance due to outside shelf // Since all of the illuminance is added to the zone as upgoing diffuse, it can be added as a lump sum here - TVISBR = dataConstruction.Construct(IConst).TransDiffVis; // Assume diffuse transmittance for shelf illuminance + TVISBR = state.dataConstruction->Construct(IConst).TransDiffVis; // Assume diffuse transmittance for shelf illuminance for (ISky = 1; ISky <= 4; ++ISky) { // This is only an estimate because the anisotropic sky view of the shelf is not yet taken into account. @@ -8270,7 +8273,7 @@ namespace DaylightingManager { if (SurfWinOriginalClass(IWin) == SurfaceClass_TDD_Dome) { // Unshaded visible transmittance of TDD for collimated beam from the sun - TVISBSun = TransTDD(PipeNum, COSBSun, VisibleBeam) * SurfWinGlazedFrac(IWin); + TVISBSun = TransTDD(state, PipeNum, COSBSun, VisibleBeam) * SurfWinGlazedFrac(IWin); TDDTransVisBeam(IHR, PipeNum) = TVISBSun; FLFWSUdisk(1) = 0.0; // Diffuse light only @@ -8280,7 +8283,7 @@ namespace DaylightingManager { FLCWSU(1) += ZSU1 * TVISBSun * SurfWinFractionUpgoing(IWin); } else { // Bare window - TVISBSun = POLYF(COSBSun, dataConstruction.Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); + TVISBSun = POLYF(COSBSun, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); // Daylighting shelf simplification: No beam makes it past end of shelf, all light is diffuse if (InShelfSurf > 0) { // Inside daylighting shelf @@ -8309,13 +8312,13 @@ namespace DaylightingManager { if (ShadeOn || ScreenOn || SurfWinSolarDiffusing(IWin)) { // Shade or screen on or diffusing glass if (SurfWinOriginalClass(IWin) == SurfaceClass_TDD_Dome) { // Shaded visible transmittance of TDD for collimated beam from the sun - TransMult(1) = TransTDD(PipeNum, COSBSun, VisibleBeam) * SurfWinGlazedFrac(IWin); + TransMult(1) = TransTDD(state, PipeNum, COSBSun, VisibleBeam) * SurfWinGlazedFrac(IWin); } else { if (ScreenOn) { TransMult(1) = SurfaceScreens(SurfWinScreenNumber(IWin)).BmBmTransVis * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); } else { - TransMult(1) = POLYF(COSBSun, dataConstruction.Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * + TransMult(1) = POLYF(COSBSun, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); } } @@ -8345,18 +8348,18 @@ namespace DaylightingManager { } else if (ShType == WSC_ST_ExteriorBlind) { // Exterior blind TransMult(JB) = TransBlBmDiffFront * - (dataConstruction.Construct(IConst).TransDiffVis / (1.0 - ReflGlDiffDiffFront * Blind(BlNum).VisBackDiffDiffRefl(JB))) * + (state.dataConstruction->Construct(IConst).TransDiffVis / (1.0 - ReflGlDiffDiffFront * Blind(BlNum).VisBackDiffDiffRefl(JB))) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); } else { // Between-glass blind - t1 = POLYF(COSBSun, dataConstruction.Construct(IConst).tBareVisCoef({1, 6}, 1)); + t1 = POLYF(COSBSun, state.dataConstruction->Construct(IConst).tBareVisCoef({1, 6}, 1)); tfshBd = InterpProfAng(ProfAng, Blind(BlNum).VisFrontBeamDiffTrans(JB, {1, 37})); rfshB = InterpProfAng(ProfAng, Blind(BlNum).VisFrontBeamDiffRefl(JB, {1, 37})); - if (dataConstruction.Construct(IConst).TotGlassLayers == 2) { // 2 glass layers + if (state.dataConstruction->Construct(IConst).TotGlassLayers == 2) { // 2 glass layers TransMult(JB) = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * SurfWinLightWellEff(IWin); } else { // 3 glass layers; blind between layers 2 and 3 - t2 = POLYF(COSBSun, dataConstruction.Construct(IConst).tBareVisCoef({1, 6}, 2)); + t2 = POLYF(COSBSun, state.dataConstruction->Construct(IConst).tBareVisCoef({1, 6}, 2)); TransMult(JB) = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * SurfWinLightWellEff(IWin); } @@ -8405,7 +8408,7 @@ namespace DaylightingManager { // -- Bare window. We use diffuse-diffuse transmittance here rather than beam-beam to avoid // complications due to specular reflection from multiple exterior surfaces - TVisSunRefl = dataConstruction.Construct(IConst).TransDiffVis * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); + TVisSunRefl = state.dataConstruction->Construct(IConst).TransDiffVis * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); // In the following it is assumed that all reflected beam is going downward, as it would be in the // important case of reflection from a highly glazed facade of a neighboring building. However, in // rare cases (such as upward specular reflection from a flat horizontal skylight) it may @@ -8422,12 +8425,12 @@ namespace DaylightingManager { if (!SurfWinMovableSlats(IWin) && JB > 1) break; if (ShadeOn || SurfWinSolarDiffusing(IWin)) { // Shade on or diffusing glass - TransMult(1) = dataConstruction.Construct(IConstShaded).TransDiffVis * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); + TransMult(1) = state.dataConstruction->Construct(IConstShaded).TransDiffVis * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); } else if (ScreenOn) { // Exterior screen on TransScDiffDiffFront = SurfaceScreens(SurfWinScreenNumber(IWin)).DifDifTransVis; TransMult(1) = TransScDiffDiffFront * - (dataConstruction.Construct(IConst).TransDiffVis / (1.0 - ReflGlDiffDiffFront * ReflScDiffDiffBack)) * + (state.dataConstruction->Construct(IConst).TransDiffVis / (1.0 - ReflGlDiffDiffFront * ReflScDiffDiffBack)) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); } else { // Blind on @@ -8441,18 +8444,18 @@ namespace DaylightingManager { } else if (ShType == WSC_ST_ExteriorBlind) { // Exterior blind TransMult(JB) = TransBlDiffDiffFront * - (dataConstruction.Construct(IConst).TransDiffVis / (1.0 - ReflGlDiffDiffFront * Blind(BlNum).VisBackDiffDiffRefl(JB))) * + (state.dataConstruction->Construct(IConst).TransDiffVis / (1.0 - ReflGlDiffDiffFront * Blind(BlNum).VisBackDiffDiffRefl(JB))) * SurfWinGlazedFrac(IWin) * SurfWinLightWellEff(IWin); } else { // Between-glass blind - t1 = dataConstruction.Construct(IConst).tBareVisDiff(1); + t1 = state.dataConstruction->Construct(IConst).tBareVisDiff(1); tfshBd = Blind(BlNum).VisFrontDiffDiffTrans(JB); rfshB = Blind(BlNum).VisFrontDiffDiffRefl(JB); - if (dataConstruction.Construct(IConst).TotGlassLayers == 2) { // 2 glass layers + if (state.dataConstruction->Construct(IConst).TotGlassLayers == 2) { // 2 glass layers TransMult(JB) = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * SurfWinLightWellEff(IWin); } else { // 3 glass layers; blind between layers 2 and 3 - t2 = dataConstruction.Construct(IConst).tBareVisDiff(2); + t2 = state.dataConstruction->Construct(IConst).tBareVisDiff(2); TransMult(JB) = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * SurfWinLightWellEff(IWin); } @@ -8649,7 +8652,8 @@ namespace DaylightingManager { } } - void DayltgInterReflectedIllumComplexFenestration(int const IWin, // Window index + void DayltgInterReflectedIllumComplexFenestration(EnergyPlusData &state, + int const IWin, // Window index int const WinEl, // Current window element counter int const IHR, // Hour of day int const ZoneNum, // Zone number @@ -8765,7 +8769,7 @@ namespace DaylightingManager { for (iBackElem = 1; iBackElem <= NTrnBasis; ++iBackElem) { for (iIncElem = 1; iIncElem <= NIncBasis; ++iIncElem) { LambdaInc = ComplexWind(IWin).Geom(CurCplxFenState).Inc.Lamda(iIncElem); - dirTrans = dataConstruction.Construct(iConst).BSDFInput.VisFrtTrans(iBackElem, iIncElem); + dirTrans = state.dataConstruction->Construct(iConst).BSDFInput.VisFrtTrans(iBackElem, iIncElem); for (iSky = 1; iSky <= 4; ++iSky) { FLSK(iSky, iBackElem) += dirTrans * LambdaInc * ElementLuminanceSky(iSky, iIncElem); @@ -8812,7 +8816,8 @@ namespace DaylightingManager { if (allocated(ElementLuminanceSunDisk)) ElementLuminanceSunDisk.deallocate(); } - void DayltgDirectIllumComplexFenestration(int const IWin, // Window index + void DayltgDirectIllumComplexFenestration(EnergyPlusData &state, + int const IWin, // Window index int const WinEl, // Current window element counter int const IHR, // Hour of day int const EP_UNUSED(ZoneNum), // Zone number @@ -8902,7 +8907,7 @@ namespace DaylightingManager { for (iIncElem = 1; iIncElem <= NIncBasis; ++iIncElem) { // LambdaInc = ComplexWind(IWin)%Geom(CurCplxFenState)%Inc%Lamda(iIncElem) - dirTrans = dataConstruction.Construct(iConst).BSDFInput.VisFrtTrans(RefPointIndex, iIncElem); + dirTrans = state.dataConstruction->Construct(iConst).BSDFInput.VisFrtTrans(RefPointIndex, iIncElem); for (iSky = 1; iSky <= 4; ++iSky) { WinLumSK(iSky) += dirTrans * ElementLuminanceSky(iSky, iIncElem); @@ -9030,7 +9035,7 @@ namespace DaylightingManager { if (PosFac != 0.0) { if (SolBmIndex > 0) { - dirTrans = dataConstruction.Construct(iConst).BSDFInput.VisFrtTrans(iTrnElem, SolBmIndex); + dirTrans = state.dataConstruction->Construct(iConst).BSDFInput.VisFrtTrans(iTrnElem, SolBmIndex); } else { dirTrans = 0.0; } @@ -9354,7 +9359,8 @@ namespace DaylightingManager { } } - void DayltgSurfaceLumFromSun(int const IHR, // Hour number + void DayltgSurfaceLumFromSun(EnergyPlusData &state, + int const IHR, // Hour number Vector3 const &Ray, // Ray from window to reflecting surface (m) int const ReflSurfNum, // Number of surface for which luminance is being calculated Vector3 const &ReflHitPt, // Point on ReflSurfNum for luminance calculation (m) @@ -9433,8 +9439,8 @@ namespace DaylightingManager { // (1 - glazing fraction) * (vis refl of opaque part of shadowing surface); specular reflection is // excluded in this value of DiffVisRefl. } else { // Exterior building surface - if (!dataConstruction.Construct(Surface(ReflSurfNum).Construction).TypeIsWindow) { - DiffVisRefl = 1.0 - dataConstruction.Construct(Surface(ReflSurfNum).Construction).OutsideAbsorpSolar; + if (!state.dataConstruction->Construct(Surface(ReflSurfNum).Construction).TypeIsWindow) { + DiffVisRefl = 1.0 - state.dataConstruction->Construct(Surface(ReflSurfNum).Construction).OutsideAbsorpSolar; } else { // Window; assume bare so no beam-to-diffuse reflection DiffVisRefl = 0.0; @@ -9443,7 +9449,7 @@ namespace DaylightingManager { LumAtReflHitPtFrSun = CosIncAngAtHitPt * DiffVisRefl / Pi; } - void DayltgInteriorMapIllum(int &ZoneNum) // Zone number + void DayltgInteriorMapIllum(EnergyPlusData &state, int &ZoneNum) // Zone number { // *****super modified version of DayltgInteriorIllum by Peter Graham Ellis @@ -9586,13 +9592,13 @@ namespace DaylightingManager { VTRatio = 1.0; if (NREFPT > 0) { IConst = Surface(IWin).Construction; - if (dataConstruction.Construct(IConst).TCFlag == 1) { + if (state.dataConstruction->Construct(IConst).TCFlag == 1) { // For thermochromic windows, daylight and glare factors are always calculated // based on the master construction. They need to be adjusted by the VTRatio, including: // ZoneDaylight()%DaylIllFacSky, DaylIllFacSun, DaylIllFacSunDisk; DaylBackFacSky, // DaylBackFacSun, DaylBackFacSunDisk, DaylSourceFacSky, DaylSourceFacSun, DaylSourceFacSunDisk - VTNow = POLYF(1.0, dataConstruction.Construct(IConst).TransVisBeamCoef); - VTMaster = POLYF(1.0, dataConstruction.Construct(dataConstruction.Construct(IConst).TCMasterConst).TransVisBeamCoef); + VTNow = POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef); + VTMaster = POLYF(1.0, state.dataConstruction->Construct(state.dataConstruction->Construct(IConst).TCMasterConst).TransVisBeamCoef); VTRatio = VTNow / VTMaster; } } @@ -9858,7 +9864,7 @@ namespace DaylightingManager { // switchable windows in partial or fully switched state, // get its intermediate VT calculated in DayltgInteriorIllum IConstShaded = Surface(IWin).activeShadedConstruction; - if (IConstShaded > 0) VTDark = POLYF(1.0, dataConstruction.Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); + if (IConstShaded > 0) VTDark = POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); if (VTDark > 0) VTMULT = SurfWinVisTransSelected(IWin) / VTDark; } } @@ -9895,7 +9901,7 @@ namespace DaylightingManager { // switchable windows in partial or fully switched state, // get its intermediate VT calculated in DayltgInteriorIllum IConstShaded = Surface(IWin).activeShadedConstruction; - if (IConstShaded > 0) VTDark = POLYF(1.0, dataConstruction.Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); + if (IConstShaded > 0) VTDark = POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * SurfWinGlazedFrac(IWin); if (VTDark > 0) VTMULT = SurfWinVisTransSelected(IWin) / VTDark; } } @@ -10661,7 +10667,7 @@ namespace DaylightingManager { } } - void DayltgInterReflIllFrIntWins(int &ZoneNum) // Zone number + void DayltgInterReflIllFrIntWins(EnergyPlusData &state, int &ZoneNum) // Zone number { // SUBROUTINE INFORMATION: @@ -10689,7 +10695,7 @@ namespace DaylightingManager { // This is an interior window in ZoneNum int const ConstrNum = Surface(IWin).Construction; int const adjEnclNum = Surface(Surface(IWin).ExtBoundCond).SolarEnclIndex; - QDifTrans = QSDifSol(adjEnclNum) * dataConstruction.Construct(ConstrNum).TransDiffVis * Surface(IWin).Area * PDIFLW; + QDifTrans = QSDifSol(adjEnclNum) * state.dataConstruction->Construct(ConstrNum).TransDiffVis * Surface(IWin).Area * PDIFLW; QDifTransUp = QDifTrans * SurfWinFractionUpgoing(IWin); QDifTransDn = QDifTrans * (1.0 - SurfWinFractionUpgoing(IWin)); if (ZoneDaylight(ZoneNum).TotInsSurfArea * (1.0 - ZoneDaylight(ZoneNum).AveVisDiffReflect) != 0.0) { diff --git a/src/EnergyPlus/DaylightingManager.hh b/src/EnergyPlus/DaylightingManager.hh index 4cbc43e3822..c78684d5525 100644 --- a/src/EnergyPlus/DaylightingManager.hh +++ b/src/EnergyPlus/DaylightingManager.hh @@ -126,7 +126,7 @@ namespace DaylightingManager { // Functions void clear_state(); - void DayltgAveInteriorReflectance(int &ZoneNum); // Zone number + void DayltgAveInteriorReflectance(EnergyPlusData &state, int &ZoneNum); // Zone number void CalcDayltgCoefficients(EnergyPlusData &state); @@ -136,7 +136,8 @@ namespace DaylightingManager { void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const ZoneNum); - void FigureDayltgCoeffsAtPointsSetupForWindow(int const ZoneNum, + void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, + int const ZoneNum, int const iRefPoint, int const loopwin, int const CalledFrom, // indicate which type of routine called this routine @@ -390,7 +391,7 @@ namespace DaylightingManager { bool &hit // True iff ray hits an obstruction ); - void DayltgInteriorIllum(int &ZoneNum); // Zone number + void DayltgInteriorIllum(EnergyPlusData &state, int &ZoneNum); // Zone number void DayltgInteriorTDDIllum(); @@ -417,7 +418,8 @@ namespace DaylightingManager { int const CalledFrom, Optional_int_const MapNum = _); - void DayltgInterReflectedIllumComplexFenestration(int const IWin, // Window index + void DayltgInterReflectedIllumComplexFenestration(EnergyPlusData &state, + int const IWin, // Window index int const WinEl, // Current window element counter int const IHR, // Hour of day int const ZoneNum, // Zone number @@ -425,7 +427,8 @@ namespace DaylightingManager { int const CalledFrom, Optional_int_const MapNum = _); - void DayltgDirectIllumComplexFenestration(int const IWin, // Window index + void DayltgDirectIllumComplexFenestration(EnergyPlusData &state, + int const IWin, // Window index int const WinEl, // Current window element counter int const IHR, // Hour of day int const ZoneNum, // Zone number @@ -460,14 +463,15 @@ namespace DaylightingManager { Vector3 &NearestHitPt // Ray's hit point on nearest obstruction (m) ); - void DayltgSurfaceLumFromSun(int const IHR, // Hour number + void DayltgSurfaceLumFromSun(EnergyPlusData &state, + int const IHR, // Hour number Vector3 const &Ray, // Ray from window to reflecting surface (m) int const ReflSurfNum, // Number of surface for which luminance is being calculated Vector3 const &ReflHitPt, // Point on ReflSurfNum for luminance calculation (m) Real64 &LumAtReflHitPtFrSun // Luminance at ReflHitPt from beam solar reflection for unit ); - void DayltgInteriorMapIllum(int &ZoneNum); // Zone number + void DayltgInteriorMapIllum(EnergyPlusData &state, int &ZoneNum); // Zone number void ReportIllumMap(EnergyPlusData &state, int const MapNum); @@ -481,7 +485,7 @@ namespace DaylightingManager { void MapShadeDeploymentOrderToLoopNumber(int &ZoneNum); - void DayltgInterReflIllFrIntWins(int &ZoneNum); // Zone number + void DayltgInterReflIllFrIntWins(EnergyPlusData &state, int &ZoneNum); // Zone number void CalcMinIntWinSolidAngs(); diff --git a/src/EnergyPlus/EMSManager.cc b/src/EnergyPlus/EMSManager.cc index f1456d25df0..c37c888069c 100644 --- a/src/EnergyPlus/EMSManager.cc +++ b/src/EnergyPlus/EMSManager.cc @@ -439,7 +439,7 @@ namespace EMSManager { if (GetEMSUserInput) { SetupZoneInfoAsInternalDataAvail(); - SetupWindowShadingControlActuators(); + SetupWindowShadingControlActuators(state); SetupSurfaceConvectionActuators(); SetupSurfaceConstructionActuators(); SetupSurfaceOutdoorBoundaryConditionActuators(); @@ -1958,7 +1958,7 @@ namespace EMSManager { } } - void SetupWindowShadingControlActuators() + void SetupWindowShadingControlActuators(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -2032,7 +2032,7 @@ namespace EMSManager { } else { if (WindowShadingControl(Surface(loopSurfNum).activeWindowShadingControl).ShadingType != WSC_ST_SwitchableGlazing) { ShowSevereError("Missing shade or blind layer in window construction name = '" + - dataConstruction.Construct(Surface(loopSurfNum).activeShadedConstruction).Name + "', surface name = '" + + state.dataConstruction->Construct(Surface(loopSurfNum).activeShadedConstruction).Name + "', surface name = '" + Surface(loopSurfNum).Name + "'."); ShowContinueError("...'Control Status' or 'Slat Angle' EMS Actuator cannot be set for a construction that does not have a shade " "or a blind layer."); diff --git a/src/EnergyPlus/EMSManager.hh b/src/EnergyPlus/EMSManager.hh index 676f6931516..32882fffd2a 100644 --- a/src/EnergyPlus/EMSManager.hh +++ b/src/EnergyPlus/EMSManager.hh @@ -133,7 +133,7 @@ namespace EMSManager { void SetupPrimaryAirSystemAvailMgrAsActuators(EnergyPlusData &state); - void SetupWindowShadingControlActuators(); + void SetupWindowShadingControlActuators(EnergyPlusData &state); void SetupThermostatActuators(); diff --git a/src/EnergyPlus/EcoRoofManager.cc b/src/EnergyPlus/EcoRoofManager.cc index bd09fa4cbc3..917d6be6e32 100644 --- a/src/EnergyPlus/EcoRoofManager.cc +++ b/src/EnergyPlus/EcoRoofManager.cc @@ -54,6 +54,7 @@ // EnergyPlus Headers #include #include +#include #include #include #include @@ -322,8 +323,8 @@ namespace EcoRoofManager { } if (SurfWinStormWinFlag(SurfNum) == 1) ConstrNum = Surface(SurfNum).StormWinConstruction; - RoughSurf = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Roughness; - AbsThermSurf = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; + RoughSurf = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Roughness; + AbsThermSurf = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; HMovInsul = 0.0; if (Surface(SurfNum).ExtWind) { @@ -350,19 +351,19 @@ namespace EcoRoofManager { ShowSevereError("CalcEcoRoof: EcoRoof simulation but HeatBalanceAlgorithm is not ConductionTransferFunction(CTF). EcoRoof model " "currently works only with CTF heat balance solution algorithm."); // ONLY READ ECOROOF PROPERTIES IN THE FIRST TIME - Zf = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).HeightOfPlants; // Plant height (m) - LAI = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).LAI; // Leaf Area Index - Alphag = 1.0 - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; // albedo rather than absorptivity - Alphaf = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Lreflectivity; // Leaf Reflectivity - epsilonf = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).LEmissitivity; // Leaf Emisivity - StomatalResistanceMin = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).RStomata; // Leaf min stomatal resistance - epsilong = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; // Soil Emisivity - MoistureMax = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Porosity; // Max moisture content in soil - MoistureResidual = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).MinMoisture; // Min moisture content in soil - Moisture = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).InitMoisture; // Initial moisture content in soil + Zf = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).HeightOfPlants; // Plant height (m) + LAI = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).LAI; // Leaf Area Index + Alphag = 1.0 - dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; // albedo rather than absorptivity + Alphaf = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Lreflectivity; // Leaf Reflectivity + epsilonf = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).LEmissitivity; // Leaf Emisivity + StomatalResistanceMin = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).RStomata; // Leaf min stomatal resistance + epsilong = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; // Soil Emisivity + MoistureMax = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Porosity; // Max moisture content in soil + MoistureResidual = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).MinMoisture; // Min moisture content in soil + Moisture = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).InitMoisture; // Initial moisture content in soil MeanRootMoisture = Moisture; // DJS Oct 2007 Release --> all soil at same initial moisture for Reverse DD fix - SoilThickness = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Thickness; // Total thickness of soil layer (m) + SoilThickness = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Thickness; // Total thickness of soil layer (m) // DJS - This set of statements and the corresponding write statement in the UpdateSoilProps subroutine should // be removed (or commented out) prior to deployment in a working version of EnergyPlus @@ -413,9 +414,9 @@ namespace EcoRoofManager { // for Reverse DD testing if (BeginEnvrnFlag || WarmupFlag) { - Moisture = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).InitMoisture; // Initial moisture content in soil + Moisture = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).InitMoisture; // Initial moisture content in soil MeanRootMoisture = Moisture; // Start the root zone moisture at the same value as the surface. - Alphag = 1.0 - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; // albedo rather than absorptivity + Alphag = 1.0 - dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; // albedo rather than absorptivity } // DJS July 2007 @@ -444,24 +445,24 @@ namespace EcoRoofManager { // If current surface is = FirstEcoSurf then for this time step we need to update the soil moisture if (SurfNum == FirstEcoSurf) { UpdateSoilProps( - Moisture, MeanRootMoisture, MoistureMax, MoistureResidual, SoilThickness, Vfluxf, Vfluxg, ConstrNum, Alphag, unit, Tg, Tf, Qsoil); + state, Moisture, MeanRootMoisture, MoistureMax, MoistureResidual, SoilThickness, Vfluxf, Vfluxg, ConstrNum, Alphag, unit, Tg, Tf, Qsoil); Ta = OutDryBulbTempAt(Surface(SurfNum).Centroid.z); // temperature outdoor - Surface is dry, use normal correlation Tg = Tgold; Tf = Tfold; - if (dataConstruction.Construct(ConstrNum).CTFCross(0) > 0.01) { + if (state.dataConstruction->Construct(ConstrNum).CTFCross(0) > 0.01) { QuickConductionSurf = true; - F1temp = dataConstruction.Construct(ConstrNum).CTFCross(0) / (dataConstruction.Construct(ConstrNum).CTFInside(0) + HConvIn(SurfNum)); + F1temp = state.dataConstruction->Construct(ConstrNum).CTFCross(0) / (state.dataConstruction->Construct(ConstrNum).CTFInside(0) + HConvIn(SurfNum)); Qsoilpart1 = -CTFConstOutPart(SurfNum) + F1temp * (CTFConstInPart(SurfNum) + SurfOpaqQRadSWInAbs(SurfNum) + SurfQRadThermInAbs(SurfNum) + - dataConstruction.Construct(ConstrNum).CTFSourceIn(0) * QsrcHist(SurfNum, 1) + + state.dataConstruction->Construct(ConstrNum).CTFSourceIn(0) * QsrcHist(SurfNum, 1) + HConvIn(SurfNum) * MAT(ZoneNum) + SurfNetLWRadToSurf(SurfNum)); } else { - Qsoilpart1 = -CTFConstOutPart(SurfNum) + dataConstruction.Construct(ConstrNum).CTFCross(0) * TempSurfIn(SurfNum); + Qsoilpart1 = -CTFConstOutPart(SurfNum) + state.dataConstruction->Construct(ConstrNum).CTFCross(0) * TempSurfIn(SurfNum); F1temp = 0.0; } - Qsoilpart2 = dataConstruction.Construct(ConstrNum).CTFOutside(0) - F1temp * dataConstruction.Construct(ConstrNum).CTFCross(0); + Qsoilpart2 = state.dataConstruction->Construct(ConstrNum).CTFOutside(0) - F1temp * state.dataConstruction->Construct(ConstrNum).CTFCross(0); Pa = StdBaroPress; // standard atmospheric pressure (apparently in Pascals) Tgk = Tg + KelvinConv; @@ -683,7 +684,8 @@ namespace EcoRoofManager { TempExt = Tgold; } - void UpdateSoilProps(Real64 &Moisture, + void UpdateSoilProps(EnergyPlusData &state, + Real64 &Moisture, Real64 &MeanRootMoisture, Real64 const MoistureMax, Real64 const MoistureResidual, @@ -800,10 +802,10 @@ namespace EcoRoofManager { if (UpdatebeginFlag) { // SET dry values that NEVER CHANGE - DryCond = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Conductivity; - DryDens = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Density; - DryAbsorp = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; - DrySpecHeat = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).SpecHeat; + DryCond = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Conductivity; + DryDens = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Density; + DryAbsorp = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; + DrySpecHeat = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).SpecHeat; // DETERMINE RELATIVE THICKNESS OF TWO LAYERS OF SOIL (also unchanging) if (SoilThickness > 0.12) { @@ -813,7 +815,7 @@ namespace EcoRoofManager { } // This loop outputs the minimum number of time steps needed to keep the solution stable // The equation is minimum timestep in seconds=161240*((number of layers)**(-2.3))*(Total thickness of the soil)**2.07 - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).EcoRoofCalculationMethod == 2) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).EcoRoofCalculationMethod == 2) { Real64 const depth_limit(depth_fac * std::pow(TopDepth + RootDepth, 2.07)); for (index1 = 1; index1 <= 20; ++index1) { if (double(MinutesPerTimeStep / index1) <= depth_limit) break; @@ -913,7 +915,7 @@ namespace EcoRoofManager { Moisture = MoistureMax; } - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).EcoRoofCalculationMethod == 1) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).EcoRoofCalculationMethod == 1) { // THE SECTION BELOW WAS THE INITIAL MOISTURE DISTRIBUTION MODEL. // Any line with "!-" was code. A line with "!" was just a comment. This is done in case this code needs to be resurected in the future. @@ -1100,23 +1102,23 @@ namespace EcoRoofManager { // TestRatio variable is available just in case there are stability issues. If so, we can limit the amount // by which soil properties are allowed to vary in one time step (10% in example below). - TestRatio = SoilConductivity / dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Conductivity; + TestRatio = SoilConductivity / dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Conductivity; if (TestRatio > RatioMax) TestRatio = RatioMax; if (TestRatio < RatioMin) TestRatio = RatioMin; - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Conductivity *= TestRatio; - SoilConductivity = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Conductivity; + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Conductivity *= TestRatio; + SoilConductivity = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Conductivity; - TestRatio = SoilDensity / dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Density; + TestRatio = SoilDensity / dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Density; if (TestRatio > RatioMax) TestRatio = RatioMax; if (TestRatio < RatioMin) TestRatio = RatioMin; - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Density *= TestRatio; - SoilDensity = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Density; + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Density *= TestRatio; + SoilDensity = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Density; - TestRatio = SoilSpecHeat / dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).SpecHeat; + TestRatio = SoilSpecHeat / dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).SpecHeat; if (TestRatio > RatioMax) TestRatio = RatioMax; if (TestRatio < RatioMin) TestRatio = RatioMin; - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).SpecHeat *= TestRatio; - SoilSpecHeat = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).SpecHeat; + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).SpecHeat *= TestRatio; + SoilSpecHeat = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).SpecHeat; // Now call InitConductionTransferFunction with the ConstrNum as the argument. As long as the argument is // non-zero InitConductionTransferFunction will ONLY update this construction. If the argument is 0 it will diff --git a/src/EnergyPlus/EcoRoofManager.hh b/src/EnergyPlus/EcoRoofManager.hh index 45482718ecc..a5702f8fc46 100644 --- a/src/EnergyPlus/EcoRoofManager.hh +++ b/src/EnergyPlus/EcoRoofManager.hh @@ -53,6 +53,9 @@ namespace EnergyPlus { +// Forward declarations +struct EnergyPlusData; + namespace EcoRoofManager { extern Real64 CumRunoff; // Cumulative runoff, updated each time step (m) mult by roof area to get volume @@ -77,7 +80,8 @@ namespace EcoRoofManager { Real64 &TempExt // Exterior temperature boundary condition ); - void UpdateSoilProps(Real64 &Moisture, + void UpdateSoilProps(EnergyPlusData &state, + Real64 &Moisture, Real64 &MeanRootMoisture, Real64 const MoistureMax, Real64 const MoistureResidual, diff --git a/src/EnergyPlus/Furnaces.cc b/src/EnergyPlus/Furnaces.cc index ae62b17039c..b095b11d651 100644 --- a/src/EnergyPlus/Furnaces.cc +++ b/src/EnergyPlus/Furnaces.cc @@ -183,7 +183,6 @@ namespace Furnaces { using namespace ScheduleManager; using DXCoils::SimDXCoil; using Fans::SimulateFanComponents; - using VariableSpeedCoils::MaxSpedLevels; // Data // MODULE PARAMETER DEFINITIONS @@ -6067,7 +6066,6 @@ namespace Furnaces { using IntegratedHeatPump::IntegratedHeatPumps; using IntegratedHeatPump::SizeIHP; using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; using WaterToAirHeatPumpSimple::SimWatertoAirHPSimple; // Locals @@ -6135,9 +6133,9 @@ namespace Furnaces { if (Furnace(FurnaceNum).bIsIHP) { SizeIHP(state, Furnace(FurnaceNum).CoolingCoilIndex); IHPCoilIndex = IntegratedHeatPumps(Furnace(FurnaceNum).CoolingCoilIndex).SCCoilIndex; - Furnace(FurnaceNum).NumOfSpeedCooling = VarSpeedCoil(IHPCoilIndex).NumOfSpeeds; - MulSpeedFlowScale = VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate / - VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(VarSpeedCoil(IHPCoilIndex).NormSpedLevel); + Furnace(FurnaceNum).NumOfSpeedCooling = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NumOfSpeeds; + MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate / + state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NormSpedLevel); IntegratedHeatPumps(Furnace(FurnaceNum).CoolingCoilIndex).CoolVolFlowScale = MulSpeedFlowScale; } else { SimVariableSpeedCoils(state, @@ -6154,19 +6152,19 @@ namespace Furnaces { 0.0, 0.0, 0.0); // conduct the sizing operation in the VS WSHP - Furnace(FurnaceNum).NumOfSpeedCooling = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).NumOfSpeeds; - MulSpeedFlowScale = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).RatedAirVolFlowRate / - VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex) - .MSRatedAirVolFlowRate(VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).NormSpedLevel); + Furnace(FurnaceNum).NumOfSpeedCooling = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).NumOfSpeeds; + MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).RatedAirVolFlowRate / + state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex) + .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).NormSpedLevel); IHPCoilIndex = Furnace(FurnaceNum).CoolingCoilIndex; } for (Iter = 1; Iter <= Furnace(FurnaceNum).NumOfSpeedCooling; ++Iter) { - Furnace(FurnaceNum).CoolVolumeFlowRate(Iter) = VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; - Furnace(FurnaceNum).CoolMassFlowRate(Iter) = VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale; + Furnace(FurnaceNum).CoolVolumeFlowRate(Iter) = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; + Furnace(FurnaceNum).CoolMassFlowRate(Iter) = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale; Furnace(FurnaceNum).MSCoolingSpeedRatio(Iter) = - VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) / - VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Furnace(FurnaceNum).NumOfSpeedCooling); + state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) / + state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Furnace(FurnaceNum).NumOfSpeedCooling); } if (Furnace(FurnaceNum).HeatingCoilType_Num == Coil_HeatingWaterToAirHPVSEquationFit || @@ -6175,9 +6173,9 @@ namespace Furnaces { if (Furnace(FurnaceNum).bIsIHP) { SizeIHP(state, Furnace(FurnaceNum).CoolingCoilIndex); IHPCoilIndex = IntegratedHeatPumps(Furnace(FurnaceNum).CoolingCoilIndex).SHCoilIndex; - Furnace(FurnaceNum).NumOfSpeedHeating = VarSpeedCoil(IHPCoilIndex).NumOfSpeeds; - MulSpeedFlowScale = VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate / - VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(VarSpeedCoil(IHPCoilIndex).NormSpedLevel); + Furnace(FurnaceNum).NumOfSpeedHeating = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NumOfSpeeds; + MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate / + state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NormSpedLevel); IntegratedHeatPumps(Furnace(FurnaceNum).CoolingCoilIndex).HeatVolFlowScale = MulSpeedFlowScale; } else { SimVariableSpeedCoils(state, @@ -6194,19 +6192,19 @@ namespace Furnaces { 0.0, 0.0, 0.0); // conduct the sizing operation in the VS WSHP - Furnace(FurnaceNum).NumOfSpeedHeating = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).NumOfSpeeds; - MulSpeedFlowScale = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).RatedAirVolFlowRate / - VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex) - .MSRatedAirVolFlowRate(VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).NormSpedLevel); + Furnace(FurnaceNum).NumOfSpeedHeating = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).NumOfSpeeds; + MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).RatedAirVolFlowRate / + state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex) + .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).NormSpedLevel); IHPCoilIndex = Furnace(FurnaceNum).HeatingCoilIndex; } for (Iter = 1; Iter <= Furnace(FurnaceNum).NumOfSpeedHeating; ++Iter) { - Furnace(FurnaceNum).HeatVolumeFlowRate(Iter) = VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; - Furnace(FurnaceNum).HeatMassFlowRate(Iter) = VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale; + Furnace(FurnaceNum).HeatVolumeFlowRate(Iter) = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; + Furnace(FurnaceNum).HeatMassFlowRate(Iter) = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale; Furnace(FurnaceNum).MSHeatingSpeedRatio(Iter) = - VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) / - VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Furnace(FurnaceNum).NumOfSpeedHeating); + state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) / + state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Furnace(FurnaceNum).NumOfSpeedHeating); } } @@ -10690,7 +10688,6 @@ namespace Furnaces { using Fans::SimulateFanComponents; using IntegratedHeatPump::SimIHP; using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -10793,7 +10790,7 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio; + SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio; } else { if (Furnace(FurnaceNum).bIsIHP) { SimIHP(state, @@ -10869,7 +10866,7 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio; + SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio; } else { if (Furnace(FurnaceNum).bIsIHP) { SimIHP(state, @@ -10960,7 +10957,7 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio; + SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio; } else { if (Furnace(FurnaceNum).bIsIHP) { @@ -11036,7 +11033,7 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio; + SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio; } else { if (Furnace(FurnaceNum).bIsIHP) { SimIHP(state, @@ -11133,7 +11130,7 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio; + SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio; } else { if (Furnace(FurnaceNum).bIsIHP) { SimIHP(state, @@ -11209,7 +11206,7 @@ namespace Furnaces { SavePartloadRatio = PartLoadFrac; SaveSpeedRatio = SpeedRatio; - SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio; + SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio; } else { if (Furnace(FurnaceNum).bIsIHP) { SimIHP(state, diff --git a/src/EnergyPlus/Furnaces.hh b/src/EnergyPlus/Furnaces.hh index 624c7b0e032..ed00db83c8a 100644 --- a/src/EnergyPlus/Furnaces.hh +++ b/src/EnergyPlus/Furnaces.hh @@ -65,7 +65,6 @@ struct EnergyPlusData; namespace Furnaces { // Using/Aliasing - using VariableSpeedCoils::MaxSpedLevels; // Data // MODULE PARAMETER DEFINITIONS @@ -131,7 +130,8 @@ namespace Furnaces { // Types struct FurnaceEquipConditions - { + { + int MaxSpedLevels = 10; // Members std::string Name; // Name of the Furnace int FurnaceType_Num; // Numeric Equivalent for Furnace Type diff --git a/src/EnergyPlus/GeneralRoutines.cc b/src/EnergyPlus/GeneralRoutines.cc index 10f324fa686..9b0747c863d 100644 --- a/src/EnergyPlus/GeneralRoutines.cc +++ b/src/EnergyPlus/GeneralRoutines.cc @@ -1154,7 +1154,7 @@ void CalcPassiveExteriorBaffleGap(EnergyPlusData &state, LocalWindArr(ThisSurf) = Surface(SurfPtr).WindSpeed; InitExteriorConvectionCoeff(state, SurfPtr, HMovInsul, Roughness, AbsExt, TmpTsBaf, HExtARR(ThisSurf), HSkyARR(ThisSurf), HGroundARR(ThisSurf), HAirARR(ThisSurf)); ConstrNum = Surface(SurfPtr).Construction; - AbsThermSurf = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; + AbsThermSurf = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; TsoK = TH(1, 1, SurfPtr) + KelvinConv; TsBaffK = TmpTsBaf + KelvinConv; if (TsBaffK == TsoK) { // avoid divide by zero diff --git a/src/EnergyPlus/HVACDXHeatPumpSystem.cc b/src/EnergyPlus/HVACDXHeatPumpSystem.cc index 4a935e9d170..d6e19dd17bc 100644 --- a/src/EnergyPlus/HVACDXHeatPumpSystem.cc +++ b/src/EnergyPlus/HVACDXHeatPumpSystem.cc @@ -600,7 +600,6 @@ namespace HVACDXHeatPumpSystem { using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyTdpFnWPb; using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; // SUBROUTINE PARAMETER DEFINITIONS: int const MaxIte(500); // Maximum number of iterations for solver @@ -815,7 +814,7 @@ namespace HVACDXHeatPumpSystem { OnOffAirFlowRatio); VSCoilIndex = DXHeatPumpSystem(DXSystemNum).HeatPumpCoilIndex; - NumOfSpeeds = VarSpeedCoil(VSCoilIndex).NumOfSpeeds; + NumOfSpeeds = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).NumOfSpeeds; NoOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); @@ -861,7 +860,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 = VarSpeedCoil(VSCoilIndex).OutletAirDBTemp; + OutletTempDXCoil = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).OutletAirDBTemp; if (OutletTempDXCoil < DesOutTemp) { PartLoadFrac = 1.0; SpeedNum = NumOfSpeeds; @@ -885,7 +884,7 @@ namespace HVACDXHeatPumpSystem { QLatReq, OnOffAirFlowRatio); - TempSpeedOut = VarSpeedCoil(VSCoilIndex).OutletAirDBTemp; + TempSpeedOut = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).OutletAirDBTemp; if ((TempSpeedOut - DesOutTemp) < Acc) { // Check to see which speed to meet the load @@ -908,7 +907,7 @@ namespace HVACDXHeatPumpSystem { QLatReq, OnOffAirFlowRatio); - TempSpeedOut = VarSpeedCoil(VSCoilIndex).OutletAirDBTemp; + TempSpeedOut = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).OutletAirDBTemp; if ((TempSpeedOut - DesOutTemp) > Acc) { SpeedNum = I; @@ -1156,7 +1155,6 @@ namespace HVACDXHeatPumpSystem { // na // Using/Aliasing using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; // Return value Real64 Residuum; // residual to be minimized to zero @@ -1207,7 +1205,7 @@ namespace HVACDXHeatPumpSystem { QLatReq, OnOffAirFlowRatio); - OutletAirTemp = VarSpeedCoil(CoilIndex).OutletAirDBTemp; + OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).OutletAirDBTemp; Residuum = Par(2) - OutletAirTemp; return Residuum; @@ -1235,7 +1233,6 @@ namespace HVACDXHeatPumpSystem { // na // Using/Aliasing using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; // Return value Real64 Residuum; // residual to be minimized to zero @@ -1287,7 +1284,7 @@ namespace HVACDXHeatPumpSystem { QLatReq, OnOffAirFlowRatio); - OutletAirTemp = VarSpeedCoil(CoilIndex).OutletAirDBTemp; + OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).OutletAirDBTemp; Residuum = Par(2) - OutletAirTemp; return Residuum; diff --git a/src/EnergyPlus/HVACDXSystem.cc b/src/EnergyPlus/HVACDXSystem.cc index cca055ce5c9..d33b67cad24 100644 --- a/src/EnergyPlus/HVACDXSystem.cc +++ b/src/EnergyPlus/HVACDXSystem.cc @@ -1042,7 +1042,6 @@ namespace HVACDXSystem { using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyTdpFnWPb; using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; // SUBROUTINE PARAMETER DEFINITIONS: int const MaxIte(500); // Maximum number of iterations for solver @@ -2236,13 +2235,13 @@ namespace HVACDXSystem { OnOffAirFlowRatio); VSCoilIndex = DXCoolingSystem(DXSystemNum).CoolingCoilIndex; - NumOfSpeeds = VarSpeedCoil(VSCoilIndex).NumOfSpeeds; + NumOfSpeeds = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).NumOfSpeeds; NoOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); ReqOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(DesOutTemp, Node(OutletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat)); - NoLoadHumRatOut = VarSpeedCoil(VSCoilIndex).OutletAirHumRat; + NoLoadHumRatOut = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).OutletAirHumRat; // IF NoOutput is lower than (more cooling than required) or very near the ReqOutput, do not run the compressor if ((NoOutput - ReqOutput) < Acc) { @@ -2461,7 +2460,7 @@ namespace HVACDXSystem { if (PartLoadFrac == 0.0) { OutletHumRatDXCoil = NoLoadHumRatOut; } else { - OutletHumRatDXCoil = VarSpeedCoil(DXCoolingSystem(DXSystemNum).CoolingCoilIndex).OutletAirHumRat; + OutletHumRatDXCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoolingSystem(DXSystemNum).CoolingCoilIndex).OutletAirHumRat; } // If humidity setpoint is not satisfied and humidity control type is CoolReheat, @@ -2491,7 +2490,7 @@ namespace HVACDXSystem { QLatReq, OnOffAirFlowRatio); - TempSpeedOut = VarSpeedCoil(VSCoilIndex).OutletAirHumRat; + TempSpeedOut = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).OutletAirHumRat; if (NumOfSpeeds > 1 && (TempSpeedOut - DesOutHumRat) > HumRatAcc) { // Check to see which speed to meet the load @@ -2513,7 +2512,7 @@ namespace HVACDXSystem { QLatReq, OnOffAirFlowRatio); - TempSpeedOut = VarSpeedCoil(VSCoilIndex).OutletAirHumRat; + TempSpeedOut = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).OutletAirHumRat; // break here if coil outlet humrat is below DesOutHumRat, then only call SolveRoot below if delta humrat is > // HumRatAcc, otherwise just use this answer (i.e., SpeedNum = x and SpeedRatio = 1.0) if ((DesOutHumRat - TempSpeedOut) > -HumRatAcc) { @@ -3570,7 +3569,6 @@ namespace HVACDXSystem { // na // Using/Aliasing using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; // Return value Real64 Residuum; // residual to be minimized to zero @@ -3612,7 +3610,7 @@ namespace HVACDXSystem { QLatReq, OnOffAirFlowRatio); - OutletAirTemp = VarSpeedCoil(CoilIndex).OutletAirDBTemp; + OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).OutletAirDBTemp; Residuum = Par(2) - OutletAirTemp; return Residuum; @@ -3639,7 +3637,6 @@ namespace HVACDXSystem { // na // Using/Aliasing using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; // Return value Real64 Residuum; // residual to be minimized to zero @@ -3691,7 +3688,7 @@ namespace HVACDXSystem { QLatReq, OnOffAirFlowRatio); - OutletAirTemp = VarSpeedCoil(CoilIndex).OutletAirDBTemp; + OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).OutletAirDBTemp; Residuum = Par(2) - OutletAirTemp; return Residuum; @@ -3716,7 +3713,6 @@ namespace HVACDXSystem { // na // Using/Aliasing using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; // Return value Real64 Residuum; // residual to be minimized to zero @@ -3767,7 +3763,7 @@ namespace HVACDXSystem { QLatReq, OnOffAirFlowRatio); - OutletAirHumRat = VarSpeedCoil(CoilIndex).OutletAirHumRat; + OutletAirHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).OutletAirHumRat; Residuum = Par(2) - OutletAirHumRat; return Residuum; @@ -3795,7 +3791,6 @@ namespace HVACDXSystem { // na // Using/Aliasing using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; // Return value Real64 Residuum; // residual to be minimized to zero @@ -3847,7 +3842,7 @@ namespace HVACDXSystem { QLatReq, OnOffAirFlowRatio); - OutletAirHumRat = VarSpeedCoil(CoilIndex).OutletAirHumRat; + OutletAirHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).OutletAirHumRat; Residuum = Par(2) - OutletAirHumRat; return Residuum; diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.cc b/src/EnergyPlus/HVACUnitaryBypassVAV.cc index 9e928b52ac0..1f0e286106d 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.cc +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.cc @@ -2502,7 +2502,7 @@ namespace HVACUnitaryBypassVAV { // 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. - Real64 OutletTempDXCoil = VariableSpeedCoils::VarSpeedCoil(CBVAV(CBVAVNum).CoolCoilCompIndex).OutletAirDBTemp; + Real64 OutletTempDXCoil = state.dataVariableSpeedCoils->VarSpeedCoil(CBVAV(CBVAVNum).CoolCoilCompIndex).OutletAirDBTemp; if (OutletTempDXCoil > DesOutTemp) { PartLoadFrac = 1.0; SpeedNum = maxNumSpeeds; @@ -2684,7 +2684,7 @@ namespace HVACUnitaryBypassVAV { } else if (PartLoadFrac < 0.0) { PartLoadFrac = 0.0; } - SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(CBVAV(CBVAVNum).CoolCoilCompIndex); + SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(state, CBVAV(CBVAVNum).CoolCoilCompIndex); // variable-speed air-to-air cooling coil, end ------------------------- } else if (SELECT_CASE_var == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) { @@ -2990,7 +2990,7 @@ namespace HVACUnitaryBypassVAV { SpeedRatio, QZnReq, QLatReq); - SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(CBVAV(CBVAVNum).CoolCoilCompIndex); + SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(state, CBVAV(CBVAVNum).CoolCoilCompIndex); } } @@ -3217,7 +3217,7 @@ namespace HVACUnitaryBypassVAV { } else { // Else find how the coil is modulating (speed level and speed ratio or part load between off and speed 1) to meet the load // 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. - Real64 OutletTempDXCoil = VariableSpeedCoils::VarSpeedCoil(CBVAV(CBVAVNum).DXHeatCoilIndexNum).OutletAirDBTemp; + Real64 OutletTempDXCoil = state.dataVariableSpeedCoils->VarSpeedCoil(CBVAV(CBVAVNum).DXHeatCoilIndexNum).OutletAirDBTemp; if (OutletTempDXCoil < DesOutTemp) { PartLoadFrac = 1.0; SpeedNum = maxNumSpeeds; @@ -3420,7 +3420,7 @@ namespace HVACUnitaryBypassVAV { } else if (PartLoadFrac < 0.0) { PartLoadFrac = 0.0; } - SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(CBVAV(CBVAVNum).DXHeatCoilIndexNum); + SaveCompressorPLR = VariableSpeedCoils::getVarSpeedPartLoadRatio(state, CBVAV(CBVAVNum).DXHeatCoilIndexNum); } else if ((SELECT_CASE_var == DataHVACGlobals::Coil_HeatingGasOrOtherFuel) || (SELECT_CASE_var == DataHVACGlobals::Coil_HeatingElectric) || (SELECT_CASE_var == DataHVACGlobals::Coil_HeatingWater) || (SELECT_CASE_var == DataHVACGlobals::Coil_HeatingSteam)) { // not a DX heating coil diff --git a/src/EnergyPlus/HeatBalFiniteDiffManager.cc b/src/EnergyPlus/HeatBalFiniteDiffManager.cc index fd560b5939c..69dd2361999 100644 --- a/src/EnergyPlus/HeatBalFiniteDiffManager.cc +++ b/src/EnergyPlus/HeatBalFiniteDiffManager.cc @@ -224,7 +224,7 @@ namespace HeatBalFiniteDiffManager { GetHBFiniteDiffInputFlag = false; } // Solve the zone heat & moisture balance using a finite difference solution - CalcHeatBalFiniteDiff(SurfNum, TempSurfInTmp, TempSurfOutTmp); + CalcHeatBalFiniteDiff(state, SurfNum, TempSurfInTmp, TempSurfOutTmp); } void GetCondFDInput(EnergyPlusData &state) @@ -538,7 +538,7 @@ namespace HeatBalFiniteDiffManager { if (Surface(SurfNum).HeatTransferAlgorithm != HeatTransferModel_CondFD) continue; if (Surface(SurfNum).Construction <= 0) continue; // Shading surface, not really a heat transfer surface ConstrNum = Surface(SurfNum).Construction; - if (dataConstruction.Construct(ConstrNum).TypeIsWindow) continue; // Windows simulated in Window module + if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) continue; // Windows simulated in Window module SurfaceFD(SurfNum).T = TempInitValue; SurfaceFD(SurfNum).TOld = TempInitValue; SurfaceFD(SurfNum).TT = TempInitValue; @@ -589,7 +589,7 @@ namespace HeatBalFiniteDiffManager { if (Surface(SurfNum).HeatTransferAlgorithm != HeatTransferModel_CondFD) continue; if (Surface(SurfNum).Construction <= 0) continue; // Shading surface, not really a heat transfer surface ConstrNum = Surface(SurfNum).Construction; - if (dataConstruction.Construct(ConstrNum).TypeIsWindow) continue; // Windows simulated in Window module + if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) continue; // Windows simulated in Window module SurfaceFD(SurfNum).T = SurfaceFD(SurfNum).TOld; SurfaceFD(SurfNum).Rhov = SurfaceFD(SurfNum).RhovOld; SurfaceFD(SurfNum).TD = SurfaceFD(SurfNum).TDOld; @@ -685,20 +685,20 @@ namespace HeatBalFiniteDiffManager { for (ConstrNum = 1; ConstrNum <= TotConstructs; ++ConstrNum) { // Need to skip window constructions and eventually window materials - if (dataConstruction.Construct(ConstrNum).TypeIsWindow) continue; + if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) continue; - ConstructFD(ConstrNum).Name.allocate(dataConstruction.Construct(ConstrNum).TotLayers); - ConstructFD(ConstrNum).Thickness.allocate(dataConstruction.Construct(ConstrNum).TotLayers); - ConstructFD(ConstrNum).NodeNumPoint.allocate(dataConstruction.Construct(ConstrNum).TotLayers); - ConstructFD(ConstrNum).DelX.allocate(dataConstruction.Construct(ConstrNum).TotLayers); - ConstructFD(ConstrNum).TempStability.allocate(dataConstruction.Construct(ConstrNum).TotLayers); - ConstructFD(ConstrNum).MoistStability.allocate(dataConstruction.Construct(ConstrNum).TotLayers); + ConstructFD(ConstrNum).Name.allocate(state.dataConstruction->Construct(ConstrNum).TotLayers); + ConstructFD(ConstrNum).Thickness.allocate(state.dataConstruction->Construct(ConstrNum).TotLayers); + ConstructFD(ConstrNum).NodeNumPoint.allocate(state.dataConstruction->Construct(ConstrNum).TotLayers); + ConstructFD(ConstrNum).DelX.allocate(state.dataConstruction->Construct(ConstrNum).TotLayers); + ConstructFD(ConstrNum).TempStability.allocate(state.dataConstruction->Construct(ConstrNum).TotLayers); + ConstructFD(ConstrNum).MoistStability.allocate(state.dataConstruction->Construct(ConstrNum).TotLayers); TotNodes = 0; SigmaR(ConstrNum) = 0.0; SigmaC(ConstrNum) = 0.0; - for (Layer = 1; Layer <= dataConstruction.Construct(ConstrNum).TotLayers; ++Layer) { // Begin layer loop ... + for (Layer = 1; Layer <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Layer) { // Begin layer loop ... // Loop through all of the layers in the current construct. The purpose // of this loop is to define the thermal properties and to. @@ -713,7 +713,7 @@ namespace HeatBalFiniteDiffManager { // Change to implicit formulation still uses explicit stability, but // now there are special equations for R-only layers. - CurrentLayer = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + CurrentLayer = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); ConstructFD(ConstrNum).Name(Layer) = dataMaterial.Material(CurrentLayer).Name; ConstructFD(ConstrNum).Thickness(Layer) = dataMaterial.Material(CurrentLayer).Thickness; @@ -761,10 +761,10 @@ namespace HeatBalFiniteDiffManager { Alpha = kt / (dataMaterial.Material(CurrentLayer).Density * dataMaterial.Material(CurrentLayer).SpecHeat); mAlpha = 0.0; - } else if (dataConstruction.Construct(ConstrNum).TypeIsIRT || dataConstruction.Construct(ConstrNum).TypeIsAirBoundaryIRTSurface) { // make similar to air? (that didn't seem to work well) - ShowSevereError("InitHeatBalFiniteDiff: Construction =\"" + dataConstruction.Construct(ConstrNum).Name + + } else if (state.dataConstruction->Construct(ConstrNum).TypeIsIRT || state.dataConstruction->Construct(ConstrNum).TypeIsAirBoundaryIRTSurface) { // make similar to air? (that didn't seem to work well) + ShowSevereError("InitHeatBalFiniteDiff: Construction =\"" + state.dataConstruction->Construct(ConstrNum).Name + "\" uses Material:InfraredTransparent. Cannot be used currently with finite difference calculations."); - if (dataConstruction.Construct(ConstrNum).IsUsed) { + if (state.dataConstruction->Construct(ConstrNum).IsUsed) { ShowContinueError("...since this construction is used in a surface, the simulation is not allowed."); ErrorsFound = true; } else { @@ -851,7 +851,7 @@ namespace HeatBalFiniteDiffManager { ConstructFD(ConstrNum).NodeXlocation.allocate(ConstructFD(ConstrNum).TotNodes + 1); ConstructFD(ConstrNum).NodeXlocation = 0.0; // init them all Ipts1 = 0; // init counter - for (Layer = 1; Layer <= dataConstruction.Construct(ConstrNum).TotLayers; ++Layer) { + for (Layer = 1; Layer <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Layer) { OutwardMatLayerNum = Layer - 1; for (LayerNode = 1; LayerNode <= ConstructFD(ConstrNum).NodeNumPoint(Layer); ++LayerNode) { ++Ipts1; @@ -859,7 +859,7 @@ namespace HeatBalFiniteDiffManager { ConstructFD(ConstrNum).NodeXlocation(Ipts1) = 0.0; // first node is on outside face } else if (LayerNode == 1) { - if (OutwardMatLayerNum > 0 && OutwardMatLayerNum <= dataConstruction.Construct(ConstrNum).TotLayers) { + if (OutwardMatLayerNum > 0 && OutwardMatLayerNum <= state.dataConstruction->Construct(ConstrNum).TotLayers) { // later nodes are Delx away from previous, but use Delx from previous layer ConstructFD(ConstrNum).NodeXlocation(Ipts1) = ConstructFD(ConstrNum).NodeXlocation(Ipts1 - 1) + ConstructFD(ConstrNum).DelX(OutwardMatLayerNum); @@ -871,7 +871,7 @@ namespace HeatBalFiniteDiffManager { } } } - Layer = dataConstruction.Construct(ConstrNum).TotLayers; + Layer = state.dataConstruction->Construct(ConstrNum).TotLayers; ++Ipts1; ConstructFD(ConstrNum).NodeXlocation(Ipts1) = ConstructFD(ConstrNum).NodeXlocation(Ipts1 - 1) + ConstructFD(ConstrNum).DelX(Layer); } @@ -1025,7 +1025,8 @@ namespace HeatBalFiniteDiffManager { return s; } - void CalcHeatBalFiniteDiff(int const Surf, // Surface number + void CalcHeatBalFiniteDiff(EnergyPlusData &state, + int const Surf, // Surface number Real64 &TempSurfInTmp, // INSIDE SURFACE TEMPERATURE OF EACH HEAT TRANSFER SURF. Real64 &TempSurfOutTmp // Outside Surface Temperature of each Heat Transfer Surface ) @@ -1057,7 +1058,7 @@ namespace HeatBalFiniteDiffManager { int const ConstrNum(Surface(Surf).Construction); int const TotNodes(ConstructFD(ConstrNum).TotNodes); - int const TotLayers(dataConstruction.Construct(ConstrNum).TotLayers); + int const TotLayers(state.dataConstruction->Construct(ConstrNum).TotLayers); TempSurfInTmp = 0.0; TempSurfOutTmp = 0.0; @@ -1099,23 +1100,23 @@ namespace HeatBalFiniteDiffManager { // For the exterior surface node with a convective boundary condition if ((i == 1) && (Lay == 1)) { - ExteriorBCEqns(Delt, i, Lay, Surf, T, TT, Rhov, RhoT, RH, TD, TDT, EnthOld, EnthNew, TotNodes, HMovInsul); + ExteriorBCEqns(state, Delt, i, Lay, Surf, T, TT, Rhov, RhoT, RH, TD, TDT, EnthOld, EnthNew, TotNodes, HMovInsul); } // For the Layer Interior nodes. Arrive here after exterior surface node or interface node if (TotNodes != 1) { for (int ctr = 2, ctr_end = ConstructFD(ConstrNum).NodeNumPoint(Lay); ctr <= ctr_end; ++ctr) { ++i; - InteriorNodeEqns(Delt, i, Lay, Surf, T, TT, Rhov, RhoT, RH, TD, TDT, EnthOld, EnthNew); + InteriorNodeEqns(state, Delt, i, Lay, Surf, T, TT, Rhov, RhoT, RH, TD, TDT, EnthOld, EnthNew); } } if ((Lay < TotLayers) && (TotNodes != 1)) { // Interface equations for 2 capacitive materials ++i; - IntInterfaceNodeEqns(Delt, i, Lay, Surf, T, TT, Rhov, RhoT, RH, TD, TDT, EnthOld, EnthNew, GSiter); + IntInterfaceNodeEqns(state, Delt, i, Lay, Surf, T, TT, Rhov, RhoT, RH, TD, TDT, EnthOld, EnthNew, GSiter); } else if (Lay == TotLayers) { // For the Interior surface node with a convective boundary condition ++i; - InteriorBCEqns(Delt, i, Lay, Surf, T, TT, Rhov, RhoT, RH, TD, TDT, EnthOld, EnthNew, TDreport); + InteriorBCEqns(state, Delt, i, Lay, Surf, T, TT, Rhov, RhoT, RH, TD, TDT, EnthOld, EnthNew, TDreport); } } // layer loop @@ -1257,20 +1258,20 @@ namespace HeatBalFiniteDiffManager { for (ThisNum = 1; ThisNum <= TotConstructs; ++ThisNum) { - if (dataConstruction.Construct(ThisNum).TypeIsWindow) continue; - if (dataConstruction.Construct(ThisNum).TypeIsIRT) continue; - if (dataConstruction.Construct(ThisNum).TypeIsAirBoundaryIRTSurface) continue; + if (state.dataConstruction->Construct(ThisNum).TypeIsWindow) continue; + if (state.dataConstruction->Construct(ThisNum).TypeIsIRT) continue; + if (state.dataConstruction->Construct(ThisNum).TypeIsAirBoundaryIRTSurface) continue; static constexpr auto Format_700(" Construction CondFD,{},{},{},{},{:.6R}\n"); print(state.files.eio, Format_700, - dataConstruction.Construct(ThisNum).Name, + state.dataConstruction->Construct(ThisNum).Name, ThisNum, - dataConstruction.Construct(ThisNum).TotLayers, + state.dataConstruction->Construct(ThisNum).TotLayers, int(ConstructFD(ThisNum).TotNodes + 1), ConstructFD(ThisNum).DeltaTime / SecInHour); - for (Layer = 1; Layer <= dataConstruction.Construct(ThisNum).TotLayers; ++Layer) { + for (Layer = 1; Layer <= state.dataConstruction->Construct(ThisNum).TotLayers; ++Layer) { static constexpr auto Format_701(" Material CondFD Summary,{},{:.4R},{},{:.8R},{:.8R},{:.8R}\n"); print(state.files.eio, Format_701, @@ -1285,7 +1286,7 @@ namespace HeatBalFiniteDiffManager { // now list each CondFD Node with its X distance from outside face in m along with other identifiers Inodes = 0; - for (Layer = 1; Layer <= dataConstruction.Construct(ThisNum).TotLayers; ++Layer) { + for (Layer = 1; Layer <= state.dataConstruction->Construct(ThisNum).TotLayers; ++Layer) { OutwardMatLayerNum = Layer - 1; for (LayerNode = 1; LayerNode <= ConstructFD(ThisNum).NodeNumPoint(Layer); ++LayerNode) { ++Inodes; @@ -1294,18 +1295,18 @@ namespace HeatBalFiniteDiffManager { Format_702, format("Node #{}", Inodes), ConstructFD(ThisNum).NodeXlocation(Inodes), - dataConstruction.Construct(ThisNum).Name, + state.dataConstruction->Construct(ThisNum).Name, "Surface Outside Face", ConstructFD(ThisNum).Name(Layer)); } else if (LayerNode == 1) { - if (OutwardMatLayerNum > 0 && OutwardMatLayerNum <= dataConstruction.Construct(ThisNum).TotLayers) { + if (OutwardMatLayerNum > 0 && OutwardMatLayerNum <= state.dataConstruction->Construct(ThisNum).TotLayers) { print(state.files.eio, Format_702, format("Node #{}", Inodes), ConstructFD(ThisNum).NodeXlocation(Inodes), - dataConstruction.Construct(ThisNum).Name, + state.dataConstruction->Construct(ThisNum).Name, ConstructFD(ThisNum).Name(OutwardMatLayerNum), ConstructFD(ThisNum).Name(Layer)); } @@ -1315,20 +1316,20 @@ namespace HeatBalFiniteDiffManager { Format_702, format("Node #{}", Inodes), ConstructFD(ThisNum).NodeXlocation(Inodes), - dataConstruction.Construct(ThisNum).Name, + state.dataConstruction->Construct(ThisNum).Name, ConstructFD(ThisNum).Name(OutwardMatLayerNum), ConstructFD(ThisNum).Name(Layer)); } } } - Layer = dataConstruction.Construct(ThisNum).TotLayers; + Layer = state.dataConstruction->Construct(ThisNum).TotLayers; ++Inodes; print(state.files.eio, Format_702, format("Node #{}", Inodes), ConstructFD(ThisNum).NodeXlocation(Inodes), - dataConstruction.Construct(ThisNum).Name, + state.dataConstruction->Construct(ThisNum).Name, ConstructFD(ThisNum).Name(Layer), "Surface Inside Face"); } @@ -1394,7 +1395,8 @@ namespace HeatBalFiniteDiffManager { } } - void ExteriorBCEqns(int const Delt, // Time Increment + void ExteriorBCEqns(EnergyPlusData &state, + int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction int const Surf, // Surface number @@ -1455,14 +1457,15 @@ namespace HeatBalFiniteDiffManager { // switch around arguments for the other surf and call routines as for interior side BC from opposite face int const ext_bound_construction(Surface(surface_ExtBoundCond).Construction); - int const LayIn(dataConstruction.Construct(ext_bound_construction).TotLayers); // layer number for call to interior eqs + int const LayIn(state.dataConstruction->Construct(ext_bound_construction).TotLayers); // layer number for call to interior eqs int const NodeIn(ConstructFD(ext_bound_construction).TotNodes + 1); // node number "I" for call to interior eqs int const TotNodesPlusOne(TotNodes + 1); if (surface_ExtBoundCond == Surf) { // adiabatic surface, PT added since it is not the same as interzone wall // as Outside Boundary Condition Object can be left blank. auto &surfaceFD(SurfaceFD(Surf)); - InteriorBCEqns(Delt, + InteriorBCEqns(state, + Delt, NodeIn, LayIn, Surf, @@ -1487,7 +1490,8 @@ namespace HeatBalFiniteDiffManager { // potential-lkl-from old CALL InteriorBCEqns(Delt,nodeIn,LayIn,Surf,SurfaceFD(Surface(Surf)%ExtBoundCond)%T, & auto &surfaceFDEBC(SurfaceFD(surface_ExtBoundCond)); - InteriorBCEqns(Delt, + InteriorBCEqns(state, + Delt, NodeIn, LayIn, surface_ExtBoundCond, @@ -1532,7 +1536,7 @@ namespace HeatBalFiniteDiffManager { if (surface.HeatTransferAlgorithm == HeatTransferModel_CondFD) { int const ConstrNum(surface.Construction); - int const MatLay(dataConstruction.Construct(ConstrNum).LayerPoint(Lay)); + int const MatLay(state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay)); auto const &mat(dataMaterial.Material(MatLay)); auto const &matFD(MaterialFD(MatLay)); @@ -1664,7 +1668,8 @@ namespace HeatBalFiniteDiffManager { } // regular BC part of the ground and Rain check } - void InteriorNodeEqns(int const Delt, // Time Increment + void InteriorNodeEqns(EnergyPlusData &state, + int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction int const Surf, // Surface number @@ -1688,7 +1693,7 @@ namespace HeatBalFiniteDiffManager { int const ConstrNum(Surface(Surf).Construction); - int const MatLay(dataConstruction.Construct(ConstrNum).LayerPoint(Lay)); + int const MatLay(state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay)); auto const &mat(dataMaterial.Material(MatLay)); auto const &matFD(MaterialFD(MatLay)); @@ -1762,7 +1767,8 @@ namespace HeatBalFiniteDiffManager { (Cp * DelX * RhoS) / 2.0; // Save this for computing node flux values, half nodes are the same here } - void IntInterfaceNodeEqns(int const Delt, // Time Increment + void IntInterfaceNodeEqns(EnergyPlusData &state, + int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction int const Surf, // Surface number @@ -1793,7 +1799,7 @@ namespace HeatBalFiniteDiffManager { if (surface.HeatTransferAlgorithm == HeatTransferModel_CondFD) { // HT Algo issue int const ConstrNum(surface.Construction); - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); int const MatLay(construct.LayerPoint(Lay)); auto const &mat(dataMaterial.Material(MatLay)); @@ -2054,7 +2060,8 @@ namespace HeatBalFiniteDiffManager { } // End of the CondFD if block } - void InteriorBCEqns(int const Delt, // Time Increment + void InteriorBCEqns(EnergyPlusData &state, + int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction int const Surf, // Surface number @@ -2121,7 +2128,7 @@ namespace HeatBalFiniteDiffManager { Real64 const QFac(NetLWRadToSurfFD + QHtRadSysSurfFD + QHWBaseboardSurfFD + QSteamBaseboardSurfFD + QElecBaseboardSurfFD + QRadSWInFD + QRadThermInFD + QCoolingPanelSurfFD); if (surface.HeatTransferAlgorithm == HeatTransferModel_CondFD) { - int const MatLay(dataConstruction.Construct(ConstrNum).LayerPoint(Lay)); + int const MatLay(state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay)); auto const &mat(dataMaterial.Material(MatLay)); auto const &matFD(MaterialFD(MatLay)); diff --git a/src/EnergyPlus/HeatBalFiniteDiffManager.hh b/src/EnergyPlus/HeatBalFiniteDiffManager.hh index c852775deeb..8768b328b5d 100644 --- a/src/EnergyPlus/HeatBalFiniteDiffManager.hh +++ b/src/EnergyPlus/HeatBalFiniteDiffManager.hh @@ -203,7 +203,8 @@ namespace HeatBalFiniteDiffManager { void InitialInitHeatBalFiniteDiff(EnergyPlusData &state); - void CalcHeatBalFiniteDiff(int const Surf, + void CalcHeatBalFiniteDiff(EnergyPlusData &state, + int const Surf, Real64 &TempSurfInTmp, // INSIDE SURFACE TEMPERATURE OF EACH HEAT TRANSFER SURF. Real64 &TempSurfOutTmp // Outside Surface Temperature of each Heat Transfer Surface ); @@ -216,7 +217,8 @@ namespace HeatBalFiniteDiffManager { Real64 terpld(Array2 const &a, Real64 const x1, int const nind, int const ndep); - void ExteriorBCEqns(int const Delt, // Time Increment + void ExteriorBCEqns(EnergyPlusData &state, + int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction int const Surf, // Surface number @@ -233,7 +235,8 @@ namespace HeatBalFiniteDiffManager { Real64 const HMovInsul // Conductance of movable(transparent) insulation. ); - void InteriorNodeEqns(int const Delt, // Time Increment + void InteriorNodeEqns(EnergyPlusData &state, + int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction int const Surf, // Surface number @@ -248,7 +251,8 @@ namespace HeatBalFiniteDiffManager { Array1D &EnthNew // New Nodal enthalpy ); - void IntInterfaceNodeEqns(int const Delt, // Time Increment + void IntInterfaceNodeEqns(EnergyPlusData &state, + int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction int const Surf, // Surface number @@ -264,7 +268,8 @@ namespace HeatBalFiniteDiffManager { int const GSiter // Iteration number of Gauss Seidell iteration ); - void InteriorBCEqns(int const Delt, // Time Increment + void InteriorBCEqns(EnergyPlusData &state, + int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction int const Surf, // Surface number diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.cc b/src/EnergyPlus/HeatBalanceHAMTManager.cc index c61045f4efe..93136979281 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.cc +++ b/src/EnergyPlus/HeatBalanceHAMTManager.cc @@ -771,42 +771,42 @@ namespace HeatBalanceHAMTManager { if (Surface(sid).HeatTransferAlgorithm != HeatTransferModel_HAMT) continue; conid = Surface(sid).Construction; if (conid == 0) continue; - for (lid = 1; lid <= dataConstruction.Construct(conid).TotLayers; ++lid) { - matid = dataConstruction.Construct(conid).LayerPoint(lid); + for (lid = 1; lid <= state.dataConstruction->Construct(conid).TotLayers; ++lid) { + matid = state.dataConstruction->Construct(conid).LayerPoint(lid); if (dataMaterial.Material(matid).ROnly) { - ShowSevereError(RoutineName + "Construction=" + dataConstruction.Construct(conid).Name + " cannot contain R-only value materials."); + ShowSevereError(RoutineName + "Construction=" + state.dataConstruction->Construct(conid).Name + " cannot contain R-only value materials."); ShowContinueError("Reference Material=\"" + dataMaterial.Material(matid).Name + "\"."); ++errorCount; continue; } if (dataMaterial.Material(matid).nmu < 0) { - ShowSevereError(RoutineName + "Construction=" + dataConstruction.Construct(conid).Name); + ShowSevereError(RoutineName + "Construction=" + state.dataConstruction->Construct(conid).Name); ShowContinueError("Reference Material=\"" + dataMaterial.Material(matid).Name + "\" does not have required Water Vapor Diffusion Resistance Factor (mu) data."); ++errorCount; } if (dataMaterial.Material(matid).niso < 0) { - ShowSevereError(RoutineName + "Construction=" + dataConstruction.Construct(conid).Name); + ShowSevereError(RoutineName + "Construction=" + state.dataConstruction->Construct(conid).Name); ShowContinueError("Reference Material=\"" + dataMaterial.Material(matid).Name + "\" does not have required isotherm data."); ++errorCount; } if (dataMaterial.Material(matid).nsuc < 0) { - ShowSevereError(RoutineName + "Construction=" + dataConstruction.Construct(conid).Name); + ShowSevereError(RoutineName + "Construction=" + state.dataConstruction->Construct(conid).Name); ShowContinueError("Reference Material=\"" + dataMaterial.Material(matid).Name + "\" does not have required liquid transport coefficient (suction) data."); ++errorCount; } if (dataMaterial.Material(matid).nred < 0) { - ShowSevereError(RoutineName + "Construction=" + dataConstruction.Construct(conid).Name); + ShowSevereError(RoutineName + "Construction=" + state.dataConstruction->Construct(conid).Name); ShowContinueError("Reference Material=\"" + dataMaterial.Material(matid).Name + "\" does not have required liquid transport coefficient (redistribution) data."); ++errorCount; } if (dataMaterial.Material(matid).ntc < 0) { if (dataMaterial.Material(matid).Conductivity > 0) { - ShowWarningError(RoutineName + "Construction=" + dataConstruction.Construct(conid).Name); + ShowWarningError(RoutineName + "Construction=" + state.dataConstruction->Construct(conid).Name); ShowContinueError("Reference Material=\"" + dataMaterial.Material(matid).Name + "\" does not have thermal conductivity data. Using fixed value."); dataMaterial.Material(matid).ntc = 2; @@ -815,7 +815,7 @@ namespace HeatBalanceHAMTManager { dataMaterial.Material(matid).tcwater(2) = dataMaterial.Material(matid).isodata(dataMaterial.Material(matid).niso); dataMaterial.Material(matid).tcdata(2) = dataMaterial.Material(matid).Conductivity; } else { - ShowSevereError(RoutineName + "Construction=" + dataConstruction.Construct(conid).Name); + ShowSevereError(RoutineName + "Construction=" + state.dataConstruction->Construct(conid).Name); ShowContinueError("Reference Material=\"" + dataMaterial.Material(matid).Name + "\" does not have required thermal conductivity data."); ++errorCount; } @@ -838,7 +838,7 @@ namespace HeatBalanceHAMTManager { if (testlen > adjdist) break; --dataMaterial.Material(matid).divs; if (dataMaterial.Material(matid).divs < 1) { - ShowSevereError(RoutineName + "Construction=" + dataConstruction.Construct(conid).Name); + ShowSevereError(RoutineName + "Construction=" + state.dataConstruction->Construct(conid).Name); ShowContinueError("Reference Material=\"" + dataMaterial.Material(matid).Name + "\" is too thin."); ++errorCount; break; @@ -914,8 +914,8 @@ namespace HeatBalanceHAMTManager { // Material Cells conid = Surface(sid).Construction; - for (lid = 1; lid <= dataConstruction.Construct(conid).TotLayers; ++lid) { - matid = dataConstruction.Construct(conid).LayerPoint(lid); + for (lid = 1; lid <= state.dataConstruction->Construct(conid).TotLayers; ++lid) { + matid = state.dataConstruction->Construct(conid).LayerPoint(lid); for (did = 1; did <= dataMaterial.Material(matid).divs; ++did) { ++cid; @@ -1032,12 +1032,12 @@ namespace HeatBalanceHAMTManager { // write cell origins to initialization output file conid = Surface(sid).Construction; - print(state.files.eio, "HAMT cells, {},{}", Surface(sid).Name, dataConstruction.Construct(conid).Name); + print(state.files.eio, "HAMT cells, {},{}", Surface(sid).Name, state.dataConstruction->Construct(conid).Name); for (int concell = 1, concell_end = Intcell(sid) - Extcell(sid) + 1; concell <= concell_end; ++concell) { print(state.files.eio, ",{:4}", concell); } print(state.files.eio, "\n"); - print(state.files.eio, "HAMT origins,{},{}", Surface(sid).Name, dataConstruction.Construct(conid).Name); + print(state.files.eio, "HAMT origins,{},{}", Surface(sid).Name, state.dataConstruction->Construct(conid).Name); for (int cellid = Extcell(sid); cellid <= Intcell(sid); ++cellid) { print(state.files.eio, ",{:10.7F}", cells(cellid).origin(1)); } diff --git a/src/EnergyPlus/HeatBalanceIntRadExchange.cc b/src/EnergyPlus/HeatBalanceIntRadExchange.cc index cf6b009e5cc..3235e40909d 100644 --- a/src/EnergyPlus/HeatBalanceIntRadExchange.cc +++ b/src/EnergyPlus/HeatBalanceIntRadExchange.cc @@ -134,7 +134,8 @@ namespace HeatBalanceIntRadExchange { CalcInteriorRadExchangefirstTime = true; } - void CalcInteriorRadExchange(Array1S const SurfaceTemp, // Current surface temperatures + void CalcInteriorRadExchange(EnergyPlusData &state, + Array1S const SurfaceTemp, // Current surface temperatures int const SurfIterations, // Number of iterations in calling subroutine Array1D &NetLWRadToSurf, // Net long wavelength radiant exchange from other surfaces Optional_int_const ZoneToResimulate, // if passed in, then only calculate for this zone @@ -269,7 +270,7 @@ namespace HeatBalanceIntRadExchange { for (int const SurfNum : zone_SurfacePtr) { if (IntShadeOrBlindStatusChanged || IntMovInsulChanged) break; // Need only check if one window's status or one movable insulation status has changed - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) { ShadeFlag = SurfWinShadingFlag(SurfNum); ShadeFlagPrev = SurfWinExtIntShadePrevTS(SurfNum); if ((ShadeFlagPrev != IntShadeOn && ShadeFlag == IntShadeOn) || @@ -277,11 +278,11 @@ namespace HeatBalanceIntRadExchange { (ShadeFlagPrev == IntShadeOn && ShadeFlag != IntShadeOn) || (ShadeFlagPrev == IntBlindOn && ShadeFlag != IntBlindOn)) IntShadeOrBlindStatusChanged = true; if (SurfWinWindowModelType(SurfNum) == WindowEQLModel && - DataWindowEquivalentLayer::CFS(dataConstruction.Construct(Surface(SurfNum).Construction).EQLConsPtr).ISControlled) { + DataWindowEquivalentLayer::CFS(state.dataConstruction->Construct(Surface(SurfNum).Construction).EQLConsPtr).ISControlled) { IntShadeOrBlindStatusChanged = true; } } else { - UpdateMovableInsulationFlag(IntMovInsulChanged, SurfNum); + UpdateMovableInsulationFlag(state, IntMovInsulChanged, SurfNum); } } } @@ -290,9 +291,9 @@ namespace HeatBalanceIntRadExchange { for (int ZoneSurfNum = 1; ZoneSurfNum <= n_zone_Surfaces; ++ZoneSurfNum) { int const SurfNum = zone_SurfacePtr(ZoneSurfNum); int const ConstrNum = Surface(SurfNum).Construction; - zone_info.Emissivity(ZoneSurfNum) = dataConstruction.Construct(ConstrNum).InsideAbsorpThermal; + zone_info.Emissivity(ZoneSurfNum) = state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal; auto const &surface_window(SurfaceWindow(SurfNum)); - if (dataConstruction.Construct(ConstrNum).TypeIsWindow && + if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow && (SurfWinShadingFlag(SurfNum) == IntShadeOn || SurfWinShadingFlag(SurfNum) == IntBlindOn)) { zone_info.Emissivity(ZoneSurfNum) = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), surface_window.EffShBlindEmiss) + @@ -303,8 +304,8 @@ namespace HeatBalanceIntRadExchange { zone_info.Emissivity(ZoneSurfNum) = dataMaterial.Material(Surface(SurfNum).MaterialMovInsulInt).AbsorpThermal; } if (SurfWinWindowModelType(SurfNum) == WindowEQLModel && - DataWindowEquivalentLayer::CFS(dataConstruction.Construct(ConstrNum).EQLConsPtr).ISControlled) { - zone_info.Emissivity(ZoneSurfNum) = EQLWindowInsideEffectiveEmiss(ConstrNum); + DataWindowEquivalentLayer::CFS(state.dataConstruction->Construct(ConstrNum).EQLConsPtr).ISControlled) { + zone_info.Emissivity(ZoneSurfNum) = EQLWindowInsideEffectiveEmiss(state, ConstrNum); } } @@ -328,10 +329,10 @@ namespace HeatBalanceIntRadExchange { int const SurfNum = zone_SurfacePtr[ZoneSurfNum]; auto const &surface_window(SurfaceWindow(SurfNum)); int const ConstrNum = Surface(SurfNum).Construction; - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); if (construct.WindowTypeEQL) { SurfaceTempRad[ZoneSurfNum] = SurfWinEffInsSurfTemp(SurfNum); - SurfaceEmiss[ZoneSurfNum] = EQLWindowInsideEffectiveEmiss(ConstrNum); + SurfaceEmiss[ZoneSurfNum] = EQLWindowInsideEffectiveEmiss(state, ConstrNum); } else if (construct.WindowTypeBSDF && SurfWinShadingFlag(SurfNum) == IntShadeOn) { SurfaceTempRad[ZoneSurfNum] = SurfWinEffInsSurfTemp(SurfNum); SurfaceEmiss[ZoneSurfNum] = surface_window.EffShBlindEmiss[0] + surface_window.EffGlassEmiss[0]; @@ -381,7 +382,7 @@ namespace HeatBalanceIntRadExchange { for (size_type RecZoneSurfNum = 0; RecZoneSurfNum < s_zone_Surfaces; ++RecZoneSurfNum) { int const RecSurfNum = zone_SurfacePtr[RecZoneSurfNum]; int const ConstrNumRec = Surface(RecSurfNum).Construction; - auto const& rec_construct(dataConstruction.Construct(ConstrNumRec)); + auto const& rec_construct(state.dataConstruction->Construct(ConstrNumRec)); auto& netLWRadToRecSurf(NetLWRadToSurf(RecSurfNum)); if (rec_construct.TypeIsWindow) { // auto& rec_surface_window(SurfaceWindow(RecSurfNum)); @@ -406,7 +407,7 @@ namespace HeatBalanceIntRadExchange { for (size_type RecZoneSurfNum = 0; RecZoneSurfNum < s_zone_Surfaces; ++RecZoneSurfNum) { int const RecSurfNum = zone_SurfacePtr[RecZoneSurfNum]; int const ConstrNumRec = Surface(RecSurfNum).Construction; - auto const &rec_construct(dataConstruction.Construct(ConstrNumRec)); + auto const &rec_construct(state.dataConstruction->Construct(ConstrNumRec)); auto &netLWRadToRecSurf(NetLWRadToSurf(RecSurfNum)); // Calculate net long-wave radiation for opaque surfaces and incident @@ -459,7 +460,7 @@ namespace HeatBalanceIntRadExchange { #endif } - void UpdateMovableInsulationFlag(bool &MovableInsulationChange, int const SurfNum) + void UpdateMovableInsulationFlag(EnergyPlusData &state, bool &MovableInsulationChange, int const SurfNum) { // SUBROUTINE INFORMATION: @@ -482,7 +483,7 @@ namespace HeatBalanceIntRadExchange { } if ((Surface(SurfNum).MovInsulIntPresent != Surface(SurfNum).MovInsulIntPresentPrevTS)) { auto const &thissurf(Surface(SurfNum)); - Real64 AbsorpDiff = std::abs(dataConstruction.Construct(thissurf.Construction).InsideAbsorpThermal - dataMaterial.Material(thissurf.MaterialMovInsulInt).AbsorpThermal); + Real64 AbsorpDiff = std::abs(state.dataConstruction->Construct(thissurf.Construction).InsideAbsorpThermal - dataMaterial.Material(thissurf.MaterialMovInsulInt).AbsorpThermal); if (AbsorpDiff > 0.01) { MovableInsulationChange = true; } @@ -592,7 +593,7 @@ namespace HeatBalanceIntRadExchange { for (int enclSurfNum = 1; enclSurfNum <= thisEnclosure.NumOfSurfaces; ++enclSurfNum) { int const SurfNum = thisEnclosure.SurfacePtr(enclSurfNum); thisEnclosure.Area(enclSurfNum) = Surface(SurfNum).Area; - thisEnclosure.Emissivity(enclSurfNum) = dataConstruction.Construct(Surface(SurfNum).Construction).InsideAbsorpThermal; + thisEnclosure.Emissivity(enclSurfNum) = state.dataConstruction->Construct(Surface(SurfNum).Construction).InsideAbsorpThermal; thisEnclosure.Azimuth(enclSurfNum) = Surface(SurfNum).Azimuth; thisEnclosure.Tilt(enclSurfNum) = Surface(SurfNum).Tilt; } @@ -853,7 +854,7 @@ namespace HeatBalanceIntRadExchange { for (int surfNum = Zone(zoneNum).SurfaceFirst, surfNum_end = Zone(zoneNum).SurfaceLast; surfNum <= surfNum_end; ++surfNum) { // Do not include non-heat transfer surfaces, unless it is an air boundary interior window if (Surface(surfNum).Construction > 0) { - if (!Surface(surfNum).HeatTransSurf && !dataConstruction.Construct(Surface(surfNum).Construction).TypeIsAirBoundaryInteriorWindow) { + if (!Surface(surfNum).HeatTransSurf && !state.dataConstruction->Construct(Surface(surfNum).Construction).TypeIsAirBoundaryInteriorWindow) { continue; } } else if (!Surface(surfNum).HeatTransSurf) { @@ -880,7 +881,7 @@ namespace HeatBalanceIntRadExchange { for (int surfNum = Zone(zoneNum).SurfaceFirst, surfNum_end = Zone(zoneNum).SurfaceLast; surfNum <= surfNum_end; ++surfNum) { // Do not include non-heat transfer surfaces, unless it is an air boundary interior window if (Surface(surfNum).Construction > 0) { - if (!Surface(surfNum).HeatTransSurf && !dataConstruction.Construct(Surface(surfNum).Construction).TypeIsAirBoundaryInteriorWindow) { + if (!Surface(surfNum).HeatTransSurf && !state.dataConstruction->Construct(Surface(surfNum).Construction).TypeIsAirBoundaryInteriorWindow) { continue; } } else if (!Surface(surfNum).HeatTransSurf) { @@ -907,7 +908,7 @@ namespace HeatBalanceIntRadExchange { for (int enclSurfNum = 1; enclSurfNum <= thisEnclosure.NumOfSurfaces; ++enclSurfNum) { int const SurfNum = thisEnclosure.SurfacePtr(enclSurfNum); thisEnclosure.Area(enclSurfNum) = Surface(SurfNum).Area; - thisEnclosure.SolAbsorptance(enclSurfNum) = dataConstruction.Construct(Surface(SurfNum).Construction).InsideAbsorpSolar; + thisEnclosure.SolAbsorptance(enclSurfNum) = state.dataConstruction->Construct(Surface(SurfNum).Construction).InsideAbsorpSolar; thisEnclosure.Azimuth(enclSurfNum) = Surface(SurfNum).Azimuth; thisEnclosure.Tilt(enclSurfNum) = Surface(SurfNum).Tilt; } diff --git a/src/EnergyPlus/HeatBalanceIntRadExchange.hh b/src/EnergyPlus/HeatBalanceIntRadExchange.hh index 968fb3960c5..0fc93aee427 100644 --- a/src/EnergyPlus/HeatBalanceIntRadExchange.hh +++ b/src/EnergyPlus/HeatBalanceIntRadExchange.hh @@ -82,13 +82,15 @@ namespace HeatBalanceIntRadExchange { // Functions void clear_state(); - void CalcInteriorRadExchange(Array1S const SurfaceTemp, // Current surface temperatures + void CalcInteriorRadExchange(EnergyPlusData &state, + Array1S const SurfaceTemp, // Current surface temperatures int const SurfIterations, // Number of iterations in calling subroutine Array1D &NetLWRadToSurf, // Net long wavelength radiant exchange from other surfaces Optional_int_const ZoneToResimulate = _, // if passed in, then only calculate for this zone std::string const &CalledFrom = ""); - void UpdateMovableInsulationFlag(bool &MovableInsulationChange, // set to true if there is a change in the movable insulation state + void UpdateMovableInsulationFlag(EnergyPlusData &state, + bool &MovableInsulationChange, // set to true if there is a change in the movable insulation state int const SurfNum // surface number of surface being investigated ); diff --git a/src/EnergyPlus/HeatBalanceKivaManager.cc b/src/EnergyPlus/HeatBalanceKivaManager.cc index 522d15089df..3977e2484d5 100644 --- a/src/EnergyPlus/HeatBalanceKivaManager.cc +++ b/src/EnergyPlus/HeatBalanceKivaManager.cc @@ -356,7 +356,7 @@ namespace HeatBalanceKivaManager { } - void KivaInstanceMap::setBoundaryConditions() + void KivaInstanceMap::setBoundaryConditions(EnergyPlusData &state) { std::shared_ptr bcs = instance.bcs; @@ -377,7 +377,7 @@ namespace HeatBalanceKivaManager { DataHeatBalFanSys::QElecBaseboardSurf(floorSurface); // HVAC bcs->slabConvectiveTemp = DataHeatBalance::TempEffBulkAir(floorSurface) + DataGlobals::KelvinConv; - bcs->slabRadiantTemp = ThermalComfort::CalcSurfaceWeightedMRT(zoneNum, floorSurface) + DataGlobals::KelvinConv; + bcs->slabRadiantTemp = ThermalComfort::CalcSurfaceWeightedMRT(state, zoneNum, floorSurface) + DataGlobals::KelvinConv; bcs->gradeForcedTerm = kmPtr->surfaceConvMap[floorSurface].f; bcs->gradeConvectionAlgorithm = kmPtr->surfaceConvMap[floorSurface].out; bcs->slabConvectionAlgorithm = kmPtr->surfaceConvMap[floorSurface].in; @@ -397,7 +397,7 @@ namespace HeatBalanceKivaManager { Real64 &A = DataSurfaces::Surface(wl).Area; - Real64 Trad = ThermalComfort::CalcSurfaceWeightedMRT(zoneNum, wl); + Real64 Trad = ThermalComfort::CalcSurfaceWeightedMRT(state, zoneNum, wl); Real64 Tconv = DataHeatBalance::TempEffBulkAir(wl); QAtotal += Q * A; @@ -646,7 +646,7 @@ namespace HeatBalanceKivaManager { readWeatherData(state); auto &Surfaces = DataSurfaces::Surface; - auto &Constructs = dataConstruction.Construct; + auto &Constructs = state.dataConstruction->Construct; auto &Materials = dataMaterial.Material; int inst = 0; @@ -1061,7 +1061,7 @@ namespace HeatBalanceKivaManager { if (kv.constructionNum == 0) { constructionName = ""; } else { - constructionName = dataConstruction.Construct(kv.constructionNum).Name; + constructionName = state.dataConstruction->Construct(kv.constructionNum).Name; } std::string wallSurfaceString = ""; @@ -1097,11 +1097,11 @@ namespace HeatBalanceKivaManager { calcKivaSurfaceResults(); } - void KivaManager::calcKivaInstances() + void KivaManager::calcKivaInstances(EnergyPlusData &state) { // calculate heat transfer through ground for (auto &kv : kivaInstances) { - kv.setBoundaryConditions(); + kv.setBoundaryConditions(state); kv.instance.calculate(timestep); kv.instance.calculate_surface_averages(); if (DataEnvironment::Month == 1 && DataEnvironment::DayOfMonth == 1 && DataGlobals::HourOfDay == 1 && DataGlobals::TimeStep == 1) { diff --git a/src/EnergyPlus/HeatBalanceKivaManager.hh b/src/EnergyPlus/HeatBalanceKivaManager.hh index 92f6a477c83..e7fc7570475 100644 --- a/src/EnergyPlus/HeatBalanceKivaManager.hh +++ b/src/EnergyPlus/HeatBalanceKivaManager.hh @@ -110,7 +110,7 @@ namespace HeatBalanceKivaManager { Real64 zoneAssumedTemperature; void initGround(EnergyPlusData &state, const KivaWeatherData &kivaWeather); void setInitialBoundaryConditions(EnergyPlusData &state, const KivaWeatherData &kivaWeather, const int date, const int hour, const int timestep); - void setBoundaryConditions(); + void setBoundaryConditions(EnergyPlusData &state); void plotDomain(); Real64 floorWeight; int constructionNum; @@ -132,7 +132,7 @@ namespace HeatBalanceKivaManager { void readWeatherData(EnergyPlusData &state); bool setupKivaInstances(EnergyPlusData &state); void initKivaInstances(EnergyPlusData &state); - void calcKivaInstances(); + void calcKivaInstances(EnergyPlusData &state); void defineDefaultFoundation(); void addDefaultFoundation(); int findFoundation(std::string const &name); diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index e7988531d31..b322910fbc6 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -472,7 +472,7 @@ namespace HeatBalanceManager { GetScheduledSurfaceGains(state, ErrorsFound); // Added TH 1/9/2009 to create thermochromic window constructions - CreateTCConstructions(ErrorsFound); + CreateTCConstructions(state, ErrorsFound); if (TotSurfaces > 0 && NumOfZones == 0) { ValidSimulationWithNoZones = CheckValidSimulationObjects(); @@ -538,23 +538,23 @@ namespace HeatBalanceManager { for (Loop = 1; Loop <= NumObjects; ++Loop) { inputProcessor->getObjectItem(state, ConstrObjects(ONum), Loop, cAlphaArgs, NumAlphas, rNumericArgs, NumNumbers, Status); if (ONum == 5) { - CNum = UtilityRoutines::FindItemInList(cAlphaArgs(4), dataConstruction.Construct); + CNum = UtilityRoutines::FindItemInList(cAlphaArgs(4), state.dataConstruction->Construct); } else { - CNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct); + CNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); } if (CNum == 0) continue; - dataConstruction.Construct(CNum).IsUsed = true; + state.dataConstruction->Construct(CNum).IsUsed = true; if (ONum == 4 || ONum == 6) { // GroundHeatExchanger:Surface or EnergyManagementSystem:ConstructionIndexVariable // Include all EMS constructions since they can potentially be used by a CTF surface - if (!dataConstruction.Construct(CNum).TypeIsWindow) { - dataConstruction.Construct(CNum).IsUsedCTF = true; + if (!state.dataConstruction->Construct(CNum).TypeIsWindow) { + state.dataConstruction->Construct(CNum).IsUsedCTF = true; } } } } Unused = - TotConstructs - std::count_if(dataConstruction.Construct.begin(), dataConstruction.Construct.end(), [](Construction::ConstructionProps const &e) { return e.IsUsed; }); + TotConstructs - std::count_if(state.dataConstruction->Construct.begin(), state.dataConstruction->Construct.end(), [](Construction::ConstructionProps const &e) { return e.IsUsed; }); if (Unused > 0) { if (!DisplayExtraWarnings) { ShowWarningError("CheckUsedConstructions: There are " + RoundSigDigits(Unused) + " nominally unused constructions in input."); @@ -563,8 +563,8 @@ namespace HeatBalanceManager { ShowWarningError("CheckUsedConstructions: There are " + RoundSigDigits(Unused) + " nominally unused constructions in input."); ShowContinueError("Each Unused construction is shown."); for (Loop = 1; Loop <= TotConstructs; ++Loop) { - if (dataConstruction.Construct(Loop).IsUsed) continue; - ShowMessage("Construction=" + dataConstruction.Construct(Loop).Name); + if (state.dataConstruction->Construct(Loop).IsUsed) continue; + ShowMessage("Construction=" + state.dataConstruction->Construct(Loop).Name); } } } @@ -4239,11 +4239,11 @@ namespace HeatBalanceManager { NominalU.dimension(TotConstructs, 0.0); // Allocate the array to the number of constructions/initialize selected variables - dataConstruction.Construct.allocate(TotConstructs); + state.dataConstruction->Construct.allocate(TotConstructs); UniqueConstructNames.reserve(TotConstructs); // Note: If TotWindow5Constructs > 0, additional constructions are created in // subr. SearchWindow5DataFile corresponding to those found on the data file. - for (auto &e : dataConstruction.Construct) { + for (auto &e : state.dataConstruction->Construct) { // Initialize CTF and History terms e.NumCTFTerms = 0; e.NumHistories = 0; @@ -4287,10 +4287,10 @@ namespace HeatBalanceManager { ++ConstrNum; // Assign Construction name to the Derived Type using the zeroth position of the array - dataConstruction.Construct(ConstrNum).Name = ConstructAlphas(0); + state.dataConstruction->Construct(ConstrNum).Name = ConstructAlphas(0); // Set the total number of layers for the construction - dataConstruction.Construct(ConstrNum).TotLayers = ConstructNumAlpha - 1; + state.dataConstruction->Construct(ConstrNum).TotLayers = ConstructNumAlpha - 1; // Loop through all of the layers of the construct to match the material names. // The loop index is the number minus 1 @@ -4298,47 +4298,47 @@ namespace HeatBalanceManager { // Find the material in the list of materials - dataConstruction.Construct(ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(ConstructAlphas(Layer), dataMaterial.Material); + state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(ConstructAlphas(Layer), dataMaterial.Material); // count number of glass layers - if (dataConstruction.Construct(ConstrNum).LayerPoint(Layer) > 0) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).Group == WindowGlass) ++iMatGlass; - MaterialLayerGroup = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).Group; + if (state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer) > 0) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).Group == WindowGlass) ++iMatGlass; + MaterialLayerGroup = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).Group; if ((MaterialLayerGroup == GlassEquivalentLayer) || (MaterialLayerGroup == ShadeEquivalentLayer) || (MaterialLayerGroup == DrapeEquivalentLayer) || (MaterialLayerGroup == BlindEquivalentLayer) || (MaterialLayerGroup == ScreenEquivalentLayer) || (MaterialLayerGroup == GapEquivalentLayer)) { - ShowSevereError("Invalid material layer type in window " + CurrentModuleObject + " = " + dataConstruction.Construct(ConstrNum).Name); + ShowSevereError("Invalid material layer type in window " + CurrentModuleObject + " = " + state.dataConstruction->Construct(ConstrNum).Name); ShowSevereError("Equivalent Layer material type = " + ConstructAlphas(Layer) + " is allowed only in Construction:WindowEquivalentLayer window object."); ErrorsFound = true; } } - if (dataConstruction.Construct(ConstrNum).LayerPoint(Layer) == 0) { + if (state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer) == 0) { // This may be a TC GlazingGroup - dataConstruction.Construct(ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(ConstructAlphas(Layer), TCGlazings); + state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(ConstructAlphas(Layer), TCGlazings); - if (dataConstruction.Construct(ConstrNum).LayerPoint(Layer) > 0) { + if (state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer) > 0) { // reset layer pointer to the first glazing in the TC GlazingGroup - dataConstruction.Construct(ConstrNum).LayerPoint(Layer) = TCGlazings(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).LayerPoint(1); - dataConstruction.Construct(ConstrNum).TCLayer = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).Group == WindowGlass) ++iMatGlass; - dataConstruction.Construct(ConstrNum).TCFlag = 1; - dataConstruction.Construct(ConstrNum).TCMasterConst = ConstrNum; - dataConstruction.Construct(ConstrNum).TCGlassID = iMatGlass; // the TC glass layer ID - dataConstruction.Construct(ConstrNum).TCLayerID = Layer; - dataConstruction.Construct(ConstrNum).TypeIsWindow = true; + state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer) = TCGlazings(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).LayerPoint(1); + state.dataConstruction->Construct(ConstrNum).TCLayer = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).Group == WindowGlass) ++iMatGlass; + state.dataConstruction->Construct(ConstrNum).TCFlag = 1; + state.dataConstruction->Construct(ConstrNum).TCMasterConst = ConstrNum; + state.dataConstruction->Construct(ConstrNum).TCGlassID = iMatGlass; // the TC glass layer ID + state.dataConstruction->Construct(ConstrNum).TCLayerID = Layer; + state.dataConstruction->Construct(ConstrNum).TypeIsWindow = true; } } - if (dataConstruction.Construct(ConstrNum).LayerPoint(Layer) == 0) { - ShowSevereError("Did not find matching material for " + CurrentModuleObject + ' ' + dataConstruction.Construct(ConstrNum).Name + + if (state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer) == 0) { + ShowSevereError("Did not find matching material for " + CurrentModuleObject + ' ' + state.dataConstruction->Construct(ConstrNum).Name + ", missing material = " + ConstructAlphas(Layer)); ErrorsFound = true; } else { - NominalRforNominalUCalculation(ConstrNum) += NominalR(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)); - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).Group == RegularMaterial && - !dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).ROnly) { + NominalRforNominalUCalculation(ConstrNum) += NominalR(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)); + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).Group == RegularMaterial && + !dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).ROnly) { NoRegularMaterialsUsed = false; } } @@ -4400,14 +4400,14 @@ namespace HeatBalanceManager { } ++ConstrNum; - auto &thisConstruct (dataConstruction.Construct(TotRegConstructs + ConstrNum)); + auto &thisConstruct (state.dataConstruction->Construct(TotRegConstructs + ConstrNum)); // Assign Construction name to the Derived Type using the zeroth position of the array thisConstruct.Name = ConstructAlphas(0); // Obtain the source/sink data if (DummyNumProp != 5) { - ShowSevereError(CurrentModuleObject + ": Wrong number of numerical inputs for " + dataConstruction.Construct(ConstrNum).Name); + ShowSevereError(CurrentModuleObject + ": Wrong number of numerical inputs for " + state.dataConstruction->Construct(ConstrNum).Name); ErrorsFound = true; } thisConstruct.SourceSinkPresent = true; @@ -4453,7 +4453,7 @@ namespace HeatBalanceManager { thisConstruct.LayerPoint(Layer) = UtilityRoutines::FindItemInList(ConstructAlphas(Layer), dataMaterial.Material); if (thisConstruct.LayerPoint(Layer) == 0) { - ShowSevereError("Did not find matching material for " + CurrentModuleObject + ' ' + dataConstruction.Construct(ConstrNum).Name + + ShowSevereError("Did not find matching material for " + CurrentModuleObject + ' ' + state.dataConstruction->Construct(ConstrNum).Name + ", missing material = " + ConstructAlphas(Layer)); ErrorsFound = true; } else { @@ -4502,12 +4502,12 @@ namespace HeatBalanceManager { ++ConstrNum; // Assign Construction name to the Derived Type using the zeroth position of the array - dataConstruction.Construct(TotRegConstructs + ConstrNum).Name = ConstructAlphas(0); + state.dataConstruction->Construct(TotRegConstructs + ConstrNum).Name = ConstructAlphas(0); // Set the total number of layers for the construction - dataConstruction.Construct(TotRegConstructs + ConstrNum).TotLayers = ConstructNumAlpha - 1; - if (dataConstruction.Construct(TotRegConstructs + ConstrNum).TotLayers < 1) { - ShowSevereError("Construction " + dataConstruction.Construct(TotRegConstructs + ConstrNum).Name + " must have at least a single layer"); + state.dataConstruction->Construct(TotRegConstructs + ConstrNum).TotLayers = ConstructNumAlpha - 1; + if (state.dataConstruction->Construct(TotRegConstructs + ConstrNum).TotLayers < 1) { + ShowSevereError("Construction " + state.dataConstruction->Construct(TotRegConstructs + ConstrNum).Name + " must have at least a single layer"); ErrorsFound = true; } @@ -4516,19 +4516,19 @@ namespace HeatBalanceManager { for (Layer = 1; Layer <= ConstructNumAlpha - 1; ++Layer) { // Find the material in the list of materials - dataConstruction.Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(ConstructAlphas(Layer), dataMaterial.Material); + state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(ConstructAlphas(Layer), dataMaterial.Material); - if (dataConstruction.Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer) == 0) { - ShowSevereError("Did not find matching material for " + CurrentModuleObject + ' ' + dataConstruction.Construct(ConstrNum).Name + + if (state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer) == 0) { + ShowSevereError("Did not find matching material for " + CurrentModuleObject + ' ' + state.dataConstruction->Construct(ConstrNum).Name + ", missing material = " + ConstructAlphas(Layer)); ErrorsFound = true; } else { - MaterialLayerGroup = dataMaterial.Material(dataConstruction.Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer)).Group; + MaterialLayerGroup = dataMaterial.Material(state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer)).Group; if (!((MaterialLayerGroup == GlassEquivalentLayer) || (MaterialLayerGroup == ShadeEquivalentLayer) || (MaterialLayerGroup == DrapeEquivalentLayer) || (MaterialLayerGroup == BlindEquivalentLayer) || (MaterialLayerGroup == ScreenEquivalentLayer) || (MaterialLayerGroup == GapEquivalentLayer))) { ShowSevereError("Invalid material layer type in window " + CurrentModuleObject + " = " + - dataConstruction.Construct(TotRegConstructs + ConstrNum).Name); + state.dataConstruction->Construct(TotRegConstructs + ConstrNum).Name); ShowContinueError("...Window layer = " + ConstructAlphas(Layer) + " is not allowed in Construction:WindowEquivalentLayer window object."); ShowContinueError("Only materials of type Material:*:EquivalentLayer are allowed"); @@ -4539,13 +4539,13 @@ namespace HeatBalanceManager { } else { NominalRforNominalUCalculation(TotRegConstructs + ConstrNum) += - NominalR(dataConstruction.Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer)); + NominalR(state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer)); } } } // Layer loop - dataConstruction.Construct(TotRegConstructs + ConstrNum).EQLConsPtr = ConstrNum; - dataConstruction.Construct(TotRegConstructs + ConstrNum).WindowTypeEQL = true; + state.dataConstruction->Construct(TotRegConstructs + ConstrNum).EQLConsPtr = ConstrNum; + state.dataConstruction->Construct(TotRegConstructs + ConstrNum).WindowTypeEQL = true; } // TotWinEquivLayerConstructs loop TotWinEquivLayerConstructs = ConstrNum; @@ -4618,17 +4618,17 @@ namespace HeatBalanceManager { for (ConstrNum = 1; ConstrNum <= TotConstructs; ++ConstrNum) { // For air boundaries, skip TypeIsAirBoundaryGroupedRadiant, process TypeIsAirBoundaryIRTSurface - if (dataConstruction.Construct(ConstrNum).TypeIsAirBoundaryGroupedRadiant) continue; + if (state.dataConstruction->Construct(ConstrNum).TypeIsAirBoundaryGroupedRadiant) continue; if (NominalRforNominalUCalculation(ConstrNum) != 0.0) { NominalU(ConstrNum) = 1.0 / NominalRforNominalUCalculation(ConstrNum); } else { - if (!dataConstruction.Construct(ConstrNum).WindowTypeEQL) { - ShowSevereError("Nominal U is zero, for construction=" + dataConstruction.Construct(ConstrNum).Name); + if (!state.dataConstruction->Construct(ConstrNum).WindowTypeEQL) { + ShowSevereError("Nominal U is zero, for construction=" + state.dataConstruction->Construct(ConstrNum).Name); ErrorsFound = true; } } - CheckAndSetConstructionProperties(ConstrNum, ErrorsFound); + CheckAndSetConstructionProperties(state, ConstrNum, ErrorsFound); } // End of ConstrNum DO loop } @@ -5278,8 +5278,8 @@ namespace HeatBalanceManager { } if (DataGlobals::AnyEnergyManagementSystemInModel) { - HeatBalanceSurfaceManager::InitEMSControlledConstructions(); - HeatBalanceSurfaceManager::InitEMSControlledSurfaceProperties(); + HeatBalanceSurfaceManager::InitEMSControlledConstructions(state); + HeatBalanceSurfaceManager::InitEMSControlledSurfaceProperties(state); } if (TotStormWin > 0) { @@ -5630,7 +5630,7 @@ namespace HeatBalanceManager { } // For non-complex windows, update a report variable so this shows up in the output as something other than zero - UpdateWindowFaceTempsNonBSDFWin(); + UpdateWindowFaceTempsNonBSDFWin(state); } void CheckWarmupConvergence() @@ -5907,7 +5907,7 @@ namespace HeatBalanceManager { } } - void UpdateWindowFaceTempsNonBSDFWin() + void UpdateWindowFaceTempsNonBSDFWin(EnergyPlusData &state) { int SurfNum; @@ -5916,9 +5916,9 @@ namespace HeatBalanceManager { auto &thisSurface(DataSurfaces::Surface(SurfNum)); if (thisSurface.Class == DataSurfaces::SurfaceClass_Window) { auto &thisConstruct(thisSurface.Construction); - if (!dataConstruction.Construct(thisConstruct).WindowTypeBSDF && !dataConstruction.Construct(thisConstruct).TypeIsAirBoundaryInteriorWindow) { + if (!state.dataConstruction->Construct(thisConstruct).WindowTypeBSDF && !state.dataConstruction->Construct(thisConstruct).TypeIsAirBoundaryInteriorWindow) { SurfWinFenLaySurfTempFront(1, SurfNum) = TH(1, 1, SurfNum); - SurfWinFenLaySurfTempBack(dataConstruction.Construct(thisConstruct).TotLayers, SurfNum) = TH(2, 1, SurfNum); + SurfWinFenLaySurfTempBack(state.dataConstruction->Construct(thisConstruct).TotLayers, SurfNum) = TH(2, 1, SurfNum); } } } @@ -6746,7 +6746,7 @@ namespace HeatBalanceManager { // reallocate Construct types TotConstructs += NGlSys; - dataConstruction.Construct.redimension(TotConstructs); + state.dataConstruction->Construct.redimension(TotConstructs); NominalRforNominalUCalculation.redimension(TotConstructs); NominalU.redimension(TotConstructs); @@ -6769,81 +6769,81 @@ namespace HeatBalanceManager { for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { ConstrNum = TotConstructs - NGlSys + IGlSys; if (IGlSys == 1) { - dataConstruction.Construct(ConstrNum).Name = DesiredConstructionName; + state.dataConstruction->Construct(ConstrNum).Name = DesiredConstructionName; } else { - dataConstruction.Construct(ConstrNum).Name = DesiredConstructionName + ":2"; + state.dataConstruction->Construct(ConstrNum).Name = DesiredConstructionName + ":2"; } for (loop = 1; loop <= Construction::MaxLayersInConstruct; ++loop) { - dataConstruction.Construct(ConstrNum).LayerPoint(loop) = 0; - } - dataConstruction.Construct(ConstrNum).InsideAbsorpSolar = 0.0; - dataConstruction.Construct(ConstrNum).OutsideAbsorpSolar = 0.0; - dataConstruction.Construct(ConstrNum).DayltPropPtr = 0; - dataConstruction.Construct(ConstrNum).CTFCross = 0.0; - dataConstruction.Construct(ConstrNum).CTFFlux = 0.0; - dataConstruction.Construct(ConstrNum).CTFInside = 0.0; - dataConstruction.Construct(ConstrNum).CTFOutside = 0.0; - dataConstruction.Construct(ConstrNum).CTFSourceIn = 0.0; - dataConstruction.Construct(ConstrNum).CTFSourceOut = 0.0; - dataConstruction.Construct(ConstrNum).CTFTimeStep = 0.0; - dataConstruction.Construct(ConstrNum).CTFTSourceOut = 0.0; - dataConstruction.Construct(ConstrNum).CTFTSourceIn = 0.0; - dataConstruction.Construct(ConstrNum).CTFTSourceQ = 0.0; - dataConstruction.Construct(ConstrNum).CTFTUserOut = 0.0; - dataConstruction.Construct(ConstrNum).CTFTUserIn = 0.0; - dataConstruction.Construct(ConstrNum).CTFTUserSource = 0.0; - dataConstruction.Construct(ConstrNum).NumHistories = 0; - dataConstruction.Construct(ConstrNum).NumCTFTerms = 0; - dataConstruction.Construct(ConstrNum).UValue = 0.0; - dataConstruction.Construct(ConstrNum).SourceSinkPresent = false; - dataConstruction.Construct(ConstrNum).SolutionDimensions = 0; - dataConstruction.Construct(ConstrNum).SourceAfterLayer = 0; - dataConstruction.Construct(ConstrNum).TempAfterLayer = 0; - dataConstruction.Construct(ConstrNum).ThicknessPerpend = 0.0; - dataConstruction.Construct(ConstrNum).AbsDiff = 0.0; - dataConstruction.Construct(ConstrNum).AbsDiffBack = 0.0; - dataConstruction.Construct(ConstrNum).AbsDiffShade = 0.0; - dataConstruction.Construct(ConstrNum).AbsDiffBackShade = 0.0; - dataConstruction.Construct(ConstrNum).ShadeAbsorpThermal = 0.0; - dataConstruction.Construct(ConstrNum).AbsBeamCoef = 0.0; - dataConstruction.Construct(ConstrNum).AbsBeamBackCoef = 0.0; - dataConstruction.Construct(ConstrNum).AbsBeamShadeCoef = 0.0; - dataConstruction.Construct(ConstrNum).AbsDiffIn = 0.0; - dataConstruction.Construct(ConstrNum).AbsDiffOut = 0.0; - dataConstruction.Construct(ConstrNum).TransDiff = 0.0; - dataConstruction.Construct(ConstrNum).TransDiffVis = 0.0; - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack = 0.0; - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront = 0.0; - dataConstruction.Construct(ConstrNum).ReflectVisDiffBack = 0.0; - dataConstruction.Construct(ConstrNum).ReflectVisDiffFront = 0.0; - dataConstruction.Construct(ConstrNum).TransSolBeamCoef = 0.0; - dataConstruction.Construct(ConstrNum).TransVisBeamCoef = 0.0; - dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef = 0.0; - dataConstruction.Construct(ConstrNum).ReflSolBeamBackCoef = 0.0; - dataConstruction.Construct(ConstrNum).W5FrameDivider = 0; - dataConstruction.Construct(ConstrNum).TotLayers = NGlass(IGlSys) + NGaps(IGlSys); - dataConstruction.Construct(ConstrNum).TotGlassLayers = NGlass(IGlSys); - dataConstruction.Construct(ConstrNum).TotSolidLayers = NGlass(IGlSys); + state.dataConstruction->Construct(ConstrNum).LayerPoint(loop) = 0; + } + state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar = 0.0; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpSolar = 0.0; + state.dataConstruction->Construct(ConstrNum).DayltPropPtr = 0; + state.dataConstruction->Construct(ConstrNum).CTFCross = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFFlux = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFInside = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFOutside = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFSourceIn = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFSourceOut = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFTimeStep = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFTSourceOut = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFTSourceIn = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFTSourceQ = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFTUserOut = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFTUserIn = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFTUserSource = 0.0; + state.dataConstruction->Construct(ConstrNum).NumHistories = 0; + state.dataConstruction->Construct(ConstrNum).NumCTFTerms = 0; + state.dataConstruction->Construct(ConstrNum).UValue = 0.0; + state.dataConstruction->Construct(ConstrNum).SourceSinkPresent = false; + state.dataConstruction->Construct(ConstrNum).SolutionDimensions = 0; + state.dataConstruction->Construct(ConstrNum).SourceAfterLayer = 0; + state.dataConstruction->Construct(ConstrNum).TempAfterLayer = 0; + state.dataConstruction->Construct(ConstrNum).ThicknessPerpend = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsDiff = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsDiffBack = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsDiffShade = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsDiffBackShade = 0.0; + state.dataConstruction->Construct(ConstrNum).ShadeAbsorpThermal = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsBeamCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsBeamBackCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsBeamShadeCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsDiffIn = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsDiffOut = 0.0; + state.dataConstruction->Construct(ConstrNum).TransDiff = 0.0; + state.dataConstruction->Construct(ConstrNum).TransDiffVis = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront = 0.0; + state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).TransVisBeamCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflSolBeamBackCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).W5FrameDivider = 0; + state.dataConstruction->Construct(ConstrNum).TotLayers = NGlass(IGlSys) + NGaps(IGlSys); + state.dataConstruction->Construct(ConstrNum).TotGlassLayers = NGlass(IGlSys); + state.dataConstruction->Construct(ConstrNum).TotSolidLayers = NGlass(IGlSys); for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { - dataConstruction.Construct(ConstrNum).LayerPoint(2 * IGlass - 1) = MaterNumSysGlass(IGlass, IGlSys); - if (IGlass < NGlass(IGlSys)) dataConstruction.Construct(ConstrNum).LayerPoint(2 * IGlass) = MaterNumSysGap(IGlass, IGlSys); + state.dataConstruction->Construct(ConstrNum).LayerPoint(2 * IGlass - 1) = MaterNumSysGlass(IGlass, IGlSys); + if (IGlass < NGlass(IGlSys)) state.dataConstruction->Construct(ConstrNum).LayerPoint(2 * IGlass) = MaterNumSysGap(IGlass, IGlSys); } - dataConstruction.Construct(ConstrNum).OutsideRoughness = VerySmooth; - dataConstruction.Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(TotMaterialsPrev + NGlass(IGlSys)).AbsorpThermalBack; - dataConstruction.Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(TotMaterialsPrev + 1).AbsorpThermalFront; - dataConstruction.Construct(ConstrNum).TypeIsWindow = true; - dataConstruction.Construct(ConstrNum).FromWindow5DataFile = true; - dataConstruction.Construct(ConstrNum).W5FileGlazingSysHeight = WinHeight(IGlSys); - dataConstruction.Construct(ConstrNum).W5FileGlazingSysWidth = WinWidth(IGlSys); + state.dataConstruction->Construct(ConstrNum).OutsideRoughness = VerySmooth; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(TotMaterialsPrev + NGlass(IGlSys)).AbsorpThermalBack; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(TotMaterialsPrev + 1).AbsorpThermalFront; + state.dataConstruction->Construct(ConstrNum).TypeIsWindow = true; + state.dataConstruction->Construct(ConstrNum).FromWindow5DataFile = true; + state.dataConstruction->Construct(ConstrNum).W5FileGlazingSysHeight = WinHeight(IGlSys); + state.dataConstruction->Construct(ConstrNum).W5FileGlazingSysWidth = WinWidth(IGlSys); if (UtilityRoutines::SameString(MullionOrientation, "Vertical")) { - dataConstruction.Construct(ConstrNum).W5FileMullionOrientation = Vertical; + state.dataConstruction->Construct(ConstrNum).W5FileMullionOrientation = Vertical; } else if (UtilityRoutines::SameString(MullionOrientation, "Horizontal")) { - dataConstruction.Construct(ConstrNum).W5FileMullionOrientation = Horizontal; + state.dataConstruction->Construct(ConstrNum).W5FileMullionOrientation = Horizontal; } else { } - dataConstruction.Construct(ConstrNum).W5FileMullionWidth = MullionWidth; + state.dataConstruction->Construct(ConstrNum).W5FileMullionWidth = MullionWidth; // Fill Construct with system transmission, reflection and absorption properties @@ -6983,27 +6983,27 @@ namespace HeatBalanceManager { " from the Window5 data file cannot be used because of above errors"); // Hemis - dataConstruction.Construct(ConstrNum).TransDiff = Tsol(11); - dataConstruction.Construct(ConstrNum).TransDiffVis = Tvis(11); - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront = Rfsol(11); - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack = Rbsol(11); - dataConstruction.Construct(ConstrNum).ReflectVisDiffFront = Rfvis(11); - dataConstruction.Construct(ConstrNum).ReflectVisDiffBack = Rbvis(11); - - W5LsqFit(CosPhiIndepVar, Tsol, 6, 1, 10, dataConstruction.Construct(ConstrNum).TransSolBeamCoef); - W5LsqFit(CosPhiIndepVar, Tvis, 6, 1, 10, dataConstruction.Construct(ConstrNum).TransVisBeamCoef); - W5LsqFit(CosPhiIndepVar, Rfsol, 6, 1, 10, dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef); + state.dataConstruction->Construct(ConstrNum).TransDiff = Tsol(11); + state.dataConstruction->Construct(ConstrNum).TransDiffVis = Tvis(11); + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront = Rfsol(11); + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack = Rbsol(11); + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront = Rfvis(11); + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack = Rbvis(11); + + W5LsqFit(CosPhiIndepVar, Tsol, 6, 1, 10, state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); + W5LsqFit(CosPhiIndepVar, Tvis, 6, 1, 10, state.dataConstruction->Construct(ConstrNum).TransVisBeamCoef); + W5LsqFit(CosPhiIndepVar, Rfsol, 6, 1, 10, state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef); for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { - W5LsqFit(CosPhiIndepVar, AbsSol(_, IGlass), 6, 1, 10, dataConstruction.Construct(ConstrNum).AbsBeamCoef(_, IGlass)); + W5LsqFit(CosPhiIndepVar, AbsSol(_, IGlass), 6, 1, 10, state.dataConstruction->Construct(ConstrNum).AbsBeamCoef(_, IGlass)); } // For comparing fitted vs. input distribution in incidence angle for (IPhi = 1; IPhi <= 10; ++IPhi) { - tsolFit(IPhi) = POLYF(CosPhi(IPhi), dataConstruction.Construct(ConstrNum).TransSolBeamCoef); - tvisFit(IPhi) = POLYF(CosPhi(IPhi), dataConstruction.Construct(ConstrNum).TransVisBeamCoef); - rfsolFit(IPhi) = POLYF(CosPhi(IPhi), dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef); + tsolFit(IPhi) = POLYF(CosPhi(IPhi), state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); + tvisFit(IPhi) = POLYF(CosPhi(IPhi), state.dataConstruction->Construct(ConstrNum).TransVisBeamCoef); + rfsolFit(IPhi) = POLYF(CosPhi(IPhi), state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef); for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { - solabsFit(IGlass, IPhi) = POLYF(CosPhi(IPhi), dataConstruction.Construct(ConstrNum).AbsBeamCoef({1, 6}, IGlass)); + solabsFit(IGlass, IPhi) = POLYF(CosPhi(IPhi), state.dataConstruction->Construct(ConstrNum).AbsBeamCoef({1, 6}, IGlass)); } } // end @@ -7012,7 +7012,7 @@ namespace HeatBalanceManager { // conductivity here ignores convective effects in gap.) NominalRforNominalUCalculation(ConstrNum) = 0.0; for (loop = 1; loop <= NGlass(IGlSys) + NGaps(IGlSys); ++loop) { - MatNum = dataConstruction.Construct(ConstrNum).LayerPoint(loop); + MatNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(loop); if (dataMaterial.Material(MatNum).Group == WindowGlass) { NominalRforNominalUCalculation(ConstrNum) += dataMaterial.Material(MatNum).Thickness / dataMaterial.Material(MatNum).Conductivity; } else if (dataMaterial.Material(MatNum).Group == WindowGas || dataMaterial.Material(MatNum).Group == WindowGasMixture) { @@ -7031,7 +7031,7 @@ namespace HeatBalanceManager { for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { if (FrameWidth > 0.0 || DividerWidth(IGlSys) > 0.0) { ++TotFrameDivider; - dataConstruction.Construct(TotConstructs - NGlSys + IGlSys).W5FrameDivider = TotFrameDivider; + state.dataConstruction->Construct(TotConstructs - NGlSys + IGlSys).W5FrameDivider = TotFrameDivider; } } @@ -7041,7 +7041,7 @@ namespace HeatBalanceManager { for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { if (FrameWidth > 0.0 || DividerWidth(IGlSys) > 0.0) { - FrDivNum = dataConstruction.Construct(TotConstructs - NGlSys + IGlSys).W5FrameDivider; + FrDivNum = state.dataConstruction->Construct(TotConstructs - NGlSys + IGlSys).W5FrameDivider; FrameDivider(FrDivNum).FrameWidth = FrameWidth; FrameDivider(FrDivNum).FrameProjectionOut = FrameProjectionOut; FrameDivider(FrDivNum).FrameProjectionIn = FrameProjectionIn; @@ -7272,16 +7272,16 @@ namespace HeatBalanceManager { ++ConstrNum; - dataConstruction.Construct(ConstrNum).Name = ConstructAlphas(1); - dataConstruction.Construct(ConstrNum).TypeIsFfactorFloor = true; + state.dataConstruction->Construct(ConstrNum).Name = ConstructAlphas(1); + state.dataConstruction->Construct(ConstrNum).TypeIsFfactorFloor = true; Ffactor = DummyProps(1); Area = DummyProps(2); PerimeterExposed = DummyProps(3); - dataConstruction.Construct(ConstrNum).Area = Area; - dataConstruction.Construct(ConstrNum).PerimeterExposed = PerimeterExposed; - dataConstruction.Construct(ConstrNum).FFactor = Ffactor; + state.dataConstruction->Construct(ConstrNum).Area = Area; + state.dataConstruction->Construct(ConstrNum).PerimeterExposed = PerimeterExposed; + state.dataConstruction->Construct(ConstrNum).FFactor = Ffactor; if (Ffactor <= 0.0) { ShowSevereError(CurrentModuleObject + "=\"" + ConstructAlphas(1) + "\" has " + cNumericFieldNames(1) + " <= 0.0, must be > 0.0."); @@ -7302,14 +7302,14 @@ namespace HeatBalanceManager { } // The construction has two layers which have been created in GetMaterialData - dataConstruction.Construct(ConstrNum).TotLayers = 2; + state.dataConstruction->Construct(ConstrNum).TotLayers = 2; // The concrete is the inside layer - dataConstruction.Construct(ConstrNum).LayerPoint(2) = iFCConcreteLayer; + state.dataConstruction->Construct(ConstrNum).LayerPoint(2) = iFCConcreteLayer; // The fictitious insulation is the outside layer MaterNum = UtilityRoutines::FindItemInList("~FC_Insulation_" + RoundSigDigits(Loop), dataMaterial.Material); - dataConstruction.Construct(ConstrNum).LayerPoint(1) = MaterNum; + state.dataConstruction->Construct(ConstrNum).LayerPoint(1) = MaterNum; // Calculate the thermal resistance of the fictitious insulation layer // effective thermal resistance excludes inside and outside air films @@ -7359,14 +7359,14 @@ namespace HeatBalanceManager { ++ConstrNum; - dataConstruction.Construct(ConstrNum).Name = ConstructAlphas(1); - dataConstruction.Construct(ConstrNum).TypeIsCfactorWall = true; + state.dataConstruction->Construct(ConstrNum).Name = ConstructAlphas(1); + state.dataConstruction->Construct(ConstrNum).TypeIsCfactorWall = true; Cfactor = DummyProps(1); Height = DummyProps(2); - dataConstruction.Construct(ConstrNum).Height = Height; - dataConstruction.Construct(ConstrNum).CFactor = Cfactor; + state.dataConstruction->Construct(ConstrNum).Height = Height; + state.dataConstruction->Construct(ConstrNum).CFactor = Cfactor; if (Cfactor <= 0.0) { ShowSevereError(CurrentModuleObject + ' ' + ConstructAlphas(1) + " has " + cNumericFieldNames(1) + " <= 0.0, must be > 0.0."); @@ -7381,14 +7381,14 @@ namespace HeatBalanceManager { } // The construction has two layers which have been created in GetMaterialData - dataConstruction.Construct(ConstrNum).TotLayers = 2; + state.dataConstruction->Construct(ConstrNum).TotLayers = 2; // The concrete is the inside layer - dataConstruction.Construct(ConstrNum).LayerPoint(2) = iFCConcreteLayer; + state.dataConstruction->Construct(ConstrNum).LayerPoint(2) = iFCConcreteLayer; // The fictitious insulation is the outside layer MaterNum = UtilityRoutines::FindItemInList("~FC_Insulation_" + RoundSigDigits(Loop + TotFfactorConstructs), dataMaterial.Material); - dataConstruction.Construct(ConstrNum).LayerPoint(1) = MaterNum; + state.dataConstruction->Construct(ConstrNum).LayerPoint(1) = MaterNum; // CR 8886 Rsoil should be in SI unit. From ASHRAE 90.1-2010 SI if (Height <= 0.25) { @@ -7447,7 +7447,7 @@ namespace HeatBalanceManager { } ++constrNum; - auto &thisConstruct = dataConstruction.Construct(constrNum); + auto &thisConstruct = state.dataConstruction->Construct(constrNum); thisConstruct.Name = UtilityRoutines::MakeUPPERCase(thisObjectName); thisConstruct.TypeIsAirBoundary = true; @@ -7617,7 +7617,7 @@ namespace HeatBalanceManager { } // Assign construction number - ConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(3), dataConstruction.Construct); + ConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataConstruction->Construct); if (ConstrNum == 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + ", object. Illegal value for " + cAlphaFieldNames(3) + " has been found."); @@ -7687,7 +7687,7 @@ namespace HeatBalanceManager { } // Assign construction number - ConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(3), dataConstruction.Construct); + ConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataConstruction->Construct); if (ConstrNum == 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + ", object. Illegal value for " + cAlphaFieldNames(3) + " has been found."); @@ -7699,7 +7699,7 @@ namespace HeatBalanceManager { NumOfScheduledLayers = NumAlpha - 3; NumOfLayersMatch = false; // Check if number of layers in construction matches number of layers in schedule surface gains object - if (NumOfScheduledLayers == dataConstruction.Construct(ConstrNum).TotSolidLayers) { + if (NumOfScheduledLayers == state.dataConstruction->Construct(ConstrNum).TotSolidLayers) { NumOfLayersMatch = true; } @@ -7708,7 +7708,7 @@ namespace HeatBalanceManager { RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + ", object. Number of scheduled surface gains for each layer does not match number of layers in referenced construction."); ShowContinueError(cAlphaArgs(1) + " have " + TrimSigDigits(NumOfScheduledLayers) + " scheduled layers and " + cAlphaArgs(3) + - " have " + TrimSigDigits(dataConstruction.Construct(ConstrNum).TotSolidLayers) + " layers."); + " have " + TrimSigDigits(state.dataConstruction->Construct(ConstrNum).TotSolidLayers) + " layers."); ErrorsFound = true; } @@ -7838,7 +7838,7 @@ namespace HeatBalanceManager { } } - void CreateTCConstructions(bool &EP_UNUSED(ErrorsFound)) // If errors found in input + void CreateTCConstructions(EnergyPlusData &state, bool &EP_UNUSED(ErrorsFound)) // If errors found in input { // SUBROUTINE INFORMATION: @@ -7887,8 +7887,8 @@ namespace HeatBalanceManager { NumNewConst = 0; for (Loop = 1; Loop <= TotConstructs; ++Loop) { - if (dataConstruction.Construct(Loop).TCFlag == 1) { - iTCG = dataMaterial.Material(dataConstruction.Construct(Loop).TCLayer).TCParent; + if (state.dataConstruction->Construct(Loop).TCFlag == 1) { + iTCG = dataMaterial.Material(state.dataConstruction->Construct(Loop).TCLayer).TCParent; if (iTCG == 0) continue; // hope this was caught already iMat = TCGlazings(iTCG).NumGlzMat; for (iTC = 1; iTC <= iMat; ++iTC) { @@ -7900,27 +7900,27 @@ namespace HeatBalanceManager { if (NumNewConst == 0) return; // no need to go further // Increase Construct() and copy the extra constructions - dataConstruction.Construct.redimension(TotConstructs + NumNewConst); + state.dataConstruction->Construct.redimension(TotConstructs + NumNewConst); NominalRforNominalUCalculation.redimension(TotConstructs + NumNewConst); NominalU.redimension(TotConstructs + NumNewConst); NumNewConst = TotConstructs; for (Loop = 1; Loop <= TotConstructs; ++Loop) { - if (dataConstruction.Construct(Loop).TCFlag == 1) { - iTCG = dataMaterial.Material(dataConstruction.Construct(Loop).TCLayer).TCParent; + if (state.dataConstruction->Construct(Loop).TCFlag == 1) { + iTCG = dataMaterial.Material(state.dataConstruction->Construct(Loop).TCLayer).TCParent; if (iTCG == 0) continue; // hope this was caught already iMat = TCGlazings(iTCG).NumGlzMat; for (iTC = 1; iTC <= iMat; ++iTC) { ++NumNewConst; - dataConstruction.Construct(NumNewConst) = dataConstruction.Construct(Loop); // copy data - dataConstruction.Construct(NumNewConst).Name = dataConstruction.Construct(Loop).Name + "_TC_" + RoundSigDigits(TCGlazings(iTCG).SpecTemp(iTC), 0); - dataConstruction.Construct(NumNewConst).TCLayer = TCGlazings(iTCG).LayerPoint(iTC); - dataConstruction.Construct(NumNewConst).LayerPoint(dataConstruction.Construct(Loop).TCLayerID) = dataConstruction.Construct(NumNewConst).TCLayer; - dataConstruction.Construct(NumNewConst).TCFlag = 1; - dataConstruction.Construct(NumNewConst).TCMasterConst = Loop; - dataConstruction.Construct(NumNewConst).TCLayerID = dataConstruction.Construct(Loop).TCLayerID; - dataConstruction.Construct(NumNewConst).TCGlassID = dataConstruction.Construct(Loop).TCGlassID; - dataConstruction.Construct(NumNewConst).TypeIsWindow = true; + state.dataConstruction->Construct(NumNewConst) = state.dataConstruction->Construct(Loop); // copy data + state.dataConstruction->Construct(NumNewConst).Name = state.dataConstruction->Construct(Loop).Name + "_TC_" + RoundSigDigits(TCGlazings(iTCG).SpecTemp(iTC), 0); + state.dataConstruction->Construct(NumNewConst).TCLayer = TCGlazings(iTCG).LayerPoint(iTC); + state.dataConstruction->Construct(NumNewConst).LayerPoint(state.dataConstruction->Construct(Loop).TCLayerID) = state.dataConstruction->Construct(NumNewConst).TCLayer; + state.dataConstruction->Construct(NumNewConst).TCFlag = 1; + state.dataConstruction->Construct(NumNewConst).TCMasterConst = Loop; + state.dataConstruction->Construct(NumNewConst).TCLayerID = state.dataConstruction->Construct(Loop).TCLayerID; + state.dataConstruction->Construct(NumNewConst).TCGlassID = state.dataConstruction->Construct(Loop).TCGlassID; + state.dataConstruction->Construct(NumNewConst).TypeIsWindow = true; } } } @@ -8716,12 +8716,12 @@ namespace HeatBalanceManager { // Simon TODO: This is to be confirmed. If this is just initial value, then we might want to make better guess NominalRforNominalUCalculation(ConstrNum) = 0.1; // Simon TODO: If I do not put this, then it is considered that surface is NOT window - dataConstruction.Construct(ConstrNum).TransDiff = 0.1; // This is a place holder to flag + state.dataConstruction->Construct(ConstrNum).TransDiff = 0.1; // This is a place holder to flag // the construction as a window until // the correct value is entered in WindowComplexManager // Now override the deraults as appropriate - dataConstruction.Construct(ConstrNum).Name = locAlphaArgs(1); + state.dataConstruction->Construct(ConstrNum).Name = locAlphaArgs(1); // ALLOCATE(Construct(ConstrNum)%BSDFInput) @@ -8730,9 +8730,9 @@ namespace HeatBalanceManager { { auto const SELECT_CASE_var(locAlphaArgs(2)); // Basis Type Keyword if (SELECT_CASE_var == "LBNLWINDOW") { - dataConstruction.Construct(ConstrNum).BSDFInput.BasisType = BasisType_WINDOW; + state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisType = BasisType_WINDOW; } else if (SELECT_CASE_var == "USERDEFINED") { - dataConstruction.Construct(ConstrNum).BSDFInput.BasisType = BasisType_Custom; + state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisType = BasisType_Custom; } else { // throw error ErrorsFound = true; @@ -8745,9 +8745,9 @@ namespace HeatBalanceManager { { auto const SELECT_CASE_var(locAlphaArgs(3)); // Basis Symmetry Keyword if (SELECT_CASE_var == "AXISYMMETRIC") { - dataConstruction.Construct(ConstrNum).BSDFInput.BasisSymmetryType = BasisSymmetry_Axisymmetric; + state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisSymmetryType = BasisSymmetry_Axisymmetric; } else if (SELECT_CASE_var == "NONE") { - dataConstruction.Construct(ConstrNum).BSDFInput.BasisSymmetryType = BasisSymmetry_None; + state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisSymmetryType = BasisSymmetry_None; } else { // throw error ErrorsFound = true; @@ -8765,16 +8765,16 @@ namespace HeatBalanceManager { ShowContinueError(locAlphaFieldNames(4) + " entered value = \"" + locAlphaArgs(4) + "\" no corresponding thermal model (WindowThermalModel:Params) found in the input file."); } else { - dataConstruction.Construct(ConstrNum).BSDFInput.ThermalModel = ThermalModelNum; + state.dataConstruction->Construct(ConstrNum).BSDFInput.ThermalModel = ThermalModelNum; } // *************************************************************************************** // Basis matrix // *************************************************************************************** - dataConstruction.Construct(ConstrNum).BSDFInput.BasisMatIndex = MatrixIndex(state, locAlphaArgs(5)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.BasisMatIndex, NumRows, NumCols); - dataConstruction.Construct(ConstrNum).BSDFInput.BasisMatNrows = NumRows; - dataConstruction.Construct(ConstrNum).BSDFInput.BasisMatNcols = NumCols; + state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisMatIndex = MatrixIndex(state, locAlphaArgs(5)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisMatIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisMatNrows = NumRows; + state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisMatNcols = NumCols; if (NumCols != 2 && NumCols != 1) { ErrorsFound = true; @@ -8783,19 +8783,19 @@ namespace HeatBalanceManager { ShowContinueError(locAlphaFieldNames(5) + " entered value=\"" + locAlphaArgs(5) + "\" invalid matrix dimensions. Basis matrix dimension can only be 2 x 1."); } - dataConstruction.Construct(ConstrNum).BSDFInput.BasisMat.allocate(NumCols, NumRows); - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.BasisMatIndex, dataConstruction.Construct(ConstrNum).BSDFInput.BasisMat); - if (dataConstruction.Construct(ConstrNum).BSDFInput.BasisType == BasisType_WINDOW) - CalculateBasisLength(dataConstruction.Construct(ConstrNum).BSDFInput, ConstrNum, dataConstruction.Construct(ConstrNum).BSDFInput.NBasis); + state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisMat.allocate(NumCols, NumRows); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisMatIndex, state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisMat); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisType == BasisType_WINDOW) + CalculateBasisLength(state, state.dataConstruction->Construct(ConstrNum).BSDFInput, ConstrNum, state.dataConstruction->Construct(ConstrNum).BSDFInput.NBasis); // determine number of layers and optical layers NumOfTotalLayers = (NumAlphas - 9) / 3; - dataConstruction.Construct(ConstrNum).TotLayers = NumOfTotalLayers; + state.dataConstruction->Construct(ConstrNum).TotLayers = NumOfTotalLayers; NumOfOpticalLayers = NumOfTotalLayers / 2 + 1; - dataConstruction.Construct(ConstrNum).BSDFInput.NumLayers = NumOfOpticalLayers; - dataConstruction.Construct(ConstrNum).BSDFInput.Layer.allocate(NumOfOpticalLayers); + state.dataConstruction->Construct(ConstrNum).BSDFInput.NumLayers = NumOfOpticalLayers; + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer.allocate(NumOfOpticalLayers); // check for incomplete field set if (mod((NumAlphas - 9), 3) != 0) { @@ -8805,18 +8805,18 @@ namespace HeatBalanceManager { ShowContinueError(locAlphaArgs(1) + " is missing some of the layers or/and gaps."); } - if (dataConstruction.Construct(ConstrNum).BSDFInput.BasisSymmetryType == BasisSymmetry_None) { + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisSymmetryType == BasisSymmetry_None) { // Non-Symmetric basis - NBasis = dataConstruction.Construct(ConstrNum).BSDFInput.NBasis; + NBasis = state.dataConstruction->Construct(ConstrNum).BSDFInput.NBasis; // ******************************************************************************* // Solar front transmittance // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransIndex = MatrixIndex(state, locAlphaArgs(6)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransIndex, NumRows, NumCols); - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransNrows = NumRows; - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransNcols = NumCols; + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransIndex = MatrixIndex(state, locAlphaArgs(6)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransNrows = NumRows; + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransNcols = NumCols; if (NumRows != NBasis) { ErrorsFound = true; @@ -8833,28 +8833,28 @@ namespace HeatBalanceManager { ShowContinueError("Solar front transmittance matrix \"" + locAlphaArgs(6) + "\" must have the same number of rows and columns."); } - if (dataConstruction.Construct(ConstrNum).BSDFInput.BasisType == BasisType_Custom) { - dataConstruction.Construct(ConstrNum).BSDFInput.NBasis = NumRows; // For custom basis, no rows in transmittance + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.BasisType == BasisType_Custom) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.NBasis = NumRows; // For custom basis, no rows in transmittance // matrix defines the basis length } - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTrans.allocate(NumCols, NumRows); - if (dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTrans.allocate(NumCols, NumRows); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Solar front transmittance Matrix:TwoDimension = \"" + locAlphaArgs(6) + "\" is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransIndex, dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTrans); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransIndex, state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTrans); } // ******************************************************************************* // Solar back reflectance // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflIndex = MatrixIndex(state, locAlphaArgs(7)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflIndex, NumRows, NumCols); - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflNrows = NumRows; - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflNcols = NumCols; + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflIndex = MatrixIndex(state, locAlphaArgs(7)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflNrows = NumRows; + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflNcols = NumCols; if (NumRows != NBasis) { ErrorsFound = true; @@ -8871,23 +8871,23 @@ namespace HeatBalanceManager { ShowContinueError("Solar bakc reflectance matrix \"" + locAlphaArgs(7) + "\" must have the same number of rows and columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkRefl.allocate(NumCols, NumRows); - if (dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkRefl.allocate(NumCols, NumRows); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Solar back reflectance Matrix:TwoDimension = \"" + locAlphaArgs(7) + "\" is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflIndex, dataConstruction.Construct(ConstrNum).BSDFInput.SolBkRefl); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflIndex, state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkRefl); } // ******************************************************************************* // Visible front transmittance // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransIndex = MatrixIndex(state, locAlphaArgs(8)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransIndex, NumRows, NumCols); - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransNrows = NumRows; - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransNcols = NumCols; + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransIndex = MatrixIndex(state, locAlphaArgs(8)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransNrows = NumRows; + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransNcols = NumCols; if (NumRows != NBasis) { ErrorsFound = true; @@ -8905,24 +8905,24 @@ namespace HeatBalanceManager { "\" must have the same number of rows and columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTrans.allocate(NumCols, NumRows); - if (dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTrans.allocate(NumCols, NumRows); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Visible front transmittance Matrix:TwoDimension = \"" + locAlphaArgs(8) + "\" is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransIndex, dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTrans); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransIndex, state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTrans); } // ******************************************************************************* // Visible back reflectance // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflIndex = MatrixIndex(state, locAlphaArgs(9)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflIndex, NumRows, NumCols); - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflNrows = NumRows; - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflNcols = NumCols; + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflIndex = MatrixIndex(state, locAlphaArgs(9)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflNrows = NumRows; + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflNcols = NumCols; if (NumRows != NBasis) { ErrorsFound = true; @@ -8939,33 +8939,33 @@ namespace HeatBalanceManager { ShowContinueError("Visible back reflectance \"" + locAlphaArgs(9) + "\" must have the same number of rows and columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkRefl.allocate(NumCols, NumRows); - if (dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkRefl.allocate(NumCols, NumRows); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Visble back reflectance Matrix:TwoDimension = \"" + locAlphaArgs(9) + "\" is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflIndex, dataConstruction.Construct(ConstrNum).BSDFInput.VisBkRefl); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflIndex, state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkRefl); } // ALLOCATE(Construct(ConstrNum)%BSDFInput%Layer(NumOfOpticalLayers)) - for (Layer = 1; Layer <= dataConstruction.Construct(ConstrNum).TotLayers; ++Layer) { + for (Layer = 1; Layer <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Layer) { AlphaIndex = 9 + (Layer * 3) - 2; currentOpticalLayer = int(Layer / 2) + 1; // Material info is contained in the thermal construct - dataConstruction.Construct(ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(locAlphaArgs(AlphaIndex), dataMaterial.Material); + state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(locAlphaArgs(AlphaIndex), dataMaterial.Material); // Simon: Load only if optical layer if (mod(Layer, 2) != 0) { - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).MaterialIndex = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).MaterialIndex = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); ++AlphaIndex; // ******************************************************************************* // Front absorptance matrix // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex = MatrixIndex(state, locAlphaArgs(AlphaIndex)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex = MatrixIndex(state, locAlphaArgs(AlphaIndex)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, NumRows, NumCols); if (NumRows != 1) { ErrorsFound = true; @@ -8986,25 +8986,25 @@ namespace HeatBalanceManager { RoundSigDigits(NBasis) + " number of columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).AbsNcols = NumCols; - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbs.allocate(NumCols, NumRows); - if (dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).AbsNcols = NumCols; + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbs.allocate(NumCols, NumRows); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Front absorbtance Matrix:TwoDimension = \"" + locAlphaArgs(AlphaIndex) + "\" for layer " + RoundSigDigits(currentOpticalLayer) + " is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbs); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbs); } ++AlphaIndex; // ******************************************************************************* // Back absorptance matrix // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex = MatrixIndex(state, locAlphaArgs(AlphaIndex)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex = MatrixIndex(state, locAlphaArgs(AlphaIndex)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, NumRows, NumCols); if (NumRows != 1) { ErrorsFound = true; @@ -9025,31 +9025,31 @@ namespace HeatBalanceManager { RoundSigDigits(NBasis) + " number of columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbs.allocate(NumCols, NumRows); - if (dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbs.allocate(NumCols, NumRows); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Back absorbtance Matrix:TwoDimension = \"" + locAlphaArgs(AlphaIndex) + "\" for layer " + RoundSigDigits(currentOpticalLayer) + " is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbs); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbs); } } // if (Mod(Layer, 2) <> 0) then } } else { // Axisymmetric basis - NBasis = dataConstruction.Construct(ConstrNum).BSDFInput.NBasis; // Basis length has already been calculated + NBasis = state.dataConstruction->Construct(ConstrNum).BSDFInput.NBasis; // Basis length has already been calculated BSDFTempMtrx.allocate(NBasis, 1); // ******************************************************************************* // Solar front transmittance // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransIndex = MatrixIndex(state, locAlphaArgs(6)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransIndex, NumRows, NumCols); - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransNrows = NBasis; - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransNcols = NBasis; + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransIndex = MatrixIndex(state, locAlphaArgs(6)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransNrows = NBasis; + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransNcols = NBasis; if (NumRows != NBasis) { ErrorsFound = true; @@ -9066,28 +9066,28 @@ namespace HeatBalanceManager { ShowContinueError("Solar front transmittance matrix \"" + locAlphaArgs(6) + "\" must have the same number of rows and columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTrans.allocate(NBasis, NBasis); - if (dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTrans.allocate(NBasis, NBasis); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Solar front transmittance Matrix:TwoDimension = \"" + locAlphaArgs(6) + "\" is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTransIndex, BSDFTempMtrx); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTransIndex, BSDFTempMtrx); - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTrans = 0.0; + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTrans = 0.0; for (I = 1; I <= NBasis; ++I) { - dataConstruction.Construct(ConstrNum).BSDFInput.SolFrtTrans(I, I) = BSDFTempMtrx(I, 1); + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolFrtTrans(I, I) = BSDFTempMtrx(I, 1); } } // ******************************************************************************* // Solar back reflectance // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflIndex = MatrixIndex(state, locAlphaArgs(7)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflIndex, NumRows, NumCols); - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflNrows = NBasis; - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflNcols = NBasis; + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflIndex = MatrixIndex(state, locAlphaArgs(7)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflNrows = NBasis; + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflNcols = NBasis; if (NumRows != NBasis) { ErrorsFound = true; @@ -9104,27 +9104,27 @@ namespace HeatBalanceManager { ShowContinueError("Solar back reflectance matrix \"" + locAlphaArgs(7) + "\" must have the same number of rows and columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkRefl.allocate(NBasis, NBasis); - if (dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkRefl.allocate(NBasis, NBasis); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Solar back reflectance Matrix:TwoDimension = \"" + locAlphaArgs(7) + "\" is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.SolBkReflIndex, BSDFTempMtrx); - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkRefl = 0.0; + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkReflIndex, BSDFTempMtrx); + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkRefl = 0.0; for (I = 1; I <= NBasis; ++I) { - dataConstruction.Construct(ConstrNum).BSDFInput.SolBkRefl(I, I) = BSDFTempMtrx(I, 1); + state.dataConstruction->Construct(ConstrNum).BSDFInput.SolBkRefl(I, I) = BSDFTempMtrx(I, 1); } } // ******************************************************************************* // Visible front transmittance // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransIndex = MatrixIndex(state, locAlphaArgs(8)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransIndex, NumRows, NumCols); - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransNrows = NBasis; - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransNcols = NBasis; + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransIndex = MatrixIndex(state, locAlphaArgs(8)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransNrows = NBasis; + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransNcols = NBasis; if (NumRows != NBasis) { ErrorsFound = true; @@ -9142,28 +9142,28 @@ namespace HeatBalanceManager { "\" must have the same number of rows and columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTrans.allocate(NBasis, NBasis); - if (dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTrans.allocate(NBasis, NBasis); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Visible front transmittance Matrix:TwoDimension = \"" + locAlphaArgs(8) + "\" is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTransIndex, BSDFTempMtrx); - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTrans = 0.0; + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTransIndex, BSDFTempMtrx); + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTrans = 0.0; for (I = 1; I <= NBasis; ++I) { - dataConstruction.Construct(ConstrNum).BSDFInput.VisFrtTrans(I, I) = BSDFTempMtrx(I, 1); + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisFrtTrans(I, I) = BSDFTempMtrx(I, 1); } } // ******************************************************************************* // Visible back reflectance // ******************************************************************************* - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflIndex = MatrixIndex(state, locAlphaArgs(9)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflIndex, NumRows, NumCols); - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflNrows = NBasis; - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflNcols = NBasis; + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflIndex = MatrixIndex(state, locAlphaArgs(9)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflNrows = NBasis; + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflNcols = NBasis; if (NumRows != NBasis) { ErrorsFound = true; @@ -9180,17 +9180,17 @@ namespace HeatBalanceManager { ShowContinueError("Visible back reflectance matrix \"" + locAlphaArgs(9) + "\" must have the same number of rows and columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkRefl.allocate(NBasis, NBasis); - if (dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflIndex == 0) { + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkRefl.allocate(NBasis, NBasis); + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Visible back reflectance Matrix:TwoDimension = \"" + locAlphaArgs(9) + "\" is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.VisBkReflIndex, BSDFTempMtrx); - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkRefl = 0.0; + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkReflIndex, BSDFTempMtrx); + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkRefl = 0.0; for (I = 1; I <= NBasis; ++I) { - dataConstruction.Construct(ConstrNum).BSDFInput.VisBkRefl(I, I) = BSDFTempMtrx(I, 1); + state.dataConstruction->Construct(ConstrNum).BSDFInput.VisBkRefl(I, I) = BSDFTempMtrx(I, 1); } } @@ -9205,21 +9205,21 @@ namespace HeatBalanceManager { // ENDIF // ALLOCATE(Construct(ConstrNum)%BSDFInput%Layer(NumOfOpticalLayers)) - for (Layer = 1; Layer <= dataConstruction.Construct(ConstrNum).TotLayers; ++Layer) { + for (Layer = 1; Layer <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Layer) { AlphaIndex = 9 + (Layer * 3) - 2; currentOpticalLayer = int(Layer / 2) + 1; - dataConstruction.Construct(ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(locAlphaArgs(AlphaIndex), dataMaterial.Material); + state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer) = UtilityRoutines::FindItemInList(locAlphaArgs(AlphaIndex), dataMaterial.Material); if (mod(Layer, 2) != 0) { - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).MaterialIndex = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).MaterialIndex = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); // ******************************************************************************* // Front absorptance matrix // ******************************************************************************* ++AlphaIndex; - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex = MatrixIndex(state, locAlphaArgs(AlphaIndex)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex = MatrixIndex(state, locAlphaArgs(AlphaIndex)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, NumRows, NumCols); if (NumRows != 1) { ErrorsFound = true; @@ -9240,26 +9240,26 @@ namespace HeatBalanceManager { RoundSigDigits(NBasis) + " number of columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).AbsNcols = NumCols; - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbs.allocate(NumCols, NumRows); + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).AbsNcols = NumCols; + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbs.allocate(NumCols, NumRows); - if (dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Front absorbtance Matrix:TwoDimension = \"" + locAlphaArgs(AlphaIndex) + "\" for layer " + RoundSigDigits(currentOpticalLayer) + " is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbs); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).FrtAbs); } // ******************************************************************************* // Back absorptance matrix // ******************************************************************************* ++AlphaIndex; - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex = MatrixIndex(state, locAlphaArgs(AlphaIndex)); - Get2DMatrixDimensions(dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, NumRows, NumCols); + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex = MatrixIndex(state, locAlphaArgs(AlphaIndex)); + Get2DMatrixDimensions(state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, NumRows, NumCols); if (NumRows != 1) { ErrorsFound = true; @@ -9280,25 +9280,25 @@ namespace HeatBalanceManager { RoundSigDigits(NBasis) + " number of columns."); } - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbs.allocate(NumCols, NumRows); + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbs.allocate(NumCols, NumRows); - if (dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { + if (state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { ErrorsFound = true; ShowSevereError(RoutineName + locCurrentModuleObject + "=\"" + locAlphaArgs(1) + ", object. Referenced Matrix:TwoDimension is missing from the input file."); ShowContinueError("Back absorbtance Matrix:TwoDimension = \"" + locAlphaArgs(AlphaIndex) + "\" for layer " + RoundSigDigits(currentOpticalLayer) + " is missing from the input file."); } else { - Get2DMatrix(dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, - dataConstruction.Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbs); + Get2DMatrix(state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, + state.dataConstruction->Construct(ConstrNum).BSDFInput.Layer(currentOpticalLayer).BkAbs); } } // if (Mod(Layer, 2) <> 0) then } BSDFTempMtrx.deallocate(); } - dataConstruction.Construct(ConstrNum).TypeIsWindow = true; - dataConstruction.Construct(ConstrNum).WindowTypeBSDF = true; + state.dataConstruction->Construct(ConstrNum).TypeIsWindow = true; + state.dataConstruction->Construct(ConstrNum).WindowTypeBSDF = true; } // Do not forget to deallocate localy allocated variables @@ -9316,8 +9316,8 @@ namespace HeatBalanceManager { { bool ErrorsFound(false); // Flag for input error condition bool DoCTFErrorReport(false); - for (auto & construction : dataConstruction.Construct) { - construction.calculateTransferFunction(ErrorsFound, DoCTFErrorReport); + for (auto & construction : state.dataConstruction->Construct) { + construction.calculateTransferFunction(state, ErrorsFound, DoCTFErrorReport); } bool InitCTFDoReport; @@ -9333,7 +9333,7 @@ namespace HeatBalanceManager { print(state.files.eio, "! ,Time,Outside,Cross,Inside,Flux (except final one)\n"); int cCounter = 0; // just used to keep construction index in output report - for (auto & construction : dataConstruction.Construct) { + for (auto & construction : state.dataConstruction->Construct) { cCounter++; if (!construction.IsUsedCTF) continue; construction.reportTransferFunction(state, cCounter); diff --git a/src/EnergyPlus/HeatBalanceManager.hh b/src/EnergyPlus/HeatBalanceManager.hh index 6ebfb3a3df3..a75d1e80db5 100644 --- a/src/EnergyPlus/HeatBalanceManager.hh +++ b/src/EnergyPlus/HeatBalanceManager.hh @@ -213,7 +213,7 @@ namespace HeatBalanceManager { void ReportWarmupConvergence(EnergyPlusData &state); - void UpdateWindowFaceTempsNonBSDFWin(); + void UpdateWindowFaceTempsNonBSDFWin(EnergyPlusData &state); // End of Record Keeping subroutines for the HB Module // ***************************************************************************** @@ -253,7 +253,7 @@ namespace HeatBalanceManager { void CheckScheduledSurfaceGains(int const ZoneNum); // Zone number for which error check will be performed - void CreateTCConstructions(bool &ErrorsFound); // If errors found in input + void CreateTCConstructions(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input void SetupSimpleWindowGlazingSystem(int &MaterNum); diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index db5a446ee3e..1e172d36531 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -290,14 +290,14 @@ namespace HeatBalanceSurfaceManager { // Before we leave the Surface Manager the thermal histories need to be updated if (DataHeatBalance::AnyCTF || DataHeatBalance::AnyEMPD) { - UpdateThermalHistories(); // Update the thermal histories + UpdateThermalHistories(state); // Update the thermal histories } if (DataHeatBalance::AnyCondFD) { for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (Surface(SurfNum).Construction <= 0) continue; // Shading surface, not really a heat transfer surface ConstrNum = Surface(SurfNum).Construction; - if (dataConstruction.Construct(ConstrNum).TypeIsWindow) continue; // Windows simulated in Window module + if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) continue; // Windows simulated in Window module if (Surface(SurfNum).HeatTransferAlgorithm != HeatTransferModel_CondFD) continue; SurfaceFD(SurfNum).UpdateMoistureBalance(); } @@ -491,7 +491,7 @@ namespace HeatBalanceSurfaceManager { // Do the Begin Environment initializations if (BeginEnvrnFlag) { if (InitSurfaceHeatBalancefirstTime) DisplayString("Initializing Temperature and Flux Histories"); - InitThermalAndFluxHistories(); // Set initial temperature and flux histories + InitThermalAndFluxHistories(state); // Set initial temperature and flux histories } // There are no daily initializations done in this portion of the surface heat balance @@ -520,17 +520,17 @@ namespace HeatBalanceSurfaceManager { // gains is absorbed by interior surfaces if (InitSurfaceHeatBalancefirstTime) DisplayString("Computing Interior Absorption Factors"); if (InitSurfaceHeatBalancefirstTime) HeatBalanceIntRadExchange::InitInteriorRadExchange(state); - ComputeIntThermalAbsorpFactors(); + ComputeIntThermalAbsorpFactors(state); // Calculate factors for diffuse solar absorbed by room surfaces and interior shades if (InitSurfaceHeatBalancefirstTime) DisplayString("Computing Interior Diffuse Solar Absorption Factors"); - ComputeIntSWAbsorpFactors(); + ComputeIntSWAbsorpFactors(state); if (InterZoneWindow) { if (InitSurfaceHeatBalancefirstTime) { DisplayString("Computing Interior Diffuse Solar Exchange through Interzone Windows"); } - ComputeDifSolExcZonesWIZWindows(NumOfZones); + ComputeDifSolExcZonesWIZWindows(state, NumOfZones); } // For daylit zones, calculate interior daylight illuminance at reference points and @@ -561,8 +561,8 @@ namespace HeatBalanceSurfaceManager { if (SunIsUp && ZoneDaylight(NZ).TotalDaylRefPoints != 0) { if (InitSurfaceHeatBalancefirstTime) DisplayString("Computing Interior Daylighting Illumination"); - DayltgInteriorIllum(NZ); - if (!DoingSizing) DayltgInteriorMapIllum(NZ); + DayltgInteriorIllum(state, NZ); + if (!DoingSizing) DayltgInteriorMapIllum(state, NZ); } if (SunIsUp && NumOfTDDPipes > 0 && NZ == 1) { @@ -707,7 +707,7 @@ namespace HeatBalanceSurfaceManager { } } - CalcInteriorRadExchange(TH(2, 1, _), 0, SurfNetLWRadToSurf, _, "Main"); + CalcInteriorRadExchange(state, TH(2, 1, _), 0, SurfNetLWRadToSurf, _, "Main"); if (AirflowWindows) WindowGapAirflowControl(); @@ -720,7 +720,7 @@ namespace HeatBalanceSurfaceManager { for (int NZ = 1; NZ <= NumOfZones; ++NZ) { if (ZoneDaylight(NZ).TotalDaylRefPoints > 0) { if (Zone(NZ).HasInterZoneWindow) { - DayltgInterReflIllFrIntWins(NZ); + DayltgInterReflIllFrIntWins(state, NZ); DayltgGlareWithIntWins(ZoneDaylight(NZ).GlareIndexAtRefPt, NZ); } DayltgElecLightingControl(state, NZ); @@ -736,7 +736,7 @@ namespace HeatBalanceSurfaceManager { if (InitSurfaceHeatBalancefirstTime) DisplayString("Initializing Internal Heat Gains"); ManageInternalHeatGains(state, false); if (InitSurfaceHeatBalancefirstTime) DisplayString("Initializing Interior Solar Distribution"); - InitIntSolarDistribution(); + InitIntSolarDistribution(state); if (InitSurfaceHeatBalancefirstTime) DisplayString("Initializing Interior Convection Coefficients"); InitInteriorConvectionCoeffs(state, TempSurfInTmp); @@ -774,7 +774,7 @@ namespace HeatBalanceSurfaceManager { // Window layer temperatures are calculated in CalcHeatBalanceInsideSurf int ConstrNum = surface.Construction; - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); if (construct.NumCTFTerms > 1) { // COMPUTE CONSTANT PORTION OF CONDUCTIVE FLUXES. Real64 QIC = 0.0; @@ -972,8 +972,8 @@ namespace HeatBalanceSurfaceManager { if ((SELECT_CASE_var == SurfaceClass_Wall) || (SELECT_CASE_var == SurfaceClass_Floor) || (SELECT_CASE_var == SurfaceClass_Roof)) { surfName = Surface(iSurf).Name; curCons = Surface(iSurf).Construction; - PreDefTableEntry(pdchOpCons, surfName, dataConstruction.Construct(curCons).Name); - PreDefTableEntry(pdchOpRefl, surfName, 1 - dataConstruction.Construct(curCons).OutsideAbsorpSolar); + PreDefTableEntry(pdchOpCons, surfName, state.dataConstruction->Construct(curCons).Name); + PreDefTableEntry(pdchOpRefl, surfName, 1 - state.dataConstruction->Construct(curCons).OutsideAbsorpSolar); PreDefTableEntry(pdchOpUfactNoFilm, surfName, NominalU(Surface(iSurf).Construction), 3); mult = Zone(zonePt).Multiplier * Zone(zonePt).ListMultiplier; PreDefTableEntry(pdchOpGrArea, surfName, Surface(iSurf).GrossArea * mult); @@ -999,7 +999,7 @@ namespace HeatBalanceSurfaceManager { } else if ((SELECT_CASE_var == SurfaceClass_Window) || (SELECT_CASE_var == SurfaceClass_TDD_Dome)) { surfName = Surface(iSurf).Name; curCons = Surface(iSurf).Construction; - PreDefTableEntry(pdchFenCons, surfName, dataConstruction.Construct(curCons).Name); + PreDefTableEntry(pdchFenCons, surfName, state.dataConstruction->Construct(curCons).Name); zonePt = Surface(iSurf).Zone; mult = Zone(zonePt).Multiplier * Zone(zonePt).ListMultiplier * Surface(iSurf).Multiplier; // include the frame area if present @@ -1030,12 +1030,12 @@ namespace HeatBalanceSurfaceManager { nomUfact = NominalU(Surface(iSurf).Construction); PreDefTableEntry(pdchFenUfact, surfName, nomUfact, 3); // if the construction report is requested the SummerSHGC is already calculated - if (dataConstruction.Construct(curCons).SummerSHGC != 0) { - SHGCSummer = dataConstruction.Construct(curCons).SummerSHGC; - TransVisNorm = dataConstruction.Construct(curCons).VisTransNorm; + if (state.dataConstruction->Construct(curCons).SummerSHGC != 0) { + SHGCSummer = state.dataConstruction->Construct(curCons).SummerSHGC; + TransVisNorm = state.dataConstruction->Construct(curCons).VisTransNorm; } else { // must calculate Summer SHGC - if (!dataConstruction.Construct(curCons).WindowTypeEQL) { + if (!state.dataConstruction->Construct(curCons).WindowTypeEQL) { CalcNominalWindowCond(state, curCons, 2, nomCond, SHGCSummer, TransSolNorm, TransVisNorm, errFlag); } } @@ -1156,11 +1156,11 @@ namespace HeatBalanceSurfaceManager { std::string names = ""; for (auto construction : Surface(iSurf).shadedConstructionList) { if (!names.empty()) names.append("; "); - names.append(dataConstruction.Construct(construction).Name); + names.append(state.dataConstruction->Construct(construction).Name); } for (auto construction : Surface(iSurf).shadedStormWinConstructionList) { if (!names.empty()) names.append("; "); - names.append(dataConstruction.Construct(construction).Name); + names.append(state.dataConstruction->Construct(construction).Name); } PreDefTableEntry(pdchWscShadCons, surfName, names); @@ -1175,7 +1175,7 @@ namespace HeatBalanceSurfaceManager { } else if (SELECT_CASE_var == SurfaceClass_Door) { surfName = Surface(iSurf).Name; curCons = Surface(iSurf).Construction; - PreDefTableEntry(pdchDrCons, surfName, dataConstruction.Construct(curCons).Name); + PreDefTableEntry(pdchDrCons, surfName, state.dataConstruction->Construct(curCons).Name); PreDefTableEntry(pdchDrUfactNoFilm, surfName, NominalU(Surface(iSurf).Construction), 3); mult = Zone(zonePt).Multiplier * Zone(zonePt).ListMultiplier; PreDefTableEntry(pdchDrGrArea, surfName, Surface(iSurf).GrossArea * mult); @@ -1189,8 +1189,8 @@ namespace HeatBalanceSurfaceManager { if((Surface(iSurf).Class == SurfaceClass_Wall) || (Surface(iSurf).Class == SurfaceClass_Floor) || (Surface(iSurf).Class == SurfaceClass_Roof)) { surfName = Surface(iSurf).Name; curCons = Surface(iSurf).Construction; - PreDefTableEntry(pdchIntOpCons, surfName, dataConstruction.Construct(curCons).Name); - PreDefTableEntry(pdchIntOpRefl, surfName, 1 - dataConstruction.Construct(curCons).OutsideAbsorpSolar); + PreDefTableEntry(pdchIntOpCons, surfName, state.dataConstruction->Construct(curCons).Name); + PreDefTableEntry(pdchIntOpRefl, surfName, 1 - state.dataConstruction->Construct(curCons).OutsideAbsorpSolar); PreDefTableEntry(pdchIntOpUfactNoFilm, surfName, NominalU(Surface(iSurf).Construction), 3); mult = Zone(zonePt).Multiplier * Zone(zonePt).ListMultiplier; PreDefTableEntry(pdchIntOpGrArea, surfName, Surface(iSurf).GrossArea * mult); @@ -1214,11 +1214,11 @@ namespace HeatBalanceSurfaceManager { } } // interior window report - }else if (((Surface(iSurf).Class == SurfaceClass_Window) || (Surface(iSurf).Class == SurfaceClass_TDD_Dome)) && (!dataConstruction.Construct(Surface(iSurf).Construction).TypeIsAirBoundaryInteriorWindow)) { + }else if (((Surface(iSurf).Class == SurfaceClass_Window) || (Surface(iSurf).Class == SurfaceClass_TDD_Dome)) && (!state.dataConstruction->Construct(Surface(iSurf).Construction).TypeIsAirBoundaryInteriorWindow)) { if (!has_prefix(Surface(iSurf).Name, "iz-")) { // don't count created interzone surfaces that are mirrors of other surfaces surfName = Surface(iSurf).Name; curCons = Surface(iSurf).Construction; - PreDefTableEntry(pdchIntFenCons, surfName, dataConstruction.Construct(curCons).Name); + PreDefTableEntry(pdchIntFenCons, surfName, state.dataConstruction->Construct(curCons).Name); zonePt = Surface(iSurf).Zone; mult = Zone(zonePt).Multiplier * Zone(zonePt).ListMultiplier * Surface(iSurf).Multiplier; // include the frame area if present @@ -1236,12 +1236,12 @@ namespace HeatBalanceSurfaceManager { nomUfact = NominalU(Surface(iSurf).Construction); PreDefTableEntry(pdchIntFenUfact, surfName, nomUfact, 3); // if the construction report is requested the SummerSHGC is already calculated - if (dataConstruction.Construct(curCons).SummerSHGC != 0) { - SHGCSummer = dataConstruction.Construct(curCons).SummerSHGC; - TransVisNorm = dataConstruction.Construct(curCons).VisTransNorm; + if (state.dataConstruction->Construct(curCons).SummerSHGC != 0) { + SHGCSummer = state.dataConstruction->Construct(curCons).SummerSHGC; + TransVisNorm = state.dataConstruction->Construct(curCons).VisTransNorm; } else { // must calculate Summer SHGC - if (!dataConstruction.Construct(curCons).WindowTypeEQL) { + if (!state.dataConstruction->Construct(curCons).WindowTypeEQL) { CalcNominalWindowCond(state, curCons, 2, nomCond, SHGCSummer, TransSolNorm, TransVisNorm, errFlag); } } @@ -1257,7 +1257,7 @@ namespace HeatBalanceSurfaceManager { }else if (Surface(iSurf).Class == SurfaceClass_Door) { surfName = Surface(iSurf).Name; curCons = Surface(iSurf).Construction; - PreDefTableEntry(pdchIntDrCons, surfName, dataConstruction.Construct(curCons).Name); + PreDefTableEntry(pdchIntDrCons, surfName, state.dataConstruction->Construct(curCons).Name); PreDefTableEntry(pdchIntDrUfactNoFilm, surfName, NominalU(Surface(iSurf).Construction), 3); mult = Zone(zonePt).Multiplier * Zone(zonePt).ListMultiplier; PreDefTableEntry(pdchIntDrGrArea, surfName, Surface(iSurf).GrossArea * mult); @@ -1975,7 +1975,7 @@ namespace HeatBalanceSurfaceManager { "State", Surface(loop).Name); } - if (dataConstruction.Construct(Surface(loop).Construction).SourceSinkPresent) { + if (state.dataConstruction->Construct(Surface(loop).Construction).SourceSinkPresent) { SetupOutputVariable(state, "Surface Internal Source Location Temperature", OutputProcessor::Unit::C, TempSource(loop), "Zone", "State", Surface(loop).Name); SetupOutputVariable(state, "Surface Internal User Specified Location Temperature", @@ -2086,7 +2086,7 @@ namespace HeatBalanceSurfaceManager { "Site Total Surface Heat Emission to Air", OutputProcessor::Unit::J, SumSurfaceHeatEmission, "Zone", "Sum", "Environment"); } - void InitThermalAndFluxHistories() + void InitThermalAndFluxHistories(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -2250,18 +2250,18 @@ namespace HeatBalanceSurfaceManager { // Reset outside boundary conditions if necessary if ((Surface(SurfNum).ExtBoundCond == ExternalEnvironment) || (Surface(SurfNum).ExtBoundCond == OtherSideCondModeledExt)) { - THM(1, {1, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = Surface(SurfNum).OutDryBulbTemp; - TH(1, {1, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = Surface(SurfNum).OutDryBulbTemp; + THM(1, {1, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = Surface(SurfNum).OutDryBulbTemp; + TH(1, {1, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = Surface(SurfNum).OutDryBulbTemp; } else if (Surface(SurfNum).ExtBoundCond == Ground) { - THM(1, {1, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = GroundTemp; - TH(1, {1, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = GroundTemp; + THM(1, {1, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = GroundTemp; + TH(1, {1, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = GroundTemp; } else if (Surface(SurfNum).ExtBoundCond == GroundFCfactorMethod) { - THM(1, {1, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = GroundTempFC; - TH(1, {1, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = GroundTempFC; + THM(1, {1, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = GroundTempFC; + TH(1, {1, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = GroundTempFC; } if (Surface(SurfNum).ExtCavityPresent) { @@ -2277,11 +2277,11 @@ namespace HeatBalanceSurfaceManager { } // Initialize the flux histories - QH(1, {2, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = - dataConstruction.Construct(Surface(SurfNum).Construction).UValue * (TH(1, 1, SurfNum) - TH(2, 1, SurfNum)); - QH(2, {2, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = QH(1, 2, SurfNum); - QHM(1, {2, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = QH(1, 2, SurfNum); - QHM(2, {2, dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = QH(1, 2, SurfNum); + QH(1, {2, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = + state.dataConstruction->Construct(Surface(SurfNum).Construction).UValue * (TH(1, 1, SurfNum) - TH(2, 1, SurfNum)); + QH(2, {2, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = QH(1, 2, SurfNum); + QHM(1, {2, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = QH(1, 2, SurfNum); + QHM(2, {2, state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms + 1}, SurfNum) = QH(1, 2, SurfNum); } if (TotOSCM >= 1) { @@ -2630,7 +2630,7 @@ namespace HeatBalanceSurfaceManager { CalcWindowProfileAngles(); - if (CalcWindowRevealReflection) CalcBeamSolarOnWinRevealSurface(); + if (CalcWindowRevealReflection) CalcBeamSolarOnWinRevealSurface(state); if (state.dataWindowManager->inExtWindowModel->isExternalLibraryModel() && state.dataWindowManager->winOpticalModel->isSimplifiedModel()) { CalcInteriorSolarDistributionWCE(state); @@ -2803,16 +2803,16 @@ namespace HeatBalanceSurfaceManager { // Reconstruct the beam, sky, and ground radiation transmittance of just the TDD:DOME and TDD pipe // by dividing out diffuse solar transmittance of TDD:DIFFUSER - currBeamSolar(SurfNum) = BeamSolarRad * TransTDD(PipeNum, currCosInc(SurfNum), SolarBeam) / - dataConstruction.Construct(ConstrNum).TransDiff; + currBeamSolar(SurfNum) = BeamSolarRad * TransTDD(state, PipeNum, currCosInc(SurfNum), SolarBeam) / + state.dataConstruction->Construct(ConstrNum).TransDiff; currSkySolarInc(SurfNum) = DifSolarRad * AnisoSkyMult(SurfNum2) * - TransTDD(PipeNum, currCosInc(SurfNum), SolarAniso) / - dataConstruction.Construct(ConstrNum).TransDiff; + TransTDD(state, PipeNum, currCosInc(SurfNum), SolarAniso) / + state.dataConstruction->Construct(ConstrNum).TransDiff; currGndSolarInc(SurfNum) = GndSolarRad * Surface(SurfNum2).ViewFactorGround * TDDPipe(PipeNum).TransSolIso / - dataConstruction.Construct(ConstrNum).TransDiff; + state.dataConstruction->Construct(ConstrNum).TransDiff; // Incident direct (unreflected) beam SurfQRadSWOutIncidentBeam(SurfNum) = currBeamSolar(SurfNum) * SunlitFrac(TimeStep, HourOfDay, SurfNum2) * @@ -2860,7 +2860,7 @@ namespace HeatBalanceSurfaceManager { if (RoughIndexMovInsul <= 0) { // No movable insulation present AbsExt = dataMaterial.Material( - dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; + state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; } // Opaque heat transfer surface SurfOpaqQRadSWOutAbs(SurfNum) = @@ -2873,7 +2873,7 @@ namespace HeatBalanceSurfaceManager { if (ConstrNum > 0) { int SurfSolIncPtr = SurfaceScheduledSolarInc(SurfNum, ConstrNum); if (SurfSolIncPtr == 0) { - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface int ShelfNum = Surface(SurfNum).Shelf; // Daylighting shelf object number int InShelfSurf = 0; // Inside daylighting shelf surface number if (ShelfNum > 0) { @@ -2923,9 +2923,9 @@ namespace HeatBalanceSurfaceManager { if (SurfWinWindowModelType(SurfNum) != WindowBSDFModel && SurfWinWindowModelType(SurfNum) != WindowEQLModel && !state.dataWindowManager->inExtWindowModel->isExternalLibraryModel()) { - int TotGlassLay = dataConstruction.Construct(ConstrNum).TotGlassLayers; // Number of glass layers + int TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; // Number of glass layers for (int Lay = 1; Lay <= TotGlassLay; ++Lay) { - AbsDiffWin(Lay) = dataConstruction.Construct(ConstrNum).AbsDiff(Lay); + AbsDiffWin(Lay) = state.dataConstruction->Construct(ConstrNum).AbsDiff(Lay); } if (ShadeFlag > 0) { // Shaded window @@ -2937,10 +2937,10 @@ namespace HeatBalanceSurfaceManager { ShadeFlag == ExtScreenOn) { // Shade/screen on for (int Lay = 1; Lay <= TotGlassLay; ++Lay) { - AbsDiffWin(Lay) = dataConstruction.Construct(ConstrNumSh).AbsDiff(Lay); + AbsDiffWin(Lay) = state.dataConstruction->Construct(ConstrNumSh).AbsDiff(Lay); } SurfWinExtDiffAbsByShade(SurfNum) = - dataConstruction.Construct(ConstrNumSh).AbsDiffShade * + state.dataConstruction->Construct(ConstrNumSh).AbsDiffShade * (SkySolarInc + GndSolarInc); } @@ -2951,32 +2951,32 @@ namespace HeatBalanceSurfaceManager { AbsDiffWin(Lay) = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct( + state.dataConstruction->Construct( ConstrNumSh).BlAbsDiff( {1, MaxSlatAngs}, Lay)); AbsDiffWinGnd(Lay) = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct( + state.dataConstruction->Construct( ConstrNumSh).BlAbsDiffGnd( {1, MaxSlatAngs}, Lay)); AbsDiffWinSky(Lay) = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct( + state.dataConstruction->Construct( ConstrNumSh).BlAbsDiffSky( {1, MaxSlatAngs}, Lay)); } SurfWinExtDiffAbsByShade(SurfNum) = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct( ConstrNumSh).AbsDiffBlind) * + state.dataConstruction->Construct( ConstrNumSh).AbsDiffBlind) * (SkySolarInc + GndSolarInc); if (Blind(SurfWinBlindNumber(SurfNum)).SlatOrientation == Horizontal) { Real64 ACosTlt = std::abs(Surface(SurfNum).CosTilt); Real64 AbsDiffBlindGnd = InterpSlatAng( SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct(ConstrNumSh).AbsDiffBlindGnd); + state.dataConstruction->Construct(ConstrNumSh).AbsDiffBlindGnd); Real64 AbsDiffBlindSky = InterpSlatAng( SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct(ConstrNumSh).AbsDiffBlindSky); + state.dataConstruction->Construct(ConstrNumSh).AbsDiffBlindSky); SurfWinExtDiffAbsByShade(SurfNum) = SkySolarInc * (0.5 * ACosTlt * AbsDiffBlindGnd + (1.0 - 0.5 * ACosTlt) * AbsDiffBlindSky) + GndSolarInc * ((1.0 - 0.5 * ACosTlt) * AbsDiffBlindGnd + @@ -2996,7 +2996,7 @@ namespace HeatBalanceSurfaceManager { SurfNum); // Switching factor for switchable glazing for (int Lay = 1; Lay <= TotGlassLay; ++Lay) { AbsDiffWin(Lay) = InterpSw(SwitchFac, AbsDiffWin(Lay), - dataConstruction.Construct( + state.dataConstruction->Construct( ConstrNumSh).AbsDiff(Lay)); } } @@ -3018,10 +3018,10 @@ namespace HeatBalanceSurfaceManager { // Absolute value of cosine of surface tilt angle Real64 AbsDiffGlassLayGnd = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct(ConstrNumSh).BlAbsDiffGnd({1, 19}, Lay)); + state.dataConstruction->Construct(ConstrNumSh).BlAbsDiffGnd({1, 19}, Lay)); Real64 AbsDiffGlassLaySky = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct(ConstrNumSh).BlAbsDiffSky({1, 19}, Lay)); + state.dataConstruction->Construct(ConstrNumSh).BlAbsDiffSky({1, 19}, Lay)); SurfWinQRadSWwinAbs(Lay, SurfNum) = SkySolarInc * (0.5 * ACosTlt * AbsDiffGlassLayGnd + (1.0 - 0.5 * ACosTlt) * AbsDiffGlassLaySky) + @@ -3050,7 +3050,7 @@ namespace HeatBalanceSurfaceManager { // ( QRadSWOutIncident( SurfNum ) + QS( Surface( SurfNum ).Zone ) ); // } } else if (SurfWinWindowModelType(SurfNum) == WindowBSDFModel) { - int TotSolidLay = dataConstruction.Construct(ConstrNum).TotSolidLayers; + int TotSolidLay = state.dataConstruction->Construct(ConstrNum).TotSolidLayers; // Number of solid layers in fenestration system (glass + shading) int CurrentState = SurfaceWindow(SurfNum).ComplexFen.CurrentState; // Current state for Complex Fenestration @@ -3089,7 +3089,7 @@ namespace HeatBalanceSurfaceManager { } else if (SurfWinWindowModelType(SurfNum) == WindowEQLModel) { SurfWinQRadSWwinAbsTot(SurfNum) = 0.0; // EQLNum = Construct(Surface(SurfNum)%Construction)%EQLConsPtr - int TotSolidLay = CFS(dataConstruction.Construct( + int TotSolidLay = CFS(state.dataConstruction->Construct( Surface(SurfNum).Construction).EQLConsPtr).NL; for (int Lay = 1; Lay <= TotSolidLay; ++Lay) { // Absorbed window components include: @@ -3097,7 +3097,7 @@ namespace HeatBalanceSurfaceManager { // (2) sky and ground reflected duffuse solar radiation absorbed by all layers // (3) diffuse short wave incident on the inside face of the fenestration. The short wave internal sources // include light, ... - AbsDiffWin(Lay) = dataConstruction.Construct(ConstrNum).AbsDiffFrontEQL( + AbsDiffWin(Lay) = state.dataConstruction->Construct(ConstrNum).AbsDiffFrontEQL( Lay); SurfWinQRadSWwinAbs(Lay, SurfNum) = AWinSurf(Lay, SurfNum) * BeamSolar + AbsDiffWin(Lay) * (SkySolarInc + GndSolarInc); @@ -3206,16 +3206,16 @@ namespace HeatBalanceSurfaceManager { // Beam solar on outside of frame FrIncSolarOut += (BeamFrHorFaceInc + BeamFrVertFaceInc) * FrProjOut; if (FrProjIn > 0.0) { - Real64 TransGl = POLYF(CosInc, dataConstruction.Construct( + Real64 TransGl = POLYF(CosInc, state.dataConstruction->Construct( ConstrNum).TransSolBeamCoef); - TransDiffGl = dataConstruction.Construct(ConstrNum).TransDiff; + TransDiffGl = state.dataConstruction->Construct(ConstrNum).TransDiff; if (ShadeFlag == SwitchableGlazing) { // Switchable glazing Real64 SwitchFac = SurfWinSwitchingFactor(SurfNum); int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; - Real64 TransGlSh = POLYF(CosInc, dataConstruction.Construct( + Real64 TransGlSh = POLYF(CosInc, state.dataConstruction->Construct( ConstrNumSh).TransSolBeamCoef); TransGl = InterpSw(SwitchFac, TransGl, TransGlSh); - Real64 TransDiffGlSh = dataConstruction.Construct( + Real64 TransDiffGlSh = state.dataConstruction->Construct( ConstrNumSh).TransDiff; TransDiffGl = InterpSw(SwitchFac, TransDiffGl, TransDiffGlSh); } @@ -3255,7 +3255,7 @@ namespace HeatBalanceSurfaceManager { if (SurfWinDividerType(SurfNum) == Suspended) { // Suspended (between-glass) divider; account for effect glass on outside of divider // (note that outside and inside projection for this type of divider are both zero) - int MatNumGl = dataConstruction.Construct(ConstrNum).LayerPoint( + int MatNumGl = state.dataConstruction->Construct(ConstrNum).LayerPoint( 1); // Outer glass layer material number Real64 TransGl = dataMaterial.Material( MatNumGl).Trans; // Outer glass layer material number, switched construction @@ -3264,7 +3264,7 @@ namespace HeatBalanceSurfaceManager { Real64 SwitchFac = SurfWinSwitchingFactor(SurfNum); int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; if (ShadeFlag == SwitchableGlazing) { // Switchable glazing - Real64 MatNumGlSh = dataConstruction.Construct( + Real64 MatNumGlSh = state.dataConstruction->Construct( ConstrNumSh).LayerPoint(1); Real64 TransGlSh = dataMaterial.Material(MatNumGlSh).Trans; Real64 ReflGlSh = dataMaterial.Material( @@ -3307,18 +3307,18 @@ namespace HeatBalanceSurfaceManager { DivIncSolarOutDif = DifSolarFaceInc * (1.0 + SurfWinProjCorrDivOut(SurfNum)); if (DivProjIn > 0.0) { - Real64 TransGl = POLYF(CosInc, dataConstruction.Construct( + Real64 TransGl = POLYF(CosInc, state.dataConstruction->Construct( ConstrNum).TransSolBeamCoef); - Real64 TransDiffGl = dataConstruction.Construct( + Real64 TransDiffGl = state.dataConstruction->Construct( ConstrNum).TransDiff; // Diffuse solar transmittance if (ShadeFlag == SwitchableGlazing) { // Switchable glazing Real64 SwitchFac = SurfWinSwitchingFactor(SurfNum); int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; - Real64 TransGlSh = POLYF(CosInc, dataConstruction.Construct( + Real64 TransGlSh = POLYF(CosInc, state.dataConstruction->Construct( ConstrNumSh).TransSolBeamCoef); // Outer glass solar trans, refl, absorptance if switched TransGl = InterpSw(SwitchFac, TransGl, TransGlSh); - Real64 TransDiffGlSh = dataConstruction.Construct( + Real64 TransDiffGlSh = state.dataConstruction->Construct( ConstrNumSh).TransDiff; // Diffuse solar transmittance, switched construction TransDiffGl = InterpSw(SwitchFac, TransDiffGl, TransDiffGlSh); @@ -3351,9 +3351,9 @@ namespace HeatBalanceSurfaceManager { DivIncSolarOutDif = DifSolarFaceInc * (1.0 + SurfWinProjCorrDivOut(SurfNum)); DivIncSolarInBm = BeamFaceInc * SurfWinProjCorrDivIn(SurfNum) * - dataConstruction.Construct(ConstrNum).TransDiff; + state.dataConstruction->Construct(ConstrNum).TransDiff; DivIncSolarInDif = DifSolarFaceInc * SurfWinProjCorrDivIn(SurfNum) * - dataConstruction.Construct(ConstrNum).TransDiff; + state.dataConstruction->Construct(ConstrNum).TransDiff; } if (ShadeFlag != ExtShadeOn && ShadeFlag != ExtBlindOn && ShadeFlag != ExtScreenOn && ShadeFlag != BGShadeOn && ShadeFlag != BGBlindOn) { @@ -3389,10 +3389,10 @@ namespace HeatBalanceSurfaceManager { } else if (ShadeFlag == ExtShadeOn) { // Exterior shade int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; SurfWinDividerQRadOutAbs(SurfNum) = - DividerAbs * dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(1)).Trans * + DividerAbs * dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1)).Trans * (DivIncSolarOutBm +DivIncSolarOutDif); SurfWinDividerQRadInAbs(SurfNum) = - DividerAbs * dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(1)).Trans * + DividerAbs * dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1)).Trans * (DivIncSolarInBm +DivIncSolarInDif); } else if (ShadeFlag == ExtScreenOn) { // Exterior screen @@ -3418,10 +3418,10 @@ namespace HeatBalanceSurfaceManager { for (int PipeNum = 1; PipeNum <= NumOfTDDPipes; ++PipeNum) { int SurfNum = TDDPipe(PipeNum).Dome; // TDD: DOME object number int ConstrNum = Surface(SurfNum).Construction; - int TotGlassLay = dataConstruction.Construct(ConstrNum).TotGlassLayers; // Number of glass layers + int TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; // Number of glass layers SurfWinQRadSWwinAbsTot(SurfNum) = 0.0; for (int Lay = 1; Lay <= TotGlassLay; ++Lay) { - AbsDiffWin(Lay) = dataConstruction.Construct(ConstrNum).AbsDiff(Lay); + AbsDiffWin(Lay) = state.dataConstruction->Construct(ConstrNum).AbsDiff(Lay); SurfWinQRadSWwinAbs(Lay, SurfNum) = AbsDiffWin(Lay) * (currSkySolarInc(SurfNum) + currGndSolarInc(SurfNum)) + AWinSurf(Lay, SurfNum) * currBeamSolar(SurfNum); SurfWinQRadSWwinAbsLayer(Lay, SurfNum) = SurfWinQRadSWwinAbs(Lay, SurfNum) * Surface(SurfNum).Area; @@ -3432,7 +3432,7 @@ namespace HeatBalanceSurfaceManager { } // End of sun-up check } - void InitIntSolarDistribution() + void InitIntSolarDistribution(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -3586,9 +3586,9 @@ namespace HeatBalanceSurfaceManager { if (Surface(SurfNum).Class == SurfaceClass_TDD_Dome) continue; // Skip tubular daylighting device domes ConstrNum = Surface(SurfNum).Construction; - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface - AbsIntSurf = dataConstruction.Construct(ConstrNum).InsideAbsorpSolar; - AbsIntSurfVis = dataConstruction.Construct( + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface + AbsIntSurf = state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar; + AbsIntSurfVis = state.dataConstruction->Construct( ConstrNum).InsideAbsorpSolar; // to fix CR 8695 change to this = Construct(ConstrNum)%InsideAbsorpVis HMovInsul = 0.0; if (Surface(SurfNum).MaterialMovInsulInt > 0) @@ -3598,26 +3598,26 @@ namespace HeatBalanceSurfaceManager { SurfOpaqQRadSWLightsInAbs(SurfNum) += QSLights(solEnclosureNum) * AbsIntSurfVis; } - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Opaque exterior surface + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Opaque exterior surface // Calculate absorbed solar on outside if movable exterior insulation in place HMovInsul = 0.0; if (Surface(SurfNum).MaterialMovInsulExt > 0) EvalOutsideMovableInsulation(SurfNum, HMovInsul, RoughIndexMovInsul, AbsExt); if (HMovInsul > 0) { // Movable outside insulation in place - SurfQRadSWOutMvIns(SurfNum) = SurfOpaqQRadSWOutAbs(SurfNum) * AbsExt / dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; + SurfQRadSWOutMvIns(SurfNum) = SurfOpaqQRadSWOutAbs(SurfNum) * AbsExt / dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpSolar; // For transparent insulation, allow some sunlight to get through the movable insulation. // The equation below is derived by taking what is transmitted through the layer and applying // the fraction that is absorbed plus the back reflected portion (first order reflection only) // to the plane between the transparent insulation and the exterior surface face. SurfOpaqQRadSWOutAbs(SurfNum) = dataMaterial.Material(Surface(SurfNum).MaterialMovInsulExt).Trans * SurfQRadSWOutMvIns(SurfNum) * - ((dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpSolar / AbsExt) + - (1 - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpSolar)); + ((dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpSolar / AbsExt) + + (1 - dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpSolar)); SurfOpaqSWOutAbsTotalReport(SurfNum) = SurfOpaqQRadSWOutAbs(SurfNum) * Surface(SurfNum).Area; SurfOpaqSWOutAbsEnergyReport(SurfNum) = SurfOpaqSWOutAbsTotalReport(SurfNum) * TimeStepZoneSec; } } // RJH 08/30/07 - Add InitialDifSolInAbs, InitialDifSolwinAbs, and InitialDifSolAbsByShade // calced in CalcWinTransDifSolInitialDistribution to QRadSWInAbs, QRadSWwinAbs, and IntSWAbsByShade here - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface SurfOpaqQRadSWInAbs(SurfNum) += SurfOpaqInitialDifSolInAbs(SurfNum); } @@ -3626,7 +3626,7 @@ namespace HeatBalanceSurfaceManager { SurfSWInAbsTotalReport(SurfNum) = 0.0; SurfInitialDifSolInAbsReport(SurfNum) = 0.0; // SurfWinInitialDifSolInTransReport(SurfNum) = 0.0; //TOCHECK - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface // Initial Transmitted Diffuse Solar Absorbed on Inside of Surface[W] SurfInitialDifSolInAbsReport(SurfNum) = SurfOpaqInitialDifSolInAbs(SurfNum) * Surface(SurfNum).Area; // Total Shortwave Radiation Absorbed on Inside of Surface[W] @@ -3649,7 +3649,7 @@ namespace HeatBalanceSurfaceManager { ConstrNum = Surface(SurfNum).StormWinConstruction; ConstrNumSh = Surface(SurfNum).activeStormWinShadedConstruction; } - TotGlassLayers = dataConstruction.Construct(ConstrNum).TotGlassLayers; + TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; ShadeFlag = SurfWinShadingFlag(SurfNum); // These calculations are repeated from InitInternalHeatGains for the Zone Component Loads Report @@ -3671,19 +3671,19 @@ namespace HeatBalanceSurfaceManager { if (ShadeFlag <= 0) { // No window shading for (IGlass = 1; IGlass <= TotGlassLayers; ++IGlass) { SurfWinQRadSWwinAbs(IGlass, SurfNum) += - QS(solEnclosureNum) * dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass); + QS(solEnclosureNum) * state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass); } } else if (ConstrNumSh != 0 && (ShadeFlag == IntShadeOn || ShadeFlag >= 3)) { // Interior, exterior or between-glass shade, screen or blind in place - for (IGlass = 1; IGlass <= dataConstruction.Construct(ConstrNumSh).TotGlassLayers; ++IGlass) { + for (IGlass = 1; IGlass <= state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; ++IGlass) { if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || ShadeFlag == ExtScreenOn) SurfWinQRadSWwinAbs(IGlass, SurfNum) += QS(solEnclosureNum) * - dataConstruction.Construct(ConstrNumSh).AbsDiffBack( + state.dataConstruction->Construct(ConstrNumSh).AbsDiffBack( IGlass); if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn) { BlAbsDiffBk = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct(ConstrNumSh).BlAbsDiffBack(_, + state.dataConstruction->Construct(ConstrNumSh).BlAbsDiffBack(_, IGlass)); SurfWinQRadSWwinAbs(IGlass, SurfNum) += QS(solEnclosureNum) * BlAbsDiffBk; } @@ -3691,7 +3691,7 @@ namespace HeatBalanceSurfaceManager { BlNum = SurfWinBlindNumber(SurfNum); if (ShadeFlag == IntShadeOn) SurfWinIntLWAbsByShade(SurfNum) = - QL(radEnclosureNum) * dataConstruction.Construct(ConstrNumSh).ShadeAbsorpThermal * + QL(radEnclosureNum) * state.dataConstruction->Construct(ConstrNumSh).ShadeAbsorpThermal * TMULT(radEnclosureNum); if (ShadeFlag == IntBlindOn) { EffBlEmiss = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), @@ -3701,10 +3701,10 @@ namespace HeatBalanceSurfaceManager { if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || ShadeFlag == ExtScreenOn) SurfWinIntSWAbsByShade(SurfNum) = - QS(solEnclosureNum) * dataConstruction.Construct(ConstrNumSh).AbsDiffBackShade; + QS(solEnclosureNum) * state.dataConstruction->Construct(ConstrNumSh).AbsDiffBackShade; if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn || ShadeFlag == BGBlindOn) { AbsDiffBkBl = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct(ConstrNumSh).AbsDiffBackBlind); + state.dataConstruction->Construct(ConstrNumSh).AbsDiffBackBlind); SurfWinIntSWAbsByShade(SurfNum) = QS(solEnclosureNum) * AbsDiffBkBl; } @@ -3717,8 +3717,8 @@ namespace HeatBalanceSurfaceManager { SurfWinQRadSWwinAbs(IGlass, SurfNum) += QS(solEnclosureNum) * InterpSw(SurfWinSwitchingFactor(SurfNum), - dataConstruction.Construct(ConstrNum).AbsDiffBack( - IGlass), dataConstruction.Construct( + state.dataConstruction->Construct(ConstrNum).AbsDiffBack( + IGlass), state.dataConstruction->Construct( ConstrNumSh).AbsDiffBack(IGlass)); } @@ -3737,8 +3737,8 @@ namespace HeatBalanceSurfaceManager { DividerThermAbs = SurfWinDividerEmis(SurfNum); DividerSolAbs = SurfWinDividerSolAbsorp(SurfNum); if (SurfWinDividerType(SurfNum) == Suspended) { // Suspended divider; account for inside glass - MatNumGl = dataConstruction.Construct(ConstrNum).LayerPoint( - dataConstruction.Construct(ConstrNum).TotLayers); + MatNumGl = state.dataConstruction->Construct(ConstrNum).LayerPoint( + state.dataConstruction->Construct(ConstrNum).TotLayers); TransGl = dataMaterial.Material(MatNumGl).Trans; ReflGl = dataMaterial.Material(MatNumGl).ReflectSolBeamBack; AbsGl = 1.0 - TransGl - ReflGl; @@ -3749,8 +3749,8 @@ namespace HeatBalanceSurfaceManager { } // Correct for interior shade transmittance if (ShadeFlag == IntShadeOn) { - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint( - dataConstruction.Construct(ConstrNumSh).TotLayers); + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint( + state.dataConstruction->Construct(ConstrNumSh).TotLayers); DividerSolAbs *= dataMaterial.Material(MatNumSh).Trans; DividerThermAbs *= dataMaterial.Material(MatNumSh).TransThermal; } else if (ShadeFlag == IntBlindOn) { @@ -3788,10 +3788,10 @@ namespace HeatBalanceSurfaceManager { SurfQRadThermInAbs(SurfNum) = adjQL * TMULT(radEnclosureNum) * ITABSF(SurfNum); } // Radiations absorbed by the window layers coming from zone side - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; for (Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { SurfWinQRadSWwinAbs(Lay, SurfNum) += - QS(solEnclosureNum) * dataConstruction.Construct(ConstrNum).AbsDiffBackEQL(Lay); + QS(solEnclosureNum) * state.dataConstruction->Construct(ConstrNum).AbsDiffBackEQL(Lay); } // Window frame has not been included for equivalent layer model yet @@ -3800,7 +3800,7 @@ namespace HeatBalanceSurfaceManager { if (Surface(SurfNum).ExtBoundCond > 0) { // Interzone surface - if (dataConstruction.Construct(ConstrNum).TransDiff > 0.0) { // Interzone window + if (state.dataConstruction->Construct(ConstrNum).TransDiff > 0.0) { // Interzone window // Short-wave radiation absorbed in panes of corresponding window in adjacent zone SurfNumAdjZone = Surface(SurfNum).ExtBoundCond; @@ -3808,7 +3808,7 @@ namespace HeatBalanceSurfaceManager { if (SurfWinWindowModelType(SurfNumAdjZone) != WindowEQLModel) { for (IGlass = 1; IGlass <= TotGlassLayers; ++IGlass) { SurfWinQRadSWwinAbs(IGlass, SurfNumAdjZone) += QS(solEnclosureNum) * - dataConstruction.Construct( + state.dataConstruction->Construct( Surface(SurfNumAdjZone).Construction).AbsDiff( IGlass); // Note that AbsDiff rather than AbsDiffBack is used in the above since the @@ -3817,9 +3817,9 @@ namespace HeatBalanceSurfaceManager { } } else { // IF (SurfaceWindow(SurfNumAdjZone)%WindowModelType == WindowEQLModel) THEN ConstrNum = Surface(SurfNumAdjZone).Construction; - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; for (Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { - SurfWinQRadSWwinAbs(Lay, SurfNumAdjZone) += QS(solEnclosureNum) * dataConstruction.Construct( + SurfWinQRadSWwinAbs(Lay, SurfNumAdjZone) += QS(solEnclosureNum) * state.dataConstruction->Construct( ConstrNum).AbsDiffFrontEQL(Lay); // Note that AbsDiffFrontEQL rather than AbsDiffBackEQL is used in the above // since the radiation from the current zone is incident on the outside of the @@ -3835,7 +3835,7 @@ namespace HeatBalanceSurfaceManager { ConstrNum = Surface(SurfNum).StormWinConstruction; ConstrNumSh = Surface(SurfNum).activeStormWinShadedConstruction; } - TotGlassLayers = dataConstruction.Construct(ConstrNum).TotGlassLayers; + TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; ShadeFlag = SurfWinShadingFlag(SurfNum); if (ShadeFlag <= 0) { // No window shading for (IGlass = 1; IGlass <= TotGlassLayers; ++IGlass) { @@ -3843,7 +3843,7 @@ namespace HeatBalanceSurfaceManager { } } else if (ShadeFlag == IntShadeOn || ShadeFlag >= 3) { // Interior, exterior or between-glass shade, screen or blind in place - for (IGlass = 1; IGlass <= dataConstruction.Construct(ConstrNumSh).TotGlassLayers; ++IGlass) { + for (IGlass = 1; IGlass <= state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; ++IGlass) { SurfWinQRadSWwinAbs(IGlass, SurfNum) += SurfWinInitialDifSolwinAbs(IGlass, SurfNum); } if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || @@ -3858,14 +3858,14 @@ namespace HeatBalanceSurfaceManager { } } // End of shading flag check } else if (SurfWinWindowModelType(SurfNum) == WindowBSDFModel) { - TotGlassLayers = dataConstruction.Construct(ConstrNum).TotGlassLayers; + TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; for (IGlass = 1; IGlass <= TotGlassLayers; ++IGlass) { SurfWinQRadSWwinAbs(IGlass, SurfNum) += SurfWinInitialDifSolwinAbs(IGlass, SurfNum); } } else if (SurfWinWindowModelType(SurfNum) == WindowEQLModel) { // ConstrNum = Surface(SurfNum)%Construction - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; for (Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { SurfWinQRadSWwinAbs(Lay, SurfNum) += SurfWinInitialDifSolwinAbs(Lay, SurfNum); @@ -3885,9 +3885,9 @@ namespace HeatBalanceSurfaceManager { ConstrNumSh = Surface(SurfNum).activeStormWinShadedConstruction; } if (SurfWinWindowModelType(SurfNum) == WindowBSDFModel) { - TotGlassLayers = dataConstruction.Construct(ConstrNum).TotSolidLayers; + TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotSolidLayers; } else { - TotGlassLayers = dataConstruction.Construct(ConstrNum).TotGlassLayers; + TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; } ShadeFlag = SurfWinShadingFlag(SurfNum); if (ShadeFlag <= 0 || SurfWinWindowModelType(SurfNum) == WindowBSDFModel) { // No window shading @@ -3902,7 +3902,7 @@ namespace HeatBalanceSurfaceManager { } } else if (ShadeFlag == IntShadeOn || ShadeFlag >= 3) { // Interior, exterior or between-glass shade, screen or blind in place - for (IGlass = 1; IGlass <= dataConstruction.Construct(ConstrNumSh).TotGlassLayers; ++IGlass) { + for (IGlass = 1; IGlass <= state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; ++IGlass) { // Initial Transmitted Diffuse Solar Absorbed on Inside of Surface[W] SurfInitialDifSolInAbsReport(SurfNum) += SurfWinInitialDifSolwinAbs(IGlass, SurfNum) * Surface(SurfNum).Area; @@ -3924,7 +3924,7 @@ namespace HeatBalanceSurfaceManager { } // End of shading flag check } else { // IF (SurfaceWindow(SurfNum)%WindowModelType == WindowEQLModel) THEN ConstrNum = Surface(SurfNum).Construction; - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; for (Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { // Initial Transmitted Diffuse Solar Absorbed on Inside of Surface[W] @@ -3937,10 +3937,10 @@ namespace HeatBalanceSurfaceManager { } } // End of window } - DistributeTDDAbsorbedSolar(); + DistributeTDDAbsorbedSolar(state); } - void ComputeIntThermalAbsorpFactors() + void ComputeIntThermalAbsorpFactors(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -3978,10 +3978,10 @@ namespace HeatBalanceSurfaceManager { if (!Surface(SurfNum).HeatTransSurf) continue; int ConstrNum = Surface(SurfNum).Construction; - ITABSF(SurfNum) = dataConstruction.Construct(ConstrNum).InsideAbsorpThermal; + ITABSF(SurfNum) = state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal; Real64 HMovInsul = 0.0; // Conductance of movable insulation Real64 AbsInt; // Solar absorptance of movable insulation - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface if (Surface(SurfNum).MaterialMovInsulInt > 0) EvalInsideMovableInsulation(SurfNum, HMovInsul, AbsInt); if (HMovInsul > 0.0) @@ -4018,8 +4018,8 @@ namespace HeatBalanceSurfaceManager { SUM1 += Surface(SurfNum).Area * ITABSF(SurfNum); } else { // Switchable glazing SUM1 += Surface(SurfNum).Area * InterpSw(SurfWinSwitchingFactor(SurfNum), - dataConstruction.Construct(ConstrNum).InsideAbsorpThermal, - dataConstruction.Construct(Surface(SurfNum).activeShadedConstruction).InsideAbsorpThermal); + state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal, + state.dataConstruction->Construct(Surface(SurfNum).activeShadedConstruction).InsideAbsorpThermal); } // Window frame and divider effects @@ -4028,13 +4028,13 @@ namespace HeatBalanceSurfaceManager { if (SurfWinDividerArea(SurfNum) > 0.0) { Real64 DividerThermAbs = SurfWinDividerEmis(SurfNum); // Window divider thermal absorptance // Suspended (between-glass) divider; relevant emissivity is inner glass emissivity - if (SurfWinDividerType(SurfNum) == Suspended) DividerThermAbs = dataConstruction.Construct(ConstrNum).InsideAbsorpThermal; + if (SurfWinDividerType(SurfNum) == Suspended) DividerThermAbs = state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal; if (ShadeFlag == IntShadeOn || ShadeFlag == IntBlindOn) { // Interior shade or blind in place int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; if (SurfWinHasShadeOrBlindLayer(SurfNum)) { // Shade layer material number - int MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(dataConstruction.Construct(ConstrNumSh).TotLayers); + int MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(state.dataConstruction->Construct(ConstrNumSh).TotLayers); // Shade or blind IR transmittance Real64 TauShIR = dataMaterial.Material(MatNumSh).TransThermal; // Effective emissivity of shade or blind @@ -4064,7 +4064,7 @@ namespace HeatBalanceSurfaceManager { } // End of loop over zones } - void ComputeIntSWAbsorpFactors() + void ComputeIntSWAbsorpFactors(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -4147,11 +4147,11 @@ namespace HeatBalanceSurfaceManager { ConstrNum = Surface(SurfNum).Construction; - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface - AbsIntSurf = dataConstruction.Construct(ConstrNum).InsideAbsorpSolar; + AbsIntSurf = state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar; HMovInsul = 0.0; if (Surface(SurfNum).MaterialMovInsulInt > 0) EvalInsideMovableInsulation(SurfNum, HMovInsul, AbsInt); if (HMovInsul > 0.0) AbsIntSurf = AbsInt; @@ -4160,7 +4160,7 @@ namespace HeatBalanceSurfaceManager { } else { // Window - if (!dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) { + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) { ShadeFlag = SurfWinShadingFlag(SurfNum); AbsDiffTotWin = 0.0; ConstrNumSh = Surface(SurfNum).activeShadedConstruction; @@ -4171,50 +4171,50 @@ namespace HeatBalanceSurfaceManager { SwitchFac = SurfWinSwitchingFactor(SurfNum); // Sum of absorptances of glass layers - for (Lay = 1; Lay <= dataConstruction.Construct(ConstrNum).TotGlassLayers; ++Lay) { - AbsDiffLayWin = dataConstruction.Construct(ConstrNum).AbsDiffBack(Lay); + for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotGlassLayers; ++Lay) { + AbsDiffLayWin = state.dataConstruction->Construct(ConstrNum).AbsDiffBack(Lay); // Window with shade, screen or blind if (ConstrNumSh != 0) { if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || ShadeFlag == ExtScreenOn) { - AbsDiffLayWin = dataConstruction.Construct(ConstrNumSh).AbsDiffBack(Lay); + AbsDiffLayWin = state.dataConstruction->Construct(ConstrNumSh).AbsDiffBack(Lay); } else if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn || ShadeFlag == BGBlindOn) { AbsDiffLayWin = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct(ConstrNumSh).BlAbsDiffBack(_, Lay)); + state.dataConstruction->Construct(ConstrNumSh).BlAbsDiffBack(_, Lay)); } } // Switchable glazing if (ShadeFlag == SwitchableGlazing) - AbsDiffLayWin = InterpSw(SwitchFac, AbsDiffLayWin, dataConstruction.Construct(ConstrNumSh).AbsDiffBack(Lay)); + AbsDiffLayWin = InterpSw(SwitchFac, AbsDiffLayWin, state.dataConstruction->Construct(ConstrNumSh).AbsDiffBack(Lay)); AbsDiffTotWin += AbsDiffLayWin; } - TransDiffWin = dataConstruction.Construct(ConstrNum).TransDiff; + TransDiffWin = state.dataConstruction->Construct(ConstrNum).TransDiff; DiffAbsShade = 0.0; // Window with shade, screen or blind if (ConstrNumSh != 0) { if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || ShadeFlag == ExtScreenOn) { - TransDiffWin = dataConstruction.Construct(ConstrNumSh).TransDiff; - DiffAbsShade = dataConstruction.Construct(ConstrNumSh).AbsDiffBackShade; + TransDiffWin = state.dataConstruction->Construct(ConstrNumSh).TransDiff; + DiffAbsShade = state.dataConstruction->Construct(ConstrNumSh).AbsDiffBackShade; } else if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn || ShadeFlag == BGBlindOn) { TransDiffWin = InterpSlatAng( - SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), dataConstruction.Construct(ConstrNumSh).BlTransDiff); + SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), state.dataConstruction->Construct(ConstrNumSh).BlTransDiff); DiffAbsShade = InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), - dataConstruction.Construct(ConstrNumSh).AbsDiffBackBlind); + state.dataConstruction->Construct(ConstrNumSh).AbsDiffBackBlind); } } // Switchable glazing if (ShadeFlag == SwitchableGlazing) - TransDiffWin = InterpSw(SwitchFac, TransDiffWin, dataConstruction.Construct(ConstrNumSh).TransDiff); + TransDiffWin = InterpSw(SwitchFac, TransDiffWin, state.dataConstruction->Construct(ConstrNumSh).TransDiff); SUM1 += Surface(SurfNum).Area * (TransDiffWin + AbsDiffTotWin + DiffAbsShade); @@ -4227,7 +4227,7 @@ namespace HeatBalanceSurfaceManager { DividerAbs = SurfWinDividerSolAbsorp(SurfNum); if (SurfWinDividerType(SurfNum) == Suspended) { // Suspended (between-glass) divider: account for glass on inside of divider - MatNumGl = dataConstruction.Construct(ConstrNum).LayerPoint(dataConstruction.Construct(ConstrNum).TotLayers); + MatNumGl = state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataConstruction->Construct(ConstrNum).TotLayers); TransGl = dataMaterial.Material(MatNumGl).Trans; ReflGl = dataMaterial.Material(MatNumGl).ReflectSolBeamBack; AbsGl = 1.0 - TransGl - ReflGl; @@ -4245,9 +4245,9 @@ namespace HeatBalanceSurfaceManager { // frames and dividers are not supported AbsDiffTotWin = 0.0; AbsDiffLayWin = 0.0; - TransDiffWin = dataConstruction.Construct(ConstrNum).TransDiff; - for (Lay = 1; Lay <= CFS(dataConstruction.Construct(ConstrNum).EQLConsPtr).NL; ++Lay) { - AbsDiffLayWin = dataConstruction.Construct(ConstrNum).AbsDiffBackEQL(Lay); + TransDiffWin = state.dataConstruction->Construct(ConstrNum).TransDiff; + for (Lay = 1; Lay <= CFS(state.dataConstruction->Construct(ConstrNum).EQLConsPtr).NL; ++Lay) { + AbsDiffLayWin = state.dataConstruction->Construct(ConstrNum).AbsDiffBackEQL(Lay); AbsDiffTotWin += AbsDiffLayWin; } SUM1 += Surface(SurfNum).Area * (TransDiffWin + AbsDiffTotWin); @@ -4274,7 +4274,7 @@ namespace HeatBalanceSurfaceManager { } // End of zone/enclosure loop } - void ComputeDifSolExcZonesWIZWindows(int const NumberOfEnclosures) // Number of solar enclosures + void ComputeDifSolExcZonesWIZWindows(EnergyPlusData &state, int const NumberOfEnclosures) // Number of solar enclosures { // SUBROUTINE INFORMATION: @@ -4307,13 +4307,13 @@ namespace HeatBalanceSurfaceManager { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond <= 0) continue; if (Surface(SurfNum).ExtBoundCond == SurfNum) continue; - if (dataConstruction.Construct(Surface(SurfNum).Construction).TransDiff <= 0.0) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TransDiff <= 0.0) continue; int surfZoneNum = Surface(SurfNum).Zone; if (!Zone(surfZoneNum).HasInterZoneWindow) continue; int NZ = Surface(SurfNum).SolarEnclIndex; int MZ = Surface(Surface(SurfNum).ExtBoundCond).SolarEnclIndex; - FractDifShortZtoZ(NZ, MZ) += dataConstruction.Construct(Surface(SurfNum).Construction).TransDiff * EnclSolVMULT(NZ) * Surface(SurfNum).Area; + FractDifShortZtoZ(NZ, MZ) += state.dataConstruction->Construct(Surface(SurfNum).Construction).TransDiff * EnclSolVMULT(NZ) * Surface(SurfNum).Area; if (EnclSolVMULT(NZ) != 0.0) RecDifShortFromZ(NZ) = true; } // Compute fractions for multiple passes. @@ -4389,7 +4389,7 @@ namespace HeatBalanceSurfaceManager { } // IZ Loop } - void InitEMSControlledSurfaceProperties() + void InitEMSControlledSurfaceProperties(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -4462,26 +4462,26 @@ namespace HeatBalanceSurfaceManager { // second, loop over constructions for (ConstrNum = 1; ConstrNum <= TotConstructs; ++ConstrNum) { - if (dataConstruction.Construct(ConstrNum).TypeIsWindow) continue; // only override opaque constructions - TotLayers = dataConstruction.Construct(ConstrNum).TotLayers; + if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) continue; // only override opaque constructions + TotLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; if (TotLayers == 0) continue; // error condition - InsideMaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers); + InsideMaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers); if (InsideMaterNum != 0) { - dataConstruction.Construct(ConstrNum).InsideAbsorpVis = dataMaterial.Material(InsideMaterNum).AbsorpVisible; - dataConstruction.Construct(ConstrNum).InsideAbsorpSolar = dataMaterial.Material(InsideMaterNum).AbsorpSolar; - dataConstruction.Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(InsideMaterNum).AbsorpThermal; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpVis = dataMaterial.Material(InsideMaterNum).AbsorpVisible; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar = dataMaterial.Material(InsideMaterNum).AbsorpSolar; + state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal = dataMaterial.Material(InsideMaterNum).AbsorpThermal; } - OutsideMaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(1); + OutsideMaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(1); if (OutsideMaterNum != 0) { - dataConstruction.Construct(ConstrNum).OutsideAbsorpVis = dataMaterial.Material(OutsideMaterNum).AbsorpVisible; - dataConstruction.Construct(ConstrNum).OutsideAbsorpSolar = dataMaterial.Material(OutsideMaterNum).AbsorpSolar; - dataConstruction.Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(OutsideMaterNum).AbsorpThermal; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpVis = dataMaterial.Material(OutsideMaterNum).AbsorpVisible; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpSolar = dataMaterial.Material(OutsideMaterNum).AbsorpSolar; + state.dataConstruction->Construct(ConstrNum).OutsideAbsorpThermal = dataMaterial.Material(OutsideMaterNum).AbsorpThermal; } } } - void InitEMSControlledConstructions() + void InitEMSControlledConstructions(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -4530,7 +4530,7 @@ namespace HeatBalanceSurfaceManager { if (Surface(SurfNum).EMSConstructionOverrideON && (Surface(SurfNum).EMSConstructionOverrideValue > 0)) { - if (dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).TypeIsWindow) { // okay, allways allow windows + if (state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).TypeIsWindow) { // okay, allways allow windows EMSConstructActuatorChecked(Surface(SurfNum).EMSConstructionOverrideValue, SurfNum) = true; EMSConstructActuatorIsOkay(Surface(SurfNum).EMSConstructionOverrideValue, SurfNum) = true; } @@ -4539,7 +4539,7 @@ namespace HeatBalanceSurfaceManager { (EMSConstructActuatorIsOkay(Surface(SurfNum).EMSConstructionOverrideValue, SurfNum))) { Surface(SurfNum).Construction = Surface(SurfNum).EMSConstructionOverrideValue; - dataConstruction.Construct(Surface(SurfNum).Construction).IsUsed = true; + state.dataConstruction->Construct(Surface(SurfNum).Construction).IsUsed = true; } else { // have not checked yet or is not okay, so see if we need to warn about incompatible if (!EMSConstructActuatorChecked(Surface(SurfNum).EMSConstructionOverrideValue, SurfNum)) { @@ -4551,46 +4551,46 @@ namespace HeatBalanceSurfaceManager { // set as okay and turn false if find a big problem EMSConstructActuatorIsOkay(Surface(SurfNum).EMSConstructionOverrideValue, SurfNum) = true; EMSConstructActuatorChecked(Surface(SurfNum).EMSConstructionOverrideValue, SurfNum) = true; - if (dataConstruction.Construct(Surface(SurfNum).Construction).NumHistories != - dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).NumHistories) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).NumHistories != + state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).NumHistories) { // thow warning, but allow ShowWarningError("InitEMSControlledConstructions: EMS Construction State Actuator may be unrealistic, incompatible " "CTF timescales are being used."); ShowContinueError( - "Construction named = " + dataConstruction.Construct(Surface(SurfNum).Construction).Name + - " has CTF timesteps = " + TrimSigDigits(dataConstruction.Construct(Surface(SurfNum).Construction).NumHistories)); + "Construction named = " + state.dataConstruction->Construct(Surface(SurfNum).Construction).Name + + " has CTF timesteps = " + TrimSigDigits(state.dataConstruction->Construct(Surface(SurfNum).Construction).NumHistories)); ShowContinueError( - "While construction named = " + dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + + "While construction named = " + state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + " has CTF timesteps = " + - TrimSigDigits(dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).NumHistories)); + TrimSigDigits(state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).NumHistories)); ShowContinueError("Transient heat transfer modeling may not be valid for surface name = " + Surface(SurfNum).Name + ", and the simulation continues"); } - if (dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms != - dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).NumCTFTerms) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms != + state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).NumCTFTerms) { // thow warning, but allow ShowWarningError("InitEMSControlledConstructions: EMS Construction State Actuator may be unrealistic, incompatible " "CTF terms are being used."); - ShowContinueError("Construction named = " + dataConstruction.Construct(Surface(SurfNum).Construction).Name + + ShowContinueError("Construction named = " + state.dataConstruction->Construct(Surface(SurfNum).Construction).Name + " has number of CTF terms = " + - TrimSigDigits(dataConstruction.Construct(Surface(SurfNum).Construction).NumCTFTerms)); + TrimSigDigits(state.dataConstruction->Construct(Surface(SurfNum).Construction).NumCTFTerms)); ShowContinueError( - "While construction named = " + dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + + "While construction named = " + state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + " has number of CTF terms = " + - TrimSigDigits(dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).NumCTFTerms)); + TrimSigDigits(state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).NumCTFTerms)); ShowContinueError( "The actuator is allowed but the transient heat transfer modeling may not be valid for surface name = " + Surface(SurfNum).Name + ", and the simulation continues"); } - if (dataConstruction.Construct(Surface(SurfNum).Construction).SourceSinkPresent) { - if (!dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).SourceSinkPresent) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).SourceSinkPresent) { + if (!state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).SourceSinkPresent) { // thow warning, and do not allow ShowSevereError("InitEMSControlledConstructions: EMS Construction State Actuator not valid."); - ShowContinueError("Construction named = " + dataConstruction.Construct(Surface(SurfNum).Construction).Name + + ShowContinueError("Construction named = " + state.dataConstruction->Construct(Surface(SurfNum).Construction).Name + " has internal source/sink"); ShowContinueError("While construction named = " + - dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + + state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + " is not an internal source/sink construction"); ShowContinueError("This actuator is not allowed for surface name = " + Surface(SurfNum).Name + ", and the simulation continues without the override"); @@ -4611,10 +4611,10 @@ namespace HeatBalanceSurfaceManager { // thow warning, and do not allow ShowSevereError("InitEMSControlledConstructions: EMS Construction State Actuator not valid."); ShowContinueError( - "Construction named = " + dataConstruction.Construct(Surface(SurfNum).Construction).Name + + "Construction named = " + state.dataConstruction->Construct(Surface(SurfNum).Construction).Name + " has number of finite difference nodes =" + TrimSigDigits(ConstructFD(Surface(SurfNum).Construction).TotNodes)); ShowContinueError( - "While construction named = " + dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + + "While construction named = " + state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + "has number of finite difference nodes =" + TrimSigDigits(ConstructFD(Surface(SurfNum).EMSConstructionOverrideValue).TotNodes)); ShowContinueError("This actuator is not allowed for surface name = " + Surface(SurfNum).Name + @@ -4623,14 +4623,14 @@ namespace HeatBalanceSurfaceManager { EMSConstructActuatorIsOkay(Surface(SurfNum).EMSConstructionOverrideValue, SurfNum) = false; } - if (dataConstruction.Construct(Surface(SurfNum).Construction).SourceSinkPresent) { - if (!dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).SourceSinkPresent) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).SourceSinkPresent) { + if (!state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).SourceSinkPresent) { // thow warning, and do not allow ShowSevereError("InitEMSControlledConstructions: EMS Construction State Actuator not valid."); - ShowContinueError("Construction named = " + dataConstruction.Construct(Surface(SurfNum).Construction).Name + + ShowContinueError("Construction named = " + state.dataConstruction->Construct(Surface(SurfNum).Construction).Name + " has internal source/sink"); ShowContinueError("While construction named = " + - dataConstruction.Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + + state.dataConstruction->Construct(Surface(SurfNum).EMSConstructionOverrideValue).Name + " is not an internal source/sink construction"); ShowContinueError("This actuator is not allowed for surface name = " + Surface(SurfNum).Name + ", and the simulation continues without the override"); @@ -4754,7 +4754,7 @@ namespace HeatBalanceSurfaceManager { } } - void UpdateThermalHistories() + void UpdateThermalHistories(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -4849,7 +4849,7 @@ namespace HeatBalanceSurfaceManager { if ((surface.HeatTransferAlgorithm != HeatTransferModel_CTF) && (surface.HeatTransferAlgorithm != HeatTransferModel_EMPD)) continue; int const ConstrNum(surface.Construction); - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); if (construct.NumCTFTerms == 0) continue; // Skip surfaces with no history terms @@ -4945,7 +4945,7 @@ namespace HeatBalanceSurfaceManager { continue; int const ConstrNum(surface.Construction); - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); ++SUMH(SurfNum); SumTime(SurfNum) = double(SUMH(SurfNum)) * TimeStepZone; @@ -5082,7 +5082,7 @@ namespace HeatBalanceSurfaceManager { } // ...end of loop over all (heat transfer) surfaces } - void CalculateZoneMRT(Optional_int_const ZoneToResimulate) // if passed in, then only calculate surfaces that have this zone + void CalculateZoneMRT(EnergyPlusData &state, Optional_int_const ZoneToResimulate) // if passed in, then only calculate surfaces that have this zone { // SUBROUTINE INFORMATION: @@ -5132,7 +5132,7 @@ namespace HeatBalanceSurfaceManager { ZoneAESum = 0.0; for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (Surface(SurfNum).HeatTransSurf) { - SurfaceAE(SurfNum) = Surface(SurfNum).Area * dataConstruction.Construct(Surface(SurfNum).Construction).InsideAbsorpThermal; + SurfaceAE(SurfNum) = Surface(SurfNum).Area * state.dataConstruction->Construct(Surface(SurfNum).Construction).InsideAbsorpThermal; ZoneNum = Surface(SurfNum).Zone; if (ZoneNum > 0) ZoneAESum(ZoneNum) += SurfaceAE(SurfNum); } @@ -5766,9 +5766,9 @@ namespace HeatBalanceSurfaceManager { } if (present(ZoneToResimulate)) { - CalcInteriorRadExchange(TH(2, 1, _), 0, SurfNetLWRadToSurf, ZoneToResimulate, Outside); + CalcInteriorRadExchange(state, TH(2, 1, _), 0, SurfNetLWRadToSurf, ZoneToResimulate, Outside); } else { - CalcInteriorRadExchange(TH(2, 1, _), 0, SurfNetLWRadToSurf, _, Outside); + CalcInteriorRadExchange(state, TH(2, 1, _), 0, SurfNetLWRadToSurf, _, Outside); } for (int zoneNum = 1; zoneNum <= NumOfZones; ++zoneNum) {// Loop through all surfaces... @@ -5815,7 +5815,7 @@ namespace HeatBalanceSurfaceManager { TH(1, 1, SurfNum) = GroundTemp; // Set the only radiant system heat balance coefficient that is non-zero for this case - if (dataConstruction.Construct(ConstrNum).SourceSinkPresent) + if (state.dataConstruction->Construct(ConstrNum).SourceSinkPresent) RadSysToHBConstCoef(SurfNum) = TH(1, 1, SurfNum); // start HAMT @@ -5858,7 +5858,7 @@ namespace HeatBalanceSurfaceManager { TH(1, 1, SurfNum) = GroundTempFC; // Set the only radiant system heat balance coefficient that is non-zero for this case - if (dataConstruction.Construct(ConstrNum).SourceSinkPresent) + if (state.dataConstruction->Construct(ConstrNum).SourceSinkPresent) RadSysToHBConstCoef(SurfNum) = TH(1, 1, SurfNum); if (Surface(SurfNum).HeatTransferAlgorithm == HeatTransferModel_HAMT) { @@ -5932,7 +5932,7 @@ namespace HeatBalanceSurfaceManager { TH(1, 1, SurfNum) = OSC(OPtr).OSCTempCalc; // Set the only radiant system heat balance coefficient that is non-zero for this case - if (dataConstruction.Construct(ConstrNum).SourceSinkPresent) + if (state.dataConstruction->Construct(ConstrNum).SourceSinkPresent) RadSysToHBConstCoef(SurfNum) = TH(1, 1, SurfNum); if (Surface(SurfNum).HeatTransferAlgorithm == HeatTransferModel_CondFD || @@ -5989,7 +5989,7 @@ namespace HeatBalanceSurfaceManager { Real64 TempExt = OSC(OPtr).OSCTempCalc; // Set the only radiant system heat balance coefficient that is non-zero for this case - if (dataConstruction.Construct(ConstrNum).SourceSinkPresent) + if (state.dataConstruction->Construct(ConstrNum).SourceSinkPresent) RadSysToHBConstCoef(SurfNum) = TH(1, 1, SurfNum); if (Surface(SurfNum).HeatTransferAlgorithm == HeatTransferModel_CondFD || @@ -6013,7 +6013,7 @@ namespace HeatBalanceSurfaceManager { // Call the outside surface temp calculation and pass the necessary terms if (Surface(SurfNum).HeatTransferAlgorithm == HeatTransferModel_CTF || Surface(SurfNum).HeatTransferAlgorithm == HeatTransferModel_EMPD) { - CalcOutsideSurfTemp(SurfNum, zoneNum, ConstrNum, HMovInsul, TempExt, MovInsulErrorFlag); + CalcOutsideSurfTemp(state, SurfNum, zoneNum, ConstrNum, HMovInsul, TempExt, MovInsulErrorFlag); if (MovInsulErrorFlag) ShowFatalError("CalcOutsideSurfTemp: Program terminates due to preceding conditions."); } @@ -6037,7 +6037,7 @@ namespace HeatBalanceSurfaceManager { Real64 TempExt = OSCM(OPtr).TConv; // Set the only radiant system heat balance coefficient that is non-zero for this case - if (dataConstruction.Construct(ConstrNum).SourceSinkPresent) + if (state.dataConstruction->Construct(ConstrNum).SourceSinkPresent) RadSysToHBConstCoef(SurfNum) = TH(1, 1, SurfNum); if (Surface(SurfNum).HeatTransferAlgorithm == HeatTransferModel_CondFD || @@ -6066,7 +6066,7 @@ namespace HeatBalanceSurfaceManager { CalcExteriorVentedCavity(state, SurfNum); } - CalcOutsideSurfTemp(SurfNum, zoneNum, ConstrNum, HMovInsul, TempExt, MovInsulErrorFlag); + CalcOutsideSurfTemp(state, SurfNum, zoneNum, ConstrNum, HMovInsul, TempExt, MovInsulErrorFlag); if (MovInsulErrorFlag) ShowFatalError("CalcOutsideSurfTemp: Program terminates due to preceding conditions."); @@ -6093,10 +6093,10 @@ namespace HeatBalanceSurfaceManager { if (SurfWinStormWinFlag(SurfNum) == 1) ConstrNum = Surface(SurfNum).StormWinConstruction; // Roughness index of the exterior surface int RoughSurf = dataMaterial.Material( - dataConstruction.Construct(ConstrNum).LayerPoint(1)).Roughness; + state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Roughness; // Thermal absoptance of the exterior surface Real64 AbsThermSurf = dataMaterial.Material( - dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; + state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; // Check for outside movable insulation if (Surface(SurfNum).MaterialMovInsulExt > 0) { @@ -6236,16 +6236,16 @@ namespace HeatBalanceSurfaceManager { if (Surface(SurfNum).HeatTransferAlgorithm == HeatTransferModel_CTF || Surface(SurfNum).HeatTransferAlgorithm == HeatTransferModel_EMPD) { - CalcOutsideSurfTemp(SurfNum, zoneNum, ConstrNum, HMovInsul, TempExt, MovInsulErrorFlag); + CalcOutsideSurfTemp(state, SurfNum, zoneNum, ConstrNum, HMovInsul, TempExt, MovInsulErrorFlag); if (MovInsulErrorFlag) ShowFatalError("CalcOutsideSurfTemp: Program terminates due to preceding conditions."); } } else if (SELECT_CASE_var == KivaFoundation) { int RoughSurf = dataMaterial.Material( - dataConstruction.Construct(ConstrNum).LayerPoint(1)).Roughness; + state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Roughness; Real64 AbsThermSurf = dataMaterial.Material( - dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; + state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; // Set Kiva exterior convection algorithms InitExteriorConvectionCoeff(state, SurfNum, HMovInsul, RoughSurf, @@ -6572,7 +6572,7 @@ namespace HeatBalanceSurfaceManager { if (((SurfaceGeometry::kivaManager.settings.timestepType == HeatBalanceKivaManager::KivaManager::Settings::HOURLY && TimeStep == 1) || SurfaceGeometry::kivaManager.settings.timestepType == HeatBalanceKivaManager::KivaManager::Settings::TIMESTEP) && !WarmupFlag) { - SurfaceGeometry::kivaManager.calcKivaInstances(); + SurfaceGeometry::kivaManager.calcKivaInstances(state); } } @@ -6588,7 +6588,7 @@ namespace HeatBalanceSurfaceManager { } HeatBalanceIntRadExchange::CalcInteriorRadExchange( - TempSurfIn, InsideSurfIterations, SurfNetLWRadToSurf, ZoneToResimulate, Inside); // Update the radiation balance + state, TempSurfIn, InsideSurfIterations, SurfNetLWRadToSurf, ZoneToResimulate, Inside); // Update the radiation balance if (DataHeatBalance::AnyKiva) { for (auto &kivaSurf : SurfaceGeometry::kivaManager.surfaceMap) { @@ -6647,7 +6647,7 @@ namespace HeatBalanceSurfaceManager { auto &surface(Surface(SurfNum)); Real64 &TH11(TH(1, 1, SurfNum)); int const ConstrNum = surface.Construction; - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); Real64 const MAT_zone(MAT(ZoneNum)); Real64 const HConvIn_surf(HConvInFD(SurfNum) = HConvIn(SurfNum)); @@ -6920,7 +6920,7 @@ namespace HeatBalanceSurfaceManager { auto &surface(Surface(SurfNum)); Real64 &TH11(TH(1, 1, SurfNum)); int ConstrNum = surface.Construction; // Not const, because storm window may change this - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); if (SurfWinOriginalClass(SurfNum) == SurfaceClass_TDD_Diffuser) { // Tubular daylighting device // Lookup up the TDD:DOME object int const pipeNum = SurfWinTDDPipeNum(SurfNum); @@ -6947,10 +6947,10 @@ namespace HeatBalanceSurfaceManager { // Calculate window heat gain for TDD:DIFFUSER since this calculation is usually done in WindowManager SurfWinHeatGain(SurfNum) = SurfWinTransSolar(SurfNum) + HConvIn_surf * surface.Area * (TempSurfIn(SurfNum) - RefAirTemp(SurfNum)) + - dataConstruction.Construct(surface.Construction).InsideAbsorpThermal * surface.Area * + state.dataConstruction->Construct(surface.Construction).InsideAbsorpThermal * surface.Area * (Sigma_Temp_4 - (SurfWinIRfromParentZone(SurfNum) + QHTRadSysSurf(SurfNum) + QCoolingPanelSurf(SurfNum) + QHWBaseboardSurf(SurfNum) + QSteamBaseboardSurf(SurfNum) + QElecBaseboardSurf(SurfNum))) - - QS(surface.SolarEnclIndex) * surface.Area * dataConstruction.Construct(surface.Construction).TransDiff; + QS(surface.SolarEnclIndex) * surface.Area * state.dataConstruction->Construct(surface.Construction).TransDiff; // Transmitted solar | Convection | IR exchange | IR // Zone diffuse interior shortwave reflected back into the TDD SurfWinHeatTransfer(SurfNum) = SurfWinHeatGain(SurfNum); @@ -6958,11 +6958,11 @@ namespace HeatBalanceSurfaceManager { // fill out report vars for components of Window Heat Gain SurfWinGainConvGlazToZoneRep(SurfNum) = HConvIn_surf * surface.Area * (TempSurfIn(SurfNum) - RefAirTemp(SurfNum)); SurfWinGainIRGlazToZoneRep(SurfNum) = - dataConstruction.Construct(surface.Construction).InsideAbsorpThermal * surface.Area * + state.dataConstruction->Construct(surface.Construction).InsideAbsorpThermal * surface.Area * (Sigma_Temp_4 - (SurfWinIRfromParentZone(SurfNum) + QHTRadSysSurf(SurfNum) + QCoolingPanelSurf(SurfNum) + QHWBaseboardSurf(SurfNum) + QSteamBaseboardSurf(SurfNum) + QElecBaseboardSurf(SurfNum))); SurfWinLossSWZoneToOutWinRep(SurfNum) = - QS(surface.SolarEnclIndex) * surface.Area * dataConstruction.Construct(surface.Construction).TransDiff; + QS(surface.SolarEnclIndex) * surface.Area * state.dataConstruction->Construct(surface.Construction).TransDiff; } else { // Regular window if (InsideSurfIterations == 0) { // Do windows only once if (SurfWinStormWinFlag(SurfNum) == 1) ConstrNum = surface.StormWinConstruction; @@ -6978,14 +6978,14 @@ namespace HeatBalanceSurfaceManager { // Exterior shade in place int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; if (ConstrNumSh != 0) { - RoughSurf = dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(1)).Roughness; - EmisOut = dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(1)).AbsorpThermal; + RoughSurf = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1)).Roughness; + EmisOut = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1)).AbsorpThermal; } } // Get the outside effective emissivity for Equivalent layer model if (construct.WindowTypeEQL) { - EmisOut = WindowEquivalentLayer::EQLWindowOutsideEffectiveEmiss(ConstrNum); + EmisOut = WindowEquivalentLayer::EQLWindowOutsideEffectiveEmiss(state, ConstrNum); } // Set Exterior Convection Coefficient... if (surface.ExtConvCoeff > 0) { @@ -7266,7 +7266,7 @@ namespace HeatBalanceSurfaceManager { ReportIntMovInsInsideSurfTemp(); - CalculateZoneMRT(ZoneToResimulate); // Update here so that the proper value of MRT is available to radiant systems + CalculateZoneMRT(state, ZoneToResimulate); // Update here so that the proper value of MRT is available to radiant systems } void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, @@ -7292,7 +7292,7 @@ namespace HeatBalanceSurfaceManager { int const lastSurf = Zone(zoneNum).NonWindowSurfaceLast; for (int surfNum = firstSurf; surfNum <= lastSurf; ++surfNum) { int const ConstrNum = Surface(surfNum).Construction; - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); if (Surface(surfNum).ExtBoundCond == surfNum) { IsAdiabatic(surfNum) = 1; IsNotAdiabatic(surfNum) = 0; @@ -7326,7 +7326,7 @@ namespace HeatBalanceSurfaceManager { for (int surfNum = firstSurf; surfNum <= lastSurf; ++surfNum) { int const ConstrNum = Surface(surfNum).Construction; - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); CTFCross0(surfNum) = construct.CTFCross(0); CTFInside0(surfNum) = construct.CTFInside(0); CTFSourceIn0(surfNum) = construct.CTFSourceIn(0); @@ -7453,7 +7453,7 @@ namespace HeatBalanceSurfaceManager { TempInsOld = TempSurfIn; // Keep track of last iteration's temperature values HeatBalanceIntRadExchange::CalcInteriorRadExchange( - TempSurfIn, InsideSurfIterations, SurfNetLWRadToSurf, ZoneToResimulate, Inside); // Update the radiation balance + state, TempSurfIn, InsideSurfIterations, SurfNetLWRadToSurf, ZoneToResimulate, Inside); // Update the radiation balance // Every 30 iterations, recalculate the inside convection coefficients in case // there has been a significant drift in the surface temperatures predicted. @@ -7577,7 +7577,7 @@ namespace HeatBalanceSurfaceManager { } if (AnyConstructInternalSourceInInput) { - if (dataConstruction.Construct(Surface(surfNum).Construction).SourceSinkPresent) { + if (state.dataConstruction->Construct(Surface(surfNum).Construction).SourceSinkPresent) { // Set the appropriate parameters for the radiant system // Radiant system does not need the damping coefficient terms (hopefully) Real64 const RadSysDiv(1.0 / (CTFInside0(surfNum) + HConvIn(surfNum))); @@ -7626,7 +7626,7 @@ namespace HeatBalanceSurfaceManager { auto &surface(Surface(surfNum)); Real64 &TH11(TH(1, 1, surfNum)); int ConstrNum = surface.Construction; // Not const, because storm window may change this - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); if (SurfWinOriginalClass(surfNum) == SurfaceClass_TDD_Diffuser) { // Tubular daylighting device // Lookup up the TDD:DOME object int const pipeNum = SurfWinTDDPipeNum(surfNum); @@ -7653,10 +7653,10 @@ namespace HeatBalanceSurfaceManager { // Calculate window heat gain for TDD:DIFFUSER since this calculation is usually done in WindowManager SurfWinHeatGain(surfNum) = SurfWinTransSolar(surfNum) + HConvIn_surf * surface.Area * (TempSurfIn(surfNum) - RefAirTemp(surfNum)) + - dataConstruction.Construct(surface.Construction).InsideAbsorpThermal * surface.Area * + state.dataConstruction->Construct(surface.Construction).InsideAbsorpThermal * surface.Area * (Sigma_Temp_4 - (SurfWinIRfromParentZone(surfNum) + QHTRadSysSurf(surfNum) + QCoolingPanelSurf(surfNum) + QHWBaseboardSurf(surfNum) + QSteamBaseboardSurf(surfNum) + QElecBaseboardSurf(surfNum))) - QS(surface.SolarEnclIndex) * surface.Area * - dataConstruction.Construct(surface.Construction) + state.dataConstruction->Construct(surface.Construction) .TransDiff; // Transmitted solar | Convection | IR exchange | IR // Zone diffuse interior shortwave reflected back into the TDD SurfWinHeatTransfer(surfNum) = SurfWinHeatGain(surfNum); @@ -7664,11 +7664,11 @@ namespace HeatBalanceSurfaceManager { // fill out report vars for components of Window Heat Gain SurfWinGainConvGlazToZoneRep(surfNum) = HConvIn_surf * surface.Area * (TempSurfIn(surfNum) - RefAirTemp(surfNum)); SurfWinGainIRGlazToZoneRep(surfNum) = - dataConstruction.Construct(surface.Construction).InsideAbsorpThermal * surface.Area * + state.dataConstruction->Construct(surface.Construction).InsideAbsorpThermal * surface.Area * (Sigma_Temp_4 - (SurfWinIRfromParentZone(surfNum) + QHTRadSysSurf(surfNum) + QCoolingPanelSurf(surfNum) + QHWBaseboardSurf(surfNum) + QSteamBaseboardSurf(surfNum) + QElecBaseboardSurf(surfNum))); SurfWinLossSWZoneToOutWinRep(surfNum) = - QS(surface.SolarEnclIndex) * surface.Area * dataConstruction.Construct(surface.Construction).TransDiff; + QS(surface.SolarEnclIndex) * surface.Area * state.dataConstruction->Construct(surface.Construction).TransDiff; } else { // Regular window if (InsideSurfIterations == 0) { // Do windows only once if (SurfWinStormWinFlag(surfNum) == 1) ConstrNum = surface.StormWinConstruction; @@ -7685,14 +7685,14 @@ namespace HeatBalanceSurfaceManager { // Exterior shade in place int ConstrNumSh = Surface(surfNum).activeShadedConstruction; if (ConstrNumSh != 0) { - RoughSurf = dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(1)).Roughness; - EmisOut = dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(1)).AbsorpThermal; + RoughSurf = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1)).Roughness; + EmisOut = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1)).AbsorpThermal; } } // Get the outside effective emissivity for Equivalent layer model if (construct.WindowTypeEQL) { - EmisOut = WindowEquivalentLayer::EQLWindowOutsideEffectiveEmiss(ConstrNum); + EmisOut = WindowEquivalentLayer::EQLWindowOutsideEffectiveEmiss(state, ConstrNum); } // Set Exterior Convection Coefficient... if (surface.ExtConvCoeff > 0) { @@ -7906,7 +7906,7 @@ namespace HeatBalanceSurfaceManager { ReportIntMovInsInsideSurfTemp(); - CalculateZoneMRT(ZoneToResimulate); // Update here so that the proper value of MRT is available to radiant systems + CalculateZoneMRT(state, ZoneToResimulate); // Update here so that the proper value of MRT is available to radiant systems } void TestSurfTempCalcHeatBalanceInsideSurf(Real64 TH12, SurfaceData &surface, ZoneData &zone, int WarmupSurfTemp) @@ -8077,7 +8077,8 @@ namespace HeatBalanceSurfaceManager { } } - void CalcOutsideSurfTemp(int const SurfNum, // Surface number DO loop counter + void CalcOutsideSurfTemp(EnergyPlusData &state, + int const SurfNum, // Surface number DO loop counter int const ZoneNum, // Zone number the current surface is attached to int const ConstrNum, // Construction index for the current surface Real64 const HMovInsul, // "Convection" coefficient of movable insulation @@ -8174,7 +8175,7 @@ namespace HeatBalanceSurfaceManager { // requires the inside heat balance to be accounted for in the heat balance // while a "slow" surface can used the last time step's value for inside // surface temperature. - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); if (construct.CTFCross(0) > 0.01) { QuickConductionSurf = true; F1 = construct.CTFCross(0) / (construct.CTFInside(0) + HConvIn(SurfNum)); @@ -8340,7 +8341,7 @@ namespace HeatBalanceSurfaceManager { for (SrdSurfNum = 1; SrdSurfNum <= SurroundingSurfsProperty(SrdSurfsNum).TotSurroundingSurface; SrdSurfNum++) { SrdSurfViewFac = SurroundingSurfsProperty(SrdSurfsNum).SurroundingSurfs(SrdSurfNum).ViewFactor; SrdSurfTempAbs = GetCurrentScheduleValue(SurroundingSurfsProperty(SrdSurfsNum).SurroundingSurfs(SrdSurfNum).TempSchNum) + KelvinConv; - QRadLWOutSrdSurfsRep += StefanBoltzmann * dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermal * + QRadLWOutSrdSurfsRep += StefanBoltzmann * dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermal * SrdSurfViewFac * (pow_4(SrdSurfTempAbs) - pow_4(TH11 + KelvinConv)); } } diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.hh b/src/EnergyPlus/HeatBalanceSurfaceManager.hh index d800f082f87..f5e15ae76c9 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.hh +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.hh @@ -93,21 +93,21 @@ namespace HeatBalanceSurfaceManager { void AllocateSurfaceHeatBalArrays(EnergyPlusData &state); - void InitThermalAndFluxHistories(); + void InitThermalAndFluxHistories(EnergyPlusData &state); void InitSolarHeatGains(EnergyPlusData &state); - void InitIntSolarDistribution(); + void InitIntSolarDistribution(EnergyPlusData &state); - void ComputeIntThermalAbsorpFactors(); + void ComputeIntThermalAbsorpFactors(EnergyPlusData &state); - void ComputeIntSWAbsorpFactors(); + void ComputeIntSWAbsorpFactors(EnergyPlusData &state); - void ComputeDifSolExcZonesWIZWindows(int NumberOfEnclosures); // Number of solar enclosures + void ComputeDifSolExcZonesWIZWindows(EnergyPlusData &state, int NumberOfEnclosures); // Number of solar enclosures - void InitEMSControlledSurfaceProperties(); + void InitEMSControlledSurfaceProperties(EnergyPlusData &state); - void InitEMSControlledConstructions(); + void InitEMSControlledConstructions(EnergyPlusData &state); // End Initialization Section of the Module //****************************************************************************** @@ -120,9 +120,9 @@ namespace HeatBalanceSurfaceManager { void UpdateFinalSurfaceHeatBalance(EnergyPlusData &state); - void UpdateThermalHistories(); + void UpdateThermalHistories(EnergyPlusData &state); - void CalculateZoneMRT(Optional_int_const ZoneToResimulate = _); // if passed in, then only calculate surfaces that have this zone + void CalculateZoneMRT(EnergyPlusData &state, Optional_int_const ZoneToResimulate = _); // if passed in, then only calculate surfaces that have this zone // End of Record Keeping subroutines for the HB Module // ***************************************************************************** @@ -172,7 +172,8 @@ namespace HeatBalanceSurfaceManager { DataHeatBalance::ZoneData &zone, int WarmupSurfTemp); - void CalcOutsideSurfTemp(int SurfNum, // Surface number DO loop counter + void CalcOutsideSurfTemp(EnergyPlusData &state, + int SurfNum, // Surface number DO loop counter int ZoneNum, // Zone number the current surface is attached to int ConstrNum, // Construction index for the current surface Real64 HMovInsul, // "Convection" coefficient of movable insulation diff --git a/src/EnergyPlus/HeatRecovery.cc b/src/EnergyPlus/HeatRecovery.cc index 2592c9c6437..81daed56c63 100644 --- a/src/EnergyPlus/HeatRecovery.cc +++ b/src/EnergyPlus/HeatRecovery.cc @@ -1591,8 +1591,8 @@ namespace HeatRecovery { } } else if (CompanionCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { // how to support VS dx coil here? - FullLoadOutAirTemp = VariableSpeedCoils::VarSpeedCoil(CompanionCoilIndex).OutletAirDBTemp; - FullLoadOutAirHumRat = VariableSpeedCoils::VarSpeedCoil(CompanionCoilIndex).OutletAirHumRat; + FullLoadOutAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CompanionCoilIndex).OutletAirDBTemp; + FullLoadOutAirHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(CompanionCoilIndex).OutletAirHumRat; } } else { diff --git a/src/EnergyPlus/HeatingCoils.cc b/src/EnergyPlus/HeatingCoils.cc index 1d7bc3a6b9f..8392dac0f3e 100644 --- a/src/EnergyPlus/HeatingCoils.cc +++ b/src/EnergyPlus/HeatingCoils.cc @@ -302,7 +302,7 @@ namespace HeatingCoils { StageNum, OpMode); // Autodesk:OPTIONAL SpeedRatio, PartLoadRatio, StageNum used without PRESENT check } else if (HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingDesuperheater) { - CalcDesuperheaterHeatingCoil(CoilNum, QCoilRequired, QCoilActual2); + CalcDesuperheaterHeatingCoil(state, CoilNum, QCoilRequired, QCoilActual2); } else { QCoilActual2 = 0.0; } @@ -1448,7 +1448,7 @@ namespace HeatingCoils { break; } } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_VARIABLE_COOLING) { - for (DXCoilNum = 1; DXCoilNum <= VariableSpeedCoils::NumVarSpeedCoils; ++DXCoilNum) { + for (DXCoilNum = 1; DXCoilNum <= state.dataVariableSpeedCoils->NumVarSpeedCoils; ++DXCoilNum) { if (!UtilityRoutines::SameString(DataHeatBalance::HeatReclaimVS_DXCoil(DXCoilNum).Name, HeatingCoil(CoilNum).ReclaimHeatingCoilName)) continue; @@ -2574,7 +2574,7 @@ namespace HeatingCoils { Node(HeatingCoil(CoilNum).AirOutletNodeNum).Temp = HeatingCoil(CoilNum).OutletAirTemp; } - void CalcDesuperheaterHeatingCoil(int const CoilNum, // index to desuperheater heating coil + void CalcDesuperheaterHeatingCoil(EnergyPlusData &state, int const CoilNum, // index to desuperheater heating coil Real64 const QCoilReq, // load requested by the simulation for load based control [W] Real64 &QCoilActual // coil load actually delivered ) @@ -2680,7 +2680,7 @@ namespace HeatingCoils { HeatReclaimDXCoil(SourceID).AvailCapacity * Effic - HeatReclaimDXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal; } else if (HeatingCoil(CoilNum).ReclaimHeatingSource == COIL_DX_VARIABLE_COOLING) { // condenser heat rejection - HeatingCoil(CoilNum).RTF = VariableSpeedCoils::VarSpeedCoil(SourceID).RunFrac; + HeatingCoil(CoilNum).RTF = state.dataVariableSpeedCoils->VarSpeedCoil(SourceID).RunFrac; HeatingCoil(CoilNum).NominalCapacity = DataHeatBalance::HeatReclaimVS_DXCoil(SourceID).AvailCapacity * Effic - DataHeatBalance::HeatReclaimVS_DXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal; } diff --git a/src/EnergyPlus/HeatingCoils.hh b/src/EnergyPlus/HeatingCoils.hh index 3079d0bf002..a99200e6c22 100644 --- a/src/EnergyPlus/HeatingCoils.hh +++ b/src/EnergyPlus/HeatingCoils.hh @@ -268,7 +268,7 @@ namespace HeatingCoils { int const FanOpMode // Fan operation mode ); - void CalcDesuperheaterHeatingCoil(int const CoilNum, // index to desuperheater heating coil + void CalcDesuperheaterHeatingCoil(EnergyPlusData &state, int const CoilNum, // index to desuperheater heating coil Real64 const QCoilReq, // load requested by the simulation for load based control [W] Real64 &QCoilActual // coil load actually delivered ); diff --git a/src/EnergyPlus/IntegratedHeatPump.cc b/src/EnergyPlus/IntegratedHeatPump.cc index f1fd2bad13b..8f1b1b0b611 100644 --- a/src/EnergyPlus/IntegratedHeatPump.cc +++ b/src/EnergyPlus/IntegratedHeatPump.cc @@ -1104,7 +1104,6 @@ namespace IntegratedHeatPump { using GlobalNames::VerifyUniqueCoilName; using General::TrimSigDigits; using VariableSpeedCoils::GetCoilIndexVariableSpeed; - using VariableSpeedCoils::VarSpeedCoil; // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("GetIHPInput: "); // include trailing blank space @@ -1300,7 +1299,7 @@ namespace IntegratedHeatPump { ShowContinueError("...specified in " + CurrentModuleObject + "=\"" + AlphArray(1) + "\"."); ErrorsFound = true; } else { - VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).bIsDesuperheater = true; + state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).bIsDesuperheater = true; } } @@ -1338,7 +1337,7 @@ namespace IntegratedHeatPump { ShowContinueError("...specified in " + CurrentModuleObject + "=\"" + AlphArray(1) + "\"."); ErrorsFound = true; } else { - VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).bIsDesuperheater = true; + state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).bIsDesuperheater = true; } } @@ -1367,8 +1366,8 @@ namespace IntegratedHeatPump { // cooling coil air node connections ChildCoilIndex = IntegratedHeatPumps(DXCoilNum).SCCoilIndex; - InNode = VarSpeedCoil(ChildCoilIndex).AirInletNodeNum; - OutNode = VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum; + InNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirInletNodeNum; + OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum; InNodeName = NodeID(InNode); OutNodeName = NodeID(OutNode); @@ -1416,8 +1415,8 @@ namespace IntegratedHeatPump { ObjectIsNotParent, ErrorsFound); - if ((VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).AirInletNodeNum != InNode) || - (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).AirOutletNodeNum != OutNode)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).AirInletNodeNum != InNode) || + (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).AirOutletNodeNum != OutNode)) { ShowContinueError("Mistaken air node connection: " + CurrentModuleObject + IntegratedHeatPumps(DXCoilNum).SCWHCoilName + "-wrong coil node names."); ErrorsFound = true; @@ -1445,8 +1444,8 @@ namespace IntegratedHeatPump { ObjectIsNotParent, ErrorsFound); - if ((VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).AirInletNodeNum != InNode) || - (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).AirOutletNodeNum != OutNode)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).AirInletNodeNum != InNode) || + (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).AirOutletNodeNum != OutNode)) { ShowContinueError("Mistaken air node connection: " + CurrentModuleObject + IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilName + "-wrong coil node names."); ErrorsFound = true; @@ -1478,11 +1477,11 @@ namespace IntegratedHeatPump { ChildCoilIndex = IntegratedHeatPumps(DXCoilNum).SHCoilIndex; InNode = IntegratedHeatPumps(DXCoilNum).AirHeatInletNodeNum; - OutNode = VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum; + OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum; IntegratedHeatPumps(DXCoilNum).AirOutletNodeNum = OutNode; InNodeName = NodeID(InNode); OutNodeName = NodeID(OutNode); - if (VarSpeedCoil(ChildCoilIndex).AirInletNodeNum != InNode) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirInletNodeNum != InNode) { ShowContinueError("Mistaken air node connection: " + CurrentModuleObject + "- cooling coil outlet mismatches heating coil inlet" + "."); ErrorsFound = true; @@ -1528,8 +1527,8 @@ namespace IntegratedHeatPump { ObjectIsNotParent, ErrorsFound); - if ((VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilIndex).AirInletNodeNum != InNode) || - (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilIndex).AirOutletNodeNum != OutNode)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilIndex).AirInletNodeNum != InNode) || + (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilIndex).AirOutletNodeNum != OutNode)) { ShowContinueError("Mistaken air node connection: " + CurrentModuleObject + IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilName + "-wrong coil node names."); ErrorsFound = true; @@ -1560,14 +1559,14 @@ namespace IntegratedHeatPump { // water node connections ChildCoilIndex = IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex; - InNode = VarSpeedCoil(ChildCoilIndex).WaterInletNodeNum; - OutNode = VarSpeedCoil(ChildCoilIndex).WaterOutletNodeNum; + InNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).WaterInletNodeNum; + OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).WaterOutletNodeNum; InNodeName = NodeID(InNode); OutNodeName = NodeID(OutNode); IntegratedHeatPumps(DXCoilNum).WaterInletNodeNum = InNode; IntegratedHeatPumps(DXCoilNum).WaterOutletNodeNum = OutNode; - if ((VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).WaterInletNodeNum != InNode) || - (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).WaterOutletNodeNum != OutNode)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).WaterInletNodeNum != InNode) || + (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).WaterOutletNodeNum != OutNode)) { ShowContinueError("Mistaken water node connection: " + CurrentModuleObject + IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilName + "-wrong coil node names."); ErrorsFound = true; @@ -1637,8 +1636,8 @@ namespace IntegratedHeatPump { ObjectIsNotParent, ErrorsFound); - if ((VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).WaterInletNodeNum != InNode) || - (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).WaterOutletNodeNum != OutNode)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).WaterInletNodeNum != InNode) || + (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).WaterOutletNodeNum != OutNode)) { ShowContinueError("Mistaken water node connection: " + CurrentModuleObject + IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilName + "-wrong coil node names."); ErrorsFound = true; @@ -1666,8 +1665,8 @@ namespace IntegratedHeatPump { ObjectIsNotParent, ErrorsFound); - if ((VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).WaterInletNodeNum != InNode) || - (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).WaterOutletNodeNum != OutNode)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).WaterInletNodeNum != InNode) || + (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).WaterOutletNodeNum != OutNode)) { ShowContinueError("Mistaken water node connection: " + CurrentModuleObject + IntegratedHeatPumps(DXCoilNum).DWHCoilName + "-wrong coil node names."); ErrorsFound = true; @@ -1701,14 +1700,14 @@ namespace IntegratedHeatPump { // outdoor air node connections for water heating coils // DWH, SCDWH, SHDWH coils have the same outdoor air nodes ChildCoilIndex = IntegratedHeatPumps(DXCoilNum).DWHCoilIndex; - InNode = VarSpeedCoil(ChildCoilIndex).AirInletNodeNum; - OutNode = VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum; + InNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirInletNodeNum; + OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum; InNodeName = NodeID(InNode); OutNodeName = NodeID(OutNode); IntegratedHeatPumps(DXCoilNum).ODAirInletNodeNum = InNode; IntegratedHeatPumps(DXCoilNum).ODAirOutletNodeNum = OutNode; - if ((VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).AirInletNodeNum != InNode) || - (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).AirOutletNodeNum != OutNode)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).AirInletNodeNum != InNode) || + (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).AirOutletNodeNum != OutNode)) { ShowContinueError("Mistaken air node connection: " + CurrentModuleObject + IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilName + "-wrong coil node names."); ErrorsFound = true; @@ -1778,10 +1777,10 @@ namespace IntegratedHeatPump { ObjectIsNotParent, ErrorsFound); - VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).AirInletNodeNum = InNode; - VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).AirOutletNodeNum = OutNode; - if ((VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).AirInletNodeNum != InNode) || - (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).AirOutletNodeNum != OutNode)) { + state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).AirInletNodeNum = InNode; + state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).AirOutletNodeNum = OutNode; + if ((state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).AirInletNodeNum != InNode) || + (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).AirOutletNodeNum != OutNode)) { ShowContinueError("Mistaken air node connection: " + CurrentModuleObject + IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilName + "-wrong coil node names."); ErrorsFound = true; @@ -1929,7 +1928,6 @@ namespace IntegratedHeatPump { using VariableSpeedCoils::SetVarSpeedCoilData; using VariableSpeedCoils::SimVariableSpeedCoils; using VariableSpeedCoils::SizeVarSpeedCoil; - using VariableSpeedCoils::VarSpeedCoil; static bool ErrorsFound(false); // If errors detected in input Real64 RatedCapacity(0.0); // rated building cooling load @@ -1962,7 +1960,7 @@ namespace IntegratedHeatPump { ShowFatalError("SizeIHP: failed to size SC coil\"" + IntegratedHeatPumps(DXCoilNum).SCCoilName + "\""); ErrorsFound = false; } else { - RatedCapacity = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCCoilIndex).RatedCapCoolTotal; + RatedCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCCoilIndex).RatedCapCoolTotal; }; SizeVarSpeedCoil(state, IntegratedHeatPumps(DXCoilNum).SHCoilIndex); // size heating coil @@ -1972,8 +1970,8 @@ namespace IntegratedHeatPump { }; // pass SC coil capacity to SCDWH cool coil - if (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).RatedCapCoolTotal == AutoSize) { - VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).RatedCapCoolTotal = RatedCapacity; + if (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).RatedCapCoolTotal == AutoSize) { + state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).RatedCapCoolTotal = RatedCapacity; }; // associate SCDWH air coil to SHDWH air coil @@ -1995,9 +1993,9 @@ namespace IntegratedHeatPump { // size the water coils below // size SCWH water coil - if (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).RatedCapWH == AutoSize) { - VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).RatedCapWH = - RatedCapacity / (1.0 - 1.0 / VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).RatedCOPHeat); + if (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).RatedCapWH == AutoSize) { + state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).RatedCapWH = + RatedCapacity / (1.0 - 1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).RatedCOPHeat); } SizeVarSpeedCoil(state, IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex); @@ -2007,8 +2005,8 @@ namespace IntegratedHeatPump { }; // size DWH water coil - if (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).RatedCapWH == AutoSize) { - VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).RatedCapWH = RatedCapacity; + if (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).RatedCapWH == AutoSize) { + state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).RatedCapWH = RatedCapacity; } SizeVarSpeedCoil(state, IntegratedHeatPumps(DXCoilNum).DWHCoilIndex); @@ -2018,8 +2016,8 @@ namespace IntegratedHeatPump { }; // size SCDWH water coil - if (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).RatedCapWH == AutoSize) { - VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).RatedCapWH = RatedCapacity * 0.13; + if (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).RatedCapWH == AutoSize) { + state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex).RatedCapWH = RatedCapacity * 0.13; } SizeVarSpeedCoil(state, IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex); @@ -2029,8 +2027,8 @@ namespace IntegratedHeatPump { }; // size SHDWH water coil - if (VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).RatedCapWH == AutoSize) { - VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).RatedCapWH = RatedCapacity * 0.1; + if (state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).RatedCapWH == AutoSize) { + state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex).RatedCapWH = RatedCapacity * 0.1; } SizeVarSpeedCoil(state, IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex); @@ -2079,7 +2077,6 @@ namespace IntegratedHeatPump { { using DataHVACGlobals::TimeStepSys; using General::TrimSigDigits; - using VariableSpeedCoils::VarSpeedCoil; int VSCoilIndex(0); Real64 ReportingConstant(0.0); @@ -2099,64 +2096,64 @@ namespace IntegratedHeatPump { switch (IntegratedHeatPumps(DXCoilNum).CurMode) { case IHPOperationMode::SCMode: VSCoilIndex = IntegratedHeatPumps(DXCoilNum).SCCoilIndex; - IntegratedHeatPumps(DXCoilNum).TotalCoolingRate = VarSpeedCoil(VSCoilIndex).QLoadTotal; // total cooling rate [w] + IntegratedHeatPumps(DXCoilNum).TotalCoolingRate = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QLoadTotal; // total cooling rate [w] IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = 0.0; // total water heating rate [w] IntegratedHeatPumps(DXCoilNum).TotalSpaceHeatingRate = 0.0; // total space heating rate [w] - IntegratedHeatPumps(DXCoilNum).TotalPower = VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] - IntegratedHeatPumps(DXCoilNum).TotalLatentLoad = VarSpeedCoil(VSCoilIndex).QLatent; // total latent cooling rate [w] - IntegratedHeatPumps(DXCoilNum).Qsource = VarSpeedCoil(VSCoilIndex).QSource; // source energy rate, [w] + IntegratedHeatPumps(DXCoilNum).TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] + IntegratedHeatPumps(DXCoilNum).TotalLatentLoad = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QLatent; // total latent cooling rate [w] + IntegratedHeatPumps(DXCoilNum).Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QSource; // source energy rate, [w] break; case IHPOperationMode::SHMode: VSCoilIndex = IntegratedHeatPumps(DXCoilNum).SHCoilIndex; IntegratedHeatPumps(DXCoilNum).TotalCoolingRate = 0.0; // total cooling rate [w] IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = 0.0; // total water heating rate [w] - IntegratedHeatPumps(DXCoilNum).TotalSpaceHeatingRate = VarSpeedCoil(VSCoilIndex).QLoadTotal; // total space heating rate [w] - IntegratedHeatPumps(DXCoilNum).TotalPower = VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] + IntegratedHeatPumps(DXCoilNum).TotalSpaceHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QLoadTotal; // total space heating rate [w] + IntegratedHeatPumps(DXCoilNum).TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] IntegratedHeatPumps(DXCoilNum).TotalLatentLoad = 0.0; // total latent cooling rate [w] - IntegratedHeatPumps(DXCoilNum).Qsource = VarSpeedCoil(VSCoilIndex).QSource; // source energy rate, [w] + IntegratedHeatPumps(DXCoilNum).Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QSource; // source energy rate, [w] break; case IHPOperationMode::DWHMode: VSCoilIndex = IntegratedHeatPumps(DXCoilNum).DWHCoilIndex; IntegratedHeatPumps(DXCoilNum).TotalCoolingRate = 0.0; // total cooling rate [w] - IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = VarSpeedCoil(VSCoilIndex).QSource; // total water heating rate [w] + IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QSource; // total water heating rate [w] IntegratedHeatPumps(DXCoilNum).TotalSpaceHeatingRate = 0.0; // total space heating rate [w] - IntegratedHeatPumps(DXCoilNum).TotalPower = VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] + IntegratedHeatPumps(DXCoilNum).TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] IntegratedHeatPumps(DXCoilNum).TotalLatentLoad = 0.0; // total latent cooling rate [w] - IntegratedHeatPumps(DXCoilNum).Qsource = VarSpeedCoil(VSCoilIndex).QLoadTotal; // source energy rate, [w] + IntegratedHeatPumps(DXCoilNum).Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QLoadTotal; // source energy rate, [w] break; case IHPOperationMode::SCWHMatchSCMode: case IHPOperationMode::SCWHMatchWHMode: VSCoilIndex = IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex; - IntegratedHeatPumps(DXCoilNum).TotalCoolingRate = VarSpeedCoil(VSCoilIndex).QLoadTotal; // total cooling rate [w] - IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = VarSpeedCoil(VSCoilIndex).QSource; // total water heating rate [w] + IntegratedHeatPumps(DXCoilNum).TotalCoolingRate = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QLoadTotal; // total cooling rate [w] + IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QSource; // total water heating rate [w] IntegratedHeatPumps(DXCoilNum).TotalSpaceHeatingRate = 0.0; // total space heating rate [w] - IntegratedHeatPumps(DXCoilNum).TotalPower = VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] - IntegratedHeatPumps(DXCoilNum).TotalLatentLoad = VarSpeedCoil(VSCoilIndex).QLatent; // total latent cooling rate [w] + IntegratedHeatPumps(DXCoilNum).TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] + IntegratedHeatPumps(DXCoilNum).TotalLatentLoad = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QLatent; // total latent cooling rate [w] IntegratedHeatPumps(DXCoilNum).Qsource = 0.0; // source energy rate, [w] break; case IHPOperationMode::SCDWHMode: VSCoilIndex = IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex; - IntegratedHeatPumps(DXCoilNum).TotalCoolingRate = VarSpeedCoil(VSCoilIndex).QLoadTotal; // total cooling rate [w] + IntegratedHeatPumps(DXCoilNum).TotalCoolingRate = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QLoadTotal; // total cooling rate [w] IntegratedHeatPumps(DXCoilNum).TotalSpaceHeatingRate = 0.0; // total space heating rate [w] - IntegratedHeatPumps(DXCoilNum).TotalPower = VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] - IntegratedHeatPumps(DXCoilNum).TotalLatentLoad = VarSpeedCoil(VSCoilIndex).QLatent; // total latent cooling rate [w] - IntegratedHeatPumps(DXCoilNum).Qsource = VarSpeedCoil(VSCoilIndex).QSource; // source energy rate, [w] + IntegratedHeatPumps(DXCoilNum).TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] + IntegratedHeatPumps(DXCoilNum).TotalLatentLoad = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QLatent; // total latent cooling rate [w] + IntegratedHeatPumps(DXCoilNum).Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QSource; // source energy rate, [w] VSCoilIndex = IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex; - IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = VarSpeedCoil(VSCoilIndex).QSource; // total water heating rate [w] + IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QSource; // total water heating rate [w] break; case IHPOperationMode::SHDWHElecHeatOffMode: case IHPOperationMode::SHDWHElecHeatOnMode: VSCoilIndex = IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilIndex; IntegratedHeatPumps(DXCoilNum).TotalCoolingRate = 0.0; // total cooling rate [w] - IntegratedHeatPumps(DXCoilNum).TotalSpaceHeatingRate = VarSpeedCoil(VSCoilIndex).QLoadTotal; // total space heating rate [w] - IntegratedHeatPumps(DXCoilNum).TotalPower = VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] + IntegratedHeatPumps(DXCoilNum).TotalSpaceHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QLoadTotal; // total space heating rate [w] + IntegratedHeatPumps(DXCoilNum).TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).Power; // total power consumption [w] IntegratedHeatPumps(DXCoilNum).TotalLatentLoad = 0.0; // total latent cooling rate [w] - IntegratedHeatPumps(DXCoilNum).Qsource = VarSpeedCoil(VSCoilIndex).QSource; // source energy rate, [w] + IntegratedHeatPumps(DXCoilNum).Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QSource; // source energy rate, [w] VSCoilIndex = IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex; - IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = VarSpeedCoil(VSCoilIndex).QSource; // total water heating rate [w] + IntegratedHeatPumps(DXCoilNum).TotalWaterHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).QSource; // total water heating rate [w] break; case IHPOperationMode::IdleMode: @@ -2734,7 +2731,6 @@ namespace IntegratedHeatPump { int GetMaxSpeedNumIHP(EnergyPlusData &state, int const DXCoilNum) { using General::TrimSigDigits; - using VariableSpeedCoils::VarSpeedCoil; // Obtains and Allocates WatertoAirHP related parameters from input file if (GetCoilsInputFlag) { // First time subroutine has been entered @@ -2752,30 +2748,30 @@ namespace IntegratedHeatPump { switch (IntegratedHeatPumps(DXCoilNum).CurMode) { case IHPOperationMode::IdleMode: - SpeedNum = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCCoilIndex).NumOfSpeeds; + SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCCoilIndex).NumOfSpeeds; break; case IHPOperationMode::SCMode: - SpeedNum = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCCoilIndex).NumOfSpeeds; + SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCCoilIndex).NumOfSpeeds; break; case IHPOperationMode::SHMode: - SpeedNum = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHCoilIndex).NumOfSpeeds; + SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHCoilIndex).NumOfSpeeds; break; case IHPOperationMode::DWHMode: - SpeedNum = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).NumOfSpeeds; + SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).NumOfSpeeds; break; case IHPOperationMode::SCWHMatchSCMode: case IHPOperationMode::SCWHMatchWHMode: - SpeedNum = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).NumOfSpeeds; + SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).NumOfSpeeds; break; case IHPOperationMode::SCDWHMode: - SpeedNum = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).NumOfSpeeds; + SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).NumOfSpeeds; break; case IHPOperationMode::SHDWHElecHeatOffMode: case IHPOperationMode::SHDWHElecHeatOnMode: - SpeedNum = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilIndex).NumOfSpeeds; + SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilIndex).NumOfSpeeds; break; default: - SpeedNum = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCCoilIndex).NumOfSpeeds; + SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCCoilIndex).NumOfSpeeds; break; } @@ -2789,7 +2785,6 @@ namespace IntegratedHeatPump { ) { using General::TrimSigDigits; - using VariableSpeedCoils::VarSpeedCoil; int IHPCoilIndex(0); Real64 AirVolFlowRate(0.0); @@ -2839,7 +2834,7 @@ namespace IntegratedHeatPump { if (IsCallbyWH) // call from water loop { IsResultFlow = true; - AirVolFlowRate = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).AirVolFlowRate; + AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).AirVolFlowRate; } break; case IHPOperationMode::SCWHMatchWHMode: @@ -2847,7 +2842,7 @@ namespace IntegratedHeatPump { FlowScale = IntegratedHeatPumps(DXCoilNum).CoolVolFlowScale; if (!IsCallbyWH) { IsResultFlow = true; - AirVolFlowRate = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).AirVolFlowRate; + AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex).AirVolFlowRate; } break; case IHPOperationMode::SCDWHMode: @@ -2855,7 +2850,7 @@ namespace IntegratedHeatPump { FlowScale = IntegratedHeatPumps(DXCoilNum).CoolVolFlowScale; if (IsCallbyWH) { IsResultFlow = true; - AirVolFlowRate = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).AirVolFlowRate; + AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SCDWHCoolCoilIndex).AirVolFlowRate; } break; case IHPOperationMode::SHDWHElecHeatOffMode: @@ -2864,7 +2859,7 @@ namespace IntegratedHeatPump { FlowScale = IntegratedHeatPumps(DXCoilNum).HeatVolFlowScale; if (IsCallbyWH) { IsResultFlow = true; - AirVolFlowRate = VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilIndex).AirVolFlowRate; + AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).SHDWHHeatCoilIndex).AirVolFlowRate; } break; default: @@ -2875,10 +2870,10 @@ namespace IntegratedHeatPump { if (!IsResultFlow) { if (1 == SpeedNum) - AirVolFlowRate = VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(SpeedNum); + AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(SpeedNum); else - AirVolFlowRate = SpeedRatio * VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(SpeedNum) + - (1.0 - SpeedRatio) * VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(SpeedNum - 1); + AirVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(SpeedNum) + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(SpeedNum - 1); AirVolFlowRate = AirVolFlowRate * FlowScale; } @@ -2897,7 +2892,6 @@ namespace IntegratedHeatPump { ) { using General::TrimSigDigits; - using VariableSpeedCoils::VarSpeedCoil; int IHPCoilIndex(0); Real64 WaterVolFlowRate(0.0); @@ -2928,36 +2922,36 @@ namespace IntegratedHeatPump { case IHPOperationMode::DWHMode: IHPCoilIndex = IntegratedHeatPumps(DXCoilNum).DWHCoilIndex; if (1 == SpeedNum) - WaterVolFlowRate = VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum); + WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum); else - WaterVolFlowRate = SpeedRatio * VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) + - (1.0 - SpeedRatio) * VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1); + WaterVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1); break; case IHPOperationMode::SCWHMatchSCMode: case IHPOperationMode::SCWHMatchWHMode: IHPCoilIndex = IntegratedHeatPumps(DXCoilNum).SCWHCoilIndex; if (1 == SpeedNum) - WaterVolFlowRate = VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum); + WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum); else - WaterVolFlowRate = SpeedRatio * VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) + - (1.0 - SpeedRatio) * VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1); + WaterVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1); break; case IHPOperationMode::SCDWHMode: IHPCoilIndex = IntegratedHeatPumps(DXCoilNum).SCDWHWHCoilIndex; if (1 == SpeedNum) - WaterVolFlowRate = VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum); + WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum); else - WaterVolFlowRate = SpeedRatio * VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) + - (1.0 - SpeedRatio) * VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1); + WaterVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1); break; case IHPOperationMode::SHDWHElecHeatOffMode: case IHPOperationMode::SHDWHElecHeatOnMode: IHPCoilIndex = IntegratedHeatPumps(DXCoilNum).SHDWHWHCoilIndex; if (1 == SpeedNum) - WaterVolFlowRate = VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum); + WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum); else - WaterVolFlowRate = SpeedRatio * VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) + - (1.0 - SpeedRatio) * VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1); + WaterVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1); break; default: WaterVolFlowRate = 0.0; @@ -2974,7 +2968,6 @@ namespace IntegratedHeatPump { ) { using General::TrimSigDigits; - using VariableSpeedCoils::VarSpeedCoil; int IHPCoilIndex(0); Real64 AirMassFlowRate(0.0); @@ -3070,10 +3063,10 @@ namespace IntegratedHeatPump { if (!IsResultFlow) { if (SpeedNum == 1) { - AirMassFlowRate = VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(SpeedNum); + AirMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(SpeedNum); } else { - AirMassFlowRate = SpeedRatio * VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(SpeedNum) + - (1.0 - SpeedRatio) * VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(SpeedNum - 1); + AirMassFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(SpeedNum) + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(SpeedNum - 1); } AirMassFlowRate = AirMassFlowRate * FlowScale; diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index 97cfae5a4b0..da2fcfedf67 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -578,7 +578,7 @@ namespace LowTempRadiantSystem { } // Error checking for zones and construction information - thisRadSys.errorCheckZonesAndConstructions(ErrorsFound); + thisRadSys.errorCheckZonesAndConstructions(state, ErrorsFound); thisRadSys.FluidToSlabHeatTransfer = thisRadSys.getFluidToSlabHeatTransferInput(Alphas(5)); thisRadSys.TubeDiameterInner = Numbers(1); @@ -902,7 +902,7 @@ namespace LowTempRadiantSystem { } // Error checking for zones and construction information - thisCFloSys.errorCheckZonesAndConstructions(ErrorsFound); + thisCFloSys.errorCheckZonesAndConstructions(state, ErrorsFound); thisCFloSys.FluidToSlabHeatTransfer = thisCFloSys.getFluidToSlabHeatTransferInput(Alphas(5)); thisCFloSys.TubeDiameterInner = Numbers(1); @@ -1136,7 +1136,7 @@ namespace LowTempRadiantSystem { } // Error checking for zones and construction information - thisElecSys.errorCheckZonesAndConstructions(ErrorsFound); + thisElecSys.errorCheckZonesAndConstructions(state, ErrorsFound); // Heating user input data // Determine Low Temp Radiant heating design capacity sizing method @@ -1648,7 +1648,7 @@ namespace LowTempRadiantSystem { } } - void RadiantSystemBaseData::errorCheckZonesAndConstructions(bool &errorsFound) + void RadiantSystemBaseData::errorCheckZonesAndConstructions(EnergyPlusData &state, bool &errorsFound) { Real64 zoneMultipliers = 0.0; Real64 zoneMultipliersSurface = 0.0; @@ -1685,10 +1685,10 @@ namespace LowTempRadiantSystem { } // make sure that this construction is defined with a source/sink--this must be the case or it can't serve as a radiant system surface - if (!dataConstruction.Construct(Surface(this->SurfacePtr(SurfNum)).Construction).SourceSinkPresent) { + if (!state.dataConstruction->Construct(Surface(this->SurfacePtr(SurfNum)).Construction).SourceSinkPresent) { ShowSevereError("Construction referenced in Radiant System Surface does not have a source/sink present"); ShowContinueError("Surface name= " + Surface(this->SurfacePtr(SurfNum)).Name + - " Construction name = " + dataConstruction.Construct(Surface(this->SurfacePtr(SurfNum)).Construction).Name); + " Construction name = " + state.dataConstruction->Construct(Surface(this->SurfacePtr(SurfNum)).Construction).Name); ShowContinueError("Construction needs to be defined with a \"Construction:InternalSource\" object."); errorsFound = true; } @@ -2903,7 +2903,7 @@ namespace LowTempRadiantSystem { } } else { // Autosize or hard-size with sizing run // CheckZoneSizing is not required here because the tube length calculation is not dependent on zone sizing calculation results - TubeLengthDes = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + TubeLengthDes = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); if (IsAutoSize) { HydrRadSys(RadSysNum).TubeLength = TubeLengthDes; BaseSizer::reportSizerOutput(CompType, HydrRadSys(RadSysNum).Name, "Design Size Hydronic Tubing Length [m]", TubeLengthDes); @@ -3100,7 +3100,7 @@ namespace LowTempRadiantSystem { } } else { // Autosize or hard-size with sizing run // CheckZoneSizing is not required here because the tube length calculation is not dependent on zone sizing calculation results - TubeLengthDes = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + TubeLengthDes = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); if (IsAutoSize) { CFloRadSys(RadSysNum).TubeLength = TubeLengthDes; BaseSizer::reportSizerOutput("ZoneHVAC:LowTemperatureRadiant:ConstantFlow", @@ -3155,7 +3155,7 @@ namespace LowTempRadiantSystem { } } - Real64 HydronicSystemBaseData::sizeRadiantSystemTubeLength() + Real64 HydronicSystemBaseData::sizeRadiantSystemTubeLength(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -3175,7 +3175,7 @@ namespace LowTempRadiantSystem { for (int surfNum = 1; surfNum <= this->NumOfSurfaces; ++surfNum) { auto &thisHydrSysSurf(Surface(this->SurfacePtr(surfNum))); - auto &thisHydrSpacing(dataConstruction.Construct(thisHydrSysSurf.Construction).ThicknessPerpend); + auto &thisHydrSpacing(state.dataConstruction->Construct(thisHydrSysSurf.Construction).ThicknessPerpend); if ((thisHydrSpacing > 0.005) && (thisHydrSpacing < 0.5)) { // limit allowable spacing to between 1cm and 1m tubeLength += thisHydrSysSurf.Area / (2.0 * thisHydrSpacing); } else { // if not in allowable limit, default back to 0.15m (15cm or 6 inches) @@ -3546,9 +3546,9 @@ namespace LowTempRadiantSystem { Cf = RadSysToHBQsrcCoef(SurfNum); Cg = CTFTsrcConstPart(SurfNum); - Ch = dataConstruction.Construct(ConstrNum).CTFTSourceQ(0); - Ci = dataConstruction.Construct(ConstrNum).CTFTSourceIn(0); - Cj = dataConstruction.Construct(ConstrNum).CTFTSourceOut(0); + Ch = state.dataConstruction->Construct(ConstrNum).CTFTSourceQ(0); + Ci = state.dataConstruction->Construct(ConstrNum).CTFTSourceIn(0); + Cj = state.dataConstruction->Construct(ConstrNum).CTFTSourceOut(0); Ck = Cg + ((Ci * (Ca + Cb * Cd) + Cj * (Cd + Ce * Ca)) / (1.0 - Ce * Cb)); Cl = Ch + ((Ci * (Cc + Cb * Cf) + Cj * (Cf + Ce * Cc)) / (1.0 - Ce * Cb)); @@ -3758,9 +3758,9 @@ namespace LowTempRadiantSystem { Ce = RadSysToHBTinCoef(SurfNum); Cf = RadSysToHBQsrcCoef(SurfNum); Cg = CTFTsrcConstPart(SurfNum); - Ch = dataConstruction.Construct(ConstrNum).CTFTSourceQ(0); - Ci = dataConstruction.Construct(ConstrNum).CTFTSourceIn(0); - Cj = dataConstruction.Construct(ConstrNum).CTFTSourceOut(0); + Ch = state.dataConstruction->Construct(ConstrNum).CTFTSourceQ(0); + Ci = state.dataConstruction->Construct(ConstrNum).CTFTSourceIn(0); + Cj = state.dataConstruction->Construct(ConstrNum).CTFTSourceOut(0); Ck = Cg + ((Ci * (Ca + Cb * Cd) + Cj * (Cd + Ce * Ca)) / (1.0 - Ce * Cb)); Cl = Ch + ((Ci * (Cc + Cb * Cf) + Cj * (Cf + Ce * Cc)) / (1.0 - Ce * Cb)); QRadSysSource(SurfNum) = EpsMdotCp * (WaterTempIn - Ck) / (1.0 + (EpsMdotCp * Cl / Surface(SurfNum).Area)); @@ -4573,9 +4573,9 @@ namespace LowTempRadiantSystem { Cf = RadSysToHBQsrcCoef(SurfNum); Cg = CTFTsrcConstPart(SurfNum); - Ch = dataConstruction.Construct(ConstrNum).CTFTSourceQ(0); - Ci = dataConstruction.Construct(ConstrNum).CTFTSourceIn(0); - Cj = dataConstruction.Construct(ConstrNum).CTFTSourceOut(0); + Ch = state.dataConstruction->Construct(ConstrNum).CTFTSourceQ(0); + Ci = state.dataConstruction->Construct(ConstrNum).CTFTSourceIn(0); + Cj = state.dataConstruction->Construct(ConstrNum).CTFTSourceOut(0); Ck = Cg + ((Ci * (Ca + Cb * Cd) + Cj * (Cd + Ce * Ca)) / (1.0 - Ce * Cb)); Cl = Ch + ((Ci * (Cc + Cb * Cf) + Cj * (Cf + Ce * Cc)) / (1.0 - Ce * Cb)); @@ -5432,7 +5432,7 @@ namespace LowTempRadiantSystem { if (this->FluidToSlabHeatTransfer == FluidToSlabHeatTransferTypes::ISOStandard) { - Real64 U = this->calculateUFromISOStandard(SurfNum, WaterMassFlow * FlowFraction); + Real64 U = this->calculateUFromISOStandard(state, SurfNum, WaterMassFlow * FlowFraction); // Calculate the NTU parameter // NTU = UA/[(Mdot*Cp)min] @@ -5473,7 +5473,7 @@ namespace LowTempRadiantSystem { return calculateHXEffectivenessTerm; } - Real64 HydronicSystemBaseData::calculateUFromISOStandard(int const SurfNum, Real64 const WaterMassFlow) + Real64 HydronicSystemBaseData::calculateUFromISOStandard(EnergyPlusData &state, int const SurfNum, Real64 const WaterMassFlow) { // Calculates the U-value for a pipe embedded in a radiant system using the information // from ISO Standard 11855, Part 2 (2012): "Building environment design — Design, dimensioning, @@ -5489,7 +5489,7 @@ namespace LowTempRadiantSystem { int constructionNumber = DataSurfaces::Surface(SurfNum).Construction; // Fluid resistance to heat transfer, assumes turbulent flow (Equation B5, p. 38 of ISO Standard 11855-2) - Real64 distanceBetweenPipes = 2.0 * dataConstruction.Construct(constructionNumber).ThicknessPerpend; + Real64 distanceBetweenPipes = 2.0 * state.dataConstruction->Construct(constructionNumber).ThicknessPerpend; Real64 ratioDiameterToMassFlowLength = this->TubeDiameterInner / WaterMassFlow / this->TubeLength; Real64 rFluid = 0.125 / DataGlobals::Pi * std::pow(distanceBetweenPipes, 0.13) * std::pow(ratioDiameterToMassFlowLength,0.87); diff --git a/src/EnergyPlus/LowTempRadiantSystem.hh b/src/EnergyPlus/LowTempRadiantSystem.hh index 086d1055c4e..915d266c33e 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.hh +++ b/src/EnergyPlus/LowTempRadiantSystem.hh @@ -186,7 +186,7 @@ namespace LowTempRadiantSystem { std::string const& controlInputField ); - void errorCheckZonesAndConstructions(bool &errorsFound); + void errorCheckZonesAndConstructions(EnergyPlusData &state, bool &errorsFound); Real64 setRadiantSystemControlTemperature(); @@ -278,9 +278,9 @@ namespace LowTempRadiantSystem { Real64 const NumCircs // Number of fluid circuits in this surface ); - Real64 calculateUFromISOStandard(int const SurfNum, Real64 const WaterMassFlow); + Real64 calculateUFromISOStandard(EnergyPlusData &state, int const SurfNum, Real64 const WaterMassFlow); - Real64 sizeRadiantSystemTubeLength(); + Real64 sizeRadiantSystemTubeLength(EnergyPlusData &state); void checkForOutOfRangeTemperatureResult(Real64 const outletTemp, Real64 const inletTemp); diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.cc b/src/EnergyPlus/MoistureBalanceEMPDManager.cc index 76360532204..e12d84ef455 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.cc +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.cc @@ -290,7 +290,7 @@ namespace MoistureBalanceEMPDManager { continue; // Heat transfer surface only and not a window if (Surface(SurfNum).HeatTransferAlgorithm != HeatTransferModel_EMPD) continue; ConstrNum = Surface(SurfNum).Construction; - MatNum = dataConstruction.Construct(ConstrNum).LayerPoint(dataConstruction.Construct(ConstrNum).TotLayers); + MatNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataConstruction->Construct(ConstrNum).TotLayers); if (dataMaterial.Material(MatNum).EMPDmu > 0.0 && Surface(SurfNum).Zone > 0) { EMPDzone(Surface(SurfNum).Zone) = true; } else { @@ -302,25 +302,25 @@ namespace MoistureBalanceEMPDManager { if (DisplayExtraWarnings) { ShowMessage("GetMoistureBalanceEMPDInput: EMPD properties are not assigned to the inside layer in Surface=" + Surface(SurfNum).Name); - ShowContinueError("with Construction=" + dataConstruction.Construct(ConstrNum).Name); + ShowContinueError("with Construction=" + state.dataConstruction->Construct(ConstrNum).Name); } } - if (dataConstruction.Construct(ConstrNum).TotLayers == 1) { // One layer construction + if (state.dataConstruction->Construct(ConstrNum).TotLayers == 1) { // One layer construction continue; } else { // Multiple layer construction - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).EMPDMaterialProps && + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).EMPDMaterialProps && Surface(SurfNum).ExtBoundCond <= 0) { // The external layer is not exposed to zone ShowSevereError("GetMoistureBalanceEMPDInput: EMPD properties are assigned to the outside layer in Construction=" + - dataConstruction.Construct(ConstrNum).Name); - ShowContinueError("..Outside layer material with EMPD properties = " + dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Name); + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError("..Outside layer material with EMPD properties = " + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Name); ShowContinueError("..A material with EMPD properties must be assigned to the inside layer of a construction."); ErrorsFound = true; } - for (Layer = 2; Layer <= dataConstruction.Construct(ConstrNum).TotLayers - 1; ++Layer) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).EMPDMaterialProps) { + for (Layer = 2; Layer <= state.dataConstruction->Construct(ConstrNum).TotLayers - 1; ++Layer) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).EMPDMaterialProps) { ShowSevereError("GetMoistureBalanceEMPDInput: EMPD properties are assigned to a middle layer in Construction=" + - dataConstruction.Construct(ConstrNum).Name); - ShowContinueError("..Middle layer material with EMPD properties = " + dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(Layer)).Name); + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError("..Middle layer material with EMPD properties = " + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer)).Name); ShowContinueError("..A material with EMPD properties must be assigned to the inside layer of a construction."); ErrorsFound = true; } @@ -547,7 +547,7 @@ namespace MoistureBalanceEMPDManager { return; } ConstrNum = surface.Construction; - MatNum = dataConstruction.Construct(ConstrNum).LayerPoint(dataConstruction.Construct(ConstrNum).TotLayers); // Then find the material pointer + MatNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataConstruction->Construct(ConstrNum).TotLayers); // Then find the material pointer auto const &material(dataMaterial.Material(MatNum)); if (material.EMPDmu <= 0.0) { @@ -797,14 +797,14 @@ namespace MoistureBalanceEMPDManager { "Coating Thickness {m}\n"); for (ConstrNum = 1; ConstrNum <= TotConstructs; ++ConstrNum) { - if (dataConstruction.Construct(ConstrNum).TypeIsWindow) continue; - MatNum = dataConstruction.Construct(ConstrNum).LayerPoint(dataConstruction.Construct(ConstrNum).TotLayers); + if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) continue; + MatNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataConstruction->Construct(ConstrNum).TotLayers); if (dataMaterial.Material(MatNum).EMPDMaterialProps) { static constexpr auto Format_700( " Construction EMPD, {}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}, {:8.4F}\n"); print(state.files.eio, Format_700, - dataConstruction.Construct(ConstrNum).Name, + state.dataConstruction->Construct(ConstrNum).Name, dataMaterial.Material(MatNum).Name, dataMaterial.Material(MatNum).EMPDmu, dataMaterial.Material(MatNum).MoistACoeff, diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 8a54c8d38ed..f8af0519488 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -762,28 +762,6 @@ namespace OutputReportTabular { // loop and updates the arrays of data that will later being put // into the tabular reports. - // METHODOLOGY EMPLOYED: - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - if (t_timeStepType != OutputProcessor::TimeStepType::TimeStepZone && t_timeStepType != OutputProcessor::TimeStepType::TimeStepSystem) { ShowFatalError("Invalid reporting requested -- UpdateTabularReports"); } @@ -817,7 +795,7 @@ namespace OutputReportTabular { GatherBEPSResultsForTimestep(t_timeStepType); GatherSourceEnergyEndUseResultsForTimestep(t_timeStepType); GatherPeakDemandForTimestep(t_timeStepType); - GatherHeatGainReport(t_timeStepType); + GatherHeatGainReport(state, t_timeStepType); GatherHeatEmissionReport(state, t_timeStepType); } } @@ -4925,8 +4903,6 @@ namespace OutputReportTabular { using PackagedThermalStorageCoil::TESCoil; using RefrigeratedCase::Condenser; using RefrigeratedCase::RefrigRack; - using VariableSpeedCoils::NumVarSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; static int iOACtrl(0); static int iCoil(0); @@ -5019,18 +4995,18 @@ namespace OutputReportTabular { } } // VAV coils - air to air - for (iCoil = 1; iCoil <= NumVarSpeedCoils; ++iCoil) { - if (VarSpeedCoil(iCoil).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { - if (VarSpeedCoil(iCoil).CondenserType == AirCooled) { - SysTotalHVACRejectHeatLoss += VarSpeedCoil(iCoil).Energy + VarSpeedCoil(iCoil).CrankcaseHeaterConsumption + - VarSpeedCoil(iCoil).DefrostConsumption + VarSpeedCoil(iCoil).EnergyLoadTotal; - } else if (VarSpeedCoil(iCoil).CondenserType == EvapCooled) { - SysTotalHVACRejectHeatLoss += VarSpeedCoil(iCoil).EvapCondPumpElecConsumption + VarSpeedCoil(iCoil).BasinHeaterConsumption + - VarSpeedCoil(iCoil).EvapWaterConsump * RhoWater * H2OHtOfVap_HVAC; + for (iCoil = 1; iCoil <= state.dataVariableSpeedCoils->NumVarSpeedCoils; ++iCoil) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).CondenserType == AirCooled) { + SysTotalHVACRejectHeatLoss += state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).Energy + state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).CrankcaseHeaterConsumption + + state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).DefrostConsumption + state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).EnergyLoadTotal; + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).CondenserType == EvapCooled) { + SysTotalHVACRejectHeatLoss += state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).EvapCondPumpElecConsumption + state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).BasinHeaterConsumption + + state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).EvapWaterConsump * RhoWater * H2OHtOfVap_HVAC; } - } else if (VarSpeedCoil(iCoil).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) { - SysTotalHVACRejectHeatLoss += VarSpeedCoil(iCoil).Energy + VarSpeedCoil(iCoil).CrankcaseHeaterConsumption + - VarSpeedCoil(iCoil).DefrostConsumption - VarSpeedCoil(iCoil).EnergyLoadTotal; + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) { + SysTotalHVACRejectHeatLoss += state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).Energy + state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).CrankcaseHeaterConsumption + + state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).DefrostConsumption - state.dataVariableSpeedCoils->VarSpeedCoil(iCoil).EnergyLoadTotal; } } @@ -5098,7 +5074,7 @@ namespace OutputReportTabular { } } - void GatherHeatGainReport(OutputProcessor::TimeStepType t_timeStepType) // What kind of data to update (Zone, HVAC) + void GatherHeatGainReport(EnergyPlusData &state, OutputProcessor::TimeStepType t_timeStepType) // What kind of data to update (Zone, HVAC) { // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer @@ -5185,21 +5161,7 @@ namespace OutputReportTabular { using LowTempRadiantSystem::NumOfHydrLowTempRadSys; using OutputReportPredefined::pdrSensibleGain; using OutputReportPredefined::reportName; - using VentilatedSlab::NumOfVentSlabs; - using VentilatedSlab::VentSlab; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: static int iZone(0); static int iRadiant(0); static int iunit(0); @@ -5304,14 +5266,14 @@ namespace OutputReportTabular { curZone = 0; // HVAC Input Heated Surface Heating // HVAC Input Cooled Surface Cooling - for (iRadiant = 1; iRadiant <= NumOfVentSlabs; ++iRadiant) { - curZone = VentSlab(iRadiant).ZonePtr; + for (iRadiant = 1; iRadiant <= state.dataVentilatedSlab->NumOfVentSlabs; ++iRadiant) { + curZone = state.dataVentilatedSlab->VentSlab(iRadiant).ZonePtr; mult = Zone(curZone).Multiplier * Zone(curZone).ListMultiplier; if ((curZone > 0) && (curZone <= NumOfZones)) { - ZonePreDefRep(curZone).SHGSAnSurfHt += VentSlab(iRadiant).RadHeatingEnergy * mult; - ZonePreDefRep(curZone).SHGSAnSurfCl -= VentSlab(iRadiant).RadCoolingEnergy * mult; - radiantHeat(curZone) = VentSlab(iRadiant).RadHeatingPower * mult; - radiantCool(curZone) = -VentSlab(iRadiant).RadCoolingPower * mult; + ZonePreDefRep(curZone).SHGSAnSurfHt += state.dataVentilatedSlab->VentSlab(iRadiant).RadHeatingEnergy * mult; + ZonePreDefRep(curZone).SHGSAnSurfCl -= state.dataVentilatedSlab->VentSlab(iRadiant).RadCoolingEnergy * mult; + radiantHeat(curZone) = state.dataVentilatedSlab->VentSlab(iRadiant).RadHeatingPower * mult; + radiantCool(curZone) = -state.dataVentilatedSlab->VentSlab(iRadiant).RadCoolingPower * mult; } } for (iRadiant = 1; iRadiant <= NumOfHydrLowTempRadSys; ++iRadiant) { diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index bd64c995376..6ffc9847c79 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -779,7 +779,7 @@ namespace OutputReportTabular { void GatherPeakDemandForTimestep(OutputProcessor::TimeStepType t_timeStepType); // What kind of data to update (Zone, HVAC) - void GatherHeatGainReport(OutputProcessor::TimeStepType t_timeStepType); // What kind of data to update (Zone, HVAC) + void GatherHeatGainReport(EnergyPlusData &state, OutputProcessor::TimeStepType t_timeStepType); // What kind of data to update (Zone, HVAC) void GatherHeatEmissionReport(EnergyPlusData &state, OutputProcessor::TimeStepType t_timeStepType); diff --git a/src/EnergyPlus/OutputReports.cc b/src/EnergyPlus/OutputReports.cc index 744f7536bbf..478dc64c5e2 100644 --- a/src/EnergyPlus/OutputReports.cc +++ b/src/EnergyPlus/OutputReports.cc @@ -1480,7 +1480,7 @@ void DetailsForSurfaces(EnergyPlusData &state, int const RptType) // (1=Vertices // prescribed R-values for interior and exterior convection coefficients as found in ASHRAE 90.1-2004, Appendix A if (Surface(surf).Construction > 0 && Surface(surf).Construction <= TotConstructs) { cNominalUwithConvCoeffs = ""; - ConstructionName = dataConstruction.Construct(Surface(surf).Construction).Name; + ConstructionName = state.dataConstruction->Construct(Surface(surf).Construction).Name; { auto const SELECT_CASE_var(Surface(surf).Class); if (SELECT_CASE_var == SurfaceClass_Wall) { @@ -1811,7 +1811,7 @@ void CostInfoOut(EnergyPlusData &state) Format_801, surf, Surface(surf).Name, - dataConstruction.Construct(Surface(surf).Construction).Name, + state.dataConstruction->Construct(Surface(surf).Construction).Name, cSurfaceClass(Surface(surf).Class), Surface(surf).Area, Surface(surf).GrossArea); @@ -1931,7 +1931,7 @@ void VRMLOut(EnergyPlusData &state, const std::string &PolygonAction, const std: for (int surf : DataSurfaces::AllSurfaceListReportOrder) { if (Surface(surf).HeatTransSurf) continue; if (Surface(surf).Construction > 0) { - if (dataConstruction.Construct(Surface(surf).Construction).TypeIsAirBoundary) continue; + if (state.dataConstruction->Construct(Surface(surf).Construction).TypeIsAirBoundary) continue; } if (Surface(surf).Class == SurfaceClass_Shading) continue; if (Surface(surf).Sides == 0) continue; diff --git a/src/EnergyPlus/PackagedTerminalHeatPump.cc b/src/EnergyPlus/PackagedTerminalHeatPump.cc index db1eb4cdaa6..4fd8e55ea9d 100644 --- a/src/EnergyPlus/PackagedTerminalHeatPump.cc +++ b/src/EnergyPlus/PackagedTerminalHeatPump.cc @@ -149,7 +149,6 @@ namespace PackagedTerminalHeatPump { using DataGlobals::SysSizingCalc; using namespace DataHVACGlobals; using DXCoils::DXCoilPartLoadRatio; - using VariableSpeedCoils::MaxSpedLevels; // Use statements for access to subroutines in other modules using namespace ScheduleManager; @@ -3792,7 +3791,6 @@ namespace PackagedTerminalHeatPump { using PlantUtilities::ScanPlantLoopsForObject; using PlantUtilities::SetComponentFlowRate; using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; using WaterCoils::GetCoilMaxWaterFlowRate; using WaterCoils::SimulateWaterCoilComponents; @@ -4061,12 +4059,12 @@ namespace PackagedTerminalHeatPump { 0.0, 0.0, 0.0); // conduct the sizing operation in the VS WSHP - PTUnit(PTUnitNum).NumOfSpeedCooling = VarSpeedCoil(PTUnit(PTUnitNum).DXCoolCoilIndexNum).NumOfSpeeds; + PTUnit(PTUnitNum).NumOfSpeedCooling = state.dataVariableSpeedCoils->VarSpeedCoil(PTUnit(PTUnitNum).DXCoolCoilIndexNum).NumOfSpeeds; for (Iter = 1; Iter <= PTUnit(PTUnitNum).NumOfSpeedCooling; ++Iter) { PTUnit(PTUnitNum).MSCoolingSpeedRatio(Iter) = - VarSpeedCoil(PTUnit(PTUnitNum).DXCoolCoilIndexNum).MSRatedAirVolFlowRate(Iter) / - VarSpeedCoil(PTUnit(PTUnitNum).DXCoolCoilIndexNum).MSRatedAirVolFlowRate(PTUnit(PTUnitNum).NumOfSpeedCooling); + state.dataVariableSpeedCoils->VarSpeedCoil(PTUnit(PTUnitNum).DXCoolCoilIndexNum).MSRatedAirVolFlowRate(Iter) / + state.dataVariableSpeedCoils->VarSpeedCoil(PTUnit(PTUnitNum).DXCoolCoilIndexNum).MSRatedAirVolFlowRate(PTUnit(PTUnitNum).NumOfSpeedCooling); PTUnit(PTUnitNum).CoolVolumeFlowRate(Iter) = PTUnit(PTUnitNum).MaxCoolAirVolFlow * PTUnit(PTUnitNum).MSCoolingSpeedRatio(Iter); PTUnit(PTUnitNum).CoolMassFlowRate(Iter) = PTUnit(PTUnitNum).MaxCoolAirMassFlow * PTUnit(PTUnitNum).MSCoolingSpeedRatio(Iter); } @@ -4089,12 +4087,12 @@ namespace PackagedTerminalHeatPump { 0.0, 0.0); // conduct the sizing operation in the VS WSHP - PTUnit(PTUnitNum).NumOfSpeedHeating = VarSpeedCoil(PTUnit(PTUnitNum).DXHeatCoilIndexNum).NumOfSpeeds; + PTUnit(PTUnitNum).NumOfSpeedHeating = state.dataVariableSpeedCoils->VarSpeedCoil(PTUnit(PTUnitNum).DXHeatCoilIndexNum).NumOfSpeeds; for (Iter = 1; Iter <= PTUnit(PTUnitNum).NumOfSpeedHeating; ++Iter) { PTUnit(PTUnitNum).MSHeatingSpeedRatio(Iter) = - VarSpeedCoil(PTUnit(PTUnitNum).DXHeatCoilIndexNum).MSRatedAirVolFlowRate(Iter) / - VarSpeedCoil(PTUnit(PTUnitNum).DXHeatCoilIndexNum).MSRatedAirVolFlowRate(PTUnit(PTUnitNum).NumOfSpeedHeating); + state.dataVariableSpeedCoils->VarSpeedCoil(PTUnit(PTUnitNum).DXHeatCoilIndexNum).MSRatedAirVolFlowRate(Iter) / + state.dataVariableSpeedCoils->VarSpeedCoil(PTUnit(PTUnitNum).DXHeatCoilIndexNum).MSRatedAirVolFlowRate(PTUnit(PTUnitNum).NumOfSpeedHeating); PTUnit(PTUnitNum).HeatVolumeFlowRate(Iter) = PTUnit(PTUnitNum).MaxHeatAirVolFlow * PTUnit(PTUnitNum).MSHeatingSpeedRatio(Iter); PTUnit(PTUnitNum).HeatMassFlowRate(Iter) = PTUnit(PTUnitNum).MaxHeatAirMassFlow * PTUnit(PTUnitNum).MSHeatingSpeedRatio(Iter); @@ -8115,7 +8113,6 @@ namespace PackagedTerminalHeatPump { using SteamCoils::SimulateSteamCoilComponents; using TempSolveRoot::SolveRoot; using VariableSpeedCoils::SimVariableSpeedCoils; - using VariableSpeedCoils::VarSpeedCoil; using WaterCoils::SimulateWaterCoilComponents; using WaterToAirHeatPumpSimple::SimWatertoAirHPSimple; diff --git a/src/EnergyPlus/PackagedTerminalHeatPump.hh b/src/EnergyPlus/PackagedTerminalHeatPump.hh index 87981c1f833..cdab3260fbf 100644 --- a/src/EnergyPlus/PackagedTerminalHeatPump.hh +++ b/src/EnergyPlus/PackagedTerminalHeatPump.hh @@ -64,9 +64,6 @@ struct EnergyPlusData; namespace PackagedTerminalHeatPump { - // Using/Aliasing - using VariableSpeedCoils::MaxSpedLevels; - // Data // MODULE PARAMETER DEFINITIONS // Compressor operation @@ -119,6 +116,7 @@ namespace PackagedTerminalHeatPump { struct PTUnitData { + int MaxSpedLevels = 10; // Members // input data int UnitType_Num; // paramter equivalent to type of unit diff --git a/src/EnergyPlus/Photovoltaics.cc b/src/EnergyPlus/Photovoltaics.cc index 1d2d52af79e..e2444755767 100644 --- a/src/EnergyPlus/Photovoltaics.cc +++ b/src/EnergyPlus/Photovoltaics.cc @@ -747,7 +747,7 @@ namespace Photovoltaics { if (!Surface(PVarray(PVnum).SurfacePtr).HeatTransSurf) { ShowSevereError("Must use a surface with heat transfer for IntegratedSurfaceOutsideFace mode in " + PVarray(PVnum).Name); ErrorsFound = true; - } else if (!dataConstruction.Construct(Surface(PVarray(PVnum).SurfacePtr).Construction).SourceSinkPresent) { + } else if (!state.dataConstruction->Construct(Surface(PVarray(PVnum).SurfacePtr).Construction).SourceSinkPresent) { ShowSevereError("Must use a surface with internal source construction for IntegratedSurfaceOutsideFace mode in " + PVarray(PVnum).Name); ErrorsFound = true; diff --git a/src/EnergyPlus/PipeHeatTransfer.cc b/src/EnergyPlus/PipeHeatTransfer.cc index 2791438bb83..cc879e805a8 100644 --- a/src/EnergyPlus/PipeHeatTransfer.cc +++ b/src/EnergyPlus/PipeHeatTransfer.cc @@ -327,7 +327,7 @@ namespace PipeHeatTransfer { // General user input data PipeHT(Item).Construction = cAlphaArgs(2); - PipeHT(Item).ConstructionNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct); + PipeHT(Item).ConstructionNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); if (PipeHT(Item).ConstructionNum == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(2) + '=' + cAlphaArgs(2)); @@ -419,7 +419,7 @@ namespace PipeHeatTransfer { if (PipeHT(Item).ConstructionNum != 0) { PipeHT(Item).ValidatePipeConstruction( - cCurrentModuleObject, cAlphaArgs(2), cAlphaFieldNames(2), PipeHT(Item).ConstructionNum, ErrorsFound); + state, cCurrentModuleObject, cAlphaArgs(2), cAlphaFieldNames(2), PipeHT(Item).ConstructionNum, ErrorsFound); } } // end of input loop @@ -447,7 +447,7 @@ namespace PipeHeatTransfer { // General user input data PipeHT(Item).Construction = cAlphaArgs(2); - PipeHT(Item).ConstructionNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct); + PipeHT(Item).ConstructionNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); if (PipeHT(Item).ConstructionNum == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(2) + '=' + cAlphaArgs(2)); @@ -523,7 +523,7 @@ namespace PipeHeatTransfer { if (PipeHT(Item).ConstructionNum != 0) { PipeHT(Item).ValidatePipeConstruction( - cCurrentModuleObject, cAlphaArgs(2), cAlphaFieldNames(2), PipeHT(Item).ConstructionNum, ErrorsFound); + state, cCurrentModuleObject, cAlphaArgs(2), cAlphaFieldNames(2), PipeHT(Item).ConstructionNum, ErrorsFound); } } // end of input loop @@ -552,7 +552,7 @@ namespace PipeHeatTransfer { // General user input data PipeHT(Item).Construction = cAlphaArgs(2); - PipeHT(Item).ConstructionNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct); + PipeHT(Item).ConstructionNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); if (PipeHT(Item).ConstructionNum == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(2) + '=' + cAlphaArgs(2)); @@ -644,7 +644,7 @@ namespace PipeHeatTransfer { if (PipeHT(Item).ConstructionNum != 0) { PipeHT(Item).ValidatePipeConstruction( - cCurrentModuleObject, cAlphaArgs(2), cAlphaFieldNames(2), PipeHT(Item).ConstructionNum, ErrorsFound); + state, cCurrentModuleObject, cAlphaArgs(2), cAlphaFieldNames(2), PipeHT(Item).ConstructionNum, ErrorsFound); } // Get ground temperature model @@ -729,7 +729,8 @@ namespace PipeHeatTransfer { } } - void PipeHTData::ValidatePipeConstruction(std::string const &PipeType, // module object of pipe (error messages) + void PipeHTData::ValidatePipeConstruction(EnergyPlusData &state, + std::string const &PipeType, // module object of pipe (error messages) std::string const &ConstructionName, // construction name of pipe (error messages) std::string const &FieldName, // fieldname of pipe (error messages) int const ConstructionNum, // pointer into construction data @@ -779,31 +780,31 @@ namespace PipeHeatTransfer { TotThickness = 0.0; // CTF stuff - TotalLayers = dataConstruction.Construct(ConstructionNum).TotLayers; + TotalLayers = state.dataConstruction->Construct(ConstructionNum).TotLayers; // get pipe properties if (TotalLayers == 1) { // no insulation layer - this->PipeConductivity = dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(1)).Conductivity; - this->PipeDensity = dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(1)).Density; - this->PipeCp = dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(1)).SpecHeat; - this->PipeOD = this->PipeID + 2.0 * dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(1)).Thickness; + this->PipeConductivity = dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1)).Conductivity; + this->PipeDensity = dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1)).Density; + this->PipeCp = dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1)).SpecHeat; + this->PipeOD = this->PipeID + 2.0 * dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1)).Thickness; this->InsulationOD = this->PipeOD; this->SumTK = - dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(1)).Thickness / dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(1)).Conductivity; + dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1)).Thickness / dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1)).Conductivity; } else if (TotalLayers >= 2) { // first layers are insulation, last layer is pipe for (LayerNum = 1; LayerNum <= TotalLayers - 1; ++LayerNum) { - Resistance += dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness / - dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).Conductivity; - Density = dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).Density * - dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness; - TotThickness += dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness; - SpHeat = dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).SpecHeat * - dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness; - this->InsulationThickness = dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness; - this->SumTK += dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness / - dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(LayerNum)).Conductivity; + Resistance += dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness / + dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).Conductivity; + Density = dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).Density * + dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness; + TotThickness += dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness; + SpHeat = dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).SpecHeat * + dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness; + this->InsulationThickness = dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness; + this->SumTK += dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).Thickness / + dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)).Conductivity; } this->InsulationResistance = Resistance; @@ -812,11 +813,11 @@ namespace PipeHeatTransfer { this->InsulationCp = SpHeat / TotThickness; this->InsulationThickness = TotThickness; - this->PipeConductivity = dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(TotalLayers)).Conductivity; - this->PipeDensity = dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(TotalLayers)).Density; - this->PipeCp = dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(TotalLayers)).SpecHeat; + this->PipeConductivity = dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(TotalLayers)).Conductivity; + this->PipeDensity = dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(TotalLayers)).Density; + this->PipeCp = dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(TotalLayers)).SpecHeat; - this->PipeOD = this->PipeID + 2.0 * dataMaterial.Material(dataConstruction.Construct(ConstructionNum).LayerPoint(TotalLayers)).Thickness; + this->PipeOD = this->PipeID + 2.0 * dataMaterial.Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(TotalLayers)).Thickness; this->InsulationOD = this->PipeOD + 2.0 * this->InsulationThickness; } else { diff --git a/src/EnergyPlus/PipeHeatTransfer.hh b/src/EnergyPlus/PipeHeatTransfer.hh index 08b5a2d9188..1717707171e 100644 --- a/src/EnergyPlus/PipeHeatTransfer.hh +++ b/src/EnergyPlus/PipeHeatTransfer.hh @@ -270,7 +270,8 @@ namespace PipeHeatTransfer { void UpdatePipesHeatTransfer(); - void ValidatePipeConstruction(std::string const &PipeType, // module object of pipe (error messages) + void ValidatePipeConstruction(EnergyPlusData &state, + std::string const &PipeType, // module object of pipe (error messages) std::string const &ConstructionName, // construction name of pipe (error messages) std::string const &FieldName, // fieldname of pipe (error messages) int const ConstructionNum, // pointer into construction data diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 4792486fb55..3093b7a6eca 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -2980,7 +2980,7 @@ namespace RuntimeLanguageProcessor { continue; } - ConstructNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct); + ConstructNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); if (ConstructNum == 0) { if (lAlphaFieldBlanks(2)) { diff --git a/src/EnergyPlus/SQLiteProcedures.cc b/src/EnergyPlus/SQLiteProcedures.cc index 615261032ce..041dd2ce70f 100644 --- a/src/EnergyPlus/SQLiteProcedures.cc +++ b/src/EnergyPlus/SQLiteProcedures.cc @@ -155,7 +155,7 @@ void CreateSQLiteZoneExtendedOutput(EnergyPlusData &state) sqlite->addMaterialData(materialNum, dataMaterial.Material(materialNum)); } for (int constructNum = 1; constructNum <= DataHeatBalance::TotConstructs; ++constructNum) { - auto const &construction = dataConstruction.Construct(constructNum); + auto const &construction = state.dataConstruction->Construct(constructNum); if (construction.TotGlassLayers == 0) { sqlite->addConstructionData(constructNum, construction, construction.UValue); } else { diff --git a/src/EnergyPlus/SolarReflectionManager.cc b/src/EnergyPlus/SolarReflectionManager.cc index 7ee9dffcca5..cca676cc659 100644 --- a/src/EnergyPlus/SolarReflectionManager.cc +++ b/src/EnergyPlus/SolarReflectionManager.cc @@ -54,6 +54,7 @@ // EnergyPlus Headers #include +#include #include #include #include @@ -113,7 +114,7 @@ namespace SolarReflectionManager { // Functions - void InitSolReflRecSurf() + void InitSolReflRecSurf(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -521,9 +522,9 @@ namespace SolarReflectionManager { ObsConstrNum = Surface(NearestHitSurfNum).Construction; if (ObsConstrNum > 0) { // Exterior building surface is nearest hit - if (!dataConstruction.Construct(ObsConstrNum).TypeIsWindow) { + if (!state.dataConstruction->Construct(ObsConstrNum).TypeIsWindow) { // Obstruction is not a window, i.e., is an opaque surface - SolReflRecSurf(RecSurfNum).HitPtSolRefl(RayNum, RecPtNum) = 1.0 - dataConstruction.Construct(ObsConstrNum).OutsideAbsorpSolar; + SolReflRecSurf(RecSurfNum).HitPtSolRefl(RayNum, RecPtNum) = 1.0 - state.dataConstruction->Construct(ObsConstrNum).OutsideAbsorpSolar; } else { // Obstruction is a window. Assume it is bare so that there is no beam-to-diffuse reflection // (beam-to-beam reflection is calculated in subroutine CalcBeamSolSpecularReflFactors). @@ -838,7 +839,7 @@ namespace SolarReflectionManager { //================================================================================================= - void CalcBeamSolSpecularReflFactors() + void CalcBeamSolSpecularReflFactors(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -879,16 +880,16 @@ namespace SolarReflectionManager { ReflFacBmToBmSolObs = 0.0; CosIncAveBmToBmSolObs = 0.0; for (IHr = 1; IHr <= 24; ++IHr) { - FigureBeamSolSpecularReflFactors(IHr); + FigureBeamSolSpecularReflFactors(state, IHr); } // End of IHr loop } else { // timestep integrated solar, use current hour of day ReflFacBmToBmSolObs(HourOfDay, {1, TotSurfaces}) = 0.0; CosIncAveBmToBmSolObs(HourOfDay, {1, TotSurfaces}) = 0.0; - FigureBeamSolSpecularReflFactors(HourOfDay); + FigureBeamSolSpecularReflFactors(state, HourOfDay); } } - void FigureBeamSolSpecularReflFactors(int const iHour) + void FigureBeamSolSpecularReflFactors(EnergyPlusData &state, int const iHour) { // SUBROUTINE INFORMATION: @@ -1046,12 +1047,12 @@ namespace SolarReflectionManager { SpecReflectance = 0.0; if (Surface(ReflSurfNum).Class == SurfaceClass_Window) { ConstrNumRefl = Surface(ReflSurfNum).Construction; - SpecReflectance = POLYF(std::abs(CosIncAngRefl), dataConstruction.Construct(ConstrNumRefl).ReflSolBeamFrontCoef); + SpecReflectance = POLYF(std::abs(CosIncAngRefl), state.dataConstruction->Construct(ConstrNumRefl).ReflSolBeamFrontCoef); } if (Surface(ReflSurfNum).ShadowingSurf && Surface(ReflSurfNum).ShadowSurfGlazingConstruct > 0) { ConstrNumRefl = Surface(ReflSurfNum).ShadowSurfGlazingConstruct; SpecReflectance = Surface(ReflSurfNum).ShadowSurfGlazingFrac * - POLYF(std::abs(CosIncAngRefl), dataConstruction.Construct(ConstrNumRefl).ReflSolBeamFrontCoef); + POLYF(std::abs(CosIncAngRefl), state.dataConstruction->Construct(ConstrNumRefl).ReflSolBeamFrontCoef); } // Angle of incidence of reflected beam on receiving surface CosIncAngRec = dot(SolReflRecSurf(RecSurfNum).NormVec, SunVecMir); diff --git a/src/EnergyPlus/SolarReflectionManager.hh b/src/EnergyPlus/SolarReflectionManager.hh index 7704fee0b83..be9c853c6e7 100644 --- a/src/EnergyPlus/SolarReflectionManager.hh +++ b/src/EnergyPlus/SolarReflectionManager.hh @@ -60,6 +60,9 @@ namespace EnergyPlus { +// Forward declarations +struct EnergyPlusData; + namespace SolarReflectionManager { // Using/Aliasing @@ -115,7 +118,7 @@ namespace SolarReflectionManager { // Functions - void InitSolReflRecSurf(); + void InitSolReflRecSurf(EnergyPlusData &state); //===================================================================================================== @@ -125,9 +128,9 @@ namespace SolarReflectionManager { //================================================================================================= - void CalcBeamSolSpecularReflFactors(); + void CalcBeamSolSpecularReflFactors(EnergyPlusData &state); - void FigureBeamSolSpecularReflFactors(int const iHour); + void FigureBeamSolSpecularReflFactors(EnergyPlusData &state, int const iHour); //================================================================================================= diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index f27f878d615..35fde4ce6ec 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -432,19 +432,19 @@ namespace SolarShading { if (SolarDistribution != FullInteriorExterior) { if (firstTime) DisplayString("Computing Interior Solar Absorption Factors"); - ComputeIntSolarAbsorpFactors(); + ComputeIntSolarAbsorpFactors(state); } if (firstTime) DisplayString("Determining Shadowing Combinations"); - DetermineShadowingCombinations(); + DetermineShadowingCombinations(state); shd_stream.reset(); // Done writing to shd file if (firstTime) DisplayString("Computing Window Shade Absorption Factors"); - ComputeWinShadeAbsorpFactors(); + ComputeWinShadeAbsorpFactors(state); if (CalcSolRefl) { DisplayString("Initializing Solar Reflection Factors"); - InitSolReflRecSurf(); + InitSolReflRecSurf(state); } if (firstTime) DisplayString("Proceeding with Initializing Solar Calculations"); @@ -1413,13 +1413,13 @@ namespace SolarShading { "Average", Surface(SurfLoop).Name); - if (dataConstruction.Construct(Surface(SurfLoop).Construction).WindowTypeBSDF) { - NumOfLayers = dataConstruction.Construct(Surface(SurfLoop).Construction).TotSolidLayers; + if (state.dataConstruction->Construct(Surface(SurfLoop).Construction).WindowTypeBSDF) { + NumOfLayers = state.dataConstruction->Construct(Surface(SurfLoop).Construction).TotSolidLayers; } else { - NumOfLayers = dataConstruction.Construct(Surface(SurfLoop).Construction).TotLayers; + NumOfLayers = state.dataConstruction->Construct(Surface(SurfLoop).Construction).TotLayers; } for (I = 1; I <= NumOfLayers; ++I) { - if (dataConstruction.Construct(Surface(SurfLoop).Construction).WindowTypeBSDF) { + if (state.dataConstruction->Construct(Surface(SurfLoop).Construction).WindowTypeBSDF) { SetupOutputVariable(state, "Surface Window Total Absorbed Shortwave Radiation Rate Layer " + RoundSigDigits(I) + "", OutputProcessor::Unit::W, SurfWinQRadSWwinAbsLayer(I, SurfLoop), @@ -1427,7 +1427,7 @@ namespace SolarShading { "Average", Surface(SurfLoop).Name); } - if (dataConstruction.Construct(Surface(SurfLoop).Construction).WindowTypeBSDF || (I == 1)) { + if (state.dataConstruction->Construct(Surface(SurfLoop).Construction).WindowTypeBSDF || (I == 1)) { SetupOutputVariable(state, "Surface Window Front Face Temperature Layer " + RoundSigDigits(I) + "", OutputProcessor::Unit::C, SurfWinFenLaySurfTempFront(I, SurfLoop), @@ -1435,7 +1435,7 @@ namespace SolarShading { "Average", Surface(SurfLoop).Name); } - if (dataConstruction.Construct(Surface(SurfLoop).Construction).WindowTypeBSDF || (I == NumOfLayers)) { + if (state.dataConstruction->Construct(Surface(SurfLoop).Construction).WindowTypeBSDF || (I == NumOfLayers)) { SetupOutputVariable(state, "Surface Window Back Face Temperature Layer " + RoundSigDigits(I) + "", OutputProcessor::Unit::C, SurfWinFenLaySurfTempBack(I, SurfLoop), @@ -1553,7 +1553,7 @@ namespace SolarShading { "Zone", "Average", Surface(SurfLoop).Name); - if (dataConstruction.Construct(Surface(SurfLoop).Construction).WindowTypeEQL) { + if (state.dataConstruction->Construct(Surface(SurfLoop).Construction).WindowTypeEQL) { SetupOutputVariable(state, "Surface Window Inside Face Other Convection Heat Gain Rate", OutputProcessor::Unit::W, SurfWinOtherConvGainInsideFaceToZoneRep(SurfLoop), @@ -1565,7 +1565,7 @@ namespace SolarShading { // Added TH 12/23/2008 for thermochromic windows // CurrentModuleObject='Thermochromic Windows' - if (dataConstruction.Construct(Surface(SurfLoop).Construction).TCFlag == 1) { + if (state.dataConstruction->Construct(Surface(SurfLoop).Construction).TCFlag == 1) { SetupOutputVariable(state, "Surface Window Thermochromic Layer Temperature", OutputProcessor::Unit::C, SurfWinTCLayerTemp(SurfLoop), @@ -3137,7 +3137,7 @@ namespace SolarShading { return inside; } - void ComputeIntSolarAbsorpFactors() + void ComputeIntSolarAbsorpFactors(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -3207,19 +3207,19 @@ namespace SolarShading { int ConstrNum = Surface(SurfNum).Construction; // last minute V3.1 - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface - if (AreaSum > 0.0) ISABSF(SurfNum) = Surface(SurfNum).Area * dataConstruction.Construct(ConstrNum).InsideAbsorpSolar / AreaSum; + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface + if (AreaSum > 0.0) ISABSF(SurfNum) = Surface(SurfNum).Area * state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar / AreaSum; } else { // Window (floor windows are assumed to have no shading device and no divider, // and assumed to be non-switchable) if (SurfWinStormWinFlag(SurfNum) == 1) ConstrNum = Surface(SurfNum).StormWinConstruction; AbsDiffTotWin = 0.0; - if (!dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) { - for (Lay = 1; Lay <= dataConstruction.Construct(ConstrNum).TotGlassLayers; ++Lay) { - AbsDiffTotWin += dataConstruction.Construct(ConstrNum).AbsDiffBack(Lay); + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) { + for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotGlassLayers; ++Lay) { + AbsDiffTotWin += state.dataConstruction->Construct(ConstrNum).AbsDiffBack(Lay); } } else { - for (Lay = 1; Lay <= CFS(dataConstruction.Construct(ConstrNum).EQLConsPtr).NL; ++Lay) { - AbsDiffTotWin += dataConstruction.Construct(ConstrNum).AbsDiffBackEQL(Lay); + for (Lay = 1; Lay <= CFS(state.dataConstruction->Construct(ConstrNum).EQLConsPtr).NL; ++Lay) { + AbsDiffTotWin += state.dataConstruction->Construct(ConstrNum).AbsDiffBackEQL(Lay); } } if (AreaSum > 0.0) ISABSF(SurfNum) = Surface(SurfNum).Area * AbsDiffTotWin / AreaSum; @@ -3251,19 +3251,19 @@ namespace SolarShading { for (int const SurfNum : thisEnclosure.SurfacePtr) { int ConstrNum = Surface(SurfNum).Construction; - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface - if (AreaSum > 0.0) ISABSF(SurfNum) = Surface(SurfNum).Area * dataConstruction.Construct(ConstrNum).InsideAbsorpSolar / AreaSum; + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Opaque surface + if (AreaSum > 0.0) ISABSF(SurfNum) = Surface(SurfNum).Area * state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar / AreaSum; } else { // Window (floor windows are assumed to have no shading device and no divider, // and assumed to be non-switchable) if (SurfWinStormWinFlag(SurfNum) == 1) ConstrNum = Surface(SurfNum).StormWinConstruction; AbsDiffTotWin = 0.0; - if (!dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) { - for (Lay = 1; Lay <= dataConstruction.Construct(ConstrNum).TotGlassLayers; ++Lay) { - AbsDiffTotWin += dataConstruction.Construct(ConstrNum).AbsDiffBack(Lay); + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) { + for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotGlassLayers; ++Lay) { + AbsDiffTotWin += state.dataConstruction->Construct(ConstrNum).AbsDiffBack(Lay); } } else { - for (Lay = 1; Lay <= CFS(dataConstruction.Construct(ConstrNum).EQLConsPtr).NL; ++Lay) { - AbsDiffTotWin += dataConstruction.Construct(ConstrNum).AbsDiffBackEQL(Lay); + for (Lay = 1; Lay <= CFS(state.dataConstruction->Construct(ConstrNum).EQLConsPtr).NL; ++Lay) { + AbsDiffTotWin += state.dataConstruction->Construct(ConstrNum).AbsDiffBackEQL(Lay); } } @@ -5247,7 +5247,7 @@ namespace SolarShading { } } - void DetermineShadowingCombinations() + void DetermineShadowingCombinations(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -5525,7 +5525,7 @@ namespace SolarShading { if (SBSNR == GRSNR) continue; // Surface itself cannot be its own subsurface if (Surface(SBSNR).BaseSurf != GRSNR) continue; // Ignore subsurfaces of other surfaces and other surfaces - if (dataConstruction.Construct(Surface(SBSNR).Construction).TransDiff > 0.0) HasWindow = true; // Check for window + if (state.dataConstruction->Construct(Surface(SBSNR).Construction).TransDiff > 0.0) HasWindow = true; // Check for window CHKSBS(HTS, GRSNR, SBSNR); // Check that the receiving surface completely encloses the subsurface; // severe error if not ++NSBS; @@ -5800,7 +5800,7 @@ namespace SolarShading { if (CTHETA(GRSNR) < SunIsUpValue) { //.001) THEN ! Receiving surface is not in the sun SAREA(HTS) = 0.0; - SHDSBS(iHour, GRSNR, NBKS, NSBS, HTS, TS); + SHDSBS(state, iHour, GRSNR, NBKS, NSBS, HTS, TS); } else if ((NGSS <= 0) && (NSBS <= 0)) { // Simple surface--no shaders or subsurfaces @@ -5867,7 +5867,7 @@ namespace SolarShading { } } - SHDSBS(iHour, GRSNR, NBKS, NSBS, HTS, TS); // Subtract subsurf areas from total + SHDSBS(state, iHour, GRSNR, NBKS, NSBS, HTS, TS); // Subtract subsurf areas from total // Error checking: require that 0 <= SAREA <= AREA. + or - .01*AREA added for round-off errors SurfArea = Surface(GRSNR).NetAreaShadowCalc; @@ -6897,8 +6897,8 @@ namespace SolarShading { // EXTERIOR BEAM SOLAR RADIATION ABSORBED ON THE OUTSIDE OF OPAQUE SURFACES //------------------------------------------------------------------------- - if (SunLitFract > 0.0 && dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { - AOSurf(SurfNum) = dataConstruction.Construct(ConstrNum).OutsideAbsorpSolar * CosInc * SunLitFract; + if (SunLitFract > 0.0 && state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { + AOSurf(SurfNum) = state.dataConstruction->Construct(ConstrNum).OutsideAbsorpSolar * CosInc * SunLitFract; // Note: movable insulation, if present, is accounted for in subr. InitIntSolarDistribution, // where QRadSWOutMvIns is calculated from QRadSWOutAbs and insulation solar absorptance @@ -6929,20 +6929,20 @@ namespace SolarShading { // is an interior or between-glass shade/blind the effects of beam incident on // inside reveal surfaces is ignored. - NGlass = dataConstruction.Construct(ConstrNum).TotGlassLayers; + NGlass = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; for (Lay = 1; Lay <= NGlass; ++Lay) { - AbWin = POLYF(CosInc, dataConstruction.Construct(ConstrNum).AbsBeamCoef({1, 6}, Lay)) * CosInc * SunLitFract * + AbWin = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).AbsBeamCoef({1, 6}, Lay)) * CosInc * SunLitFract * SurfaceWindow(SurfNum).OutProjSLFracMult(HourOfDay); - ADiffWin = dataConstruction.Construct(ConstrNum).AbsDiff(Lay); + ADiffWin = state.dataConstruction->Construct(ConstrNum).AbsDiff(Lay); if (ShadeFlag <= 0 || ShadeFlag >= 10) { // Bare window (ShadeFlag = -1 or 0 or shading device of off) // Add contribution of beam reflected from outside and inside reveal AWinSurf(Lay, SurfNum) = AbWin + - SurfWinOutsRevealDiffOntoGlazing(SurfNum) * dataConstruction.Construct(ConstrNum).AbsDiff(Lay) + - SurfWinInsRevealDiffOntoGlazing(SurfNum) * dataConstruction.Construct(ConstrNum).AbsDiffBack(Lay); + SurfWinOutsRevealDiffOntoGlazing(SurfNum) * state.dataConstruction->Construct(ConstrNum).AbsDiff(Lay) + + SurfWinInsRevealDiffOntoGlazing(SurfNum) * state.dataConstruction->Construct(ConstrNum).AbsDiffBack(Lay); } else { @@ -6954,9 +6954,9 @@ namespace SolarShading { // Shade or switchable glazing on - AbWinSh = POLYF(CosInc, dataConstruction.Construct(ConstrNumSh).AbsBeamCoef({1, 6}, Lay)) * CosInc * FracSunLit; + AbWinSh = POLYF(CosInc, state.dataConstruction->Construct(ConstrNumSh).AbsBeamCoef({1, 6}, Lay)) * CosInc * FracSunLit; - ADiffWinSh = dataConstruction.Construct(ConstrNumSh).AbsDiff(Lay); + ADiffWinSh = state.dataConstruction->Construct(ConstrNumSh).AbsDiff(Lay); } else { // Blind or screen on @@ -6967,14 +6967,14 @@ namespace SolarShading { // Interior blind on if (Lay == 1) { - TGlBm = POLYF(CosInc, dataConstruction.Construct(ConstrNum).TransSolBeamCoef); - RGlDiffBack = dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; + TGlBm = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); + RGlDiffBack = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; RhoBlFront = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamDiffRefl); RhoBlDiffFront = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolFrontDiffDiffRefl); } - AGlDiffBack = dataConstruction.Construct(ConstrNum).AbsDiffBack(Lay); + AGlDiffBack = state.dataConstruction->Construct(ConstrNum).AbsDiffBack(Lay); AbWinSh = AbWin + (TGlBm * AGlDiffBack * RhoBlFront / (1.0 - RhoBlFront * RGlDiffBack)) * CosInc * FracSunLit; - ADiffWinSh = ADiffWin + dataConstruction.Construct(ConstrNum).TransDiff * AGlDiffBack * RhoBlDiffFront / + ADiffWinSh = ADiffWin + state.dataConstruction->Construct(ConstrNum).TransDiff * AGlDiffBack * RhoBlDiffFront / (1.0 - RhoBlDiffFront * RGlDiffBack); } else if (ShadeFlag == ExtBlindOn) { @@ -6985,13 +6985,13 @@ namespace SolarShading { TBlBmDiff = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamDiffTrans); RhoBlBack = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolBackBeamDiffRefl); RhoBlDiffBack = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolBackDiffDiffRefl); - RGlFront = POLYF(CosInc, dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef); - RGlDiffFront = dataConstruction.Construct(ConstrNum).ReflectSolDiffFront; + RGlFront = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef); + RGlDiffFront = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront; TBlDifDif = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolFrontDiffDiffTrans); - RGlDifFr = dataConstruction.Construct(ConstrNum).ReflectSolDiffFront; + RGlDifFr = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront; RhoBlDifDifBk = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolBackDiffDiffRefl); } - AGlDiffFront = dataConstruction.Construct(ConstrNum).AbsDiff(Lay); + AGlDiffFront = state.dataConstruction->Construct(ConstrNum).AbsDiff(Lay); AbWinSh = TBlBmBm * AbWin + ((TBlBmBm * RGlFront * RhoBlBack + TBlBmDiff) * AGlDiffFront / (1 - RGlDiffFront * RhoBlDiffBack)) * CosInc * FracSunLit; @@ -7007,16 +7007,16 @@ namespace SolarShading { TScBmDiff = SurfaceScreens(ScNum).BmDifTrans; RScBack = SurfaceScreens(ScNum).ReflectSolBeamFront; RScDifBack = SurfaceScreens(ScNum).DifReflect; - RGlFront = POLYF(CosInc, dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef); - RGlDiffFront = dataConstruction.Construct(ConstrNum).ReflectSolDiffFront; + RGlFront = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef); + RGlDiffFront = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront; TScDifDif = SurfaceScreens(ScNum).DifDifTrans; - RGlDifFr = dataConstruction.Construct(ConstrNum).ReflectSolDiffFront; + RGlDifFr = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront; } - AGlDiffFront = dataConstruction.Construct(ConstrNum).AbsDiff(Lay); + AGlDiffFront = state.dataConstruction->Construct(ConstrNum).AbsDiff(Lay); // Reduce the bare window absorbed beam by the screen beam transmittance and then account for // interreflections - AbWinSh = TScBmBm * AbWin + (TScBmBm * RGlFront * RScBack + TScBmDiff) * dataConstruction.Construct(ConstrNum).AbsDiff(Lay) / + AbWinSh = TScBmBm * AbWin + (TScBmBm * RGlFront * RScBack + TScBmDiff) * state.dataConstruction->Construct(ConstrNum).AbsDiff(Lay) / (1.0 - RGlDiffFront * RScDifBack) * CosInc * FracSunLit; ADiffWinSh = ADiffWin * TScDifDif / (1.0 - RGlDifFr * RScDifBack); @@ -7026,26 +7026,26 @@ namespace SolarShading { // Isolated glass and blind properties at current incidence angle, profile angle and slat angle if (Lay == 1) { - t1 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).tBareSolCoef({1, 6}, 1)); - t2 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).tBareSolCoef({1, 6}, 2)); - af1 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).afBareSolCoef({1, 6}, 1)); - af2 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).afBareSolCoef({1, 6}, 2)); - ab1 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).abBareSolCoef({1, 6}, 1)); - ab2 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).abBareSolCoef({1, 6}, 2)); - rf1 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).rfBareSolCoef({1, 6}, 1)); - rf2 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).rfBareSolCoef({1, 6}, 2)); - rb1 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).rbBareSolCoef({1, 6}, 1)); - rb2 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).rbBareSolCoef({1, 6}, 2)); - td1 = dataConstruction.Construct(ConstrNum).tBareSolDiff(1); - td2 = dataConstruction.Construct(ConstrNum).tBareSolDiff(2); - afd1 = dataConstruction.Construct(ConstrNum).afBareSolDiff(1); - afd2 = dataConstruction.Construct(ConstrNum).afBareSolDiff(2); - abd1 = dataConstruction.Construct(ConstrNum).abBareSolDiff(1); - abd2 = dataConstruction.Construct(ConstrNum).abBareSolDiff(2); - rfd1 = dataConstruction.Construct(ConstrNum).rfBareSolDiff(1); - rfd2 = dataConstruction.Construct(ConstrNum).rfBareSolDiff(2); - rbd1 = dataConstruction.Construct(ConstrNum).rbBareSolDiff(1); - rbd2 = dataConstruction.Construct(ConstrNum).rbBareSolDiff(2); + t1 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).tBareSolCoef({1, 6}, 1)); + t2 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).tBareSolCoef({1, 6}, 2)); + af1 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).afBareSolCoef({1, 6}, 1)); + af2 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).afBareSolCoef({1, 6}, 2)); + ab1 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).abBareSolCoef({1, 6}, 1)); + ab2 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).abBareSolCoef({1, 6}, 2)); + rf1 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).rfBareSolCoef({1, 6}, 1)); + rf2 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).rfBareSolCoef({1, 6}, 2)); + rb1 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).rbBareSolCoef({1, 6}, 1)); + rb2 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).rbBareSolCoef({1, 6}, 2)); + td1 = state.dataConstruction->Construct(ConstrNum).tBareSolDiff(1); + td2 = state.dataConstruction->Construct(ConstrNum).tBareSolDiff(2); + afd1 = state.dataConstruction->Construct(ConstrNum).afBareSolDiff(1); + afd2 = state.dataConstruction->Construct(ConstrNum).afBareSolDiff(2); + abd1 = state.dataConstruction->Construct(ConstrNum).abBareSolDiff(1); + abd2 = state.dataConstruction->Construct(ConstrNum).abBareSolDiff(2); + rfd1 = state.dataConstruction->Construct(ConstrNum).rfBareSolDiff(1); + rfd2 = state.dataConstruction->Construct(ConstrNum).rfBareSolDiff(2); + rbd1 = state.dataConstruction->Construct(ConstrNum).rbBareSolDiff(1); + rbd2 = state.dataConstruction->Construct(ConstrNum).rbBareSolDiff(2); tfshBB = BlindBeamBeamTrans( ProfAng, SlatAng, Blind(BlNum).SlatWidth, Blind(BlNum).SlatSeparation, Blind(BlNum).SlatThickness); tfshBd = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamDiffTrans); @@ -7070,16 +7070,16 @@ namespace SolarShading { if (Lay == 1 && NGlass == 3) { t1t2 = t1 * t2; td1td2 = td1 * td2; - t3 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).tBareSolCoef({1, 6}, 3)); - af3 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).afBareSolCoef({1, 6}, 3)); - ab3 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).abBareSolCoef({1, 6}, 3)); - rf3 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).rfBareSolCoef({1, 6}, 3)); - rb3 = POLYF(CosInc, dataConstruction.Construct(ConstrNum).rbBareSolCoef({1, 6}, 3)); - td3 = dataConstruction.Construct(ConstrNum).tBareSolDiff(3); - afd3 = dataConstruction.Construct(ConstrNum).afBareSolDiff(3); - abd3 = dataConstruction.Construct(ConstrNum).abBareSolDiff(3); - rfd3 = dataConstruction.Construct(ConstrNum).rfBareSolDiff(3); - rbd3 = dataConstruction.Construct(ConstrNum).rbBareSolDiff(3); + t3 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).tBareSolCoef({1, 6}, 3)); + af3 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).afBareSolCoef({1, 6}, 3)); + ab3 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).abBareSolCoef({1, 6}, 3)); + rf3 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).rfBareSolCoef({1, 6}, 3)); + rb3 = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).rbBareSolCoef({1, 6}, 3)); + td3 = state.dataConstruction->Construct(ConstrNum).tBareSolDiff(3); + afd3 = state.dataConstruction->Construct(ConstrNum).afBareSolDiff(3); + abd3 = state.dataConstruction->Construct(ConstrNum).abBareSolDiff(3); + rfd3 = state.dataConstruction->Construct(ConstrNum).rfBareSolDiff(3); + rbd3 = state.dataConstruction->Construct(ConstrNum).rbBareSolDiff(3); } if (NGlass == 2) { @@ -7145,7 +7145,7 @@ namespace SolarShading { // Add contribution of diffuse from beam on outside and inside reveal AWinSurf(Lay, SurfNum) += InterpSw(SwitchFac, ADiffWin, ADiffWinSh) * SurfWinOutsRevealDiffOntoGlazing(SurfNum) + - InterpSw(SwitchFac, dataConstruction.Construct(ConstrNum).AbsDiffBack(Lay), dataConstruction.Construct(ConstrNumSh).AbsDiffBack(Lay)) * + InterpSw(SwitchFac, state.dataConstruction->Construct(ConstrNum).AbsDiffBack(Lay), state.dataConstruction->Construct(ConstrNumSh).AbsDiffBack(Lay)) * SurfWinInsRevealDiffOntoGlazing(SurfNum); } } // End of check if window has shading device @@ -7159,10 +7159,10 @@ namespace SolarShading { if (ShadeFlag == IntShadeOn) { // Note that AbsBeamShadeCoef includes effect of shade/glazing inter-reflection - AbsShade = POLYF(CosInc, dataConstruction.Construct(ConstrNumSh).AbsBeamShadeCoef); + AbsShade = POLYF(CosInc, state.dataConstruction->Construct(ConstrNumSh).AbsBeamShadeCoef); ExtBeamAbsByShadFac(SurfNum) = (AbsShade * CosInc * SunLitFract * InOutProjSLFracMult + - SurfWinOutsRevealDiffOntoGlazing(SurfNum) * dataConstruction.Construct(ConstrNumSh).AbsDiffShade) * + SurfWinOutsRevealDiffOntoGlazing(SurfNum) * state.dataConstruction->Construct(ConstrNumSh).AbsDiffShade) * SurfWinGlazedFrac(SurfNum); // In the above, GlazedFrac corrects for shadowing of divider onto interior shade } @@ -7170,28 +7170,28 @@ namespace SolarShading { // Exterior beam absorbed by EXTERIOR SHADE if (ShadeFlag == ExtShadeOn) { - ExtBeamAbsByShadFac(SurfNum) = dataConstruction.Construct(ConstrNumSh).AbsDiffShade * CosInc * SunLitFract; + ExtBeamAbsByShadFac(SurfNum) = state.dataConstruction->Construct(ConstrNumSh).AbsDiffShade * CosInc * SunLitFract; } // Exterior beam absorbed by BETWEEN-GLASS SHADE if (ShadeFlag == BGShadeOn) { - AbsShade = POLYF(CosInc, dataConstruction.Construct(ConstrNumSh).AbsBeamShadeCoef); + AbsShade = POLYF(CosInc, state.dataConstruction->Construct(ConstrNumSh).AbsBeamShadeCoef); ExtBeamAbsByShadFac(SurfNum) = AbsShade * CosInc * SunLitFract + - SurfWinOutsRevealDiffOntoGlazing(SurfNum) * dataConstruction.Construct(ConstrNumSh).AbsDiffShade; + SurfWinOutsRevealDiffOntoGlazing(SurfNum) * state.dataConstruction->Construct(ConstrNumSh).AbsDiffShade; } // Exterior beam absorbed by INTERIOR BLIND if (ShadeFlag == IntBlindOn) { - TBmBm = POLYF(CosInc, dataConstruction.Construct(ConstrNum).TransSolBeamCoef); - RGlDiffBack = dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; + TBmBm = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); + RGlDiffBack = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; RhoBlFront = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamDiffRefl); AbsBlFront = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamAbs); RhoBlDiffFront = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolFrontDiffDiffRefl); AbsBlDiffFront = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolFrontDiffAbs); AbsShade = TBmBm * (AbsBlFront + RhoBlFront * RGlDiffBack * AbsBlDiffFront / (1.0 - RhoBlDiffFront * RGlDiffBack)); - AbsShadeDiff = dataConstruction.Construct(ConstrNum).TransDiff * + AbsShadeDiff = state.dataConstruction->Construct(ConstrNum).TransDiff * (AbsBlDiffFront + RhoBlDiffFront * RGlDiffBack * AbsBlDiffFront / (1.0 - RhoBlDiffFront * RGlDiffBack)); ExtBeamAbsByShadFac(SurfNum) = (AbsShade * CosInc * SunLitFract * InOutProjSLFracMult + @@ -7205,11 +7205,11 @@ namespace SolarShading { if (ShadeFlag == ExtBlindOn) { TBlBmBm = BlindBeamBeamTrans(ProfAng, SlatAng, Blind(BlNum).SlatWidth, Blind(BlNum).SlatSeparation, Blind(BlNum).SlatThickness); - RGlFront = POLYF(CosInc, dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef); + RGlFront = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef); AbsBlFront = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamAbs); AbsBlBack = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolBackBeamAbs); AbsBlDiffBack = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolBackDiffAbs); - RGlDiffFront = dataConstruction.Construct(ConstrNum).ReflectSolDiffFront; + RGlDiffFront = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront; RhoBlDiffBack = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolBackDiffDiffRefl); RhoBlBack = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolBackBeamDiffRefl); TBlBmDiff = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamDiffTrans); @@ -7223,8 +7223,8 @@ namespace SolarShading { if (ShadeFlag == ExtScreenOn) { TScBmBm = SurfaceScreens(SurfWinScreenNumber(SurfNum)).BmBmTrans; // TScBmDiff = SurfaceScreens(SurfaceWindow(SurfNum)%ScreenNumber)%BmDifTrans - RGlFront = POLYF(CosInc, dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef); - RGlDiffFront = dataConstruction.Construct(ConstrNum).ReflectSolDiffFront; + RGlFront = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef); + RGlDiffFront = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront; AbsScBeam = SurfaceScreens(ScNum).AbsorpSolarBeamFront; AbsScDiffBack = SurfaceScreens(ScNum).DifScreenAbsorp; @@ -7286,13 +7286,13 @@ namespace SolarShading { // recalcuate the diffuse absorptance and transmittance of the // the equivalent layer window model if there is shade control - EQLNum = dataConstruction.Construct(Surface(SurfNum).Construction).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(Surface(SurfNum).Construction).EQLConsPtr; if (CFS(EQLNum).ISControlled) { WindowEquivalentLayer::CalcEQLOpticalProperty(state, SurfNum, isDIFF, AbsSolDiffEQL); } else { AbsSolDiffEQL(_, {1, CFS(EQLNum).NL + 1}) = state.dataWindowEquivalentLayer->CFSDiffAbsTrans(_, {1, CFS(EQLNum).NL + 1}, EQLNum); } - dataConstruction.Construct(ConstrNum).TransDiff = AbsSolDiffEQL(1, CFS(EQLNum).NL + 1); + state.dataConstruction->Construct(ConstrNum).TransDiff = AbsSolDiffEQL(1, CFS(EQLNum).NL + 1); for (Lay = 1; Lay <= CFS(EQLNum).NL + 1; ++Lay) { AbWinEQL = AbsSolBeamEQL(1, Lay) * CosInc * SunLitFract * InOutProjSLFracMult; @@ -7329,7 +7329,7 @@ namespace SolarShading { if (SurfWinWindowModelType(SurfNum) != WindowBSDFModel && SurfWinWindowModelType(SurfNum) != WindowEQLModel) { // Regular window - DiffTrans = dataConstruction.Construct(ConstrNum).TransDiff; + DiffTrans = state.dataConstruction->Construct(ConstrNum).TransDiff; if (DifSolarRad != 0.0) { DSZoneWin = (SkySolarInc * DiffTrans * Surface(SurfNum).Area) / (DifSolarRad); } else { @@ -7341,19 +7341,19 @@ namespace SolarShading { DGZoneWin = (GndSolarInc * DiffTrans * Surface(SurfNum).Area) / (1.e-8); } } else if (SurfWinOriginalClass(SurfNum) == SurfaceClass_TDD_Diffuser) { - DiffTrans = TransTDD(PipeNum, CosInc, SolarAniso); + DiffTrans = TransTDD(state, PipeNum, CosInc, SolarAniso); DSZoneWin = AnisoSkyMult(SurfNum2) * DiffTrans * Surface(SurfNum).Area; DGZoneWin = Surface(SurfNum2).ViewFactorGround * TDDPipe(PipeNum).TransSolIso * Surface(SurfNum).Area; } else if (Surface(SurfNum).Class == SurfaceClass_TDD_Dome) { - DiffTrans = dataConstruction.Construct(ConstrNum).TransDiff; + DiffTrans = state.dataConstruction->Construct(ConstrNum).TransDiff; DSZoneWin = 0.0; // Solar not added by TDD:DOME; added to zone via TDD:DIFFUSER DGZoneWin = 0.0; // Solar not added by TDD:DOME; added to zone via TDD:DIFFUSER } else if (OutShelfSurf > 0) { // Outside daylighting shelf - DiffTrans = dataConstruction.Construct(ConstrNum).TransDiff; + DiffTrans = state.dataConstruction->Construct(ConstrNum).TransDiff; DSZoneWin = AnisoSkyMult(SurfNum) * DiffTrans * Surface(SurfNum).Area; @@ -7428,7 +7428,7 @@ namespace SolarShading { } else if (SurfWinWindowModelType(SurfNum) == WindowEQLModel) { - DiffTrans = dataConstruction.Construct(ConstrNum).TransDiff; + DiffTrans = state.dataConstruction->Construct(ConstrNum).TransDiff; if (DifSolarRad != 0.0) { DSZoneWin = (SkySolarInc * DiffTrans * Surface(SurfNum).Area) / (DifSolarRad); @@ -7451,15 +7451,15 @@ namespace SolarShading { // Shade or blind if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || ShadeFlag == ExtScreenOn) { // Shade or screen - DiffTrans = dataConstruction.Construct(ConstrNumSh).TransDiff; + DiffTrans = state.dataConstruction->Construct(ConstrNumSh).TransDiff; } else { // Blind - DiffTrans = InterpSlatAng(SlatAng, VarSlats, dataConstruction.Construct(ConstrNumSh).BlTransDiff); + DiffTrans = InterpSlatAng(SlatAng, VarSlats, state.dataConstruction->Construct(ConstrNumSh).BlTransDiff); // For blinds with horizontal slats, allow different diffuse/diffuse transmittance for // ground and sky solar if (Blind(SurfWinBlindNumber(SurfNum)).SlatOrientation == Horizontal) { - DiffTransGnd = InterpSlatAng(SlatAng, VarSlats, dataConstruction.Construct(ConstrNumSh).BlTransDiffGnd); - DiffTransSky = InterpSlatAng(SlatAng, VarSlats, dataConstruction.Construct(ConstrNumSh).BlTransDiffSky); + DiffTransGnd = InterpSlatAng(SlatAng, VarSlats, state.dataConstruction->Construct(ConstrNumSh).BlTransDiffGnd); + DiffTransSky = InterpSlatAng(SlatAng, VarSlats, state.dataConstruction->Construct(ConstrNumSh).BlTransDiffSky); } } if (DifSolarRad != 0.0) { @@ -7502,7 +7502,7 @@ namespace SolarShading { } else { // Switchable glazing SwitchFac = SurfWinSwitchingFactor(SurfNum); - DiffTrans = InterpSw(SwitchFac, dataConstruction.Construct(ConstrNum).TransDiff, dataConstruction.Construct(ConstrNumSh).TransDiff); + DiffTrans = InterpSw(SwitchFac, state.dataConstruction->Construct(ConstrNum).TransDiff, state.dataConstruction->Construct(ConstrNumSh).TransDiff); if (DifSolarRad != 0.0) { DSZoneWinSh = SkySolarInc * DiffTrans * Surface(SurfNum).Area / (DifSolarRad); } else { @@ -7541,14 +7541,14 @@ namespace SolarShading { // Beam-beam transmittance for bare exterior window if (SunLitFract > 0.0) { if (SurfWinOriginalClass(SurfNum) == SurfaceClass_TDD_Diffuser) { - TBmDif = TransTDD(PipeNum, CosInc, SolarBeam); + TBmDif = TransTDD(state, PipeNum, CosInc, SolarBeam); TDDPipe(PipeNum).TransSolBeam = TBmDif; // Report variable } else if (SurfWinWindowModelType(SurfNum) != WindowBSDFModel && SurfWinWindowModelType(SurfNum) != WindowEQLModel) { // Regular window if (!SurfWinSolarDiffusing(SurfNum)) { // Clear glazing - TBmBm = POLYF(CosInc, dataConstruction.Construct(ConstrNum).TransSolBeamCoef); //[-] + TBmBm = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); //[-] } else { // Diffusing glazing - TBmDif = POLYF(CosInc, dataConstruction.Construct(ConstrNum).TransSolBeamCoef); //[-] + TBmDif = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); //[-] } } else if (SurfWinWindowModelType(SurfNum) == WindowBSDFModel) { // Need to check what effect, if any, defining these here has @@ -7572,7 +7572,7 @@ namespace SolarShading { // Diffuse-diffuse transmittance for bare exterior window if (SurfWinOriginalClass(SurfNum) == SurfaceClass_TDD_Diffuser) { - TDifBare = TransTDD(PipeNum, CosInc, SolarAniso); + TDifBare = TransTDD(state, PipeNum, CosInc, SolarAniso); } else { if (SurfWinWindowModelType(SurfNum) == WindowBSDFModel) { // Complex Fenestration: use hemispherical ave of directional-hemispherical transmittance @@ -7580,9 +7580,9 @@ namespace SolarShading { TDifBare = SurfaceWindow(SurfNum).ComplexFen.State(SurfaceWindow(SurfNum).ComplexFen.CurrentState).WinDiffTrans; } else if (SurfWinWindowModelType(SurfNum) == WindowEQLModel) { // get ASHWAT fenestration model diffuse-diffuse properties includes shade if present - TDifBare = dataConstruction.Construct(ConstrNum).TransDiff; + TDifBare = state.dataConstruction->Construct(ConstrNum).TransDiff; } else { // Regular window - TDifBare = dataConstruction.Construct(ConstrNum).TransDiff; + TDifBare = state.dataConstruction->Construct(ConstrNum).TransDiff; } } SurfWinGlTsolDifDif(SurfNum) = TDifBare; @@ -7598,7 +7598,7 @@ namespace SolarShading { // Shade on or switchable glazing - if (SunLitFract > 0.0) TBmAllShBlSc = POLYF(CosInc, dataConstruction.Construct(ConstrNumSh).TransSolBeamCoef); + if (SunLitFract > 0.0) TBmAllShBlSc = POLYF(CosInc, state.dataConstruction->Construct(ConstrNumSh).TransSolBeamCoef); } else { @@ -7664,7 +7664,7 @@ namespace SolarShading { TBlDifDif = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolFrontDiffDiffTrans); RhoBlBmDifFr = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamDiffRefl); - RGlDifBk = dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; + RGlDifBk = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; RhoBlDifDifFr = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolFrontDiffDiffRefl); TBmAllShBlSc = TBmBm * (TBlBmBm + TBlBmDif + TBlDifDif * RhoBlBmDifFr * RGlDifBk / (1 - RhoBlDifDifFr * RGlDifBk)); @@ -7679,7 +7679,7 @@ namespace SolarShading { // Exterior blind on: beam-beam and diffuse transmittance of exterior beam RhoBlBmDifBk = InterpProfSlatAng(ProfAng, SlatAng, VarSlats, Blind(BlNum).SolBackBeamDiffRefl); - RGlBmFr = POLYF(CosInc, dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef); + RGlBmFr = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef); TBmAllShBlSc = TBlBmBm * (TBmBm + TDifBare * RGlBmFr * RhoBlBmDifBk / (1 - RGlDifFr * RhoBlDifDifBk)) + TBlBmDif * TDifBare / (1 - RGlDifFr * RhoBlDifDifBk); @@ -7693,7 +7693,7 @@ namespace SolarShading { RScBack = SurfaceScreens(ScNum).ReflectSolBeamFront; RScDifDifBk = SurfaceScreens(ScNum).DifReflect; - RGlBmFr = POLYF(CosInc, dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef); + RGlBmFr = POLYF(CosInc, state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef); TBmAllShBlSc = TScBmBm * (TBmBm + RGlBmFr * RScBack * TDifBare / (1 - RGlDifFr * RScDifDifBk)) + TScBmDif * TDifBare / (1 - RGlDifFr * RScDifDifBk); @@ -7918,17 +7918,17 @@ namespace SolarShading { if (BackSurfNum == 0) break; // No more irradiated back surfaces for this exterior window ConstrNumBack = Surface(BackSurfNum).Construction; - NBackGlass = dataConstruction.Construct(ConstrNumBack).TotGlassLayers; + NBackGlass = state.dataConstruction->Construct(ConstrNumBack).TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) AOverlap = OverlapAreas(TimeStep, HourOfDay, IBack, SurfNum); BOverlap = TBm * AOverlap * CosInc; //[m2] - if (dataConstruction.Construct(ConstrNumBack).TransDiff <= 0.0) { + if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { // Back surface is opaque interior or exterior wall - AbsIntSurf = dataConstruction.Construct(ConstrNumBack).InsideAbsorpSolar; + AbsIntSurf = state.dataConstruction->Construct(ConstrNumBack).InsideAbsorpSolar; // Check for movable insulation; reproduce code from subr. EvalInsideMovableInsulation; // Can't call that routine here since cycle prevents SolarShadingGeometry from USEing @@ -7977,42 +7977,42 @@ namespace SolarShading { // Interior beam absorptance of glass layers and beam transmittance of back exterior & // or interior window WITHOUT SHADING this timestep - if (dataConstruction.Construct(ConstrNumBack).TypeIsAirBoundaryInteriorWindow) { + if (state.dataConstruction->Construct(ConstrNumBack).TypeIsAirBoundaryInteriorWindow) { TransBeamWin = 1.0; AbsBeamWinEQL = 0.0; AbsBeamTotWin = 0.0; } else if (ShadeFlagBack <= 0) { for (Lay = 1; Lay <= NBackGlass; ++Lay) { - AbsBeamWin(Lay) = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).AbsBeamBackCoef({1, 6}, Lay)); + AbsBeamWin(Lay) = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef({1, 6}, Lay)); } - TransBeamWin = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).TransSolBeamCoef); + TransBeamWin = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); } // Interior beam absorptance of glass layers and beam transmittance // of back exterior window with SHADE if (ShadeFlagBack == IntShadeOn || ShadeFlagBack == ExtShadeOn || ShadeFlagBack == BGShadeOn) { - for (Lay = 1; Lay <= dataConstruction.Construct(ConstrNumBackSh).TotGlassLayers; ++Lay) { - AbsBeamWin(Lay) = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBackSh).AbsBeamBackCoef({1, 6}, Lay)); + for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNumBackSh).TotGlassLayers; ++Lay) { + AbsBeamWin(Lay) = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef({1, 6}, Lay)); } - TransBeamWin = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBackSh).TransSolBeamCoef); + TransBeamWin = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); } // Interior beam absorbed by INTERIOR SHADE of back exterior window if (ShadeFlagBack == IntShadeOn) { - IntBeamAbsByShadFac(BackSurfNum) = BOverlap * dataConstruction.Construct(ConstrNumBackSh).AbsDiffBackShade / + IntBeamAbsByShadFac(BackSurfNum) = BOverlap * state.dataConstruction->Construct(ConstrNumBackSh).AbsDiffBackShade / (Surface(BackSurfNum).Area + SurfWinDividerArea(BackSurfNum)); - BABSZone += BOverlap * dataConstruction.Construct(ConstrNumBackSh).AbsDiffBackShade; + BABSZone += BOverlap * state.dataConstruction->Construct(ConstrNumBackSh).AbsDiffBackShade; } // Interior beam absorbed by EXTERIOR SHADE of back exterior window if (ShadeFlagBack == ExtShadeOn) { - RGlFront = dataConstruction.Construct(ConstrNumBack).ReflectSolDiffFront; - AbsSh = dataMaterial.Material(dataConstruction.Construct(ConstrNumBackSh).LayerPoint(1)).AbsorpSolar; - RhoSh = 1.0 - AbsSh - dataMaterial.Material(dataConstruction.Construct(ConstrNumBackSh).LayerPoint(1)).Trans; - AShBack = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).TransSolBeamCoef) * AbsSh / (1.0 - RGlFront * RhoSh); + RGlFront = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffFront; + AbsSh = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(1)).AbsorpSolar; + RhoSh = 1.0 - AbsSh - dataMaterial.Material(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(1)).Trans; + AShBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef) * AbsSh / (1.0 - RGlFront * RhoSh); BABSZone += BOverlap * AShBack; IntBeamAbsByShadFac(BackSurfNum) = BOverlap * AShBack / (Surface(BackSurfNum).Area + SurfWinDividerArea(BackSurfNum)); @@ -8021,18 +8021,18 @@ namespace SolarShading { // Interior beam absorbed by BETWEEN-GLASS SHADE of back exterior window if (ShadeFlagBack == BGShadeOn) { - rbd1k = dataConstruction.Construct(ConstrNumBack).rbBareSolDiff(1); + rbd1k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(1); if (NBackGlass == 2) { - t2k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).tBareSolCoef({1, 6}, 2)); - rfd2k = dataConstruction.Construct(ConstrNumBack).rfBareSolDiff(2); - TrSh = dataMaterial.Material(dataConstruction.Construct(ConstrNumBackSh).LayerPoint(3)).Trans; - RhoSh = dataMaterial.Material(dataConstruction.Construct(ConstrNumBackSh).LayerPoint(3)).ReflectShade; + t2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef({1, 6}, 2)); + rfd2k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(2); + TrSh = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(3)).Trans; + RhoSh = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(3)).ReflectShade; AbsSh = min(1.0, max(0.0, 1 - TrSh - RhoSh)); AShBack = t2k * (1 + RhoSh * rfd2k + TrSh * rbd1k) * AbsSh; } else { // NBackGlass = 3 - t3k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).tBareSolCoef({1, 6}, 3)); - TrSh = dataMaterial.Material(dataConstruction.Construct(ConstrNumBackSh).LayerPoint(5)).Trans; - RhoSh = dataMaterial.Material(dataConstruction.Construct(ConstrNumBackSh).LayerPoint(5)).ReflectShade; + t3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef({1, 6}, 3)); + TrSh = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(5)).Trans; + RhoSh = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(5)).ReflectShade; AbsSh = min(1.0, max(0.0, 1 - TrSh - RhoSh)); AShBack = t3k * (1 + RhoSh * rfd3k + TrSh * (rbd2k + td2k * rbd1k * td2k)) * AbsSh; } @@ -8046,7 +8046,7 @@ namespace SolarShading { if (ShadeFlagBack == IntBlindOn || ShadeFlagBack == ExtBlindOn || ShadeFlagBack == BGBlindOn) { BlNumBack = SurfWinBlindNumber(BackSurfNum); ProfileAngle(BackSurfNum, SOLCOS, Blind(BlNumBack).SlatOrientation, ProfAngBack); - TGlBmBack = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).TransSolBeamCoef); + TGlBmBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); TBlBmBmBack = BlindBeamBeamTrans(ProfAngBack, Pi - SlatAngBack, Blind(BlNumBack).SlatWidth, @@ -8062,18 +8062,18 @@ namespace SolarShading { RhoBlFront = InterpProfSlatAng(ProfAngBack, SlatAngBack, VarSlatsBack, Blind(BlNumBack).SolFrontBeamDiffRefl); RhoBlDiffFront = InterpSlatAng(SlatAngBack, VarSlatsBack, Blind(BlNumBack).SolFrontDiffDiffRefl); - RGlBack = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).ReflSolBeamBackCoef({1, 6})); - RGlDiffBack = dataConstruction.Construct(ConstrNumBack).ReflectSolDiffBack; + RGlBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).ReflSolBeamBackCoef({1, 6})); + RGlDiffBack = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffBack; for (Lay = 1; Lay <= NBackGlass; ++Lay) { - AbWinBack = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).AbsBeamBackCoef({1, 6}, Lay)); - AGlDiffBack = dataConstruction.Construct(ConstrNumBack).AbsDiffBack(Lay); + AbWinBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef({1, 6}, Lay)); + AGlDiffBack = state.dataConstruction->Construct(ConstrNumBack).AbsDiffBack(Lay); AbsBeamWin(Lay) = TBlBmBmBack * AbWinBack + ((TBlBmBmBack * RGlBack * RhoBlFront + TBlBmDiffBack) * AGlDiffBack / (1.0 - RGlDiffBack * RhoBlDiffFront)); } // Interior beam transmitted by exterior back window with INTERIOR BLIND - TGlDif = dataConstruction.Construct(ConstrNumBack).TransDiff; + TGlDif = state.dataConstruction->Construct(ConstrNumBack).TransDiff; TransBeamWin = TBlBmBmBack * (TGlBmBack + TGlDif * RGlBack * RhoBlFront / (1.0 - RGlDiffBack * RhoBlDiffFront)) + TBlBmDiffBack * TGlDif / (1.0 - RGlDiffBack * RhoBlDiffFront); @@ -8095,12 +8095,12 @@ namespace SolarShading { // Interior beam absorptance of GLASS LAYERS of exterior back window with EXTERIOR BLIND - RGlDiffFront = dataConstruction.Construct(ConstrNumBack).ReflectSolDiffFront; + RGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffFront; RhoBlBack = InterpProfSlatAng(ProfAngBack, SlatAngBack, VarSlatsBack, Blind(BlNumBack).SolBackBeamDiffRefl); for (Lay = 1; Lay <= NBackGlass; ++Lay) { - AbWinBack = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).AbsBeamBackCoef({1, 6}, Lay)); - AGlDiffFront = dataConstruction.Construct(ConstrNumBack).AbsDiff(Lay); + AbWinBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef({1, 6}, Lay)); + AGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).AbsDiff(Lay); AbsBeamWin(Lay) = AbWinBack + (TGlBmBack * AGlDiffFront * RhoBlBack / (1.0 - RhoBlBack * RGlDiffFront)); } @@ -8110,7 +8110,7 @@ namespace SolarShading { TBlDifDif = InterpSlatAng(SlatAngBack, VarSlatsBack, Blind(BlNumBack).SolBackDiffDiffTrans); RhoBlBmDifBk = InterpProfSlatAng(ProfAngBack, SlatAngBack, VarSlatsBack, Blind(BlNumBack).SolBackBeamDiffRefl); - RGlDifFr = dataConstruction.Construct(ConstrNum).ReflectSolDiffFront; + RGlDifFr = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront; RhoBlDifDifBk = InterpSlatAng(SlatAngBack, VarSlatsBack, Blind(BlNumBack).SolBackDiffDiffRefl); TransBeamWin = TGlBmBack * (TBlBmBmBack + TBlBmDiffBack + TBlDifDif * RhoBlBmDifBk * RGlDifFr / (1.0 - RhoBlDifDifBk * RGlDifFr)); @@ -8129,21 +8129,21 @@ namespace SolarShading { if (ShadeFlagBack == BGBlindOn) { - t1k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).tBareSolCoef({1, 6}, 1)); - t2k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).tBareSolCoef({1, 6}, 2)); - af2k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).afBareSolCoef({1, 6}, 2)); - ab1k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).abBareSolCoef({1, 6}, 1)); - ab2k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).abBareSolCoef({1, 6}, 2)); - rb1k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).rbBareSolCoef({1, 6}, 1)); - rb2k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).rbBareSolCoef({1, 6}, 2)); - td1k = dataConstruction.Construct(ConstrNumBack).tBareSolDiff(1); - td2k = dataConstruction.Construct(ConstrNumBack).tBareSolDiff(2); - afd2k = dataConstruction.Construct(ConstrNumBack).afBareSolDiff(2); - abd1k = dataConstruction.Construct(ConstrNumBack).abBareSolDiff(1); - abd2k = dataConstruction.Construct(ConstrNumBack).abBareSolDiff(2); - rfd2k = dataConstruction.Construct(ConstrNumBack).rfBareSolDiff(2); - rbd1k = dataConstruction.Construct(ConstrNumBack).rbBareSolDiff(1); - rbd2k = dataConstruction.Construct(ConstrNumBack).rbBareSolDiff(2); + t1k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef({1, 6}, 1)); + t2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef({1, 6}, 2)); + af2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).afBareSolCoef({1, 6}, 2)); + ab1k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).abBareSolCoef({1, 6}, 1)); + ab2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).abBareSolCoef({1, 6}, 2)); + rb1k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).rbBareSolCoef({1, 6}, 1)); + rb2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).rbBareSolCoef({1, 6}, 2)); + td1k = state.dataConstruction->Construct(ConstrNumBack).tBareSolDiff(1); + td2k = state.dataConstruction->Construct(ConstrNumBack).tBareSolDiff(2); + afd2k = state.dataConstruction->Construct(ConstrNumBack).afBareSolDiff(2); + abd1k = state.dataConstruction->Construct(ConstrNumBack).abBareSolDiff(1); + abd2k = state.dataConstruction->Construct(ConstrNumBack).abBareSolDiff(2); + rfd2k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(2); + rbd1k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(1); + rbd2k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(2); tfshBBk = BlindBeamBeamTrans(ProfAngBack, SlatAngBack, Blind(BlNumBack).SlatWidth, @@ -8170,11 +8170,11 @@ namespace SolarShading { abshBk = InterpProfSlatAng(ProfAngBack, SlatAngBack, VarSlatsBack, Blind(BlNumBack).SolBackBeamAbs); if (NBackGlass == 3) { - t3k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).tBareSolCoef({1, 6}, 3)); - af3k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).afBareSolCoef({1, 6}, 3)); - ab3k = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).abBareSolCoef({1, 6}, 3)); - afd3k = dataConstruction.Construct(ConstrNumBack).afBareSolDiff(3); - rfd3k = dataConstruction.Construct(ConstrNumBack).rfBareSolDiff(3); + t3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef({1, 6}, 3)); + af3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).afBareSolCoef({1, 6}, 3)); + ab3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).abBareSolCoef({1, 6}, 3)); + afd3k = state.dataConstruction->Construct(ConstrNumBack).afBareSolDiff(3); + rfd3k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(3); } // Interior beam absorptance of GLASS LAYERS of exterior back window with BETWEEN-GLASS BLIND @@ -8240,15 +8240,15 @@ namespace SolarShading { // Interior beam absorptance of GLASS LAYERS of exterior back window with EXTERIOR SCREEN ScNumBack = SurfWinScreenNumber(BackSurfNum); - TGlBmBack = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).TransSolBeamCoef); - RGlDiffFront = dataConstruction.Construct(ConstrNumBack).ReflectSolDiffFront; + TGlBmBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); + RGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffFront; TScBmBmBack = SurfaceScreens(ScNumBack).BmBmTransBack; TScBmDiffBack = SurfaceScreens(ScNumBack).BmDifTransBack; RScBack = SurfaceScreens(ScNumBack).ReflectSolBeamFront; RScDifBack = SurfaceScreens(ScNumBack).DifReflect; for (Lay = 1; Lay <= NBackGlass; ++Lay) { - AbWinBack = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBack).AbsBeamBackCoef({1, 6}, Lay)); - AGlDiffFront = dataConstruction.Construct(ConstrNumBack).AbsDiff(Lay); + AbWinBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef({1, 6}, Lay)); + AGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).AbsDiff(Lay); AbsBeamWin(Lay) = AbWinBack + (TGlBmBack * AGlDiffFront * RScBack / (1.0 - RScDifBack * RGlDiffFront)); } @@ -8256,7 +8256,7 @@ namespace SolarShading { TScDifDif = SurfaceScreens(ScNumBack).DifDifTrans; RScBmDifBk = SurfaceScreens(ScNumBack).ReflectSolBeamBack; - RGlDifFr = dataConstruction.Construct(ConstrNum).ReflectSolDiffFront; + RGlDifFr = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront; RScDifDifBk = SurfaceScreens(ScNumBack).DifReflect; TransBeamWin = TGlBmBack * (TScBmBmBack + TScBmDiffBack + TScDifDif * RScBmDifBk * RGlDifFr / (1.0 - RScDifDifBk * RGlDifFr)); @@ -8279,10 +8279,10 @@ namespace SolarShading { SwitchFacBack = SurfWinSwitchingFactor(BackSurfNum); for (Lay = 1; Lay <= NBackGlass; ++Lay) { - AbsBeamWinSh = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBackSh).AbsBeamBackCoef({1, 6}, Lay)); + AbsBeamWinSh = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef({1, 6}, Lay)); AbsBeamWin(Lay) = InterpSw(SwitchFac, AbsBeamWin(Lay), AbsBeamWinSh); } - TransBeamWinSh = POLYF(CosIncBack, dataConstruction.Construct(ConstrNumBackSh).TransSolBeamCoef); + TransBeamWinSh = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); TransBeamWin = InterpSw(SwitchFac, TransBeamWin, TransBeamWinSh); } @@ -8353,7 +8353,7 @@ namespace SolarShading { // window has to be considered as beam and therefore calcualte CFBoverlap for each of them for (CurTrnDir = 1; CurTrnDir <= ComplexWind(SurfNum).Geom(CurCplxFenState).Trn.NBasis; ++CurTrnDir) { CurLambda = ComplexWind(SurfNum).Geom(CurCplxFenState).Trn.Lamda(CurTrnDir); - DirTrans = dataConstruction.Construct(IConst).BSDFInput.SolFrtTrans(IBm, CurTrnDir); + DirTrans = state.dataConstruction->Construct(IConst).BSDFInput.SolFrtTrans(IBm, CurTrnDir); // Now calculate effect of this direction on all back surfaces for (IBack = 1; IBack <= NBkSurf; ++IBack) { CFDirBoverlap(IBack, CurTrnDir) = @@ -8408,14 +8408,14 @@ namespace SolarShading { .IntegratedBkRefl(bestBackTrn)); // Absorptance from current back direction - TotSolidLay = dataConstruction.Construct(ConstrNumBack).TotSolidLayers; + TotSolidLay = state.dataConstruction->Construct(ConstrNumBack).TotSolidLayers; for (Lay = 1; Lay <= TotSolidLay; ++Lay) { // IF (ALLOCATED(Construct(ConstrNumBack)%BSDFInput)) THEN // CFDirBoverlap is energy transmitted for current basis beam. It is important to note that // AWinOverlap array needs to contain flux and not absorbed energy because later in the code // this will be multiplied with window area AWinCFOverlap(Lay, BackSurfaceNumber) += - dataConstruction.Construct(ConstrNumBack).BSDFInput.Layer(Lay).BkAbs(bestBackTrn, 1) * + state.dataConstruction->Construct(ConstrNumBack).BSDFInput.Layer(Lay).BkAbs(bestBackTrn, 1) * CFDirBoverlap(IBack, CurTrnDir) / Surface(BackSurfaceNumber).Area; // END IF } @@ -8443,12 +8443,12 @@ namespace SolarShading { } } } else { - if (dataConstruction.Construct(ConstrNumBack).TransDiff <= 0.0) { + if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { // Do not take into account this window if it is scheduled for surface gains SurfSolIncPtr = SurfaceScheduledSolarInc(BackSurfaceNumber, ConstrNumBack); if (SurfSolIncPtr == 0) { - AbsIntSurf = dataConstruction.Construct(ConstrNumBack).InsideAbsorpSolar; + AbsIntSurf = state.dataConstruction->Construct(ConstrNumBack).InsideAbsorpSolar; AISurf(BackSurfaceNumber) += CFBoverlap(IBack) * AbsIntSurf / Surface(BackSurfaceNumber).Area; BABSZone += CFBoverlap(IBack) * AbsIntSurf; } @@ -8474,17 +8474,17 @@ namespace SolarShading { if (SurfWinWindowModelType(IBack) != WindowEQLModel) continue; // only EQL back window is allowed ConstrNumBack = Surface(BackSurfNum).Construction; - NBackGlass = dataConstruction.Construct(ConstrNumBack).TotGlassLayers; + NBackGlass = state.dataConstruction->Construct(ConstrNumBack).TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) AOverlap = OverlapAreas(TimeStep, HourOfDay, IBack, SurfNum); BOverlap = TBm * AOverlap * CosInc; //[m2] - if (dataConstruction.Construct(ConstrNumBack).TransDiff <= 0.0) { + if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { // Back surface is opaque interior or exterior wall - AbsIntSurf = dataConstruction.Construct(ConstrNumBack).InsideAbsorpSolar; + AbsIntSurf = state.dataConstruction->Construct(ConstrNumBack).InsideAbsorpSolar; // Check for movable insulation; reproduce code from subr. EvalInsideMovableInsulation; // Can't call that routine here since cycle prevents SolarShadingGeometry from USEing @@ -8523,7 +8523,7 @@ namespace SolarShading { // call the ASHWAT fenestration model for beam radiation here WindowEquivalentLayer::CalcEQLOpticalProperty(state, BackSurfNum, isBEAM, AbsSolBeamBackEQL); - EQLNum = dataConstruction.Construct(ConstrNumBack).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNumBack).EQLConsPtr; AbsBeamWinEQL({ 1, CFS(EQLNum).NL }) = AbsSolBeamBackEQL(1, { 1, CFS(EQLNum).NL }); // get the interior beam transmitted through back exterior or interior EQL window TransBeamWin = AbsSolBeamBackEQL(1, CFS(EQLNum).NL + 1); @@ -8597,11 +8597,11 @@ namespace SolarShading { BTOTWinZone = TBm * SunLitFract * Surface(SurfNum).Area * CosInc * InOutProjSLFracMult; //[m2] - if (dataConstruction.Construct(FlConstrNum).TransDiff <= 0.0) { + if (state.dataConstruction->Construct(FlConstrNum).TransDiff <= 0.0) { // Opaque surface AISurf(FloorNum) += BTOTWinZone * ISABSF(FloorNum) / Surface(FloorNum).Area; //[-] - } else if (dataConstruction.Construct(FlConstrNum).TypeIsAirBoundaryInteriorWindow) { + } else if (state.dataConstruction->Construct(FlConstrNum).TypeIsAirBoundaryInteriorWindow) { TransBeamWin = 1.0; AbsBeamWinEQL = 0.0; AbsBeamTotWin = 0.0; @@ -8617,14 +8617,14 @@ namespace SolarShading { // diffuse layer absorptions have already been put into the construction if (SurfWinStormWinFlag(FloorNum) == 1) FlConstrNum = Surface(FloorNum).StormWinConstruction; AbsBeamTotWin = 0.0; - for (Lay = 1; Lay <= dataConstruction.Construct(FlConstrNum).TotGlassLayers; ++Lay) { - AbsBeamTotWin += dataConstruction.Construct(FlConstrNum).AbsDiffBack(Lay); + for (Lay = 1; Lay <= state.dataConstruction->Construct(FlConstrNum).TotGlassLayers; ++Lay) { + AbsBeamTotWin += state.dataConstruction->Construct(FlConstrNum).AbsDiffBack(Lay); } // In the following we have to multiply by the AbsDiffBack(Lay)/AbsBeamTotWin ratio to get the // layer by layer absorbed beam since ISABSF(FloorNum) is proportional to AbsBeamTotWin // (see ComputeIntSolarAbsorpFactors). - for (Lay = 1; Lay <= dataConstruction.Construct(FlConstrNum).TotGlassLayers; ++Lay) { - AWinSurf(Lay, FloorNum) += dataConstruction.Construct(FlConstrNum).AbsDiffBack(Lay) / AbsBeamTotWin * BTOTWinZone * + for (Lay = 1; Lay <= state.dataConstruction->Construct(FlConstrNum).TotGlassLayers; ++Lay) { + AWinSurf(Lay, FloorNum) += state.dataConstruction->Construct(FlConstrNum).AbsDiffBack(Lay) / AbsBeamTotWin * BTOTWinZone * ISABSF(FloorNum) / Surface(FloorNum).Area; //[-] } } @@ -8632,7 +8632,7 @@ namespace SolarShading { BABSZone += BTOTWinZone * ISABSF(FloorNum); //[m2] int AdjSurfNum = Surface(FloorNum).ExtBoundCond; - if (dataConstruction.Construct(FlConstrNum).TransDiff > 0.0 && AdjSurfNum > 0) { + if (state.dataConstruction->Construct(FlConstrNum).TransDiff > 0.0 && AdjSurfNum > 0) { // Window in an interior floor @@ -8640,9 +8640,9 @@ namespace SolarShading { // Contribution (assumed diffuse) to adjacent zone of beam radiation passing // through this window - DBZoneIntWin(adjEnclosureNum) += BTOTWinZone * ISABSF(FloorNum) * dataConstruction.Construct(FlConstrNum).TransDiff / AbsBeamTotWin; + DBZoneIntWin(adjEnclosureNum) += BTOTWinZone * ISABSF(FloorNum) * state.dataConstruction->Construct(FlConstrNum).TransDiff / AbsBeamTotWin; - BABSZone += BTOTWinZone * ISABSF(FloorNum) * dataConstruction.Construct(FlConstrNum).TransDiff / AbsBeamTotWin; + BABSZone += BTOTWinZone * ISABSF(FloorNum) * state.dataConstruction->Construct(FlConstrNum).TransDiff / AbsBeamTotWin; } } // End of loop over floor sections @@ -8659,7 +8659,7 @@ namespace SolarShading { // do calculation only if construction number match. if (SurfIncSolSSG(iSSG).ConstrPtr == Surface(SurfNum).Construction) { if (Surface(SurfNum).SolarEnclIndex == enclosureNum) { - AbsIntSurf = dataConstruction.Construct(Surface(SurfNum).Construction).InsideAbsorpSolar; + AbsIntSurf = state.dataConstruction->Construct(Surface(SurfNum).Construction).InsideAbsorpSolar; // SolarIntoZone = GetCurrentScheduleValue(SurfIncSolSSG(iSSG)%SchedPtr) * Surface(SurfNum)%Area SolarIntoZone = GetCurrentScheduleValue(SurfIncSolSSG(iSSG).SchedPtr); AISurf(SurfNum) = SolarIntoZone * AbsIntSurf; @@ -8720,7 +8720,7 @@ namespace SolarShading { DifSolarInc = DifSolarRad * AnisoSkyMult(SurfNum2) + GndSolarRad * Surface(SurfNum2).ViewFactorGround; - SkySolarTrans = DifSolarRad * TransTDD(PipeNum, CosInc, SolarAniso) * AnisoSkyMult(SurfNum2); + SkySolarTrans = DifSolarRad * TransTDD(state, PipeNum, CosInc, SolarAniso) * AnisoSkyMult(SurfNum2); GndSolarTrans = GndSolarRad * TDDPipe(PipeNum).TransSolIso * Surface(SurfNum2).ViewFactorGround; SurfWinBmSolar(SurfNum) = BeamSolarRad * WinTransBmSolar(SurfNum); @@ -8815,7 +8815,7 @@ namespace SolarShading { // Includes subsequent transmittance of diffuse solar to adjacent zones through interior windows CalcWinTransDifSolInitialDistribution(state); } - void CalcAborbedOnExteriorOpaqueSurfaces() + void CalcAbsorbedOnExteriorOpaqueSurfaces(EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Simon Vidanovic @@ -8864,8 +8864,8 @@ namespace SolarShading { // EXTERIOR BEAM SOLAR RADIATION ABSORBED ON THE OUTSIDE OF OPAQUE SURFACES //------------------------------------------------------------------------- - if (SunLitFract > 0.0 && dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { - AOSurf(SurfNum) = dataConstruction.Construct(ConstrNum).OutsideAbsorpSolar * CosInc * SunLitFract; + if (SunLitFract > 0.0 && state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { + AOSurf(SurfNum) = state.dataConstruction->Construct(ConstrNum).OutsideAbsorpSolar * CosInc * SunLitFract; // Note: movable insulation, if present, is accounted for in subr. InitIntSolarDistribution, // where QRadSWOutMvIns is calculated from QRadSWOutAbs and insulation solar absorptance @@ -8892,7 +8892,7 @@ namespace SolarShading { // REFERENCES: // na - CalcAborbedOnExteriorOpaqueSurfaces(); + CalcAbsorbedOnExteriorOpaqueSurfaces(state); if (state.dataWindowManager->winOpticalModel->isSimplifiedModel()) { CalcInteriorSolarDistributionWCESimple(state); @@ -9004,7 +9004,7 @@ namespace SolarShading { // SKY AND GROUND DIFFUSE SOLAR GAIN INTO ZONE FROM EXTERIOR WINDOW //////////////////////////////////////////////////////////////////// Real64 Tdiff = aLayer->getPropertySimple(PropertySimple::T, Side::Front, Scattering::DiffuseDiffuse, Theta, Phi); - dataConstruction.Construct(ConstrNum).TransDiff = Tdiff; + state.dataConstruction->Construct(ConstrNum).TransDiff = Tdiff; Real64 DSZoneWin = SurfSkySolarInc(SurfNum2) * Tdiff * Surface(SurfNum2).Area; if ((DifSolarRad != 0)) { DSZoneWin /= DifSolarRad; @@ -9069,10 +9069,10 @@ namespace SolarShading { Real64 AOverlap = OverlapAreas(TimeStep, HourOfDay, IBack, SurfNum); Real64 BOverlap = TBm * AOverlap * CosInc; //[m2] - if (dataConstruction.Construct(ConstrNumBack).TransDiff <= 0.0) { + if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { // Back surface is opaque interior or exterior wall - Real64 AbsIntSurf = dataConstruction.Construct(ConstrNumBack).InsideAbsorpSolar; + Real64 AbsIntSurf = state.dataConstruction->Construct(ConstrNumBack).InsideAbsorpSolar; // Check for movable insulation; reproduce code from subr. EvalInsideMovableInsulation; // Can't call that routine here since cycle prevents SolarShadingGeometry from USEing @@ -9102,7 +9102,7 @@ namespace SolarShading { Real64 BTOTWinZone = TBm * SunLitFract * Surface(SurfNum).Area * CosInc * window.InOutProjSLFracMult(HourOfDay); //[m2] - if (dataConstruction.Construct(Surface(FloorNum).Construction).TransDiff <= 0.0) { + if (state.dataConstruction->Construct(Surface(FloorNum).Construction).TransDiff <= 0.0) { // Opaque surface AISurf(FloorNum) += BTOTWinZone * ISABSF(FloorNum) / Surface(FloorNum).Area; //[-] @@ -9290,7 +9290,7 @@ namespace SolarShading { // Calculate factors for solar reflection if (CalcSolRefl) { CalcBeamSolDiffuseReflFactors(); - CalcBeamSolSpecularReflFactors(); + CalcBeamSolSpecularReflFactors(state); if (BeginSimFlag) CalcSkySolDiffuseReflFactors(); } @@ -9517,7 +9517,8 @@ namespace SolarShading { } } - void SHDSBS(int const iHour, // Hour Index + void SHDSBS(EnergyPlusData &state, + int const iHour, // Hour Index int const CurSurf, int const NBKS, // Number of back surfaces int const NSBS, // Number of subsurfaces @@ -9657,7 +9658,7 @@ namespace SolarShading { } // Determine transmittance and absorptances of sunlit window. - if (dataConstruction.Construct(K).TransDiff > 0.0) { + if (state.dataConstruction->Construct(K).TransDiff > 0.0) { if (!CalcSkyDifShading) { // Overlaps calculation is only done for beam solar // shading, not for sky diffuse solar shading @@ -9900,7 +9901,7 @@ namespace SolarShading { SurfWinShadingFlag(ISurf) = NoShade; SurfWinFracTimeShadingDeviceOn(ISurf) = 0.0; if (SurfWinWindowModelType(ISurf) == WindowEQLModel) { - int EQLNum = dataConstruction.Construct(Surface(ISurf).Construction).EQLConsPtr; + int EQLNum = state.dataConstruction->Construct(Surface(ISurf).Construction).EQLConsPtr; if (CFS(EQLNum).VBLayerPtr > 0) { if (CFS(EQLNum).L(CFS(EQLNum).VBLayerPtr).CNTRL == state.dataWindowEquivalentLayer->lscNONE) { SurfWinSlatAngThisTSDeg(ISurf) = CFS(EQLNum).L(CFS(EQLNum).VBLayerPtr).PHI_DEG; @@ -9912,7 +9913,7 @@ namespace SolarShading { // Initialization of complex fenestration shading device if (SurfWinWindowModelType(ISurf) == WindowBSDFModel) { - auto &construction(dataConstruction.Construct(Surface(ISurf).Construction)); + auto &construction(state.dataConstruction->Construct(Surface(ISurf).Construction)); auto &surface_window(SurfaceWindow(ISurf)); int TotLayers = construction.TotLayers; for (auto Lay = 1; Lay <= TotLayers; ++Lay) { @@ -9923,7 +9924,7 @@ namespace SolarShading { if (isShading && Lay == TotLayers) SurfWinShadingFlag(ISurf) = IntShadeOn; } if (SurfWinShadingFlag(ISurf) == IntShadeOn) { - auto &construction(dataConstruction.Construct(Surface(ISurf).Construction)); + auto &construction(state.dataConstruction->Construct(Surface(ISurf).Construction)); const int TotLay = construction.TotLayers; int ShadingLayerPtr = construction.LayerPoint(TotLay); ShadingLayerPtr = dataMaterial.Material(ShadingLayerPtr).ComplexShadePtr; @@ -9954,7 +9955,7 @@ namespace SolarShading { IConst = Surface(ISurf).Construction; // Vis trans at normal incidence of unswitched glass. Counting the GlazedFrac if (IConst > 0) - SurfWinVisTransSelected(ISurf) = POLYF(1.0, dataConstruction.Construct(IConst).TransVisBeamCoef) * + SurfWinVisTransSelected(ISurf) = POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(ISurf); @@ -10223,7 +10224,7 @@ namespace SolarShading { // Vis trans at normal incidence of fully switched glass IConst = Surface(ISurf).activeShadedConstruction; SurfWinVisTransSelected(ISurf) = - POLYF(1.0, dataConstruction.Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(ISurf); + POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * SurfWinGlazedFrac(ISurf); } // Slat angle control for blinds @@ -11012,7 +11013,7 @@ namespace SolarShading { SurfaceWindow(SurfNum).InOutProjSLFracMult(HourNum) = 1.0 - (FracShFDin + FracShFDOut); } - void CalcBeamSolarOnWinRevealSurface() + void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -11217,7 +11218,7 @@ namespace SolarShading { ConstrNumSh = Surface(SurfNum).activeStormWinShadedConstruction; } SolTransGlass = POLYF(CosIncAng(TimeStep, HourOfDay, SurfNum), - dataConstruction.Construct(ConstrNum).TransSolBeamCoef); + state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); TanProfileAngVert = SurfWinTanProfileAngVert(SurfNum); TanProfileAngHor = SurfWinTanProfileAngHor(SurfNum); FrameDivNum = Surface(SurfNum).FrameDivider; @@ -11445,13 +11446,13 @@ namespace SolarShading { if (A2ill > 1.0e-6) { - DiffReflGlass = dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; + DiffReflGlass = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; if (ShadeFlag == SwitchableGlazing) { SolTransGlassSh = POLYF(CosIncAng(TimeStep, HourOfDay, SurfNum), - dataConstruction.Construct(ConstrNumSh).TransSolBeamCoef); + state.dataConstruction->Construct(ConstrNumSh).TransSolBeamCoef); SolTransGlass = InterpSw(SurfWinSwitchingFactor(SurfNum), SolTransGlass, SolTransGlassSh); - DiffReflGlassSh = dataConstruction.Construct(ConstrNumSh).ReflectSolDiffBack; + DiffReflGlassSh = state.dataConstruction->Construct(ConstrNumSh).ReflectSolDiffBack; DiffReflGlass = InterpSw(SurfWinSwitchingFactor(SurfNum), DiffReflGlass, DiffReflGlassSh); } @@ -11769,7 +11770,7 @@ namespace SolarShading { } } - void ComputeWinShadeAbsorpFactors() + void ComputeWinShadeAbsorpFactors(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -11804,20 +11805,20 @@ namespace SolarShading { WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_ExteriorShade || WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_BetweenGlassShade) { int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; // Window construction number with shade - int TotLay = dataConstruction.Construct(ConstrNumSh).TotLayers; // Total layers in a construction + int TotLay = state.dataConstruction->Construct(ConstrNumSh).TotLayers; // Total layers in a construction if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_InteriorShade) { - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay); // Interior shade + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay); // Interior shade } else if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_ExteriorShade) { - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(1); // Exterior shade + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1); // Exterior shade } else if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_BetweenGlassShade) { - if (dataConstruction.Construct(ConstrNumSh).TotGlassLayers == 2) { + if (state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers == 2) { // Double pane with between-glass shade - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(3); + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(3); } else { // Triple pane with between-glass shade - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(5); + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(5); } } AbsorpEff = dataMaterial.Material(MatNumSh).AbsorpSolar / @@ -11991,11 +11992,11 @@ namespace SolarShading { // Calculate diffuse solar from current exterior window absorbed and reflected by current heat transfer surface // And calculate transmitted diffuse solar to adjacent zones through interior windows int ConstrNum = Surface(HeatTransSurfNum).Construction; - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Interior Opaque Surface + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Interior Opaque Surface // Determine the inside (back) diffuse solar absorptance // and reflectance of the current heat transfer surface - InsideDifAbsorptance = dataConstruction.Construct(ConstrNum).InsideAbsorpSolar; + InsideDifAbsorptance = state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar; // Check for movable insulation; reproduce code from subr. EvalInsideMovableInsulation; // Can't call that routine here since cycle prevents SolarShadingGeometry from USEing // HeatBalanceSurfaceManager, which contains EvalInsideMovableInsulation @@ -12046,7 +12047,7 @@ namespace SolarShading { ConstrNum = Surface(HeatTransSurfNum).StormWinConstruction; ConstrNumSh = Surface(HeatTransSurfNum).activeStormWinShadedConstruction; } - int TotGlassLayers = dataConstruction.Construct(ConstrNum).TotGlassLayers; + int TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; int ShadeFlag = SurfWinShadingFlag(HeatTransSurfNum); if (SurfWinWindowModelType(HeatTransSurfNum) != WindowEQLModel) { @@ -12059,8 +12060,8 @@ namespace SolarShading { // to account for layer by layer transmittance and reflection effects. for (int IGlass = 1; IGlass <= TotGlassLayers; ++IGlass) { // Calc diffuse solar absorbed from the inside by each window glass layer [W] - AbsInt = dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass); - WinDifSolLayAbsW = WinDifSolarTrans_Factor * dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass); + AbsInt = state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass); + WinDifSolLayAbsW = WinDifSolarTrans_Factor * state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass); // Accumulate distributed diffuse solar absorbed [W] by overall window for transmittance calc below DifSolarAbsW += WinDifSolLayAbsW; @@ -12079,8 +12080,8 @@ namespace SolarShading { // Reflected diffuse solar [W] = current window transmitted diffuse solar // * view factor from current (sending) window DifTransSurfNum to current (receiving) surface HeatTransSurfNum // * current window inside solar reflectance - InsideDifReflectance = dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; - DifSolarReflW = WinDifSolarTrans_Factor * dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; + InsideDifReflectance = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; + DifSolarReflW = WinDifSolarTrans_Factor * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; // Accumulate total reflected distributed diffuse solar for each zone for subsequent interreflection calcs InitialZoneDifSolReflW(enclosureNum) += DifSolarReflW; // [W] @@ -12123,7 +12124,7 @@ namespace SolarShading { int const adjEnclosureNum = Surface(AdjSurfNum).SolarEnclIndex; // Call routine to distribute diffuse solar transmitted through this interior window into adjacent zone - CalcInteriorWinTransDifSolInitialDistribution(adjEnclosureNum, AdjSurfNum, DifSolarTransW); + CalcInteriorWinTransDifSolInitialDistribution(state, adjEnclosureNum, AdjSurfNum, DifSolarTransW); } else { // this is an exterior window surface @@ -12149,7 +12150,7 @@ namespace SolarShading { WinDifSolLayAbsW = 0.0; // First calc diffuse solar absorbed by each glass layer in this window with shade/blind in place - auto const &construct_sh(dataConstruction.Construct(ConstrNumSh)); + auto const &construct_sh(state.dataConstruction->Construct(ConstrNumSh)); auto const &construct_sh_AbsDiffBack(construct_sh.AbsDiffBack); auto const &construct_sh_BlAbsDiffBack(construct_sh.BlAbsDiffBack); for (int IGlass = 1; IGlass <= construct_sh.TotGlassLayers; ++IGlass) { @@ -12177,11 +12178,11 @@ namespace SolarShading { // Next calc diffuse solar reflected back to zone from window with shade or blind on // Diffuse back solar reflectance, bare glass or shade on - InsideDifReflectance = dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; + InsideDifReflectance = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn) { // Diffuse back solar reflectance, blind present, vs. slat angle InsideDifReflectance = - InterpSlatAng(HTsurf_slat_ang, HTsurf_movable_slats, dataConstruction.Construct(ConstrNum).BlReflectSolDiffBack); + InterpSlatAng(HTsurf_slat_ang, HTsurf_movable_slats, state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffBack); } DifSolarReflW = WinDifSolarTrans_Factor * InsideDifReflectance; @@ -12231,9 +12232,9 @@ namespace SolarShading { // Init accumulator for transmittance calc below DifSolarAbsW = 0.0; - auto const &construct(dataConstruction.Construct(ConstrNum)); + auto const &construct(state.dataConstruction->Construct(ConstrNum)); auto const &construct_AbsDiffBack(construct.AbsDiffBack); - auto const &construct_sh(dataConstruction.Construct(ConstrNumSh)); + auto const &construct_sh(state.dataConstruction->Construct(ConstrNumSh)); auto const &construct_sh_AbsDiffBack(construct_sh.AbsDiffBack); for (int IGlass = 1; IGlass <= TotGlassLayers; ++IGlass) { // Calc diffuse solar absorbed in each window glass layer @@ -12280,7 +12281,7 @@ namespace SolarShading { // call the ASHWAT fenestration model for diffuse radiation here WindowEquivalentLayer::CalcEQLOpticalProperty(state, HeatTransSurfNum, isDIFF, AbsSolDiffBackEQL); - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; for (Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { // Calc diffuse solar absorbed from the inside by each layer of EQL model [W] @@ -12307,8 +12308,8 @@ namespace SolarShading { // Reflected diffuse solar [W] = current window transmitted diffuse solar // * view factor from current (sending) window DifTransSurfNum to current (receiving) surface HeatTransSurfNum // * current window inside solar reflectance - InsideDifReflectance = dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; - DifSolarReflW = WinDifSolarTrans_Factor * dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; + InsideDifReflectance = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; + DifSolarReflW = WinDifSolarTrans_Factor * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; // Accumulate total reflected distributed diffuse solar for each zone for subsequent interreflection calcs InitialZoneDifSolReflW(enclosureNum) += DifSolarReflW; // [W] @@ -12339,7 +12340,7 @@ namespace SolarShading { // Get the adjacent zone index int adjEnclosureNum = Surface(AdjSurfNum).SolarEnclIndex; // Call routine to distribute diffuse solar transmitted through this interior window into adjacent zone - CalcInteriorWinTransDifSolInitialDistribution(adjEnclosureNum, AdjSurfNum, DifSolarTransW); + CalcInteriorWinTransDifSolInitialDistribution(state, adjEnclosureNum, AdjSurfNum, DifSolarTransW); } else { // this is an exterior window surface @@ -12411,6 +12412,7 @@ namespace SolarShading { } // ZoneNum = 1, NumOfZones } void CalcInteriorWinTransDifSolInitialDistribution( + EnergyPlusData &state, int const IntWinEnclosureNum, // Interior Window Enclosure index number int const IntWinSurfNum, // Interior Window Surface number Real64 const IntWinDifSolarTransW // Diffuse Solar transmitted through Interior Window IntWinSurfNum from adjacent enclosure [W] @@ -12531,11 +12533,11 @@ namespace SolarShading { // Calculate diffuse solar from current interior window absorbed and reflected by current heat transfer surface // And calculate transmitted diffuse solar to adjacent zones through interior windows int ConstrNum = Surface(HeatTransSurfNum).Construction; - if (dataConstruction.Construct(ConstrNum).TransDiff <= 0.0) { // Interior Opaque Surface + if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Interior Opaque Surface // Determine the inside (back) diffuse solar absorptance // and reflectance of the current heat transfer surface - InsideDifAbsorptance = dataConstruction.Construct(ConstrNum).InsideAbsorpSolar; + InsideDifAbsorptance = state.dataConstruction->Construct(ConstrNum).InsideAbsorpSolar; // Check for movable insulation; reproduce code from subr. EvalInsideMovableInsulation; // Can't call that routine here since cycle prevents SolarShadingGeometry from USEing // HeatBalanceSurfaceManager, which contains EvalInsideMovableInsulation @@ -12587,7 +12589,7 @@ namespace SolarShading { ConstrNum = Surface(HeatTransSurfNum).StormWinConstruction; ConstrNumSh = Surface(HeatTransSurfNum).activeStormWinShadedConstruction; } - TotGlassLayers = dataConstruction.Construct(ConstrNum).TotGlassLayers; + TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; ShadeFlag = SurfWinShadingFlag(HeatTransSurfNum); if (ShadeFlag <= 0) { // No window shading @@ -12599,8 +12601,8 @@ namespace SolarShading { // to account for layer by layer transmittance and reflection effects. for (IGlass = 1; IGlass <= TotGlassLayers; ++IGlass) { // Calc diffuse solar absorbed from the inside by each window glass layer [W] - AbsInt = dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass); - WinDifSolLayAbsW = SolarTrans_ViewFactor * dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass); + AbsInt = state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass); + WinDifSolLayAbsW = SolarTrans_ViewFactor * state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass); // Accumulate distributed diffuse solar absorbed [W] by overall window for transmittance calc below DifSolarAbsW += WinDifSolLayAbsW; @@ -12618,7 +12620,7 @@ namespace SolarShading { // Reflected diffuse solar [W] = current window transmitted diffuse solar // * view factor from current (sending) window IntWinSurfNum to current (receiving) surface HeatTransSurfNum // * current window inside solar reflectance - DifSolarReflW = SolarTrans_ViewFactor * dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; + DifSolarReflW = SolarTrans_ViewFactor * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; // Accumulate total reflected distributed diffuse solar for each zone for subsequent interreflection calcs InitialZoneDifSolReflW_zone += DifSolarReflW; // [W] @@ -12668,16 +12670,16 @@ namespace SolarShading { WinDifSolLayAbsW = 0.0; // First calc diffuse solar absorbed by each glass layer in this window with shade/blind in place - for (IGlass = 1; IGlass <= dataConstruction.Construct(ConstrNumSh).TotGlassLayers; ++IGlass) { + for (IGlass = 1; IGlass <= state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; ++IGlass) { if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || ShadeFlag == ExtScreenOn) { // Calc diffuse solar absorbed in each window glass layer and shade - WinDifSolLayAbsW = SolarTrans_ViewFactor * dataConstruction.Construct(ConstrNumSh).AbsDiffBack(IGlass); + WinDifSolLayAbsW = SolarTrans_ViewFactor * state.dataConstruction->Construct(ConstrNumSh).AbsDiffBack(IGlass); } if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn || ShadeFlag == BGBlindOn) { BlAbsDiffBk = InterpSlatAng(SurfWinSlatAngThisTS(HeatTransSurfNum), SurfWinMovableSlats(HeatTransSurfNum), - dataConstruction.Construct(ConstrNumSh).BlAbsDiffBack(_, IGlass)); + state.dataConstruction->Construct(ConstrNumSh).BlAbsDiffBack(_, IGlass)); // Calc diffuse solar absorbed in each window glass layer and shade WinDifSolLayAbsW = SolarTrans_ViewFactor * BlAbsDiffBk; } @@ -12694,12 +12696,12 @@ namespace SolarShading { // Next calc diffuse solar reflected back to zone from window with shade or blind on // Diffuse back solar reflectance, bare glass or shade on - InsideDifReflectance = dataConstruction.Construct(ConstrNum).ReflectSolDiffBack; + InsideDifReflectance = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn) { // Diffuse back solar reflectance, blind present, vs. slat angle InsideDifReflectance = InterpSlatAng(SurfWinSlatAngThisTS(HeatTransSurfNum), SurfWinMovableSlats(HeatTransSurfNum), - dataConstruction.Construct(ConstrNum).BlReflectSolDiffBack); + state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffBack); } DifSolarReflW = SolarTrans_ViewFactor * InsideDifReflectance; @@ -12714,13 +12716,13 @@ namespace SolarShading { BlNum = SurfWinBlindNumber(HeatTransSurfNum); if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || ShadeFlag == ExtScreenOn) { // Calc diffuse solar absorbed by shade or screen [W] - ShBlDifSolarAbsW = SolarTrans_ViewFactor * dataConstruction.Construct(ConstrNumSh).AbsDiffBackShade; + ShBlDifSolarAbsW = SolarTrans_ViewFactor * state.dataConstruction->Construct(ConstrNumSh).AbsDiffBackShade; } if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn || ShadeFlag == BGBlindOn) { // Calc diffuse solar absorbed by blind [W] AbsDiffBkBl = InterpSlatAng(SurfWinSlatAngThisTS(HeatTransSurfNum), SurfWinMovableSlats(HeatTransSurfNum), - dataConstruction.Construct(ConstrNumSh).AbsDiffBackBlind); + state.dataConstruction->Construct(ConstrNumSh).AbsDiffBackBlind); ShBlDifSolarAbsW = SolarTrans_ViewFactor * AbsDiffBkBl; } // Correct for divider shadowing @@ -12754,8 +12756,8 @@ namespace SolarShading { for (IGlass = 1; IGlass <= TotGlassLayers; ++IGlass) { // Calc diffuse solar absorbed in each window glass layer WinDifSolLayAbsW = SolarTrans_ViewFactor * InterpSw(SurfWinSwitchingFactor(HeatTransSurfNum), - dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass), - dataConstruction.Construct(ConstrNumSh).AbsDiffBack(IGlass)); + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass), + state.dataConstruction->Construct(ConstrNumSh).AbsDiffBack(IGlass)); // Accumulate distributed diffuse solar absorbed [W] by overall window for transmittance calc below DifSolarAbsW += WinDifSolLayAbsW; @@ -12769,8 +12771,8 @@ namespace SolarShading { // Calc diffuse solar reflected back to zone DifSolarReflW = SolarTrans_ViewFactor * InterpSw(SurfWinSwitchingFactor(HeatTransSurfNum), - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack, - dataConstruction.Construct(ConstrNumSh).ReflectSolDiffBack); + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack, + state.dataConstruction->Construct(ConstrNumSh).ReflectSolDiffBack); // Accumulate total reflected distributed diffuse solar for each zone for subsequent interreflection calcs InitialZoneDifSolReflW_zone += DifSolarReflW; // [W] @@ -12832,7 +12834,8 @@ namespace SolarShading { // WinDifSolarTrans } - void CalcComplexWindowOverlap(BSDFGeomDescr &Geom, // State Geometry + void CalcComplexWindowOverlap(EnergyPlusData &state, + BSDFGeomDescr &Geom, // State Geometry BSDFWindowGeomDescr const &Window, // Window Geometry int const ISurf // Surface number of the complex fenestration ) @@ -13001,9 +13004,9 @@ namespace SolarShading { for (KBkSurf = 1; KBkSurf <= Window.NBkSurf; ++KBkSurf) { // back surf loop BackSurfaceNumber = ShadowComb(BaseSurf).BackSurf(KBkSurf); IConst = Surface(BackSurfaceNumber).Construction; - InsideConLay = dataConstruction.Construct(IConst).TotLayers; + InsideConLay = state.dataConstruction->Construct(IConst).TotLayers; if (SurfWinWindowModelType(BackSurfaceNumber) == WindowBSDFModel) { - VisibleReflectance = dataConstruction.Construct(IConst).ReflectVisDiffBack; + VisibleReflectance = state.dataConstruction->Construct(IConst).ReflectVisDiffBack; } else { VisibleReflectance = (1.0 - dataMaterial.Material(InsideConLay).AbsorpVisible); } @@ -13053,7 +13056,7 @@ namespace SolarShading { for (iState = 1; iState <= NumOfStates; ++iState) { // do initialization only once if (ComplexWind(iSurf).Geom(iState).InitState) { - CalcComplexWindowOverlap(ComplexWind(iSurf).Geom(iState), ComplexWind(iSurf), iSurf); + CalcComplexWindowOverlap(state, ComplexWind(iSurf).Geom(iState), ComplexWind(iSurf), iSurf); ComplexWind(iSurf).Geom(iState).InitState = false; } } diff --git a/src/EnergyPlus/SolarShading.hh b/src/EnergyPlus/SolarShading.hh index 4ee4cdbb688..9ac6f9a97dc 100644 --- a/src/EnergyPlus/SolarShading.hh +++ b/src/EnergyPlus/SolarShading.hh @@ -235,7 +235,7 @@ namespace SolarShading { bool const ignorey, bool const ignorez); - void ComputeIntSolarAbsorpFactors(); + void ComputeIntSolarAbsorpFactors(EnergyPlusData &state); void CLIP(int const NVT, Array1D &XVT, Array1D &YVT, Array1D &ZVT); @@ -310,7 +310,7 @@ namespace SolarShading { void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const iTimeStep); - void DetermineShadowingCombinations(); + void DetermineShadowingCombinations(EnergyPlusData &state); void SHADOW(EnergyPlusData &state, int const iHour, // Hour index @@ -341,7 +341,7 @@ namespace SolarShading { void CalcInteriorSolarDistribution(EnergyPlusData &state); - void CalcAborbedOnExteriorOpaqueSurfaces(); + void CalcAbsorbedOnExteriorOpaqueSurfaces(EnergyPlusData &state); void CalcInteriorSolarDistributionWCE(EnergyPlusData &state); @@ -362,7 +362,8 @@ namespace SolarShading { int const Hour, int const TS); - void SHDSBS(int const iHour, // Hour Index + void SHDSBS(EnergyPlusData &state, + int const iHour, // Hour Index int const CurSurf, int const NBKS, // Number of back surfaces int const NSBS, // Number of subsurfaces @@ -396,23 +397,25 @@ namespace SolarShading { int const HourNum // Hour number ); - void CalcBeamSolarOnWinRevealSurface(); + void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state); void ReportSurfaceShading(); void ReportSurfaceErrors(); - void ComputeWinShadeAbsorpFactors(); + void ComputeWinShadeAbsorpFactors(EnergyPlusData &state); void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state); void CalcInteriorWinTransDifSolInitialDistribution( + EnergyPlusData &state, int const IntWinEnclosureNum, // Interior Window Enclosure index number int const IntWinSurfNum, // Interior Window Surface number Real64 const IntWinDifSolarTransW // Diffuse Solar transmitted through Interior Window IntWinSurfNum from adjacent enclosure [W] ); - void CalcComplexWindowOverlap(BSDFGeomDescr &Geom, // State Geometry + void CalcComplexWindowOverlap(EnergyPlusData &state, + BSDFGeomDescr &Geom, // State Geometry BSDFWindowGeomDescr const &Window, // Window Geometry int const ISurf // Surface number of the complex fenestration ); diff --git a/src/EnergyPlus/StateManagement.cc b/src/EnergyPlus/StateManagement.cc index f6575c02a1e..5e7c26fefcf 100644 --- a/src/EnergyPlus/StateManagement.cc +++ b/src/EnergyPlus/StateManagement.cc @@ -224,15 +224,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include void EnergyPlus::clearAllStates(EnergyPlusData &state) { @@ -247,7 +238,7 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) DataBranchAirLoopPlant::clear_state(); DataAirSystems::clear_state(); DataBranchNodeConnections::clear_state(); - dataConstruction.clear_state(); + state.dataConstruction->clear_state(); DataContaminantBalance::clear_state(); DataConvergParams::clear_state(); DataDefineEquip::clear_state(); @@ -412,8 +403,6 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) UnitVentilator::clear_state(); UserDefinedComponents::clear_state(); UtilityRoutines::clear_state(); - VariableSpeedCoils::clear_state(); - VentilatedSlab::clear_state(); EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::clear_state(); ResultsFramework::clear_state(); } diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 32b6775005d..f49d19ac027 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -450,9 +450,9 @@ namespace SurfaceGeometry { GetStormWindowData(state, ErrorsFound); - if (!ErrorsFound && TotStormWin > 0) CreateStormWindowConstructions(); + if (!ErrorsFound && TotStormWin > 0) CreateStormWindowConstructions(state); - SetFlagForWindowConstructionWithShadeOrBlindLayer(); + SetFlagForWindowConstructionWithShadeOrBlindLayer(state); CosZoneRelNorth.deallocate(); SinZoneRelNorth.deallocate(); @@ -503,12 +503,12 @@ namespace SurfaceGeometry { if (!Surface(SurfNum).HeatTransSurf && !Surface(SurfNum).IsAirBoundarySurf) continue; // Skip shadowing (sub)surfaces ZoneNum = Surface(SurfNum).Zone; Zone(ZoneNum).TotalSurfArea += Surface(SurfNum).Area; - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) { + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) { Zone(ZoneNum).TotalSurfArea += SurfWinFrameArea(SurfNum); Zone(ZoneNum).HasWindow = true; } if (Surface(SurfNum).Class == SurfaceClass_Roof) ZoneCeilingArea(ZoneNum) += Surface(SurfNum).Area; - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) { + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) { if (Surface(SurfNum).ExtBoundCond == ExternalEnvironment || Surface(SurfNum).ExtBoundCond == OtherSideCondModeledExt) { Zone(ZoneNum).ExteriorTotalSurfArea += Surface(SurfNum).GrossArea; if (Surface(SurfNum).Class == SurfaceClass_Wall) { @@ -865,7 +865,7 @@ namespace SurfaceGeometry { } // ZoneNum // Set up solar distribution enclosures allowing for any air boundaries - SetupEnclosuresAndAirBoundaries(DataViewFactorInformation::ZoneSolarInfo, SurfaceGeometry::enclosureType::SolarEnclosures, ErrorsFound); + SetupEnclosuresAndAirBoundaries(state, DataViewFactorInformation::ZoneSolarInfo, SurfaceGeometry::enclosureType::SolarEnclosures, ErrorsFound); // Do the Stratosphere check SetZoneOutBulbTempAt(); @@ -1287,7 +1287,7 @@ namespace SurfaceGeometry { SurfaceTmp(CurNewSurf).Zone = Found; SurfaceTmp(CurNewSurf).ZoneName = Zone(Found).Name; // Reverse Construction - SurfaceTmp(CurNewSurf).Construction = AssignReverseConstructionNumber(SurfaceTmp(SurfNum).Construction, SurfError); + SurfaceTmp(CurNewSurf).Construction = AssignReverseConstructionNumber(state, SurfaceTmp(SurfNum).Construction, SurfError); SurfaceTmp(CurNewSurf).ConstructionStoredInputValue = SurfaceTmp(CurNewSurf).Construction; // Reverse Vertices NVert = SurfaceTmp(SurfNum).Sides; @@ -1645,25 +1645,25 @@ namespace SurfaceGeometry { ConstrNum = Surface(SurfNum).Construction; ConstrNumFound = Surface(Found).Construction; if (ConstrNum <= 0 || ConstrNumFound <= 0) continue; - if (dataConstruction.Construct(ConstrNum).ReverseConstructionNumLayersWarning && - dataConstruction.Construct(ConstrNumFound).ReverseConstructionNumLayersWarning) + if (state.dataConstruction->Construct(ConstrNum).ReverseConstructionNumLayersWarning && + state.dataConstruction->Construct(ConstrNumFound).ReverseConstructionNumLayersWarning) continue; - if (dataConstruction.Construct(ConstrNum).ReverseConstructionLayersOrderWarning && - dataConstruction.Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning) + if (state.dataConstruction->Construct(ConstrNum).ReverseConstructionLayersOrderWarning && + state.dataConstruction->Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning) continue; - TotLay = dataConstruction.Construct(ConstrNum).TotLayers; - TotLayFound = dataConstruction.Construct(ConstrNumFound).TotLayers; + TotLay = state.dataConstruction->Construct(ConstrNum).TotLayers; + TotLayFound = state.dataConstruction->Construct(ConstrNumFound).TotLayers; if (TotLay != TotLayFound) { // Different number of layers // match on like Uvalues (nominal) if (std::abs(NominalU(ConstrNum) - NominalU(ConstrNumFound)) > 0.001) { - ShowSevereError(RoutineName + "Construction " + dataConstruction.Construct(ConstrNum).Name + " of interzone surface " + + ShowSevereError(RoutineName + "Construction " + state.dataConstruction->Construct(ConstrNum).Name + " of interzone surface " + Surface(SurfNum).Name + " does not have the same number of layers as the construction " + - dataConstruction.Construct(ConstrNumFound).Name + " of adjacent surface " + Surface(Found).Name); - if (!dataConstruction.Construct(ConstrNum).ReverseConstructionNumLayersWarning || - !dataConstruction.Construct(ConstrNumFound).ReverseConstructionNumLayersWarning) { + state.dataConstruction->Construct(ConstrNumFound).Name + " of adjacent surface " + Surface(Found).Name); + if (!state.dataConstruction->Construct(ConstrNum).ReverseConstructionNumLayersWarning || + !state.dataConstruction->Construct(ConstrNumFound).ReverseConstructionNumLayersWarning) { ShowContinueError("...this problem for this pair will not be reported again."); - dataConstruction.Construct(ConstrNum).ReverseConstructionNumLayersWarning = true; - dataConstruction.Construct(ConstrNumFound).ReverseConstructionNumLayersWarning = true; + state.dataConstruction->Construct(ConstrNum).ReverseConstructionNumLayersWarning = true; + state.dataConstruction->Construct(ConstrNumFound).ReverseConstructionNumLayersWarning = true; } SurfError = true; } @@ -1671,25 +1671,25 @@ namespace SurfaceGeometry { // check layers as number of layers is the same izConstDiff = false; // ok if same nominal U - CheckForReversedLayers(izConstDiff, ConstrNum, ConstrNumFound, TotLay); + CheckForReversedLayers(state, izConstDiff, ConstrNum, ConstrNumFound, TotLay); if (izConstDiff && std::abs(NominalU(ConstrNum) - NominalU(ConstrNumFound)) > 0.001) { - ShowSevereError(RoutineName + "Construction " + dataConstruction.Construct(ConstrNum).Name + " of interzone surface " + + ShowSevereError(RoutineName + "Construction " + state.dataConstruction->Construct(ConstrNum).Name + " of interzone surface " + Surface(SurfNum).Name + " does not have the same materials in the reverse order as the construction " + - dataConstruction.Construct(ConstrNumFound).Name + " of adjacent surface " + Surface(Found).Name); + state.dataConstruction->Construct(ConstrNumFound).Name + " of adjacent surface " + Surface(Found).Name); ShowContinueError("or the properties of the reversed layers are not correct due to differing layer front and back side values"); - if (!dataConstruction.Construct(ConstrNum).ReverseConstructionLayersOrderWarning || - !dataConstruction.Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning) { + if (!state.dataConstruction->Construct(ConstrNum).ReverseConstructionLayersOrderWarning || + !state.dataConstruction->Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning) { ShowContinueError("...this problem for this pair will not be reported again."); - dataConstruction.Construct(ConstrNum).ReverseConstructionLayersOrderWarning = true; - dataConstruction.Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning = true; + state.dataConstruction->Construct(ConstrNum).ReverseConstructionLayersOrderWarning = true; + state.dataConstruction->Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning = true; } SurfError = true; } else if (izConstDiff) { - ShowWarningError(RoutineName + "Construction " + dataConstruction.Construct(ConstrNum).Name + " of interzone surface " + + ShowWarningError(RoutineName + "Construction " + state.dataConstruction->Construct(ConstrNum).Name + " of interzone surface " + Surface(SurfNum).Name + " does not have the same materials in the reverse order as the construction " + - dataConstruction.Construct(ConstrNumFound).Name + " of adjacent surface " + Surface(Found).Name); + state.dataConstruction->Construct(ConstrNumFound).Name + " of adjacent surface " + Surface(Found).Name); ShowContinueError("or the properties of the reversed layers are not correct due to differing layer front and back side values"); ShowContinueError("...but Nominal U values are similar, diff=[" + RoundSigDigits(std::abs(NominalU(ConstrNum) - NominalU(ConstrNumFound)), 4) + @@ -1699,11 +1699,11 @@ namespace SurfaceGeometry { "\"reverse\" construction should be created."); izConstDiffMsg = true; } - if (!dataConstruction.Construct(ConstrNum).ReverseConstructionLayersOrderWarning || - !dataConstruction.Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning) { + if (!state.dataConstruction->Construct(ConstrNum).ReverseConstructionLayersOrderWarning || + !state.dataConstruction->Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning) { ShowContinueError("...this problem for this pair will not be reported again."); - dataConstruction.Construct(ConstrNum).ReverseConstructionLayersOrderWarning = true; - dataConstruction.Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning = true; + state.dataConstruction->Construct(ConstrNum).ReverseConstructionLayersOrderWarning = true; + state.dataConstruction->Construct(ConstrNumFound).ReverseConstructionLayersOrderWarning = true; } } } @@ -2103,8 +2103,8 @@ namespace SurfaceGeometry { // TH 1/7/2010. CR 7930 // The old code did not consider between-glass blind. Also there should not be two blinds - both interior and exterior // Use the new generic code (assuming only one blind) as follows - for (iTmp1 = 1; iTmp1 <= dataConstruction.Construct(ConstrNumSh).TotLayers; ++iTmp1) { - iTmp2 = dataConstruction.Construct(ConstrNumSh).LayerPoint(iTmp1); + for (iTmp1 = 1; iTmp1 <= state.dataConstruction->Construct(ConstrNumSh).TotLayers; ++iTmp1) { + iTmp2 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(iTmp1); if (dataMaterial.Material(iTmp2).Group == WindowBlind) { BlNum = dataMaterial.Material(iTmp2).BlindDataPtr; SurfWinBlindNumber(SurfNum) = BlNum; @@ -2169,14 +2169,14 @@ namespace SurfaceGeometry { // Check for EcoRoof and only 1 allowed to be used. if (!Surface(SurfNum).ExtEcoRoof) continue; if (LayNumOutside == 0) { - LayNumOutside = dataConstruction.Construct(Surface(SurfNum).Construction).LayerPoint(1); + LayNumOutside = state.dataConstruction->Construct(Surface(SurfNum).Construction).LayerPoint(1); continue; } - if (LayNumOutside != dataConstruction.Construct(Surface(SurfNum).Construction).LayerPoint(1)) { + if (LayNumOutside != state.dataConstruction->Construct(Surface(SurfNum).Construction).LayerPoint(1)) { ShowSevereError(RoutineName + "Only one EcoRoof Material is currently allowed for all constructions."); ShowContinueError("... first material=" + dataMaterial.Material(LayNumOutside).Name); - ShowContinueError("... conflicting Construction=" + dataConstruction.Construct(Surface(SurfNum).Construction).Name + - " uses material=" + dataMaterial.Material(dataConstruction.Construct(Surface(SurfNum).Construction).LayerPoint(1)).Name); + ShowContinueError("... conflicting Construction=" + state.dataConstruction->Construct(Surface(SurfNum).Construction).Name + + " uses material=" + dataMaterial.Material(state.dataConstruction->Construct(Surface(SurfNum).Construction).LayerPoint(1)).Name); ErrorsFound = true; } } @@ -2228,18 +2228,18 @@ namespace SurfaceGeometry { // Exclude duplicate shading surfaces if (Surface(SurfNum).MirroredSurf) continue; // Exclude air boundary surfaces - if (Surface(SurfNum).HeatTransSurf && dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsAirBoundary) continue; + if (Surface(SurfNum).HeatTransSurf && state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsAirBoundary) continue; Surface(SurfNum).ShadowSurfPossibleObstruction = true; } // Check for IRT surfaces in invalid places. iTmp1 = 0; - if (std::any_of(dataConstruction.Construct.begin(), dataConstruction.Construct.end(), [](Construction::ConstructionProps const &e) { return e.TypeIsIRT; })) { + if (std::any_of(state.dataConstruction->Construct.begin(), state.dataConstruction->Construct.end(), [](Construction::ConstructionProps const &e) { return e.TypeIsIRT; })) { for (int SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (!Surface(SurfNum).HeatTransSurf) continue; // ignore shading surfaces if (Surface(SurfNum).ExtBoundCond > 0 && Surface(SurfNum).ExtBoundCond != SurfNum) continue; // interzone, not adiabatic surface - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsIRT) { + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsIRT) { continue; } if (!DisplayExtraWarnings) { @@ -2306,7 +2306,7 @@ namespace SurfaceGeometry { GetSurfaceHeatTransferAlgorithmOverrides(state, ErrorsFound); // Set up enclosures, process Air Boundaries if any - SetupEnclosuresAndAirBoundaries(DataViewFactorInformation::ZoneRadiantInfo, SurfaceGeometry::enclosureType::RadiantEnclosures, ErrorsFound); + SetupEnclosuresAndAirBoundaries(state, DataViewFactorInformation::ZoneRadiantInfo, SurfaceGeometry::enclosureType::RadiantEnclosures, ErrorsFound); GetSurfaceSrdSurfsData(state, ErrorsFound); @@ -3176,13 +3176,13 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).Class = BaseSurfIDs(ClassItem); } - SurfaceTmp(SurfNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(ArgPointer), dataConstruction.Construct, TotConstructs); + SurfaceTmp(SurfNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(ArgPointer), state.dataConstruction->Construct, TotConstructs); if (SurfaceTmp(SurfNum).Construction == 0) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(ArgPointer) + "=\"" + cAlphaArgs(ArgPointer) + "\"."); - } else if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + } else if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(ArgPointer) + "=\"" + cAlphaArgs(ArgPointer) + "\" - has Window materials."); @@ -3192,7 +3192,7 @@ namespace SurfaceGeometry { ShowContinueError("...because Surface Type=" + BaseSurfCls(ClassItem)); } } else { - dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).IsUsed = true; + state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).IsUsed = true; SurfaceTmp(SurfNum).ConstructionStoredInputValue = SurfaceTmp(SurfNum).Construction; } SurfaceTmp(SurfNum).HeatTransSurf = true; @@ -3252,15 +3252,15 @@ namespace SurfaceGeometry { } } if (SurfaceTmp(SurfNum).Construction > 0) { - if (SurfaceTmp(SurfNum).Class == SurfaceClass_Wall && !dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { + if (SurfaceTmp(SurfNum).Class == SurfaceClass_Wall && !state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(ArgPointer)); - ShowContinueError("Construction=\"" + dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).Name + + ShowContinueError("Construction=\"" + state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).Name + "\" is not type Construction:CfactorUndergroundWall."); ErrorsFound = true; } - if (SurfaceTmp(SurfNum).Class == SurfaceClass_Floor && !dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { + if (SurfaceTmp(SurfNum).Class == SurfaceClass_Floor && !state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(ArgPointer)); - ShowContinueError("Construction=\"" + dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).Name + + ShowContinueError("Construction=\"" + state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).Name + "\" is not type Construction:FfactorGroundFloor."); ErrorsFound = true; } @@ -3343,7 +3343,7 @@ namespace SurfaceGeometry { } } - if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { + if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", construction may not have an internal source/sink"); ErrorsFound = true; @@ -3412,7 +3412,7 @@ namespace SurfaceGeometry { } // Set the logical flag for the EcoRoof presented, this is only based on the flag in the construction type - if (SurfaceTmp(SurfNum).Construction > 0) SurfaceTmp(SurfNum).ExtEcoRoof = dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsEcoRoof; + if (SurfaceTmp(SurfNum).Construction > 0) SurfaceTmp(SurfNum).ExtEcoRoof = state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsEcoRoof; SurfaceTmp(SurfNum).ViewFactorGround = rNumericArgs(1); if (lNumericFieldBlanks(1)) SurfaceTmp(SurfNum).ViewFactorGround = AutoCalculate; @@ -3460,8 +3460,8 @@ namespace SurfaceGeometry { } if (SurfaceTmp(SurfNum).Construction > 0) { // Check wall height for the CFactor walls - if (SurfaceTmp(SurfNum).Class == SurfaceClass_Wall && dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { - if (std::abs(SurfaceTmp(SurfNum).Height - dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).Height) > 0.05) { + if (SurfaceTmp(SurfNum).Class == SurfaceClass_Wall && state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { + if (std::abs(SurfaceTmp(SurfNum).Height - state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).Height) > 0.05) { ShowWarningError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", underground Wall Height = " + TrimSigDigits(SurfaceTmp(SurfNum).Height, 2)); ShowContinueError("..which does not match its construction height."); @@ -3469,13 +3469,13 @@ namespace SurfaceGeometry { } // Check area and perimeter for the FFactor floors - if (SurfaceTmp(SurfNum).Class == SurfaceClass_Floor && dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { - if (std::abs(SurfaceTmp(SurfNum).Area - dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).Area) > 0.1) { + if (SurfaceTmp(SurfNum).Class == SurfaceClass_Floor && state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { + if (std::abs(SurfaceTmp(SurfNum).Area - state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).Area) > 0.1) { ShowWarningError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", underground Floor Area = " + TrimSigDigits(SurfaceTmp(SurfNum).Area, 2)); ShowContinueError("..which does not match its construction area."); } - if (SurfaceTmp(SurfNum).Perimeter < dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).PerimeterExposed - 0.1) { + if (SurfaceTmp(SurfNum).Perimeter < state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).PerimeterExposed - 0.1) { ShowWarningError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", underground Floor Perimeter = " + TrimSigDigits(SurfaceTmp(SurfNum).Perimeter, 2)); ShowContinueError("..which is less than its construction exposed perimeter."); @@ -3658,19 +3658,19 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).Name = cAlphaArgs(1); // Set the Surface Name in the Derived Type SurfaceTmp(SurfNum).Class = BaseSurfIDs(ClassItem); // Set class number - SurfaceTmp(SurfNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct, TotConstructs); + SurfaceTmp(SurfNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct, TotConstructs); if (SurfaceTmp(SurfNum).Construction == 0) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); - } else if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + } else if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(2) + "\" - has Window materials."); ShowContinueError("...because " + cAlphaFieldNames(2) + '=' + cAlphaArgs(2)); } else { - dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).IsUsed = true; + state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).IsUsed = true; SurfaceTmp(SurfNum).ConstructionStoredInputValue = SurfaceTmp(SurfNum).Construction; } SurfaceTmp(SurfNum).HeatTransSurf = true; @@ -3692,18 +3692,18 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).ExtBoundCond = ExtBoundCondition; if (SurfaceTmp(SurfNum).Construction > 0) { - if (SurfaceTmp(SurfNum).Class == SurfaceClass_Wall && dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall && + if (SurfaceTmp(SurfNum).Class == SurfaceClass_Wall && state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall && SurfaceTmp(SurfNum).ExtBoundCond == Ground) { SurfaceTmp(SurfNum).ExtBoundCond = GroundFCfactorMethod; - } else if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { + } else if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", Construction type is \"Construction:CfactorUndergroundWall\" but invalid for this object."); } - if (SurfaceTmp(SurfNum).Class == SurfaceClass_Floor && dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor && + if (SurfaceTmp(SurfNum).Class == SurfaceClass_Floor && state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor && SurfaceTmp(SurfNum).ExtBoundCond == Ground) { SurfaceTmp(SurfNum).ExtBoundCond = GroundFCfactorMethod; - } else if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { + } else if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", Construction type is \"Construction:FfactorGroundFloor\" but invalid for this object."); @@ -3719,7 +3719,7 @@ namespace SurfaceGeometry { // Set the logical flag for the EcoRoof presented, this is only based on the flag in the construction type if (SurfaceTmp(SurfNum).Construction > 0) - SurfaceTmp(SurfNum).ExtEcoRoof = dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsEcoRoof; + SurfaceTmp(SurfNum).ExtEcoRoof = state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsEcoRoof; } else if (SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { if (GettingIZSurfaces) { @@ -3785,7 +3785,7 @@ namespace SurfaceGeometry { // Check wall height for the CFactor walls if (SurfaceTmp(SurfNum).Class == SurfaceClass_Wall && SurfaceTmp(SurfNum).ExtBoundCond == GroundFCfactorMethod) { - if (std::abs(SurfaceTmp(SurfNum).Height - dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).Height) > 0.05) { + if (std::abs(SurfaceTmp(SurfNum).Height - state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).Height) > 0.05) { ShowWarningError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", underground Wall Height = " + TrimSigDigits(SurfaceTmp(SurfNum).Height, 2)); ShowContinueError("..which deos not match its construction height."); @@ -3794,12 +3794,12 @@ namespace SurfaceGeometry { // Check area and perimeter for the FFactor floors if (SurfaceTmp(SurfNum).Class == SurfaceClass_Floor && SurfaceTmp(SurfNum).ExtBoundCond == GroundFCfactorMethod) { - if (std::abs(SurfaceTmp(SurfNum).Area - dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).Area) > 0.1) { + if (std::abs(SurfaceTmp(SurfNum).Area - state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).Area) > 0.1) { ShowWarningError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", underground Floor Area = " + TrimSigDigits(SurfaceTmp(SurfNum).Area, 2)); ShowContinueError("..which does not match its construction area."); } - if (SurfaceTmp(SurfNum).Perimeter < dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).PerimeterExposed - 0.1) { + if (SurfaceTmp(SurfNum).Perimeter < state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).PerimeterExposed - 0.1) { ShowWarningError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", underground Floor Perimeter = " + TrimSigDigits(SurfaceTmp(SurfNum).Perimeter, 2)); ShowContinueError("..which is less than its construction exposed perimeter."); @@ -4158,14 +4158,14 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).Class = SubSurfIDs(ValidChk); // Set class number } - SurfaceTmp(SurfNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(3), dataConstruction.Construct, TotConstructs); + SurfaceTmp(SurfNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataConstruction->Construct, TotConstructs); if (SurfaceTmp(SurfNum).Construction == 0) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); } else { - dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).IsUsed = true; + state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).IsUsed = true; SurfaceTmp(SurfNum).ConstructionStoredInputValue = SurfaceTmp(SurfNum).Construction; } @@ -4173,12 +4173,12 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).Class == SurfaceClass_TDD_Diffuser || SurfaceTmp(SurfNum).Class == SurfaceClass_TDD_Dome) { if (SurfaceTmp(SurfNum).Construction != 0) { - if (!dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + if (!state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\" has an opaque surface construction; it should have a window construction."); } - if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { + if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\": Windows are not allowed to have embedded sources/sinks"); @@ -4186,7 +4186,7 @@ namespace SurfaceGeometry { } } else if (SurfaceTmp(SurfNum).Construction != 0) { - if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\" - has Window materials."); @@ -4358,9 +4358,9 @@ namespace SurfaceGeometry { ErrorsFound = true; } - InitialAssociateWindowShadingControlFenestration(ErrorsFound, SurfNum); + InitialAssociateWindowShadingControlFenestration(state, ErrorsFound, SurfNum); - CheckWindowShadingControlFrameDivider("GetHTSubSurfaceData", ErrorsFound, SurfNum, 6); + CheckWindowShadingControlFrameDivider(state, "GetHTSubSurfaceData", ErrorsFound, SurfNum, 6); if (SurfaceTmp(SurfNum).Sides == 3) { // Triangular window if (!cAlphaArgs(6).empty()) { @@ -4374,7 +4374,7 @@ namespace SurfaceGeometry { } // check on non-opaquedoor subsurfaces - CheckSubSurfaceMiscellaneous("GetHTSubSurfaceData", ErrorsFound, SurfNum, cAlphaArgs(1), cAlphaArgs(3), AddedSubSurfaces); + CheckSubSurfaceMiscellaneous(state, "GetHTSubSurfaceData", ErrorsFound, SurfNum, cAlphaArgs(1), cAlphaArgs(3), AddedSubSurfaces); } // End of main loop over subsurfaces } @@ -4506,26 +4506,26 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).Name = cAlphaArgs(1); // Set the Surface Name in the Derived Type SurfaceTmp(SurfNum).Class = SubSurfIDs(ClassItem); // Set class number - SurfaceTmp(SurfNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct, TotConstructs); + SurfaceTmp(SurfNum).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct, TotConstructs); if (SurfaceTmp(SurfNum).Construction == 0) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); } else { - dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).IsUsed = true; + state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).IsUsed = true; SurfaceTmp(SurfNum).ConstructionStoredInputValue = SurfaceTmp(SurfNum).Construction; } if (SurfaceTmp(SurfNum).Class == SurfaceClass_Window || SurfaceTmp(SurfNum).Class == SurfaceClass_GlassDoor) { if (SurfaceTmp(SurfNum).Construction != 0) { - if (!dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + if (!state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\" has an opaque surface construction; it should have a window construction."); } - if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { + if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\": Windows are not allowed to have embedded sources/sinks"); @@ -4533,7 +4533,7 @@ namespace SurfaceGeometry { } } else if (SurfaceTmp(SurfNum).Construction != 0) { - if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\" - has Window materials."); @@ -4666,7 +4666,7 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).shadedStormWinConstructionList.clear(); SurfaceTmp(SurfNum).activeStormWinShadedConstruction= 0; - InitialAssociateWindowShadingControlFenestration(ErrorsFound, SurfNum); + InitialAssociateWindowShadingControlFenestration(state, ErrorsFound, SurfNum); if (!GettingIZSurfaces && (SurfaceTmp(SurfNum).Class == SurfaceClass_Window || SurfaceTmp(SurfNum).Class == SurfaceClass_GlassDoor)) { @@ -4682,17 +4682,18 @@ namespace SurfaceGeometry { ErrorsFound = true; } - CheckWindowShadingControlFrameDivider("GetRectSubSurfaces", ErrorsFound, SurfNum, FrameField); + CheckWindowShadingControlFrameDivider(state, "GetRectSubSurfaces", ErrorsFound, SurfNum, FrameField); } // check on non-opaquedoor subsurfaces - CheckSubSurfaceMiscellaneous("GetRectSubSurfaces", ErrorsFound, SurfNum, cAlphaArgs(1), cAlphaArgs(2), AddedSubSurfaces); + CheckSubSurfaceMiscellaneous(state, "GetRectSubSurfaces", ErrorsFound, SurfNum, cAlphaArgs(1), cAlphaArgs(2), AddedSubSurfaces); } // Getting Items } } - void CheckWindowShadingControlFrameDivider(std::string const &cRoutineName, // routine name calling this one (for error messages) + void CheckWindowShadingControlFrameDivider(EnergyPlusData &state, + std::string const &cRoutineName, // routine name calling this one (for error messages) bool &ErrorsFound, // true if errors have been found or are found here int const SurfNum, // current surface number int const FrameField // field number for frame/divider @@ -4747,7 +4748,7 @@ namespace SurfaceGeometry { WindowShadingControl(WSCPtr).ShadingType == WSC_ST_ExteriorBlind) { ShDevNum = WindowShadingControl(WSCPtr).ShadingDevice; if (ShDevNum > 0) { - CreateShadedWindowConstruction(SurfNum, WSCPtr, ShDevNum, shadeControlIndex); + CreateShadedWindowConstruction(state, SurfNum, WSCPtr, ShDevNum, shadeControlIndex); ConstrNumSh = SurfaceTmp(SurfNum).activeShadedConstruction; } } @@ -4761,23 +4762,23 @@ namespace SurfaceGeometry { if (WindowShadingControl(WSCPtr).ShadingType == WSC_ST_InteriorShade || WindowShadingControl(WSCPtr).ShadingType == WSC_ST_InteriorBlind) { - TotLayers = dataConstruction.Construct(ConstrNum).TotLayers; - TotShLayers = dataConstruction.Construct(ConstrNumSh).TotLayers; + TotLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; + TotShLayers = state.dataConstruction->Construct(ConstrNumSh).TotLayers; if (TotShLayers - 1 != TotLayers) { ShowWarningError("WindowShadingControl: Interior shade or blind: Potential problem in match of unshaded/shaded constructions, " "shaded should have 1 more layers than unshaded."); - ShowContinueError("Unshaded construction=" + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError("Shaded construction=" + dataConstruction.Construct(ConstrNumSh).Name); + ShowContinueError("Unshaded construction=" + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError("Shaded construction=" + state.dataConstruction->Construct(ConstrNumSh).Name); ShowContinueError("If preceding two constructions are same name, you have likely specified a WindowShadingControl (Field #3) " "with the Window Construction rather than a shaded construction."); } - for (Lay = 1; Lay <= dataConstruction.Construct(ConstrNum).TotLayers; ++Lay) { - if (dataConstruction.Construct(ConstrNum).LayerPoint(Lay) != dataConstruction.Construct(ConstrNumSh).LayerPoint(Lay)) { + for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Lay) { + if (state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay) != state.dataConstruction->Construct(ConstrNumSh).LayerPoint(Lay)) { ErrorsFound = true; ShowSevereError(" The glass and gas layers in the shaded and unshaded constructions do not match for window=" + SurfaceTmp(SurfNum).Name); - ShowContinueError("Unshaded construction=" + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError("Shaded construction=" + dataConstruction.Construct(ConstrNumSh).Name); + ShowContinueError("Unshaded construction=" + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError("Shaded construction=" + state.dataConstruction->Construct(ConstrNumSh).Name); break; } } @@ -4786,23 +4787,23 @@ namespace SurfaceGeometry { if (WindowShadingControl(WSCPtr).ShadingType == WSC_ST_ExteriorShade || WindowShadingControl(WSCPtr).ShadingType == WSC_ST_ExteriorScreen || WindowShadingControl(WSCPtr).ShadingType == WSC_ST_ExteriorBlind) { - TotLayers = dataConstruction.Construct(ConstrNum).TotLayers; - TotShLayers = dataConstruction.Construct(ConstrNumSh).TotLayers; + TotLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; + TotShLayers = state.dataConstruction->Construct(ConstrNumSh).TotLayers; if (TotShLayers - 1 != TotLayers) { ShowWarningError("WindowShadingControl: Exterior shade, screen or blind: Potential problem in match of unshaded/shaded " "constructions, shaded should have 1 more layer than unshaded."); - ShowContinueError("Unshaded construction=" + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError("Shaded construction=" + dataConstruction.Construct(ConstrNumSh).Name); + ShowContinueError("Unshaded construction=" + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError("Shaded construction=" + state.dataConstruction->Construct(ConstrNumSh).Name); ShowContinueError("If preceding two constructions have the same name, you have likely specified a WindowShadingControl (Field " "#3) with the Window Construction rather than a shaded construction."); } - for (Lay = 1; Lay <= dataConstruction.Construct(ConstrNum).TotLayers; ++Lay) { - if (dataConstruction.Construct(ConstrNum).LayerPoint(Lay) != dataConstruction.Construct(ConstrNumSh).LayerPoint(Lay + 1)) { + for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Lay) { + if (state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay) != state.dataConstruction->Construct(ConstrNumSh).LayerPoint(Lay + 1)) { ErrorsFound = true; ShowSevereError(" The glass and gas layers in the shaded and unshaded constructions do not match for window=" + SurfaceTmp(SurfNum).Name); - ShowContinueError("Unshaded construction=" + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError("Shaded construction=" + dataConstruction.Construct(ConstrNumSh).Name); + ShowContinueError("Unshaded construction=" + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError("Shaded construction=" + state.dataConstruction->Construct(ConstrNumSh).Name); break; } } @@ -4820,43 +4821,43 @@ namespace SurfaceGeometry { } } // Check consistency of gap widths between unshaded and shaded constructions - TotGlassLayers = dataConstruction.Construct(ConstrNum).TotGlassLayers; - TotLayers = dataConstruction.Construct(ConstrNum).TotLayers; - TotShLayers = dataConstruction.Construct(ConstrNumSh).TotLayers; + TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; + TotLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; + TotShLayers = state.dataConstruction->Construct(ConstrNumSh).TotLayers; if (TotShLayers - 2 != TotLayers) { ShowWarningError("WindowShadingControl: Between Glass Shade/Blind: Potential problem in match of unshaded/shaded constructions, " "shaded should have 2 more layers than unshaded."); - ShowContinueError("Unshaded construction=" + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError("Shaded construction=" + dataConstruction.Construct(ConstrNumSh).Name); + ShowContinueError("Unshaded construction=" + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError("Shaded construction=" + state.dataConstruction->Construct(ConstrNumSh).Name); ShowContinueError("If preceding two constructions are same name, you have likely specified a WindowShadingControl (Field #3) " "with the Window Construction rather than a shaded construction."); } - if (dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers) != dataConstruction.Construct(ConstrNumSh).LayerPoint(TotShLayers)) { + if (state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers) != state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotShLayers)) { ShowSevereError(cRoutineName + ": Mis-match in unshaded/shaded inside layer materials. These should match."); - ShowContinueError("Unshaded construction=" + dataConstruction.Construct(ConstrNum).Name + - ", Material=" + dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers)).Name); - ShowContinueError("Shaded construction=" + dataConstruction.Construct(ConstrNumSh).Name + - ", Material=" + dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(TotShLayers)).Name); + ShowContinueError("Unshaded construction=" + state.dataConstruction->Construct(ConstrNum).Name + + ", Material=" + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers)).Name); + ShowContinueError("Shaded construction=" + state.dataConstruction->Construct(ConstrNumSh).Name + + ", Material=" + dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotShLayers)).Name); ErrorsFound = true; } - if (dataConstruction.Construct(ConstrNum).LayerPoint(1) != dataConstruction.Construct(ConstrNumSh).LayerPoint(1)) { + if (state.dataConstruction->Construct(ConstrNum).LayerPoint(1) != state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1)) { ShowSevereError(cRoutineName + ": Mis-match in unshaded/shaded inside layer materials. These should match."); - ShowContinueError("Unshaded construction=" + dataConstruction.Construct(ConstrNum).Name + - ", Material=" + dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Name); - ShowContinueError("Shaded construction=" + dataConstruction.Construct(ConstrNumSh).Name + - ", Material=" + dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(1)).Name); + ShowContinueError("Unshaded construction=" + state.dataConstruction->Construct(ConstrNum).Name + + ", Material=" + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Name); + ShowContinueError("Shaded construction=" + state.dataConstruction->Construct(ConstrNumSh).Name + + ", Material=" + dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1)).Name); ErrorsFound = true; } if (TotGlassLayers == 2 || TotGlassLayers == 3) { - MatGap = dataConstruction.Construct(ConstrNum).LayerPoint(2 * TotGlassLayers - 2); - MatGap1 = dataConstruction.Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers - 2); - MatGap2 = dataConstruction.Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers); - MatSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers - 1); + MatGap = state.dataConstruction->Construct(ConstrNum).LayerPoint(2 * TotGlassLayers - 2); + MatGap1 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers - 2); + MatGap2 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers); + MatSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers - 1); if (WindowShadingControl(WSCPtr).ShadingType == WSC_ST_BetweenGlassBlind) { MatGapCalc = std::abs(dataMaterial.Material(MatGap).Thickness - (dataMaterial.Material(MatGap1).Thickness + dataMaterial.Material(MatGap2).Thickness)); if (MatGapCalc > 0.001) { - ShowSevereError(cRoutineName + ": The gap width(s) for the unshaded window construction " + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError("are inconsistent with the gap widths for shaded window construction " + dataConstruction.Construct(ConstrNumSh).Name); + ShowSevereError(cRoutineName + ": The gap width(s) for the unshaded window construction " + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError("are inconsistent with the gap widths for shaded window construction " + state.dataConstruction->Construct(ConstrNumSh).Name); ShowContinueError("for window " + SurfaceTmp(SurfNum).Name + ", which has a between-glass blind."); ShowContinueError("..Material=" + dataMaterial.Material(MatGap).Name + " thickness=" + RoundSigDigits(dataMaterial.Material(MatGap).Thickness, 3) + " -"); @@ -4870,8 +4871,8 @@ namespace SurfaceGeometry { MatGapCalc = std::abs(dataMaterial.Material(MatGap).Thickness - (dataMaterial.Material(MatGap1).Thickness + dataMaterial.Material(MatGap2).Thickness + dataMaterial.Material(MatSh).Thickness)); if (MatGapCalc > 0.001) { - ShowSevereError(cRoutineName + ": The gap width(s) for the unshaded window construction " + dataConstruction.Construct(ConstrNum).Name); - ShowContinueError("are inconsistent with the gap widths for shaded window construction " + dataConstruction.Construct(ConstrNumSh).Name); + ShowSevereError(cRoutineName + ": The gap width(s) for the unshaded window construction " + state.dataConstruction->Construct(ConstrNum).Name); + ShowContinueError("are inconsistent with the gap widths for shaded window construction " + state.dataConstruction->Construct(ConstrNumSh).Name); ShowContinueError("for window " + SurfaceTmp(SurfNum).Name + ", which has a between-glass shade."); ShowContinueError("..Material=" + dataMaterial.Material(MatGap).Name + " thickness=" + RoundSigDigits(dataMaterial.Material(MatGap).Thickness, 3) + " -"); @@ -4898,20 +4899,20 @@ namespace SurfaceGeometry { // window from the Window5 data file it is used instead of the window's input FrameDivider. if (SurfaceTmp(SurfNum).Construction != 0) { - SurfaceTmp(SurfNum).FrameDivider = dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).W5FrameDivider; + SurfaceTmp(SurfNum).FrameDivider = state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).W5FrameDivider; // Warning if FrameAndDivider for this window is over-ridden by one from Window5 Data File if (SurfaceTmp(SurfNum).FrameDivider > 0 && !lAlphaFieldBlanks(FrameField)) { ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", " + cAlphaFieldNames(FrameField) + "=\"" + cAlphaArgs(FrameField) + "\""); ShowContinueError("will be replaced with FrameAndDivider from Window5 Data File entry " + - dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).Name); + state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).Name); } if (!lAlphaFieldBlanks(FrameField) && SurfaceTmp(SurfNum).FrameDivider == 0) { SurfaceTmp(SurfNum).FrameDivider = UtilityRoutines::FindItemInList(cAlphaArgs(FrameField), FrameDivider); if (SurfaceTmp(SurfNum).FrameDivider == 0) { - if (!dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { + if (!state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(FrameField) + "=\"" + cAlphaArgs(FrameField) + "\""); ErrorsFound = true; @@ -4944,7 +4945,7 @@ namespace SurfaceGeometry { } // End of check if window has a construction } - if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { + if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { if (SurfaceTmp(SurfNum).FrameDivider > 0) { // Equivalent Layer window does not have frame/divider model ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + cAlphaFieldNames(FrameField) + "=\"" + @@ -4955,7 +4956,8 @@ namespace SurfaceGeometry { } } - void CheckSubSurfaceMiscellaneous(std::string const &cRoutineName, // routine name calling this one (for error messages) + void CheckSubSurfaceMiscellaneous(EnergyPlusData &state, + std::string const &cRoutineName, // routine name calling this one (for error messages) bool &ErrorsFound, // true if errors have been found or are found here int const SurfNum, // current surface number std::string const &SubSurfaceName, // name of the surface @@ -5002,8 +5004,8 @@ namespace SurfaceGeometry { ConstrNum = SurfaceTmp(SurfNum).Construction; if (ConstrNum > 0) { NumShades = 0; - for (Lay = 1; Lay <= dataConstruction.Construct(ConstrNum).TotLayers; ++Lay) { - LayerPtr = dataConstruction.Construct(ConstrNum).LayerPoint(Lay); + for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Lay) { + LayerPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); if (LayerPtr == 0) continue; // Error is caught already, will terminate later if (dataMaterial.Material(LayerPtr).Group == Shade || dataMaterial.Material(LayerPtr).Group == WindowBlind || dataMaterial.Material(LayerPtr).Group == Screen) ++NumShades; } @@ -5021,8 +5023,8 @@ namespace SurfaceGeometry { (SurfaceTmp(SurfNum).Class == SurfaceClass_Window || SurfaceTmp(SurfNum).Class == SurfaceClass_GlassDoor)) { ConstrNum = SurfaceTmp(SurfNum).Construction; if (ConstrNum > 0) { - for (Lay = 1; Lay <= dataConstruction.Construct(ConstrNum).TotLayers; ++Lay) { - LayerPtr = dataConstruction.Construct(ConstrNum).LayerPoint(Lay); + for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Lay) { + LayerPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); if (dataMaterial.Material(LayerPtr).Group == WindowGlass && dataMaterial.Material(LayerPtr).GlassTransDirtFactor < 1.0) { ShowSevereError(cRoutineName + ": Interior Window or GlassDoor " + SubSurfaceName + " has a glass layer with"); ShowContinueError("Dirt Correction Factor for Solar and Visible Transmittance < 1.0"); @@ -5041,9 +5043,9 @@ namespace SurfaceGeometry { if (SurfaceTmp(SurfNum).Construction != 0) { - if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).FromWindow5DataFile) { + if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).FromWindow5DataFile) { - ModifyWindow(SurfNum, ErrorsFound, AddedSubSurfaces); + ModifyWindow(state, SurfNum, ErrorsFound, AddedSubSurfaces); } else { // Calculate net area for base surface (note that ModifyWindow, above, adjusts net area of @@ -5899,7 +5901,7 @@ namespace SurfaceGeometry { IntMassObjects(Item).Name = cAlphaArgs(1); IntMassObjects(Item).GrossArea = rNumericArgs(1); - IntMassObjects(Item).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct, TotConstructs); + IntMassObjects(Item).Construction = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct, TotConstructs); IntMassObjects(Item).ZoneOrZoneListName = cAlphaArgs(3); int Item1 = UtilityRoutines::FindItemInList(cAlphaArgs(3), Zone, NumOfZones); int ZLItem = 0; @@ -5933,12 +5935,12 @@ namespace SurfaceGeometry { if (IntMassObjects(Item).Construction == 0) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", " + cAlphaFieldNames(2) + " not found=" + cAlphaArgs(2)); - } else if (dataConstruction.Construct(IntMassObjects(Item).Construction).TypeIsWindow) { + } else if (state.dataConstruction->Construct(IntMassObjects(Item).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\" - has Window materials."); } else { - dataConstruction.Construct(IntMassObjects(Item).Construction).IsUsed = true; + state.dataConstruction->Construct(IntMassObjects(Item).Construction).IsUsed = true; } } @@ -5976,7 +5978,7 @@ namespace SurfaceGeometry { } if (IntMassObjects(Loop).Construction > 0) { - if (dataConstruction.Construct(IntMassObjects(Loop).Construction).IsUsed) { + if (state.dataConstruction->Construct(IntMassObjects(Loop).Construction).IsUsed) { SurfaceTmp(SurfNum).ConstructionStoredInputValue = IntMassObjects(Loop).Construction; } } @@ -6140,13 +6142,13 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).ShadowSurfDiffuseSolRefl = (1.0 - rNumericArgs(3)) * rNumericArgs(1); SurfaceTmp(SurfNum).ShadowSurfDiffuseVisRefl = (1.0 - rNumericArgs(3)) * rNumericArgs(2); if (rNumericArgs(3) > 0.0) { - GlConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct, TotConstructs); + GlConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct, TotConstructs); if (GlConstrNum == 0) { ShowSevereError(cCurrentModuleObject + "=\"" + SurfaceTmp(SurfNum).Name + "\", " + cAlphaFieldNames(2) + " not found=" + cAlphaArgs(2)); ErrorsFound = true; } else { - dataConstruction.Construct(GlConstrNum).IsUsed = true; + state.dataConstruction->Construct(GlConstrNum).IsUsed = true; } SurfaceTmp(SurfNum).ShadowSurfGlazingConstruct = GlConstrNum; } @@ -6156,9 +6158,9 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).ShadowSurfDiffuseSolRefl = (1.0 - rNumericArgs(3)) * rNumericArgs(1); SurfaceTmp(SurfNum).ShadowSurfDiffuseVisRefl = (1.0 - rNumericArgs(3)) * rNumericArgs(2); if (rNumericArgs(3) > 0.0) { - GlConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct, TotConstructs); + GlConstrNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct, TotConstructs); if (GlConstrNum != 0) { - dataConstruction.Construct(GlConstrNum).IsUsed = true; + state.dataConstruction->Construct(GlConstrNum).IsUsed = true; } SurfaceTmp(SurfNum).ShadowSurfGlazingConstruct = GlConstrNum; } @@ -6184,7 +6186,7 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).ShadowSurfDiffuseSolRefl, SurfaceTmp(SurfNum).ShadowSurfDiffuseVisRefl, SurfaceTmp(SurfNum).ShadowSurfGlazingFrac, - dataConstruction.Construct(SurfaceTmp(SurfNum).ShadowSurfGlazingConstruct).Name); + state.dataConstruction->Construct(SurfaceTmp(SurfNum).ShadowSurfGlazingConstruct).Name); } else { print(state.files.eio, fmt, @@ -7118,7 +7120,7 @@ namespace SurfaceGeometry { for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; Surface(SurfNum).HeatTransferAlgorithm = tmpAlgoInput; } @@ -7129,7 +7131,7 @@ namespace SurfaceGeometry { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces if (Surface(SurfNum).Class != SurfaceClass_Wall) continue; - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; Surface(SurfNum).HeatTransferAlgorithm = tmpAlgoInput; } @@ -7140,7 +7142,7 @@ namespace SurfaceGeometry { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces if (Surface(SurfNum).Class != SurfaceClass_Roof) continue; - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; Surface(SurfNum).HeatTransferAlgorithm = tmpAlgoInput; } @@ -7151,7 +7153,7 @@ namespace SurfaceGeometry { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces if (Surface(SurfNum).Class != SurfaceClass_Floor) continue; - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; Surface(SurfNum).HeatTransferAlgorithm = tmpAlgoInput; } @@ -7161,7 +7163,7 @@ namespace SurfaceGeometry { for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond != Ground) continue; // ground BC - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; Surface(SurfNum).HeatTransferAlgorithm = tmpAlgoInput; } @@ -7170,7 +7172,7 @@ namespace SurfaceGeometry { for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; Surface(SurfNum).HeatTransferAlgorithm = tmpAlgoInput; } @@ -7181,7 +7183,7 @@ namespace SurfaceGeometry { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces if (Surface(SurfNum).Class != SurfaceClass_Wall) continue; - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; Surface(SurfNum).HeatTransferAlgorithm = tmpAlgoInput; } @@ -7192,7 +7194,7 @@ namespace SurfaceGeometry { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces if (Surface(SurfNum).Class != SurfaceClass_Roof) continue; - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; Surface(SurfNum).HeatTransferAlgorithm = tmpAlgoInput; } @@ -7203,7 +7205,7 @@ namespace SurfaceGeometry { if (!Surface(SurfNum).HeatTransSurf) continue; if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces if (Surface(SurfNum).Class != SurfaceClass_Floor) continue; - if (dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; SurfacesOfType = true; Surface(SurfNum).HeatTransferAlgorithm = tmpAlgoInput; } @@ -7314,7 +7316,7 @@ namespace SurfaceGeometry { } } - Found = UtilityRoutines::FindItemInList(cAlphaArgs(3), dataConstruction.Construct, TotConstructs); + Found = UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataConstruction->Construct, TotConstructs); if (Found == 0) { ShowSevereError(cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3)); ErrorsFoundByConstruct = true; @@ -7486,7 +7488,7 @@ namespace SurfaceGeometry { } if (Surface(Item).HeatTransferAlgorithm == HeatTransferModel_CTF || Surface(Item).HeatTransferAlgorithm == HeatTransferModel_EMPD) { - dataConstruction.Construct(Surface(Item).Construction).IsUsedCTF = true; + state.dataConstruction->Construct(Surface(Item).Construction).IsUsedCTF = true; } } } @@ -8227,7 +8229,7 @@ namespace SurfaceGeometry { WindowShadingControl(ControlNum).SequenceNumber = int(rNumericArgs(1)); // WindowShadingControl().getInputShadedConstruction is only used during GetInput process and is ultimately stored in Surface().shadedConstructionList - WindowShadingControl(ControlNum).getInputShadedConstruction = UtilityRoutines::FindItemInList(cAlphaArgs(4), dataConstruction.Construct, TotConstructs); + WindowShadingControl(ControlNum).getInputShadedConstruction = UtilityRoutines::FindItemInList(cAlphaArgs(4), state.dataConstruction->Construct, TotConstructs); WindowShadingControl(ControlNum).ShadingDevice = UtilityRoutines::FindItemInList(cAlphaArgs(9), dataMaterial.Material, TotMaterials); WindowShadingControl(ControlNum).Schedule = GetScheduleIndex(state, cAlphaArgs(6)); WindowShadingControl(ControlNum).SetPoint = rNumericArgs(2); @@ -8318,8 +8320,8 @@ namespace SurfaceGeometry { } } else { if (WindowShadingControl(ControlNum).getInputShadedConstruction > 0) { - dataConstruction.Construct(WindowShadingControl(ControlNum).getInputShadedConstruction).IsUsed = true; - if (dataMaterial.Material(dataConstruction.Construct(WindowShadingControl(ControlNum).getInputShadedConstruction).LayerPoint(1)).Group == Screen && + state.dataConstruction->Construct(WindowShadingControl(ControlNum).getInputShadedConstruction).IsUsed = true; + if (dataMaterial.Material(state.dataConstruction->Construct(WindowShadingControl(ControlNum).getInputShadedConstruction).LayerPoint(1)).Group == Screen && !(ControlType == "ALWAYSON" || ControlType == "ALWAYSOFF" || ControlType == "ONIFSCHEDULEALLOWS")) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + WindowShadingControl(ControlNum).Name + "\" invalid " + cAlphaFieldNames(5) + @@ -8473,20 +8475,20 @@ namespace SurfaceGeometry { IShadingDevice = 0; ShowWarningError(cCurrentModuleObject + "=\"" + WindowShadingControl(ControlNum).Name + "\" Both " + cAlphaFieldNames(4) + " and " + cAlphaFieldNames(9) + " are specified."); - ShowContinueError("The " + cAlphaFieldNames(4) + "=\"" + dataConstruction.Construct(IShadedConst).Name + "\" will be used."); + ShowContinueError("The " + cAlphaFieldNames(4) + "=\"" + state.dataConstruction->Construct(IShadedConst).Name + "\" will be used."); } // If type = interior or exterior shade or blind require that the shaded construction // have a shade layer in the correct position if (IShadedConst != 0) { - NLayers = dataConstruction.Construct(IShadedConst).TotLayers; + NLayers = state.dataConstruction->Construct(IShadedConst).TotLayers; BGShadeBlindError = false; IShadingDevice = 0; - if (dataConstruction.Construct(IShadedConst).LayerPoint(NLayers) != 0) { + if (state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers) != 0) { if (WindowShadingControl(ControlNum).ShadingType == WSC_ST_InteriorShade) { - IShadingDevice = dataConstruction.Construct(IShadedConst).LayerPoint(NLayers); - if (dataMaterial.Material(dataConstruction.Construct(IShadedConst).LayerPoint(NLayers)).Group != Shade) { + IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers); + if (dataMaterial.Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers)).Group != Shade) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + WindowShadingControl(ControlNum).Name + "\" the " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\""); @@ -8494,8 +8496,8 @@ namespace SurfaceGeometry { "\" should have a shade layer on the inside of the window."); } } else if (WindowShadingControl(ControlNum).ShadingType == WSC_ST_ExteriorShade) { - IShadingDevice = dataConstruction.Construct(IShadedConst).LayerPoint(1); - if (dataMaterial.Material(dataConstruction.Construct(IShadedConst).LayerPoint(1)).Group != Shade) { + IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(1); + if (dataMaterial.Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(1)).Group != Shade) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + WindowShadingControl(ControlNum).Name + "\" the " + cAlphaFieldNames(43) + "=\"" + cAlphaArgs(4) + "\""); @@ -8503,8 +8505,8 @@ namespace SurfaceGeometry { "\" should have a shade layer on the outside of the window."); } } else if (WindowShadingControl(ControlNum).ShadingType == WSC_ST_ExteriorScreen) { - IShadingDevice = dataConstruction.Construct(IShadedConst).LayerPoint(1); - if (dataMaterial.Material(dataConstruction.Construct(IShadedConst).LayerPoint(1)).Group != Screen) { + IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(1); + if (dataMaterial.Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(1)).Group != Screen) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + WindowShadingControl(ControlNum).Name + "\" the " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\""); @@ -8512,8 +8514,8 @@ namespace SurfaceGeometry { "\" should have a screen layer on the outside of the window."); } } else if (WindowShadingControl(ControlNum).ShadingType == WSC_ST_InteriorBlind) { - IShadingDevice = dataConstruction.Construct(IShadedConst).LayerPoint(NLayers); - if (dataMaterial.Material(dataConstruction.Construct(IShadedConst).LayerPoint(NLayers)).Group != WindowBlind) { + IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers); + if (dataMaterial.Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers)).Group != WindowBlind) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + WindowShadingControl(ControlNum).Name + "\" the " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\""); @@ -8521,8 +8523,8 @@ namespace SurfaceGeometry { "\" should have a blind layer on the inside of the window."); } } else if (WindowShadingControl(ControlNum).ShadingType == WSC_ST_ExteriorBlind) { - IShadingDevice = dataConstruction.Construct(IShadedConst).LayerPoint(1); - if (dataMaterial.Material(dataConstruction.Construct(IShadedConst).LayerPoint(1)).Group != WindowBlind) { + IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(1); + if (dataMaterial.Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(1)).Group != WindowBlind) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + WindowShadingControl(ControlNum).Name + "\" the " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\""); @@ -8532,10 +8534,10 @@ namespace SurfaceGeometry { } else if (WindowShadingControl(ControlNum).ShadingType == WSC_ST_BetweenGlassShade) { if (NLayers != 5 && NLayers != 7) BGShadeBlindError = true; if (NLayers == 5) { - if (dataMaterial.Material(dataConstruction.Construct(IShadedConst).LayerPoint(3)).Group != Shade) BGShadeBlindError = true; + if (dataMaterial.Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(3)).Group != Shade) BGShadeBlindError = true; } if (NLayers == 7) { - if (dataMaterial.Material(dataConstruction.Construct(IShadedConst).LayerPoint(5)).Group != Shade) BGShadeBlindError = true; + if (dataMaterial.Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(5)).Group != Shade) BGShadeBlindError = true; } if (BGShadeBlindError) { ErrorsFound = true; @@ -8548,10 +8550,10 @@ namespace SurfaceGeometry { } else if (WindowShadingControl(ControlNum).ShadingType == WSC_ST_BetweenGlassBlind) { if (NLayers != 5 && NLayers != 7) BGShadeBlindError = true; if (NLayers == 5) { - if (dataMaterial.Material(dataConstruction.Construct(IShadedConst).LayerPoint(3)).Group != WindowBlind) BGShadeBlindError = true; + if (dataMaterial.Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(3)).Group != WindowBlind) BGShadeBlindError = true; } if (NLayers == 7) { - if (dataMaterial.Material(dataConstruction.Construct(IShadedConst).LayerPoint(5)).Group != WindowBlind) BGShadeBlindError = true; + if (dataMaterial.Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(5)).Group != WindowBlind) BGShadeBlindError = true; } if (BGShadeBlindError) { ErrorsFound = true; @@ -8586,7 +8588,7 @@ namespace SurfaceGeometry { } // End of loop over window shading controls } - void InitialAssociateWindowShadingControlFenestration(bool &ErrorsFound, int &SurfNum) + void InitialAssociateWindowShadingControlFenestration(EnergyPlusData &state, bool &ErrorsFound, int &SurfNum) { // J.Glazer 2018 - operates on SurfaceTmp array before final indices are known for windows and sets the activeWindowShadingControl for (int iShadeCtrl = 1; iShadeCtrl <= TotWinShadingControl; ++iShadeCtrl) { @@ -8607,7 +8609,7 @@ namespace SurfaceGeometry { ShowContinueError(".. It appears on WindowShadingControl object: \"" + WindowShadingControl(iShadeCtrl).Name); } // check to make sure the window is not using equivalent layer window construction - if (dataConstruction.Construct(SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { + if (state.dataConstruction->Construct(SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { ErrorsFound = true; ShowSevereError("InitialAssociateWindowShadingControlFenestration: =\"" + SurfaceTmp(SurfNum).Name + "\", invalid " + "\"."); @@ -8929,7 +8931,7 @@ namespace SurfaceGeometry { if (Surface(SurfNum).Class != SurfaceClass_Window) WrongSurfaceType = true; if (Surface(SurfNum).Class == SurfaceClass_Window) { ConstrNum = Surface(SurfNum).Construction; - if (dataConstruction.Construct(ConstrNum).TotGlassLayers != 2 && dataConstruction.Construct(ConstrNum).TotGlassLayers != 3) WrongSurfaceType = true; + if (state.dataConstruction->Construct(ConstrNum).TotGlassLayers != 2 && state.dataConstruction->Construct(ConstrNum).TotGlassLayers != 3) WrongSurfaceType = true; if (Surface(SurfNum).ExtBoundCond != ExternalEnvironment) WrongSurfaceType = true; } if (WrongSurfaceType) { @@ -9058,12 +9060,12 @@ namespace SurfaceGeometry { ShowWarningError(cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", is an Interior window; cannot be an airflow window."); if (!ErrorsFound) { // Require that gas in airflow gap has type = air - MatGapFlow = dataConstruction.Construct(ConstrNum).LayerPoint(2); - if (dataConstruction.Construct(ConstrNum).TotGlassLayers == 3) MatGapFlow = dataConstruction.Construct(ConstrNum).LayerPoint(4); + MatGapFlow = state.dataConstruction->Construct(ConstrNum).LayerPoint(2); + if (state.dataConstruction->Construct(ConstrNum).TotGlassLayers == 3) MatGapFlow = state.dataConstruction->Construct(ConstrNum).LayerPoint(4); if (dataMaterial.Material(MatGapFlow).GasType(1) != 1) { ErrorsFound = true; ShowSevereError(cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", Gas type not air in airflow gap of construction " + - dataConstruction.Construct(ConstrNum).Name); + state.dataConstruction->Construct(ConstrNum).Name); } // Require that gas be air in airflow gaps on either side of a between glass shade/blind if (Surface(SurfNum).HasShadeControl) { @@ -9072,13 +9074,13 @@ namespace SurfaceGeometry { if (WindowShadingControl(WSCPtr).ShadingType == WSC_ST_BetweenGlassShade || WindowShadingControl(WSCPtr).ShadingType == WSC_ST_BetweenGlassBlind) { ConstrNumSh = Surface(SurfNum).shadedConstructionList[listIndex]; - if (dataConstruction.Construct(ConstrNum).TotGlassLayers == 2) { - MatGapFlow1 = dataConstruction.Construct(ConstrNumSh).LayerPoint(2); - MatGapFlow2 = dataConstruction.Construct(ConstrNumSh).LayerPoint(4); + if (state.dataConstruction->Construct(ConstrNum).TotGlassLayers == 2) { + MatGapFlow1 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(2); + MatGapFlow2 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(4); } else { - MatGapFlow1 = dataConstruction.Construct(ConstrNumSh).LayerPoint(4); - MatGapFlow2 = dataConstruction.Construct(ConstrNumSh).LayerPoint(6); + MatGapFlow1 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(4); + MatGapFlow2 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(6); } if (dataMaterial.Material(MatGapFlow1).GasType(1) != 1 || dataMaterial.Material(MatGapFlow2).GasType(1) != 1) { ErrorsFound = true; @@ -9455,14 +9457,14 @@ namespace SurfaceGeometry { numF++; if (!lAlphaFieldBlanks(alpF)) { - fndInput.wallConstructionIndex = UtilityRoutines::FindItemInList(cAlphaArgs(alpF), dataConstruction.Construct); + fndInput.wallConstructionIndex = UtilityRoutines::FindItemInList(cAlphaArgs(alpF), state.dataConstruction->Construct); if (fndInput.wallConstructionIndex == 0) { ErrorsFound = true; ShowSevereError("Did not find matching construction for " + cCurrentModuleObject + "=\"" + fndInput.name + "\", " + cAlphaFieldNames(alpF) + ", missing construction = " + cAlphaArgs(alpF)); continue; } - auto &c = dataConstruction.Construct(fndInput.wallConstructionIndex); + auto &c = state.dataConstruction->Construct(fndInput.wallConstructionIndex); c.IsUsed = true; if (c.TypeIsWindow) { ErrorsFound = true; @@ -11532,7 +11534,8 @@ namespace SurfaceGeometry { CompCoordTranslVector = Surface(SurfNum).Vertex(2) + Gamma * (Surface(SurfNum).Vertex(3) - Surface(SurfNum).Vertex(2)); } - void CreateShadedWindowConstruction(int const SurfNum, // Surface number + void CreateShadedWindowConstruction(EnergyPlusData &state, + int const SurfNum, // Surface number int const WSCPtr, // Pointer to WindowShadingControl for SurfNum int const ShDevNum, // Shading device material number for WSCptr int const shadeControlIndex // index to the Surface().windowShadingControlList, @@ -11562,7 +11565,7 @@ namespace SurfaceGeometry { ShDevName = dataMaterial.Material(ShDevNum).Name; ConstrNum = SurfaceTmp(SurfNum).Construction; - ConstrName = dataConstruction.Construct(ConstrNum).Name; + ConstrName = state.dataConstruction->Construct(ConstrNum).Name; if (WindowShadingControl(WSCPtr).ShadingType == WSC_ST_InteriorShade || WindowShadingControl(WSCPtr).ShadingType == WSC_ST_InteriorBlind) { ConstrNameSh = ConstrName + ':' + ShDevName + ":INT"; } else { @@ -11571,7 +11574,7 @@ namespace SurfaceGeometry { // If this construction name already exists, set the surface's shaded construction number to it - ConstrNewSh = UtilityRoutines::FindItemInList(ConstrNameSh, dataConstruction.Construct); + ConstrNewSh = UtilityRoutines::FindItemInList(ConstrNameSh, state.dataConstruction->Construct); if (ConstrNewSh > 0) { SurfaceTmp(SurfNum).shadedConstructionList[shadeControlIndex] = ConstrNewSh; @@ -11584,90 +11587,90 @@ namespace SurfaceGeometry { SurfaceTmp(SurfNum).shadedConstructionList[shadeControlIndex] = ConstrNewSh; SurfaceTmp(SurfNum).activeShadedConstruction = ConstrNewSh; //set the active to the current for now TotConstructs = ConstrNewSh; - dataConstruction.Construct.redimension(TotConstructs); + state.dataConstruction->Construct.redimension(TotConstructs); NominalRforNominalUCalculation.redimension(TotConstructs); NominalRforNominalUCalculation(TotConstructs) = 0.0; NominalU.redimension(TotConstructs); NominalU(TotConstructs) = 0.0; - TotLayersOld = dataConstruction.Construct(ConstrNum).TotLayers; + TotLayersOld = state.dataConstruction->Construct(ConstrNum).TotLayers; TotLayersNew = TotLayersOld + 1; - dataConstruction.Construct(ConstrNewSh).LayerPoint = 0; + state.dataConstruction->Construct(ConstrNewSh).LayerPoint = 0; if (WindowShadingControl(WSCPtr).ShadingType == WSC_ST_InteriorShade || WindowShadingControl(WSCPtr).ShadingType == WSC_ST_InteriorBlind) { // Interior shading device - dataConstruction.Construct(ConstrNewSh).LayerPoint({1, TotLayersOld}) = dataConstruction.Construct(ConstrNum).LayerPoint({1, TotLayersOld}); - dataConstruction.Construct(ConstrNewSh).LayerPoint(TotLayersNew) = ShDevNum; - dataConstruction.Construct(ConstrNewSh).InsideAbsorpSolar = dataMaterial.Material(ShDevNum).AbsorpSolar; - dataConstruction.Construct(ConstrNewSh).OutsideAbsorpSolar = dataMaterial.Material(dataConstruction.Construct(ConstrNewSh).LayerPoint(1)).AbsorpSolar; - dataConstruction.Construct(ConstrNewSh).OutsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNewSh).LayerPoint(1)).AbsorpThermalFront; + state.dataConstruction->Construct(ConstrNewSh).LayerPoint({1, TotLayersOld}) = state.dataConstruction->Construct(ConstrNum).LayerPoint({1, TotLayersOld}); + state.dataConstruction->Construct(ConstrNewSh).LayerPoint(TotLayersNew) = ShDevNum; + state.dataConstruction->Construct(ConstrNewSh).InsideAbsorpSolar = dataMaterial.Material(ShDevNum).AbsorpSolar; + state.dataConstruction->Construct(ConstrNewSh).OutsideAbsorpSolar = dataMaterial.Material(state.dataConstruction->Construct(ConstrNewSh).LayerPoint(1)).AbsorpSolar; + state.dataConstruction->Construct(ConstrNewSh).OutsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNewSh).LayerPoint(1)).AbsorpThermalFront; } else { // Exterior shading device - dataConstruction.Construct(ConstrNewSh).LayerPoint(1) = ShDevNum; - dataConstruction.Construct(ConstrNewSh).LayerPoint({2, TotLayersNew}) = dataConstruction.Construct(ConstrNum).LayerPoint({1, TotLayersOld}); - dataConstruction.Construct(ConstrNewSh).InsideAbsorpSolar = dataMaterial.Material(dataConstruction.Construct(ConstrNewSh).LayerPoint(TotLayersNew)).AbsorpSolar; - dataConstruction.Construct(ConstrNewSh).OutsideAbsorpSolar = dataMaterial.Material(ShDevNum).AbsorpSolar; - dataConstruction.Construct(ConstrNewSh).OutsideAbsorpThermal = dataMaterial.Material(ShDevNum).AbsorpThermalFront; + state.dataConstruction->Construct(ConstrNewSh).LayerPoint(1) = ShDevNum; + state.dataConstruction->Construct(ConstrNewSh).LayerPoint({2, TotLayersNew}) = state.dataConstruction->Construct(ConstrNum).LayerPoint({1, TotLayersOld}); + state.dataConstruction->Construct(ConstrNewSh).InsideAbsorpSolar = dataMaterial.Material(state.dataConstruction->Construct(ConstrNewSh).LayerPoint(TotLayersNew)).AbsorpSolar; + state.dataConstruction->Construct(ConstrNewSh).OutsideAbsorpSolar = dataMaterial.Material(ShDevNum).AbsorpSolar; + state.dataConstruction->Construct(ConstrNewSh).OutsideAbsorpThermal = dataMaterial.Material(ShDevNum).AbsorpThermalFront; } // The following InsideAbsorpThermal applies only to inside glass; it is corrected // later in InitGlassOpticalCalculations if construction has inside shade or blind. - dataConstruction.Construct(ConstrNewSh).InsideAbsorpThermal = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLayersOld)).AbsorpThermalBack; - dataConstruction.Construct(ConstrNewSh).OutsideRoughness = VerySmooth; - dataConstruction.Construct(ConstrNewSh).DayltPropPtr = 0; - dataConstruction.Construct(ConstrNewSh).CTFCross = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFFlux = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFInside = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFOutside = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFSourceIn = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFSourceOut = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFTimeStep = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFTSourceOut = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFTSourceIn = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFTSourceQ = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFTUserOut = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFTUserIn = 0.0; - dataConstruction.Construct(ConstrNewSh).CTFTUserSource = 0.0; - dataConstruction.Construct(ConstrNewSh).NumHistories = 0; - dataConstruction.Construct(ConstrNewSh).NumCTFTerms = 0; - dataConstruction.Construct(ConstrNewSh).UValue = 0.0; - dataConstruction.Construct(ConstrNewSh).SourceSinkPresent = false; - dataConstruction.Construct(ConstrNewSh).SolutionDimensions = 0; - dataConstruction.Construct(ConstrNewSh).SourceAfterLayer = 0; - dataConstruction.Construct(ConstrNewSh).TempAfterLayer = 0; - dataConstruction.Construct(ConstrNewSh).ThicknessPerpend = 0.0; - dataConstruction.Construct(ConstrNewSh).AbsDiff = 0.0; - dataConstruction.Construct(ConstrNewSh).AbsDiffBack = 0.0; - dataConstruction.Construct(ConstrNewSh).AbsDiffShade = 0.0; - dataConstruction.Construct(ConstrNewSh).AbsDiffBackShade = 0.0; - dataConstruction.Construct(ConstrNewSh).ShadeAbsorpThermal = 0.0; - dataConstruction.Construct(ConstrNewSh).AbsBeamCoef = 0.0; - dataConstruction.Construct(ConstrNewSh).AbsBeamBackCoef = 0.0; - dataConstruction.Construct(ConstrNewSh).AbsBeamShadeCoef = 0.0; - dataConstruction.Construct(ConstrNewSh).TransDiff = 0.0; - dataConstruction.Construct(ConstrNewSh).TransDiffVis = 0.0; - dataConstruction.Construct(ConstrNewSh).ReflectSolDiffBack = 0.0; - dataConstruction.Construct(ConstrNewSh).ReflectSolDiffFront = 0.0; - dataConstruction.Construct(ConstrNewSh).ReflectVisDiffBack = 0.0; - dataConstruction.Construct(ConstrNewSh).ReflectVisDiffFront = 0.0; - dataConstruction.Construct(ConstrNewSh).TransSolBeamCoef = 0.0; - dataConstruction.Construct(ConstrNewSh).TransVisBeamCoef = 0.0; - dataConstruction.Construct(ConstrNewSh).ReflSolBeamFrontCoef = 0.0; - dataConstruction.Construct(ConstrNewSh).ReflSolBeamBackCoef = 0.0; - dataConstruction.Construct(ConstrNewSh).W5FrameDivider = 0; - dataConstruction.Construct(ConstrNewSh).FromWindow5DataFile = false; - - dataConstruction.Construct(ConstrNewSh).Name = ConstrNameSh; - dataConstruction.Construct(ConstrNewSh).TotLayers = TotLayersNew; - dataConstruction.Construct(ConstrNewSh).TotSolidLayers = dataConstruction.Construct(ConstrNum).TotSolidLayers + 1; - dataConstruction.Construct(ConstrNewSh).TotGlassLayers = dataConstruction.Construct(ConstrNum).TotGlassLayers; - dataConstruction.Construct(ConstrNewSh).TypeIsWindow = true; - dataConstruction.Construct(ConstrNewSh).IsUsed = true; + state.dataConstruction->Construct(ConstrNewSh).InsideAbsorpThermal = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayersOld)).AbsorpThermalBack; + state.dataConstruction->Construct(ConstrNewSh).OutsideRoughness = VerySmooth; + state.dataConstruction->Construct(ConstrNewSh).DayltPropPtr = 0; + state.dataConstruction->Construct(ConstrNewSh).CTFCross = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFFlux = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFInside = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFOutside = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFSourceIn = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFSourceOut = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFTimeStep = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFTSourceOut = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFTSourceIn = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFTSourceQ = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFTUserOut = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFTUserIn = 0.0; + state.dataConstruction->Construct(ConstrNewSh).CTFTUserSource = 0.0; + state.dataConstruction->Construct(ConstrNewSh).NumHistories = 0; + state.dataConstruction->Construct(ConstrNewSh).NumCTFTerms = 0; + state.dataConstruction->Construct(ConstrNewSh).UValue = 0.0; + state.dataConstruction->Construct(ConstrNewSh).SourceSinkPresent = false; + state.dataConstruction->Construct(ConstrNewSh).SolutionDimensions = 0; + state.dataConstruction->Construct(ConstrNewSh).SourceAfterLayer = 0; + state.dataConstruction->Construct(ConstrNewSh).TempAfterLayer = 0; + state.dataConstruction->Construct(ConstrNewSh).ThicknessPerpend = 0.0; + state.dataConstruction->Construct(ConstrNewSh).AbsDiff = 0.0; + state.dataConstruction->Construct(ConstrNewSh).AbsDiffBack = 0.0; + state.dataConstruction->Construct(ConstrNewSh).AbsDiffShade = 0.0; + state.dataConstruction->Construct(ConstrNewSh).AbsDiffBackShade = 0.0; + state.dataConstruction->Construct(ConstrNewSh).ShadeAbsorpThermal = 0.0; + state.dataConstruction->Construct(ConstrNewSh).AbsBeamCoef = 0.0; + state.dataConstruction->Construct(ConstrNewSh).AbsBeamBackCoef = 0.0; + state.dataConstruction->Construct(ConstrNewSh).AbsBeamShadeCoef = 0.0; + state.dataConstruction->Construct(ConstrNewSh).TransDiff = 0.0; + state.dataConstruction->Construct(ConstrNewSh).TransDiffVis = 0.0; + state.dataConstruction->Construct(ConstrNewSh).ReflectSolDiffBack = 0.0; + state.dataConstruction->Construct(ConstrNewSh).ReflectSolDiffFront = 0.0; + state.dataConstruction->Construct(ConstrNewSh).ReflectVisDiffBack = 0.0; + state.dataConstruction->Construct(ConstrNewSh).ReflectVisDiffFront = 0.0; + state.dataConstruction->Construct(ConstrNewSh).TransSolBeamCoef = 0.0; + state.dataConstruction->Construct(ConstrNewSh).TransVisBeamCoef = 0.0; + state.dataConstruction->Construct(ConstrNewSh).ReflSolBeamFrontCoef = 0.0; + state.dataConstruction->Construct(ConstrNewSh).ReflSolBeamBackCoef = 0.0; + state.dataConstruction->Construct(ConstrNewSh).W5FrameDivider = 0; + state.dataConstruction->Construct(ConstrNewSh).FromWindow5DataFile = false; + + state.dataConstruction->Construct(ConstrNewSh).Name = ConstrNameSh; + state.dataConstruction->Construct(ConstrNewSh).TotLayers = TotLayersNew; + state.dataConstruction->Construct(ConstrNewSh).TotSolidLayers = state.dataConstruction->Construct(ConstrNum).TotSolidLayers + 1; + state.dataConstruction->Construct(ConstrNewSh).TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; + state.dataConstruction->Construct(ConstrNewSh).TypeIsWindow = true; + state.dataConstruction->Construct(ConstrNewSh).IsUsed = true; } } - void CreateStormWindowConstructions() + void CreateStormWindowConstructions(EnergyPlusData &state) { // For windows with an associated StormWindow object, creates a construction // consisting of the base construction plus a storm window and air gap on the outside. @@ -11679,7 +11682,7 @@ namespace SurfaceGeometry { int SurfNum = StormWindow(StormWinNum).BaseWindowNum; // Surface number int ConstrNum = Surface(SurfNum).Construction; // Number of unshaded construction // Fatal error if base construction has more than three glass layers - if (dataConstruction.Construct(ConstrNum).TotGlassLayers > 3) { + if (state.dataConstruction->Construct(ConstrNum).TotGlassLayers > 3) { ShowFatalError("Window=" + Surface(SurfNum).Name + " has more than 3 glass layers; a storm window cannot be applied."); } @@ -11687,11 +11690,11 @@ namespace SurfaceGeometry { const auto ChrNum = fmt::to_string(StormWinNum); std::string ConstrNameSt = "BARECONSTRUCTIONWITHSTORMWIN:" + ChrNum; // Name of unshaded construction with storm window // If this construction name already exists, set the surface's storm window construction number to it - int ConstrNewSt = UtilityRoutines::FindItemInList(ConstrNameSt, dataConstruction.Construct, TotConstructs); // Number of unshaded storm window construction that is created + int ConstrNewSt = UtilityRoutines::FindItemInList(ConstrNameSt, state.dataConstruction->Construct, TotConstructs); // Number of unshaded storm window construction that is created // If necessary, create new material corresponding to the air layer between the storm winddow and the rest of the window int MatNewStAir = createAirMaterialFromDistance(StormWindow(StormWinNum).StormWinDistance, "AIR:STORMWIN:"); if (ConstrNewSt == 0) { - ConstrNewSt = createConstructionWithStorm(ConstrNum, ConstrNameSt, StormWindow(StormWinNum).StormWinMaterialNum, MatNewStAir); + ConstrNewSt = createConstructionWithStorm(state, ConstrNum, ConstrNameSt, StormWindow(StormWinNum).StormWinMaterialNum, MatNewStAir); } Surface(SurfNum).StormWinConstruction = ConstrNewSt; @@ -11703,12 +11706,12 @@ namespace SurfaceGeometry { // can be added. (A storm window can be added if there is an interior shade or blind and up to three // glass layers, or there is a between-glass shade or blind and two glass layers.) bool ShAndSt = false; // True if unshaded and shaded window can have a storm window - std::string ConstrNameSh = dataConstruction.Construct(curConstruction).Name; // Name of original shaded window construction - int TotLayers = dataConstruction.Construct(curConstruction).TotLayers; // Total layers in a construction - int MatIntSh = dataConstruction.Construct(curConstruction).LayerPoint(TotLayers); // Material number of interior shade or blind + std::string ConstrNameSh = state.dataConstruction->Construct(curConstruction).Name; // Name of original shaded window construction + int TotLayers = state.dataConstruction->Construct(curConstruction).TotLayers; // Total layers in a construction + int MatIntSh = state.dataConstruction->Construct(curConstruction).LayerPoint(TotLayers); // Material number of interior shade or blind int MatBetweenGlassSh = 0; // Material number of between-glass shade or blind - if (TotLayers == 5) MatBetweenGlassSh = dataConstruction.Construct(curConstruction).LayerPoint(3); - if (dataConstruction.Construct(curConstruction).TotGlassLayers <= 3 && (dataMaterial.Material(MatIntSh).Group == Shade || dataMaterial.Material(MatIntSh).Group == WindowBlind)) ShAndSt = true; + if (TotLayers == 5) MatBetweenGlassSh = state.dataConstruction->Construct(curConstruction).LayerPoint(3); + if (state.dataConstruction->Construct(curConstruction).TotGlassLayers <= 3 && (dataMaterial.Material(MatIntSh).Group == Shade || dataMaterial.Material(MatIntSh).Group == WindowBlind)) ShAndSt = true; if (MatBetweenGlassSh > 0) { if (dataMaterial.Material(MatBetweenGlassSh).Group == Shade || dataMaterial.Material(MatBetweenGlassSh).Group == WindowBlind) { ShAndSt = true; @@ -11721,8 +11724,8 @@ namespace SurfaceGeometry { } } if (ShAndSt) { - std::string ConstrNameStSh = "SHADEDCONSTRUCTIONWITHSTORMWIN:" + dataConstruction.Construct(iConstruction).Name + ":" + ChrNum ; // Name of shaded construction with storm window - int ConstrNewStSh = createConstructionWithStorm(ConstrNum, ConstrNameStSh, StormWindow(StormWinNum).StormWinMaterialNum, MatNewStAir); + std::string ConstrNameStSh = "SHADEDCONSTRUCTIONWITHSTORMWIN:" + state.dataConstruction->Construct(iConstruction).Name + ":" + ChrNum ; // Name of shaded construction with storm window + int ConstrNewStSh = createConstructionWithStorm(state, ConstrNum, ConstrNameStSh, StormWindow(StormWinNum).StormWinMaterialNum, MatNewStAir); Surface(SurfNum).shadedStormWinConstructionList[iConstruction] = ConstrNewStSh; // put in same index as the shaded constuction } } // end of loop for shaded constructions @@ -11802,86 +11805,87 @@ namespace SurfaceGeometry { } // create a new construction with storm based on an old construction and storm and gap materials - int createConstructionWithStorm(int oldConstruction, std::string name, int stormMaterial, int gapMaterial) + int createConstructionWithStorm(EnergyPlusData &state, int oldConstruction, std::string name, int stormMaterial, int gapMaterial) { - int newConstruct = UtilityRoutines::FindItemInList(name, dataConstruction.Construct, TotConstructs); // Number of shaded storm window construction that is created + int newConstruct = UtilityRoutines::FindItemInList(name, state.dataConstruction->Construct, TotConstructs); // Number of shaded storm window construction that is created if (newConstruct == 0) { TotConstructs = TotConstructs + 1; newConstruct = TotConstructs; - dataConstruction.Construct.redimension(TotConstructs); + state.dataConstruction->Construct.redimension(TotConstructs); NominalRforNominalUCalculation.redimension(TotConstructs); NominalU.redimension(TotConstructs); - int TotLayersOld = dataConstruction.Construct(oldConstruction).TotLayers; - dataConstruction.Construct(TotConstructs).LayerPoint({ 1, Construction::MaxLayersInConstruct }) = 0; - dataConstruction.Construct(TotConstructs).LayerPoint(1) = stormMaterial; - dataConstruction.Construct(TotConstructs).LayerPoint(2) = gapMaterial; - dataConstruction.Construct(TotConstructs).LayerPoint({ 3, TotLayersOld + 2 }) = dataConstruction.Construct(oldConstruction).LayerPoint({ 1, TotLayersOld }); - dataConstruction.Construct(TotConstructs).Name = name; - dataConstruction.Construct(TotConstructs).TotLayers = TotLayersOld + 2; - dataConstruction.Construct(TotConstructs).TotSolidLayers = dataConstruction.Construct(oldConstruction).TotSolidLayers + 1; - dataConstruction.Construct(TotConstructs).TotGlassLayers = dataConstruction.Construct(oldConstruction).TotGlassLayers + 1; - dataConstruction.Construct(TotConstructs).TypeIsWindow = true; - dataConstruction.Construct(TotConstructs).InsideAbsorpVis = 0.0; - dataConstruction.Construct(TotConstructs).OutsideAbsorpVis = 0.0; - dataConstruction.Construct(TotConstructs).InsideAbsorpSolar = 0.0; - dataConstruction.Construct(TotConstructs).OutsideAbsorpSolar = 0.0; - dataConstruction.Construct(TotConstructs).InsideAbsorpThermal = dataConstruction.Construct(oldConstruction).InsideAbsorpThermal; - dataConstruction.Construct(TotConstructs).OutsideAbsorpThermal = dataMaterial.Material(stormMaterial).AbsorpThermalFront; - dataConstruction.Construct(TotConstructs).OutsideRoughness = VerySmooth; - dataConstruction.Construct(TotConstructs).DayltPropPtr = 0; - dataConstruction.Construct(TotConstructs).CTFCross = 0.0; - dataConstruction.Construct(TotConstructs).CTFFlux = 0.0; - dataConstruction.Construct(TotConstructs).CTFInside = 0.0; - dataConstruction.Construct(TotConstructs).CTFOutside = 0.0; - dataConstruction.Construct(TotConstructs).CTFSourceIn = 0.0; - dataConstruction.Construct(TotConstructs).CTFSourceOut = 0.0; - dataConstruction.Construct(TotConstructs).CTFTimeStep = 0.0; - dataConstruction.Construct(TotConstructs).CTFTSourceOut = 0.0; - dataConstruction.Construct(TotConstructs).CTFTSourceIn = 0.0; - dataConstruction.Construct(TotConstructs).CTFTSourceQ = 0.0; - dataConstruction.Construct(TotConstructs).CTFTUserOut = 0.0; - dataConstruction.Construct(TotConstructs).CTFTUserIn = 0.0; - dataConstruction.Construct(TotConstructs).CTFTUserSource = 0.0; - dataConstruction.Construct(TotConstructs).NumHistories = 0; - dataConstruction.Construct(TotConstructs).NumCTFTerms = 0; - dataConstruction.Construct(TotConstructs).UValue = 0.0; - dataConstruction.Construct(TotConstructs).SourceSinkPresent = false; - dataConstruction.Construct(TotConstructs).SolutionDimensions = 0; - dataConstruction.Construct(TotConstructs).SourceAfterLayer = 0; - dataConstruction.Construct(TotConstructs).TempAfterLayer = 0; - dataConstruction.Construct(TotConstructs).ThicknessPerpend = 0.0; - dataConstruction.Construct(TotConstructs).AbsDiffIn = 0.0; - dataConstruction.Construct(TotConstructs).AbsDiffOut = 0.0; - dataConstruction.Construct(TotConstructs).AbsDiff = 0.0; - dataConstruction.Construct(TotConstructs).AbsDiffBack = 0.0; - dataConstruction.Construct(TotConstructs).AbsDiffShade = 0.0; - dataConstruction.Construct(TotConstructs).AbsDiffBackShade = 0.0; - dataConstruction.Construct(TotConstructs).ShadeAbsorpThermal = 0.0; - dataConstruction.Construct(TotConstructs).AbsBeamCoef = 0.0; - dataConstruction.Construct(TotConstructs).AbsBeamBackCoef = 0.0; - dataConstruction.Construct(TotConstructs).AbsBeamShadeCoef = 0.0; - dataConstruction.Construct(TotConstructs).TransDiff = 0.0; - dataConstruction.Construct(TotConstructs).TransDiffVis = 0.0; - dataConstruction.Construct(TotConstructs).ReflectSolDiffBack = 0.0; - dataConstruction.Construct(TotConstructs).ReflectSolDiffFront = 0.0; - dataConstruction.Construct(TotConstructs).ReflectVisDiffBack = 0.0; - dataConstruction.Construct(TotConstructs).ReflectVisDiffFront = 0.0; - dataConstruction.Construct(TotConstructs).TransSolBeamCoef = 0.0; - dataConstruction.Construct(TotConstructs).TransVisBeamCoef = 0.0; - dataConstruction.Construct(TotConstructs).ReflSolBeamFrontCoef = 0.0; - dataConstruction.Construct(TotConstructs).ReflSolBeamBackCoef = 0.0; - dataConstruction.Construct(TotConstructs).W5FrameDivider = 0; - dataConstruction.Construct(TotConstructs).FromWindow5DataFile = false; - dataConstruction.Construct(TotConstructs).W5FileMullionWidth = 0.0; - dataConstruction.Construct(TotConstructs).W5FileMullionOrientation = 0; - dataConstruction.Construct(TotConstructs).W5FileGlazingSysWidth = 0.0; - dataConstruction.Construct(TotConstructs).W5FileGlazingSysHeight = 0.0; + int TotLayersOld = state.dataConstruction->Construct(oldConstruction).TotLayers; + state.dataConstruction->Construct(TotConstructs).LayerPoint({ 1, Construction::MaxLayersInConstruct }) = 0; + state.dataConstruction->Construct(TotConstructs).LayerPoint(1) = stormMaterial; + state.dataConstruction->Construct(TotConstructs).LayerPoint(2) = gapMaterial; + state.dataConstruction->Construct(TotConstructs).LayerPoint({ 3, TotLayersOld + 2 }) = state.dataConstruction->Construct(oldConstruction).LayerPoint({ 1, TotLayersOld }); + state.dataConstruction->Construct(TotConstructs).Name = name; + state.dataConstruction->Construct(TotConstructs).TotLayers = TotLayersOld + 2; + state.dataConstruction->Construct(TotConstructs).TotSolidLayers = state.dataConstruction->Construct(oldConstruction).TotSolidLayers + 1; + state.dataConstruction->Construct(TotConstructs).TotGlassLayers = state.dataConstruction->Construct(oldConstruction).TotGlassLayers + 1; + state.dataConstruction->Construct(TotConstructs).TypeIsWindow = true; + state.dataConstruction->Construct(TotConstructs).InsideAbsorpVis = 0.0; + state.dataConstruction->Construct(TotConstructs).OutsideAbsorpVis = 0.0; + state.dataConstruction->Construct(TotConstructs).InsideAbsorpSolar = 0.0; + state.dataConstruction->Construct(TotConstructs).OutsideAbsorpSolar = 0.0; + state.dataConstruction->Construct(TotConstructs).InsideAbsorpThermal = state.dataConstruction->Construct(oldConstruction).InsideAbsorpThermal; + state.dataConstruction->Construct(TotConstructs).OutsideAbsorpThermal = dataMaterial.Material(stormMaterial).AbsorpThermalFront; + state.dataConstruction->Construct(TotConstructs).OutsideRoughness = VerySmooth; + state.dataConstruction->Construct(TotConstructs).DayltPropPtr = 0; + state.dataConstruction->Construct(TotConstructs).CTFCross = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFFlux = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFInside = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFOutside = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFSourceIn = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFSourceOut = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFTimeStep = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFTSourceOut = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFTSourceIn = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFTSourceQ = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFTUserOut = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFTUserIn = 0.0; + state.dataConstruction->Construct(TotConstructs).CTFTUserSource = 0.0; + state.dataConstruction->Construct(TotConstructs).NumHistories = 0; + state.dataConstruction->Construct(TotConstructs).NumCTFTerms = 0; + state.dataConstruction->Construct(TotConstructs).UValue = 0.0; + state.dataConstruction->Construct(TotConstructs).SourceSinkPresent = false; + state.dataConstruction->Construct(TotConstructs).SolutionDimensions = 0; + state.dataConstruction->Construct(TotConstructs).SourceAfterLayer = 0; + state.dataConstruction->Construct(TotConstructs).TempAfterLayer = 0; + state.dataConstruction->Construct(TotConstructs).ThicknessPerpend = 0.0; + state.dataConstruction->Construct(TotConstructs).AbsDiffIn = 0.0; + state.dataConstruction->Construct(TotConstructs).AbsDiffOut = 0.0; + state.dataConstruction->Construct(TotConstructs).AbsDiff = 0.0; + state.dataConstruction->Construct(TotConstructs).AbsDiffBack = 0.0; + state.dataConstruction->Construct(TotConstructs).AbsDiffShade = 0.0; + state.dataConstruction->Construct(TotConstructs).AbsDiffBackShade = 0.0; + state.dataConstruction->Construct(TotConstructs).ShadeAbsorpThermal = 0.0; + state.dataConstruction->Construct(TotConstructs).AbsBeamCoef = 0.0; + state.dataConstruction->Construct(TotConstructs).AbsBeamBackCoef = 0.0; + state.dataConstruction->Construct(TotConstructs).AbsBeamShadeCoef = 0.0; + state.dataConstruction->Construct(TotConstructs).TransDiff = 0.0; + state.dataConstruction->Construct(TotConstructs).TransDiffVis = 0.0; + state.dataConstruction->Construct(TotConstructs).ReflectSolDiffBack = 0.0; + state.dataConstruction->Construct(TotConstructs).ReflectSolDiffFront = 0.0; + state.dataConstruction->Construct(TotConstructs).ReflectVisDiffBack = 0.0; + state.dataConstruction->Construct(TotConstructs).ReflectVisDiffFront = 0.0; + state.dataConstruction->Construct(TotConstructs).TransSolBeamCoef = 0.0; + state.dataConstruction->Construct(TotConstructs).TransVisBeamCoef = 0.0; + state.dataConstruction->Construct(TotConstructs).ReflSolBeamFrontCoef = 0.0; + state.dataConstruction->Construct(TotConstructs).ReflSolBeamBackCoef = 0.0; + state.dataConstruction->Construct(TotConstructs).W5FrameDivider = 0; + state.dataConstruction->Construct(TotConstructs).FromWindow5DataFile = false; + state.dataConstruction->Construct(TotConstructs).W5FileMullionWidth = 0.0; + state.dataConstruction->Construct(TotConstructs).W5FileMullionOrientation = 0; + state.dataConstruction->Construct(TotConstructs).W5FileGlazingSysWidth = 0.0; + state.dataConstruction->Construct(TotConstructs).W5FileGlazingSysHeight = 0.0; } return(newConstruct); } - void ModifyWindow(int const SurfNum, // SurfNum has construction of glazing system from Window5 Data File; + void ModifyWindow(EnergyPlusData &state, + int const SurfNum, // SurfNum has construction of glazing system from Window5 Data File; bool &ErrorsFound, // Set to true if errors found int &AddedSubSurfaces // Subsurfaces added when window references a ) @@ -11963,11 +11967,11 @@ namespace SurfaceGeometry { OriginalCoord.Vertex({1, SurfaceTmp(SurfNum).Sides}) = SurfaceTmp(SurfNum).Vertex({1, SurfaceTmp(SurfNum).Sides}); // Height and width of first glazing system - h1 = dataConstruction.Construct(IConst).W5FileGlazingSysHeight; - w1 = dataConstruction.Construct(IConst).W5FileGlazingSysWidth; + h1 = state.dataConstruction->Construct(IConst).W5FileGlazingSysHeight; + w1 = state.dataConstruction->Construct(IConst).W5FileGlazingSysWidth; - Const2Name = dataConstruction.Construct(IConst).Name + ":2"; - IConst2 = UtilityRoutines::FindItemInList(Const2Name, dataConstruction.Construct); + Const2Name = state.dataConstruction->Construct(IConst).Name + ":2"; + IConst2 = UtilityRoutines::FindItemInList(Const2Name, state.dataConstruction->Construct); if (IConst2 == 0) { // Only one glazing system on Window5 Data File for this window. @@ -11978,7 +11982,7 @@ namespace SurfaceGeometry { if (DisplayExtraWarnings) { ShowWarningError("SurfaceGeometry: ModifyWindow: Window " + SurfaceTmp(SurfNum).Name + - " uses the Window5 Data File Construction " + dataConstruction.Construct(IConst).Name); + " uses the Window5 Data File Construction " + state.dataConstruction->Construct(IConst).Name); ShowContinueError("The height " + RoundSigDigits(H, 3) + "(m) or width " + RoundSigDigits(W, 3) + " (m) of this window differs by more than 10%"); ShowContinueError("from the corresponding height " + RoundSigDigits(h1, 3) + " (m) or width " + RoundSigDigits(w1, 3) + @@ -12015,32 +12019,32 @@ namespace SurfaceGeometry { if (DisplayExtraWarnings) { ShowMessage("SurfaceGeometry: ModifyWindow: Window " + SurfaceTmp(SurfNum).Name + - " has been replaced with the Window 5/6 two glazing system=\"" + dataConstruction.Construct(IConst).Name + "\"."); + " has been replaced with the Window 5/6 two glazing system=\"" + state.dataConstruction->Construct(IConst).Name + "\"."); ShowContinueError("Note that originally entered dimensions are overridden."); } else { ++Warning2Count; } // Allocate another window - AddWindow(SurfNum, ErrorsFound, AddedSubSurfaces); + AddWindow(state, SurfNum, ErrorsFound, AddedSubSurfaces); } else if (SurfaceTmp(SurfNum).ExtBoundCond > 0) { // Interior window, specified ! not external environment if (DisplayExtraWarnings) { ShowWarningError("SurfaceGeometry: ModifyWindow: Interior Window " + SurfaceTmp(SurfNum).Name + - " has been replaced with the Window 5/6 two glazing system=\"" + dataConstruction.Construct(IConst).Name + "\"."); + " has been replaced with the Window 5/6 two glazing system=\"" + state.dataConstruction->Construct(IConst).Name + "\"."); ShowContinueError( "Please check to make sure interior window is correct. Note that originally entered dimensions are overridden."); } else { ++Warning3Count; } - AddWindow(SurfNum, ErrorsFound, AddedSubSurfaces); + AddWindow(state, SurfNum, ErrorsFound, AddedSubSurfaces); } else { // Interior window, specified not entered ShowSevereError("SurfaceGeometry: ModifyWindow: Interior Window " + SurfaceTmp(SurfNum).Name + " is a window in an adjacent zone."); - ShowContinueError("Attempted to add/reverse Window 5/6 multiple glazing system=\"" + dataConstruction.Construct(IConst).Name + "\"."); + ShowContinueError("Attempted to add/reverse Window 5/6 multiple glazing system=\"" + state.dataConstruction->Construct(IConst).Name + "\"."); ShowContinueError("Cannot use these Window 5/6 constructs for these Interior Windows. Program will terminate."); ErrorsFound = true; } @@ -12048,7 +12052,8 @@ namespace SurfaceGeometry { } // End of check if one or two glazing systems are on the Window5 Data File } - void AddWindow(int const SurfNum, // SurfNum has construction of glazing system from Window5 Data File; + void AddWindow(EnergyPlusData &state, + int const SurfNum, // SurfNum has construction of glazing system from Window5 Data File; bool &ErrorsFound, // Set to true if errors found int &AddedSubSurfaces // Subsurfaces added when window references a ) @@ -12126,11 +12131,11 @@ namespace SurfaceGeometry { OriginalCoord.Vertex({1, SurfaceTmp(SurfNum).Sides}) = SurfaceTmp(SurfNum).Vertex({1, SurfaceTmp(SurfNum).Sides}); // Height and width of first glazing system - h1 = dataConstruction.Construct(IConst).W5FileGlazingSysHeight; - w1 = dataConstruction.Construct(IConst).W5FileGlazingSysWidth; + h1 = state.dataConstruction->Construct(IConst).W5FileGlazingSysHeight; + w1 = state.dataConstruction->Construct(IConst).W5FileGlazingSysWidth; - Const2Name = dataConstruction.Construct(IConst).Name + ":2"; - IConst2 = UtilityRoutines::FindItemInList(Const2Name, dataConstruction.Construct); + Const2Name = state.dataConstruction->Construct(IConst).Name + ":2"; + IConst2 = UtilityRoutines::FindItemInList(Const2Name, state.dataConstruction->Construct); ++AddedSubSurfaces; SurfaceTmp.redimension(++TotSurfaces); @@ -12189,9 +12194,9 @@ namespace SurfaceGeometry { SurfaceTmp(TotSurfaces).Multiplier = SurfaceTmp(SurfNum).Multiplier; SurfaceTmp(TotSurfaces).NetAreaShadowCalc = SurfaceTmp(SurfNum).NetAreaShadowCalc; - MulWidth = dataConstruction.Construct(IConst).W5FileMullionWidth; - w2 = dataConstruction.Construct(IConst2).W5FileGlazingSysWidth; - h2 = dataConstruction.Construct(IConst2).W5FileGlazingSysHeight; + MulWidth = state.dataConstruction->Construct(IConst).W5FileMullionWidth; + w2 = state.dataConstruction->Construct(IConst2).W5FileGlazingSysWidth; + h2 = state.dataConstruction->Construct(IConst2).W5FileGlazingSysHeight; // Correction to net area of base surface. Add back in the original glazing area and subtract the // area of the two glazing systems. Note that for Surface(SurfNum)%Class = 'Window' the effect @@ -12231,7 +12236,7 @@ namespace SurfaceGeometry { // Assign vertices to the new window; modify vertices of original window. // In the following, vertices are numbered counter-clockwise with vertex #1 at the upper left. - if (dataConstruction.Construct(IConst).W5FileMullionOrientation == Vertical) { + if (state.dataConstruction->Construct(IConst).W5FileMullionOrientation == Vertical) { // VERTICAL MULLION: original window is modified to become left-hand glazing (system #1); // new window is created to become right-hand glazing (system #2) @@ -12897,7 +12902,8 @@ namespace SurfaceGeometry { } } - void SetupEnclosuresAndAirBoundaries(Array1D &Enclosures, // Radiant or Solar Enclosures + void SetupEnclosuresAndAirBoundaries(EnergyPlusData &state, + Array1D &Enclosures, // Radiant or Solar Enclosures SurfaceGeometry::enclosureType const &EnclosureType, // Radiant or Solar bool &ErrorsFound) // Set to true if errors found { @@ -12916,12 +12922,12 @@ namespace SurfaceGeometry { } else { ShowFatalError(RoutineName + ": Illegal call to this function. Second argument must be 'RadiantEnclosures' or 'SolarEnclosures'"); } - if (std::any_of(dataConstruction.Construct.begin(), dataConstruction.Construct.end(), [](Construction::ConstructionProps const &e) { return e.TypeIsAirBoundary; })) { + if (std::any_of(state.dataConstruction->Construct.begin(), state.dataConstruction->Construct.end(), [](Construction::ConstructionProps const &e) { return e.TypeIsAirBoundary; })) { int errorCount = 0; for (int surfNum = 1; surfNum <= DataSurfaces::TotSurfaces; ++surfNum) { auto &surf(Surface(surfNum)); if (surf.Construction == 0) continue; - auto &constr(dataConstruction.Construct(surf.Construction)); + auto &constr(state.dataConstruction->Construct(surf.Construction)); if (!constr.TypeIsAirBoundary) continue; surf.IsAirBoundarySurf = true; @@ -13083,8 +13089,8 @@ namespace SurfaceGeometry { ++DataHeatBalance::NumAirBoundaryMixing; DataHeatBalance::AirBoundaryMixingZone1.push_back(zoneNum1); DataHeatBalance::AirBoundaryMixingZone2.push_back(zoneNum2); - DataHeatBalance::AirBoundaryMixingSched.push_back(dataConstruction.Construct(surf.Construction).AirBoundaryMixingSched); - Real64 mixingVol = dataConstruction.Construct(surf.Construction).AirBoundaryACH * min(Zone(zoneNum1).Volume, Zone(zoneNum2).Volume) / + DataHeatBalance::AirBoundaryMixingSched.push_back(state.dataConstruction->Construct(surf.Construction).AirBoundaryMixingSched); + Real64 mixingVol = state.dataConstruction->Construct(surf.Construction).AirBoundaryACH * min(Zone(zoneNum1).Volume, Zone(zoneNum2).Volume) / DataGlobals::SecInHour; DataHeatBalance::AirBoundaryMixingVol.push_back(mixingVol); } @@ -13535,7 +13541,8 @@ namespace SurfaceGeometry { } - void CheckForReversedLayers(bool &RevLayerDiffs, // true when differences are discovered in interzone constructions + void CheckForReversedLayers(EnergyPlusData &state, + bool &RevLayerDiffs, // true when differences are discovered in interzone constructions int const ConstrNum, // construction index int const ConstrNumRev, // construction index for reversed construction int const TotalLayers // total layers for construction definition @@ -13545,8 +13552,8 @@ namespace SurfaceGeometry { RevLayerDiffs = false; for (int LayerNo = 1; LayerNo <= TotalLayers; ++LayerNo) { - auto &thisConstLayer(dataConstruction.Construct(ConstrNum).LayerPoint(LayerNo)); - auto &revConstLayer(dataConstruction.Construct(ConstrNumRev).LayerPoint(TotalLayers - LayerNo + 1)); + auto &thisConstLayer(state.dataConstruction->Construct(ConstrNum).LayerPoint(LayerNo)); + auto &revConstLayer(state.dataConstruction->Construct(ConstrNumRev).LayerPoint(TotalLayers - LayerNo + 1)); auto &thisMatLay(dataMaterial.Material(thisConstLayer)); auto &revMatLay(dataMaterial.Material(revConstLayer)); if ((thisConstLayer != revConstLayer) || // Not pointing to the same layer diff --git a/src/EnergyPlus/SurfaceGeometry.hh b/src/EnergyPlus/SurfaceGeometry.hh index 28b3c9fb32f..75549e881ae 100644 --- a/src/EnergyPlus/SurfaceGeometry.hh +++ b/src/EnergyPlus/SurfaceGeometry.hh @@ -214,13 +214,15 @@ namespace SurfaceGeometry { int &NeedToAddSubSurfaces // Number of surfaces to add, based on unentered IZ surfaces ); - void CheckWindowShadingControlFrameDivider(std::string const &cRoutineName, // routine name calling this one (for error messages) + void CheckWindowShadingControlFrameDivider(EnergyPlusData &state, + std::string const &cRoutineName, // routine name calling this one (for error messages) bool &ErrorsFound, // true if errors have been found or are found here int const SurfNum, // current surface number int const FrameField // field number for frame/divider ); - void CheckSubSurfaceMiscellaneous(std::string const &cRoutineName, // routine name calling this one (for error messages) + void CheckSubSurfaceMiscellaneous(EnergyPlusData &state, + std::string const &cRoutineName, // routine name calling this one (for error messages) bool &ErrorsFound, // true if errors have been found or are found here int const SurfNum, // current surface number std::string const &SubSurfaceName, // name of the surface @@ -303,7 +305,7 @@ namespace SurfaceGeometry { void GetWindowShadingControlData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input - void InitialAssociateWindowShadingControlFenestration(bool &ErrorsFound, int &SurfNum); + void InitialAssociateWindowShadingControlFenestration(EnergyPlusData &state, bool &ErrorsFound, int &SurfNum); void FinalAssociateWindowShadingControlFenestration(bool &ErrorsFound); @@ -381,26 +383,29 @@ namespace SurfaceGeometry { Vector &CompCoordTranslVector // Coordinate Translation Vector ); - void CreateShadedWindowConstruction(int const SurfNum, // Surface number + void CreateShadedWindowConstruction(EnergyPlusData &state, + int const SurfNum, // Surface number int const WSCPtr, // Pointer to WindowShadingControl for SurfNum int const ShDevNum, // Shading device material number for WSCptr int const shadeControlIndex // index to the Surface().windowShadingControlList, // Surface().shadedConstructionList, and Surface().shadedStormWinConstructionList ); - void CreateStormWindowConstructions(); + void CreateStormWindowConstructions(EnergyPlusData &state); int createAirMaterialFromDistance(Real64 distance, std::string namePrefix); //return new material number // create a new construction with storm based on an old construction and storm and gap materials - int createConstructionWithStorm(int oldConstruction, std::string name, int stormMaterial, int gapMaterial); + int createConstructionWithStorm(EnergyPlusData &state, int oldConstruction, std::string name, int stormMaterial, int gapMaterial); - void ModifyWindow(int const SurfNum, // SurfNum has construction of glazing system from Window5 Data File; + void ModifyWindow(EnergyPlusData &state, + int const SurfNum, // SurfNum has construction of glazing system from Window5 Data File; bool &ErrorsFound, // Set to true if errors found int &AddedSubSurfaces // Subsurfaces added when window references a ); - void AddWindow(int const SurfNum, // SurfNum has construction of glazing system from Window5 Data File; + void AddWindow(EnergyPlusData &state, + int const SurfNum, // SurfNum has construction of glazing system from Window5 Data File; bool &ErrorsFound, // Set to true if errors found int &AddedSubSurfaces // Subsurfaces added when window references a ); @@ -414,7 +419,8 @@ namespace SurfaceGeometry { void SetupShadeSurfacesForSolarCalcs(EnergyPlusData &state); - void SetupEnclosuresAndAirBoundaries(Array1D &Enclosures, // Radiant or Solar Enclosures + void SetupEnclosuresAndAirBoundaries(EnergyPlusData &state, + Array1D &Enclosures, // Radiant or Solar Enclosures SurfaceGeometry::enclosureType const &EnclosureType, // Radiant or Solar bool &ErrorsFound); // Set to true if errors found @@ -425,7 +431,8 @@ namespace SurfaceGeometry { bool isRectangle(int const ThisSurf // Current surface number ); - void CheckForReversedLayers(bool &RevLayerDiffs, // true when differences are discovered in interzone constructions + void CheckForReversedLayers(EnergyPlusData &state, + bool &RevLayerDiffs, // true when differences are discovered in interzone constructions int const ConstrNum, // construction index int const ConstrNumRev, // construction index for reversed construction int const TotalLayers // total layers for construction definition diff --git a/src/EnergyPlus/SurfaceGroundHeatExchanger.cc b/src/EnergyPlus/SurfaceGroundHeatExchanger.cc index dac5e4cc47c..5929c64b31c 100644 --- a/src/EnergyPlus/SurfaceGroundHeatExchanger.cc +++ b/src/EnergyPlus/SurfaceGroundHeatExchanger.cc @@ -290,7 +290,7 @@ namespace SurfaceGroundHeatExchanger { // General user input data SurfaceGHE(Item).Name = cAlphaArgs(1); SurfaceGHE(Item).ConstructionName = cAlphaArgs(2); - SurfaceGHE(Item).ConstructionNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), dataConstruction.Construct); + SurfaceGHE(Item).ConstructionNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataConstruction->Construct); if (SurfaceGHE(Item).ConstructionNum == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(2) + '=' + cAlphaArgs(2)); @@ -299,7 +299,7 @@ namespace SurfaceGroundHeatExchanger { } // Error checking for surfaces, zones, and construction information - if (!dataConstruction.Construct(SurfaceGHE(Item).ConstructionNum).SourceSinkPresent) { + if (!state.dataConstruction->Construct(SurfaceGHE(Item).ConstructionNum).SourceSinkPresent) { ShowSevereError("Invalid " + cAlphaFieldNames(2) + '=' + cAlphaArgs(2)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ShowContinueError("Construction must have internal source/sink and use Construction:InternalSource object"); @@ -539,28 +539,28 @@ namespace SurfaceGroundHeatExchanger { // get QTF data - only once if (this->InitQTF) { for (Cons = 1; Cons <= TotConstructs; ++Cons) { - if (UtilityRoutines::SameString(dataConstruction.Construct(Cons).Name, this->ConstructionName)) { + if (UtilityRoutines::SameString(state.dataConstruction->Construct(Cons).Name, this->ConstructionName)) { // some error checking ?? // CTF stuff - LayerNum = dataConstruction.Construct(Cons).TotLayers; - this->NumCTFTerms = dataConstruction.Construct(Cons).NumCTFTerms; - this->CTFin = dataConstruction.Construct(Cons).CTFInside; // Z coefficents - this->CTFout = dataConstruction.Construct(Cons).CTFOutside; // X coefficents - this->CTFcross = dataConstruction.Construct(Cons).CTFCross; // Y coefficents - this->CTFflux({1, _}) = dataConstruction.Construct(Cons).CTFFlux; // F & f coefficents + LayerNum = state.dataConstruction->Construct(Cons).TotLayers; + this->NumCTFTerms = state.dataConstruction->Construct(Cons).NumCTFTerms; + this->CTFin = state.dataConstruction->Construct(Cons).CTFInside; // Z coefficents + this->CTFout = state.dataConstruction->Construct(Cons).CTFOutside; // X coefficents + this->CTFcross = state.dataConstruction->Construct(Cons).CTFCross; // Y coefficents + this->CTFflux({1, _}) = state.dataConstruction->Construct(Cons).CTFFlux; // F & f coefficents // QTF stuff - this->CTFSourceIn = dataConstruction.Construct(Cons).CTFSourceIn; // Wi coefficents - this->CTFSourceOut = dataConstruction.Construct(Cons).CTFSourceOut; // Wo coefficents - this->CTFTSourceOut = dataConstruction.Construct(Cons).CTFTSourceOut; // y coefficents - this->CTFTSourceIn = dataConstruction.Construct(Cons).CTFTSourceIn; // x coefficents - this->CTFTSourceQ = dataConstruction.Construct(Cons).CTFTSourceQ; // w coefficents + this->CTFSourceIn = state.dataConstruction->Construct(Cons).CTFSourceIn; // Wi coefficents + this->CTFSourceOut = state.dataConstruction->Construct(Cons).CTFSourceOut; // Wo coefficents + this->CTFTSourceOut = state.dataConstruction->Construct(Cons).CTFTSourceOut; // y coefficents + this->CTFTSourceIn = state.dataConstruction->Construct(Cons).CTFTSourceIn; // x coefficents + this->CTFTSourceQ = state.dataConstruction->Construct(Cons).CTFTSourceQ; // w coefficents this->ConstructionNum = Cons; // surface properties - this->BtmRoughness = dataMaterial.Material(dataConstruction.Construct(Cons).LayerPoint(LayerNum)).Roughness; - this->TopThermAbs = dataMaterial.Material(dataConstruction.Construct(Cons).LayerPoint(LayerNum)).AbsorpThermal; - this->TopRoughness = dataMaterial.Material(dataConstruction.Construct(Cons).LayerPoint(1)).Roughness; - this->TopThermAbs = dataMaterial.Material(dataConstruction.Construct(Cons).LayerPoint(1)).AbsorpThermal; - this->TopSolarAbs = dataMaterial.Material(dataConstruction.Construct(Cons).LayerPoint(1)).AbsorpSolar; + this->BtmRoughness = dataMaterial.Material(state.dataConstruction->Construct(Cons).LayerPoint(LayerNum)).Roughness; + this->TopThermAbs = dataMaterial.Material(state.dataConstruction->Construct(Cons).LayerPoint(LayerNum)).AbsorpThermal; + this->TopRoughness = dataMaterial.Material(state.dataConstruction->Construct(Cons).LayerPoint(1)).Roughness; + this->TopThermAbs = dataMaterial.Material(state.dataConstruction->Construct(Cons).LayerPoint(1)).AbsorpThermal; + this->TopSolarAbs = dataMaterial.Material(state.dataConstruction->Construct(Cons).LayerPoint(1)).AbsorpSolar; } } // set one-time flag diff --git a/src/EnergyPlus/SwimmingPool.cc b/src/EnergyPlus/SwimmingPool.cc index 9ae6c68f8a8..913d6dbfe31 100644 --- a/src/EnergyPlus/SwimmingPool.cc +++ b/src/EnergyPlus/SwimmingPool.cc @@ -249,7 +249,7 @@ namespace SwimmingPool { } } - Pool(Item).ErrorCheckSetupPoolSurface(Alphas(1),Alphas(2),cAlphaFields(2),ErrorsFound); + Pool(Item).ErrorCheckSetupPoolSurface(state, Alphas(1),Alphas(2),cAlphaFields(2),ErrorsFound); Pool(Item).AvgDepth = Numbers(1); if (Pool(Item).AvgDepth < MinDepth) { @@ -411,7 +411,8 @@ namespace SwimmingPool { } } - void SwimmingPoolData::ErrorCheckSetupPoolSurface(std::string const Alpha1, + void SwimmingPoolData::ErrorCheckSetupPoolSurface(EnergyPlusData &state, + std::string const Alpha1, std::string const Alpha2, std::string const cAlphaField2, bool &ErrorsFound @@ -445,7 +446,7 @@ namespace SwimmingPool { ShowSevereError(DataSurfaces::Surface(this->SurfacePtr).Name + " is a pool and has movable insulation. This is not allowed. Remove the movable insulation for this surface."); ErrorsFound = true; - } else if (dataConstruction.Construct(DataSurfaces::Surface(this->SurfacePtr).Construction).SourceSinkPresent) { + } else if (state.dataConstruction->Construct(DataSurfaces::Surface(this->SurfacePtr).Construction).SourceSinkPresent) { ShowSevereError( DataSurfaces::Surface(this->SurfacePtr).Name + " is a pool and uses a construction with a source/sink. This is not allowed. Use a standard construction for this surface."); diff --git a/src/EnergyPlus/SwimmingPool.hh b/src/EnergyPlus/SwimmingPool.hh index 56f207461d2..3ef46515bef 100644 --- a/src/EnergyPlus/SwimmingPool.hh +++ b/src/EnergyPlus/SwimmingPool.hh @@ -164,7 +164,8 @@ namespace SwimmingPool { void simulate(EnergyPlusData &EP_UNUSED(state), const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) override; - void ErrorCheckSetupPoolSurface(std::string const Alpha1, + void ErrorCheckSetupPoolSurface(EnergyPlusData &state, + std::string const Alpha1, std::string const Alpha2, std::string const cAlphaField2, bool &ErrorsFound diff --git a/src/EnergyPlus/ThermalComfort.cc b/src/EnergyPlus/ThermalComfort.cc index 23d3fe4b4e8..b0f04974a5c 100644 --- a/src/EnergyPlus/ThermalComfort.cc +++ b/src/EnergyPlus/ThermalComfort.cc @@ -394,9 +394,9 @@ namespace ThermalComfort { } if (!DoingSizing && !WarmupFlag) { - CalcThermalComfortFanger(); - CalcThermalComfortPierce(); - CalcThermalComfortKSU(); + CalcThermalComfortFanger(state); + CalcThermalComfortPierce(state); + CalcThermalComfortKSU(state); CalcThermalComfortSimpleASH55(); CalcIfSetPointMet(state); if (ASH55Flag) CalcThermalComfortAdaptiveASH55(state, false); @@ -663,7 +663,8 @@ namespace ThermalComfort { ZoneOccHrs.dimension(NumOfZones, 0.0); } - void CalcThermalComfortFanger(Optional_int_const PNum, // People number for thermal comfort control + void CalcThermalComfortFanger(EnergyPlusData &state, + Optional_int_const PNum, // People number for thermal comfort control Optional Tset, // Temperature setpoint for thermal comfort control Optional PMVResult // PMV value for thermal comfort control ) @@ -744,7 +745,7 @@ namespace ThermalComfort { AirTemp = ZTAVComf(ZoneNum); } } - RadTemp = CalcRadTemp(PeopleNum); + RadTemp = CalcRadTemp(state, PeopleNum); // Use mean air temp for calculating RH when thermal comfort control is used if (present(PNum)) { RelHum = PsyRhFnTdbWPb(MAT(ZoneNum), ZoneAirHumRatAvgComf(ZoneNum), OutBaroPress); @@ -932,7 +933,7 @@ namespace ThermalComfort { } } - void CalcThermalComfortPierce() + void CalcThermalComfortPierce(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -1029,7 +1030,7 @@ namespace ThermalComfort { } else { AirTemp = ZTAVComf(ZoneNum); } - RadTemp = CalcRadTemp(PeopleNum); + RadTemp = CalcRadTemp(state, PeopleNum); RelHum = PsyRhFnTdbWPb(AirTemp, ZoneAirHumRatAvgComf(ZoneNum), OutBaroPress); // Metabolic rate of body (W/m2) ActLevel = GetCurrentScheduleValue(People(PeopleNum).ActivityLevelPtr) / BodySurfArea; @@ -1378,7 +1379,7 @@ namespace ThermalComfort { } } - void CalcThermalComfortKSU() + void CalcThermalComfortKSU(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -1449,7 +1450,7 @@ namespace ThermalComfort { } else { AirTemp = ZTAVComf(ZoneNum); } - RadTemp = CalcRadTemp(PeopleNum); + RadTemp = CalcRadTemp(state, PeopleNum); RelHum = PsyRhFnTdbWPb(AirTemp, ZoneAirHumRatAvgComf(ZoneNum), OutBaroPress); ActLevel = GetCurrentScheduleValue(People(PeopleNum).ActivityLevelPtr) / BodySurfArea; WorkEff = GetCurrentScheduleValue(People(PeopleNum).WorkEffPtr) * ActLevel; @@ -1960,7 +1961,7 @@ namespace ThermalComfort { } } - Real64 CalcAngleFactorMRT(int const AngleFacNum) + Real64 CalcAngleFactorMRT(EnergyPlusData &state, int const AngleFacNum) { // SUBROUTINE INFORMATION: @@ -1995,7 +1996,7 @@ namespace ThermalComfort { for (SurfNum = 1; SurfNum <= thisAngFacList.TotAngleFacSurfaces; ++SurfNum) { SurfaceTemp = TH(2, 1, thisAngFacList.SurfacePtr(SurfNum)) + KelvinConv; - SurfEAF = dataConstruction.Construct(Surface(thisAngFacList.SurfacePtr(SurfNum)).Construction).InsideAbsorpThermal * thisAngFacList.AngleFactor(SurfNum); + SurfEAF = state.dataConstruction->Construct(Surface(thisAngFacList.SurfacePtr(SurfNum)).Construction).InsideAbsorpThermal * thisAngFacList.AngleFactor(SurfNum); SurfTempEmissAngleFacSummed += SurfEAF * pow_4(SurfaceTemp); SumSurfaceEmissAngleFactor += SurfEAF; } @@ -2005,7 +2006,7 @@ namespace ThermalComfort { return CalcAngleFactorMRT; } - Real64 CalcSurfaceWeightedMRT(int const ZoneNum, int const SurfNum) + Real64 CalcSurfaceWeightedMRT(EnergyPlusData &state, int const ZoneNum, int const SurfNum) { // Purpose: Calculate a modified zone MRT that excludes the Surface( SurfNum ). @@ -2043,7 +2044,7 @@ namespace ThermalComfort { ZoneAESum = 0.0; for (SurfNum2 = 1; SurfNum2 <= TotSurfaces; ++SurfNum2) { if (Surface(SurfNum2).HeatTransSurf) { - SurfaceAE(SurfNum2) = Surface(SurfNum2).Area * dataConstruction.Construct(Surface(SurfNum2).Construction).InsideAbsorpThermal; + SurfaceAE(SurfNum2) = Surface(SurfNum2).Area * state.dataConstruction->Construct(Surface(SurfNum2).Construction).InsideAbsorpThermal; ZoneNum2 = Surface(SurfNum2).Zone; // Do NOT include the contribution of the Surface that is being surface weighted in this calculation since it will already be // accounted for @@ -2058,7 +2059,7 @@ namespace ThermalComfort { ZoneAESum(ZoneNum) = 0.0; for (SurfNum2 = Zone(ZoneNum).SurfaceFirst; SurfNum2 <= Zone(ZoneNum).SurfaceLast; ++SurfNum2) { if ((Surface(SurfNum2).HeatTransSurf) && (SurfNum2 != SurfNum)) { - SurfaceAE(SurfNum2) = Surface(SurfNum2).Area * dataConstruction.Construct(Surface(SurfNum2).Construction).InsideAbsorpThermal; + SurfaceAE(SurfNum2) = Surface(SurfNum2).Area * state.dataConstruction->Construct(Surface(SurfNum2).Construction).InsideAbsorpThermal; SumAET += SurfaceAE(SurfNum2) * TH(2, 1, SurfNum2); ZoneAESum(ZoneNum) += SurfaceAE(SurfNum2); } @@ -2101,7 +2102,7 @@ namespace ThermalComfort { return 6.16796 + 358.1855 * pow_2(XT) - 550.3543 * pow_3(XT) + 1048.8115 * pow_4(XT); } - Real64 CalcRadTemp(int const PeopleListNum) // Type of MRT calculation (zone averaged or surface weighted) + Real64 CalcRadTemp(EnergyPlusData &state, int const PeopleListNum) // Type of MRT calculation (zone averaged or surface weighted) { // FUNCTION INFORMATION: @@ -2164,9 +2165,9 @@ namespace ThermalComfort { } else if (SELECT_CASE_var == SurfaceWeighted) { ZoneRadTemp = MRT(ZoneNum); SurfaceTemp = TH(2, 1, People(PeopleListNum).SurfacePtr); - RadTemp = CalcSurfaceWeightedMRT(ZoneNum, People(PeopleListNum).SurfacePtr); + RadTemp = CalcSurfaceWeightedMRT(state, ZoneNum, People(PeopleListNum).SurfacePtr); } else if (SELECT_CASE_var == AngleFactor) { - RadTemp = CalcAngleFactorMRT(People(PeopleListNum).AngleFactorListPtr); + RadTemp = CalcAngleFactorMRT(state, People(PeopleListNum).AngleFactorListPtr); } } @@ -2782,7 +2783,7 @@ namespace ThermalComfort { } else { AirTemp = ZTAVComf(ZoneNum); } - RadTemp = CalcRadTemp(PeopleNum); + RadTemp = CalcRadTemp(state, PeopleNum); OpTemp = (AirTemp + RadTemp) / 2.0; ThermalComfortData(PeopleNum).ThermalComfortOpTemp = OpTemp; ThermalComfortData(PeopleNum).ASHRAE55RunningMeanOutdoorTemp = runningAverageASH; @@ -2985,7 +2986,7 @@ namespace ThermalComfort { } else { AirTemp = ZTAVComf(ZoneNum); } - RadTemp = CalcRadTemp(PeopleNum); + RadTemp = CalcRadTemp(state, PeopleNum); OpTemp = (AirTemp + RadTemp) / 2.0; ThermalComfortData(PeopleNum).ThermalComfortOpTemp = OpTemp; ThermalComfortData(PeopleNum).CEN15251RunningMeanOutdoorTemp = runningAverageCEN; diff --git a/src/EnergyPlus/ThermalComfort.hh b/src/EnergyPlus/ThermalComfort.hh index 050d9bb5731..f04f32de75c 100644 --- a/src/EnergyPlus/ThermalComfort.hh +++ b/src/EnergyPlus/ThermalComfort.hh @@ -291,14 +291,15 @@ namespace ThermalComfort { void InitThermalComfort(EnergyPlusData &state); - void CalcThermalComfortFanger(Optional_int_const PNum = _, // People number for thermal comfort control + void CalcThermalComfortFanger(EnergyPlusData &state, + Optional_int_const PNum = _, // People number for thermal comfort control Optional Tset = _, // Temperature setpoint for thermal comfort control Optional PMVResult = _ // PMV value for thermal comfort control ); - void CalcThermalComfortPierce(); + void CalcThermalComfortPierce(EnergyPlusData &state); - void CalcThermalComfortKSU(); + void CalcThermalComfortKSU(EnergyPlusData &state); void DERIV(int &TempIndiceNum, // Number of temperature indices unused1208 Array1D &Temp, // Temperature unused1208 @@ -309,13 +310,13 @@ namespace ThermalComfort { void GetAngleFactorList(EnergyPlusData &state); - Real64 CalcAngleFactorMRT(int const AngleFacNum); + Real64 CalcAngleFactorMRT(EnergyPlusData &state, int const AngleFacNum); - Real64 CalcSurfaceWeightedMRT(int const ZoneNum, int const SurfNum); + Real64 CalcSurfaceWeightedMRT(EnergyPlusData &state, int const ZoneNum, int const SurfNum); Real64 CalcSatVapPressFromTemp(Real64 const Temp); - Real64 CalcRadTemp(int const PeopleListNum); // Type of MRT calculation (zone averaged or surface weighted) + Real64 CalcRadTemp(EnergyPlusData &state, int const PeopleListNum); // Type of MRT calculation (zone averaged or surface weighted) void CalcThermalComfortSimpleASH55(); diff --git a/src/EnergyPlus/TranspiredCollector.cc b/src/EnergyPlus/TranspiredCollector.cc index 5061540159b..192b7c91432 100644 --- a/src/EnergyPlus/TranspiredCollector.cc +++ b/src/EnergyPlus/TranspiredCollector.cc @@ -1080,7 +1080,7 @@ namespace TranspiredCollector { LocalWindArr(ThisSurf) = Surface(SurfPtr).WindSpeed; InitExteriorConvectionCoeff(state, SurfPtr, HMovInsul, Roughness, AbsExt, TempExt, HExt, HSkyARR(ThisSurf), HGroundARR(ThisSurf), HAirARR(ThisSurf)); ConstrNum = Surface(SurfPtr).Construction; - AbsThermSurf = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; + AbsThermSurf = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermal; TsoK = TH(1, 1, SurfPtr) + KelvinConv; TscollK = UTSC(UTSCNum).TcollLast + KelvinConv; HPlenARR(ThisSurf) = Sigma * AbsExt * AbsThermSurf * (pow_4(TscollK) - pow_4(TsoK)) / (TscollK - TsoK); diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 104c72dd6ff..c74f6ca03b8 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -1972,19 +1972,19 @@ namespace UnitarySystems { if (this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed || this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) { if (this->m_CoolCoilExists && this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { - Real64 MaxSpeedFlowRate = VariableSpeedCoils::VarSpeedCoil(this->m_CoolingCoilIndex) - .MSRatedAirVolFlowRate(VariableSpeedCoils::VarSpeedCoil(this->m_CoolingCoilIndex).NumOfSpeeds); + Real64 MaxSpeedFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex) + .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).NumOfSpeeds); if (MaxSpeedFlowRate > 0.0) { NoLoadCoolingAirFlowRateRatio = - VariableSpeedCoils::VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(1) / MaxSpeedFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(1) / MaxSpeedFlowRate; } } if (this->m_HeatCoilExists && this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingAirToAirVariableSpeed) { - Real64 MaxSpeedFlowRate = VariableSpeedCoils::VarSpeedCoil(this->m_HeatingCoilIndex) - .MSRatedAirVolFlowRate(VariableSpeedCoils::VarSpeedCoil(this->m_HeatingCoilIndex).NumOfSpeeds); + Real64 MaxSpeedFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex) + .MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).NumOfSpeeds); if (MaxSpeedFlowRate > 0.0) { NoLoadHeatingAirFlowRateRatio = - VariableSpeedCoils::VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowRate(1) / MaxSpeedFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowRate(1) / MaxSpeedFlowRate; } } this->m_NoLoadAirFlowRateRatio = min(NoLoadCoolingAirFlowRateRatio, NoLoadHeatingAirFlowRateRatio); @@ -2137,11 +2137,11 @@ namespace UnitarySystems { 0.0, 0.0, 0.0); // conduct the sizing operation in the VS WSHP - if (this->m_NumOfSpeedCooling != VariableSpeedCoils::VarSpeedCoil(this->m_CoolingCoilIndex).NumOfSpeeds) { + if (this->m_NumOfSpeedCooling != state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).NumOfSpeeds) { ShowWarningError(RoutineName + ": " + CompType + " = " + CompName); ShowContinueError("Number of cooling speeds does not match coil object."); - ShowFatalError("Cooling coil = " + VariableSpeedCoils::VarSpeedCoil(this->m_CoolingCoilIndex).VarSpeedCoilType + ": " + - VariableSpeedCoils::VarSpeedCoil(this->m_CoolingCoilIndex).Name); + ShowFatalError("Cooling coil = " + state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).VarSpeedCoilType + ": " + + state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).Name); } DataSizing::DXCoolCap = VariableSpeedCoils::GetCoilCapacityVariableSpeed(state, DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num), this->m_CoolingCoilName, ErrFound); @@ -2149,7 +2149,7 @@ namespace UnitarySystems { EqSizing.DesHeatingLoad = DataSizing::DXCoolCap; for (Iter = 1; Iter <= this->m_NumOfSpeedCooling; ++Iter) { - this->m_CoolVolumeFlowRate[Iter] = VariableSpeedCoils::VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(Iter); + this->m_CoolVolumeFlowRate[Iter] = state.dataVariableSpeedCoils->VarSpeedCoil(this->m_CoolingCoilIndex).MSRatedAirVolFlowRate(Iter); this->m_CoolMassFlowRate[Iter] = this->m_CoolVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; this->m_MSCoolingSpeedRatio[Iter] = this->m_CoolVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate; } @@ -2386,11 +2386,11 @@ namespace UnitarySystems { 0.0, 0.0); // conduct the sizing operation in the VS WSHP - if (this->m_NumOfSpeedHeating != VariableSpeedCoils::VarSpeedCoil(this->m_HeatingCoilIndex).NumOfSpeeds) { + if (this->m_NumOfSpeedHeating != state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).NumOfSpeeds) { ShowWarningError(RoutineName + ": " + CompType + " = " + CompName); ShowContinueError("Number of heating speeds does not match coil object."); - ShowFatalError("Heating coil = " + VariableSpeedCoils::VarSpeedCoil(this->m_HeatingCoilIndex).VarSpeedCoilType + ": " + - VariableSpeedCoils::VarSpeedCoil(this->m_HeatingCoilIndex).Name); + ShowFatalError("Heating coil = " + state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).VarSpeedCoilType + ": " + + state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).Name); } if (this->m_NumOfSpeedHeating > 0) { @@ -2400,7 +2400,7 @@ namespace UnitarySystems { } for (Iter = 1; Iter <= this->m_NumOfSpeedHeating; ++Iter) { - this->m_HeatVolumeFlowRate[Iter] = VariableSpeedCoils::VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowRate(Iter); + this->m_HeatVolumeFlowRate[Iter] = state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex).MSRatedAirVolFlowRate(Iter); this->m_HeatMassFlowRate[Iter] = this->m_HeatVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; if (this->m_DesignFanVolFlowRate > 0.0 && this->m_FanExists) { this->m_MSHeatingSpeedRatio[Iter] = this->m_HeatVolumeFlowRate[Iter] / this->m_DesignFanVolFlowRate; @@ -5106,7 +5106,7 @@ namespace UnitarySystems { // Set fan info if (thisSys.m_FanExists) { - VariableSpeedCoils::setVarSpeedFanInfo( + VariableSpeedCoils::setVarSpeedFanInfo(state, thisSys.m_CoolingCoilIndex, loc_m_FanName, thisSys.m_FanIndex, thisSys.m_FanType_Num); } } diff --git a/src/EnergyPlus/VariableSpeedCoils.cc b/src/EnergyPlus/VariableSpeedCoils.cc index 08eaca3f884..93414338594 100644 --- a/src/EnergyPlus/VariableSpeedCoils.cc +++ b/src/EnergyPlus/VariableSpeedCoils.cc @@ -109,189 +109,8 @@ namespace VariableSpeedCoils { using DXCoils::CalcCBF; using General::RoundSigDigits; - // Use statements for access to subroutines in other modules - - // Data - // MODULE PARAMETER DEFINITIONS - - Real64 const RatedInletAirTemp(26.6667); // 26.6667C or 80F - Real64 const RatedInletWetBulbTemp(19.4444); // 19.44 or 67F, cooling mode - Real64 const RatedInletAirHumRat(0.0111847); // Humidity ratio corresponding to 80F dry bulb/67F wet bulb - Real64 const RatedInletWaterTemp(29.4444); // 85 F cooling mode - Real64 const RatedAmbAirTemp(35.0); // 95 F cooling mode - Real64 const RatedInletAirTempHeat(21.1111); // 21.11C or 70F, heating mode - Real64 const RatedInletWaterTempHeat(21.1111); // 21.11C or 70F, heating mode - Real64 const RatedAmbAirTempHeat(8.3333); // 8.33 or 47F, heating mode - Real64 const RatedAmbAirWBHeat(6.1111); // 8.33 or 43F, heating mode, rated wet bulb temperature - - // 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); - - // Curve Types - int const Linear(1); - int const BiLinear(2); - int const Quadratic(3); - int const BiQuadratic(4); - int const Cubic(5); - - // 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 - - int const MaxSpedLevels(10); // Maximum number of speed that supports - static std::string const BlankString; - // DERIVED TYPE DEFINITIONS - - // MODULE VARIABLE DECLARATIONS: - // Identifier is VarSpeedCoil - int NumVarSpeedCoils(0); // The Number of Water to Air Heat Pumps found in the Input - - bool MyOneTimeFlag(true); // one time allocation flag - bool GetCoilsInputFlag(true); // Flag set to make sure you get input once - // LOGICAL, ALLOCATABLE, DIMENSION(:) :: MySizeFlag - - Real64 SourceSideMassFlowRate(0.0); // Source Side Mass flow rate [Kg/s] - Real64 SourceSideInletTemp(0.0); // Source Side Inlet Temperature [C] - Real64 SourceSideInletEnth(0.0); // Source Side Inlet Enthalpy [J/kg] - Real64 LoadSideMassFlowRate(0.0); // Load Side Mass flow rate [Kg/s] - Real64 LoadSideInletDBTemp(0.0); // Load Side Inlet Dry Bulb Temp [C] - Real64 LoadSideInletWBTemp(0.0); // Load Side Inlet Wet Bulb Temp [C] - Real64 LoadSideInletHumRat(0.0); // Load Side Outlet Humidity ratio - Real64 LoadSideInletEnth(0.0); // Load Side Inlet Enthalpy [J/kg] - Real64 LoadSideOutletDBTemp(0.0); // Load Side Outlet Dry Bulb Temp [C] - Real64 LoadSideOutletHumRat(0.0); // Load Side Outlet Humidity ratio - Real64 LoadSideOutletEnth(0.0); // Load Side Outlet Enthalpy [J/kg] - Real64 QSensible(0.0); // Load side sensible heat transfer rate [W] - Real64 QLoadTotal(0.0); // Load side total heat transfer rate [W] - Real64 QLatRated(0.0); // Latent Capacity [W] rated at entering air conditions [Tdb=26.7C Twb=19.4C] - Real64 QLatActual(0.0); // Actual Latent Capacity [W] - Real64 QSource(0.0); // Source side heat transfer rate [W] - Real64 Winput(0.0); // Power Consumption [W] - Real64 PLRCorrLoadSideMdot(0.0); // Load Side Mdot corrected for Part Load Ratio of the unit - - Real64 VSHPWHHeatingCapacity(0.0); // Used by Heat Pump:Water Heater object as total water heating capacity [W] - Real64 VSHPWHHeatingCOP(0.0); // Used by Heat Pump:Water Heater object as water heating COP [W/W] - - // SUBROUTINE SPECIFICATIONS FOR MODULE - - // Driver/Manager Routines - - // Get Input routines for module - - // Initialization routines for module - - // Update routines to check convergence and update nodes - - // Update routine - - // Utility routines - // SHR, bypass factor routines - - // Object Data - Array1D VarSpeedCoil; - bool firstTime(true); - - // MODULE SUBROUTINES: - //************************************************************************* - - // Functions - void clear_state() - { - NumVarSpeedCoils = 0; - MyOneTimeFlag = true; - GetCoilsInputFlag = true; - SourceSideMassFlowRate = 0.0; - SourceSideInletTemp = 0.0; - SourceSideInletEnth = 0.0; - LoadSideMassFlowRate = 0.0; - LoadSideInletDBTemp = 0.0; - LoadSideInletWBTemp = 0.0; - LoadSideInletHumRat = 0.0; - LoadSideInletEnth = 0.0; - LoadSideOutletDBTemp = 0.0; - LoadSideOutletHumRat = 0.0; - LoadSideOutletEnth = 0.0; - QSensible = 0.0; - QLoadTotal = 0.0; - QLatRated = 0.0; - QLatActual = 0.0; - QSource = 0.0; - Winput = 0.0; - PLRCorrLoadSideMdot = 0.0; - VSHPWHHeatingCapacity = 0.0; - VSHPWHHeatingCOP = 0.0; - VarSpeedCoil.deallocate(); - firstTime = true; - } - - // Default Constructor - VariableSpeedCoilData::VariableSpeedCoilData() - : NumOfSpeeds(2), NormSpedLevel(MaxSpedLevels), RatedWaterVolFlowRate(AutoSize), RatedWaterMassFlowRate(AutoSize), - RatedAirVolFlowRate(AutoSize), RatedCapHeat(AutoSize), RatedCapCoolTotal(AutoSize), MaxONOFFCyclesperHour(0.0), Twet_Rated(0.0), - Gamma_Rated(0.0), HOTGASREHEATFLG(0), HPTimeConstant(0.0), PLFFPLR(0), VSCoilTypeOfNum(0), SimFlag(false), DesignWaterMassFlowRate(0.0), - DesignWaterVolFlowRate(0.0), DesignAirMassFlowRate(0.0), DesignAirVolFlowRate(0.0), AirVolFlowRate(0.0), AirMassFlowRate(0.0), - InletAirPressure(0.0), InletAirDBTemp(0.0), InletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirDBTemp(0.0), OutletAirHumRat(0.0), - OutletAirEnthalpy(0.0), WaterVolFlowRate(0.0), WaterMassFlowRate(0.0), InletWaterTemp(0.0), InletWaterEnthalpy(0.0), OutletWaterTemp(0.0), - OutletWaterEnthalpy(0.0), Power(0.0), QLoadTotal(0.0), QSensible(0.0), QLatent(0.0), QSource(0.0), QWasteHeat(0.0), Energy(0.0), - EnergyLoadTotal(0.0), EnergySensible(0.0), EnergyLatent(0.0), EnergySource(0.0), COP(0.0), RunFrac(0.0), PartLoadRatio(0.0), - RatedPowerHeat(0.0), RatedCOPHeat(0.0), RatedCapCoolSens(0.0), RatedPowerCool(0.0), RatedCOPCool(0.0), AirInletNodeNum(0), - AirOutletNodeNum(0), WaterInletNodeNum(0), WaterOutletNodeNum(0), LoopNum(0), LoopSide(0), BranchNum(0), CompNum(0), - FindCompanionUpStreamCoil(true), IsDXCoilInZone(false), CompanionCoolingCoilNum(0), CompanionHeatingCoilNum(0), FanDelayTime(0.0), - // This one calls into a std::vector, so it's 0-indexed, so we initialize it to -1 - MSHPDesignSpecIndex(-1), MSErrIndex(MaxSpedLevels, 0), MSRatedPercentTotCap(MaxSpedLevels, 0.0), MSRatedTotCap(MaxSpedLevels, 0.0), - MSRatedSHR(MaxSpedLevels, 0.0), MSRatedCOP(MaxSpedLevels, 0.0), MSRatedAirVolFlowPerRatedTotCap(MaxSpedLevels, 0.0), - MSRatedAirVolFlowRate(MaxSpedLevels, 0.0), MSRatedAirMassFlowRate(MaxSpedLevels, 0.0), - MSRatedWaterVolFlowPerRatedTotCap(MaxSpedLevels, 0.0), MSRatedWaterVolFlowRate(MaxSpedLevels, 0.0), - MSRatedWaterMassFlowRate(MaxSpedLevels, 0.0), MSRatedCBF(MaxSpedLevels, 0.0), MSEffectiveAo(MaxSpedLevels, 0.0), - MSCCapFTemp(MaxSpedLevels, 0), MSCCapAirFFlow(MaxSpedLevels, 0), MSCCapWaterFFlow(MaxSpedLevels, 0), MSEIRFTemp(MaxSpedLevels, 0), - MSEIRAirFFlow(MaxSpedLevels, 0), MSEIRWaterFFlow(MaxSpedLevels, 0), MSWasteHeat(MaxSpedLevels, 0), MSWasteHeatFrac(MaxSpedLevels, 0.0), - MSWHPumpPower(MaxSpedLevels, 0.0), MSWHPumpPowerPerRatedTotCap(MaxSpedLevels, 0.0), SpeedNumReport(0.0), SpeedRatioReport(0.0), - DefrostStrategy(0), DefrostControl(0), EIRFPLR(0), DefrostEIRFT(0), MinOATCompressor(0.0), OATempCompressorOn(0.0), MaxOATDefrost(0.0), - DefrostTime(0.0), DefrostCapacity(0.0), HPCompressorRuntime(0.0), HPCompressorRuntimeLast(0.0), TimeLeftToDefrost(0.0), DefrostPower(0.0), - DefrostConsumption(0.0), ReportCoolingCoilCrankcasePower(true), CrankcaseHeaterCapacity(0.0), CrankcaseHeaterPower(0.0), - MaxOATCrankcaseHeater(0.0), CrankcaseHeaterConsumption(0.0), CondenserInletNodeNum(0), CondenserType(AirCooled), ReportEvapCondVars(false), - EvapCondPumpElecNomPower(0.0), EvapCondPumpElecPower(0.0), EvapWaterConsumpRate(0.0), EvapCondPumpElecConsumption(0.0), - EvapWaterConsump(0.0), BasinHeaterConsumption(0.0), BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0), BasinHeaterPower(0.0), - BasinHeaterSchedulePtr(0), EvapCondAirFlow(MaxSpedLevels, 0.0), EvapCondEffect(MaxSpedLevels, 0.0), - MSRatedEvapCondVolFlowPerRatedTotCap(MaxSpedLevels, 0.0), EvapWaterSupplyMode(WaterSupplyFromMains), EvapWaterSupTankID(0), - EvapWaterTankDemandARRID(0), CondensateCollectMode(CondensateDiscarded), CondensateTankID(0), CondensateTankSupplyARRID(0), - CondensateVdot(0.0), CondensateVol(0.0), CondInletTemp(0.0), SupplyFanIndex(0), SupplyFan_TypeNum(0), SourceAirMassFlowRate(0.0), - InletSourceAirTemp(0.0), InletSourceAirEnthalpy(0.0), - // begin varibles for HPWH - RatedCapWH(0.0), // Rated water heating Capacity [W] - InletAirTemperatureType(0), // Specifies to use either air wet-bulb or dry-bulb temp for curve objects - WHRatedInletDBTemp(0.0), // Rated inlet air dry-bulb temperature [C] - WHRatedInletWBTemp(0.0), // Rated inlet air wet-bulb temperature [C] - WHRatedInletWaterTemp(0.0), // Rated condenser water inlet temperature [C] - HPWHCondPumpElecNomPower(0.0), // Nominal power input to the condenser water circulation pump [W] - HPWHCondPumpFracToWater(1.0), // Nominal power fraction to water for the condenser water circulation pump - RatedHPWHCondWaterFlow(0.0), // Rated water flow rate through the condenser of the HPWH DX coil [m3/s] - ElecWaterHeatingPower(0.0), // Total electric power consumed by compressor and condenser pump [W] - ElecWaterHeatingConsumption(0.0), // Total electric consumption by compressor and condenser pump [J] - FanPowerIncludedInCOP(false), // Indicates that fan heat is included in heating capacity and COP - CondPumpHeatInCapacity(false), // Indicates that condenser pump heat is included in heating capacity - CondPumpPowerInCOP(false), // Indicates that condenser pump power is included in heating COP - AirVolFlowAutoSized(false), // Used to report autosizing info for the HPWH DX coil - WaterVolFlowAutoSized(false), // Used to report autosizing info for the HPWH DX coil - TotalHeatingEnergy(0.0), // total water heating energy - TotalHeatingEnergyRate(0.0), // total WH energy rate - bIsDesuperheater(false), // whether the coil is used for a desuperheater, i.e. zero all the cooling capacity and power - // end variables for HPWH - reportCoilFinalSizes(true), // coil report - capModFacTotal(0.0) // coil report - - { - } - void SimVariableSpeedCoils(EnergyPlusData &state, std::string const &CompName, // Coil Name int &CompIndex, // Index for Component name @@ -329,26 +148,26 @@ namespace VariableSpeedCoils { int SpeedCal; // variable for error proof speed input // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } if (CompIndex == 0) { - DXCoilNum = UtilityRoutines::FindItemInList(CompName, VarSpeedCoil); + DXCoilNum = UtilityRoutines::FindItemInList(CompName, state.dataVariableSpeedCoils->VarSpeedCoil); if (DXCoilNum == 0) { ShowFatalError("WaterToAirHPVSWEquationFit not found=" + CompName); } CompIndex = DXCoilNum; } else { DXCoilNum = CompIndex; - if (DXCoilNum > NumVarSpeedCoils || DXCoilNum < 1) { + if (DXCoilNum > state.dataVariableSpeedCoils->NumVarSpeedCoils || DXCoilNum < 1) { ShowFatalError("SimVariableSpeedCoils: Invalid CompIndex passed=" + TrimSigDigits(DXCoilNum) + - ", Number of Water to Air HPs=" + TrimSigDigits(NumVarSpeedCoils) + ", WaterToAir HP name=" + CompName); + ", Number of Water to Air HPs=" + TrimSigDigits(state.dataVariableSpeedCoils->NumVarSpeedCoils) + ", WaterToAir HP name=" + CompName); } - if (!CompName.empty() && CompName != VarSpeedCoil(DXCoilNum).Name) { + if (!CompName.empty() && CompName != state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name) { ShowFatalError("SimVariableSpeedCoils: Invalid CompIndex passed=" + TrimSigDigits(DXCoilNum) + ", WaterToAir HP name=" + CompName + - ", stored WaterToAir HP Name for that index=" + VarSpeedCoil(DXCoilNum).Name); + ", stored WaterToAir HP Name for that index=" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); } } @@ -365,8 +184,8 @@ namespace VariableSpeedCoils { SpeedCal = SpeedNum; } - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) || - (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) || + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed)) { // Cooling mode InitVarSpeedCoil(state, DXCoilNum, @@ -381,9 +200,9 @@ namespace VariableSpeedCoils { SpeedCal); CalcVarSpeedCoilCooling( state, DXCoilNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadFrac, OnOffAirFlowRatio, SpeedRatio, SpeedCal); - UpdateVarSpeedCoil(DXCoilNum); - } else if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) || - (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed)) { + UpdateVarSpeedCoil(state, DXCoilNum); + } else if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) || + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed)) { // Heating mode InitVarSpeedCoil(state, DXCoilNum, @@ -397,8 +216,8 @@ namespace VariableSpeedCoils { SpeedRatio, SpeedCal); CalcVarSpeedCoilHeating(state, DXCoilNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadFrac, OnOffAirFlowRatio, SpeedRatio, SpeedCal); - UpdateVarSpeedCoil(DXCoilNum); - } else if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed) { + UpdateVarSpeedCoil(state, DXCoilNum); + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed) { // Heating mode InitVarSpeedCoil(state, DXCoilNum, @@ -412,14 +231,14 @@ namespace VariableSpeedCoils { SpeedRatio, SpeedCal); CalcVarSpeedHPWH(state, DXCoilNum, RuntimeFrac, PartLoadFrac, SpeedRatio, SpeedNum, CyclingScheme); - UpdateVarSpeedCoil(DXCoilNum); + UpdateVarSpeedCoil(state, DXCoilNum); } else { ShowFatalError("SimVariableSpeedCoils: WatertoAir heatpump not in either HEATING or COOLING mode"); } // two additional output variables - VarSpeedCoil(DXCoilNum).SpeedNumReport = SpeedCal; - VarSpeedCoil(DXCoilNum).SpeedRatioReport = SpeedRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport = SpeedCal; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport = SpeedRatio; } void GetVarSpeedCoilInput(EnergyPlusData &state) @@ -487,18 +306,18 @@ namespace VariableSpeedCoils { NumCoolAS = inputProcessor->getNumObjectsFound("COIL:COOLING:DX:VARIABLESPEED"); NumHeatAS = inputProcessor->getNumObjectsFound("COIL:HEATING:DX:VARIABLESPEED"); NumHPWHAirToWater = inputProcessor->getNumObjectsFound("COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED"); - NumVarSpeedCoils = NumCool + NumHeat + NumCoolAS + NumHeatAS + NumHPWHAirToWater; + state.dataVariableSpeedCoils->NumVarSpeedCoils = NumCool + NumHeat + NumCoolAS + NumHeatAS + NumHPWHAirToWater; DXCoilNum = 0; - if (NumVarSpeedCoils <= 0) { + if (state.dataVariableSpeedCoils->NumVarSpeedCoils <= 0) { ShowSevereError("No Equipment found in GetVarSpeedCoilInput"); ErrorsFound = true; } // Allocate Arrays - if (NumVarSpeedCoils > 0) { - VarSpeedCoil.allocate(NumVarSpeedCoils); - DataHeatBalance::HeatReclaimVS_DXCoil.allocate(NumVarSpeedCoils); + if (state.dataVariableSpeedCoils->NumVarSpeedCoils > 0) { + state.dataVariableSpeedCoils->VarSpeedCoil.allocate(state.dataVariableSpeedCoils->NumVarSpeedCoils); + DataHeatBalance::HeatReclaimVS_DXCoil.allocate(state.dataVariableSpeedCoils->NumVarSpeedCoils); } inputProcessor->getObjectDefMaxArgs("COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT", NumParams, NumAlphas, NumNums); @@ -551,102 +370,102 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - VarSpeedCoil(DXCoilNum).Name = AlphArray(1); - VarSpeedCoil(DXCoilNum).CoolHeatType = "COOLING"; - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit; - VarSpeedCoil(DXCoilNum).VarSpeedCoilType = DataHVACGlobals::cAllCoilTypes(VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum); - VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = NumArray(3); - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); - VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = NumArray(5); - VarSpeedCoil(DXCoilNum).Twet_Rated = NumArray(6); - VarSpeedCoil(DXCoilNum).Gamma_Rated = NumArray(7); - VarSpeedCoil(DXCoilNum).HOTGASREHEATFLG = int(NumArray(8)); - VarSpeedCoil(DXCoilNum).CondenserType = WaterCooled; - - VarSpeedCoil(DXCoilNum).WaterInletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "COOLING"; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = DataHVACGlobals::cAllCoilTypes(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = NumArray(3); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = NumArray(5); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated = NumArray(6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated = NumArray(7); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HOTGASREHEATFLG = int(NumArray(8)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = WaterCooled; + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Water, NodeConnectionType_Inlet, 2, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Water, NodeConnectionType_Outlet, 2, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); TestCompSet(CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); - // If (VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then - if (VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + // If (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(1) + " must be >= 1. entered number is " + TrimSigDigits(NumArray(1), 0)); ErrorsFound = true; } - if (VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - VarSpeedCoil(DXCoilNum).NormSpedLevel = VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; } - if ((VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(2) + " must be valid speed level entered number is " + TrimSigDigits(NumArray(2), 0)); ErrorsFound = true; } // part load curve - VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(6)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(6)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(6)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(6) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(6) + "=\"" + AlphArray(6) + "\"."); } ErrorsFound = true; } else { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(6) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } } - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(9 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(10 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(11 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(12 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) = NumArray(13 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(I) = NumArray(14 + (I - 1) * 6); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(9 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(10 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(11 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(12 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) = NumArray(13 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(I) = NumArray(14 + (I - 1) * 6); AlfaFieldIncre = 7 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), state.dataVariableSpeedCoils->RatedInletWetBulbTemp, state.dataVariableSpeedCoils->RatedInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -654,29 +473,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 8 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -684,29 +503,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 9 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -714,29 +533,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 10 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), state.dataVariableSpeedCoils->RatedInletWetBulbTemp, state.dataVariableSpeedCoils->RatedInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -744,29 +563,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 11 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -774,29 +593,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 12 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -805,29 +624,29 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 7; // Read waste heat modifier curve name - VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal types are BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(I), RatedInletWaterTemp, RatedInletAirTemp); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), state.dataVariableSpeedCoils->RatedInletWaterTemp, state.dataVariableSpeedCoils->RatedInletAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -835,22 +654,22 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit" SetupOutputVariable(state, "Cooling Coil Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).Energy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "Cooling", @@ -858,10 +677,10 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Cooling Coil Total Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "ENERGYTRANSFER", "COOLINGCOILS", @@ -869,22 +688,22 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergySensible, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergyLatent, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Source Side Heat Transfer Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergySource, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "PLANTLOOPCOOLINGDEMAND", "COOLINGCOILS", @@ -892,24 +711,24 @@ namespace VariableSpeedCoils { "System"); // for table output, being consistent with outher water-to-air coils - // IF (VarSpeedCoil(DXCoilNum)%RatedCapCoolTotal /= AutoSize) THEN - // VarSpeedCoil(DXCoilNum)%RatedCapCoolSens = VarSpeedCoil(DXCoilNum)%RatedCapCoolTotal & - // *VarSpeedCoil(DXCoilNum)%MSRatedSHR(VarSpeedCoil(DXCoilNum)%NormSpedLevel) + // IF (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%RatedCapCoolTotal /= AutoSize) THEN + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%RatedCapCoolSens = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%RatedCapCoolTotal & + // *VarSpeedCoil(DXCoilNum)%MSRatedSHR(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%NormSpedLevel) // ELSE - // VarSpeedCoil(DXCoilNum)%RatedCapCoolSens = AUTOSIZE + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%RatedCapCoolSens = AUTOSIZE // END IF - VarSpeedCoil(DXCoilNum).RatedCapCoolSens = AutoSize; // always auto-sized, to be determined in the sizing calculation + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = AutoSize; // always auto-sized, to be determined in the sizing calculation // BAN Sept 30 2103, CR9322, commented out, now it is redundant, it is reported from sizing routine // create predefined report entries - // PreDefTableEntry( pdchCoolCoilType, VarSpeedCoil( DXCoilNum ).Name, CurrentModuleObject ); - // PreDefTableEntry( pdchCoolCoilTotCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); - // PreDefTableEntry( pdchCoolCoilSensCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); - // PreDefTableEntry( pdchCoolCoilLatCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal - VarSpeedCoil( - // DXCoilNum ).RatedCapCoolSens ); PreDefTableEntry( pdchCoolCoilSHR, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum - // ).RatedCapCoolSens / VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); PreDefTableEntry( pdchCoolCoilNomEff, VarSpeedCoil( DXCoilNum - // ).Name, VarSpeedCoil( DXCoilNum ).MSRatedCOP( VarSpeedCoil( DXCoilNum ).NormSpedLevel ) ); + // PreDefTableEntry( pdchCoolCoilType, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, CurrentModuleObject ); + // PreDefTableEntry( pdchCoolCoilTotCap, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); + // PreDefTableEntry( pdchCoolCoilSensCap, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); + // PreDefTableEntry( pdchCoolCoilLatCap, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal - state.dataVariableSpeedCoils->VarSpeedCoil( + // DXCoilNum ).RatedCapCoolSens ); PreDefTableEntry( pdchCoolCoilSHR, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum + // ).RatedCapCoolSens / state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); PreDefTableEntry( pdchCoolCoilNomEff, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum + // ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).MSRatedCOP( state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).NormSpedLevel ) ); } //-------------------------AIR SOURCE, COOLING---BEGIN @@ -936,59 +755,59 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - VarSpeedCoil(DXCoilNum).Name = AlphArray(1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); // Initialize DataHeatBalance heat reclaim variable name for use by heat reclaim coils - DataHeatBalance::HeatReclaimVS_DXCoil(DXCoilNum).Name = VarSpeedCoil(DXCoilNum).Name; + DataHeatBalance::HeatReclaimVS_DXCoil(DXCoilNum).Name = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name; DataHeatBalance::HeatReclaimVS_DXCoil(DXCoilNum).SourceType = CurrentModuleObject; - VarSpeedCoil(DXCoilNum).CoolHeatType = "COOLING"; - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = Coil_CoolingAirToAirVariableSpeed; - VarSpeedCoil(DXCoilNum).VarSpeedCoilType = DataHVACGlobals::cAllCoilTypes(Coil_CoolingAirToAirVariableSpeed); - VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = NumArray(3); - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); - VarSpeedCoil(DXCoilNum).Twet_Rated = NumArray(5); - VarSpeedCoil(DXCoilNum).Gamma_Rated = NumArray(6); - - VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "COOLING"; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = Coil_CoolingAirToAirVariableSpeed; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = DataHVACGlobals::cAllCoilTypes(Coil_CoolingAirToAirVariableSpeed); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = NumArray(3); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated = NumArray(5); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated = NumArray(6); + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); - if (VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(1) + " must be >= 1. entered number is " + TrimSigDigits(NumArray(1), 0)); ErrorsFound = true; } - if (VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - VarSpeedCoil(DXCoilNum).NormSpedLevel = VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; } - if ((VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(2) + " must be valid speed level entered number is " + TrimSigDigits(NumArray(2), 0)); ErrorsFound = true; } // part load curve - VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(4)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(4)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(4)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(6) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(4) + "=\"" + AlphArray(4) + "\"."); } ErrorsFound = true; } else { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(4) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -996,19 +815,19 @@ namespace VariableSpeedCoils { // outdoor condenser node if (lAlphaBlanks(5)) { - VarSpeedCoil(DXCoilNum).CondenserInletNodeNum = 0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum = 0; } else { - VarSpeedCoil(DXCoilNum).CondenserInletNodeNum = GetOnlySingleNode(state, AlphArray(5), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, CurrentModuleObject, - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, NodeType_Air, NodeConnectionType_OutsideAirReference, 1, ObjectIsNotParent); - if (!CheckOutAirNodeNumber(state, VarSpeedCoil(DXCoilNum).CondenserInletNodeNum)) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", may be invalid"); + if (!CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum)) { + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", may be invalid"); ShowContinueError(cAlphaFields(10) + "=\"" + AlphArray(5) + "\", node does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); ShowContinueError( @@ -1017,136 +836,136 @@ namespace VariableSpeedCoils { } if ((UtilityRoutines::SameString(AlphArray(6), "AirCooled")) || lAlphaBlanks(6)) { - VarSpeedCoil(DXCoilNum).CondenserType = AirCooled; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = AirCooled; } else if (UtilityRoutines::SameString(AlphArray(6), "EvaporativelyCooled")) { - VarSpeedCoil(DXCoilNum).CondenserType = EvapCooled; - VarSpeedCoil(DXCoilNum).ReportEvapCondVars = true; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = EvapCooled; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ReportEvapCondVars = true; } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cAlphaFields(6) + "=\"" + AlphArray(6) + "\":"); ShowContinueError("...must be AirCooled or EvaporativelyCooled."); ErrorsFound = true; } - VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower = NumArray(7); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower = NumArray(7); - if (VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower < 0.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower < 0.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(7) + " cannot be < 0.0."); ShowContinueError("...entered value=[" + TrimSigDigits(NumArray(7), 2) + "]."); ErrorsFound = true; } // Set crankcase heater capacity - VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(8); - if (VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(8); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(8) + " cannot be < 0.0."); ShowContinueError("...entered value=[" + TrimSigDigits(NumArray(8), 2) + "]."); ErrorsFound = true; } // Set crankcase heater cutout temperature - VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater = NumArray(9); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater = NumArray(9); // Set crankcase heater cutout temperature - VarSpeedCoil(DXCoilNum).MinOATCompressor = NumArray(10); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MinOATCompressor = NumArray(10); // Get Water System tank connections // A7, \field Name of Water Storage Tank for Supply - VarSpeedCoil(DXCoilNum).EvapWaterSupplyName = AlphArray(7); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyName = AlphArray(7); if (lAlphaBlanks(7)) { - VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromMains; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = state.dataVariableSpeedCoils->WaterSupplyFromMains; } else { - VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromTank; - SetupTankDemandComponent(state, VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = state.dataVariableSpeedCoils->WaterSupplyFromTank; + SetupTankDemandComponent(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject, - VarSpeedCoil(DXCoilNum).EvapWaterSupplyName, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyName, ErrorsFound, - VarSpeedCoil(DXCoilNum).EvapWaterSupTankID, - VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID); } // A8; \field Name of Water Storage Tank for Condensate Collection - VarSpeedCoil(DXCoilNum).CondensateCollectName = AlphArray(8); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectName = AlphArray(8); if (lAlphaBlanks(8)) { - VarSpeedCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode = state.dataVariableSpeedCoils->CondensateDiscarded; } else { - VarSpeedCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; - SetupTankSupplyComponent(state, VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode = state.dataVariableSpeedCoils->CondensateToTank; + SetupTankSupplyComponent(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject, - VarSpeedCoil(DXCoilNum).CondensateCollectName, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectName, ErrorsFound, - VarSpeedCoil(DXCoilNum).CondensateTankID, - VarSpeedCoil(DXCoilNum).CondensateTankSupplyARRID); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankID, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankSupplyARRID); } // Basin heater power as a function of temperature must be greater than or equal to 0 - VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff = NumArray(11); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff = NumArray(11); if (NumArray(11) < 0.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(11) + " must be >= 0.0."); ShowContinueError("...entered value=[" + TrimSigDigits(NumArray(11), 2) + "]."); ErrorsFound = true; } - VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp = NumArray(12); - if (VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { - if (VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", freeze possible"); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp = NumArray(12); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp < 2.0) { + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", freeze possible"); ShowContinueError("..." + cNumericFields(12) + " is < 2 {C}. Freezing could occur."); ShowContinueError("...entered value=[" + TrimSigDigits(NumArray(12), 2) + "]."); } } if (!lAlphaBlanks(9)) { - VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, AlphArray(9)); - if (VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, AlphArray(9)); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(14) + "=\"" + AlphArray(9) + "\"."); ShowContinueError("Basin heater will be available to operate throughout the simulation."); } } - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(13 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(14 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(15 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(16 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).EvapCondAirFlow(I) = NumArray(17 + (I - 1) * 6); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(13 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(14 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(15 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(16 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(I) = NumArray(17 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).EvapCondEffect(I) = NumArray(18 + (I - 1) * 6); - if (VarSpeedCoil(DXCoilNum).EvapCondEffect(I) < 0.0 || VarSpeedCoil(DXCoilNum).EvapCondEffect(I) > 1.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(I) = NumArray(18 + (I - 1) * 6); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(I) < 0.0 || state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(I) > 1.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(18 + (I - 1) * 6) + " cannot be < 0.0 or > 1.0."); ShowContinueError("...entered value=[" + TrimSigDigits(NumArray(18 + (I - 1) * 6), 2) + "]."); ErrorsFound = true; } AlfaFieldIncre = 10 + (I - 1) * 4; - VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), state.dataVariableSpeedCoils->RatedInletWetBulbTemp, state.dataVariableSpeedCoils->RatedAmbAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1154,29 +973,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 11 + (I - 1) * 4; - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1184,29 +1003,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 12 + (I - 1) * 4; - VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), state.dataVariableSpeedCoils->RatedInletWetBulbTemp, state.dataVariableSpeedCoils->RatedAmbAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1214,29 +1033,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 13 + (I - 1) * 4; - VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1244,22 +1063,22 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - VarSpeedCoil(DXCoilNum).MSRatedEvapCondVolFlowPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).EvapCondAirFlow(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedEvapCondVolFlowPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Cooling:DX:VariableSpeed" SetupOutputVariable(state, "Cooling Coil Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).Energy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "Cooling", @@ -1267,10 +1086,10 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Cooling Coil Total Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "ENERGYTRANSFER", "COOLINGCOILS", @@ -1278,34 +1097,34 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergySensible, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergyLatent, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Source Side Heat Transfer Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergySource, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); - VarSpeedCoil(DXCoilNum).RatedCapCoolSens = AutoSize; // always auto-sized, to be determined in the sizing calculation + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = AutoSize; // always auto-sized, to be determined in the sizing calculation // BAN Sept 30 2103, CR9322, commented out, now it is redundant, it is reported from sizing routine // create predefined report entries - // PreDefTableEntry( pdchCoolCoilType, VarSpeedCoil( DXCoilNum ).Name, CurrentModuleObject ); - // PreDefTableEntry( pdchCoolCoilTotCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); - // PreDefTableEntry( pdchCoolCoilSensCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); - // PreDefTableEntry( pdchCoolCoilLatCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal - VarSpeedCoil( - // DXCoilNum ).RatedCapCoolSens ); PreDefTableEntry( pdchCoolCoilSHR, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum - // ).RatedCapCoolSens / VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); PreDefTableEntry( pdchCoolCoilNomEff, VarSpeedCoil( DXCoilNum - // ).Name, VarSpeedCoil( DXCoilNum ).MSRatedCOP( VarSpeedCoil( DXCoilNum ).NormSpedLevel ) ); + // PreDefTableEntry( pdchCoolCoilType, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, CurrentModuleObject ); + // PreDefTableEntry( pdchCoolCoilTotCap, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); + // PreDefTableEntry( pdchCoolCoilSensCap, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); + // PreDefTableEntry( pdchCoolCoilLatCap, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal - state.dataVariableSpeedCoils->VarSpeedCoil( + // DXCoilNum ).RatedCapCoolSens ); PreDefTableEntry( pdchCoolCoilSHR, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum + // ).RatedCapCoolSens / state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); PreDefTableEntry( pdchCoolCoilNomEff, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum + // ).Name, state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).MSRatedCOP( state.dataVariableSpeedCoils->VarSpeedCoil( DXCoilNum ).NormSpedLevel ) ); } //-------------------------AIR SOURCE COOLING---END @@ -1332,99 +1151,99 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - VarSpeedCoil(DXCoilNum).Name = AlphArray(1); - VarSpeedCoil(DXCoilNum).CoolHeatType = "HEATING"; - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = Coil_HeatingWaterToAirHPVSEquationFit; // fix coil type + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "HEATING"; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = Coil_HeatingWaterToAirHPVSEquationFit; // fix coil type - VarSpeedCoil(DXCoilNum).VarSpeedCoilType = DataHVACGlobals::cAllCoilTypes(VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum); - VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); - VarSpeedCoil(DXCoilNum).RatedCapHeat = NumArray(3); - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); - VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = NumArray(5); - VarSpeedCoil(DXCoilNum).CondenserType = WaterCooled; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = DataHVACGlobals::cAllCoilTypes(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat = NumArray(3); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = NumArray(5); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = WaterCooled; - VarSpeedCoil(DXCoilNum).WaterInletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Water, NodeConnectionType_Inlet, 2, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Water, NodeConnectionType_Outlet, 2, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); TestCompSet(CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); - // If (VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then - if (VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + // If (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(1) + " must be >= 1. entered number is " + TrimSigDigits(NumArray(1), 0)); ErrorsFound = true; } - if (VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - VarSpeedCoil(DXCoilNum).NormSpedLevel = VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; } - if ((VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(2) + " must be valid speed level entered number is " + TrimSigDigits(NumArray(2), 0)); ErrorsFound = true; } // part load curve - VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(6)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(6)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(6)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(6) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(6) + "=\"" + AlphArray(6) + "\"."); } ErrorsFound = true; } else { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(6) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } } - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(6 + (I - 1) * 5); - VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(7 + (I - 1) * 5); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(8 + (I - 1) * 5); - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) = NumArray(9 + (I - 1) * 5); - VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(I) = NumArray(10 + (I - 1) * 5); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(6 + (I - 1) * 5); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(7 + (I - 1) * 5); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(8 + (I - 1) * 5); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) = NumArray(9 + (I - 1) * 5); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(I) = NumArray(10 + (I - 1) * 5); AlfaFieldIncre = 7 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletAirTempHeat, RatedInletWaterTempHeat); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), state.dataVariableSpeedCoils->RatedInletAirTempHeat, state.dataVariableSpeedCoils->RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1432,29 +1251,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 8 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1462,29 +1281,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 9 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(14 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1492,29 +1311,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 10 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletAirTempHeat, RatedInletWaterTempHeat); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), state.dataVariableSpeedCoils->RatedInletAirTempHeat, state.dataVariableSpeedCoils->RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1522,29 +1341,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 11 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(16 + (I - 1) * 6) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1552,29 +1371,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 12 + (I - 1) * 7; - VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1583,29 +1402,29 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 7; // Read waste heat modifier curve name - VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal types are BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(I), RatedInletAirTempHeat, RatedInletWaterTempHeat); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), state.dataVariableSpeedCoils->RatedInletAirTempHeat, state.dataVariableSpeedCoils->RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1613,22 +1432,22 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit" SetupOutputVariable(state, "Heating Coil Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).Energy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "Heating", @@ -1636,10 +1455,10 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Heating Coil Heating Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "ENERGYTRANSFER", "HEATINGCOILS", @@ -1647,10 +1466,10 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Heating Coil Source Side Heat Transfer Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergySource, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "PLANTLOOPHEATINGDEMAND", "HEATINGCOILS", @@ -1658,10 +1477,10 @@ namespace VariableSpeedCoils { "System"); // create predefined report entries - PreDefTableEntry(pdchHeatCoilType, VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); - PreDefTableEntry(pdchHeatCoilNomCap, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).RatedCapHeat); + PreDefTableEntry(pdchHeatCoilType, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); + PreDefTableEntry(pdchHeatCoilNomCap, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); PreDefTableEntry( - pdchHeatCoilNomEff, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).MSRatedCOP(VarSpeedCoil(DXCoilNum).NormSpedLevel)); + pdchHeatCoilNomEff, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); } //-------------------------AIR SOURCE, HEATING---BEGIN @@ -1687,172 +1506,172 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - VarSpeedCoil(DXCoilNum).Name = AlphArray(1); - VarSpeedCoil(DXCoilNum).CoolHeatType = "HEATING"; - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = Coil_HeatingAirToAirVariableSpeed; - VarSpeedCoil(DXCoilNum).VarSpeedCoilType = DataHVACGlobals::cAllCoilTypes(Coil_HeatingAirToAirVariableSpeed); - VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); - VarSpeedCoil(DXCoilNum).RatedCapHeat = NumArray(3); - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); - - VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "HEATING"; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = Coil_HeatingAirToAirVariableSpeed; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = DataHVACGlobals::cAllCoilTypes(Coil_HeatingAirToAirVariableSpeed); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat = NumArray(3); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(4); + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); - if (VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(1) + " must be >= 1. entered number is " + TrimSigDigits(NumArray(1), 0)); ErrorsFound = true; } - if (VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - VarSpeedCoil(DXCoilNum).NormSpedLevel = VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; } - if ((VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(2) + " must be valid speed level entered number is " + TrimSigDigits(NumArray(2), 0)); ErrorsFound = true; } // part load curve - VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(4)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(4)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(4)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(4) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(4) + "=\"" + AlphArray(4) + "\"."); } ErrorsFound = true; } else { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(4) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } } - VarSpeedCoil(DXCoilNum).DefrostEIRFT = GetCurveIndex(state, AlphArray(5)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT = GetCurveIndex(state, AlphArray(5)); // convert curve name to number if (UtilityRoutines::SameString(AlphArray(6), "ReverseCycle")) { - if (VarSpeedCoil(DXCoilNum).DefrostEIRFT == 0) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT == 0) { if (lAlphaBlanks(5)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(5) + " is blank."); ShowContinueError("...field is required because " + cAlphaFields(6) + " is \"ReverseCycle\"."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(5) + "=\"" + AlphArray(5) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).DefrostEIRFT, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT, // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name } } - if (UtilityRoutines::SameString(AlphArray(6), "ReverseCycle")) VarSpeedCoil(DXCoilNum).DefrostStrategy = ReverseCycle; - if (UtilityRoutines::SameString(AlphArray(6), "Resistive")) VarSpeedCoil(DXCoilNum).DefrostStrategy = Resistive; - if (VarSpeedCoil(DXCoilNum).DefrostStrategy == 0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if (UtilityRoutines::SameString(AlphArray(6), "ReverseCycle")) state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy = state.dataVariableSpeedCoils->ReverseCycle; + if (UtilityRoutines::SameString(AlphArray(6), "Resistive")) state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy = state.dataVariableSpeedCoils->Resistive; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy == 0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...illegal " + cAlphaFields(6) + "=\"" + AlphArray(6) + "\"."); ShowContinueError("...valid values for this field are ReverseCycle or Resistive."); ErrorsFound = true; } - if (UtilityRoutines::SameString(AlphArray(7), "Timed")) VarSpeedCoil(DXCoilNum).DefrostControl = Timed; - if (UtilityRoutines::SameString(AlphArray(7), "OnDemand")) VarSpeedCoil(DXCoilNum).DefrostControl = OnDemand; - if (VarSpeedCoil(DXCoilNum).DefrostControl == 0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if (UtilityRoutines::SameString(AlphArray(7), "Timed")) state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl = state.dataVariableSpeedCoils->Timed; + if (UtilityRoutines::SameString(AlphArray(7), "OnDemand")) state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl = state.dataVariableSpeedCoils->OnDemand; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl == 0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...illegal " + cAlphaFields(7) + "=\"" + AlphArray(7) + "\"."); ShowContinueError("...valid values for this field are Timed or OnDemand."); ErrorsFound = true; } // Set minimum OAT for heat pump compressor operation - VarSpeedCoil(DXCoilNum).MinOATCompressor = NumArray(5); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MinOATCompressor = NumArray(5); // reserved for HSPF calculation - VarSpeedCoil(DXCoilNum).OATempCompressorOn = NumArray(6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OATempCompressorOn = NumArray(6); // Set maximum outdoor temp for defrost to occur - VarSpeedCoil(DXCoilNum).MaxOATDefrost = NumArray(7); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATDefrost = NumArray(7); // Set crankcase heater capacity - VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(8); - if (VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(8); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(9) + " cannot be < 0.0."); ShowContinueError("...entered value=[" + TrimSigDigits(NumArray(9), 2) + "]."); ErrorsFound = true; } // Set crankcase heater cutout temperature - VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater = NumArray(9); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater = NumArray(9); // Set defrost time period - VarSpeedCoil(DXCoilNum).DefrostTime = NumArray(10); - if (VarSpeedCoil(DXCoilNum).DefrostTime == 0.0 && VarSpeedCoil(DXCoilNum).DefrostControl == 1) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", "); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostTime = NumArray(10); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostTime == 0.0 && state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl == 1) { + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", "); ShowContinueError("..." + cNumericFields(5) + " = 0.0 for defrost control = TIMED."); } // Set defrost capacity (for resistive defrost) - VarSpeedCoil(DXCoilNum).DefrostCapacity = NumArray(11); - if (VarSpeedCoil(DXCoilNum).DefrostCapacity == 0.0 && VarSpeedCoil(DXCoilNum).DefrostStrategy == 2) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", "); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity = NumArray(11); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity == 0.0 && state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy == 2) { + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", "); ShowContinueError("..." + cNumericFields(6) + " = 0.0 for defrost strategy = RESISTIVE."); } - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 3); - VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 3); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(14 + (I - 1) * 3); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 3); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 3); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(14 + (I - 1) * 3); - if (VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) < 1.e-10) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid value"); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) < 1.e-10) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid value"); ShowContinueError("...too small " + cNumericFields(12 + (I - 1) * 3) + "=[" + - RoundSigDigits(VarSpeedCoil(DXCoilNum).MSRatedTotCap(I), 2) + "]."); + RoundSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I), 2) + "]."); ErrorsFound = true; } AlfaFieldIncre = 8 + (I - 1) * 4; - VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), state.dataVariableSpeedCoils->RatedInletAirTempHeat, state.dataVariableSpeedCoils->RatedAmbAirTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1860,29 +1679,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 9 + (I - 1) * 4; - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1890,29 +1709,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 10 + (I - 1) * 4; - VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), state.dataVariableSpeedCoils->RatedInletAirTempHeat, state.dataVariableSpeedCoils->RatedAmbAirTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1920,29 +1739,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 11 + (I - 1) * 4; - VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError("...Curve output at rated conditions = " + TrimSigDigits(CurveVal, 3)); } @@ -1952,20 +1771,20 @@ namespace VariableSpeedCoils { if (ErrorsFound) continue; - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Heating:DX:Variablespeed " SetupOutputVariable(state, "Heating Coil Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).Energy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "Heating", @@ -1973,10 +1792,10 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Heating Coil Heating Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "ENERGYTRANSFER", "HEATINGCOILS", @@ -1984,16 +1803,16 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Heating Coil Source Side Heat Transfer Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergySource, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); // create predefined report entries - PreDefTableEntry(pdchHeatCoilType, VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); - PreDefTableEntry(pdchHeatCoilNomCap, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).RatedCapHeat); + PreDefTableEntry(pdchHeatCoilType, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); + PreDefTableEntry(pdchHeatCoilNomCap, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); PreDefTableEntry( - pdchHeatCoilNomEff, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).MSRatedCOP(VarSpeedCoil(DXCoilNum).NormSpedLevel)); + pdchHeatCoilNomEff, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); } //-------------------------AIR SOURCE HEATING---END @@ -2021,18 +1840,18 @@ namespace VariableSpeedCoils { // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); - VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; - VarSpeedCoil(DXCoilNum).CondenserType = WaterHeater; - VarSpeedCoil(DXCoilNum).CoolHeatType = "WATERHEATING"; - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = CoilDX_HeatPumpWaterHeaterVariableSpeed; - VarSpeedCoil(DXCoilNum).VarSpeedCoilType = cAllCoilTypes(CoilDX_HeatPumpWaterHeaterVariableSpeed); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = WaterHeater; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType = "WATERHEATING"; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum = CoilDX_HeatPumpWaterHeaterVariableSpeed; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType = cAllCoilTypes(CoilDX_HeatPumpWaterHeaterVariableSpeed); - VarSpeedCoil(DXCoilNum).Name = AlphArray(1); - VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); - VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds = int(NumArray(1)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = int(NumArray(2)); - if (VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(1) + " must be >= 1." " entered number is " + @@ -2040,12 +1859,12 @@ namespace VariableSpeedCoils { ErrorsFound = true; } - if (VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - VarSpeedCoil(DXCoilNum).NormSpedLevel = VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; } - if ((VarSpeedCoil(DXCoilNum).NormSpedLevel > VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) || (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel <= 0)) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(2) + " must be valid speed level" " entered number is " + @@ -2053,31 +1872,31 @@ namespace VariableSpeedCoils { ErrorsFound = true; } - VarSpeedCoil(DXCoilNum).RatedCapWH = NumArray(3); - if (VarSpeedCoil(DXCoilNum).RatedCapWH <= 0.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapWH = NumArray(3); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapWH <= 0.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(3) + " must be > 0.0, entered value=[" + TrimSigDigits(NumArray(3), 2) + "]."); ErrorsFound = true; } - VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp = NumArray(4); - VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp = NumArray(5); - VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp = NumArray(6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp = NumArray(4); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp = NumArray(5); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp = NumArray(6); - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(7); - VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = NumArray(8); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = NumArray(7); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = NumArray(8); - if (VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate != AutoCalculate) { - if (VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate <= 0.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate != AutoCalculate) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate <= 0.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(7) + " must be > 0.0. entered value=[" + TrimSigDigits(NumArray(7), 3) + "]."); ErrorsFound = true; } } - if (VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate != AutoCalculate) { - if (VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate <= 0.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate != AutoCalculate) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate <= 0.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(8) + " must be > 0.0 entered value=[" + TrimSigDigits(NumArray(8), 3) + "]."); ErrorsFound = true; } @@ -2086,11 +1905,11 @@ namespace VariableSpeedCoils { if (UtilityRoutines::SameString(AlphArray(2), "Yes") || UtilityRoutines::SameString(AlphArray(2), "No")) { // initialized to TRUE on allocate if (UtilityRoutines::SameString(AlphArray(2), "No")) - VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP = false; else - VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP = true; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP = true; } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(",,,invalid choice for " + cAlphaFields(2) + ". Entered choice = " + AlphArray(2)); ShowContinueError("Valid choices are Yes or No."); ErrorsFound = true; @@ -2099,11 +1918,11 @@ namespace VariableSpeedCoils { if (UtilityRoutines::SameString(AlphArray(3), "Yes") || UtilityRoutines::SameString(AlphArray(3), "No")) { // initialized to FALSE on allocate if (UtilityRoutines::SameString(AlphArray(3), "Yes")) - VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP = true; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP = true; else - VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP = false; } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(",,,invalid choice for " + cAlphaFields(3) + ". Entered choice = " + AlphArray(3)); ShowContinueError("Valid choices are Yes or No."); ErrorsFound = true; @@ -2112,98 +1931,98 @@ namespace VariableSpeedCoils { if (UtilityRoutines::SameString(AlphArray(4), "Yes") || UtilityRoutines::SameString(AlphArray(4), "No")) { // initialized to FALSE on allocate if (UtilityRoutines::SameString(AlphArray(4), "Yes")) - VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity = true; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity = true; else - VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity = false; } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError(",,,invalid choice for " + cAlphaFields(4) + ". Entered choice = " + AlphArray(4)); ShowContinueError("Valid choices are Yes or No."); ErrorsFound = true; } - VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater = NumArray(9); - if (VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater <= 0.0 || VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater > 1.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater = NumArray(9); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater <= 0.0 || state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater > 1.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(10) + " must be >= 0 and <= 1. entered value=[" + TrimSigDigits(NumArray(9), 3) + "]."); ErrorsFound = true; } - if (!VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { - VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater = 0.0; + if (!state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater = 0.0; } // Air nodes - VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(6), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); TestCompSet(CurrentModuleObject, AlphArray(1), AlphArray(5), AlphArray(6), "Air Nodes"); // Check if the air inlet node is OA node, to justify whether the coil is placed in zone or not - VarSpeedCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(state, VarSpeedCoil(DXCoilNum).AirInletNodeNum); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum); // Water nodes - VarSpeedCoil(DXCoilNum).WaterInletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum = GetOnlySingleNode(state, AlphArray(7), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Water, NodeConnectionType_Inlet, 2, ObjectIsNotParent); - VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(8), ErrorsFound, CurrentModuleObject, AlphArray(1), NodeType_Water, NodeConnectionType_Outlet, 2, ObjectIsNotParent); TestCompSet(CurrentModuleObject, AlphArray(1), AlphArray(7), AlphArray(8), "Water Nodes"); - VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(10); - if (VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(10); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(10) + " must be >= 0.0 entered value=[" + TrimSigDigits(NumArray(10), 1) + "]."); ErrorsFound = true; } - VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater = NumArray(11); - if (VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater < 0.0) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater = NumArray(11); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater < 0.0) { + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cNumericFields(11) + " must be >= 0 {C}. entered value=[" + TrimSigDigits(NumArray(11), 1) + "]."); ErrorsFound = true; } if (UtilityRoutines::SameString(AlphArray(9), "DryBulbTemperature")) { - VarSpeedCoil(DXCoilNum).InletAirTemperatureType = DryBulbIndicator; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirTemperatureType = DryBulbIndicator; } else if (UtilityRoutines::SameString(AlphArray(9), "WetBulbTemperature")) { - VarSpeedCoil(DXCoilNum).InletAirTemperatureType = WetBulbIndicator; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirTemperatureType = WetBulbIndicator; } else { // wrong temperature type selection - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("..." + cAlphaFields(9) + " must be DryBulbTemperature or WetBulbTemperature."); ShowContinueError("...entered value=\"" + AlphArray(9) + "\"."); ErrorsFound = true; } // set rated inlet air temperature for curve object verification - if (VarSpeedCoil(DXCoilNum).InletAirTemperatureType == WetBulbIndicator) { - WHInletAirTemp = VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirTemperatureType == WetBulbIndicator) { + WHInletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp; } else { - WHInletAirTemp = VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp; + WHInletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp; } // set rated water temperature for curve object verification - WHInletWaterTemp = VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp; + WHInletWaterTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp; // part load curve - VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(10)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(10)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(10)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(10) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(10) + "=\"" + AlphArray(10) + "\"."); } ErrorsFound = true; } else { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(10) + " output is not equal to 1.0 " "(+ or - 10%) at rated conditions."); @@ -2211,38 +2030,38 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(14 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(15 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) = NumArray(16 + (I - 1) * 6); - VarSpeedCoil(DXCoilNum).MSWHPumpPower(I) = NumArray(17 + (I - 1) * 6); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(14 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(15 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) = NumArray(16 + (I - 1) * 6); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(I) = NumArray(17 + (I - 1) * 6); AlfaFieldIncre = 11 + (I - 1) * 6; - VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), WHInletAirTemp, WHInletWaterTemp); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), WHInletAirTemp, WHInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 " "(+ or - 10%) at rated conditions."); @@ -2252,29 +2071,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 12 + (I - 1) * 6; - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 " "(+ or - 10%) at rated conditions."); @@ -2284,29 +2103,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 13 + (I - 1) * 6; - VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 " "(+ or - 10%) at rated conditions."); @@ -2316,29 +2135,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 14 + (I - 1) * 6; - VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is BiQuadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), // Curve index {2}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), WHInletAirTemp, WHInletWaterTemp); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), WHInletAirTemp, WHInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 " "(+ or - 10%) at rated conditions."); @@ -2348,29 +2167,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 15 + (I - 1) * 6; - VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 " "(+ or - 10%) at rated conditions."); @@ -2380,29 +2199,29 @@ namespace VariableSpeedCoils { } AlfaFieldIncre = 16 + (I - 1) * 6; - VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number - if (VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", missing"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", missing"); ShowContinueError("...required " + cAlphaFields(AlfaFieldIncre) + " is blank."); } else { - ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", invalid"); + ShowSevereError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", invalid"); ShowContinueError("...not found " + cAlphaFields(AlfaFieldIncre) + "=\"" + AlphArray(AlfaFieldIncre) + "\"."); } ErrorsFound = true; } else { // Verify Curve Object, only legal type is Quadratic - ErrorsFound |= CurveManager::CheckCurveDims(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), // Curve index {1}, // Valid dimensions RoutineName, // Routine name CurrentModuleObject, // Object Type - VarSpeedCoil(DXCoilNum).Name, // Object Name + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + VarSpeedCoil(DXCoilNum).Name + "\", curve values"); + ShowWarningError(RoutineName + CurrentModuleObject + "=\"" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\", curve values"); ShowContinueError("..." + cAlphaFields(AlfaFieldIncre) + " output is not equal to 1.0 " "(+ or - 10%) at rated conditions."); @@ -2413,24 +2232,24 @@ namespace VariableSpeedCoils { } // get scale values - for (I = 1; I <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { - VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); - VarSpeedCoil(DXCoilNum).MSWHPumpPowerPerRatedTotCap(I) = - VarSpeedCoil(DXCoilNum).MSWHPumpPower(I) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPowerPerRatedTotCap(I) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I); } // CurrentModuleObject = "Coil:Waterheating:Airtowaterheatpump:Variablespeed" SetupOutputVariable(state, "Cooling Coil Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).Energy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "Heating", @@ -2438,35 +2257,35 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergySensible, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergyLatent, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Water Side Heat Transfer Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergySource, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "PLANTLOOPHEATINGDEMAND", "HEATINGCOILS", _, "System"); - if (VarSpeedCoil(DXCoilNum).IsDXCoilInZone) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).IsDXCoilInZone) { SetupOutputVariable(state, "Cooling Coil Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "ENERGYTRANSFER", "COOLINGCOILS", @@ -2475,13 +2294,13 @@ namespace VariableSpeedCoils { } else { SetupOutputVariable(state, "Cooling Coil Cooling Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EnergyLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal, "System", "Summed", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); } - VarSpeedCoil(DXCoilNum).RatedCapCoolSens = AutoSize; // always auto-sized, to be determined in the sizing calculation + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = AutoSize; // always auto-sized, to be determined in the sizing calculation } //---------------------------VARIABLE-SPEED AIR SOURCE HPWH END -------------- @@ -2496,112 +2315,112 @@ namespace VariableSpeedCoils { ShowFatalError(RoutineName + "Errors found getting input. Program terminates."); } - for (DXCoilNum = 1; DXCoilNum <= NumVarSpeedCoils; ++DXCoilNum) { - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) || - (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed)) { + for (DXCoilNum = 1; DXCoilNum <= state.dataVariableSpeedCoils->NumVarSpeedCoils; ++DXCoilNum) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) || + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed)) { // Setup Report variables for the Heat Pump // cooling and heating coils separately - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { // air source cooling coils SetupOutputVariable(state, "Cooling Coil Air Mass Flow Rate", OutputProcessor::Unit::kg_s, - VarSpeedCoil(DXCoilNum).AirMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).InletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).InletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QLatent, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).OutletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QSensible, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Total Cooling Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Part Load Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).PartLoadRatio, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).Power, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Runtime Fraction", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).RunFrac, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Source Side Heat Transfer Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QSource, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Upper Speed Level", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedNumReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Neighboring Speed Levels Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedRatioReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); - if (VarSpeedCoil(DXCoilNum).CondensateCollectMode == CondensateToTank) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode == state.dataVariableSpeedCoils->CondensateToTank) { SetupOutputVariable(state, "Cooling Coil Condensate Volume Flow Rate", OutputProcessor::Unit::m3_s, - VarSpeedCoil(DXCoilNum).CondensateVdot, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVdot, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Condensate Volume", OutputProcessor::Unit::m3, - VarSpeedCoil(DXCoilNum).CondensateVol, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVol, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "OnSiteWater", "Condensate", @@ -2609,19 +2428,19 @@ namespace VariableSpeedCoils { "System"); } - if (VarSpeedCoil(DXCoilNum).ReportEvapCondVars) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ReportEvapCondVars) { SetupOutputVariable(state, "Cooling Coil Condenser Inlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).CondInletTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondInletTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Evaporative Condenser Water Volume", OutputProcessor::Unit::m3, - VarSpeedCoil(DXCoilNum).EvapWaterConsump, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Water", "Cooling", @@ -2629,10 +2448,10 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Cooling Coil Evaporative Condenser Mains Water Volume", OutputProcessor::Unit::m3, - VarSpeedCoil(DXCoilNum).EvapWaterConsump, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "MainsWater", "Cooling", @@ -2640,34 +2459,34 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Cooling Coil Evaporative Condenser Pump Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).EvapCondPumpElecPower, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecPower, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Evaporative Condenser Pump Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "COOLING", _, "System"); - if (VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff > 0.0) { SetupOutputVariable(state, "Cooling Coil Basin Heater Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).BasinHeaterPower, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Basin Heater Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).BasinHeaterConsumption, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterConsumption, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "COOLING", @@ -2678,16 +2497,16 @@ namespace VariableSpeedCoils { SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "COOLING", @@ -2697,96 +2516,96 @@ namespace VariableSpeedCoils { // air source heating coils SetupOutputVariable(state, "Heating Coil Air Mass Flow Rate", OutputProcessor::Unit::kg_s, - VarSpeedCoil(DXCoilNum).AirMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Air Inlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).InletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Air Inlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).InletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Air Outlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Air Outlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).OutletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Sensible Heating Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QSensible, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Heating Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Part Load Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).PartLoadRatio, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).Power, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Runtime Fraction", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).RunFrac, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Source Side Heat Transfer Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QSource, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Upper Speed Level", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedNumReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Neighboring Speed Levels Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedRatioReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Defrost Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).DefrostPower, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Defrost Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).DefrostConsumption, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostConsumption, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "HEATING", @@ -2794,16 +2613,16 @@ namespace VariableSpeedCoils { "System"); SetupOutputVariable(state, "Heating Coil Crankcase Heater Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Crankcase Heater Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "HEATING", @@ -2812,333 +2631,333 @@ namespace VariableSpeedCoils { } } else { - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit) { // fix coil type + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit) { // fix coil type // cooling WAHP coil // Setup Report variables for water source Heat Pump SetupOutputVariable(state, "Cooling Coil Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).Power, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Total Cooling Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QSensible, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QLatent, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Source Side Heat Transfer Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QSource, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Part Load Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).PartLoadRatio, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Runtime Fraction", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).RunFrac, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Mass Flow Rate", OutputProcessor::Unit::kg_s, - VarSpeedCoil(DXCoilNum).AirMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).InletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).InletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).OutletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Source Side Mass Flow Rate", OutputProcessor::Unit::kg_s, - VarSpeedCoil(DXCoilNum).WaterMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Source Side Inlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).InletWaterTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Source Side Outlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).OutletWaterTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Upper Speed Level", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedNumReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Neighboring Speed Levels Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedRatioReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Recoverable Heat Transfer Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QWasteHeat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); - } else if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit) { // fix coil type + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit) { // fix coil type // heating WAHP coil // Setup Report variables for water source Heat Pump SetupOutputVariable(state, "Heating Coil Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).Power, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Heating Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Sensible Heating Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QSensible, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Source Side Heat Transfer Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QSource, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Part Load Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).PartLoadRatio, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Runtime Fraction", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).RunFrac, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Air Mass Flow Rate", OutputProcessor::Unit::kg_s, - VarSpeedCoil(DXCoilNum).AirMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Air Inlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).InletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Air Inlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).InletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Air Outlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Air Outlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).OutletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Source Side Mass Flow Rate", OutputProcessor::Unit::kg_s, - VarSpeedCoil(DXCoilNum).WaterMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Source Side Inlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).InletWaterTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Source Side Outlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).OutletWaterTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Upper Speed Level", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedNumReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Neighboring Speed Levels Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedRatioReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Heating Coil Recoverable Heat Transfer Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QWasteHeat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); - } else if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed) { // air source water heating coil SetupOutputVariable(state, "Cooling Coil Water Heating Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).Power, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Total Cooling Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QLoadTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Sensible Cooling Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QSensible, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Latent Cooling Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).QLatent, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Total Water Heating Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).TotalHeatingEnergyRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).TotalHeatingEnergyRate, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Part Load Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).PartLoadRatio, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Runtime Fraction", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).RunFrac, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Mass Flow Rate", OutputProcessor::Unit::kg_s, - VarSpeedCoil(DXCoilNum).AirMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).InletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Inlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).InletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Air Outlet Humidity Ratio", OutputProcessor::Unit::kgWater_kgDryAir, - VarSpeedCoil(DXCoilNum).OutletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Water Mass Flow Rate", OutputProcessor::Unit::kg_s, - VarSpeedCoil(DXCoilNum).WaterMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Water Inlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).InletWaterTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Water Outlet Temperature", OutputProcessor::Unit::C, - VarSpeedCoil(DXCoilNum).OutletWaterTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Crankcase Heater Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "HEATING", @@ -3147,29 +2966,29 @@ namespace VariableSpeedCoils { SetupOutputVariable(state, "Cooling Coil Upper Speed Level", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedNumReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedNumReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Neighboring Speed Levels Ratio", OutputProcessor::Unit::None, - VarSpeedCoil(DXCoilNum).SpeedRatioReport, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SpeedRatioReport, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Water Heating Pump Electricity Rate", OutputProcessor::Unit::W, - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower, "System", "Average", - VarSpeedCoil(DXCoilNum).Name); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); SetupOutputVariable(state, "Cooling Coil Water Heating Pump Electricity Energy", OutputProcessor::Unit::J, - VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption, "System", "Sum", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, _, "Electricity", "HEATING", @@ -3258,22 +3077,22 @@ namespace VariableSpeedCoils { // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("InitVarSpeedCoil"); - if (MyOneTimeFlag) { + if (state.dataVariableSpeedCoils->MyOneTimeFlag) { // initialize the environment and sizing flags - MySizeFlag.allocate(NumVarSpeedCoils); - MyEnvrnFlag.allocate(NumVarSpeedCoils); - MyPlantScanFlag.allocate(NumVarSpeedCoils); + MySizeFlag.allocate(state.dataVariableSpeedCoils->NumVarSpeedCoils); + MyEnvrnFlag.allocate(state.dataVariableSpeedCoils->NumVarSpeedCoils); + MyPlantScanFlag.allocate(state.dataVariableSpeedCoils->NumVarSpeedCoils); MySizeFlag = true; MyEnvrnFlag = true; MyPlantScanFlag = true; - MyOneTimeFlag = false; + state.dataVariableSpeedCoils->MyOneTimeFlag = false; } DXCT = 1; // hard-code to non-DOAS sizing routine for cfm/ton until .ISHundredPercentDOASDXCoil member from DXcoils.cc is added to // VarSpeedCoil object // variable-speed heat pump water heating, begin - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed && MySizeFlag(DXCoilNum)) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed && MySizeFlag(DXCoilNum)) { SizeVarSpeedCoil(state, DXCoilNum); @@ -3284,24 +3103,24 @@ namespace VariableSpeedCoils { // variable-speed heat pump water heating, end // water source - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) || - (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit)) { // fix coil type + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) || + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit)) { // fix coil type if (MyPlantScanFlag(DXCoilNum) && allocated(PlantLoop)) { // switch from coil type numbers in DataHVACGlobals, to coil type numbers in plant. int plantTypeOfNum(0); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) { plantTypeOfNum = DataPlant::TypeOf_CoilVSWAHPCoolingEquationFit; - } else if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) { + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) { plantTypeOfNum = DataPlant::TypeOf_CoilVSWAHPHeatingEquationFit; } errFlag = false; ScanPlantLoopsForObject(state, - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, plantTypeOfNum, - VarSpeedCoil(DXCoilNum).LoopNum, - VarSpeedCoil(DXCoilNum).LoopSide, - VarSpeedCoil(DXCoilNum).BranchNum, - VarSpeedCoil(DXCoilNum).CompNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopSide, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BranchNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompNum, errFlag, _, _, @@ -3324,17 +3143,17 @@ namespace VariableSpeedCoils { MySizeFlag(DXCoilNum) = false; // Multispeed Cooling - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) || - (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed)) { - for (Mode = 1; Mode <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) || + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed)) { + for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { // Check for zero capacity or zero max flow rate - if (VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) <= 0.0) { - ShowSevereError("Sizing: " + VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + VarSpeedCoil(DXCoilNum).Name + + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) <= 0.0) { + ShowSevereError("Sizing: " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + " has zero rated total capacity at speed " + TrimSigDigits(Mode)); ErrorsFound = true; } - if (VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) <= 0.0) { - ShowSevereError("Sizing: " + VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + VarSpeedCoil(DXCoilNum).Name + + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) <= 0.0) { + ShowSevereError("Sizing: " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + " has zero rated air flow rate at speed " + TrimSigDigits(Mode)); ErrorsFound = true; } @@ -3342,12 +3161,12 @@ namespace VariableSpeedCoils { ShowFatalError("Preceding condition causes termination."); } // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - RatedVolFlowPerRatedTotCap = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); + RatedVolFlowPerRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); // note: variable-speed HP can exceed the flow rate restrictions at low speed levels // IF (((MinRatedAirVolFlowPerRatedTotCap - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest).OR. & // ((RatedVolFlowPerRatedTotCap - MaxRatedAirVolFlowPerRatedTotCap) > SmallDifferenceTest)) THEN - // CALL ShowSevereError('Sizing: '//TRIM(VarSpeedCoil(DXCoilNum)%VarSpeedCoilType) & - // // ' "'//TRIM(VarSpeedCoil(DXCoilNum)%Name)// & + // CALL ShowSevereError('Sizing: '//TRIM(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%VarSpeedCoilType) & + // // ' "'//TRIM(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%Name)// & // '": Rated air volume flow rate per watt of rated total '// & // 'cooling capacity is out of range at speed '//TRIM(TrimSigDigits(Mode))) // CALL ShowContinueError & @@ -3356,26 +3175,26 @@ namespace VariableSpeedCoils { // Max Rated Vol Flow Per Watt=['// & // TRIM(TrimSigDigits(MaxRatedAirVolFlowPerRatedTotCap,3))//']. See Input-Output Reference Manual for valid range.') // END IF - // VarSpeedCoil(DXCoilNum)%MSRatedAirMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum)%MSRatedAirVolFlowRate(Mode)* & + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%MSRatedAirMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%MSRatedAirVolFlowRate(Mode)* & // PsyRhoAirFnPbTdbW(OutBaroPress,RatedInletAirTemp,RatedInletAirHumRat,RoutineName) // ! get high speed rated coil bypass factor - // VarSpeedCoil(DXCoilNum)%MSRatedCBF(Mode) = CalcCBF(VarSpeedCoil(DXCoilNum)%VarSpeedCoilType, & - // VarSpeedCoil(DXCoilNum)%Name,& + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%MSRatedCBF(Mode) = CalcCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%VarSpeedCoilType, & + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%Name,& // RatedInletAirTemp,RatedInletAirHumRat,VarSpeedCoil(DXCoilNum)%MSRatedTotCap(Mode),& - // VarSpeedCoil(DXCoilNum)%MSRatedAirMassFlowRate(Mode), & - // VarSpeedCoil(DXCoilNum)%MSRatedSHR(Mode)) + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%MSRatedAirMassFlowRate(Mode), & + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%MSRatedSHR(Mode)) } // call coil model with everthing set at rating point - VarSpeedCoil(DXCoilNum).InletAirDBTemp = RatedInletAirTemp; - VarSpeedCoil(DXCoilNum).InletAirHumRat = - Psychrometrics::PsyWFnTdbTwbPb(RatedInletAirTemp, RatedInletWetBulbTemp, DataEnvironment::StdPressureSeaLevel); - VarSpeedCoil(DXCoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, VarSpeedCoil(DXCoilNum).InletAirHumRat); - VarSpeedCoil(DXCoilNum).InletAirPressure = DataEnvironment::StdPressureSeaLevel; - - VarSpeedCoil(DXCoilNum).AirMassFlowRate = - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(DataEnvironment::StdPressureSeaLevel, - RatedInletAirTemp, - VarSpeedCoil(DXCoilNum).InletAirHumRat); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = state.dataVariableSpeedCoils->RatedInletAirTemp; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat = + Psychrometrics::PsyWFnTdbTwbPb(state.dataVariableSpeedCoils->RatedInletAirTemp, state.dataVariableSpeedCoils->RatedInletWetBulbTemp, DataEnvironment::StdPressureSeaLevel); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->RatedInletAirTemp, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure = DataEnvironment::StdPressureSeaLevel; + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(DataEnvironment::StdPressureSeaLevel, + state.dataVariableSpeedCoils->RatedInletAirTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat); // store environment data fill back in after rating point calc is over Real64 holdOutDryBulbTemp = DataEnvironment::OutDryBulbTemp; Real64 holdOutHumRat = DataEnvironment::OutHumRat; @@ -3383,57 +3202,57 @@ namespace VariableSpeedCoils { Real64 holdOutBaroPress = DataEnvironment::OutBaroPress; Real64 ratedOutdoorAirWetBulb = 23.9; // from I/O ref. more precise value? - DataEnvironment::OutDryBulbTemp = RatedAmbAirTemp; + DataEnvironment::OutDryBulbTemp = state.dataVariableSpeedCoils->RatedAmbAirTemp; DataEnvironment::OutWetBulbTemp = ratedOutdoorAirWetBulb; DataEnvironment::OutBaroPress = DataEnvironment::StdPressureSeaLevel; // assume rating is for sea level. DataEnvironment::OutHumRat = - Psychrometrics::PsyWFnTdbTwbPb(RatedAmbAirTemp, ratedOutdoorAirWetBulb, DataEnvironment::StdPressureSeaLevel, RoutineName); - if (VarSpeedCoil(DXCoilNum).CondenserInletNodeNum > 0) { - Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp = RatedAmbAirTemp; - Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat = DataEnvironment::OutHumRat; - Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press = DataEnvironment::StdPressureSeaLevel; - Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb = ratedOutdoorAirWetBulb; + Psychrometrics::PsyWFnTdbTwbPb(state.dataVariableSpeedCoils->RatedAmbAirTemp, ratedOutdoorAirWetBulb, DataEnvironment::StdPressureSeaLevel, RoutineName); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum > 0) { + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp = state.dataVariableSpeedCoils->RatedAmbAirTemp; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat = DataEnvironment::OutHumRat; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press = DataEnvironment::StdPressureSeaLevel; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb = ratedOutdoorAirWetBulb; } - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) { // need to set water info for WSHP - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).InletWaterTemp = RatedInletWaterTemp; // 85 F cooling mode - Real64 CpSource = GetSpecificHeatGlycol(state, PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidName, - SourceSideInletTemp, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = state.dataVariableSpeedCoils->RatedInletWaterTemp; // 85 F cooling mode + Real64 CpSource = GetSpecificHeatGlycol(state, PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidName, + state.dataVariableSpeedCoils->SourceSideInletTemp, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, RoutineName); - VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = VarSpeedCoil(DXCoilNum).InletWaterTemp * CpSource; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp * CpSource; } // calculate coil model at rating point Real64 runtimeFrac(1.0); - VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = - VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); - CalcVarSpeedCoilCooling(state, DXCoilNum, 2.0, runtimeFrac, SensLoad, LatentLoad, 1, 1.0, 1.0, 1.0, VarSpeedCoil(DXCoilNum).NumOfSpeeds); + CalcVarSpeedCoilCooling(state, DXCoilNum, 2.0, runtimeFrac, SensLoad, LatentLoad, 1, 1.0, 1.0, 1.0, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); // coil outlets Real64 RatedOutletWetBulb(0.0); - RatedOutletWetBulb = Psychrometrics::PsyTwbFnTdbWPb(VarSpeedCoil(DXCoilNum).OutletAirDBTemp, - VarSpeedCoil(DXCoilNum).OutletAirHumRat, + RatedOutletWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, RoutineName); - coilSelectionReportObj->setRatedCoilConditions(VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).QLoadTotal, // this is the report variable - VarSpeedCoil(DXCoilNum).QSensible, // this is the report variable - VarSpeedCoil(DXCoilNum).AirMassFlowRate, - VarSpeedCoil(DXCoilNum).InletAirDBTemp, - VarSpeedCoil(DXCoilNum).InletAirHumRat, - RatedInletWetBulbTemp, - VarSpeedCoil(DXCoilNum).OutletAirDBTemp, - VarSpeedCoil(DXCoilNum).OutletAirHumRat, + coilSelectionReportObj->setRatedCoilConditions(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, // this is the report variable + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, // this is the report variable + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, + state.dataVariableSpeedCoils->RatedInletWetBulbTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, RatedOutletWetBulb, - RatedAmbAirTemp, + state.dataVariableSpeedCoils->RatedAmbAirTemp, ratedOutdoorAirWetBulb, - VarSpeedCoil(DXCoilNum).MSRatedCBF(VarSpeedCoil(DXCoilNum).NumOfSpeeds), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds), -999.0); // coil effectiveness not define for DX // now replace the outdoor air conditions set above for one time rating point calc @@ -3444,21 +3263,21 @@ namespace VariableSpeedCoils { } // Multispeed Heating - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) || - (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) || + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed)) { RatedHeatPumpIndoorAirTemp = 21.11; // 21.11C or 70F RatedHeatPumpIndoorHumRat = 0.00881; // Humidity ratio corresponding to 70F dry bulb/60F wet bulb - for (Mode = 1; Mode <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { - VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * PsyRhoAirFnPbTdbW(OutBaroPress, RatedHeatPumpIndoorAirTemp, RatedHeatPumpIndoorHumRat, RoutineName); // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - RatedVolFlowPerRatedTotCap = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); + RatedVolFlowPerRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); // note: variable-speed HP can exceed the flow rate restrictions at low speed levels // IF (((MinRatedAirVolFlowPerRatedTotCap - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest).OR. & // ((RatedVolFlowperRatedTotCap - MaxRatedAirVolFlowPerRatedTotCap) > SmallDifferenceTest)) THEN - // CALL ShowSevereError('Coil:Heating:DX:MultiSpeed '//TRIM(VarSpeedCoil(DXCoilNum)%Name)// & + // CALL ShowSevereError('Coil:Heating:DX:MultiSpeed '//TRIM(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%Name)// & // ': Rated air volume flow rate per watt of rated total '// & // 'heating capacity is out of range at speed '//TRIM(TrimSigDigits(Mode))) // CALL ShowContinueError('Min Rated Vol Flow Per Watt=['//TRIM(TrimSigDigits & @@ -3470,74 +3289,74 @@ namespace VariableSpeedCoils { // END IF } // call coil model with everthing set at rating point - VarSpeedCoil(DXCoilNum).InletAirDBTemp = RatedInletAirTempHeat; - VarSpeedCoil(DXCoilNum).InletAirHumRat = - Psychrometrics::PsyWFnTdbTwbPb(RatedInletAirTempHeat, RatedInletWetBulbTemp, DataEnvironment::StdPressureSeaLevel); - VarSpeedCoil(DXCoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTempHeat, VarSpeedCoil(DXCoilNum).InletAirHumRat); - VarSpeedCoil(DXCoilNum).InletAirPressure = DataEnvironment::StdPressureSeaLevel; - - VarSpeedCoil(DXCoilNum).AirMassFlowRate = - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(DataEnvironment::StdPressureSeaLevel, - RatedInletAirTempHeat, - VarSpeedCoil(DXCoilNum).InletAirHumRat); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = state.dataVariableSpeedCoils->RatedInletAirTempHeat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat = + Psychrometrics::PsyWFnTdbTwbPb(state.dataVariableSpeedCoils->RatedInletAirTempHeat, state.dataVariableSpeedCoils->RatedInletWetBulbTemp, DataEnvironment::StdPressureSeaLevel); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->RatedInletAirTempHeat, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure = DataEnvironment::StdPressureSeaLevel; + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(DataEnvironment::StdPressureSeaLevel, + state.dataVariableSpeedCoils->RatedInletAirTempHeat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat); // store environment data fill back in after rating point calc is over Real64 holdOutDryBulbTemp = DataEnvironment::OutDryBulbTemp; Real64 holdOutHumRat = DataEnvironment::OutHumRat; Real64 holdOutWetBulb = DataEnvironment::OutWetBulbTemp; Real64 holdOutBaroPress = DataEnvironment::OutBaroPress; - DataEnvironment::OutDryBulbTemp = RatedAmbAirTempHeat; - DataEnvironment::OutWetBulbTemp = RatedAmbAirWBHeat; + DataEnvironment::OutDryBulbTemp = state.dataVariableSpeedCoils->RatedAmbAirTempHeat; + DataEnvironment::OutWetBulbTemp = state.dataVariableSpeedCoils->RatedAmbAirWBHeat; DataEnvironment::OutBaroPress = DataEnvironment::StdPressureSeaLevel; // assume rating is for sea level. DataEnvironment::OutHumRat = - Psychrometrics::PsyWFnTdbTwbPb(RatedAmbAirTempHeat, RatedAmbAirWBHeat, DataEnvironment::StdPressureSeaLevel, RoutineName); - if (VarSpeedCoil(DXCoilNum).CondenserInletNodeNum > 0) { - Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp = RatedAmbAirTempHeat; - Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat = DataEnvironment::OutHumRat; - Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press = DataEnvironment::StdPressureSeaLevel; - Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb = RatedAmbAirWBHeat; + Psychrometrics::PsyWFnTdbTwbPb(state.dataVariableSpeedCoils->RatedAmbAirTempHeat, state.dataVariableSpeedCoils->RatedAmbAirWBHeat, DataEnvironment::StdPressureSeaLevel, RoutineName); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum > 0) { + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp = state.dataVariableSpeedCoils->RatedAmbAirTempHeat; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat = DataEnvironment::OutHumRat; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press = DataEnvironment::StdPressureSeaLevel; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb = state.dataVariableSpeedCoils->RatedAmbAirWBHeat; } - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) { // need to set water info for WSHP - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).InletWaterTemp = RatedInletWaterTempHeat; // 21.11C or 70F, heating mode + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = state.dataVariableSpeedCoils->RatedInletWaterTempHeat; // 21.11C or 70F, heating mode Real64 CpSource = GetSpecificHeatGlycol(state, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidName, - SourceSideInletTemp, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidName, + state.dataVariableSpeedCoils->SourceSideInletTemp, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, RoutineName); - VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = VarSpeedCoil(DXCoilNum).InletWaterTemp * CpSource; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp * CpSource; } // calculate coil model at rating point Real64 runtimeFrac(1.0); - VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = - VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(VarSpeedCoil(DXCoilNum).NumOfSpeeds); - CalcVarSpeedCoilHeating(state, DXCoilNum, 2.0, runtimeFrac, SensLoad, 1, 1.0, 1.0, 1.0, VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); + CalcVarSpeedCoilHeating(state, DXCoilNum, 2.0, runtimeFrac, SensLoad, 1, 1.0, 1.0, 1.0, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); // coil outlets Real64 RatedOutletWetBulb(0.0); - RatedOutletWetBulb = Psychrometrics::PsyTwbFnTdbWPb(VarSpeedCoil(DXCoilNum).OutletAirDBTemp, - VarSpeedCoil(DXCoilNum).OutletAirHumRat, + RatedOutletWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, DataEnvironment::StdPressureSeaLevel, RoutineName); - coilSelectionReportObj->setRatedCoilConditions(VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).QLoadTotal, // this is the report variable - VarSpeedCoil(DXCoilNum).QSensible, // this is the report variable - VarSpeedCoil(DXCoilNum).AirMassFlowRate, - VarSpeedCoil(DXCoilNum).InletAirDBTemp, - VarSpeedCoil(DXCoilNum).InletAirHumRat, - RatedInletWetBulbTemp, - VarSpeedCoil(DXCoilNum).OutletAirDBTemp, - VarSpeedCoil(DXCoilNum).OutletAirHumRat, + coilSelectionReportObj->setRatedCoilConditions(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal, // this is the report variable + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible, // this is the report variable + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat, + state.dataVariableSpeedCoils->RatedInletWetBulbTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat, RatedOutletWetBulb, - RatedAmbAirTempHeat, - RatedAmbAirWBHeat, - VarSpeedCoil(DXCoilNum).MSRatedCBF(VarSpeedCoil(DXCoilNum).NumOfSpeeds), + state.dataVariableSpeedCoils->RatedAmbAirTempHeat, + state.dataVariableSpeedCoils->RatedAmbAirWBHeat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds), -999.0); // coil effectiveness not define for DX // now replace the outdoor air conditions set above for one time rating point calc @@ -3548,114 +3367,114 @@ namespace VariableSpeedCoils { } // store fan info for coil - if (VarSpeedCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { - if (VarSpeedCoil(DXCoilNum).SupplyFanIndex > -1) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex > -1) { coilSelectionReportObj->setCoilSupplyFanInfo(state, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).SupplyFanName, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanName, DataAirSystems::objectVectorOOFanSystemModel, - VarSpeedCoil(DXCoilNum).SupplyFanIndex); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex); } } else { - if (VarSpeedCoil(DXCoilNum).SupplyFanIndex > 0) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex > 0) { coilSelectionReportObj->setCoilSupplyFanInfo(state, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).SupplyFanName, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanName, DataAirSystems::structArrayLegacyFanModels, - VarSpeedCoil(DXCoilNum).SupplyFanIndex); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex); } } } - if (SpeedNum > VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - SpeedCal = VarSpeedCoil(DXCoilNum).NumOfSpeeds; + if (SpeedNum > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { + SpeedCal = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; } else if (SpeedNum < 1) { SpeedCal = 1; } else { SpeedCal = SpeedNum; } - if ((SpeedNum <= 1) || (SpeedNum > VarSpeedCoil(DXCoilNum).NumOfSpeeds)) { - VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal); - VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(SpeedCal); - VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(SpeedCal); - VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(SpeedCal); + if ((SpeedNum <= 1) || (SpeedNum > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds)) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(SpeedCal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(SpeedCal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(SpeedCal); } else { - VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal - 1); - VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(SpeedCal - 1); - VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(SpeedCal - 1); - VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(SpeedCal - 1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal - 1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(SpeedCal - 1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(SpeedCal - 1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(SpeedCal - 1); } // Do the Begin Environment initializations if (BeginEnvrnFlag && MyEnvrnFlag(DXCoilNum) && !MyPlantScanFlag(DXCoilNum)) { // Do the initializations to start simulation - AirInletNode = VarSpeedCoil(DXCoilNum).AirInletNodeNum; + AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; // Initialize all report variables to a known state at beginning of simulation - VarSpeedCoil(DXCoilNum).AirVolFlowRate = 0.0; - VarSpeedCoil(DXCoilNum).InletAirDBTemp = 0.0; - VarSpeedCoil(DXCoilNum).InletAirHumRat = 0.0; - VarSpeedCoil(DXCoilNum).OutletAirDBTemp = 0.0; - VarSpeedCoil(DXCoilNum).OutletAirHumRat = 0.0; - VarSpeedCoil(DXCoilNum).WaterVolFlowRate = 0.0; - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; - VarSpeedCoil(DXCoilNum).InletWaterTemp = 0.0; - VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = 0.0; - VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; - VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; - VarSpeedCoil(DXCoilNum).Power = 0.0; - VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; - VarSpeedCoil(DXCoilNum).QSensible = 0.0; - VarSpeedCoil(DXCoilNum).QLatent = 0.0; - VarSpeedCoil(DXCoilNum).QSource = 0.0; - VarSpeedCoil(DXCoilNum).Energy = 0.0; - VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; - VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; - VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; - VarSpeedCoil(DXCoilNum).EnergySource = 0.0; - VarSpeedCoil(DXCoilNum).COP = 0.0; - VarSpeedCoil(DXCoilNum).RunFrac = 0.0; - VarSpeedCoil(DXCoilNum).PartLoadRatio = 0.0; - - VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour = MaxONOFFCyclesperHour; - VarSpeedCoil(DXCoilNum).HPTimeConstant = HPTimeConstant; - VarSpeedCoil(DXCoilNum).FanDelayTime = FanDelayTime; - - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit) || - (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit)) { - WaterInletNode = VarSpeedCoil(DXCoilNum).WaterInletNodeNum; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterVolFlowRate = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = 0.0; + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour = MaxONOFFCyclesperHour; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPTimeConstant = HPTimeConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime = FanDelayTime; + + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit) || + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit)) { + WaterInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; rho = GetDensityGlycol(state, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidName, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidName, CWInitConvTemp, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, RoutineNameSimpleWatertoAirHP); Cp = GetSpecificHeatGlycol(state, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidName, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidName, CWInitConvTemp, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, RoutineNameSimpleWatertoAirHP); - // VarSpeedCoil(DXCoilNum)%DesignWaterMassFlowRate= & - // rho * VarSpeedCoil(DXCoilNum)%RatedWaterVolFlowRate + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%DesignWaterMassFlowRate= & + // rho * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%RatedWaterVolFlowRate InitComponentNodes(0.0, - VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate, - VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, - VarSpeedCoil(DXCoilNum).LoopNum, - VarSpeedCoil(DXCoilNum).LoopSide, - VarSpeedCoil(DXCoilNum).BranchNum, - VarSpeedCoil(DXCoilNum).CompNum); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopSide, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BranchNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompNum); Node(WaterInletNode).Temp = 5.0; Node(WaterInletNode).Enthalpy = Cp * Node(WaterInletNode).Temp; @@ -3663,14 +3482,14 @@ namespace VariableSpeedCoils { Node(WaterInletNode).Press = 0.0; Node(WaterInletNode).HumRat = 0.0; - Node(VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Temp = 5.0; - Node(VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Enthalpy = Cp * Node(WaterInletNode).Temp; - Node(VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Quality = 0.0; - Node(VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Press = 0.0; - Node(VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).HumRat = 0.0; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Temp = 5.0; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Enthalpy = Cp * Node(WaterInletNode).Temp; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Quality = 0.0; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).Press = 0.0; + Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum).HumRat = 0.0; } - VarSpeedCoil(DXCoilNum).SimFlag = true; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; DataHeatBalance::HeatReclaimVS_DXCoil(DXCoilNum).AvailCapacity = 0.0; MyEnvrnFlag(DXCoilNum) = false; @@ -3687,112 +3506,112 @@ namespace VariableSpeedCoils { // Set water and air inlet nodes - AirInletNode = VarSpeedCoil(DXCoilNum).AirInletNodeNum; - WaterInletNode = VarSpeedCoil(DXCoilNum).WaterInletNodeNum; + AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; + WaterInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; if ((SensLoad != 0.0 || LatentLoad != 0.0) && (Node(AirInletNode).MassFlowRate > 0.0)) { - if (VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(VarSpeedCoil(DXCoilNum).NormSpedLevel) > 0.0) { - WaterFlowScale = VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate / - VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(VarSpeedCoil(DXCoilNum).NormSpedLevel); - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate * WaterFlowScale; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel) > 0.0) { + WaterFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate / + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate * WaterFlowScale; } else { - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; } if (CyclingScheme == ContFanCycCoil) { // continuous fan, cycling compressor - VarSpeedCoil(DXCoilNum).AirMassFlowRate = Node(AirInletNode).MassFlowRate; - // VarSpeedCoil(DXCoilNum)%AirMassFlowRate = VarSpeedCoil(DXCoilNum)%DesignAirVolFlowRate* & + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = Node(AirInletNode).MassFlowRate; + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%AirMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%DesignAirVolFlowRate* & // PsyRhoAirFnPbTdbW(OutBaroPress,Node(AirInletNode)%Temp,Node(AirInletNode)%HumRat) // If air flow is less than 25% rated flow. Then set air flow to the 25% of rated conditions - if (VarSpeedCoil(DXCoilNum).AirMassFlowRate < - 0.25 * VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate < + 0.25 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * PsyRhoAirFnPbTdbW(OutBaroPress, Node(AirInletNode).Temp, Node(AirInletNode).HumRat)) { - VarSpeedCoil(DXCoilNum).AirMassFlowRate = 0.25 * VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = 0.25 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * PsyRhoAirFnPbTdbW(OutBaroPress, Node(AirInletNode).Temp, Node(AirInletNode).HumRat); } } else { // CYCLIC FAN, NOT CORRECTION, WILL BE PROCESSED IN THE FOLLOWING SUBROUTINES - VarSpeedCoil(DXCoilNum).AirMassFlowRate = Node(AirInletNode).MassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = Node(AirInletNode).MassFlowRate; } } else { // heat pump is off - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; - VarSpeedCoil(DXCoilNum).AirMassFlowRate = 0.0; - } - - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit) || - (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit)) { - SetComponentFlowRate(VarSpeedCoil(DXCoilNum).WaterMassFlowRate, - VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, - VarSpeedCoil(DXCoilNum).LoopNum, - VarSpeedCoil(DXCoilNum).LoopSide, - VarSpeedCoil(DXCoilNum).BranchNum, - VarSpeedCoil(DXCoilNum).CompNum); - - VarSpeedCoil(DXCoilNum).InletWaterTemp = Node(WaterInletNode).Temp; - VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = Node(WaterInletNode).Enthalpy; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = 0.0; + } + + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit) || + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit)) { + SetComponentFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopSide, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BranchNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompNum); + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = Node(WaterInletNode).Temp; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = Node(WaterInletNode).Enthalpy; } else { - VarSpeedCoil(DXCoilNum).InletWaterTemp = 0.0; - VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = 0.0; } - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed) { - VarSpeedCoil(DXCoilNum).InletWaterTemp = Node(WaterInletNode).Temp; - VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = Node(WaterInletNode).Enthalpy; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = Node(WaterInletNode).Temp; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = Node(WaterInletNode).Enthalpy; }; - VarSpeedCoil(DXCoilNum).InletAirDBTemp = Node(AirInletNode).Temp; - VarSpeedCoil(DXCoilNum).InletAirHumRat = Node(AirInletNode).HumRat; - VarSpeedCoil(DXCoilNum).InletAirEnthalpy = Node(AirInletNode).Enthalpy; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = Node(AirInletNode).Temp; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat = Node(AirInletNode).HumRat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy = Node(AirInletNode).Enthalpy; - VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour = MaxONOFFCyclesperHour; - VarSpeedCoil(DXCoilNum).HPTimeConstant = HPTimeConstant; - VarSpeedCoil(DXCoilNum).FanDelayTime = FanDelayTime; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour = MaxONOFFCyclesperHour; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPTimeConstant = HPTimeConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime = FanDelayTime; - VarSpeedCoil(DXCoilNum).InletAirPressure = OutBaroPress; // temporary + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure = OutBaroPress; // temporary // Outlet variables - VarSpeedCoil(DXCoilNum).Power = 0.0; - VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; - VarSpeedCoil(DXCoilNum).QSensible = 0.0; - VarSpeedCoil(DXCoilNum).QLatent = 0.0; - VarSpeedCoil(DXCoilNum).QSource = 0.0; - VarSpeedCoil(DXCoilNum).QWasteHeat = 0.0; - VarSpeedCoil(DXCoilNum).Energy = 0.0; - VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; - VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; - VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; - VarSpeedCoil(DXCoilNum).EnergySource = 0.0; - VarSpeedCoil(DXCoilNum).COP = 0.0; - - VarSpeedCoil(DXCoilNum).OutletAirDBTemp = 0.0; - VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; - VarSpeedCoil(DXCoilNum).OutletAirHumRat = 0.0; - VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = 0.0; - VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; // bug fix, must set zeros to the variables below, otherwise can't pass switch DD test - VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = 0.0; - VarSpeedCoil(DXCoilNum).EvapWaterConsump = 0.0; - VarSpeedCoil(DXCoilNum).BasinHeaterConsumption = 0.0; - VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption = 0.0; - VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; - VarSpeedCoil(DXCoilNum).DefrostConsumption = 0.0; - VarSpeedCoil(DXCoilNum).CondensateVdot = 0.0; - VarSpeedCoil(DXCoilNum).CondensateVol = 0.0; - VarSpeedCoil(DXCoilNum).QWasteHeat = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterConsumption = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostConsumption = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVdot = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVol = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = 0.0; // clear zeros to HPWH variables - VarSpeedCoil(DXCoilNum).ElecWaterHeatingPower = 0.0; // Total electric power consumed by compressor and condenser pump [W] - VarSpeedCoil(DXCoilNum).ElecWaterHeatingConsumption = 0.0; // Total electric consumption by compressor and condenser pump [J] - VarSpeedCoil(DXCoilNum).TotalHeatingEnergy = 0.0; // total water heating energy - VarSpeedCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; // total WH energy rate - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = 0.0; // power power - - VSHPWHHeatingCapacity = 0.0; // Used by Heat Pump:Water Heater object as total water heating capacity [W] - VSHPWHHeatingCOP = 0.0; // Used by Heat Pump:Water Heater object as water heating COP [W/W] - VarSpeedCoil(DXCoilNum).OutletWaterTemp = VarSpeedCoil(DXCoilNum).InletWaterTemp; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ElecWaterHeatingPower = 0.0; // Total electric power consumed by compressor and condenser pump [W] + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ElecWaterHeatingConsumption = 0.0; // Total electric consumption by compressor and condenser pump [J] + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).TotalHeatingEnergy = 0.0; // total water heating energy + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).TotalHeatingEnergyRate = 0.0; // total WH energy rate + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = 0.0; // power power + + state.dataVariableSpeedCoils->VSHPWHHeatingCapacity = 0.0; // Used by Heat Pump:Water Heater object as total water heating capacity [W] + state.dataVariableSpeedCoils->VSHPWHHeatingCOP = 0.0; // Used by Heat Pump:Water Heater object as water heating COP [W/W] + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; DataHeatBalance::HeatReclaimVS_DXCoil(DXCoilNum).AvailCapacity = 0.0; } @@ -3910,8 +3729,8 @@ namespace VariableSpeedCoils { Real64 HPInletAirHumRat; // Rated inlet air humidity ratio for heat pump water heater [kgWater/kgDryAir] Real64 HPWHCoolCapacity; // estimate cooling capacity in HPWH - UpperSpeed = VarSpeedCoil(DXCoilNum).NumOfSpeeds; - NormSpeed = VarSpeedCoil(DXCoilNum).NormSpedLevel; + UpperSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + NormSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel; PltSizNum = 0; ErrorsFound = false; RatedAirFlowAutoSized = false; @@ -3949,58 +3768,58 @@ namespace VariableSpeedCoils { DefrostCapacityDes = 0.0; DefrostCapacityUser = 0.0; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit || - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit || + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == DataHVACGlobals::Coil_HeatingWaterToAirHPVSEquationFit) { CurrentObjSubfix = ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"; - } else if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed) { + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == CoilDX_HeatPumpWaterHeaterVariableSpeed) { CurrentObjSubfix = ":WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED"; } else { CurrentObjSubfix = ":DX:VARIABLESPEED"; } - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { - if (VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate == AutoCalculate) { - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = VarSpeedCoil(DXCoilNum).RatedCapWH * - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(NormSpeed) / - VarSpeedCoil(DXCoilNum).MSRatedTotCap(NormSpeed); // 0.00005035; - VarSpeedCoil(DXCoilNum).AirVolFlowAutoSized = true; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate == AutoCalculate) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapWH * + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(NormSpeed) / + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(NormSpeed); // 0.00005035; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowAutoSized = true; } - coilSelectionReportObj->setCoilAirFlow(VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate, - VarSpeedCoil(DXCoilNum).AirVolFlowAutoSized); + coilSelectionReportObj->setCoilAirFlow(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowAutoSized); - if (VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate == AutoCalculate) { - VarSpeedCoil(DXCoilNum).RatedHPWHCondWaterFlow = VarSpeedCoil(DXCoilNum).RatedCapWH * - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(NormSpeed) / - VarSpeedCoil(DXCoilNum).MSRatedTotCap(NormSpeed); // 0.00000004487; - VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = VarSpeedCoil(DXCoilNum).RatedHPWHCondWaterFlow; - VarSpeedCoil(DXCoilNum).WaterVolFlowAutoSized = true; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate == AutoCalculate) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedHPWHCondWaterFlow = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapWH * + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(NormSpeed) / + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(NormSpeed); // 0.00000004487; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedHPWHCondWaterFlow; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterVolFlowAutoSized = true; } coilSelectionReportObj->setCoilWaterFlowPltSizNum(state, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate, - VarSpeedCoil(DXCoilNum).WaterVolFlowAutoSized, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterVolFlowAutoSized, -999, - VarSpeedCoil(DXCoilNum).LoopNum); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum); } - if (VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate == AutoSize) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate == AutoSize) { RatedAirFlowAutoSized = true; } if (CurSysNum > 0) { if (!RatedAirFlowAutoSized && !SizingDesRunThisAirSys) { // Simulation continue HardSizeNoDesRunAirFlow = true; - if (VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate > 0.0) { - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate > 0.0) { + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "User-Specified Rated Air Flow Rate [m3/s]", - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate); } } else { - CheckSysSizing("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, VarSpeedCoil(DXCoilNum).Name); + CheckSysSizing("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); if (FinalSysSizing(CurSysNum).DesMainVolFlow >= SmallAirVolFlow) { RatedAirVolFlowRateDes = FinalSysSizing(CurSysNum).DesMainVolFlow; } else { @@ -4012,14 +3831,14 @@ namespace VariableSpeedCoils { if (CurZoneEqNum > 0) { if (!RatedAirFlowAutoSized && !SizingDesRunThisZone) { // Simulation continue HardSizeNoDesRunAirFlow = true; - if (VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate > 0.0) { - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate > 0.0) { + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "User-Specified Rated Air Flow Rate [m3/s]", - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate); } } else { - CheckZoneSizing("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, VarSpeedCoil(DXCoilNum).Name); + CheckZoneSizing("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); RatedAirVolFlowRateDes = max(FinalZoneSizing(CurZoneEqNum).DesCoolVolFlow, FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow); if (RatedAirVolFlowRateDes < SmallAirVolFlow) { RatedAirVolFlowRateDes = 0.0; @@ -4027,11 +3846,11 @@ namespace VariableSpeedCoils { } } - if (RatedAirFlowAutoSized) VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = RatedAirVolFlowRateDes; - // CALL BaseSizer::reportSizerOutput('COIL:'//TRIM(VarSpeedCoil(DXCoilNum)%CoolHeatType)//TRIM(CurrentObjSubfix), & - // VarSpeedCoil(DXCoilNum)%Name, & + if (RatedAirFlowAutoSized) state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = RatedAirVolFlowRateDes; + // CALL BaseSizer::reportSizerOutput('COIL:'//TRIM(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%CoolHeatType)//TRIM(CurrentObjSubfix), & + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%Name, & // 'Rated Air Flow Rate [m3/s]', & - // VarSpeedCoil(DXCoilNum)%RatedAirVolFlowRate) + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%RatedAirVolFlowRate) // RatedAirFlowAutoSized = .TRUE. @@ -4040,22 +3859,22 @@ namespace VariableSpeedCoils { // size rated total cooling capacity IsAutoSize = false; - if (VarSpeedCoil(DXCoilNum).RatedCapCoolTotal == AutoSize && VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal == AutoSize && state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { RatedCapCoolTotalAutoSized = true; } if (SizingDesRunThisZone || SizingDesRunThisAirSys) HardSizeNoDesRun = false; if (CurSysNum > 0) { if (!RatedCapCoolTotalAutoSized && !SizingDesRunThisAirSys) { // Simulation continue HardSizeNoDesRun = true; - if (VarSpeedCoil(DXCoilNum).RatedCapCoolTotal > 0.0) { - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal > 0.0) { + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "User-Specified Rated Total Cooling Capacity [W]", - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); } } else { - CheckSysSizing("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, VarSpeedCoil(DXCoilNum).Name); - VolFlowRate = VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate; + CheckSysSizing("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + VolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate; if (VolFlowRate >= SmallAirVolFlow) { if (CurOASysNum > 0) { // coil is in the OA stream MixTemp = FinalSysSizing(CurSysNum).OutTempAtCoolPeak; @@ -4096,14 +3915,14 @@ namespace VariableSpeedCoils { SupTemp -= FanCoolLoad / (CpAir * rhoair * VolFlowRate); } MixWetBulb = PsyTwbFnTdbWPb(MixTemp, MixHumRat, OutBaroPress, RoutineName); - // need to use OutTemp for air-cooled and RatedInletWaterTemp for water-cooled - if (VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { - RatedSourceTempCool = RatedInletWaterTemp; + // need to use OutTemp for air-cooled and state.dataVariableSpeedCoils->RatedInletWaterTemp for water-cooled + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { + RatedSourceTempCool = state.dataVariableSpeedCoils->RatedInletWaterTemp; } else { RatedSourceTempCool = OutTemp; } TotCapTempModFac = - CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(VarSpeedCoil(DXCoilNum).NormSpedLevel), MixWetBulb, RatedSourceTempCool); + CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel), MixWetBulb, RatedSourceTempCool); // The mixed air temp for zone equipment without an OA mixer is 0. // This test avoids a negative capacity until a solution can be found. @@ -4126,15 +3945,15 @@ namespace VariableSpeedCoils { } else if (CurZoneEqNum > 0) { if (!RatedCapCoolTotalAutoSized && !SizingDesRunThisZone) { // Simulation continue HardSizeNoDesRun = true; - if (VarSpeedCoil(DXCoilNum).RatedCapCoolTotal > 0.0) { - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal > 0.0) { + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "User-Specified Rated Total Cooling Capacity [W]", - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); } } else { - CheckZoneSizing("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, VarSpeedCoil(DXCoilNum).Name); - VolFlowRate = VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate; + CheckZoneSizing("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); + VolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate; if (VolFlowRate >= SmallAirVolFlow) { if (ZoneEqDXCoil) { if (ZoneEqSizing(CurZoneEqNum).OAVolFlow > 0.0) { @@ -4173,14 +3992,14 @@ namespace VariableSpeedCoils { } MixWetBulb = PsyTwbFnTdbWPb(MixTemp, MixHumRat, OutBaroPress, RoutineName); - // need to use OutTemp for air-cooled and RatedInletWaterTemp for water-cooled - if (VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { - RatedSourceTempCool = RatedInletWaterTemp; + // need to use OutTemp for air-cooled and state.dataVariableSpeedCoils->RatedInletWaterTemp for water-cooled + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { + RatedSourceTempCool = state.dataVariableSpeedCoils->RatedInletWaterTemp; } else { RatedSourceTempCool = OutTemp; } TotCapTempModFac = - CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(VarSpeedCoil(DXCoilNum).NormSpedLevel), MixWetBulb, RatedSourceTempCool); + CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel), MixWetBulb, RatedSourceTempCool); // The mixed air temp for zone equipment without an OA mixer is 0. // This test avoids a negative capacity until a solution can be found. @@ -4205,41 +4024,41 @@ namespace VariableSpeedCoils { } if (!HardSizeNoDesRun) { if (RatedCapCoolTotalAutoSized) { - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = RatedCapCoolTotalDes; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = RatedCapCoolTotalDes; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Rated Total Cooling Capacity [W]", - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); - PreDefTableEntry(pdchCoolCoilTotCap, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); + PreDefTableEntry(pdchCoolCoilTotCap, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); PreDefTableEntry(pdchCoolCoilLatCap, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal - VarSpeedCoil(DXCoilNum).RatedCapCoolSens); - if (VarSpeedCoil(DXCoilNum).RatedCapCoolTotal != 0.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal != 0.0) { PreDefTableEntry(pdchCoolCoilSHR, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).RatedCapCoolSens / VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); - PreDefTableEntry(pdchCoolCoilNomEff, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).MSRatedCOP(NormSpeed)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); + PreDefTableEntry(pdchCoolCoilNomEff, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(NormSpeed)); } else { - PreDefTableEntry(pdchCoolCoilSHR, VarSpeedCoil(DXCoilNum).Name, 0.0); - PreDefTableEntry(pdchCoolCoilNomEff, VarSpeedCoil(DXCoilNum).Name, 0.0); + PreDefTableEntry(pdchCoolCoilSHR, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, 0.0); + PreDefTableEntry(pdchCoolCoilNomEff, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, 0.0); } addFootNoteSubTable( pdstCoolCoil, "Nominal values are gross at rated conditions, i.e., the supply air fan heat and electric power NOT accounted for."); } else { - if (VarSpeedCoil(DXCoilNum).RatedCapCoolTotal > 0.0 && RatedCapCoolTotalDes > 0.0) { - RatedCapCoolTotalUser = VarSpeedCoil(DXCoilNum).RatedCapCoolTotal; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal > 0.0 && RatedCapCoolTotalDes > 0.0) { + RatedCapCoolTotalUser = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Rated Total Cooling Capacity [W]", RatedCapCoolTotalDes, "User-Specified Rated Total Cooling Capacity [W]", RatedCapCoolTotalUser); if (DisplayExtraWarnings) { if ((std::abs(RatedCapCoolTotalDes - RatedCapCoolTotalUser) / RatedCapCoolTotalUser) > AutoVsHardSizingThreshold) { - ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for " + VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + + ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + CurrentObjSubfix); - ShowContinueError("Coil Name =" + VarSpeedCoil(DXCoilNum).Name); + ShowContinueError("Coil Name =" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); ShowContinueError("User-Specified Rated Total Cooling Capacity of " + RoundSigDigits(RatedCapCoolTotalUser, 2) + " [W]"); ShowContinueError("differs from Design Size Rated Total Cooling Capacity of " + RoundSigDigits(RatedCapCoolTotalDes, 2) + " [W]"); @@ -4251,13 +4070,13 @@ namespace VariableSpeedCoils { } coilSelectionReportObj->setCoilEntAirTemp(state, - VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).VarSpeedCoilType, MixTemp, CurSysNum, CurZoneEqNum); - coilSelectionReportObj->setCoilEntAirHumRat(VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).VarSpeedCoilType, MixHumRat); - coilSelectionReportObj->setCoilLvgAirTemp(VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).VarSpeedCoilType, SupTemp); - coilSelectionReportObj->setCoilLvgAirHumRat(VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).VarSpeedCoilType, SupHumRat); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, MixTemp, CurSysNum, CurZoneEqNum); + coilSelectionReportObj->setCoilEntAirHumRat(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, MixHumRat); + coilSelectionReportObj->setCoilLvgAirTemp(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, SupTemp); + coilSelectionReportObj->setCoilLvgAirHumRat(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, SupHumRat); coilSelectionReportObj->setCoilCoolingCapacity(state, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, RatedCapCoolTotalDes, RatedCapCoolTotalAutoSized, CurSysNum, @@ -4270,28 +4089,28 @@ namespace VariableSpeedCoils { } // Set the global DX cooling coil capacity variable for use by other objects - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { - DXCoolCap = VarSpeedCoil(DXCoilNum).RatedCapCoolTotal; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { + DXCoolCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal; } // size rated heating capacity - if (VarSpeedCoil(DXCoilNum).RatedCapHeat == AutoSize && VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat == AutoSize && state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { RatedCapHeatAutoSized = true; } // simply set heating capacity equal to the cooling capacity - // VarSpeedCoil(DXCoilNum)%RatedCapHeat = DXCoolCap - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { - if (VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum > 0) { - RatedCapHeatDes = VarSpeedCoil(VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal; - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = RatedCapHeatDes; // AVOID BEING ZERO + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%RatedCapHeat = DXCoolCap + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum > 0) { + RatedCapHeatDes = state.dataVariableSpeedCoils->VarSpeedCoil(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = RatedCapHeatDes; // AVOID BEING ZERO } else { RatedCapHeatDes = DXCoolCap; // previous code, can be risky } // END IF if (RatedCapHeatAutoSized) { if (RatedCapHeatDes == AutoSize) { - ShowWarningError("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"" + - VarSpeedCoil(DXCoilNum).Name + "\""); + ShowWarningError("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"" + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\""); ShowContinueError(RoutineName + ": Heating coil could not be autosized since cooling coil was not previously sized."); ShowContinueError("... Cooling coil must be upstream of heating coil."); ShowContinueError("... Manually sizing this heating coil will be required."); @@ -4301,8 +4120,8 @@ namespace VariableSpeedCoils { RatedCapHeatDes = 0.0; } coilSelectionReportObj->setCoilHeatingCapacity(state, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, RatedCapHeatDes, RatedCapHeatAutoSized, CurSysNum, @@ -4314,33 +4133,33 @@ namespace VariableSpeedCoils { -999.0); } if (RatedCapHeatAutoSized) { - VarSpeedCoil(DXCoilNum).RatedCapHeat = RatedCapHeatDes; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat = RatedCapHeatDes; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Nominal Heating Capacity [W]", RatedCapHeatDes); - PreDefTableEntry(pdchHeatCoilNomCap, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).RatedCapHeat); - if (VarSpeedCoil(DXCoilNum).RatedCapHeat != 0.0) { - PreDefTableEntry(pdchHeatCoilNomEff, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).MSRatedCOP(NormSpeed)); + PreDefTableEntry(pdchHeatCoilNomCap, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat != 0.0) { + PreDefTableEntry(pdchHeatCoilNomEff, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(NormSpeed)); } else { - PreDefTableEntry(pdchHeatCoilNomEff, VarSpeedCoil(DXCoilNum).Name, 0.0); + PreDefTableEntry(pdchHeatCoilNomEff, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, 0.0); } addFootNoteSubTable(pdstHeatCoil, "Nominal values are gross at rated conditions, i.e., the supply air fan heat and electric power NOT accounted for."); } else { - if (VarSpeedCoil(DXCoilNum).RatedCapHeat > 0.0 && RatedCapHeatDes > 0.0) { - RatedCapHeatUser = VarSpeedCoil(DXCoilNum).RatedCapHeat; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat > 0.0 && RatedCapHeatDes > 0.0) { + RatedCapHeatUser = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Nominal Heating Capacity [W]", RatedCapHeatDes, "User-Specified Nominal Heating Capacity [W]", RatedCapHeatUser); if (DisplayExtraWarnings) { if ((std::abs(RatedCapHeatDes - RatedCapHeatUser) / RatedCapHeatUser) > AutoVsHardSizingThreshold) { - ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for " + VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + + ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + CurrentObjSubfix); - ShowContinueError("Coil Name =" + VarSpeedCoil(DXCoilNum).Name); + ShowContinueError("Coil Name =" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); ShowContinueError("User-Specified Rated Total Heating Capacity of " + RoundSigDigits(RatedCapHeatUser, 2) + " [W]"); ShowContinueError("differs from Design Size Rated Total Heating Capacity of " + RoundSigDigits(RatedCapHeatDes, 2) + " [W]"); ShowContinueError("This may, or may not, indicate mismatched component sizes."); @@ -4354,32 +4173,32 @@ namespace VariableSpeedCoils { if (!HardSizeNoDesRunAirFlow) { if ((RatedCapCoolTotalAutoSized) && (RatedAirFlowAutoSized)) { RatedAirVolFlowRateDes = - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(NormSpeed); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(NormSpeed); } else if ((RatedCapHeatAutoSized) && (RatedAirFlowAutoSized)) { - RatedAirVolFlowRateDes = VarSpeedCoil(DXCoilNum).RatedCapHeat * VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(NormSpeed); + RatedAirVolFlowRateDes = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(NormSpeed); } // write the air flow sizing output if (RatedAirFlowAutoSized) { - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = RatedAirVolFlowRateDes; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate = RatedAirVolFlowRateDes; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Rated Air Flow Rate [m3/s]", RatedAirVolFlowRateDes); } else { - if (VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate > 0.0 && RatedAirVolFlowRateDes > 0.0) { - RatedAirVolFlowRateUser = VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate > 0.0 && RatedAirVolFlowRateDes > 0.0) { + RatedAirVolFlowRateUser = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Rated Air Flow Rate [m3/s]", RatedAirVolFlowRateDes, "User-Specified Rated Air Flow Rate [m3/s]", RatedAirVolFlowRateUser); if (DisplayExtraWarnings) { if ((std::abs(RatedAirVolFlowRateDes - RatedAirVolFlowRateUser) / RatedAirVolFlowRateUser) > AutoVsHardSizingThreshold) { - ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for" + VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + + ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + CurrentObjSubfix); - ShowContinueError("Coil Name =" + VarSpeedCoil(DXCoilNum).Name); + ShowContinueError("Coil Name =" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); ShowContinueError("User-Specified Rated Air Flow Rate of " + RoundSigDigits(RatedAirVolFlowRateUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Rated Air Flow Rate of " + RoundSigDigits(RatedAirVolFlowRateDes, 5) + " [m3/s]"); @@ -4390,214 +4209,214 @@ namespace VariableSpeedCoils { } } coilSelectionReportObj->setCoilAirFlow( - VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).VarSpeedCoilType, RatedAirVolFlowRateDes, RatedAirFlowAutoSized); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, RatedAirVolFlowRateDes, RatedAirFlowAutoSized); } // Check that heat pump heating capacity is within 20% of cooling capacity. Check only for heating coil and report both. - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING" && VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum > 0) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING" && state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum > 0) { - if (VarSpeedCoil(VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal > 0.0) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal > 0.0) { - if (std::abs(VarSpeedCoil(VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal - VarSpeedCoil(DXCoilNum).RatedCapHeat) / - VarSpeedCoil(VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal > + if (std::abs(state.dataVariableSpeedCoils->VarSpeedCoil(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat) / + state.dataVariableSpeedCoils->VarSpeedCoil(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal > 0.2) { - ShowWarningError("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"" + - VarSpeedCoil(DXCoilNum).Name + "\""); - ShowContinueError("...used with COIL:" + VarSpeedCoil(VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).CoolHeatType + + ShowWarningError("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"" + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\""); + ShowContinueError("...used with COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).CoolHeatType + ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"" + - VarSpeedCoil(VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).Name + "\""); + state.dataVariableSpeedCoils->VarSpeedCoil(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).Name + "\""); ShowContinueError("...heating capacity is disproportionate (> 20% different) to total cooling capacity"); - ShowContinueError("...heating capacity = " + TrimSigDigits(VarSpeedCoil(DXCoilNum).RatedCapHeat, 3) + " W"); + ShowContinueError("...heating capacity = " + TrimSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat, 3) + " W"); ShowContinueError("...cooling capacity = " + - TrimSigDigits(VarSpeedCoil(VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal, 3) + " W"); + TrimSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapCoolTotal, 3) + " W"); } } } // ASSIGN CAPACITY - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) = - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal / VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(NormSpeed); - } else if (VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) = - VarSpeedCoil(DXCoilNum).RatedCapHeat / VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(NormSpeed); - } else if (VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) = - VarSpeedCoil(DXCoilNum).RatedCapWH / VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(NormSpeed); - } - - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(NormSpeed); + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(NormSpeed); + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapWH / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(NormSpeed); + } + + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { HPInletAirHumRat = - PsyWFnTdbTwbPb(VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp, VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp, StdBaroPress, RoutineName); - rhoA = PsyRhoAirFnPbTdbW(OutBaroPress, VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp, HPInletAirHumRat, RoutineName); - - for (Mode = VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) * VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(Mode); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(Mode); - VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; + PsyWFnTdbTwbPb(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp, StdBaroPress, RoutineName); + rhoA = PsyRhoAirFnPbTdbW(OutBaroPress, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp, HPInletAirHumRat, RoutineName); + + for (Mode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; // EVAPORATIVE PRECOOLING CONDENSER AIR FLOW RATE - VarSpeedCoil(DXCoilNum).EvapCondAirFlow(Mode) = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(Mode) = 0.0; } } else { - rhoA = PsyRhoAirFnPbTdbW(OutBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); + rhoA = PsyRhoAirFnPbTdbW(OutBaroPress, state.dataVariableSpeedCoils->RatedInletAirTemp, state.dataVariableSpeedCoils->RatedInletAirHumRat, RoutineName); // HPWH, the mass flow rate will be updated by a revised entering air density - if (VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex > -1 && UnitarySystems::designSpecMSHP.size() > 0) { - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { - if (UnitarySystems::designSpecMSHP[VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex].numOfSpeedCooling != - VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - ShowFatalError("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix + " = " + VarSpeedCoil(DXCoilNum).Name + + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex > -1 && UnitarySystems::designSpecMSHP.size() > 0) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { + if (UnitarySystems::designSpecMSHP[state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex].numOfSpeedCooling != + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { + ShowFatalError("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix + " = " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + " number of speeds not equal to number of speed specified in UnitarySystemPerformance:Multispeed object."); } else { - for (Mode = VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * - UnitarySystems::designSpecMSHP[VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex].coolingVolFlowRatio[Mode - 1]; - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(Mode); - VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; + for (Mode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * + UnitarySystems::designSpecMSHP[state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex].coolingVolFlowRatio[Mode - 1]; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; // EVAPORATIVE PRECOOLING CONDENSER AIR FLOW RATE - VarSpeedCoil(DXCoilNum).EvapCondAirFlow(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * VarSpeedCoil(DXCoilNum).MSRatedEvapCondVolFlowPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedEvapCondVolFlowPerRatedTotCap(Mode); } } - } else if (VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { - if (UnitarySystems::designSpecMSHP[VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex].numOfSpeedHeating != - VarSpeedCoil(DXCoilNum).NumOfSpeeds) { - ShowFatalError("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix + " = " + VarSpeedCoil(DXCoilNum).Name + + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { + if (UnitarySystems::designSpecMSHP[state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex].numOfSpeedHeating != + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds) { + ShowFatalError("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix + " = " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + " number of speeds not equal to number of speed specified in UnitarySystemPerformance:Multispeed object."); } else { - for (Mode = VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * - UnitarySystems::designSpecMSHP[VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex].heatingVolFlowRatio[Mode - 1]; - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(Mode); - VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; + for (Mode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * + UnitarySystems::designSpecMSHP[state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSHPDesignSpecIndex].heatingVolFlowRatio[Mode - 1]; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; // EVAPORATIVE PRECOOLING CONDENSER AIR FLOW RATE - VarSpeedCoil(DXCoilNum).EvapCondAirFlow(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * VarSpeedCoil(DXCoilNum).MSRatedEvapCondVolFlowPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedEvapCondVolFlowPerRatedTotCap(Mode); } } } } else { - for (Mode = VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) * VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(Mode); - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(Mode); - VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; + for (Mode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(UpperSpeed) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; // EVAPORATIVE PRECOOLING CONDENSER AIR FLOW RATE - VarSpeedCoil(DXCoilNum).EvapCondAirFlow(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * VarSpeedCoil(DXCoilNum).MSRatedEvapCondVolFlowPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedEvapCondVolFlowPerRatedTotCap(Mode); } } } // size rated power - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { - VarSpeedCoil(DXCoilNum).RatedCOPCool = VarSpeedCoil(DXCoilNum).MSRatedCOP(VarSpeedCoil(DXCoilNum).NormSpedLevel); - VarSpeedCoil(DXCoilNum).RatedPowerCool = VarSpeedCoil(DXCoilNum).RatedCapCoolTotal / VarSpeedCoil(DXCoilNum).RatedCOPCool; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCOPCool = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedPowerCool = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCOPCool; - } else if (VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { - VarSpeedCoil(DXCoilNum).RatedCOPHeat = VarSpeedCoil(DXCoilNum).MSRatedCOP(VarSpeedCoil(DXCoilNum).NormSpedLevel); - VarSpeedCoil(DXCoilNum).RatedPowerHeat = VarSpeedCoil(DXCoilNum).RatedCapHeat / VarSpeedCoil(DXCoilNum).RatedCOPHeat; - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = VarSpeedCoil(DXCoilNum).RatedCapHeat; - } else if (VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { - VarSpeedCoil(DXCoilNum).RatedCOPHeat = VarSpeedCoil(DXCoilNum).MSRatedCOP(VarSpeedCoil(DXCoilNum).NormSpedLevel); - VarSpeedCoil(DXCoilNum).RatedPowerHeat = VarSpeedCoil(DXCoilNum).RatedCapWH / VarSpeedCoil(DXCoilNum).RatedCOPHeat; - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = VarSpeedCoil(DXCoilNum).RatedCapWH * (1.0 - 1.0 / VarSpeedCoil(DXCoilNum).RatedCOPHeat); + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCOPHeat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedPowerHeat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCOPHeat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat; + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCOPHeat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedPowerHeat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapWH / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCOPHeat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapWH * (1.0 - 1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCOPHeat); } // Size water volumetric flow rate - if ((VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate == AutoSize) && - (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit || - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate == AutoSize) && + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit || + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit)) { RatedWaterFlowAutoSized = true; } //! if not found on a plant loop, check condenser loop and warn user if not found // IF(PltSizNum == 0) THEN // PltSizNum = & - // MyCondPlantSizingIndex('COIL:'//TRIM(VarSpeedCoil(DXCoilNum)%CoolHeatType)// & + // MyCondPlantSizingIndex('COIL:'//TRIM(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%CoolHeatType)// & // TRIM(CurrentObjSubfix), & - // VarSpeedCoil(DXCoilNum)%Name, & - // VarSpeedCoil(DXCoilNum)%WaterInletNodeNum, & - // VarSpeedCoil(DXCoilNum)%WaterOutletNodeNum, ErrorsFound) + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%Name, & + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%WaterInletNodeNum, & + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%WaterOutletNodeNum, ErrorsFound) // END IF // WSHP condenser can be on either a plant loop or condenser loop. Test each to find plant sizing number. // first check to see if coil is connected to a plant loop, no warning on this CALL if (RatedWaterFlowAutoSized) { - if (VarSpeedCoil(DXCoilNum).CondenserType == WaterCooled) - PltSizNum = MyPlantSizingIndex("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType == WaterCooled) + PltSizNum = MyPlantSizingIndex("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, ErrorsFound, false); if (PltSizNum > 0) { - rho = GetDensityGlycol(state, PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidName, + rho = GetDensityGlycol(state, PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidName, PlantSizData(PltSizNum).ExitTemp, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, RoutineNameAlt); cp = GetSpecificHeatGlycol(state, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidName, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidName, PlantSizData(PltSizNum).ExitTemp, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, RoutineNameAlt); - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "HEATING") { - RatedWaterVolFlowRateDes = VarSpeedCoil(DXCoilNum).RatedCapHeat / (PlantSizData(PltSizNum).DeltaT * cp * rho); + RatedWaterVolFlowRateDes = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat / (PlantSizData(PltSizNum).DeltaT * cp * rho); - // CALL BaseSizer::reportSizerOutput('COIL:'//TRIM(VarSpeedCoil(DXCoilNum)%CoolHeatType)//& + // CALL BaseSizer::reportSizerOutput('COIL:'//TRIM(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%CoolHeatType)//& // TRIM(CurrentObjSubfix), & - // VarSpeedCoil(DXCoilNum)%Name, & - // 'Rated Water Flow Rate [m3/s]', VarSpeedCoil(DXCoilNum)%RatedWaterVolFlowRate) - coilSelectionReportObj->setCoilLvgWaterTemp(VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%Name, & + // 'Rated Water Flow Rate [m3/s]', state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%RatedWaterVolFlowRate) + coilSelectionReportObj->setCoilLvgWaterTemp(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, PlantSizData(PltSizNum).ExitTemp + PlantSizData(PltSizNum).DeltaT); // TRACE 3D Plus coil selection report - } else if (VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { // use companion heating coil capacity to calculate volumetric flow rate - if (VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum > 0) { - SystemCapacity = VarSpeedCoil(VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapHeat; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum > 0) { + SystemCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CompanionCoolingCoilNum).RatedCapHeat; } else { - SystemCapacity = VarSpeedCoil(DXCoilNum).RatedCapCoolTotal; + SystemCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal; } RatedWaterVolFlowRateDes = SystemCapacity / (PlantSizData(PltSizNum).DeltaT * cp * rho); - // CALL BaseSizer::reportSizerOutput('COIL:'//TRIM(VarSpeedCoil(DXCoilNum)%CoolHeatType)& + // CALL BaseSizer::reportSizerOutput('COIL:'//TRIM(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%CoolHeatType)& // //TRIM(CurrentObjSubfix), & - // VarSpeedCoil(DXCoilNum)%Name, & - // 'Rated Water Flow Rate [m3/s]', VarSpeedCoil(DXCoilNum)%RatedWaterVolFlowRate) - coilSelectionReportObj->setCoilLvgWaterTemp(VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + // state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%Name, & + // 'Rated Water Flow Rate [m3/s]', state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%RatedWaterVolFlowRate) + coilSelectionReportObj->setCoilLvgWaterTemp(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, PlantSizData(PltSizNum).ExitTemp - PlantSizData(PltSizNum).DeltaT); // TRACE 3D Plus coil selection report } - coilSelectionReportObj->setCoilEntWaterTemp(VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + coilSelectionReportObj->setCoilEntWaterTemp(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, PlantSizData(PltSizNum).ExitTemp); // TRACE 3D Plus coil selection report - coilSelectionReportObj->setCoilWaterDeltaT(VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + coilSelectionReportObj->setCoilWaterDeltaT(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, PlantSizData(PltSizNum).DeltaT); // TRACE 3D Plus coil selection report } else { ShowSevereError("Autosizing of water flow requires a loop Sizing:Plant object"); ShowContinueError("Autosizing also requires physical connection to a plant or condenser loop."); - ShowContinueError("Occurs in COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix + - " Object=" + VarSpeedCoil(DXCoilNum).Name); + ShowContinueError("Occurs in COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix + + " Object=" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); ErrorsFound = true; } } @@ -4607,50 +4426,50 @@ namespace VariableSpeedCoils { // FORCE BACK TO THE RATED WATER FLOW RATE WITH THE SAME RATIO DEFINED BY THE CATLOG DATA if (RatedCapCoolTotalAutoSized) { RatedWaterVolFlowRateDes = - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); } else if (RatedCapHeatAutoSized) { RatedWaterVolFlowRateDes = - VarSpeedCoil(DXCoilNum).RatedCapHeat * VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); } coilSelectionReportObj->setCoilWaterFlowNodeNums(state, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, RatedWaterVolFlowRateDes, RatedWaterFlowAutoSized, - VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, - VarSpeedCoil(DXCoilNum).LoopNum); - VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = RatedWaterVolFlowRateDes; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate = RatedWaterVolFlowRateDes; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Rated Water Flow Rate [m3/s]", RatedWaterVolFlowRateDes); // Ensure water 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 <= VarSpeedCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { - if (VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) > VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode + 1) * 1.05) { - ShowWarningError("SizeDXCoil: " + VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + VarSpeedCoil(DXCoilNum).Name + ", Speed " + + for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode + 1) * 1.05) { + ShowWarningError("SizeDXCoil: " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + ", Speed " + TrimSigDigits(Mode) + " Rated Air Flow Rate must be less than or equal to Speed " + TrimSigDigits(Mode + 1) + " Rated Air Flow Rate."); - ShowContinueError("Instead, " + RoundSigDigits(VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), 2) + " > " + - RoundSigDigits(VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1), 2)); + ShowContinueError("Instead, " + RoundSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), 2) + " > " + + RoundSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1), 2)); ShowFatalError("Preceding conditions cause termination."); } } } else { - if (VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate > 0.0 && RatedWaterVolFlowRateDes > 0.0) { - RatedWaterVolFlowRateUser = VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate > 0.0 && RatedWaterVolFlowRateDes > 0.0) { + RatedWaterVolFlowRateUser = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Rated Water Flow Rate [m3/s]", RatedWaterVolFlowRateDes, "User-Specified Rated Water Flow Rate [m3/s]", RatedWaterVolFlowRateUser); if (DisplayExtraWarnings) { if ((std::abs(RatedWaterVolFlowRateDes - RatedWaterVolFlowRateUser) / RatedWaterVolFlowRateUser) > AutoVsHardSizingThreshold) { - ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for" + VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + + ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + CurrentObjSubfix); - ShowContinueError("Coil Name =" + VarSpeedCoil(DXCoilNum).Name); + ShowContinueError("Coil Name =" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); ShowContinueError("User-Specified Rated Water Flow Rate of " + RoundSigDigits(RatedWaterVolFlowRateUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Rated Water Flow Rate of " + RoundSigDigits(RatedWaterVolFlowRateDes, 5) + " [m3/s]"); @@ -4662,181 +4481,181 @@ namespace VariableSpeedCoils { } // Save component design water volumetric flow rate. - if (VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate > 0.0 && VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { - RegisterPlantCompDesignFlow(VarSpeedCoil(DXCoilNum).WaterInletNodeNum, VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate > 0.0 && state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { + RegisterPlantCompDesignFlow(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate); } // Use 1/2 flow since both cooling and heating coil will save flow yet only 1 will operate at a time - else if (VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate > 0.0) { - RegisterPlantCompDesignFlow(VarSpeedCoil(DXCoilNum).WaterInletNodeNum, 0.5 * VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate); + else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate > 0.0) { + RegisterPlantCompDesignFlow(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, 0.5 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate); } - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit || - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit || + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit) { - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit) { - RatedSourceTempCool = RatedInletWaterTemp; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit) { + RatedSourceTempCool = state.dataVariableSpeedCoils->RatedInletWaterTemp; } else { - RatedSourceTempCool = RatedInletWaterTempHeat; + RatedSourceTempCool = state.dataVariableSpeedCoils->RatedInletWaterTempHeat; } if (PltSizNum > 0) { rhoW = rho; } else { rhoW = GetDensityGlycol(state, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidName, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidName, RatedSourceTempCool, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, RoutineName); } - VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate = VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate * rhoW; - for (Mode = VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(Mode); - VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) * rhoW; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate * rhoW; + for (Mode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) * rhoW; } - } else if (VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { - RatedSourceTempCool = VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp; + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { + RatedSourceTempCool = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp; rhoW = RhoH2O(RatedSourceTempCool); - VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate = VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate * rhoW; - for (Mode = VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { - VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(Mode); - VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * VarSpeedCoil(DXCoilNum).MSWHPumpPowerPerRatedTotCap(Mode); - VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) * rhoW; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate * rhoW; + for (Mode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; Mode >= 1; --Mode) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPowerPerRatedTotCap(Mode); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(Mode) * rhoW; } } else { - RatedSourceTempCool = RatedAmbAirTemp; + RatedSourceTempCool = state.dataVariableSpeedCoils->RatedAmbAirTemp; } // Ensure air 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 <= VarSpeedCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { - if (VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) > VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1)) { - ShowWarningError("SizeDXCoil: " + VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + VarSpeedCoil(DXCoilNum).Name + ", Speed " + + for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1)) { + ShowWarningError("SizeDXCoil: " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + ", Speed " + TrimSigDigits(Mode) + " Rated Air Flow Rate must be less than or equal to Speed " + TrimSigDigits(Mode + 1) + " Rated Air Flow Rate."); - ShowContinueError("Instead, " + RoundSigDigits(VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), 2) + " > " + - RoundSigDigits(VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1), 2)); + ShowContinueError("Instead, " + RoundSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), 2) + " > " + + RoundSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode + 1), 2)); ShowFatalError("Preceding conditions cause termination."); } } // Ensure capacity at lower speed must be lower or equal to the capacity at higher speed. - for (Mode = 1; Mode <= VarSpeedCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { - if (VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) > VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode + 1)) { - ShowWarningError("SizeDXCoil: " + VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + VarSpeedCoil(DXCoilNum).Name + ", Speed " + + for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds - 1; ++Mode) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode + 1)) { + ShowWarningError("SizeDXCoil: " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType + ' ' + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + ", Speed " + TrimSigDigits(Mode) + " Rated Total Cooling Capacity must be less than or equal to Speed " + TrimSigDigits(Mode + 1) + " Rated Total Cooling Capacity."); - ShowContinueError("Instead, " + RoundSigDigits(VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode), 2) + " > " + - RoundSigDigits(VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode + 1), 2)); + ShowContinueError("Instead, " + RoundSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode), 2) + " > " + + RoundSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode + 1), 2)); ShowFatalError("Preceding conditions cause termination."); } } // convert SHR to rated Bypass factor and effective air side surface area - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { - for (Mode = 1; Mode <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { - VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode) = CalcCBF(VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).Name, - RatedInletAirTemp, - RatedInletAirHumRat, - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode), - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), - VarSpeedCoil(DXCoilNum).MSRatedSHR(Mode), + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { + for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode) = CalcCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->RatedInletAirTemp, + state.dataVariableSpeedCoils->RatedInletAirHumRat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(Mode), true); - if (VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode) > 0.0) { - VarSpeedCoil(DXCoilNum).MSEffectiveAo(Mode) = - -std::log(VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode)) * VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode) > 0.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(Mode) = + -std::log(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode)) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode); } else { - VarSpeedCoil(DXCoilNum).MSEffectiveAo(Mode) = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(Mode) = 0.0; } } - } else if (VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { - HPWHInletDBTemp = VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp; - HPWHInletWBTemp = VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp; + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { + HPWHInletDBTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletDBTemp; + HPWHInletWBTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWBTemp; rhoA = PsyRhoAirFnPbTdbW(StdBaroPress, HPWHInletDBTemp, HPInletAirHumRat, RoutineName); - for (Mode = 1; Mode <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { - VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; + for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * rhoA; // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) - // RatedVolFlowPerRatedTotCap = VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / + // RatedVolFlowPerRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / // VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode);//prepared for checking ratios, not used here } - for (Mode = 1; Mode <= VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { // get cooling capacity, without fan power, i.e. total coil cooling - if (VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) - HPWHCoolCapacity = VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * (1.0 - 1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(Mode)) + - VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) - - VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) * VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) + HPWHCoolCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * (1.0 - 1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(Mode)) + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) - + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; else - HPWHCoolCapacity = VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * (1.0 - 1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(Mode)) - - VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) * VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; + HPWHCoolCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * (1.0 - 1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(Mode)) - + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; - VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode) = CalcCBF(VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode) = CalcCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, HPWHInletDBTemp, HPInletAirHumRat, HPWHCoolCapacity, - VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), - VarSpeedCoil(DXCoilNum).MSRatedSHR(Mode), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(Mode), true); - if (VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode) > 0.0) { - VarSpeedCoil(DXCoilNum).MSEffectiveAo(Mode) = - -std::log(VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode)) * VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode) > 0.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(Mode) = + -std::log(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(Mode)) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode); } else { - VarSpeedCoil(DXCoilNum).MSEffectiveAo(Mode) = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(Mode) = 0.0; } } - // update VarSpeedCoil(DXCoilNum).RatedCapCoolTotal - Mode = VarSpeedCoil(DXCoilNum).NormSpedLevel; - if (VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * (1.0 - 1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(Mode)) + - VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) - - VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) * VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; + // update state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal + Mode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * (1.0 - 1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(Mode)) + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) - + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; } else { - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = - VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * (1.0 - 1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(Mode)) - - VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) * VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) * (1.0 - 1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(Mode)) - + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(Mode) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; } } // size rated sensible cooling capacity RatedCapCoolSensAutoSized = true; // always do that - if (VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate >= SmallAirVolFlow && VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate >= SmallAirVolFlow && state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { RatedAirMassFlowRate = - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * PsyRhoAirFnPbTdbW(StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); - RatedInletEnth = PsyHFnTdbW(RatedInletAirTemp, RatedInletAirHumRat); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate * PsyRhoAirFnPbTdbW(StdBaroPress, state.dataVariableSpeedCoils->RatedInletAirTemp, state.dataVariableSpeedCoils->RatedInletAirHumRat, RoutineName); + RatedInletEnth = PsyHFnTdbW(state.dataVariableSpeedCoils->RatedInletAirTemp, state.dataVariableSpeedCoils->RatedInletAirHumRat); CBFRated = AdjustCBF( - VarSpeedCoil(DXCoilNum).MSRatedCBF(NormSpeed), VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(NormSpeed), RatedAirMassFlowRate); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(NormSpeed), state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(NormSpeed), RatedAirMassFlowRate); if (CBFRated > 0.999) CBFRated = 0.999; - AirMassFlowRatio = RatedAirMassFlowRate / VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(NormSpeed); + AirMassFlowRatio = RatedAirMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(NormSpeed); - if (VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(NormSpeed) > 1.0e-10) { - WaterMassFlowRatio = VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate / VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(NormSpeed); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(NormSpeed) > 1.0e-10) { + WaterMassFlowRatio = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterVolFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterVolFlowRate(NormSpeed); } else { WaterMassFlowRatio = 1.0; } - Real64 TempInletWetBulb = RatedInletWetBulbTemp; + Real64 TempInletWetBulb = state.dataVariableSpeedCoils->RatedInletWetBulbTemp; CalcTotCapSHR_VSWSHP(state, - RatedInletAirTemp, - RatedInletAirHumRat, + state.dataVariableSpeedCoils->RatedInletAirTemp, + state.dataVariableSpeedCoils->RatedInletAirHumRat, RatedInletEnth, TempInletWetBulb, AirMassFlowRatio, WaterMassFlowRatio, RatedAirMassFlowRate, CBFRated, - VarSpeedCoil(DXCoilNum).MSRatedTotCap(NormSpeed), - VarSpeedCoil(DXCoilNum).MSCCapFTemp(NormSpeed), - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(NormSpeed), - VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(NormSpeed), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(NormSpeed), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(NormSpeed), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(NormSpeed), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(NormSpeed), 0.0, 0, 0, @@ -4849,12 +4668,12 @@ namespace VariableSpeedCoils { StdBaroPress, 0.0, 1, - VarSpeedCoil(DXCoilNum).capModFacTotal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); - RatedCapCoolSensDes = VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * SHR; - } else if (VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate >= SmallAirVolFlow && VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { - SHR = VarSpeedCoil(DXCoilNum).MSRatedSHR(NormSpeed); - RatedCapCoolSensDes = VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * SHR; + RatedCapCoolSensDes = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * SHR; + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate >= SmallAirVolFlow && state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "WATERHEATING") { + SHR = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(NormSpeed); + RatedCapCoolSensDes = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * SHR; } else { RatedCapCoolSensDes = 0.0; } @@ -4863,61 +4682,61 @@ namespace VariableSpeedCoils { RatedCapCoolSensDes = 0.0; } - if (VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { // always report for cooling mode + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType == "COOLING") { // always report for cooling mode if (RatedCapCoolTotalAutoSized) { - VarSpeedCoil(DXCoilNum).RatedCapCoolSens = RatedCapCoolSensDes; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = RatedCapCoolSensDes; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Rated Sensible Cooling Capacity [W]", - VarSpeedCoil(DXCoilNum).RatedCapCoolSens); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens); } else { // sensible capacity does not have an input field if (RatedCapCoolSensDes > 0.0) { - VarSpeedCoil(DXCoilNum).RatedCapCoolSens = RatedCapCoolSensDes; - BaseSizer::reportSizerOutput("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = RatedCapCoolSensDes; + BaseSizer::reportSizerOutput("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + CurrentObjSubfix, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Rated Sensible Cooling Capacity [W]", RatedCapCoolSensDes); //, & } } - PreDefTableEntry(pdchCoolCoilTotCap, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); - PreDefTableEntry(pdchCoolCoilSensCap, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).RatedCapCoolSens); + PreDefTableEntry(pdchCoolCoilTotCap, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); + PreDefTableEntry(pdchCoolCoilSensCap, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens); PreDefTableEntry(pdchCoolCoilLatCap, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal - VarSpeedCoil(DXCoilNum).RatedCapCoolSens); - if (VarSpeedCoil(DXCoilNum).RatedCapCoolTotal != 0.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal != 0.0) { PreDefTableEntry(pdchCoolCoilSHR, - VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).RatedCapCoolSens / VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal); } else { - PreDefTableEntry(pdchCoolCoilSHR, VarSpeedCoil(DXCoilNum).Name, 0.0); + PreDefTableEntry(pdchCoolCoilSHR, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, 0.0); } PreDefTableEntry( - pdchCoolCoilNomEff, VarSpeedCoil(DXCoilNum).Name, VarSpeedCoil(DXCoilNum).MSRatedCOP(VarSpeedCoil(DXCoilNum).NormSpedLevel)); + pdchCoolCoilNomEff, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); addFootNoteSubTable(pdstCoolCoil, "Nominal values are gross at rated conditions, i.e., the supply air fan heat and electric power NOT accounted for."); } // START SIZING EVAP PRECOOLING PUMP POWER IsAutoSize = false; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { - if (VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower == AutoSize) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower == AutoSize) { IsAutoSize = true; } // Auto size high speed evap condenser pump power to Total Capacity * 0.004266 w/w (15 w/ton) - EvapCondPumpElecNomPowerDes = VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * 0.004266; + EvapCondPumpElecNomPowerDes = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal * 0.004266; if (IsAutoSize) { - VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower = EvapCondPumpElecNomPowerDes; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower = EvapCondPumpElecNomPowerDes; BaseSizer::reportSizerOutput("AS VS COOLING COIL", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Evaporative Condenser Pump Rated Power Consumption [W]", EvapCondPumpElecNomPowerDes); } else { - if (VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower > 0.0 && EvapCondPumpElecNomPowerDes > 0.0) { - EvapCondPumpElecNomPowerUser = VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower > 0.0 && EvapCondPumpElecNomPowerDes > 0.0) { + EvapCondPumpElecNomPowerUser = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower; BaseSizer::reportSizerOutput("AS VS COOLING COIL", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Evaporative Condenser Pump Rated Power Consumption [W]", EvapCondPumpElecNomPowerDes, "User-Specified Evaporative Condenser Pump Rated Power Consumption [W]", @@ -4925,9 +4744,9 @@ namespace VariableSpeedCoils { if (DisplayExtraWarnings) { if ((std::abs(EvapCondPumpElecNomPowerDes - EvapCondPumpElecNomPowerUser) / EvapCondPumpElecNomPowerUser) > AutoVsHardSizingThreshold) { - ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for " + VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + + ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + CurrentObjSubfix); - ShowContinueError("Coil Name =" + VarSpeedCoil(DXCoilNum).Name); + ShowContinueError("Coil Name =" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); ShowContinueError("User-Specified Evaporative Condenser Pump Rated Power Consumption of " + RoundSigDigits(EvapCondPumpElecNomPowerUser, 2) + " [W]"); ShowContinueError("differs from Design Size Evaporative Condenser Pump Rated Power Consumption of " + @@ -4945,33 +4764,33 @@ namespace VariableSpeedCoils { // Resistive Defrost Heater Capacity = capacity at the first stage IsAutoSize = false; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { - if (VarSpeedCoil(DXCoilNum).DefrostCapacity == AutoSize) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity == AutoSize) { IsAutoSize = true; } - if (VarSpeedCoil(DXCoilNum).DefrostStrategy == Resistive) { - DefrostCapacityDes = VarSpeedCoil(DXCoilNum).RatedCapHeat; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy == state.dataVariableSpeedCoils->Resistive) { + DefrostCapacityDes = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat; } else { DefrostCapacityDes = 0.0; } if (IsAutoSize) { - VarSpeedCoil(DXCoilNum).DefrostCapacity = DefrostCapacityDes; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity = DefrostCapacityDes; BaseSizer::reportSizerOutput( - "AS VS HEATING COIL", VarSpeedCoil(DXCoilNum).Name, "Design Size Resistive Defrost Heater Capacity [W]", DefrostCapacityDes); + "AS VS HEATING COIL", state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Resistive Defrost Heater Capacity [W]", DefrostCapacityDes); } else { - if (VarSpeedCoil(DXCoilNum).DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0 && !HardSizeNoDesRun) { - DefrostCapacityUser = VarSpeedCoil(DXCoilNum).DefrostCapacity; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity > 0.0 && DefrostCapacityDes > 0.0 && !HardSizeNoDesRun) { + DefrostCapacityUser = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity; BaseSizer::reportSizerOutput("AS VS HEATING COIL", - VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, "Design Size Resistive Defrost Heater Capacity [W]", DefrostCapacityDes, "User-Specified Resistive Defrost Heater Capacity [W]", DefrostCapacityUser); if (DisplayExtraWarnings) { if ((std::abs(DefrostCapacityDes - DefrostCapacityUser) / DefrostCapacityUser) > AutoVsHardSizingThreshold) { - ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for " + VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + + ShowMessage("SizeVarSpeedCoil: Potential issue with equipment sizing for " + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ' ' + CurrentObjSubfix); - ShowContinueError("Coil Name =" + VarSpeedCoil(DXCoilNum).Name); + ShowContinueError("Coil Name =" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); ShowContinueError("User-Specified Resistive Defrost Heater Capacity of " + RoundSigDigits(DefrostCapacityUser, 2) + " [W]"); ShowContinueError("differs from Design Size Resistive Defrost Heater Capacity of " + @@ -4987,13 +4806,13 @@ namespace VariableSpeedCoils { // test autosized sensible and total cooling capacity for total > sensible if (RatedCapCoolSensAutoSized && RatedCapCoolTotalAutoSized) { - if (VarSpeedCoil(DXCoilNum).RatedCapCoolSens > VarSpeedCoil(DXCoilNum).RatedCapCoolTotal) { - ShowWarningError("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"" + - VarSpeedCoil(DXCoilNum).Name + "\""); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal) { + ShowWarningError("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"" + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\""); ShowContinueError(RoutineName + ": Rated Sensible Cooling Capacity > Rated Total Cooling Capacity"); ShowContinueError("Each of these capacity inputs have been autosized."); - ShowContinueError("Rated Sensible Cooling Capacity = " + TrimSigDigits(VarSpeedCoil(DXCoilNum).RatedCapCoolSens, 2) + " W"); - ShowContinueError("Rated Total Cooling Capacity = " + TrimSigDigits(VarSpeedCoil(DXCoilNum).RatedCapCoolTotal, 2) + " W"); + ShowContinueError("Rated Sensible Cooling Capacity = " + TrimSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens, 2) + " W"); + ShowContinueError("Rated Total Cooling Capacity = " + TrimSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal, 2) + " W"); ShowContinueError("See eio file for further details."); ShowContinueError("Check Total and Sensible Cooling Capacity Coefficients to ensure they are accurate."); ShowContinueError("Check Zone and System Sizing objects to verify sizing inputs."); @@ -5012,13 +4831,13 @@ namespace VariableSpeedCoils { ShowContinueError("... to ensure they meet the expected manufacturers performance specifications."); } } else if (RatedCapCoolTotalAutoSized) { - if (VarSpeedCoil(DXCoilNum).RatedCapCoolSens > VarSpeedCoil(DXCoilNum).RatedCapCoolTotal) { - ShowWarningError("COIL:" + VarSpeedCoil(DXCoilNum).CoolHeatType + ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"" + - VarSpeedCoil(DXCoilNum).Name + "\""); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal) { + ShowWarningError("COIL:" + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CoolHeatType + ":WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"" + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name + "\""); ShowContinueError(RoutineName + ": Rated Sensible Cooling Capacity > Rated Total Cooling Capacity"); ShowContinueError("Only the rated total capacity input is autosized, consider autosizing both inputs."); - ShowContinueError("Rated Sensible Cooling Capacity = " + TrimSigDigits(VarSpeedCoil(DXCoilNum).RatedCapCoolSens, 2) + " W"); - ShowContinueError("Rated Total Cooling Capacity = " + TrimSigDigits(VarSpeedCoil(DXCoilNum).RatedCapCoolTotal, 2) + " W"); + ShowContinueError("Rated Sensible Cooling Capacity = " + TrimSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens, 2) + " W"); + ShowContinueError("Rated Total Cooling Capacity = " + TrimSigDigits(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal, 2) + " W"); ShowContinueError("See eio file for further details."); ShowContinueError("Check Total and Sensible Cooling Capacity Coefficients to ensure they are accurate."); ShowContinueError("Check Zone and System Sizing objects to verify sizing inputs."); @@ -5162,17 +4981,17 @@ namespace VariableSpeedCoils { Real64 SpecHumOut; // outlet air specific humidity Real64 rhoair(0); // entering air density - if (firstTime) { + if (state.dataVariableSpeedCoils->firstTime) { // Set indoor air conditions to the rated condition LoadSideInletDBTemp_Init = 26.7; LoadSideInletHumRat_Init = 0.0111; LoadSideInletEnth_Init = PsyHFnTdbW(LoadSideInletDBTemp_Init, LoadSideInletHumRat_Init); CpAir_Init = PsyCpAirFnW(LoadSideInletHumRat_Init); - firstTime = false; + state.dataVariableSpeedCoils->firstTime = false; } LoadSideInletWBTemp_Init = PsyTwbFnTdbWPb(LoadSideInletDBTemp_Init, LoadSideInletHumRat_Init, OutBaroPress, RoutineName); - MaxSpeed = VarSpeedCoil(DXCoilNum).NumOfSpeeds; + MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; // must be placed inside the loop, otherwise cause bug in release mode, need to be present at two places if (SpeedNum > MaxSpeed) { @@ -5183,21 +5002,21 @@ namespace VariableSpeedCoils { // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) if (!(CyclingScheme == ContFanCycCoil) && PartLoadRatio > 0.0) { - VarSpeedCoil(DXCoilNum).AirMassFlowRate = Node(VarSpeedCoil(DXCoilNum).AirInletNodeNum).MassFlowRate / PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum).MassFlowRate / PartLoadRatio; } - Twet_Rated = VarSpeedCoil(DXCoilNum).Twet_Rated; - Gamma_Rated = VarSpeedCoil(DXCoilNum).Gamma_Rated; + Twet_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated; + Gamma_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated; - LoadSideMassFlowRate = VarSpeedCoil(DXCoilNum).AirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { // Get condenser outdoor node info from DX COOLING Coil - if (VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { - OutdoorDryBulb = Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp; - OutdoorHumRat = Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat; - OutdoorPressure = Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press; - OutdoorWetBulb = Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { + OutdoorDryBulb = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp; + OutdoorHumRat = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat; + OutdoorPressure = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press; + OutdoorWetBulb = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb; } else { OutdoorDryBulb = OutDryBulbTemp; OutdoorHumRat = OutHumRat; @@ -5208,19 +5027,19 @@ namespace VariableSpeedCoils { RhoSourceAir = PsyRhoAirFnPbTdbW(OutdoorPressure, OutdoorDryBulb, OutdoorHumRat); if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { - CondAirMassFlow = RhoSourceAir * VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal); + CondAirMassFlow = RhoSourceAir * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal); } else { - CondAirMassFlow = RhoSourceAir * (VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal - 1)); + CondAirMassFlow = RhoSourceAir * (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal - 1)); } // AIR COOL OR EVAP COOLED CONDENSER - if (VarSpeedCoil(DXCoilNum).CondenserType == EvapCooled) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType == EvapCooled) { if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { - EvapCondEffectSped = VarSpeedCoil(DXCoilNum).EvapCondEffect(SpeedCal); + EvapCondEffectSped = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(SpeedCal); } else { - EvapCondEffectSped = VarSpeedCoil(DXCoilNum).EvapCondEffect(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).EvapCondEffect(SpeedCal - 1); + EvapCondEffectSped = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondEffect(SpeedCal - 1); } // (Outdoor wet-bulb temp from DataEnvironment) + (1.0-EvapCondEffectiveness) * (drybulb - wetbulb) CondInletTemp = OutdoorWetBulb + (OutdoorDryBulb - OutdoorWetBulb) * (1.0 - EvapCondEffectSped); @@ -5232,53 +5051,53 @@ namespace VariableSpeedCoils { CondInletHumRat = OutHumRat; } - SourceSideMassFlowRate = CondAirMassFlow; - SourceSideInletTemp = CondInletTemp; - SourceSideInletEnth = PsyHFnTdbW(CondInletTemp, CondInletHumRat); + state.dataVariableSpeedCoils->SourceSideMassFlowRate = CondAirMassFlow; + state.dataVariableSpeedCoils->SourceSideInletTemp = CondInletTemp; + state.dataVariableSpeedCoils->SourceSideInletEnth = PsyHFnTdbW(CondInletTemp, CondInletHumRat); CpSource = PsyCpAirFnW(CondInletHumRat); - VarSpeedCoil(DXCoilNum).CondInletTemp = CondInletTemp; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondInletTemp = CondInletTemp; // If used in a heat pump, the value of MaxOAT in the heating coil overrides that in the cooling coil (in GetInput) // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil - if (OutdoorDryBulb < VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (OutdoorDryBulb < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity; } else { CrankcaseHeatingPower = 0.0; } } else { - SourceSideMassFlowRate = VarSpeedCoil(DXCoilNum).WaterMassFlowRate; - SourceSideInletTemp = VarSpeedCoil(DXCoilNum).InletWaterTemp; - SourceSideInletEnth = VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; + state.dataVariableSpeedCoils->SourceSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate; + state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; + state.dataVariableSpeedCoils->SourceSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; CpSource = GetSpecificHeatGlycol(state, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidName, - SourceSideInletTemp, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidName, + state.dataVariableSpeedCoils->SourceSideInletTemp, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, RoutineNameSourceSideInletTemp); } // Check for flows, do not perform simulation if no flow in load side or source side. - if (SourceSideMassFlowRate <= 0.0 || LoadSideMassFlowRate <= 0.0) { + if (state.dataVariableSpeedCoils->SourceSideMassFlowRate <= 0.0 || state.dataVariableSpeedCoils->LoadSideMassFlowRate <= 0.0) { - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) && - (VarSpeedCoil(DXCoilNum).CondenserType == AirCooled) && (LoadSideMassFlowRate > 0.0)) { + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) && + (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType == AirCooled) && (state.dataVariableSpeedCoils->LoadSideMassFlowRate > 0.0)) { // ALLOW SIMULATION IF AIR-COOLED CONDENSER COIL - VarSpeedCoil(DXCoilNum).SimFlag = true; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; } else { - VarSpeedCoil(DXCoilNum).SimFlag = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; return; } } else { - VarSpeedCoil(DXCoilNum).SimFlag = true; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; } if (CompOp == 0) { - VarSpeedCoil(DXCoilNum).SimFlag = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; return; } - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) && - (CondInletTemp < VarSpeedCoil(DXCoilNum).MinOATCompressor)) { - VarSpeedCoil(DXCoilNum).SimFlag = false; + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) && + (CondInletTemp < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MinOATCompressor)) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; return; } @@ -5296,50 +5115,50 @@ namespace VariableSpeedCoils { } // Set indoor air conditions to the actual condition - LoadSideInletDBTemp_Unit = VarSpeedCoil(DXCoilNum).InletAirDBTemp; - LoadSideInletHumRat_Unit = VarSpeedCoil(DXCoilNum).InletAirHumRat; + LoadSideInletDBTemp_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp; + LoadSideInletHumRat_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat; LoadSideInletWBTemp_Unit = PsyTwbFnTdbWPb(LoadSideInletDBTemp_Unit, LoadSideInletHumRat_Unit, OutBaroPress, RoutineName); - LoadSideInletEnth_Unit = VarSpeedCoil(DXCoilNum).InletAirEnthalpy; + LoadSideInletEnth_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy; CpAir_Unit = PsyCpAirFnW(LoadSideInletHumRat_Unit); RuntimeFrac = 1.0; OnOffFanPartLoadFraction = 1.0; - VarSpeedCoil(DXCoilNum).RunFrac = 1.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = CurveValue(state, VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } if (CyclingScheme == CycFanCycCoil) OnOffFanPartLoadFraction = PLF; // save PLF for fan model, don't change fan power for constant fan mode if coil is off // calculate the run time fraction - VarSpeedCoil(DXCoilNum).RunFrac = PartLoadRatio / PLF; - VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = PartLoadRatio / PLF; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - if (VarSpeedCoil(DXCoilNum).RunFrac > 1.0) { - VarSpeedCoil(DXCoilNum).RunFrac = 1.0; // Reset coil runtime fraction to 1.0 - } else if (VarSpeedCoil(DXCoilNum).RunFrac < 0.0) { - VarSpeedCoil(DXCoilNum).RunFrac = 0.0; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac > 1.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac < 0.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 0.0; } - RuntimeFrac = VarSpeedCoil(DXCoilNum).RunFrac; + RuntimeFrac = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; } while (true) { ++NumIteration; if (NumIteration == 1) { // Set indoor air conditions to the rated conditions - LoadSideInletDBTemp = LoadSideInletDBTemp_Init; - LoadSideInletHumRat = LoadSideInletHumRat_Init; - LoadSideInletWBTemp = LoadSideInletWBTemp_Init; - LoadSideInletEnth = LoadSideInletEnth_Init; + state.dataVariableSpeedCoils->LoadSideInletDBTemp = LoadSideInletDBTemp_Init; + state.dataVariableSpeedCoils->LoadSideInletHumRat = LoadSideInletHumRat_Init; + state.dataVariableSpeedCoils->LoadSideInletWBTemp = LoadSideInletWBTemp_Init; + state.dataVariableSpeedCoils->LoadSideInletEnth = LoadSideInletEnth_Init; CpAir = CpAir_Init; } else { // Set indoor air conditions to the actual condition - LoadSideInletDBTemp = LoadSideInletDBTemp_Unit; - LoadSideInletHumRat = LoadSideInletHumRat_Unit; - LoadSideInletWBTemp = LoadSideInletWBTemp_Unit; - LoadSideInletEnth = LoadSideInletEnth_Unit; + state.dataVariableSpeedCoils->LoadSideInletDBTemp = LoadSideInletDBTemp_Unit; + state.dataVariableSpeedCoils->LoadSideInletHumRat = LoadSideInletHumRat_Unit; + state.dataVariableSpeedCoils->LoadSideInletWBTemp = LoadSideInletWBTemp_Unit; + state.dataVariableSpeedCoils->LoadSideInletEnth = LoadSideInletEnth_Unit; CpAir = CpAir_Unit; } @@ -5351,349 +5170,349 @@ namespace VariableSpeedCoils { } if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { - AirMassFlowRatio = LoadSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + AirMassFlowRatio = state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { WaterMassFlowRatio = 1.0; } else { - WaterMassFlowRatio = SourceSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; } CBFSpeed = AdjustCBF( - VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), LoadSideMassFlowRate); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), state.dataVariableSpeedCoils->LoadSideMassFlowRate); if (CBFSpeed > 0.999) CBFSpeed = 0.999; CalcTotCapSHR_VSWSHP(state, - LoadSideInletDBTemp, - LoadSideInletHumRat, - LoadSideInletEnth, - LoadSideInletWBTemp, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + state.dataVariableSpeedCoils->LoadSideInletEnth, + state.dataVariableSpeedCoils->LoadSideInletWBTemp, AirMassFlowRatio, WaterMassFlowRatio, - LoadSideMassFlowRate, + state.dataVariableSpeedCoils->LoadSideMassFlowRate, CBFSpeed, - VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal), - VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), - VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), 0.0, 0, 0, 0, QLoadTotal1, QLoadTotal2, - QLoadTotal, + state.dataVariableSpeedCoils->QLoadTotal, SHR, - SourceSideInletTemp, - VarSpeedCoil(DXCoilNum).InletAirPressure, + state.dataVariableSpeedCoils->SourceSideInletTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, 0.0, 1, - VarSpeedCoil(DXCoilNum).capModFacTotal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); - EIRTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), LoadSideInletWBTemp, SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { - EIRWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + EIRWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; + EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; CBFSpeed = AdjustCBF( - VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), LoadSideMassFlowRate); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), state.dataVariableSpeedCoils->LoadSideMassFlowRate); if (CBFSpeed > 0.999) CBFSpeed = 0.999; CalcTotCapSHR_VSWSHP(state, - LoadSideInletDBTemp, - LoadSideInletHumRat, - LoadSideInletEnth, - LoadSideInletWBTemp, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + state.dataVariableSpeedCoils->LoadSideInletEnth, + state.dataVariableSpeedCoils->LoadSideInletWBTemp, AirMassFlowRatio, WaterMassFlowRatio, - LoadSideMassFlowRate, + state.dataVariableSpeedCoils->LoadSideMassFlowRate, CBFSpeed, - VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal), - VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), - VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), 0.0, 0, 0, 0, QLoadTotal1, QLoadTotal2, - QLoadTotal, + state.dataVariableSpeedCoils->QLoadTotal, SHR, - SourceSideInletTemp, - VarSpeedCoil(DXCoilNum).InletAirPressure, + state.dataVariableSpeedCoils->SourceSideInletTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, 0.0, 1, - VarSpeedCoil(DXCoilNum).capModFacTotal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); - Winput = QLoadTotal * EIR; + state.dataVariableSpeedCoils->Winput = state.dataVariableSpeedCoils->QLoadTotal * EIR; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { QWasteHeat = 0.0; } else { - QWasteHeat = Winput * VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat *= CurveValue(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), LoadSideInletWBTemp, SourceSideInletTemp); + QWasteHeat = state.dataVariableSpeedCoils->Winput * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat *= CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } } else { - AirMassFlowRatio = LoadSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + AirMassFlowRatio = state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { WaterMassFlowRatio = 1.0; } else { - WaterMassFlowRatio = SourceSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; } - AoEff = VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal - 1); + AoEff = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal - 1); - CBFSpeed = std::exp(-AoEff / LoadSideMassFlowRate); + CBFSpeed = std::exp(-AoEff / state.dataVariableSpeedCoils->LoadSideMassFlowRate); if (CBFSpeed > 0.999) CBFSpeed = 0.999; CalcTotCapSHR_VSWSHP(state, - LoadSideInletDBTemp, - LoadSideInletHumRat, - LoadSideInletEnth, - LoadSideInletWBTemp, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + state.dataVariableSpeedCoils->LoadSideInletEnth, + state.dataVariableSpeedCoils->LoadSideInletWBTemp, AirMassFlowRatio, WaterMassFlowRatio, - LoadSideMassFlowRate, + state.dataVariableSpeedCoils->LoadSideMassFlowRate, CBFSpeed, - VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal - 1), - VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal - 1), - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal - 1), - VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal - 1), - VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal), - VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), - VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal - 1), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal - 1), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal - 1), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal - 1), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), QLoadTotal1, QLoadTotal2, - QLoadTotal, + state.dataVariableSpeedCoils->QLoadTotal, SHR, - SourceSideInletTemp, - VarSpeedCoil(DXCoilNum).InletAirPressure, + state.dataVariableSpeedCoils->SourceSideInletTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, SpeedRatio, 2, - VarSpeedCoil(DXCoilNum).capModFacTotal); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); SpeedCal = SpeedNum - 1; - EIRTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), LoadSideInletWBTemp, SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { - EIRWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + EIRWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; + EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; Winput1 = QLoadTotal1 * EIR; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { QWasteHeat1 = 0.0; } else { - QWasteHeat1 = Winput1 * VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat1 *= CurveValue(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), LoadSideInletWBTemp, SourceSideInletTemp); + QWasteHeat1 = Winput1 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat1 *= CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } SpeedCal = SpeedNum; - EIRTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), LoadSideInletWBTemp, SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { - EIRWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + EIRWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; + EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; Winput2 = QLoadTotal2 * EIR; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { QWasteHeat2 = 0.0; } else { - QWasteHeat2 = Winput2 * VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat2 *= CurveValue(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), LoadSideInletWBTemp, SourceSideInletTemp); + QWasteHeat2 = Winput2 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat2 *= CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletWBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } - Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; + state.dataVariableSpeedCoils->Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; QWasteHeat = QWasteHeat2 * SpeedRatio + (1.0 - SpeedRatio) * QWasteHeat1; } - QSensible = QLoadTotal * SHR; + state.dataVariableSpeedCoils->QSensible = state.dataVariableSpeedCoils->QLoadTotal * SHR; - QSource = QLoadTotal + Winput - QWasteHeat; + state.dataVariableSpeedCoils->QSource = state.dataVariableSpeedCoils->QLoadTotal + state.dataVariableSpeedCoils->Winput - QWasteHeat; - if (QSource < 0) { - QSource = 0.0; - QWasteHeat = QLoadTotal + Winput; + if (state.dataVariableSpeedCoils->QSource < 0) { + state.dataVariableSpeedCoils->QSource = 0.0; + QWasteHeat = state.dataVariableSpeedCoils->QLoadTotal + state.dataVariableSpeedCoils->Winput; } // Check if the Sensible Load is greater than the Total Cooling Load - if (QSensible > QLoadTotal) { - QSensible = QLoadTotal; + if (state.dataVariableSpeedCoils->QSensible > state.dataVariableSpeedCoils->QLoadTotal) { + state.dataVariableSpeedCoils->QSensible = state.dataVariableSpeedCoils->QLoadTotal; } if (LatDegradModelSimFlag) { // Calculate for SHReff using the Latent Degradation Model if (NumIteration == 1) { - QLatRated = QLoadTotal - QSensible; + state.dataVariableSpeedCoils->QLatRated = state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible; } else if (NumIteration == 2) { - QLatActual = QLoadTotal - QSensible; - SHRss = QSensible / QLoadTotal; - SHReff = CalcEffectiveSHR( - DXCoilNum, SHRss, CyclingScheme, RuntimeFrac, QLatRated, QLatActual, LoadSideInletDBTemp, LoadSideInletWBTemp); + state.dataVariableSpeedCoils->QLatActual = state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible; + SHRss = state.dataVariableSpeedCoils->QSensible / state.dataVariableSpeedCoils->QLoadTotal; + SHReff = CalcEffectiveSHR(state, + DXCoilNum, SHRss, CyclingScheme, RuntimeFrac, state.dataVariableSpeedCoils->QLatRated, state.dataVariableSpeedCoils->QLatActual, state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->LoadSideInletWBTemp); // Update sensible capacity based on effective SHR - QSensible = QLoadTotal * SHReff; + state.dataVariableSpeedCoils->QSensible = state.dataVariableSpeedCoils->QLoadTotal * SHReff; goto LOOP_exit; } } else { // Assume SHReff=SHRss - SHReff = QSensible / QLoadTotal; + SHReff = state.dataVariableSpeedCoils->QSensible / state.dataVariableSpeedCoils->QLoadTotal; goto LOOP_exit; } } LOOP_exit:; // considering hot gas reheat here - if (VarSpeedCoil(DXCoilNum).HOTGASREHEATFLG > 0) { - QLoadTotal -= QWasteHeat; - QSensible -= QWasteHeat; - SHReff = QSensible / QLoadTotal; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HOTGASREHEATFLG > 0) { + state.dataVariableSpeedCoils->QLoadTotal -= QWasteHeat; + state.dataVariableSpeedCoils->QSensible -= QWasteHeat; + SHReff = state.dataVariableSpeedCoils->QSensible / state.dataVariableSpeedCoils->QLoadTotal; } - VarSpeedCoil(DXCoilNum).BasinHeaterPower = 0.0; - VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { - if (VarSpeedCoil(DXCoilNum).CondenserType == EvapCooled) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType == EvapCooled) { //****************** // WATER CONSUMPTION IN m3 OF WATER FOR DIRECT // H2O [m3/s] = Delta W[kgWater/kgDryAir]*Mass Flow Air[kgDryAir/s] // /RhoWater [kgWater/m3] //****************** RhoEvapCondWater = RhoH2O(OutdoorDryBulb); - VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate = (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoEvapCondWater * RuntimeFrac; - VarSpeedCoil(DXCoilNum).EvapCondPumpElecPower = VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower * RuntimeFrac; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate = (CondInletHumRat - OutdoorHumRat) * CondAirMassFlow / RhoEvapCondWater * RuntimeFrac; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecNomPower * RuntimeFrac; // Calculate basin heater power - CalcBasinHeaterPower(VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr, - VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp, - VarSpeedCoil(DXCoilNum).BasinHeaterPower); - VarSpeedCoil(DXCoilNum).BasinHeaterPower *= (1.0 - RuntimeFrac); + CalcBasinHeaterPower(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower *= (1.0 - RuntimeFrac); } - VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - RuntimeFrac); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - RuntimeFrac); // set water system demand request (if needed) - if (VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - WaterStorage(VarSpeedCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID) = - VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode == state.dataVariableSpeedCoils->WaterSupplyFromTank) { + WaterStorage(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate; } } // calculate coil outlet state variables - LoadSideOutletEnth = LoadSideInletEnth - QLoadTotal / LoadSideMassFlowRate; - LoadSideOutletDBTemp = LoadSideInletDBTemp - QSensible / (LoadSideMassFlowRate * CpAir); + state.dataVariableSpeedCoils->LoadSideOutletEnth = state.dataVariableSpeedCoils->LoadSideInletEnth - state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->LoadSideMassFlowRate; + state.dataVariableSpeedCoils->LoadSideOutletDBTemp = state.dataVariableSpeedCoils->LoadSideInletDBTemp - state.dataVariableSpeedCoils->QSensible / (state.dataVariableSpeedCoils->LoadSideMassFlowRate * CpAir); - MaxHumRat = PsyWFnTdbRhPb(LoadSideOutletDBTemp, 0.9999, VarSpeedCoil(DXCoilNum).InletAirPressure, RoutineName); - MaxOutletEnth = PsyHFnTdbW(LoadSideOutletDBTemp, MaxHumRat); - if (LoadSideOutletEnth > MaxOutletEnth) { - LoadSideOutletEnth = MaxOutletEnth; - // QLoadTotal = LoadSideMassFlowRate * (LoadSideInletEnth - LoadSideOutletEnth) + MaxHumRat = PsyWFnTdbRhPb(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, 0.9999, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, RoutineName); + MaxOutletEnth = PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); + if (state.dataVariableSpeedCoils->LoadSideOutletEnth > MaxOutletEnth) { + state.dataVariableSpeedCoils->LoadSideOutletEnth = MaxOutletEnth; + // QLoadTotal = state.dataVariableSpeedCoils->LoadSideMassFlowRate * (LoadSideInletEnth - LoadSideOutletEnth) } - LoadSideOutletHumRat = PsyWFnTdbH(LoadSideOutletDBTemp, LoadSideOutletEnth, RoutineName); - if (LoadSideOutletHumRat > MaxHumRat) { - LoadSideOutletHumRat = MaxHumRat; + state.dataVariableSpeedCoils->LoadSideOutletHumRat = PsyWFnTdbH(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); + if (state.dataVariableSpeedCoils->LoadSideOutletHumRat > MaxHumRat) { + state.dataVariableSpeedCoils->LoadSideOutletHumRat = MaxHumRat; } ++Count; // Actual outlet conditions are "average" for time step if (CyclingScheme == ContFanCycCoil) { // continuous fan, cycling compressor - VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = PartLoadRatio * LoadSideOutletEnth + (1.0 - PartLoadRatio) * LoadSideInletEnth; - VarSpeedCoil(DXCoilNum).OutletAirHumRat = PartLoadRatio * LoadSideOutletHumRat + (1.0 - PartLoadRatio) * LoadSideInletHumRat; - VarSpeedCoil(DXCoilNum).OutletAirDBTemp = PsyTdbFnHW(VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, VarSpeedCoil(DXCoilNum).OutletAirHumRat); - PLRCorrLoadSideMdot = LoadSideMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletEnth + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletEnth; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { // default to cycling fan, cycling compressor - VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = LoadSideOutletEnth; - VarSpeedCoil(DXCoilNum).OutletAirHumRat = LoadSideOutletHumRat; - VarSpeedCoil(DXCoilNum).OutletAirDBTemp = LoadSideOutletDBTemp; - PLRCorrLoadSideMdot = LoadSideMassFlowRate * PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = state.dataVariableSpeedCoils->LoadSideOutletHumRat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = state.dataVariableSpeedCoils->LoadSideOutletDBTemp; + state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate * PartLoadRatio; } // scale heat transfer rates to PLR and power to RTF - QLoadTotal *= PartLoadRatio; - QSensible *= PartLoadRatio; + state.dataVariableSpeedCoils->QLoadTotal *= PartLoadRatio; + state.dataVariableSpeedCoils->QSensible *= PartLoadRatio; // count the powr separately - Winput *= RuntimeFrac; //+ VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower & - //+ VarSpeedCoil(DXCoilNum)%BasinHeaterPower + VarSpeedCoil(DXCoilNum)%EvapCondPumpElecPower - QSource *= PartLoadRatio; + state.dataVariableSpeedCoils->Winput *= RuntimeFrac; //+ state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower & + //+ state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%BasinHeaterPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%EvapCondPumpElecPower + state.dataVariableSpeedCoils->QSource *= PartLoadRatio; QWasteHeat *= PartLoadRatio; // Add power to global variable so power can be summed by parent object - DXElecCoolingPower = Winput; + DXElecCoolingPower = state.dataVariableSpeedCoils->Winput; ReportingConstant = TimeStepSys * SecInHour; // Update heat pump data structure - VarSpeedCoil(DXCoilNum).Power = Winput; - VarSpeedCoil(DXCoilNum).QLoadTotal = QLoadTotal; - VarSpeedCoil(DXCoilNum).QSensible = QSensible; - VarSpeedCoil(DXCoilNum).QLatent = QLoadTotal - QSensible; - VarSpeedCoil(DXCoilNum).QSource = QSource; - VarSpeedCoil(DXCoilNum).Energy = Winput * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergyLoadTotal = QLoadTotal * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergySensible = QSensible * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergyLatent = (QLoadTotal - QSensible) * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergySource = QSource * ReportingConstant; - VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; - VarSpeedCoil(DXCoilNum).EvapWaterConsump = VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate * ReportingConstant; - VarSpeedCoil(DXCoilNum).BasinHeaterConsumption = VarSpeedCoil(DXCoilNum).BasinHeaterPower * ReportingConstant; - VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption = VarSpeedCoil(DXCoilNum).EvapCondPumpElecPower * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = state.dataVariableSpeedCoils->Winput; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = state.dataVariableSpeedCoils->QSensible; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = state.dataVariableSpeedCoils->QSource; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = state.dataVariableSpeedCoils->Winput * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = state.dataVariableSpeedCoils->QSensible * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = ( state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible) * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = state.dataVariableSpeedCoils->QSource * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterConsumption = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecPower * ReportingConstant; if (RuntimeFrac == 0.0) { - VarSpeedCoil(DXCoilNum).COP = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; } else { - VarSpeedCoil(DXCoilNum).COP = QLoadTotal / Winput; - } - VarSpeedCoil(DXCoilNum).RunFrac = RuntimeFrac; - VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - VarSpeedCoil(DXCoilNum).AirMassFlowRate = PLRCorrLoadSideMdot; - rhoair = PsyRhoAirFnPbTdbW(OutBaroPress, LoadSideInletDBTemp, LoadSideInletHumRat, RoutineName); - VarSpeedCoil(DXCoilNum).AirVolFlowRate = VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; - - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; - VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; - VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; - DataHeatBalance::HeatReclaimVS_DXCoil(DXCoilNum).AvailCapacity = QSource; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->Winput; + } + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = RuntimeFrac; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; + rhoair = PsyRhoAirFnPbTdbW(OutBaroPress, state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->LoadSideInletHumRat, RoutineName); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; + + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; + DataHeatBalance::HeatReclaimVS_DXCoil(DXCoilNum).AvailCapacity = state.dataVariableSpeedCoils->QSource; } else { - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = SourceSideMassFlowRate; - VarSpeedCoil(DXCoilNum).OutletWaterTemp = SourceSideInletTemp + QSource / (SourceSideMassFlowRate * CpSource); - VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = SourceSideInletEnth + QSource / SourceSideMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = state.dataVariableSpeedCoils->SourceSideInletTemp + state.dataVariableSpeedCoils->QSource / (state.dataVariableSpeedCoils->SourceSideMassFlowRate * CpSource); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = state.dataVariableSpeedCoils->SourceSideInletEnth + state.dataVariableSpeedCoils->QSource / state.dataVariableSpeedCoils->SourceSideMassFlowRate; } - VarSpeedCoil(DXCoilNum).QWasteHeat = QWasteHeat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = QWasteHeat; - if (VarSpeedCoil(DXCoilNum).CondensateCollectMode == CondensateToTank) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode == state.dataVariableSpeedCoils->CondensateToTank) { // calculate and report condensation rates (how much water extracted from the air stream) // water flow of water in m3/s for water system interactions - RhoWater = RhoH2O((VarSpeedCoil(DXCoilNum).InletAirDBTemp + VarSpeedCoil(DXCoilNum).OutletAirDBTemp) / 2.0); + RhoWater = RhoH2O((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp) / 2.0); // CR9155 Remove specific humidity calculations - SpecHumIn = LoadSideInletHumRat; - SpecHumOut = LoadSideOutletHumRat; + SpecHumIn = state.dataVariableSpeedCoils->LoadSideInletHumRat; + SpecHumOut = state.dataVariableSpeedCoils->LoadSideOutletHumRat; // mdot * del HumRat / rho water - VarSpeedCoil(DXCoilNum).CondensateVdot = max(0.0, (LoadSideMassFlowRate * (SpecHumIn - SpecHumOut) / RhoWater)); - VarSpeedCoil(DXCoilNum).CondensateVol = VarSpeedCoil(DXCoilNum).CondensateVdot * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVdot = max(0.0, (state.dataVariableSpeedCoils->LoadSideMassFlowRate * (SpecHumIn - SpecHumOut) / RhoWater)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVol = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateVdot * ReportingConstant; } } @@ -5799,15 +5618,15 @@ namespace VariableSpeedCoils { // note: load side is the evaporator side, and source side is the condenser side - CondInletNode = VarSpeedCoil(DXCoilNum).WaterInletNodeNum; - CondOutletNode = VarSpeedCoil(DXCoilNum).WaterOutletNodeNum; + CondInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; + CondOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum; // If heat pump water heater is OFF, set outlet to inlet and RETURN if (PartLoadRatio == 0.0) { Node(CondOutletNode) = Node(CondInletNode); return; } else { - EvapInletNode = VarSpeedCoil(DXCoilNum).AirInletNodeNum; - EvapOutletNode = VarSpeedCoil(DXCoilNum).AirOutletNodeNum; + EvapInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; + EvapOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum; InletWaterTemp = Node(CondInletNode).Temp; CondInletMassFlowRate = Node(CondInletNode).MassFlowRate; EvapInletMassFlowRate = Node(EvapInletNode).MassFlowRate; @@ -5823,11 +5642,11 @@ namespace VariableSpeedCoils { EvapInletMassFlowRate = EvapInletMassFlowRate / PartLoadRatio; } - VarSpeedCoil(DXCoilNum).AirMassFlowRate = EvapInletMassFlowRate; - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = CondInletMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = EvapInletMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = CondInletMassFlowRate; // determine inlet air temperature type for curve objects - if (VarSpeedCoil(DXCoilNum).InletAirTemperatureType == WetBulbIndicator) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirTemperatureType == WetBulbIndicator) { InletAirTemp = HPWHInletWBTemp; } else { InletAirTemp = HPWHInletDBTemp; @@ -5836,42 +5655,42 @@ namespace VariableSpeedCoils { // check if indoor evaporator or outdoor evaporator CrankcaseHeatingPower = 0.0; if (EvapInletNode != 0) { - LoadSideInletDBTemp = Node(EvapInletNode).Temp; - LoadSideInletHumRat = Node(EvapInletNode).HumRat; + state.dataVariableSpeedCoils->LoadSideInletDBTemp = Node(EvapInletNode).Temp; + state.dataVariableSpeedCoils->LoadSideInletHumRat = Node(EvapInletNode).HumRat; LoadPressure = Node(EvapInletNode).Press; // prevent the air pressure not given if (LoadPressure < 10.0) LoadPressure = OutBaroPress; - LoadSideInletWBTemp = Node(EvapInletNode).OutAirWetBulb; - LoadSideInletEnth = Node(EvapInletNode).Enthalpy; + state.dataVariableSpeedCoils->LoadSideInletWBTemp = Node(EvapInletNode).OutAirWetBulb; + state.dataVariableSpeedCoils->LoadSideInletEnth = Node(EvapInletNode).Enthalpy; } else { - LoadSideInletDBTemp = OutDryBulbTemp; - LoadSideInletHumRat = OutHumRat; + state.dataVariableSpeedCoils->LoadSideInletDBTemp = OutDryBulbTemp; + state.dataVariableSpeedCoils->LoadSideInletHumRat = OutHumRat; LoadPressure = OutBaroPress; - LoadSideInletWBTemp = OutWetBulbTemp; - LoadSideInletEnth = OutEnthalpy; + state.dataVariableSpeedCoils->LoadSideInletWBTemp = OutWetBulbTemp; + state.dataVariableSpeedCoils->LoadSideInletEnth = OutEnthalpy; // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil - if (OutDryBulbTemp < VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (OutDryBulbTemp < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity; }; } - LoadSideMassFlowRate = EvapInletMassFlowRate; - SourceSideMassFlowRate = CondInletMassFlowRate; - SourceSideInletTemp = InletWaterTemp; - SourceSideInletEnth = Node(CondInletNode).Enthalpy; - VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = SourceSideInletEnth; + state.dataVariableSpeedCoils->LoadSideMassFlowRate = EvapInletMassFlowRate; + state.dataVariableSpeedCoils->SourceSideMassFlowRate = CondInletMassFlowRate; + state.dataVariableSpeedCoils->SourceSideInletTemp = InletWaterTemp; + state.dataVariableSpeedCoils->SourceSideInletEnth = Node(CondInletNode).Enthalpy; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataVariableSpeedCoils->SourceSideInletEnth; // Check for flows, do not perform simulation if no flow in load side or source side. - if ((SourceSideMassFlowRate <= 0.0) || (LoadSideMassFlowRate <= 0.0)) { - VarSpeedCoil(DXCoilNum).SimFlag = false; + if ((state.dataVariableSpeedCoils->SourceSideMassFlowRate <= 0.0) || (state.dataVariableSpeedCoils->LoadSideMassFlowRate <= 0.0)) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; return; } else { - VarSpeedCoil(DXCoilNum).SimFlag = true; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; } - MaxSpeed = VarSpeedCoil(DXCoilNum).NumOfSpeeds; + MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; // must be placed inside the loop, otherwise cause bug in release mode, need to be present at two places if (SpeedNum > MaxSpeed) { @@ -5883,25 +5702,25 @@ namespace VariableSpeedCoils { // part-load calculation RuntimeFrac = 1.0; OnOffFanPartLoadFraction = 1.0; - VarSpeedCoil(DXCoilNum).RunFrac = 1.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = CurveValue(state, VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } if (CyclingScheme == CycFanCycCoil) OnOffFanPartLoadFraction = PLF; // save PLF for fan model, don't change fan power for constant fan mode if coil is off // calculate the run time fraction - VarSpeedCoil(DXCoilNum).RunFrac = PartLoadRatio / PLF; - VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = PartLoadRatio / PLF; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - if (VarSpeedCoil(DXCoilNum).RunFrac > 1.0) { - VarSpeedCoil(DXCoilNum).RunFrac = 1.0; // Reset coil runtime fraction to 1.0 - } else if (VarSpeedCoil(DXCoilNum).RunFrac < 0.0) { - VarSpeedCoil(DXCoilNum).RunFrac = 0.0; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac > 1.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac < 0.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 0.0; } - RuntimeFrac = VarSpeedCoil(DXCoilNum).RunFrac; + RuntimeFrac = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; } // interpolate between speeds @@ -5913,44 +5732,44 @@ namespace VariableSpeedCoils { } Real64 locFanElecPower = 0.0; // local for fan electric power - if (VarSpeedCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { - if (VarSpeedCoil(DXCoilNum).SupplyFanIndex > -1) { - locFanElecPower = HVACFan::fanObjs[VarSpeedCoil(DXCoilNum).SupplyFanIndex]->fanPower(); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex > -1) { + locFanElecPower = HVACFan::fanObjs[ state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex]->fanPower(); } } else { - if (VarSpeedCoil(DXCoilNum).SupplyFanIndex > 0) { - locFanElecPower = Fans::GetFanPower(VarSpeedCoil(DXCoilNum).SupplyFanIndex); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex > 0) { + locFanElecPower = Fans::GetFanPower(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SupplyFanIndex); } } if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { - AirMassFlowRatio = LoadSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; - WaterMassFlowRatio = SourceSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); + AirMassFlowRatio = state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); - COPTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), InletAirTemp, SourceSideInletTemp); - COPAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - COPWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + COPTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + COPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + COPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); - COP = VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; + COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; - TOTCAPTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), InletAirTemp, SourceSideInletTemp); + TOTCAPTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TOTCAPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + TOTCAPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); - OperatingHeatingCapacity = VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; + OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; - Winput = OperatingHeatingCapacity / COP; - OperatingHeatingPower = Winput; + state.dataVariableSpeedCoils->Winput = OperatingHeatingCapacity / COP; + OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; OperatingHeatingCOP = COP; - PumpHeatToWater = VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; + PumpHeatToWater = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; TankHeatingCOP = OperatingHeatingCOP; // account for pump heat if not included in total water heating capacity - if (VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { TotalTankHeatingCapacity = OperatingHeatingCapacity; } else { TotalTankHeatingCapacity = OperatingHeatingCapacity + PumpHeatToWater; @@ -5958,107 +5777,107 @@ namespace VariableSpeedCoils { HPRTF = RuntimeFrac; // calculate evaporator total cooling capacity - if (VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP) { - if (VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { // make sure fan power is full load fan power, it isn't though, - CompressorPower = OperatingHeatingPower - locFanElecPower / HPRTF - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; + CompressorPower = OperatingHeatingPower - locFanElecPower / HPRTF - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; if (OperatingHeatingPower > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / OperatingHeatingPower; } else { CompressorPower = OperatingHeatingPower - locFanElecPower / HPRTF; - if ((OperatingHeatingPower + VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) - TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); + if ((OperatingHeatingPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) + TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); } } else { - if (VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { // make sure fan power is full load fan power - CompressorPower = OperatingHeatingPower - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; + CompressorPower = OperatingHeatingPower - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; if ((OperatingHeatingPower + locFanElecPower / HPRTF) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + locFanElecPower / HPRTF); } else { CompressorPower = OperatingHeatingPower; - if ((OperatingHeatingPower + locFanElecPower / HPRTF + VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) + if ((OperatingHeatingPower + locFanElecPower / HPRTF + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / - (OperatingHeatingPower + locFanElecPower / HPRTF + VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); + (OperatingHeatingPower + locFanElecPower / HPRTF + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); } } - if (VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { EvapCoolingCapacity = TotalTankHeatingCapacity - PumpHeatToWater - CompressorPower; } else { EvapCoolingCapacity = TotalTankHeatingCapacity - CompressorPower; } CBFSpeed = AdjustCBF( - VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), LoadSideMassFlowRate); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), state.dataVariableSpeedCoils->LoadSideMassFlowRate); } else { - AirMassFlowRatio = LoadSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; - WaterMassFlowRatio = SourceSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; - AoEff = VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal - 1); - CBFSpeed = std::exp(-AoEff / LoadSideMassFlowRate); + AirMassFlowRatio = state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + AoEff = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEffectiveAo(SpeedCal - 1); + CBFSpeed = std::exp(-AoEff / state.dataVariableSpeedCoils->LoadSideMassFlowRate); // calculate low speed SpeedCal = SpeedNum - 1; - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); - COPTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), InletAirTemp, SourceSideInletTemp); - COPAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - COPWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); + COPTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + COPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + COPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); - COP = VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; + COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; - TOTCAPTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), InletAirTemp, SourceSideInletTemp); + TOTCAPTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TOTCAPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + TOTCAPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); - OperatingHeatingCapacity = VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; + OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; - Winput = OperatingHeatingCapacity / COP; - OperatingHeatingPower = Winput; - Winput1 = Winput; + state.dataVariableSpeedCoils->Winput = OperatingHeatingCapacity / COP; + OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; + Winput1 = state.dataVariableSpeedCoils->Winput; WHCAP1 = OperatingHeatingCapacity; // calculate upper speed SpeedCal = SpeedNum; - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); - COPTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), InletAirTemp, SourceSideInletTemp); - COPAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - COPWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); + COPTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + COPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + COPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); - COP = VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; + COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; - TOTCAPTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), InletAirTemp, SourceSideInletTemp); + TOTCAPTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), InletAirTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TOTCAPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + TOTCAPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); - OperatingHeatingCapacity = VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; + OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; - Winput = OperatingHeatingCapacity / COP; - OperatingHeatingPower = Winput; + state.dataVariableSpeedCoils->Winput = OperatingHeatingCapacity / COP; + OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; - Winput2 = Winput; + Winput2 = state.dataVariableSpeedCoils->Winput; WHCAP2 = OperatingHeatingCapacity; // interpolation - Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; - OperatingHeatingPower = Winput; + state.dataVariableSpeedCoils->Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; + OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; OperatingHeatingCapacity = WHCAP2 * SpeedRatio + (1.0 - SpeedRatio) * WHCAP1; - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedNum) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedNum - 1); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedNum) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedNum - 1); OperatingHeatingCOP = OperatingHeatingCapacity / OperatingHeatingPower; TankHeatingCOP = OperatingHeatingCOP; - PumpHeatToWater = VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; + PumpHeatToWater = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpFracToWater; // account for pump heat if not included in total water heating capacity - if (VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { TotalTankHeatingCapacity = OperatingHeatingCapacity; } else { TotalTankHeatingCapacity = OperatingHeatingCapacity + PumpHeatToWater; @@ -6066,39 +5885,39 @@ namespace VariableSpeedCoils { HPRTF = RuntimeFrac; // calculate evaporator total cooling capacity - if (VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP) { - if (VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanPowerIncludedInCOP) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { // make sure fan power is full load fan power - CompressorPower = OperatingHeatingPower - locFanElecPower / HPRTF - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; + CompressorPower = OperatingHeatingPower - locFanElecPower / HPRTF - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; if (OperatingHeatingPower > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / OperatingHeatingPower; } else { CompressorPower = OperatingHeatingPower - locFanElecPower / HPRTF; - if ((OperatingHeatingPower + VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) - TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); + if ((OperatingHeatingPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) + TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); } } else { - if (VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpPowerInCOP) { // make sure fan power is full load fan power - CompressorPower = OperatingHeatingPower - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; + CompressorPower = OperatingHeatingPower - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower; if ((OperatingHeatingPower + locFanElecPower / HPRTF) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / (OperatingHeatingPower + locFanElecPower / HPRTF); } else { CompressorPower = OperatingHeatingPower; - if ((OperatingHeatingPower + locFanElecPower / HPRTF + VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) + if ((OperatingHeatingPower + locFanElecPower / HPRTF + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) > 0.0) TankHeatingCOP = TotalTankHeatingCapacity / - (OperatingHeatingPower + locFanElecPower / HPRTF + VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); + (OperatingHeatingPower + locFanElecPower / HPRTF + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower); } } - if (VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondPumpHeatInCapacity) { EvapCoolingCapacity = TotalTankHeatingCapacity - PumpHeatToWater - CompressorPower; } else { EvapCoolingCapacity = TotalTankHeatingCapacity - CompressorPower; } } - QSource = TotalTankHeatingCapacity; - QLoadTotal = EvapCoolingCapacity; + state.dataVariableSpeedCoils->QSource = TotalTankHeatingCapacity; + state.dataVariableSpeedCoils->QLoadTotal = EvapCoolingCapacity; DXCoilTotalCapacity = EvapCoolingCapacity; // for standard rating calculation SHR = 1.0; // if indoor, calculate SHR @@ -6108,20 +5927,20 @@ namespace VariableSpeedCoils { if (CBFSpeed < 0.001) { SHR = 1.0; } else { - hDelta = QLoadTotal / LoadSideMassFlowRate; - hADP = LoadSideInletEnth - hDelta / (1.0 - CBFSpeed); + hDelta = state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->LoadSideMassFlowRate; + hADP = state.dataVariableSpeedCoils->LoadSideInletEnth - hDelta / (1.0 - CBFSpeed); tADP = PsyTsatFnHPb(hADP, LoadPressure, RoutineName); wADP = PsyWFnTdbH(tADP, hADP, RoutineName); - hTinwADP = PsyHFnTdbW(LoadSideInletDBTemp, wADP); - if ((LoadSideInletEnth - hADP) > 1.e-10) { - SHR = min((hTinwADP - hADP) / (LoadSideInletEnth - hADP), 1.0); + hTinwADP = PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideInletDBTemp, wADP); + if (( state.dataVariableSpeedCoils->LoadSideInletEnth - hADP) > 1.e-10) { + SHR = min((hTinwADP - hADP) / ( state.dataVariableSpeedCoils->LoadSideInletEnth - hADP), 1.0); } else { SHR = 1.0; } } } - QSensible = QLoadTotal * SHR; + state.dataVariableSpeedCoils->QSensible = state.dataVariableSpeedCoils->QLoadTotal * SHR; // determine condenser water inlet/outlet condition at full capacity if (CondInletMassFlowRate == 0.0) { @@ -6136,124 +5955,124 @@ namespace VariableSpeedCoils { // send heating capacity and COP to water heater module for standards rating calculation // total heating capacity including condenser pump - VSHPWHHeatingCapacity = TotalTankHeatingCapacity; + state.dataVariableSpeedCoils->VSHPWHHeatingCapacity = TotalTankHeatingCapacity; // total heating COP including compressor, fan, and condenser pump - VSHPWHHeatingCOP = TankHeatingCOP; + state.dataVariableSpeedCoils->VSHPWHHeatingCOP = TankHeatingCOP; - VarSpeedCoil(DXCoilNum).TotalHeatingEnergyRate = TotalTankHeatingCapacity * PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).TotalHeatingEnergyRate = TotalTankHeatingCapacity * PartLoadRatio; // calculate total compressor plus condenser pump power, fan power reported in fan module - VarSpeedCoil(DXCoilNum).ElecWaterHeatingPower = (CompressorPower + VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) * HPRTF; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).ElecWaterHeatingPower = (CompressorPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower) * HPRTF; // pass the outputs for the cooling coil section - VarSpeedCoil(DXCoilNum).BasinHeaterPower = 0.0; - VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - RuntimeFrac); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - RuntimeFrac); // calculate coil outlet state variables - LoadSideOutletEnth = LoadSideInletEnth - QLoadTotal / LoadSideMassFlowRate; - CpAir = PsyCpAirFnW(LoadSideInletHumRat); - LoadSideOutletDBTemp = LoadSideInletDBTemp - QSensible / (LoadSideMassFlowRate * CpAir); + state.dataVariableSpeedCoils->LoadSideOutletEnth = state.dataVariableSpeedCoils->LoadSideInletEnth - state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->LoadSideMassFlowRate; + CpAir = PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); + state.dataVariableSpeedCoils->LoadSideOutletDBTemp = state.dataVariableSpeedCoils->LoadSideInletDBTemp - state.dataVariableSpeedCoils->QSensible / (state.dataVariableSpeedCoils->LoadSideMassFlowRate * CpAir); - MaxHumRat = PsyWFnTdbRhPb(LoadSideOutletDBTemp, 0.9999, VarSpeedCoil(DXCoilNum).InletAirPressure, RoutineName); - MaxOutletEnth = PsyHFnTdbW(LoadSideOutletDBTemp, MaxHumRat); - if (LoadSideOutletEnth > MaxOutletEnth) { - LoadSideOutletEnth = MaxOutletEnth; + MaxHumRat = PsyWFnTdbRhPb( state.dataVariableSpeedCoils->LoadSideOutletDBTemp, 0.9999, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, RoutineName); + MaxOutletEnth = PsyHFnTdbW( state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); + if ( state.dataVariableSpeedCoils->LoadSideOutletEnth > MaxOutletEnth) { + state.dataVariableSpeedCoils->LoadSideOutletEnth = MaxOutletEnth; } - LoadSideOutletHumRat = PsyWFnTdbH(LoadSideOutletDBTemp, LoadSideOutletEnth, RoutineName); - if (LoadSideOutletHumRat > MaxHumRat) { - LoadSideOutletHumRat = MaxHumRat; + state.dataVariableSpeedCoils->LoadSideOutletHumRat = PsyWFnTdbH( state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); + if ( state.dataVariableSpeedCoils->LoadSideOutletHumRat > MaxHumRat) { + state.dataVariableSpeedCoils->LoadSideOutletHumRat = MaxHumRat; } // Actual outlet conditions are "average" for time step if (CyclingScheme == ContFanCycCoil) { // continuous fan, cycling compressor - VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = PartLoadRatio * LoadSideOutletEnth + (1.0 - PartLoadRatio) * LoadSideInletEnth; - VarSpeedCoil(DXCoilNum).OutletAirHumRat = PartLoadRatio * LoadSideOutletHumRat + (1.0 - PartLoadRatio) * LoadSideInletHumRat; - VarSpeedCoil(DXCoilNum).OutletAirDBTemp = PsyTdbFnHW(VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, VarSpeedCoil(DXCoilNum).OutletAirHumRat); - PLRCorrLoadSideMdot = LoadSideMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletEnth + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletEnth; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { - VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = LoadSideOutletEnth; - VarSpeedCoil(DXCoilNum).OutletAirHumRat = LoadSideOutletHumRat; - VarSpeedCoil(DXCoilNum).OutletAirDBTemp = LoadSideOutletDBTemp; - PLRCorrLoadSideMdot = LoadSideMassFlowRate * PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = state.dataVariableSpeedCoils->LoadSideOutletHumRat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = state.dataVariableSpeedCoils->LoadSideOutletDBTemp; + state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate * PartLoadRatio; } // scale heat transfer rates to PLR and power to RTF - QLoadTotal *= PartLoadRatio; - QSensible *= PartLoadRatio; + state.dataVariableSpeedCoils->QLoadTotal *= PartLoadRatio; + state.dataVariableSpeedCoils->QSensible *= PartLoadRatio; // count the powr separately - Winput *= RuntimeFrac; //+ VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower & - //+ VarSpeedCoil(DXCoilNum)%BasinHeaterPower + VarSpeedCoil(DXCoilNum)%EvapCondPumpElecPower - QSource *= PartLoadRatio; + state.dataVariableSpeedCoils->Winput *= RuntimeFrac; //+ state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower & + //+ state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%BasinHeaterPower + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%EvapCondPumpElecPower + state.dataVariableSpeedCoils->QSource *= PartLoadRatio; // Add power to global variable so power can be summed by parent object - DXElecCoolingPower = Winput; + DXElecCoolingPower = state.dataVariableSpeedCoils->Winput; ReportingConstant = TimeStepSys * SecInHour; // Update heat pump data structure - VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * RuntimeFrac; // water heating pump power - VarSpeedCoil(DXCoilNum).Power = Winput; - VarSpeedCoil(DXCoilNum).QLoadTotal = QLoadTotal; - VarSpeedCoil(DXCoilNum).QSensible = QSensible; - VarSpeedCoil(DXCoilNum).QLatent = QLoadTotal - QSensible; - VarSpeedCoil(DXCoilNum).QSource = QSource; - VarSpeedCoil(DXCoilNum).Energy = Winput * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergyLoadTotal = QLoadTotal * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergySensible = QSensible * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergyLatent = (QLoadTotal - QSensible) * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergySource = QSource * ReportingConstant; - VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; - VarSpeedCoil(DXCoilNum).EvapWaterConsump = 0.0; - VarSpeedCoil(DXCoilNum).BasinHeaterConsumption = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * RuntimeFrac; // water heating pump power + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = state.dataVariableSpeedCoils->Winput; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = state.dataVariableSpeedCoils->QSensible; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = state.dataVariableSpeedCoils->QSource; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = state.dataVariableSpeedCoils->Winput * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = state.dataVariableSpeedCoils->QSensible * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = ( state.dataVariableSpeedCoils->QLoadTotal - state.dataVariableSpeedCoils->QSensible) * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = state.dataVariableSpeedCoils->QSource * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsump = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterConsumption = 0.0; // re-use EvapCondPumpElecConsumption to store WH pump energy consumption - VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption = VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondPumpElecConsumption = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower * ReportingConstant; if (RuntimeFrac == 0.0) { - VarSpeedCoil(DXCoilNum).COP = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; } else { - VarSpeedCoil(DXCoilNum).COP = QLoadTotal / Winput; - } - VarSpeedCoil(DXCoilNum).RunFrac = RuntimeFrac; - VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - VarSpeedCoil(DXCoilNum).AirMassFlowRate = PLRCorrLoadSideMdot; - rhoair = PsyRhoAirFnPbTdbW(OutBaroPress, LoadSideInletDBTemp, LoadSideInletHumRat, RoutineName); - VarSpeedCoil(DXCoilNum).AirVolFlowRate = VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = SourceSideMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->Winput; + } + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = RuntimeFrac; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; + rhoair = PsyRhoAirFnPbTdbW(OutBaroPress, state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->LoadSideInletHumRat, RoutineName); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; RhoWater = RhoH2O(InletWaterTemp); // initialize - VarSpeedCoil(DXCoilNum).WaterVolFlowRate = VarSpeedCoil(DXCoilNum).WaterMassFlowRate / RhoWater; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate / RhoWater; - VarSpeedCoil(DXCoilNum).OutletWaterTemp = SourceSideInletTemp + QSource / (SourceSideMassFlowRate * CpWater); - VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = SourceSideInletEnth + QSource / SourceSideMassFlowRate; - VarSpeedCoil(DXCoilNum).QWasteHeat = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = state.dataVariableSpeedCoils->SourceSideInletTemp + state.dataVariableSpeedCoils->QSource / (state.dataVariableSpeedCoils->SourceSideMassFlowRate * CpWater); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = state.dataVariableSpeedCoils->SourceSideInletEnth + state.dataVariableSpeedCoils->QSource / state.dataVariableSpeedCoils->SourceSideMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = 0.0; - if (VarSpeedCoil(DXCoilNum).bIsDesuperheater) // desuperheater doesn't save power and cooling energy variables + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater) // desuperheater doesn't save power and cooling energy variables { // source side is the water side; load side is the air side - VarSpeedCoil(DXCoilNum).Power = 0.0; - VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; - VarSpeedCoil(DXCoilNum).QSensible = 0.0; - VarSpeedCoil(DXCoilNum).QLatent = 0.0; - VarSpeedCoil(DXCoilNum).Energy = 0.0; - VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; - VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; - VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; - VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = 0.0; } } - void setVarSpeedHPWHFanTypeNum(int const dXCoilNum, int const fanTypeNum) + void setVarSpeedHPWHFanTypeNum(EnergyPlusData &state, int const dXCoilNum, int const fanTypeNum) { - VarSpeedCoil(dXCoilNum).SupplyFan_TypeNum = fanTypeNum; + state.dataVariableSpeedCoils->VarSpeedCoil(dXCoilNum).SupplyFan_TypeNum = fanTypeNum; } - void setVarSpeedHPWHFanIndex(int const dXCoilNum, int const fanIndex) + void setVarSpeedHPWHFanIndex(EnergyPlusData &state, int const dXCoilNum, int const fanIndex) { - VarSpeedCoil(dXCoilNum).SupplyFanIndex = fanIndex; + state.dataVariableSpeedCoils->VarSpeedCoil(dXCoilNum).SupplyFanIndex = fanIndex; } - void setVarSpeedFanInfo(int const dXCoilNum, std::string const fanName, int const fanIndex, int const fanTypeNum) + void setVarSpeedFanInfo(EnergyPlusData &state, int const dXCoilNum, std::string const fanName, int const fanIndex, int const fanTypeNum) { - VarSpeedCoil(dXCoilNum).SupplyFanIndex = fanIndex; - VarSpeedCoil(dXCoilNum).SupplyFan_TypeNum = fanTypeNum; - VarSpeedCoil(dXCoilNum).SupplyFanName = fanName; + state.dataVariableSpeedCoils->VarSpeedCoil(dXCoilNum).SupplyFanIndex = fanIndex; + state.dataVariableSpeedCoils->VarSpeedCoil(dXCoilNum).SupplyFan_TypeNum = fanTypeNum; + state.dataVariableSpeedCoils->VarSpeedCoil(dXCoilNum).SupplyFanName = fanName; } void CalcVarSpeedCoilHeating(EnergyPlusData &state, @@ -6301,7 +6120,7 @@ namespace VariableSpeedCoils { // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("CalcVarSpeedCoilHeating"); - static std::string const RoutineNameSourceSideInletTemp("CalcVarSpeedCoilHeating:SourceSideInletTemp"); + static std::string const RoutineNameSourceSideInletTemp("CalcVarSpeedCoilHeating:state.dataVariableSpeedCoils->SourceSideInletTemp"); // INTERFACE BLOCK SPECIFICATIONS // na @@ -6350,72 +6169,72 @@ namespace VariableSpeedCoils { static Real64 DefrostEIRTempModFac(0.0); // EIR modifier for defrost (function of entering wetbulb, outside drybulb) static Real64 TotRatedCapacity(0.0); // total rated capacity at the given speed and speed ratio for defrosting - MaxSpeed = VarSpeedCoil(DXCoilNum).NumOfSpeeds; + MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) if (!(CyclingScheme == ContFanCycCoil) && PartLoadRatio > 0.0) { - VarSpeedCoil(DXCoilNum).AirMassFlowRate = Node(VarSpeedCoil(DXCoilNum).AirInletNodeNum).MassFlowRate / PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum).MassFlowRate / PartLoadRatio; } - LoadSideMassFlowRate = VarSpeedCoil(DXCoilNum).AirMassFlowRate; - LoadSideInletDBTemp = VarSpeedCoil(DXCoilNum).InletAirDBTemp; - LoadSideInletHumRat = VarSpeedCoil(DXCoilNum).InletAirHumRat; + state.dataVariableSpeedCoils->LoadSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate; + state.dataVariableSpeedCoils->LoadSideInletDBTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp; + state.dataVariableSpeedCoils->LoadSideInletHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat; - LoadSideInletWBTemp = PsyTwbFnTdbWPb(LoadSideInletDBTemp, LoadSideInletHumRat, OutBaroPress, RoutineName); - LoadSideInletEnth = VarSpeedCoil(DXCoilNum).InletAirEnthalpy; - CpAir = PsyCpAirFnW(LoadSideInletHumRat); + state.dataVariableSpeedCoils->LoadSideInletWBTemp = PsyTwbFnTdbWPb(state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->LoadSideInletHumRat, OutBaroPress, RoutineName); + state.dataVariableSpeedCoils->LoadSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy; + CpAir = PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { // Get condenser outdoor node info from DX Heating Coil - if (VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { - OutdoorDryBulb = Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp; - OutdoorHumRat = Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat; - OutdoorPressure = Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press; - OutdoorWetBulb = Node(VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum != 0) { + OutdoorDryBulb = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Temp; + OutdoorHumRat = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).HumRat; + OutdoorPressure = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).Press; + OutdoorWetBulb = Node(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum).OutAirWetBulb; } else { OutdoorDryBulb = OutDryBulbTemp; OutdoorHumRat = OutHumRat; OutdoorPressure = OutBaroPress; OutdoorWetBulb = OutWetBulbTemp; } - SourceSideMassFlowRate = 1.0; // not used and avoid divided by zero - SourceSideInletTemp = OutdoorDryBulb; - SourceSideInletEnth = PsyHFnTdbW(OutdoorDryBulb, OutdoorHumRat); + state.dataVariableSpeedCoils->SourceSideMassFlowRate = 1.0; // not used and avoid divided by zero + state.dataVariableSpeedCoils->SourceSideInletTemp = OutdoorDryBulb; + state.dataVariableSpeedCoils->SourceSideInletEnth = PsyHFnTdbW(OutdoorDryBulb, OutdoorHumRat); CpSource = PsyCpAirFnW(OutHumRat); // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil - if (OutdoorDryBulb < VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { - CrankcaseHeatingPower = VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity; + if (OutdoorDryBulb < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { + CrankcaseHeatingPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity; } else { CrankcaseHeatingPower = 0.0; } } else { - SourceSideMassFlowRate = VarSpeedCoil(DXCoilNum).WaterMassFlowRate; - SourceSideInletTemp = VarSpeedCoil(DXCoilNum).InletWaterTemp; - SourceSideInletEnth = VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; + state.dataVariableSpeedCoils->SourceSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate; + state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; + state.dataVariableSpeedCoils->SourceSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; CpSource = GetSpecificHeatGlycol(state, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidName, - SourceSideInletTemp, - PlantLoop(VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidName, + state.dataVariableSpeedCoils->SourceSideInletTemp, + PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LoopNum).FluidIndex, RoutineNameSourceSideInletTemp); } // Check for flows, do not perform simulation if no flow in load side or source side. - if ((SourceSideMassFlowRate <= 0.0) || (LoadSideMassFlowRate <= 0.0)) { - VarSpeedCoil(DXCoilNum).SimFlag = false; + if ((state.dataVariableSpeedCoils->SourceSideMassFlowRate <= 0.0) || (state.dataVariableSpeedCoils->LoadSideMassFlowRate <= 0.0)) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; return; } else { - VarSpeedCoil(DXCoilNum).SimFlag = true; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; } - if ((VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) && - (OutdoorDryBulb < VarSpeedCoil(DXCoilNum).MinOATCompressor)) { - VarSpeedCoil(DXCoilNum).SimFlag = false; + if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) && + (OutdoorDryBulb < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MinOATCompressor)) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; return; } if (CompOp == 0) { - VarSpeedCoil(DXCoilNum).SimFlag = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false; return; } @@ -6426,150 +6245,150 @@ namespace VariableSpeedCoils { } RuntimeFrac = 1.0; - VarSpeedCoil(DXCoilNum).RunFrac = 1.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; OnOffFanPartLoadFraction = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = CurveValue(state, VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } if (CyclingScheme == CycFanCycCoil) OnOffFanPartLoadFraction = PLF; // save PLF for fan model, don't change fan power for constant fan mode if coil is off // calculate the run time fraction - VarSpeedCoil(DXCoilNum).RunFrac = PartLoadRatio / PLF; - VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = PartLoadRatio / PLF; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - if (VarSpeedCoil(DXCoilNum).RunFrac > 1.0) { - VarSpeedCoil(DXCoilNum).RunFrac = 1.0; // Reset coil runtime fraction to 1.0 - } else if (VarSpeedCoil(DXCoilNum).RunFrac < 0.0) { - VarSpeedCoil(DXCoilNum).RunFrac = 0.0; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac > 1.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; // Reset coil runtime fraction to 1.0 + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac < 0.0) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 0.0; } - RuntimeFrac = VarSpeedCoil(DXCoilNum).RunFrac; + RuntimeFrac = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; } if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { - AirMassFlowRatio = LoadSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + AirMassFlowRatio = state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { WaterMassFlowRatio = 1.0; } else { - WaterMassFlowRatio = SourceSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; } - TotCapTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), LoadSideInletDBTemp, SourceSideInletTemp); - TotCapAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TotCapTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + TotCapAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { - TotCapWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + TotCapWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } - QLoadTotal = VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; - VarSpeedCoil(DXCoilNum).capModFacTotal = TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; - TotRatedCapacity = VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal); // for defrosting power cal + state.dataVariableSpeedCoils->QLoadTotal = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal = TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; + TotRatedCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal); // for defrosting power cal - EIRTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), LoadSideInletDBTemp, SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { - EIRWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + EIRWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; - Winput = QLoadTotal * EIR; + EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; + state.dataVariableSpeedCoils->Winput = state.dataVariableSpeedCoils->QLoadTotal * EIR; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { QWasteHeat = 0.0; } else { - QWasteHeat = Winput * VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat *= CurveValue(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), LoadSideInletDBTemp, SourceSideInletTemp); + QWasteHeat = state.dataVariableSpeedCoils->Winput * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat *= CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } } else { - AirMassFlowRatio = LoadSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; + AirMassFlowRatio = state.dataVariableSpeedCoils->LoadSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirMassFlowRate; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { WaterMassFlowRatio = 1.0; } else { - WaterMassFlowRatio = SourceSideMassFlowRate / VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; + WaterMassFlowRatio = state.dataVariableSpeedCoils->SourceSideMassFlowRate / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; } SpeedCal = SpeedNum - 1; - TotCapTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), LoadSideInletDBTemp, SourceSideInletTemp); - TotCapAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TotCapTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + TotCapAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { - TotCapWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + TotCapWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } - QLoadTotal1 = VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; + QLoadTotal1 = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; - EIRTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), LoadSideInletDBTemp, SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { - EIRWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + EIRWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; + EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; Winput1 = QLoadTotal1 * EIR; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { QWasteHeat1 = 0.0; } else { - QWasteHeat1 = Winput1 * VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat1 *= CurveValue(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), LoadSideInletDBTemp, SourceSideInletTemp); + QWasteHeat1 = Winput1 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat1 *= CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } SpeedCal = SpeedNum; - TotCapTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), LoadSideInletDBTemp, SourceSideInletTemp); - TotCapAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TotCapTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + TotCapAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { - TotCapWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + TotCapWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } - QLoadTotal2 = VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; + QLoadTotal2 = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; - EIRTempModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), LoadSideInletDBTemp, SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { - EIRWaterFFModFac = CurveValue(state, VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + EIRWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } - EIR = (1.0 / VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; + EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; Winput2 = QLoadTotal2 * EIR; - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { QWasteHeat2 = 0.0; } else { - QWasteHeat2 = Winput2 * VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat2 *= CurveValue(state, VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), LoadSideInletDBTemp, SourceSideInletTemp); + QWasteHeat2 = Winput2 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); + QWasteHeat2 *= CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->SourceSideInletTemp); } - QLoadTotal = QLoadTotal2 * SpeedRatio + (1.0 - SpeedRatio) * QLoadTotal1; - Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; + state.dataVariableSpeedCoils->QLoadTotal = QLoadTotal2 * SpeedRatio + (1.0 - SpeedRatio) * QLoadTotal1; + state.dataVariableSpeedCoils->Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; QWasteHeat = QWasteHeat2 * SpeedRatio + (1.0 - SpeedRatio) * QWasteHeat1; - TotRatedCapacity = VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * SpeedRatio + - (1.0 - SpeedRatio) * VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal - 1); + TotRatedCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * SpeedRatio + + (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal - 1); } - VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; // necessary to clear zero for water source coils - VarSpeedCoil(DXCoilNum).DefrostPower = 0.0; // clear the defrost power - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = 0.0; // necessary to clear zero for water source coils + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = 0.0; // clear the defrost power + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { // 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 OutdoorCoilT = 0.82 * OutdoorDryBulb - 8.589; @@ -6581,10 +6400,10 @@ namespace VariableSpeedCoils { FractionalDefrostTime = 0.0; InputPowerMultiplier = 1.0; // Check outdoor temperature to determine of defrost is active - if (OutdoorDryBulb <= VarSpeedCoil(DXCoilNum).MaxOATDefrost) { + if (OutdoorDryBulb <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATDefrost) { // Calculate defrost adjustment factors depending on defrost control type - if (VarSpeedCoil(DXCoilNum).DefrostControl == Timed) { - FractionalDefrostTime = VarSpeedCoil(DXCoilNum).DefrostTime; + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostControl == state.dataVariableSpeedCoils->Timed) { + FractionalDefrostTime = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostTime; HeatingCapacityMultiplier = 0.909 - 107.33 * OutdoorCoildw; InputPowerMultiplier = 0.90 - 36.45 * OutdoorCoildw; } else { // else defrost control is on-demand @@ -6597,20 +6416,20 @@ namespace VariableSpeedCoils { if (FractionalDefrostTime > 0.0) { // Calculate defrost adjustment factors depending on defrost control strategy - if (VarSpeedCoil(DXCoilNum).DefrostStrategy == ReverseCycle) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostStrategy == state.dataVariableSpeedCoils->ReverseCycle) { LoadDueToDefrost = (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (TotRatedCapacity / 1.01667); DefrostEIRTempModFac = - CurveValue(state, VarSpeedCoil(DXCoilNum).DefrostEIRFT, max(15.555, LoadSideInletWBTemp), max(15.555, OutdoorDryBulb)); - VarSpeedCoil(DXCoilNum).DefrostPower = DefrostEIRTempModFac * (TotRatedCapacity / 1.01667) * FractionalDefrostTime; + CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT, max(15.555, state.dataVariableSpeedCoils->LoadSideInletWBTemp), max(15.555, OutdoorDryBulb)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = DefrostEIRTempModFac * (TotRatedCapacity / 1.01667) * FractionalDefrostTime; } else { // Defrost strategy is resistive - VarSpeedCoil(DXCoilNum).DefrostPower = VarSpeedCoil(DXCoilNum).DefrostCapacity * FractionalDefrostTime; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostCapacity * FractionalDefrostTime; } - } else { // Defrost is not active because (OutDryBulbTemp > VarSpeedCoil(DXCoilNum).MaxOATDefrost) - VarSpeedCoil(DXCoilNum).DefrostPower = 0.0; + } else { // Defrost is not active because (OutDryBulbTemp > state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATDefrost) + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = 0.0; } } - VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - RuntimeFrac); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower = CrankcaseHeatingPower * (1.0 - RuntimeFrac); //! Modify total heating capacity based on defrost heating capacity multiplier //! MaxHeatCap passed from parent object VRF Condenser and is used to limit capacity of TU's to that available from condenser // IF(PRESENT(MaxHeatCap))THEN @@ -6618,85 +6437,85 @@ namespace VariableSpeedCoils { // ELSE // TotCap = TotCap * HeatingCapacityMultiplier // END IF - QLoadTotal = QLoadTotal * HeatingCapacityMultiplier - LoadDueToDefrost; + state.dataVariableSpeedCoils->QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * HeatingCapacityMultiplier - LoadDueToDefrost; // count the powr separately - Winput *= InputPowerMultiplier; //+ VarSpeedCoil(DXCoilNum)%DefrostPower + state.dataVariableSpeedCoils->Winput *= InputPowerMultiplier; //+ state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%DefrostPower } - QSource = QLoadTotal + QWasteHeat - Winput; - QSensible = QLoadTotal; + state.dataVariableSpeedCoils->QSource = state.dataVariableSpeedCoils->QLoadTotal + QWasteHeat - state.dataVariableSpeedCoils->Winput; + state.dataVariableSpeedCoils->QSensible = state.dataVariableSpeedCoils->QLoadTotal; - if (QSource < 0) { - QSource = 0.0; - QWasteHeat = Winput - QLoadTotal; + if ( state.dataVariableSpeedCoils->QSource < 0) { + state.dataVariableSpeedCoils->QSource = 0.0; + QWasteHeat = state.dataVariableSpeedCoils->Winput - state.dataVariableSpeedCoils->QLoadTotal; } // calculate coil outlet state variables - LoadSideOutletEnth = LoadSideInletEnth + QLoadTotal / LoadSideMassFlowRate; - LoadSideOutletDBTemp = LoadSideInletDBTemp + QSensible / (LoadSideMassFlowRate * CpAir); - LoadSideOutletHumRat = PsyWFnTdbH(LoadSideOutletDBTemp, LoadSideOutletEnth, RoutineName); + state.dataVariableSpeedCoils->LoadSideOutletEnth = state.dataVariableSpeedCoils->LoadSideInletEnth + state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->LoadSideMassFlowRate; + state.dataVariableSpeedCoils->LoadSideOutletDBTemp = state.dataVariableSpeedCoils->LoadSideInletDBTemp + state.dataVariableSpeedCoils->QSensible / (state.dataVariableSpeedCoils->LoadSideMassFlowRate * CpAir); + state.dataVariableSpeedCoils->LoadSideOutletHumRat = PsyWFnTdbH( state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); // Actual outlet conditions are "average" for time step if (CyclingScheme == ContFanCycCoil) { // continuous fan, cycling compressor - VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = PartLoadRatio * LoadSideOutletEnth + (1.0 - PartLoadRatio) * LoadSideInletEnth; - VarSpeedCoil(DXCoilNum).OutletAirHumRat = PartLoadRatio * LoadSideOutletHumRat + (1.0 - PartLoadRatio) * LoadSideInletHumRat; - VarSpeedCoil(DXCoilNum).OutletAirDBTemp = PsyTdbFnHW(VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, VarSpeedCoil(DXCoilNum).OutletAirHumRat); - PLRCorrLoadSideMdot = LoadSideMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletEnth + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletEnth; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { // default to cycling fan, cycling compressor - VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = LoadSideOutletEnth; - VarSpeedCoil(DXCoilNum).OutletAirHumRat = LoadSideOutletHumRat; - VarSpeedCoil(DXCoilNum).OutletAirDBTemp = LoadSideOutletDBTemp; - PLRCorrLoadSideMdot = LoadSideMassFlowRate * PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = state.dataVariableSpeedCoils->LoadSideOutletHumRat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = state.dataVariableSpeedCoils->LoadSideOutletDBTemp; + state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate * PartLoadRatio; } // scale heat transfer rates to PLR and power to RTF - QLoadTotal *= PartLoadRatio; - QSensible *= PartLoadRatio; + state.dataVariableSpeedCoils->QLoadTotal *= PartLoadRatio; + state.dataVariableSpeedCoils->QSensible *= PartLoadRatio; // count the powr separately - Winput *= RuntimeFrac; //+ VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower - QSource *= PartLoadRatio; + state.dataVariableSpeedCoils->Winput *= RuntimeFrac; //+ state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum)%CrankcaseHeaterPower + state.dataVariableSpeedCoils->QSource *= PartLoadRatio; QWasteHeat *= PartLoadRatio; // Add power to global variable so power can be summed by parent object - DXElecHeatingPower = Winput; + DXElecHeatingPower = state.dataVariableSpeedCoils->Winput; ReportingConstant = TimeStepSys * SecInHour; // Update heat pump data structure - VarSpeedCoil(DXCoilNum).Power = Winput; - VarSpeedCoil(DXCoilNum).QLoadTotal = QLoadTotal; - VarSpeedCoil(DXCoilNum).QSensible = QSensible; - VarSpeedCoil(DXCoilNum).QSource = QSource; - VarSpeedCoil(DXCoilNum).Energy = Winput * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergyLoadTotal = QLoadTotal * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergySensible = QSensible * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; - VarSpeedCoil(DXCoilNum).EnergySource = QSource * ReportingConstant; - VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; - VarSpeedCoil(DXCoilNum).DefrostConsumption = VarSpeedCoil(DXCoilNum).DefrostPower * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = state.dataVariableSpeedCoils->Winput; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = state.dataVariableSpeedCoils->QLoadTotal; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = state.dataVariableSpeedCoils->QSensible; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = state.dataVariableSpeedCoils->QSource; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = state.dataVariableSpeedCoils->Winput * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = state.dataVariableSpeedCoils->QLoadTotal * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = state.dataVariableSpeedCoils->QSensible * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = state.dataVariableSpeedCoils->QSource * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterConsumption = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterPower * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostConsumption = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower * ReportingConstant; if (RuntimeFrac == 0.0) { - VarSpeedCoil(DXCoilNum).COP = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; } else { - VarSpeedCoil(DXCoilNum).COP = QLoadTotal / Winput; - } - VarSpeedCoil(DXCoilNum).RunFrac = RuntimeFrac; - VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; - VarSpeedCoil(DXCoilNum).AirMassFlowRate = PLRCorrLoadSideMdot; - rhoair = PsyRhoAirFnPbTdbW(OutBaroPress, LoadSideInletDBTemp, LoadSideInletHumRat, RoutineName); - VarSpeedCoil(DXCoilNum).AirVolFlowRate = VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; - - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; - VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; - VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->Winput; + } + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = RuntimeFrac; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; + rhoair = PsyRhoAirFnPbTdbW(OutBaroPress, state.dataVariableSpeedCoils->LoadSideInletDBTemp, state.dataVariableSpeedCoils->LoadSideInletHumRat, RoutineName); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; + + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = 0.0; } else { - VarSpeedCoil(DXCoilNum).WaterMassFlowRate = SourceSideMassFlowRate; - VarSpeedCoil(DXCoilNum).OutletWaterTemp = SourceSideInletTemp - QSource / (SourceSideMassFlowRate * CpSource); - VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = SourceSideInletEnth - QSource / SourceSideMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = state.dataVariableSpeedCoils->SourceSideInletTemp - state.dataVariableSpeedCoils->QSource / (state.dataVariableSpeedCoils->SourceSideMassFlowRate * CpSource); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = state.dataVariableSpeedCoils->SourceSideInletEnth - state.dataVariableSpeedCoils->QSource / state.dataVariableSpeedCoils->SourceSideMassFlowRate; } - VarSpeedCoil(DXCoilNum).QWasteHeat = QWasteHeat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QWasteHeat = QWasteHeat; } Real64 GetCoilCapacityVariableSpeed(EnergyPlusData &state, @@ -6727,10 +6546,10 @@ namespace VariableSpeedCoils { int WhichCoil; // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } if (UtilityRoutines::SameString(CoilType, "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT") || @@ -6738,15 +6557,15 @@ namespace VariableSpeedCoils { UtilityRoutines::SameString(CoilType, "COIL:COOLING:DX:VARIABLESPEED") || UtilityRoutines::SameString(CoilType, "COIL:HEATING:DX:VARIABLESPEED") || UtilityRoutines::SameString(CoilType, "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED")) { - WhichCoil = UtilityRoutines::FindItemInList(CoilName, VarSpeedCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { if (UtilityRoutines::SameString(CoilType, "COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT") || UtilityRoutines::SameString(CoilType, "COIL:HEATING:DX:VARIABLESPEED")) { - CoilCapacity = VarSpeedCoil(WhichCoil).RatedCapHeat; + CoilCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedCapHeat; } else if (UtilityRoutines::SameString(CoilType, "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED")) { - CoilCapacity = VarSpeedCoil(WhichCoil).RatedCapWH; + CoilCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedCapWH; } else { - CoilCapacity = VarSpeedCoil(WhichCoil).RatedCapCoolTotal; + CoilCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedCapCoolTotal; } } } else { @@ -6787,13 +6606,13 @@ namespace VariableSpeedCoils { int IndexNum; // returned index of matched coil // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - IndexNum = UtilityRoutines::FindItemInList(CoilName, VarSpeedCoil); + IndexNum = UtilityRoutines::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (IndexNum == 0) { ShowSevereError("GetCoilIndexVariableSpeed: Could not find CoilType=\"" + CoilType + "\" with Name=\"" + CoilName + "\""); @@ -6828,10 +6647,10 @@ namespace VariableSpeedCoils { int WhichCoil; // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } if (UtilityRoutines::SameString(CoilType, "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT") || @@ -6839,15 +6658,15 @@ namespace VariableSpeedCoils { UtilityRoutines::SameString(CoilType, "COIL:COOLING:DX:VARIABLESPEED") || UtilityRoutines::SameString(CoilType, "COIL:HEATING:DX:VARIABLESPEED") || UtilityRoutines::SameString(CoilType, "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED")) { - WhichCoil = UtilityRoutines::FindItemInList(CoilName, VarSpeedCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { // CoilAirFlowRate=VarSpeedCoil(WhichCoil)%RatedAirVolFlowRate - if (VarSpeedCoil(WhichCoil).RatedAirVolFlowRate == AutoSize) { // means autosize - CoilAirFlowRate = VarSpeedCoil(WhichCoil).RatedAirVolFlowRate; + if (state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedAirVolFlowRate == AutoSize) { // means autosize + CoilAirFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedAirVolFlowRate; } else { - CoilAirFlowRate = VarSpeedCoil(WhichCoil).MSRatedAirVolFlowRate(VarSpeedCoil(WhichCoil).NumOfSpeeds) / - VarSpeedCoil(WhichCoil).MSRatedAirVolFlowRate(VarSpeedCoil(WhichCoil).NormSpedLevel) * - VarSpeedCoil(WhichCoil).RatedAirVolFlowRate; + CoilAirFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).NumOfSpeeds) / + state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).NormSpedLevel) * + state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedAirVolFlowRate; } // use largest air flow rate } } else { @@ -6888,15 +6707,15 @@ namespace VariableSpeedCoils { int WhichCoil; // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, VarSpeedCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { - PLRNumber = VarSpeedCoil(WhichCoil).PLFFPLR; + PLRNumber = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).PLFFPLR; } if (WhichCoil == 0) { @@ -6927,9 +6746,9 @@ namespace VariableSpeedCoils { int CapFTIndex; // returned CapFT curve index of matched coil // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } if (CoilIndex == 0) { @@ -6937,7 +6756,7 @@ namespace VariableSpeedCoils { ErrorsFound = true; CapFTIndex = 0; } else { - CapFTIndex = VarSpeedCoil(CoilIndex).MSCCapFTemp(VarSpeedCoil(CoilIndex).NumOfSpeeds); + CapFTIndex = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).MSCCapFTemp(state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).NumOfSpeeds); } return CapFTIndex; @@ -6971,15 +6790,15 @@ namespace VariableSpeedCoils { int WhichCoil; // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, VarSpeedCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { - NodeNumber = VarSpeedCoil(WhichCoil).AirInletNodeNum; + NodeNumber = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).AirInletNodeNum; } if (WhichCoil == 0) { @@ -7019,15 +6838,15 @@ namespace VariableSpeedCoils { int WhichCoil; // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, VarSpeedCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { - NodeNumber = VarSpeedCoil(WhichCoil).AirOutletNodeNum; + NodeNumber = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).AirOutletNodeNum; } if (WhichCoil == 0) { @@ -7062,15 +6881,15 @@ namespace VariableSpeedCoils { int WhichCoil; // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, VarSpeedCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { - CondNode = VarSpeedCoil(WhichCoil).CondenserInletNodeNum; + CondNode = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).CondenserInletNodeNum; } else { ShowSevereError("GetCoilCondenserInletNode: Invalid VS DX Coil, Type= VS DX Cooling Name=\"" + CoilName + "\""); ErrorsFound = true; @@ -7103,15 +6922,15 @@ namespace VariableSpeedCoils { int WhichCoil; // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, VarSpeedCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { - MinOAT = VarSpeedCoil(WhichCoil).MinOATCompressor; + MinOAT = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).MinOATCompressor; } else { ShowSevereError("GetVSCoilMinOATCompressor: Invalid VS DX Coil, Type= VS DX Coil Name=\"" + CoilName + "\""); ErrorsFound = true; @@ -7140,9 +6959,9 @@ namespace VariableSpeedCoils { Real64 MinOAT; // returned min oa temperature of matched coil // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } if (CoilIndex == 0) { @@ -7154,7 +6973,7 @@ namespace VariableSpeedCoils { } else { - MinOAT = VarSpeedCoil(CoilIndex).MinOATCompressor; + MinOAT = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).MinOATCompressor; } return MinOAT; @@ -7183,14 +7002,14 @@ namespace VariableSpeedCoils { int WhichCoil; // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - WhichCoil = UtilityRoutines::FindItemInList(CoilName, VarSpeedCoil); + WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { - Speeds = VarSpeedCoil(WhichCoil).NumOfSpeeds; + Speeds = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).NumOfSpeeds; } else { ShowSevereError("GetVSCoilNumOfSpeeds: Invalid VS DX Coil, Type= VS DX Coil Name=\"" + CoilName + "\""); ErrorsFound = true; @@ -7224,36 +7043,36 @@ namespace VariableSpeedCoils { using General::TrimSigDigits; // Obtains and Allocates WatertoAirHP related parameters from input file - if (GetCoilsInputFlag) { // First time subroutine has been entered + if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once - GetCoilsInputFlag = false; + state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - if (WSHPNum <= 0 || WSHPNum > NumVarSpeedCoils) { + if (WSHPNum <= 0 || WSHPNum > state.dataVariableSpeedCoils->NumVarSpeedCoils) { ShowSevereError("SetVarSpeedCoilData: called with VS WSHP Coil Number out of range=" + TrimSigDigits(WSHPNum) + " should be >0 and <" + - TrimSigDigits(NumVarSpeedCoils)); + TrimSigDigits(state.dataVariableSpeedCoils->NumVarSpeedCoils)); ErrorsFound = true; return; } if (present(CompanionCoolingCoilNum)) { - VarSpeedCoil(WSHPNum).CompanionCoolingCoilNum = CompanionCoolingCoilNum; - VarSpeedCoil(WSHPNum).FindCompanionUpStreamCoil = true; - VarSpeedCoil(CompanionCoolingCoilNum).CompanionHeatingCoilNum = WSHPNum; + state.dataVariableSpeedCoils->VarSpeedCoil(WSHPNum).CompanionCoolingCoilNum = CompanionCoolingCoilNum; + state.dataVariableSpeedCoils->VarSpeedCoil(WSHPNum).FindCompanionUpStreamCoil = true; + state.dataVariableSpeedCoils->VarSpeedCoil(CompanionCoolingCoilNum).CompanionHeatingCoilNum = WSHPNum; } if (present(CompanionHeatingCoilNum)) { - VarSpeedCoil(WSHPNum).CompanionHeatingCoilNum = CompanionHeatingCoilNum; - VarSpeedCoil(CompanionHeatingCoilNum).CompanionCoolingCoilNum = WSHPNum; + state.dataVariableSpeedCoils->VarSpeedCoil(WSHPNum).CompanionHeatingCoilNum = CompanionHeatingCoilNum; + state.dataVariableSpeedCoils->VarSpeedCoil(CompanionHeatingCoilNum).CompanionCoolingCoilNum = WSHPNum; } if (present(MSHPDesignSpecIndex)) { - VarSpeedCoil(WSHPNum).MSHPDesignSpecIndex = MSHPDesignSpecIndex; + state.dataVariableSpeedCoils->VarSpeedCoil(WSHPNum).MSHPDesignSpecIndex = MSHPDesignSpecIndex; } } - void UpdateVarSpeedCoil(int const DXCoilNum) + void UpdateVarSpeedCoil(EnergyPlusData &state, int const DXCoilNum) { // SUBROUTINE INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:UpdateSimpleWSHP @@ -7280,92 +7099,92 @@ namespace VariableSpeedCoils { Real64 ReportingConstant; // WatertoAirHP(DXCoilNum)%SimFlag=.FALSE. - if (!VarSpeedCoil(DXCoilNum).SimFlag) { + if (!state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag) { // Heatpump is off; just pass through conditions - VarSpeedCoil(DXCoilNum).Power = 0.0; - VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; - VarSpeedCoil(DXCoilNum).QSensible = 0.0; - VarSpeedCoil(DXCoilNum).QLatent = 0.0; - VarSpeedCoil(DXCoilNum).QSource = 0.0; - VarSpeedCoil(DXCoilNum).Energy = 0.0; - VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; - VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; - VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; - VarSpeedCoil(DXCoilNum).EnergySource = 0.0; - VarSpeedCoil(DXCoilNum).COP = 0.0; - VarSpeedCoil(DXCoilNum).RunFrac = 0.0; - VarSpeedCoil(DXCoilNum).PartLoadRatio = 0.0; - - VarSpeedCoil(DXCoilNum).OutletAirDBTemp = VarSpeedCoil(DXCoilNum).InletAirDBTemp; - VarSpeedCoil(DXCoilNum).OutletAirHumRat = VarSpeedCoil(DXCoilNum).InletAirHumRat; - VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = VarSpeedCoil(DXCoilNum).InletAirEnthalpy; - VarSpeedCoil(DXCoilNum).OutletWaterTemp = VarSpeedCoil(DXCoilNum).InletWaterTemp; - VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; - } - - AirInletNode = VarSpeedCoil(DXCoilNum).AirInletNodeNum; - WaterInletNode = VarSpeedCoil(DXCoilNum).WaterInletNodeNum; - AirOutletNode = VarSpeedCoil(DXCoilNum).AirOutletNodeNum; - WaterOutletNode = VarSpeedCoil(DXCoilNum).WaterOutletNodeNum; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).COP = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = 0.0; + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; + } + + AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; + WaterInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; + AirOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum; + WaterOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum; // Set the air outlet nodes of the WatertoAirHPSimple - Node(AirOutletNode).MassFlowRate = Node(AirInletNode).MassFlowRate; // LoadSideMassFlowRate - Node(AirOutletNode).Temp = VarSpeedCoil(DXCoilNum).OutletAirDBTemp; - Node(AirOutletNode).HumRat = VarSpeedCoil(DXCoilNum).OutletAirHumRat; - Node(AirOutletNode).Enthalpy = VarSpeedCoil(DXCoilNum).OutletAirEnthalpy; + Node(AirOutletNode).MassFlowRate = Node(AirInletNode).MassFlowRate; // state.dataVariableSpeedCoils->LoadSideMassFlowRate + Node(AirOutletNode).Temp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp; + Node(AirOutletNode).HumRat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat; + Node(AirOutletNode).Enthalpy = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy; // Set the air outlet nodes for properties that just pass through & not used Node(AirOutletNode).Quality = Node(AirInletNode).Quality; Node(AirOutletNode).Press = Node(AirInletNode).Press; Node(AirOutletNode).MassFlowRateMin = Node(AirInletNode).MassFlowRateMin; - Node(AirOutletNode).MassFlowRateMax = Node(AirInletNode).MassFlowRateMax; // LoadSideMassFlowRate + Node(AirOutletNode).MassFlowRateMax = Node(AirInletNode).MassFlowRateMax; // state.dataVariableSpeedCoils->LoadSideMassFlowRate Node(AirOutletNode).MassFlowRateMinAvail = Node(AirInletNode).MassFlowRateMinAvail; - Node(AirOutletNode).MassFlowRateMaxAvail = Node(AirInletNode).MassFlowRateMaxAvail; // LoadSideMassFlowRate + Node(AirOutletNode).MassFlowRateMaxAvail = Node(AirInletNode).MassFlowRateMaxAvail; // state.dataVariableSpeedCoils->LoadSideMassFlowRate // Set the water outlet node of the WatertoAirHPSimple // Set the water outlet nodes for properties that just pass through & not used if (WaterInletNode != 0 && WaterOutletNode != 0) { SafeCopyPlantNode(WaterInletNode, WaterOutletNode); - Node(WaterOutletNode).Temp = VarSpeedCoil(DXCoilNum).OutletWaterTemp; - Node(WaterOutletNode).Enthalpy = VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy; + Node(WaterOutletNode).Temp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterTemp; + Node(WaterOutletNode).Enthalpy = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletWaterEnthalpy; } ReportingConstant = TimeStepSys * SecInHour; - VarSpeedCoil(DXCoilNum).Energy = VarSpeedCoil(DXCoilNum).Power * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergyLoadTotal = VarSpeedCoil(DXCoilNum).QLoadTotal * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergySensible = VarSpeedCoil(DXCoilNum).QSensible * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergyLatent = VarSpeedCoil(DXCoilNum).QLatent * ReportingConstant; - VarSpeedCoil(DXCoilNum).EnergySource = VarSpeedCoil(DXCoilNum).QSource * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Energy = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Power * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLoadTotal = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLoadTotal * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySensible = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSensible * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergyLatent = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QLatent * ReportingConstant; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EnergySource = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).QSource * ReportingConstant; if (Contaminant.CO2Simulation) { Node(AirOutletNode).CO2 = Node(AirInletNode).CO2; } - if (VarSpeedCoil(DXCoilNum).reportCoilFinalSizes) { + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).reportCoilFinalSizes) { if (!DataGlobals::WarmupFlag && !DataGlobals::DoingHVACSizingSimulations && !DataGlobals::DoingSizing) { - if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit || - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { // cooling coil - coilSelectionReportObj->setCoilFinalSizes(VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).RatedCapCoolTotal, - VarSpeedCoil(DXCoilNum).RatedCapCoolSens, - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate, - VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate); - } else if (VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit || - VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { // heating coil - coilSelectionReportObj->setCoilFinalSizes(VarSpeedCoil(DXCoilNum).Name, - VarSpeedCoil(DXCoilNum).VarSpeedCoilType, - VarSpeedCoil(DXCoilNum).RatedCapHeat, - VarSpeedCoil(DXCoilNum).RatedCapHeat, - VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate, - VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate); + if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingWaterToAirHPVSEquationFit || + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_CoolingAirToAirVariableSpeed) { // cooling coil + coilSelectionReportObj->setCoilFinalSizes(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate); + } else if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingWaterToAirHPVSEquationFit || + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilTypeOfNum == Coil_HeatingAirToAirVariableSpeed) { // heating coil + coilSelectionReportObj->setCoilFinalSizes(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VarSpeedCoilType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedAirVolFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedWaterMassFlowRate); } - VarSpeedCoil(DXCoilNum).reportCoilFinalSizes = false; + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).reportCoilFinalSizes = false; } } } - 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 int const CyclingScheme, // Fan/compressor cycling scheme indicator Real64 const RTF, // Compressor run-time fraction @@ -7424,11 +7243,11 @@ namespace VariableSpeedCoils { Real64 Error; // Error for iteration (DO) loop Real64 LHRmult; // Latent Heat Ratio (LHR) multiplier. The effective latent heat ratio LHR = (1-SHRss)*LHRmult - Twet_Rated = VarSpeedCoil(DXCoilNum).Twet_Rated; - Gamma_Rated = VarSpeedCoil(DXCoilNum).Gamma_Rated; - MaxONOFFCyclesperHour = VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour; - HPTimeConstant = VarSpeedCoil(DXCoilNum).HPTimeConstant; - FanDelayTime = VarSpeedCoil(DXCoilNum).FanDelayTime; + Twet_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated; + Gamma_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated; + MaxONOFFCyclesperHour = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour; + HPTimeConstant = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPTimeConstant; + FanDelayTime = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime; // No moisture evaporation (latent degradation) occurs for runtime fraction of 1.0 // All latent degradation model parameters cause divide by 0.0 if not greater than 0.0 @@ -7649,9 +7468,9 @@ namespace VariableSpeedCoils { InletWetBulb = InletWetBulbCalc; } - Real64 getVarSpeedPartLoadRatio(int const DXCoilNum) + Real64 getVarSpeedPartLoadRatio(EnergyPlusData &state, int const DXCoilNum) { - return VarSpeedCoil(DXCoilNum).PartLoadRatio; + return state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio; } } // namespace VariableSpeedCoils diff --git a/src/EnergyPlus/VariableSpeedCoils.hh b/src/EnergyPlus/VariableSpeedCoils.hh index 19520557f37..1ad037672ff 100644 --- a/src/EnergyPlus/VariableSpeedCoils.hh +++ b/src/EnergyPlus/VariableSpeedCoils.hh @@ -53,6 +53,8 @@ #include // EnergyPlus Headers +#include +#include #include namespace EnergyPlus { @@ -62,101 +64,9 @@ struct EnergyPlusData; namespace VariableSpeedCoils { - // Using/Aliasing - - // Data - // MODULE PARAMETER DEFINITIONS - - extern Real64 const RatedInletAirTemp; // 26.6667C or 80F - extern Real64 const RatedInletWetBulbTemp; // 19.44 or 67F, cooling mode - extern Real64 const RatedInletAirHumRat; // Humidity ratio corresponding to 80F dry bulb/67F wet bulb - extern Real64 const RatedInletWaterTemp; // 85 F cooling mode - extern Real64 const RatedAmbAirTemp; // 95 F cooling mode - extern Real64 const RatedInletAirTempHeat; // 21.11C or 70F, heating mode - extern Real64 const RatedInletWaterTempHeat; // 21.11C or 70F, heating mode - extern Real64 const RatedAmbAirTempHeat; // 8.33 or 47F, heating mode - extern Real64 const RatedAmbAirWBHeat; // 8.33 or 43F, heating mode, rated wet bulb temperature - - // Airflow per total capacity range - extern Real64 const MaxRatedVolFlowPerRatedTotCap; // m3/s per watt = 450 cfm/ton - extern Real64 const MinRatedVolFlowPerRatedTotCap; // m3/s per watt = 300 cfm/ton - extern Real64 const MaxHeatVolFlowPerRatedTotCap; // m3/s per watt = 600 cfm/ton - extern Real64 const MaxCoolVolFlowPerRatedTotCap; // m3/s per watt = 500 cfm/ton - extern Real64 const MinOperVolFlowPerRatedTotCap; // m3/s per watt = 200 cfm/ton - - // 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; - - // Curve Types - extern int const Linear; - extern int const BiLinear; - extern int const Quadratic; - extern int const BiQuadratic; - extern int const Cubic; - - // 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 - - extern int const MaxSpedLevels; // Maximum number of speed that supports - - // DERIVED TYPE DEFINITIONS - - // MODULE VARIABLE DECLARATIONS: - // Identifier is VarSpeedCoil - extern int NumVarSpeedCoils; // The Number of variable speed Water to Air Heat Pumps and variable dx coils found in the Input - - extern bool GetCoilsInputFlag; // Flag set to make sure you get input once - // LOGICAL, ALLOCATABLE, DIMENSION(:) :: MySizeFlag - - extern Real64 SourceSideMassFlowRate; // Source Side Mass flow rate [Kg/s] - extern Real64 SourceSideInletTemp; // Source Side Inlet Temperature [C] - extern Real64 SourceSideInletEnth; // Source Side Inlet Enthalpy [J/kg] - extern Real64 LoadSideMassFlowRate; // Load Side Mass flow rate [Kg/s] - extern Real64 LoadSideInletDBTemp; // Load Side Inlet Dry Bulb Temp [C] - extern Real64 LoadSideInletWBTemp; // Load Side Inlet Wet Bulb Temp [C] - extern Real64 LoadSideInletHumRat; // Load Side Outlet Humidity ratio - extern Real64 LoadSideInletEnth; // Load Side Inlet Enthalpy [J/kg] - extern Real64 LoadSideOutletDBTemp; // Load Side Outlet Dry Bulb Temp [C] - extern Real64 LoadSideOutletHumRat; // Load Side Outlet Humidity ratio - extern Real64 LoadSideOutletEnth; // Load Side Outlet Enthalpy [J/kg] - extern Real64 QSensible; // Load side sensible heat transfer rate [W] - extern Real64 QLoadTotal; // Load side total heat transfer rate [W] - extern Real64 QLatRated; // Latent Capacity [W] rated at entering air conditions [Tdb=26.7C Twb=19.4C] - extern Real64 QLatActual; // Actual Latent Capacity [W] - extern Real64 QSource; // Source side heat transfer rate [W] - extern Real64 Winput; // Power Consumption [W] - extern Real64 PLRCorrLoadSideMdot; // Load Side Mdot corrected for Part Load Ratio of the unit - - extern Real64 VSHPWHHeatingCapacity; // Used by Heat Pump:Water Heater object as total water heating capacity [W] - extern Real64 VSHPWHHeatingCOP; // Used by Heat Pump:Water Heater object as water heating COP [W/W] - - // SUBROUTINE SPECIFICATIONS FOR MODULE - - // Driver/Manager Routines - - // Get Input routines for module - - // Initialization routines for module - - // Update routines to check convergence and update nodes - - // Update routine - - // Utility routines - // SHR, bypass factor routines - - // Types - struct VariableSpeedCoilData // variable speed coil { + int MaxSpedLevels = 10; // Members std::string Name; // Name of the Coil std::string VarSpeedCoilType; // type of coil @@ -366,15 +276,65 @@ namespace VariableSpeedCoils { Real64 capModFacTotal; // coil TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac, for result for simulation peak reporting // Default Constructor - VariableSpeedCoilData(); + VariableSpeedCoilData() + : NumOfSpeeds(2), NormSpedLevel(MaxSpedLevels), RatedWaterVolFlowRate(DataSizing::AutoSize), RatedWaterMassFlowRate(DataSizing::AutoSize), + RatedAirVolFlowRate(DataSizing::AutoSize), RatedCapHeat(DataSizing::AutoSize), RatedCapCoolTotal(DataSizing::AutoSize), MaxONOFFCyclesperHour(0.0), Twet_Rated(0.0), + Gamma_Rated(0.0), HOTGASREHEATFLG(0), HPTimeConstant(0.0), PLFFPLR(0), VSCoilTypeOfNum(0), SimFlag(false), DesignWaterMassFlowRate(0.0), + DesignWaterVolFlowRate(0.0), DesignAirMassFlowRate(0.0), DesignAirVolFlowRate(0.0), AirVolFlowRate(0.0), AirMassFlowRate(0.0), + InletAirPressure(0.0), InletAirDBTemp(0.0), InletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirDBTemp(0.0), OutletAirHumRat(0.0), + OutletAirEnthalpy(0.0), WaterVolFlowRate(0.0), WaterMassFlowRate(0.0), InletWaterTemp(0.0), InletWaterEnthalpy(0.0), OutletWaterTemp(0.0), + OutletWaterEnthalpy(0.0), Power(0.0), QLoadTotal(0.0), QSensible(0.0), QLatent(0.0), QSource(0.0), QWasteHeat(0.0), Energy(0.0), + EnergyLoadTotal(0.0), EnergySensible(0.0), EnergyLatent(0.0), EnergySource(0.0), COP(0.0), RunFrac(0.0), PartLoadRatio(0.0), + RatedPowerHeat(0.0), RatedCOPHeat(0.0), RatedCapCoolSens(0.0), RatedPowerCool(0.0), RatedCOPCool(0.0), AirInletNodeNum(0), + AirOutletNodeNum(0), WaterInletNodeNum(0), WaterOutletNodeNum(0), LoopNum(0), LoopSide(0), BranchNum(0), CompNum(0), + FindCompanionUpStreamCoil(true), IsDXCoilInZone(false), CompanionCoolingCoilNum(0), CompanionHeatingCoilNum(0), FanDelayTime(0.0), + // This one calls into a std::vector, so it's 0-indexed, so we initialize it to -1 + MSHPDesignSpecIndex(-1), MSErrIndex(MaxSpedLevels, 0), MSRatedPercentTotCap(MaxSpedLevels, 0.0), MSRatedTotCap(MaxSpedLevels, 0.0), + MSRatedSHR(MaxSpedLevels, 0.0), MSRatedCOP(MaxSpedLevels, 0.0), MSRatedAirVolFlowPerRatedTotCap(MaxSpedLevels, 0.0), + MSRatedAirVolFlowRate(MaxSpedLevels, 0.0), MSRatedAirMassFlowRate(MaxSpedLevels, 0.0), + MSRatedWaterVolFlowPerRatedTotCap(MaxSpedLevels, 0.0), MSRatedWaterVolFlowRate(MaxSpedLevels, 0.0), + MSRatedWaterMassFlowRate(MaxSpedLevels, 0.0), MSRatedCBF(MaxSpedLevels, 0.0), MSEffectiveAo(MaxSpedLevels, 0.0), + MSCCapFTemp(MaxSpedLevels, 0), MSCCapAirFFlow(MaxSpedLevels, 0), MSCCapWaterFFlow(MaxSpedLevels, 0), MSEIRFTemp(MaxSpedLevels, 0), + MSEIRAirFFlow(MaxSpedLevels, 0), MSEIRWaterFFlow(MaxSpedLevels, 0), MSWasteHeat(MaxSpedLevels, 0), MSWasteHeatFrac(MaxSpedLevels, 0.0), + MSWHPumpPower(MaxSpedLevels, 0.0), MSWHPumpPowerPerRatedTotCap(MaxSpedLevels, 0.0), SpeedNumReport(0.0), SpeedRatioReport(0.0), + DefrostStrategy(0), DefrostControl(0), EIRFPLR(0), DefrostEIRFT(0), MinOATCompressor(0.0), OATempCompressorOn(0.0), MaxOATDefrost(0.0), + DefrostTime(0.0), DefrostCapacity(0.0), HPCompressorRuntime(0.0), HPCompressorRuntimeLast(0.0), TimeLeftToDefrost(0.0), DefrostPower(0.0), + DefrostConsumption(0.0), ReportCoolingCoilCrankcasePower(true), CrankcaseHeaterCapacity(0.0), CrankcaseHeaterPower(0.0), + MaxOATCrankcaseHeater(0.0), CrankcaseHeaterConsumption(0.0), CondenserInletNodeNum(0), CondenserType(DataHVACGlobals::AirCooled), ReportEvapCondVars(false), + EvapCondPumpElecNomPower(0.0), EvapCondPumpElecPower(0.0), EvapWaterConsumpRate(0.0), EvapCondPumpElecConsumption(0.0), + EvapWaterConsump(0.0), BasinHeaterConsumption(0.0), BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0), BasinHeaterPower(0.0), + BasinHeaterSchedulePtr(0), EvapCondAirFlow(MaxSpedLevels, 0.0), EvapCondEffect(MaxSpedLevels, 0.0), + MSRatedEvapCondVolFlowPerRatedTotCap(MaxSpedLevels, 0.0), EvapWaterSupplyMode(101), EvapWaterSupTankID(0), + EvapWaterTankDemandARRID(0), CondensateCollectMode(1001), CondensateTankID(0), CondensateTankSupplyARRID(0), + CondensateVdot(0.0), CondensateVol(0.0), CondInletTemp(0.0), SupplyFanIndex(0), SupplyFan_TypeNum(0), SourceAirMassFlowRate(0.0), + InletSourceAirTemp(0.0), InletSourceAirEnthalpy(0.0), + // begin varibles for HPWH + RatedCapWH(0.0), // Rated water heating Capacity [W] + InletAirTemperatureType(0), // Specifies to use either air wet-bulb or dry-bulb temp for curve objects + WHRatedInletDBTemp(0.0), // Rated inlet air dry-bulb temperature [C] + WHRatedInletWBTemp(0.0), // Rated inlet air wet-bulb temperature [C] + WHRatedInletWaterTemp(0.0), // Rated condenser water inlet temperature [C] + HPWHCondPumpElecNomPower(0.0), // Nominal power input to the condenser water circulation pump [W] + HPWHCondPumpFracToWater(1.0), // Nominal power fraction to water for the condenser water circulation pump + RatedHPWHCondWaterFlow(0.0), // Rated water flow rate through the condenser of the HPWH DX coil [m3/s] + ElecWaterHeatingPower(0.0), // Total electric power consumed by compressor and condenser pump [W] + ElecWaterHeatingConsumption(0.0), // Total electric consumption by compressor and condenser pump [J] + FanPowerIncludedInCOP(false), // Indicates that fan heat is included in heating capacity and COP + CondPumpHeatInCapacity(false), // Indicates that condenser pump heat is included in heating capacity + CondPumpPowerInCOP(false), // Indicates that condenser pump power is included in heating COP + AirVolFlowAutoSized(false), // Used to report autosizing info for the HPWH DX coil + WaterVolFlowAutoSized(false), // Used to report autosizing info for the HPWH DX coil + TotalHeatingEnergy(0.0), // total water heating energy + TotalHeatingEnergyRate(0.0), // total WH energy rate + bIsDesuperheater(false), // whether the coil is used for a desuperheater, i.e. zero all the cooling capacity and power + // end variables for HPWH + reportCoilFinalSizes(true), // coil report + capModFacTotal(0.0) // coil report + + { + } }; - // Object Data - extern Array1D VarSpeedCoil; - - // Functions - void clear_state(); - void SimVariableSpeedCoils(EnergyPlusData &state, std::string const &CompName, // Coil Name int &CompIndex, // Index for Component name int const CyclingScheme, // Continuous fan OR cycling compressor @@ -503,9 +463,9 @@ namespace VariableSpeedCoils { Optional_int MSHPDesignSpecIndex = _ // index to UnitarySystemPerformance:Multispeed object ); - void UpdateVarSpeedCoil(int const DXCoilNum); + void UpdateVarSpeedCoil(EnergyPlusData &state, int const DXCoilNum); - 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 int const CyclingScheme, // Fan/compressor cycling scheme indicator Real64 const RTF, // Compressor run-time fraction @@ -552,16 +512,113 @@ namespace VariableSpeedCoils { int const CyclingScheme // Continuous fan OR cycling compressor ); - Real64 getVarSpeedPartLoadRatio(int const DXCoilNum); // the number of the DX coil to mined for current PLR + Real64 getVarSpeedPartLoadRatio(EnergyPlusData &state, int const DXCoilNum); // the number of the DX coil to mined for current PLR - void setVarSpeedHPWHFanTypeNum(int const dXCoilNum, int const fanTypeNum); + void setVarSpeedHPWHFanTypeNum(EnergyPlusData &state, int const dXCoilNum, int const fanTypeNum); - void setVarSpeedHPWHFanIndex(int const dXCoilNum, int const fanIndex); + void setVarSpeedHPWHFanIndex(EnergyPlusData &state, int const dXCoilNum, int const fanIndex); - void setVarSpeedFanInfo(int const dXCoilNum, std::string const fanName, int const fanIndex, int const fanTypeNum); + void setVarSpeedFanInfo(EnergyPlusData &state, int const dXCoilNum, std::string const fanName, int const fanIndex, int const fanTypeNum); } // namespace VariableSpeedCoils +struct VariableSpeedCoilsData : BaseGlobalStruct { + + Real64 const RatedInletAirTemp = 26.6667; // 26.6667C or 80F + Real64 const RatedInletWetBulbTemp = 19.4444; // 19.44 or 67F, cooling mode + Real64 const RatedInletAirHumRat = 0.0111847; // Humidity ratio corresponding to 80F dry bulb/67F wet bulb + Real64 const RatedInletWaterTemp = 29.4444; // 85 F cooling mode + Real64 const RatedAmbAirTemp = 35.0; // 95 F cooling mode + Real64 const RatedInletAirTempHeat = 21.1111; // 21.11C or 70F, heating mode + Real64 const RatedInletWaterTempHeat = 21.1111; // 21.11C or 70F, heating mode + Real64 const RatedAmbAirTempHeat = 8.3333; // 8.33 or 47F, heating mode + Real64 const RatedAmbAirWBHeat = 6.1111; // 8.33 or 43F, heating mode, rated wet bulb temperature + // 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; + + // Curve Types + int const Linear = 1; + int const BiLinear = 2; + int const Quadratic = 3; + int const BiQuadratic = 4; + int const Cubic = 5; + + // 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 + + int const MaxSpedLevels = 10; // Maximum number of speed that supports + + int NumVarSpeedCoils = 0; // The Number of Water to Air Heat Pumps found in the Input + + bool MyOneTimeFlag = true; // one time allocation flag + bool GetCoilsInputFlag = true; // Flag set to make sure you get input once + // LOGICAL, ALLOCATABLE, DIMENSION(:) :: MySizeFlag + + Real64 SourceSideMassFlowRate = 0.0; // Source Side Mass flow rate [Kg/s] + Real64 SourceSideInletTemp = 0.0; // Source Side Inlet Temperature [C] + Real64 SourceSideInletEnth = 0.0; // Source Side Inlet Enthalpy [J/kg] + Real64 LoadSideMassFlowRate = 0.0; // Load Side Mass flow rate [Kg/s] + Real64 LoadSideInletDBTemp = 0.0; // Load Side Inlet Dry Bulb Temp [C] + Real64 LoadSideInletWBTemp = 0.0; // Load Side Inlet Wet Bulb Temp [C] + Real64 LoadSideInletHumRat = 0.0; // Load Side Outlet Humidity ratio + Real64 LoadSideInletEnth = 0.0; // Load Side Inlet Enthalpy [J/kg] + Real64 LoadSideOutletDBTemp = 0.0; // Load Side Outlet Dry Bulb Temp [C] + Real64 LoadSideOutletHumRat = 0.0; // Load Side Outlet Humidity ratio + Real64 LoadSideOutletEnth = 0.0; // Load Side Outlet Enthalpy [J/kg] + Real64 QSensible = 0.0; // Load side sensible heat transfer rate [W] + Real64 QLoadTotal = 0.0; // Load side total heat transfer rate [W] + Real64 QLatRated = 0.0; // Latent Capacity [W] rated at entering air conditions [Tdb=26.7C Twb=19.4C] + Real64 QLatActual = 0.0; // Actual Latent Capacity [W] + Real64 QSource = 0.0; // Source side heat transfer rate [W] + Real64 Winput = 0.0; // Power Consumption [W] + Real64 PLRCorrLoadSideMdot = 0.0; // Load Side Mdot corrected for Part Load Ratio of the unit + + Real64 VSHPWHHeatingCapacity = 0.0; // Used by Heat Pump:Water Heater object as total water heating capacity [W] + Real64 VSHPWHHeatingCOP = 0.0; // Used by Heat Pump:Water Heater object as water heating COP [W/W] + + Array1D VarSpeedCoil; + bool firstTime = true; + + void clear_state() override + { + NumVarSpeedCoils = 0; + MyOneTimeFlag = true; + GetCoilsInputFlag = true; + SourceSideMassFlowRate = 0.0; + SourceSideInletTemp = 0.0; + SourceSideInletEnth = 0.0; + LoadSideMassFlowRate = 0.0; + LoadSideInletDBTemp = 0.0; + LoadSideInletWBTemp = 0.0; + LoadSideInletHumRat = 0.0; + LoadSideInletEnth = 0.0; + LoadSideOutletDBTemp = 0.0; + LoadSideOutletHumRat = 0.0; + LoadSideOutletEnth = 0.0; + QSensible = 0.0; + QLoadTotal = 0.0; + QLatRated = 0.0; + QLatActual = 0.0; + QSource = 0.0; + Winput = 0.0; + PLRCorrLoadSideMdot = 0.0; + VSHPWHHeatingCapacity = 0.0; + VSHPWHHeatingCOP = 0.0; + VarSpeedCoil.deallocate(); + firstTime = true; + } + + // Default Constructor + VariableSpeedCoilsData() = default; +}; } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 48fe5c64d88..338a9a7e650 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -137,100 +137,12 @@ namespace VentilatedSlab { using namespace FluidProperties; // Module Object - std::string const cMO_VentilatedSlab("ZoneHVAC:VentilatedSlab"); - static std::string const BlankString; - // Parameters for outside air control types: - int const Heating_ElectricCoilType(1); - int const Heating_GasCoilType(2); - int const Heating_WaterCoilType(3); - int const Heating_SteamCoilType(4); - int const Cooling_CoilWaterCooling(1); - int const Cooling_CoilDetailedCooling(2); - int const Cooling_CoilHXAssisted(3); - int const VariablePercent(1); - int const FixedTemperature(2); - int const FixedOAControl(3); - int const NotOperating(0); // Parameter for use with OperatingMode variable, set for no heating/cooling - int const HeatingMode(1); // Parameter for use with OperatingMode variable, set for heating - int const CoolingMode(2); // Parameter for use with OperatingMode variable, set for cooling - // Ventilated Slab Configurations - int const SlabOnly(1); // Air circulate through cores of slab only - int const SlabAndZone(2); // Circulated Air is introduced to zone - int const SeriesSlabs(3); - // Control Types - int const MATControl(1); // Controls system using mean air temperature - int const MRTControl(2); // Controls system using mean radiant temperature - int const OPTControl(3); // Controls system using operative temperature - int const ODBControl(4); // Controls system using outside air dry-bulb temperature - int const OWBControl(5); // Controls system using outside air wet-bulb temperature - int const SURControl(6); // Controls system using surface temperature !Phase2-A - int const DPTZControl(7); // Controls system using dew-point temperature of zone!Phase2-A - - // coil operation - int const On(1); // normal coil operation - int const Off(0); // signal coil shouldn't run - int const NoneOption(0); - int const BothOption(1); - int const HeatingOption(2); - int const CoolingOption(3); - int OperatingMode(0); // Used to keep track of whether system is in heating or cooling mode + static std::string const BlankString; static std::string const fluidNameSteam("STEAM"); static std::string const fluidNameWater("WATER"); - // DERIVED TYPE DEFINITIONS - - // MODULE VARIABLE DECLARATIONS: - bool HCoilOn(false); // TRUE if the heating coil (gas or electric especially) should be running - int NumOfVentSlabs(0); // Number of ventilated slab in the input file - Real64 OAMassFlowRate(0.0); // Outside air mass flow rate for the ventilated slab - Array1D_double QRadSysSrcAvg; // Average source over the time step for a particular radiant surfaceD - Array1D ZeroSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source - int MaxCloNumOfSurfaces(0); // Used to set allocate size in CalcClo routine - Real64 QZnReq(0.0); // heating or cooling needed by system [watts] - - // Record keeping variables used to calculate QRadSysSrcAvg locally - - Array1D_double LastQRadSysSrc; // Need to keep the last value in case we are still iterating - Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating - Array1D_bool CheckEquipName; - - // Autosizing variables - bool GetInputFlag(true); - bool MyOneTimeFlag(true); - Array1D_bool MySizeFlag; - - // SUBROUTINE SPECIFICATIONS FOR MODULE VentilatedSlab - // PRIVATE UpdateVentilatedSlabValAvg - - // Object Data - Array1D VentSlab; - Array1D VentSlabNumericFields; - - // Functions - - void clear_state() - { - MyOneTimeFlag = true; - GetInputFlag = true; - HCoilOn = false; - NumOfVentSlabs = 0; - OAMassFlowRate = 0.0; - MaxCloNumOfSurfaces = 0; - QZnReq = 0.0; - QRadSysSrcAvg.deallocate(); - ZeroSourceSumHATsurf.deallocate(); - LastQRadSysSrc.deallocate(); - LastSysTimeElapsed.deallocate(); - LastTimeStepSys.deallocate(); - CheckEquipName.deallocate(); - MySizeFlag.deallocate(); - VentSlab.deallocate(); - VentSlabNumericFields.deallocate(); - } - void SimVentilatedSlab(EnergyPlusData &state, std::string const &CompName, // name of the fan coil unit int const ZoneNum, // number of zone being served @@ -261,30 +173,30 @@ namespace VentilatedSlab { int Item; // index of ventilated slab being simulated // FLOW: - if (GetInputFlag) { + if (state.dataVentilatedSlab->GetInputFlag) { GetVentilatedSlabInput(state); - GetInputFlag = false; + state.dataVentilatedSlab->GetInputFlag = false; } // Find the correct VentilatedSlabInput if (CompIndex == 0) { - Item = UtilityRoutines::FindItemInList(CompName, VentSlab); + Item = UtilityRoutines::FindItemInList(CompName, state.dataVentilatedSlab->VentSlab); if (Item == 0) { ShowFatalError("SimVentilatedSlab: system not found=" + CompName); } CompIndex = Item; } else { Item = CompIndex; - if (Item > NumOfVentSlabs || Item < 1) { + if (Item > state.dataVentilatedSlab->NumOfVentSlabs || Item < 1) { ShowFatalError("SimVentilatedSlab: Invalid CompIndex passed=" + TrimSigDigits(Item) + - ", Number of Systems=" + TrimSigDigits(NumOfVentSlabs) + ", Entered System name=" + CompName); + ", Number of Systems=" + TrimSigDigits(state.dataVentilatedSlab->NumOfVentSlabs) + ", Entered System name=" + CompName); } - if (CheckEquipName(Item)) { - if (CompName != VentSlab(Item).Name) { + if (state.dataVentilatedSlab->CheckEquipName(Item)) { + if (CompName != state.dataVentilatedSlab->VentSlab(Item).Name ) { ShowFatalError("SimVentilatedSlab: Invalid CompIndex passed=" + TrimSigDigits(Item) + ", System name=" + CompName + - ", stored System Name for that index=" + VentSlab(Item).Name); + ", stored System Name for that index=" + state.dataVentilatedSlab->VentSlab(Item).Name); } - CheckEquipName(Item) = false; + state.dataVentilatedSlab->CheckEquipName(Item) = false; } } @@ -294,9 +206,9 @@ namespace VentilatedSlab { CalcVentilatedSlab(state, Item, ZoneNum, FirstHVACIteration, PowerMet, LatOutputProvided); - UpdateVentilatedSlab(Item, FirstHVACIteration); + UpdateVentilatedSlab(state, Item, FirstHVACIteration); - ReportVentilatedSlab(Item); + ReportVentilatedSlab(state, Item); ZoneEqVentedSlab = false; } @@ -389,14 +301,14 @@ namespace VentilatedSlab { // make sure data is gotten for surface lists BaseNum = GetNumberOfSurfListVentSlab(state); - NumOfVentSlabs = inputProcessor->getNumObjectsFound(CurrentModuleObject); + state.dataVentilatedSlab->NumOfVentSlabs = inputProcessor->getNumObjectsFound(CurrentModuleObject); // Allocate the local derived type and do one-time initializations for all parts of it - VentSlab.allocate(NumOfVentSlabs); - CheckEquipName.dimension(NumOfVentSlabs, true); - VentSlabNumericFields.allocate(NumOfVentSlabs); + state.dataVentilatedSlab->VentSlab.allocate(state.dataVentilatedSlab->NumOfVentSlabs); + state.dataVentilatedSlab->CheckEquipName.dimension(state.dataVentilatedSlab->NumOfVentSlabs, true); + state.dataVentilatedSlab->VentSlabNumericFields.allocate(state.dataVentilatedSlab->NumOfVentSlabs); - for (Item = 1; Item <= NumOfVentSlabs; ++Item) { // Begin looping over the entire ventilated slab systems found in the input file... + for (Item = 1; Item <= state.dataVentilatedSlab->NumOfVentSlabs; ++Item) { // Begin looping over the entire ventilated slab systems found in the input file... inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -411,26 +323,26 @@ namespace VentilatedSlab { cAlphaFields, cNumericFields); - VentSlabNumericFields(Item).FieldNames.allocate(NumNumbers); - VentSlabNumericFields(Item).FieldNames = cNumericFields; + state.dataVentilatedSlab->VentSlabNumericFields(Item).FieldNames.allocate(NumNumbers); + state.dataVentilatedSlab->VentSlabNumericFields(Item).FieldNames = cNumericFields; UtilityRoutines::IsNameEmpty(cAlphaArgs(1), CurrentModuleObject, ErrorsFound); - VentSlab(Item).Name = cAlphaArgs(1); - VentSlab(Item).SchedName = cAlphaArgs(2); + state.dataVentilatedSlab->VentSlab(Item).Name = cAlphaArgs(1); + state.dataVentilatedSlab->VentSlab(Item).SchedName = cAlphaArgs(2); if (lAlphaBlanks(2)) { - VentSlab(Item).SchedPtr = ScheduleAlwaysOn; + state.dataVentilatedSlab->VentSlab(Item).SchedPtr = ScheduleAlwaysOn; } else { - VentSlab(Item).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); // convert schedule name to pointer - if (VentSlab(Item).SchedPtr == 0) { + state.dataVentilatedSlab->VentSlab(Item).SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); // convert schedule name to pointer + if (state.dataVentilatedSlab->VentSlab(Item).SchedPtr == 0) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(2) + "=\"" + cAlphaArgs(2) + "\" not found."); ErrorsFound = true; } } - VentSlab(Item).ZoneName = cAlphaArgs(3); - VentSlab(Item).ZonePtr = UtilityRoutines::FindItemInList(cAlphaArgs(3), Zone); - if (VentSlab(Item).ZonePtr == 0) { + state.dataVentilatedSlab->VentSlab(Item).ZoneName = cAlphaArgs(3); + state.dataVentilatedSlab->VentSlab(Item).ZonePtr = UtilityRoutines::FindItemInList(cAlphaArgs(3), Zone); + if (state.dataVentilatedSlab->VentSlab(Item).ZonePtr == 0) { if (lAlphaBlanks(3)) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(3) + " is required but input is blank."); @@ -441,60 +353,60 @@ namespace VentilatedSlab { ErrorsFound = true; } - VentSlab(Item).SurfListName = cAlphaArgs(4); + state.dataVentilatedSlab->VentSlab(Item).SurfListName = cAlphaArgs(4); SurfListNum = 0; // IF (NumOfSlabLists > 0) SurfListNum = UtilityRoutines::FindItemInList(VentSlab(Item)%SurfListName, SlabList%Name, NumOfSlabLists) - if (NumOfSurfListVentSlab > 0) SurfListNum = UtilityRoutines::FindItemInList(VentSlab(Item).SurfListName, SlabList); + if (NumOfSurfListVentSlab > 0) SurfListNum = UtilityRoutines::FindItemInList(state.dataVentilatedSlab->VentSlab(Item).SurfListName, SlabList); if (SurfListNum > 0) { // Found a valid surface list - VentSlab(Item).NumOfSurfaces = SlabList(SurfListNum).NumOfSurfaces; - VentSlab(Item).ZName.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).ZPtr.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).SurfaceName.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).SurfacePtr.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).CDiameter.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).CLength.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).CNumbers.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).SlabIn.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).SlabOut.allocate(VentSlab(Item).NumOfSurfaces); - - MaxCloNumOfSurfaces = max(MaxCloNumOfSurfaces, VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces = SlabList(SurfListNum).NumOfSurfaces; + state.dataVentilatedSlab->VentSlab(Item).ZName.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).ZPtr.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).SurfaceName.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).SurfacePtr.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).CDiameter.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).CLength.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).CNumbers.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).SlabIn.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).SlabOut.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + + state.dataVentilatedSlab->MaxCloNumOfSurfaces = max(state.dataVentilatedSlab->MaxCloNumOfSurfaces, state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); for (SurfNum = 1; SurfNum <= SlabList(SurfListNum).NumOfSurfaces; ++SurfNum) { - VentSlab(Item).ZName(SurfNum) = SlabList(SurfListNum).ZoneName(SurfNum); - VentSlab(Item).ZPtr(SurfNum) = SlabList(SurfListNum).ZonePtr(SurfNum); - VentSlab(Item).SurfaceName(SurfNum) = SlabList(SurfListNum).SurfName(SurfNum); - VentSlab(Item).SurfacePtr(SurfNum) = SlabList(SurfListNum).SurfPtr(SurfNum); - VentSlab(Item).CDiameter(SurfNum) = SlabList(SurfListNum).CoreDiameter(SurfNum); - VentSlab(Item).CLength(SurfNum) = SlabList(SurfListNum).CoreLength(SurfNum); - VentSlab(Item).CNumbers(SurfNum) = SlabList(SurfListNum).CoreNumbers(SurfNum); - VentSlab(Item).SlabIn(SurfNum) = SlabList(SurfListNum).SlabInNodeName(SurfNum); - VentSlab(Item).SlabOut(SurfNum) = SlabList(SurfListNum).SlabOutNodeName(SurfNum); - if (VentSlab(Item).SurfacePtr(SurfNum) != 0) { - Surface(VentSlab(Item).SurfacePtr(SurfNum)).IntConvSurfHasActiveInIt = true; + state.dataVentilatedSlab->VentSlab(Item).ZName(SurfNum) = SlabList(SurfListNum).ZoneName(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).ZPtr(SurfNum) = SlabList(SurfListNum).ZonePtr(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).SurfaceName(SurfNum) = SlabList(SurfListNum).SurfName(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum) = SlabList(SurfListNum).SurfPtr(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).CDiameter(SurfNum) = SlabList(SurfListNum).CoreDiameter(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).CLength(SurfNum) = SlabList(SurfListNum).CoreLength(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).CNumbers(SurfNum) = SlabList(SurfListNum).CoreNumbers(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).SlabIn(SurfNum) = SlabList(SurfListNum).SlabInNodeName(SurfNum); + state.dataVentilatedSlab->VentSlab(Item).SlabOut(SurfNum) = SlabList(SurfListNum).SlabOutNodeName(SurfNum); + if (state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum) != 0) { + Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).IntConvSurfHasActiveInIt = true; } } } else { // User entered a single surface name rather than a surface list - VentSlab(Item).NumOfSurfaces = 1; - VentSlab(Item).SurfacePtr.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).SurfaceName.allocate(VentSlab(Item).NumOfSurfaces); - VentSlab(Item).SurfaceFlowFrac.allocate(VentSlab(Item).NumOfSurfaces); - MaxCloNumOfSurfaces = max(MaxCloNumOfSurfaces, VentSlab(Item).NumOfSurfaces); - VentSlab(Item).SurfaceName(1) = VentSlab(Item).SurfListName; - VentSlab(Item).SurfacePtr(1) = UtilityRoutines::FindItemInList(VentSlab(Item).SurfaceName(1), Surface); - VentSlab(Item).SurfaceFlowFrac(1) = 1.0; + state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces = 1; + state.dataVentilatedSlab->VentSlab(Item).SurfacePtr.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).SurfaceName.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).SurfaceFlowFrac.allocate(state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->MaxCloNumOfSurfaces = max(state.dataVentilatedSlab->MaxCloNumOfSurfaces, state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces); + state.dataVentilatedSlab->VentSlab(Item).SurfaceName(1) = state.dataVentilatedSlab->VentSlab(Item).SurfListName; + state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(1) = UtilityRoutines::FindItemInList(state.dataVentilatedSlab->VentSlab(Item).SurfaceName(1), Surface); + state.dataVentilatedSlab->VentSlab(Item).SurfaceFlowFrac(1) = 1.0; // Error checking for single surfaces - if (VentSlab(Item).SurfacePtr(1) == 0) { + if (state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(1) == 0) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(4) + "=\"" + cAlphaArgs(4) + "\" not found."); ErrorsFound = true; - } else if (Surface(VentSlab(Item).SurfacePtr(1)).IsRadSurfOrVentSlabOrPool) { + } else if (Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(1)).IsRadSurfOrVentSlabOrPool) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid Surface"); ShowContinueError(cAlphaFields(4) + "=\"" + cAlphaArgs(4) + "\" has been used in another radiant system or ventilated slab."); ErrorsFound = true; } - if (VentSlab(Item).SurfacePtr(1) != 0) { - Surface(VentSlab(Item).SurfacePtr(1)).IntConvSurfHasActiveInIt = true; - Surface(VentSlab(Item).SurfacePtr(1)).IsRadSurfOrVentSlabOrPool = true; + if (state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(1) != 0) { + Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(1)).IntConvSurfHasActiveInIt = true; + Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(1)).IsRadSurfOrVentSlabOrPool = true; } } @@ -502,87 +414,87 @@ namespace VentilatedSlab { if (SurfListNum > 0) { - for (SurfNum = 1; SurfNum <= VentSlab(Item).NumOfSurfaces; ++SurfNum) { + for (SurfNum = 1; SurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++SurfNum) { - if (VentSlab(Item).SurfacePtr(SurfNum) == 0) continue; // invalid surface -- detected earlier - if (VentSlab(Item).ZPtr(SurfNum) == 0) continue; // invalid zone -- detected earlier - // IF (Surface(VentSlab(Item)%SurfacePtr(SurfNum))%Zone /= VentSlab(Item)%ZPtr(SurfNum)) THEN + if (state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum) == 0) continue; // invalid surface -- detected earlier + if (state.dataVentilatedSlab->VentSlab(Item).ZPtr(SurfNum) == 0) continue; // invalid zone -- detected earlier + // IF (Surface(VentSlab(Item)%SurfacePtr(SurfNum))%Zone /= state.dataVentilatedSlab->VentSlab(Item)%ZPtr(SurfNum)) THEN // CALL ShowSevereError(TRIM(CurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))//'" invalid '// & // 'surface="'//TRIM(Surface(VentSlab(Item)%SurfacePtr(SurfNum))%Name)//'".') // CALL ShowContinueError('Surface in Zone='//TRIM(Zone(Surface(VentSlab(Item)%SurfacePtr(SurfNum))%Zone)%Name)//' '// & // CurrentModuleObject//' in Zone='//TRIM(cAlphaArgs(3))) // ErrorsFound=.TRUE. // END IF - if (Surface(VentSlab(Item).SurfacePtr(SurfNum)).Construction == 0) continue; // invalid construction, detected earlier - if (!dataConstruction.Construct(Surface(VentSlab(Item).SurfacePtr(SurfNum)).Construction).SourceSinkPresent) { + if (Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Construction == 0) continue; // invalid construction, detected earlier + if (!state.dataConstruction->Construct(Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Construction).SourceSinkPresent) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid surface=\"" + - Surface(VentSlab(Item).SurfacePtr(SurfNum)).Name + "\"."); + Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Name + "\"."); ShowContinueError("Surface Construction does not have a source/sink, Construction name= \"" + - dataConstruction.Construct(Surface(VentSlab(Item).SurfacePtr(SurfNum)).Construction).Name + "\"."); + state.dataConstruction->Construct(Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Construction).Name + "\"."); ErrorsFound = true; } } } else { - for (SurfNum = 1; SurfNum <= VentSlab(Item).NumOfSurfaces; ++SurfNum) { - if (VentSlab(Item).SurfacePtr(SurfNum) == 0) continue; // invalid surface -- detected earlier - if (VentSlab(Item).ZonePtr == 0) continue; // invalid zone -- detected earlier - if (Surface(VentSlab(Item).SurfacePtr(SurfNum)).Zone != VentSlab(Item).ZonePtr) { + for (SurfNum = 1; SurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++SurfNum) { + if (state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum) == 0) continue; // invalid surface -- detected earlier + if (state.dataVentilatedSlab->VentSlab(Item).ZonePtr == 0) continue; // invalid zone -- detected earlier + if (Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Zone != state.dataVentilatedSlab->VentSlab(Item).ZonePtr) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid surface=\"" + - Surface(VentSlab(Item).SurfacePtr(SurfNum)).Name + "\"."); - ShowContinueError("Surface in Zone=" + Zone(Surface(VentSlab(Item).SurfacePtr(SurfNum)).Zone).Name + ' ' + + Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Name + "\"."); + ShowContinueError("Surface in Zone=" + Zone(Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Zone).Name + ' ' + CurrentModuleObject + " in Zone=" + cAlphaArgs(3)); ErrorsFound = true; } - if (Surface(VentSlab(Item).SurfacePtr(SurfNum)).Construction == 0) continue; // invalid construction, detected earlier - if (!dataConstruction.Construct(Surface(VentSlab(Item).SurfacePtr(SurfNum)).Construction).SourceSinkPresent) { + if (Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Construction == 0) continue; // invalid construction, detected earlier + if (!state.dataConstruction->Construct(Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Construction).SourceSinkPresent) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid surface=\"" + - Surface(VentSlab(Item).SurfacePtr(SurfNum)).Name + "\"."); + Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Name + "\"."); ShowContinueError("Surface Construction does not have a source/sink, Construction name= \"" + - dataConstruction.Construct(Surface(VentSlab(Item).SurfacePtr(SurfNum)).Construction).Name + "\"."); + state.dataConstruction->Construct(Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(SurfNum)).Construction).Name + "\"."); ErrorsFound = true; } } } - VentSlab(Item).MaxAirVolFlow = rNumericArgs(1); + state.dataVentilatedSlab->VentSlab(Item).MaxAirVolFlow = rNumericArgs(1); // Outside air information: - VentSlab(Item).MinOutAirVolFlow = rNumericArgs(2); - VentSlab(Item).OutAirVolFlow = rNumericArgs(3); + state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow = rNumericArgs(2); + state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow = rNumericArgs(3); { auto const SELECT_CASE_var(cAlphaArgs(5)); if (SELECT_CASE_var == "VARIABLEPERCENT") { - VentSlab(Item).OAControlType = VariablePercent; - VentSlab(Item).MaxOASchedName = cAlphaArgs(6); - VentSlab(Item).MaxOASchedPtr = GetScheduleIndex(state, cAlphaArgs(7)); // convert schedule name to pointer - if (VentSlab(Item).MaxOASchedPtr == 0) { + state.dataVentilatedSlab->VentSlab(Item).OAControlType = state.dataVentilatedSlab->VariablePercent; + state.dataVentilatedSlab->VentSlab(Item).MaxOASchedName = cAlphaArgs(6); + state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr = GetScheduleIndex(state, cAlphaArgs(7)); // convert schedule name to pointer + if (state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr == 0) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(7) + "=\"" + cAlphaArgs(7) + "\" not found."); ErrorsFound = true; - } else if (!CheckScheduleValueMinMax(VentSlab(Item).MaxOASchedPtr, ">=0", 0.0, "<=", 1.0)) { + } else if (!CheckScheduleValueMinMax(state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr, ">=0", 0.0, "<=", 1.0)) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(7) + "=\"" + cAlphaArgs(7) + "\" values out of range [0,1]."); ErrorsFound = true; } } else if (SELECT_CASE_var == "FIXEDAMOUNT") { - VentSlab(Item).OAControlType = FixedOAControl; - VentSlab(Item).MaxOASchedName = cAlphaArgs(7); - VentSlab(Item).MaxOASchedPtr = GetScheduleIndex(state, cAlphaArgs(7)); // convert schedule name to pointer - if (VentSlab(Item).MaxOASchedPtr == 0) { + state.dataVentilatedSlab->VentSlab(Item).OAControlType = state.dataVentilatedSlab->FixedOAControl; + state.dataVentilatedSlab->VentSlab(Item).MaxOASchedName = cAlphaArgs(7); + state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr = GetScheduleIndex(state, cAlphaArgs(7)); // convert schedule name to pointer + if (state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr == 0) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(7) + "=\"" + cAlphaArgs(7) + "\" not found."); ErrorsFound = true; - } else if (!CheckScheduleValueMinMax(VentSlab(Item).MaxOASchedPtr, ">=0", 0.0)) { + } else if (!CheckScheduleValueMinMax(state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr, ">=0", 0.0)) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(7) + "=\"" + cAlphaArgs(7) + "\" values out of range (must be >=0)."); ErrorsFound = true; } } else if (SELECT_CASE_var == "FIXEDTEMPERATURE") { - VentSlab(Item).OAControlType = FixedTemperature; - VentSlab(Item).TempSchedName = cAlphaArgs(7); - VentSlab(Item).TempSchedPtr = GetScheduleIndex(state, cAlphaArgs(7)); // convert schedule name to pointer - if (VentSlab(Item).TempSchedPtr == 0) { + state.dataVentilatedSlab->VentSlab(Item).OAControlType = state.dataVentilatedSlab->FixedTemperature; + state.dataVentilatedSlab->VentSlab(Item).TempSchedName = cAlphaArgs(7); + state.dataVentilatedSlab->VentSlab(Item).TempSchedPtr = GetScheduleIndex(state, cAlphaArgs(7)); // convert schedule name to pointer + if (state.dataVentilatedSlab->VentSlab(Item).TempSchedPtr == 0) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(7) + "=\"" + cAlphaArgs(7) + "\" not found."); ErrorsFound = true; @@ -592,9 +504,9 @@ namespace VentilatedSlab { } } - VentSlab(Item).MinOASchedName = cAlphaArgs(6); - VentSlab(Item).MinOASchedPtr = GetScheduleIndex(state, cAlphaArgs(6)); // convert schedule name to pointer - if (VentSlab(Item).MinOASchedPtr == 0) { + state.dataVentilatedSlab->VentSlab(Item).MinOASchedName = cAlphaArgs(6); + state.dataVentilatedSlab->VentSlab(Item).MinOASchedPtr = GetScheduleIndex(state, cAlphaArgs(6)); // convert schedule name to pointer + if (state.dataVentilatedSlab->VentSlab(Item).MinOASchedPtr == 0) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(6) + "=\"" + cAlphaArgs(6) + "\" not found."); ErrorsFound = true; @@ -602,21 +514,21 @@ namespace VentilatedSlab { // System Configuration: if (UtilityRoutines::SameString(cAlphaArgs(8), "SlabOnly")) { - VentSlab(Item).SysConfg = SlabOnly; + state.dataVentilatedSlab->VentSlab(Item).SysConfg = state.dataVentilatedSlab->SlabOnly; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "SlabAndZone")) { - VentSlab(Item).SysConfg = SlabAndZone; + state.dataVentilatedSlab->VentSlab(Item).SysConfg = state.dataVentilatedSlab->SlabAndZone; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "SeriesSlabs")) { - VentSlab(Item).SysConfg = SeriesSlabs; + state.dataVentilatedSlab->VentSlab(Item).SysConfg = state.dataVentilatedSlab->SeriesSlabs; } else { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(8) + "=\"" + cAlphaArgs(8) + "\"."); ShowContinueError("Control reset to SLAB ONLY Configuration."); - VentSlab(Item).SysConfg = SlabOnly; + state.dataVentilatedSlab->VentSlab(Item).SysConfg = state.dataVentilatedSlab->SlabOnly; } // Hollow Core information : - VentSlab(Item).CoreDiameter = rNumericArgs(4); - VentSlab(Item).CoreLength = rNumericArgs(5); - VentSlab(Item).CoreNumbers = rNumericArgs(6); + state.dataVentilatedSlab->VentSlab(Item).CoreDiameter = rNumericArgs(4); + state.dataVentilatedSlab->VentSlab(Item).CoreLength = rNumericArgs(5); + state.dataVentilatedSlab->VentSlab(Item).CoreNumbers = rNumericArgs(6); if (UtilityRoutines::SameString(cAlphaArgs(8), "SurfaceListNames")) { if (!lNumericBlanks(4)) { @@ -644,31 +556,31 @@ namespace VentilatedSlab { // Process the temperature control type if (UtilityRoutines::SameString(cAlphaArgs(9), OutsideAirDryBulbTemperature)) { - VentSlab(Item).ControlType = ODBControl; + state.dataVentilatedSlab->VentSlab(Item).ControlType = state.dataVentilatedSlab->ODBControl; } else if (UtilityRoutines::SameString(cAlphaArgs(9), OutsideAirWetBulbTemperature)) { - VentSlab(Item).ControlType = OWBControl; + state.dataVentilatedSlab->VentSlab(Item).ControlType = state.dataVentilatedSlab->OWBControl; } else if (UtilityRoutines::SameString(cAlphaArgs(9), OperativeTemperature)) { - VentSlab(Item).ControlType = OPTControl; + state.dataVentilatedSlab->VentSlab(Item).ControlType = state.dataVentilatedSlab->OPTControl; } else if (UtilityRoutines::SameString(cAlphaArgs(9), MeanAirTemperature)) { - VentSlab(Item).ControlType = MATControl; + state.dataVentilatedSlab->VentSlab(Item).ControlType = state.dataVentilatedSlab->MATControl; } else if (UtilityRoutines::SameString(cAlphaArgs(9), MeanRadiantTemperature)) { - VentSlab(Item).ControlType = MRTControl; + state.dataVentilatedSlab->VentSlab(Item).ControlType = state.dataVentilatedSlab->MRTControl; } else if (UtilityRoutines::SameString(cAlphaArgs(9), SlabSurfaceTemperature)) { - VentSlab(Item).ControlType = SURControl; + state.dataVentilatedSlab->VentSlab(Item).ControlType = state.dataVentilatedSlab->SURControl; } else if (UtilityRoutines::SameString(cAlphaArgs(9), SlabSurfaceDewPointTemperature)) { - VentSlab(Item).ControlType = DPTZControl; + state.dataVentilatedSlab->VentSlab(Item).ControlType = state.dataVentilatedSlab->DPTZControl; } else { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(9) + "=\"" + cAlphaArgs(9) + "\"."); ShowContinueError("Control reset to ODB control."); - VentSlab(Item).ControlType = ODBControl; + state.dataVentilatedSlab->VentSlab(Item).ControlType = state.dataVentilatedSlab->ODBControl; } // Heating User Input Data For Ventilated Slab Control : // High Air Temp : - VentSlab(Item).HotAirHiTempSched = cAlphaArgs(10); - VentSlab(Item).HotAirHiTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(10)); - if ((VentSlab(Item).HotAirHiTempSchedPtr == 0) && (!lAlphaBlanks(10))) { + state.dataVentilatedSlab->VentSlab(Item).HotAirHiTempSched = cAlphaArgs(10); + state.dataVentilatedSlab->VentSlab(Item).HotAirHiTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(10)); + if ((state.dataVentilatedSlab->VentSlab(Item).HotAirHiTempSchedPtr == 0) && (!lAlphaBlanks(10))) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(10) + "=\"" + cAlphaArgs(10) + "\" not found."); ErrorsFound = true; @@ -676,25 +588,25 @@ namespace VentilatedSlab { // Low Air Temp : - VentSlab(Item).HotAirLoTempSched = cAlphaArgs(11); - VentSlab(Item).HotAirLoTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(11)); - if ((VentSlab(Item).HotAirLoTempSchedPtr == 0) && (!lAlphaBlanks(11))) { + state.dataVentilatedSlab->VentSlab(Item).HotAirLoTempSched = cAlphaArgs(11); + state.dataVentilatedSlab->VentSlab(Item).HotAirLoTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(11)); + if ((state.dataVentilatedSlab->VentSlab(Item).HotAirLoTempSchedPtr == 0) && (!lAlphaBlanks(11))) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(11) + "=\"" + cAlphaArgs(11) + "\" not found."); ErrorsFound = true; } - VentSlab(Item).HotCtrlHiTempSched = cAlphaArgs(12); - VentSlab(Item).HotCtrlHiTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(12)); - if ((VentSlab(Item).HotCtrlHiTempSchedPtr == 0) && (!lAlphaBlanks(12))) { + state.dataVentilatedSlab->VentSlab(Item).HotCtrlHiTempSched = cAlphaArgs(12); + state.dataVentilatedSlab->VentSlab(Item).HotCtrlHiTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(12)); + if ((state.dataVentilatedSlab->VentSlab(Item).HotCtrlHiTempSchedPtr == 0) && (!lAlphaBlanks(12))) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(12) + "=\"" + cAlphaArgs(12) + "\" not found."); ErrorsFound = true; } - VentSlab(Item).HotCtrlLoTempSched = cAlphaArgs(13); - VentSlab(Item).HotCtrlLoTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(13)); - if ((VentSlab(Item).HotCtrlLoTempSchedPtr == 0) && (!lAlphaBlanks(13))) { + state.dataVentilatedSlab->VentSlab(Item).HotCtrlLoTempSched = cAlphaArgs(13); + state.dataVentilatedSlab->VentSlab(Item).HotCtrlLoTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(13)); + if ((state.dataVentilatedSlab->VentSlab(Item).HotCtrlLoTempSchedPtr == 0) && (!lAlphaBlanks(13))) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(13) + "=\"" + cAlphaArgs(13) + "\" not found."); ErrorsFound = true; @@ -702,9 +614,9 @@ namespace VentilatedSlab { // Cooling User Input Data For Ventilated Slab Control : // Cooling High Temp Sch. - VentSlab(Item).ColdAirHiTempSched = cAlphaArgs(13); - VentSlab(Item).ColdAirHiTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(14)); - if ((VentSlab(Item).ColdAirHiTempSchedPtr == 0) && (!lAlphaBlanks(14))) { + state.dataVentilatedSlab->VentSlab(Item).ColdAirHiTempSched = cAlphaArgs(13); + state.dataVentilatedSlab->VentSlab(Item).ColdAirHiTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(14)); + if ((state.dataVentilatedSlab->VentSlab(Item).ColdAirHiTempSchedPtr == 0) && (!lAlphaBlanks(14))) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(14) + "=\"" + cAlphaArgs(14) + "\" not found."); ErrorsFound = true; @@ -712,9 +624,9 @@ namespace VentilatedSlab { // Cooling Low Temp Sch. - VentSlab(Item).ColdAirLoTempSched = cAlphaArgs(15); - VentSlab(Item).ColdAirLoTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(15)); - if ((VentSlab(Item).ColdAirLoTempSchedPtr == 0) && (!lAlphaBlanks(15))) { + state.dataVentilatedSlab->VentSlab(Item).ColdAirLoTempSched = cAlphaArgs(15); + state.dataVentilatedSlab->VentSlab(Item).ColdAirLoTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(15)); + if ((state.dataVentilatedSlab->VentSlab(Item).ColdAirLoTempSchedPtr == 0) && (!lAlphaBlanks(15))) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(15) + "=\"" + cAlphaArgs(15) + "\" not found."); ErrorsFound = true; @@ -722,9 +634,9 @@ namespace VentilatedSlab { // Cooling Control High Sch. - VentSlab(Item).ColdCtrlHiTempSched = cAlphaArgs(16); - VentSlab(Item).ColdCtrlHiTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(16)); - if ((VentSlab(Item).ColdCtrlHiTempSchedPtr == 0) && (!lAlphaBlanks(16))) { + state.dataVentilatedSlab->VentSlab(Item).ColdCtrlHiTempSched = cAlphaArgs(16); + state.dataVentilatedSlab->VentSlab(Item).ColdCtrlHiTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(16)); + if ((state.dataVentilatedSlab->VentSlab(Item).ColdCtrlHiTempSchedPtr == 0) && (!lAlphaBlanks(16))) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(16) + "=\"" + cAlphaArgs(16) + "\" not found."); ErrorsFound = true; @@ -732,9 +644,9 @@ namespace VentilatedSlab { // Cooling Control Low Sch. - VentSlab(Item).ColdCtrlLoTempSched = cAlphaArgs(17); - VentSlab(Item).ColdCtrlLoTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(17)); - if ((VentSlab(Item).ColdCtrlLoTempSchedPtr == 0) && (!lAlphaBlanks(17))) { + state.dataVentilatedSlab->VentSlab(Item).ColdCtrlLoTempSched = cAlphaArgs(17); + state.dataVentilatedSlab->VentSlab(Item).ColdCtrlLoTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(17)); + if ((state.dataVentilatedSlab->VentSlab(Item).ColdCtrlLoTempSchedPtr == 0) && (!lAlphaBlanks(17))) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(17) + "=\"" + cAlphaArgs(17) + "\" not found."); ErrorsFound = true; @@ -773,9 +685,9 @@ namespace VentilatedSlab { // %OutsideAirNode is the outdoor air inlet to the OA mixer // For all types of ventilated slab, this is NodeConnectionType_Inlet,ObjectIsNotParent, -OA MIXER - if (VentSlab(Item).SysConfg == SlabOnly) { + if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabOnly) { - VentSlab(Item).ReturnAirNode = GetOnlySingleNode(state, cAlphaArgs(18), + state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode = GetOnlySingleNode(state, cAlphaArgs(18), ErrorsFound, CurrentModuleObject + "-OA MIXER", cAlphaArgs(1) + "-OA MIXER", @@ -783,10 +695,10 @@ namespace VentilatedSlab { NodeConnectionType_Internal, 1, ObjectIsNotParent); - VentSlab(Item).RadInNode = GetOnlySingleNode(state, + state.dataVentilatedSlab->VentSlab(Item).RadInNode = GetOnlySingleNode(state, cAlphaArgs(19), ErrorsFound, CurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - VentSlab(Item).OAMixerOutNode = GetOnlySingleNode(state, cAlphaArgs(23), + state.dataVentilatedSlab->VentSlab(Item).OAMixerOutNode = GetOnlySingleNode(state, cAlphaArgs(23), ErrorsFound, CurrentModuleObject + "-OA MIXER", cAlphaArgs(1) + "-OA MIXER", @@ -794,12 +706,12 @@ namespace VentilatedSlab { NodeConnectionType_Outlet, 1, ObjectIsNotParent); - VentSlab(Item).FanOutletNode = GetOnlySingleNode(state, + state.dataVentilatedSlab->VentSlab(Item).FanOutletNode = GetOnlySingleNode(state, cAlphaArgs(24), ErrorsFound, CurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Internal, 1, ObjectIsParent); - } else if (VentSlab(Item).SysConfg == SeriesSlabs) { + } else if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SeriesSlabs) { - VentSlab(Item).ReturnAirNode = GetOnlySingleNode(state, cAlphaArgs(18), + state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode = GetOnlySingleNode(state, cAlphaArgs(18), ErrorsFound, CurrentModuleObject + "-OA MIXER", cAlphaArgs(1) + "-OA MIXER", @@ -807,10 +719,10 @@ namespace VentilatedSlab { NodeConnectionType_Internal, 1, ObjectIsNotParent); - VentSlab(Item).RadInNode = GetOnlySingleNode(state, + state.dataVentilatedSlab->VentSlab(Item).RadInNode = GetOnlySingleNode(state, cAlphaArgs(19), ErrorsFound, CurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - VentSlab(Item).OAMixerOutNode = GetOnlySingleNode(state, cAlphaArgs(23), + state.dataVentilatedSlab->VentSlab(Item).OAMixerOutNode = GetOnlySingleNode(state, cAlphaArgs(23), ErrorsFound, CurrentModuleObject + "-OA MIXER", cAlphaArgs(1) + "-OA MIXER", @@ -818,12 +730,12 @@ namespace VentilatedSlab { NodeConnectionType_Outlet, 1, ObjectIsNotParent); - VentSlab(Item).FanOutletNode = GetOnlySingleNode(state, + state.dataVentilatedSlab->VentSlab(Item).FanOutletNode = GetOnlySingleNode(state, cAlphaArgs(24), ErrorsFound, CurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Internal, 1, ObjectIsParent); - } else if (VentSlab(Item).SysConfg == SlabAndZone) { + } else if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabAndZone) { - VentSlab(Item).ReturnAirNode = GetOnlySingleNode(state, cAlphaArgs(18), + state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode = GetOnlySingleNode(state, cAlphaArgs(18), ErrorsFound, CurrentModuleObject + "-SYSTEM", cAlphaArgs(1) + "-SYSTEM", @@ -831,7 +743,7 @@ namespace VentilatedSlab { NodeConnectionType_Inlet, 1, ObjectIsParent); - VentSlab(Item).ReturnAirNode = GetOnlySingleNode(state, cAlphaArgs(18), + state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode = GetOnlySingleNode(state, cAlphaArgs(18), ErrorsFound, CurrentModuleObject + "-OA MIXER", cAlphaArgs(1) + "-OA MIXER", @@ -839,9 +751,9 @@ namespace VentilatedSlab { NodeConnectionType_Inlet, 1, ObjectIsNotParent); - VentSlab(Item).RadInNode = GetOnlySingleNode(state, + state.dataVentilatedSlab->VentSlab(Item).RadInNode = GetOnlySingleNode(state, cAlphaArgs(19), ErrorsFound, CurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - VentSlab(Item).OAMixerOutNode = GetOnlySingleNode(state, cAlphaArgs(23), + state.dataVentilatedSlab->VentSlab(Item).OAMixerOutNode = GetOnlySingleNode(state, cAlphaArgs(23), ErrorsFound, CurrentModuleObject + "-OA MIXER", cAlphaArgs(1) + "-OA MIXER", @@ -849,25 +761,25 @@ namespace VentilatedSlab { NodeConnectionType_Outlet, 1, ObjectIsNotParent); - VentSlab(Item).FanOutletNode = GetOnlySingleNode(state, + state.dataVentilatedSlab->VentSlab(Item).FanOutletNode = GetOnlySingleNode(state, cAlphaArgs(24), ErrorsFound, CurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Internal, 1, ObjectIsParent); } - if (VentSlab(Item).SysConfg == SlabOnly) { + if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabOnly) { if (!lAlphaBlanks(20)) { ShowWarningError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" " + cAlphaFields(20) + "=\"" + cAlphaArgs(20) + "\" not needed - ignored."); ShowContinueError("It is used for \"SlabAndZone\" only"); } - } else if (VentSlab(Item).SysConfg == SlabAndZone) { + } else if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabAndZone) { if (lAlphaBlanks(20)) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(20) + " is blank and must be entered."); ErrorsFound = true; } - VentSlab(Item).ZoneAirInNode = GetOnlySingleNode(state, cAlphaArgs(20), + state.dataVentilatedSlab->VentSlab(Item).ZoneAirInNode = GetOnlySingleNode(state, cAlphaArgs(20), ErrorsFound, CurrentModuleObject + "-SYSTEM", cAlphaArgs(1) + "-SYSTEM", @@ -876,12 +788,12 @@ namespace VentilatedSlab { 1, ObjectIsParent); - VentSlab(Item).ZoneAirInNode = GetOnlySingleNode(state, + state.dataVentilatedSlab->VentSlab(Item).ZoneAirInNode = GetOnlySingleNode(state, cAlphaArgs(20), ErrorsFound, CurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent); } // Set connection type to 'Inlet', because it now uses an OA node - VentSlab(Item).OutsideAirNode = GetOnlySingleNode(state, cAlphaArgs(21), + state.dataVentilatedSlab->VentSlab(Item).OutsideAirNode = GetOnlySingleNode(state, cAlphaArgs(21), ErrorsFound, CurrentModuleObject + "-OA MIXER", cAlphaArgs(1) + "-OA MIXER", @@ -891,13 +803,13 @@ namespace VentilatedSlab { ObjectIsNotParent); if (!lAlphaBlanks(21)) { - CheckAndAddAirNodeNumber(state, VentSlab(Item).OutsideAirNode, IsValid); + CheckAndAddAirNodeNumber(state, state.dataVentilatedSlab->VentSlab(Item).OutsideAirNode, IsValid); if (!IsValid) { ShowWarningError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", Adding OutdoorAir:Node=" + cAlphaArgs(21)); } } - VentSlab(Item).AirReliefNode = GetOnlySingleNode(state, cAlphaArgs(22), + state.dataVentilatedSlab->VentSlab(Item).AirReliefNode = GetOnlySingleNode(state, cAlphaArgs(22), ErrorsFound, CurrentModuleObject + "-OA MIXER", cAlphaArgs(1) + "-OA MIXER", @@ -907,51 +819,51 @@ namespace VentilatedSlab { ObjectIsNotParent); // Fan information: - VentSlab(Item).FanName = cAlphaArgs(25); + state.dataVentilatedSlab->VentSlab(Item).FanName = cAlphaArgs(25); - if (HVACFan::checkIfFanNameIsAFanSystem(state, VentSlab(Item).FanName)) { - VentSlab(Item).FanType_Num = DataHVACGlobals::FanType_SystemModelObject; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, VentSlab(Item).FanName)); - VentSlab(Item).Fan_Index = HVACFan::getFanObjectVectorIndex(VentSlab(Item).FanName); + if (HVACFan::checkIfFanNameIsAFanSystem(state, state.dataVentilatedSlab->VentSlab(Item).FanName)) { + state.dataVentilatedSlab->VentSlab(Item).FanType_Num = DataHVACGlobals::FanType_SystemModelObject; + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, state.dataVentilatedSlab->VentSlab(Item).FanName)); + state.dataVentilatedSlab->VentSlab(Item).Fan_Index = HVACFan::getFanObjectVectorIndex(state.dataVentilatedSlab->VentSlab(Item).FanName); } else { bool isNotOkay(false); - ValidateComponent(state, "FAN:CONSTANTVOLUME", VentSlab(Item).FanName, isNotOkay, "GetPIUs"); + ValidateComponent(state, "FAN:CONSTANTVOLUME", state.dataVentilatedSlab->VentSlab(Item).FanName, isNotOkay, "GetPIUs"); if (isNotOkay) { - ShowContinueError("In " + CurrentModuleObject + " = " + VentSlab(Item).Name); + ShowContinueError("In " + CurrentModuleObject + " = " + state.dataVentilatedSlab->VentSlab(Item).Name); ErrorsFound = true; } - VentSlab(Item).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; + state.dataVentilatedSlab->VentSlab(Item).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; } - if (VentSlab(Item).OAControlType == FixedOAControl) { - VentSlab(Item).OutAirVolFlow = VentSlab(Item).MinOutAirVolFlow; - VentSlab(Item).MaxOASchedName = VentSlab(Item).MinOASchedName; - VentSlab(Item).MaxOASchedPtr = GetScheduleIndex(state, VentSlab(Item).MinOASchedName); + if (state.dataVentilatedSlab->VentSlab(Item).OAControlType == state.dataVentilatedSlab->FixedOAControl) { + state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow = state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow; + state.dataVentilatedSlab->VentSlab(Item).MaxOASchedName = state.dataVentilatedSlab->VentSlab(Item).MinOASchedName; + state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr = GetScheduleIndex(state, state.dataVentilatedSlab->VentSlab(Item).MinOASchedName); } // Add fan to component sets array SetUpCompSets( - CurrentModuleObject + "-SYSTEM", VentSlab(Item).Name + "-SYSTEM", "UNDEFINED", cAlphaArgs(25), cAlphaArgs(23), cAlphaArgs(24)); + CurrentModuleObject + "-SYSTEM", state.dataVentilatedSlab->VentSlab(Item).Name + "-SYSTEM", "UNDEFINED", cAlphaArgs(25), cAlphaArgs(23), cAlphaArgs(24)); // Coil options assign { auto const SELECT_CASE_var(cAlphaArgs(26)); if (SELECT_CASE_var == "HEATINGANDCOOLING") { - VentSlab(Item).CoilOption = BothOption; + state.dataVentilatedSlab->VentSlab(Item).CoilOption = state.dataVentilatedSlab->BothOption; } else if (SELECT_CASE_var == "HEATING") { - VentSlab(Item).CoilOption = HeatingOption; + state.dataVentilatedSlab->VentSlab(Item).CoilOption = state.dataVentilatedSlab->HeatingOption; } else if (SELECT_CASE_var == "COOLING") { - VentSlab(Item).CoilOption = CoolingOption; + state.dataVentilatedSlab->VentSlab(Item).CoilOption = state.dataVentilatedSlab->CoolingOption; } else if (SELECT_CASE_var == "NONE") { - VentSlab(Item).CoilOption = NoneOption; + state.dataVentilatedSlab->VentSlab(Item).CoilOption = state.dataVentilatedSlab->NoneOption; } else { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(26) + "=\"" + cAlphaArgs(26) + "\"."); ErrorsFound = true; } } - if (VentSlab(Item).CoilOption == BothOption || VentSlab(Item).CoilOption == HeatingOption) { + if (state.dataVentilatedSlab->VentSlab(Item).CoilOption == state.dataVentilatedSlab->BothOption || state.dataVentilatedSlab->VentSlab(Item).CoilOption == state.dataVentilatedSlab->HeatingOption) { // Heating coil information: // A27, \field Heating Coil Object Type // \type choice @@ -965,29 +877,29 @@ namespace VentilatedSlab { // Heating coil information: if (!lAlphaBlanks(28)) { - VentSlab(Item).HCoilPresent = true; - VentSlab(Item).HCoilTypeCh = cAlphaArgs(27); + state.dataVentilatedSlab->VentSlab(Item).HCoilPresent = true; + state.dataVentilatedSlab->VentSlab(Item).HCoilTypeCh = cAlphaArgs(27); errFlag = false; { auto const SELECT_CASE_var(cAlphaArgs(27)); if (SELECT_CASE_var == "COIL:HEATING:WATER") { - VentSlab(Item).HCoilType = Heating_WaterCoilType; - VentSlab(Item).HCoil_PlantTypeNum = TypeOf_CoilWaterSimpleHeating; + state.dataVentilatedSlab->VentSlab(Item).HCoilType = state.dataVentilatedSlab->Heating_WaterCoilType; + state.dataVentilatedSlab->VentSlab(Item).HCoil_PlantTypeNum = TypeOf_CoilWaterSimpleHeating; } else if (SELECT_CASE_var == "COIL:HEATING:STEAM") { - VentSlab(Item).HCoilType = Heating_SteamCoilType; - VentSlab(Item).HCoil_PlantTypeNum = TypeOf_CoilSteamAirHeating; - VentSlab(Item).HCoil_FluidIndex = FindRefrigerant(state, "Steam"); - if (VentSlab(Item).HCoil_FluidIndex == 0) { + state.dataVentilatedSlab->VentSlab(Item).HCoilType = state.dataVentilatedSlab->Heating_SteamCoilType; + state.dataVentilatedSlab->VentSlab(Item).HCoil_PlantTypeNum = TypeOf_CoilSteamAirHeating; + state.dataVentilatedSlab->VentSlab(Item).HCoil_FluidIndex = FindRefrigerant(state, "Steam"); + if (state.dataVentilatedSlab->VentSlab(Item).HCoil_FluidIndex == 0) { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "Steam Properties not found."); if (SteamMessageNeeded) ShowContinueError("Steam Fluid Properties should have been included in the input file."); ErrorsFound = true; SteamMessageNeeded = false; } } else if (SELECT_CASE_var == "COIL:HEATING:ELECTRIC") { - VentSlab(Item).HCoilType = Heating_ElectricCoilType; + state.dataVentilatedSlab->VentSlab(Item).HCoilType = state.dataVentilatedSlab->Heating_ElectricCoilType; } else if (SELECT_CASE_var == "COIL:HEATING:FUEL") { - VentSlab(Item).HCoilType = Heating_GasCoilType; + state.dataVentilatedSlab->VentSlab(Item).HCoilType = state.dataVentilatedSlab->Heating_GasCoilType; } else { ShowSevereError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(27) + "=\"" + cAlphaArgs(27) + "\"."); @@ -996,8 +908,8 @@ namespace VentilatedSlab { } } if (!errFlag) { - VentSlab(Item).HCoilName = cAlphaArgs(28); - ValidateComponent(state, cAlphaArgs(27), VentSlab(Item).HCoilName, IsNotOK, CurrentModuleObject); + state.dataVentilatedSlab->VentSlab(Item).HCoilName = cAlphaArgs(28); + ValidateComponent(state, cAlphaArgs(27), state.dataVentilatedSlab->VentSlab(Item).HCoilName, IsNotOK, CurrentModuleObject); if (IsNotOK) { ShowContinueError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(28) + "=\"" + cAlphaArgs(28) + "\"."); @@ -1006,12 +918,12 @@ namespace VentilatedSlab { } } - VentSlab(Item).MinVolHotWaterFlow = 0.0; - VentSlab(Item).MinVolHotSteamFlow = 0.0; + state.dataVentilatedSlab->VentSlab(Item).MinVolHotWaterFlow = 0.0; + state.dataVentilatedSlab->VentSlab(Item).MinVolHotSteamFlow = 0.0; // The heating coil control node is necessary for a hot water coil, but not necessary for an // electric or gas coil. - if (VentSlab(Item).HCoilType == Heating_GasCoilType || VentSlab(Item).HCoilType == Heating_ElectricCoilType) { + if (state.dataVentilatedSlab->VentSlab(Item).HCoilType == state.dataVentilatedSlab->Heating_GasCoilType || state.dataVentilatedSlab->VentSlab(Item).HCoilType == state.dataVentilatedSlab->Heating_ElectricCoilType) { if (!lAlphaBlanks(29)) { ShowWarningError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" " + cAlphaFields(29) + "=\"" + cAlphaArgs(29) + "\" not needed - ignored."); @@ -1023,7 +935,7 @@ namespace VentilatedSlab { " is blank and must be entered."); ErrorsFound = true; } - VentSlab(Item).HotControlNode = GetOnlySingleNode(state, cAlphaArgs(29), + state.dataVentilatedSlab->VentSlab(Item).HotControlNode = GetOnlySingleNode(state, cAlphaArgs(29), ErrorsFound, CurrentModuleObject, cAlphaArgs(1), @@ -1032,14 +944,14 @@ namespace VentilatedSlab { 1, ObjectIsParent); } - VentSlab(Item).HotControlOffset = 0.001; - - if (VentSlab(Item).HCoilType == Heating_WaterCoilType) { - VentSlab(Item).MaxVolHotWaterFlow = GetWaterCoilMaxFlowRate(state, "Coil:Heating:Water", VentSlab(Item).HCoilName, ErrorsFound); - VentSlab(Item).MaxVolHotSteamFlow = GetWaterCoilMaxFlowRate(state, "Coil:Heating:Water", VentSlab(Item).HCoilName, ErrorsFound); - } else if (VentSlab(Item).HCoilType == Heating_SteamCoilType) { - VentSlab(Item).MaxVolHotWaterFlow = GetSteamCoilMaxFlowRate(state, "Coil:Heating:Steam", VentSlab(Item).HCoilName, ErrorsFound); - VentSlab(Item).MaxVolHotSteamFlow = GetSteamCoilMaxFlowRate(state, "Coil:Heating:Steam", VentSlab(Item).HCoilName, ErrorsFound); + state.dataVentilatedSlab->VentSlab(Item).HotControlOffset = 0.001; + + if (state.dataVentilatedSlab->VentSlab(Item).HCoilType == state.dataVentilatedSlab->Heating_WaterCoilType) { + state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow = GetWaterCoilMaxFlowRate(state, "Coil:Heating:Water", state.dataVentilatedSlab->VentSlab(Item).HCoilName, ErrorsFound); + state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow = GetWaterCoilMaxFlowRate(state, "Coil:Heating:Water", state.dataVentilatedSlab->VentSlab(Item).HCoilName, ErrorsFound); + } else if (state.dataVentilatedSlab->VentSlab(Item).HCoilType == state.dataVentilatedSlab->Heating_SteamCoilType) { + state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow = GetSteamCoilMaxFlowRate(state, "Coil:Heating:Steam", state.dataVentilatedSlab->VentSlab(Item).HCoilName, ErrorsFound); + state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow = GetSteamCoilMaxFlowRate(state, "Coil:Heating:Steam", state.dataVentilatedSlab->VentSlab(Item).HCoilName, ErrorsFound); } } else { // no heating coil @@ -1049,7 +961,7 @@ namespace VentilatedSlab { } } - if (VentSlab(Item).CoilOption == BothOption || VentSlab(Item).CoilOption == CoolingOption) { + if (state.dataVentilatedSlab->VentSlab(Item).CoilOption == state.dataVentilatedSlab->BothOption || state.dataVentilatedSlab->VentSlab(Item).CoilOption == state.dataVentilatedSlab->CoolingOption) { // Cooling coil information (if one is present): // A30, \field Cooling Coil Object Type // \type choice @@ -1061,32 +973,32 @@ namespace VentilatedSlab { // \object-list CoolingCoilsWater // Cooling coil information (if one is present): if (!lAlphaBlanks(31)) { - VentSlab(Item).CCoilPresent = true; - VentSlab(Item).CCoilTypeCh = cAlphaArgs(30); + state.dataVentilatedSlab->VentSlab(Item).CCoilPresent = true; + state.dataVentilatedSlab->VentSlab(Item).CCoilTypeCh = cAlphaArgs(30); errFlag = false; { auto const SELECT_CASE_var(cAlphaArgs(30)); if (SELECT_CASE_var == "COIL:COOLING:WATER") { - VentSlab(Item).CCoilType = Cooling_CoilWaterCooling; - VentSlab(Item).CCoil_PlantTypeNum = TypeOf_CoilWaterCooling; - VentSlab(Item).CCoilPlantName = cAlphaArgs(31); + state.dataVentilatedSlab->VentSlab(Item).CCoilType = state.dataVentilatedSlab->Cooling_CoilWaterCooling; + state.dataVentilatedSlab->VentSlab(Item).CCoil_PlantTypeNum = TypeOf_CoilWaterCooling; + state.dataVentilatedSlab->VentSlab(Item).CCoilPlantName = cAlphaArgs(31); } else if (SELECT_CASE_var == "COIL:COOLING:WATER:DETAILEDGEOMETRY") { - VentSlab(Item).CCoilType = Cooling_CoilDetailedCooling; - VentSlab(Item).CCoil_PlantTypeNum = TypeOf_CoilWaterDetailedFlatCooling; - VentSlab(Item).CCoilPlantName = cAlphaArgs(31); + state.dataVentilatedSlab->VentSlab(Item).CCoilType = state.dataVentilatedSlab->Cooling_CoilDetailedCooling; + state.dataVentilatedSlab->VentSlab(Item).CCoil_PlantTypeNum = TypeOf_CoilWaterDetailedFlatCooling; + state.dataVentilatedSlab->VentSlab(Item).CCoilPlantName = cAlphaArgs(31); } else if (SELECT_CASE_var == "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED") { - VentSlab(Item).CCoilType = Cooling_CoilHXAssisted; + state.dataVentilatedSlab->VentSlab(Item).CCoilType = state.dataVentilatedSlab->Cooling_CoilHXAssisted; GetHXCoilTypeAndName( - state, cAlphaArgs(30), cAlphaArgs(31), ErrorsFound, VentSlab(Item).CCoilPlantType, VentSlab(Item).CCoilPlantName); - if (UtilityRoutines::SameString(VentSlab(Item).CCoilPlantType, "Coil:Cooling:Water")) { - VentSlab(Item).CCoil_PlantTypeNum = TypeOf_CoilWaterCooling; - } else if (UtilityRoutines::SameString(VentSlab(Item).CCoilPlantType, "Coil:Cooling:Water:DetailedGeometry")) { - VentSlab(Item).CCoil_PlantTypeNum = TypeOf_CoilWaterDetailedFlatCooling; + state, cAlphaArgs(30), cAlphaArgs(31), ErrorsFound, state.dataVentilatedSlab->VentSlab(Item).CCoilPlantType, state.dataVentilatedSlab->VentSlab(Item).CCoilPlantName); + if (UtilityRoutines::SameString(state.dataVentilatedSlab->VentSlab(Item).CCoilPlantType, "Coil:Cooling:Water")) { + state.dataVentilatedSlab->VentSlab(Item).CCoil_PlantTypeNum = TypeOf_CoilWaterCooling; + } else if (UtilityRoutines::SameString(state.dataVentilatedSlab->VentSlab(Item).CCoilPlantType, "Coil:Cooling:Water:DetailedGeometry")) { + state.dataVentilatedSlab->VentSlab(Item).CCoil_PlantTypeNum = TypeOf_CoilWaterDetailedFlatCooling; } else { - ShowSevereError("GetVentilatedSlabInput: " + CurrentModuleObject + "=\"" + VentSlab(Item).Name + "\", invalid"); + ShowSevereError("GetVentilatedSlabInput: " + CurrentModuleObject + "=\"" + state.dataVentilatedSlab->VentSlab(Item).Name + "\", invalid"); ShowContinueError("For: " + cAlphaFields(30) + "=\"" + cAlphaArgs(30) + "\"."); - ShowContinueError("Invalid Coil Type=" + VentSlab(Item).CCoilPlantType + ", Name=" + VentSlab(Item).CCoilPlantName); + ShowContinueError("Invalid Coil Type=" + state.dataVentilatedSlab->VentSlab(Item).CCoilPlantType + ", Name=" + state.dataVentilatedSlab->VentSlab(Item).CCoilPlantName); ShowContinueError("must be \"Coil:Cooling:Water\" or \"Coil:Cooling:Water:DetailedGeometry\""); ErrorsFound = true; } @@ -1099,8 +1011,8 @@ namespace VentilatedSlab { } if (!errFlag) { - VentSlab(Item).CCoilName = cAlphaArgs(31); - ValidateComponent(state, cAlphaArgs(30), VentSlab(Item).CCoilName, IsNotOK, "ZoneHVAC:VentilatedSlab "); + state.dataVentilatedSlab->VentSlab(Item).CCoilName = cAlphaArgs(31); + ValidateComponent(state, cAlphaArgs(30), state.dataVentilatedSlab->VentSlab(Item).CCoilName, IsNotOK, "ZoneHVAC:VentilatedSlab "); if (IsNotOK) { ShowContinueError(CurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" invalid " + cAlphaFields(31) + "=\"" + cAlphaArgs(31) + "\"."); @@ -1109,9 +1021,9 @@ namespace VentilatedSlab { } } - VentSlab(Item).MinVolColdWaterFlow = 0.0; + state.dataVentilatedSlab->VentSlab(Item).MinVolColdWaterFlow = 0.0; - VentSlab(Item).ColdControlNode = GetOnlySingleNode(state, cAlphaArgs(32), + state.dataVentilatedSlab->VentSlab(Item).ColdControlNode = GetOnlySingleNode(state, cAlphaArgs(32), ErrorsFound, CurrentModuleObject, cAlphaArgs(1), @@ -1126,16 +1038,16 @@ namespace VentilatedSlab { ErrorsFound = true; } - VentSlab(Item).ColdControlOffset = 0.001; + state.dataVentilatedSlab->VentSlab(Item).ColdControlOffset = 0.001; - if (VentSlab(Item).CCoilType == Cooling_CoilWaterCooling) { - VentSlab(Item).MaxVolColdWaterFlow = GetWaterCoilMaxFlowRate(state, "Coil:Cooling:Water", VentSlab(Item).CCoilName, ErrorsFound); - } else if (VentSlab(Item).CCoilType == Cooling_CoilDetailedCooling) { - VentSlab(Item).MaxVolColdWaterFlow = - GetWaterCoilMaxFlowRate(state, "Coil:Cooling:Water:DetailedGeometry", VentSlab(Item).CCoilName, ErrorsFound); - } else if (VentSlab(Item).CCoilType == Cooling_CoilHXAssisted) { - VentSlab(Item).MaxVolColdWaterFlow = - GetHXAssistedCoilFlowRate(state, "CoilSystem:Cooling:Water:HeatExchangerAssisted", VentSlab(Item).CCoilName, ErrorsFound); + if (state.dataVentilatedSlab->VentSlab(Item).CCoilType == state.dataVentilatedSlab->Cooling_CoilWaterCooling) { + state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow = GetWaterCoilMaxFlowRate(state, "Coil:Cooling:Water", state.dataVentilatedSlab->VentSlab(Item).CCoilName, ErrorsFound); + } else if (state.dataVentilatedSlab->VentSlab(Item).CCoilType == state.dataVentilatedSlab->Cooling_CoilDetailedCooling) { + state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow = + GetWaterCoilMaxFlowRate(state, "Coil:Cooling:Water:DetailedGeometry", state.dataVentilatedSlab->VentSlab(Item).CCoilName, ErrorsFound); + } else if (state.dataVentilatedSlab->VentSlab(Item).CCoilType == state.dataVentilatedSlab->Cooling_CoilHXAssisted) { + state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow = + GetHXAssistedCoilFlowRate(state, "CoilSystem:Cooling:Water:HeatExchangerAssisted", state.dataVentilatedSlab->VentSlab(Item).CCoilName, ErrorsFound); } } else { // No Cooling Coil @@ -1145,25 +1057,25 @@ namespace VentilatedSlab { } } if (!lAlphaBlanks(33)) { - VentSlab(Item).AvailManagerListName = cAlphaArgs(33); + state.dataVentilatedSlab->VentSlab(Item).AvailManagerListName = cAlphaArgs(33); } - VentSlab(Item).HVACSizingIndex = 0; + state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex = 0; if (!lAlphaBlanks(34)) { - VentSlab(Item).HVACSizingIndex = UtilityRoutines::FindItemInList(cAlphaArgs(34), ZoneHVACSizing); - if (VentSlab(Item).HVACSizingIndex == 0) { + state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex = UtilityRoutines::FindItemInList(cAlphaArgs(34), ZoneHVACSizing); + if (state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex == 0) { ShowSevereError(cAlphaFields(34) + " = " + cAlphaArgs(34) + " not found."); - ShowContinueError("Occurs in " + cMO_VentilatedSlab + " = " + VentSlab(Item).Name); + ShowContinueError("Occurs in " + state.dataVentilatedSlab->cMO_VentilatedSlab + " = " + state.dataVentilatedSlab->VentSlab(Item).Name); ErrorsFound = true; } } { - auto const SELECT_CASE_var(VentSlab(Item).CoilOption); - if (SELECT_CASE_var == BothOption) { // 'HeatingAndCooling' + auto const SELECT_CASE_var(state.dataVentilatedSlab->VentSlab(Item).CoilOption); + if (SELECT_CASE_var == state.dataVentilatedSlab->BothOption) { // 'HeatingAndCooling' // Add cooling coil to component sets array when present SetUpCompSets(CurrentModuleObject + "-SYSTEM", - VentSlab(Item).Name + "-SYSTEM", + state.dataVentilatedSlab->VentSlab(Item).Name + "-SYSTEM", cAlphaArgs(30), cAlphaArgs(31), cAlphaArgs(24), @@ -1171,31 +1083,31 @@ namespace VentilatedSlab { // Add heating coil to component sets array when cooling coil present SetUpCompSets(CurrentModuleObject + "-SYSTEM", - VentSlab(Item).Name + "-SYSTEM", + state.dataVentilatedSlab->VentSlab(Item).Name + "-SYSTEM", cAlphaArgs(27), cAlphaArgs(28), "UNDEFINED", cAlphaArgs(19)); - } else if (SELECT_CASE_var == HeatingOption) { // 'Heating' + } else if (SELECT_CASE_var == state.dataVentilatedSlab->HeatingOption) { // 'Heating' // Add heating coil to component sets array when no cooling coil present SetUpCompSets(CurrentModuleObject + "-SYSTEM", - VentSlab(Item).Name + "-SYSTEM", + state.dataVentilatedSlab->VentSlab(Item).Name + "-SYSTEM", cAlphaArgs(27), cAlphaArgs(28), cAlphaArgs(24), cAlphaArgs(19)); - } else if (SELECT_CASE_var == CoolingOption) { // 'Cooling' + } else if (SELECT_CASE_var == state.dataVentilatedSlab->CoolingOption) { // 'Cooling' // Add cooling coil to component sets array when no heating coil present SetUpCompSets(CurrentModuleObject + "-SYSTEM", - VentSlab(Item).Name + "-SYSTEM", + state.dataVentilatedSlab->VentSlab(Item).Name + "-SYSTEM", cAlphaArgs(30), cAlphaArgs(31), cAlphaArgs(24), cAlphaArgs(19)); - } else if (SELECT_CASE_var == NoneOption) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->NoneOption) { } else { } @@ -1213,146 +1125,146 @@ namespace VentilatedSlab { if (ErrorsFound) ShowFatalError(CurrentModuleObject + " errors occurred in input. Program terminates."); // Setup Report variables for the VENTILATED SLAB - for (Item = 1; Item <= NumOfVentSlabs; ++Item) { + for (Item = 1; Item <= state.dataVentilatedSlab->NumOfVentSlabs; ++Item) { // CALL SetupOutputVariable(state, 'Ventilated Slab Direct Heat Loss Rate [W]', & - // VentSlab(Item)%DirectHeatLossRate,'System', & - // 'Average', VentSlab(Item)%Name) + // state.dataVentilatedSlab->VentSlab(Item)%DirectHeatLossRate,'System', & + // 'Average', state.dataVentilatedSlab->VentSlab(Item)%Name) // CALL SetupOutputVariable(state, 'Ventilated Slab Direct Heat Loss [W]', & - // VentSlab(Item)%DirectHeatLoss,'System', & - // 'Sum', VentSlab(Item)%Name) + // state.dataVentilatedSlab->VentSlab(Item)%DirectHeatLoss,'System', & + // 'Sum', state.dataVentilatedSlab->VentSlab(Item)%Name) // CALL SetupOutputVariable(state, 'Ventilated Slab Direct Heat Gain Rate [W]', & - // VentSlab(Item)%DirectHeatGainRate,'System', & - // 'Average', VentSlab(Item)%Name) + // state.dataVentilatedSlab->VentSlab(Item)%DirectHeatGainRate,'System', & + // 'Average', state.dataVentilatedSlab->VentSlab(Item)%Name) // CALL SetupOutputVariable(state, 'Ventilated Slab Direct Heat Gain [J]', & - // VentSlab(Item)%DirectHeatGain,'System', & - // 'Sum', VentSlab(Item)%Name) + // state.dataVentilatedSlab->VentSlab(Item)%DirectHeatGain,'System', & + // 'Sum', state.dataVentilatedSlab->VentSlab(Item)%Name) SetupOutputVariable(state, "Zone Ventilated Slab Radiant Heating Rate", OutputProcessor::Unit::W, - VentSlab(Item).RadHeatingPower, + state.dataVentilatedSlab->VentSlab(Item).RadHeatingPower, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Radiant Heating Energy", OutputProcessor::Unit::J, - VentSlab(Item).RadHeatingEnergy, + state.dataVentilatedSlab->VentSlab(Item).RadHeatingEnergy, "System", "Sum", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Radiant Cooling Rate", OutputProcessor::Unit::W, - VentSlab(Item).RadCoolingPower, + state.dataVentilatedSlab->VentSlab(Item).RadCoolingPower, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Radiant Cooling Energy", OutputProcessor::Unit::J, - VentSlab(Item).RadCoolingEnergy, + state.dataVentilatedSlab->VentSlab(Item).RadCoolingEnergy, "System", "Sum", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Coil Heating Rate", OutputProcessor::Unit::W, - VentSlab(Item).HeatCoilPower, + state.dataVentilatedSlab->VentSlab(Item).HeatCoilPower, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Coil Heating Energy", OutputProcessor::Unit::J, - VentSlab(Item).HeatCoilEnergy, + state.dataVentilatedSlab->VentSlab(Item).HeatCoilEnergy, "System", "Sum", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Coil Total Cooling Rate", OutputProcessor::Unit::W, - VentSlab(Item).TotCoolCoilPower, + state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Coil Total Cooling Energy", OutputProcessor::Unit::J, - VentSlab(Item).TotCoolCoilEnergy, + state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilEnergy, "System", "Sum", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Coil Sensible Cooling Rate", OutputProcessor::Unit::W, - VentSlab(Item).SensCoolCoilPower, + state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Coil Sensible Cooling Energy", OutputProcessor::Unit::J, - VentSlab(Item).SensCoolCoilEnergy, + state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilEnergy, "System", "Sum", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Coil Latent Cooling Rate", OutputProcessor::Unit::W, - VentSlab(Item).LateCoolCoilPower, + state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Coil Latent Cooling Energy", OutputProcessor::Unit::J, - VentSlab(Item).LateCoolCoilEnergy, + state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilEnergy, "System", "Sum", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Air Mass Flow Rate", OutputProcessor::Unit::kg_s, - VentSlab(Item).AirMassFlowRate, + state.dataVentilatedSlab->VentSlab(Item).AirMassFlowRate, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Fan Electricity Rate", OutputProcessor::Unit::W, - VentSlab(Item).ElecFanPower, + state.dataVentilatedSlab->VentSlab(Item).ElecFanPower, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); //! Note that the ventilated slab fan electric is NOT metered because this value is already metered through the fan component SetupOutputVariable(state, "Zone Ventilated Slab Fan Electricity Energy", OutputProcessor::Unit::J, - VentSlab(Item).ElecFanEnergy, + state.dataVentilatedSlab->VentSlab(Item).ElecFanEnergy, "System", "Sum", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Inlet Air Temperature", OutputProcessor::Unit::C, - VentSlab(Item).SlabInTemp, + state.dataVentilatedSlab->VentSlab(Item).SlabInTemp, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Outlet Air Temperature", OutputProcessor::Unit::C, - VentSlab(Item).SlabOutTemp, + state.dataVentilatedSlab->VentSlab(Item).SlabOutTemp, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Zone Inlet Air Temperature", OutputProcessor::Unit::C, - VentSlab(Item).ZoneInletTemp, + state.dataVentilatedSlab->VentSlab(Item).ZoneInletTemp, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Return Air Temperature", OutputProcessor::Unit::C, - VentSlab(Item).ReturnAirTemp, + state.dataVentilatedSlab->VentSlab(Item).ReturnAirTemp, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Fan Outlet Air Temperature", OutputProcessor::Unit::C, - VentSlab(Item).FanOutletTemp, + state.dataVentilatedSlab->VentSlab(Item).FanOutletTemp, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); SetupOutputVariable(state, "Zone Ventilated Slab Fan Availability Status", OutputProcessor::Unit::None, - VentSlab(Item).AvailStatus, + state.dataVentilatedSlab->VentSlab(Item).AvailStatus, "System", "Average", - VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).Name); } } @@ -1443,51 +1355,51 @@ namespace VentilatedSlab { // Do the one time initializations - if (MyOneTimeFlag) { - MyEnvrnFlag.allocate(NumOfVentSlabs); - MySizeFlag.allocate(NumOfVentSlabs); - MyPlantScanFlag.allocate(NumOfVentSlabs); - MyZoneEqFlag.allocate(NumOfVentSlabs); - ZeroSourceSumHATsurf.dimension(NumOfZones, 0.0); - QRadSysSrcAvg.dimension(TotSurfaces, 0.0); - LastQRadSysSrc.dimension(TotSurfaces, 0.0); - LastSysTimeElapsed.dimension(TotSurfaces, 0.0); - LastTimeStepSys.dimension(TotSurfaces, 0.0); + if (state.dataVentilatedSlab->MyOneTimeFlag) { + MyEnvrnFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); + state.dataVentilatedSlab->MySizeFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); + MyPlantScanFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); + MyZoneEqFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); + state.dataVentilatedSlab->ZeroSourceSumHATsurf.dimension(NumOfZones, 0.0); + state.dataVentilatedSlab->QRadSysSrcAvg.dimension(TotSurfaces, 0.0); + state.dataVentilatedSlab->LastQRadSysSrc.dimension(TotSurfaces, 0.0); + state.dataVentilatedSlab->LastSysTimeElapsed.dimension(TotSurfaces, 0.0); + state.dataVentilatedSlab->LastTimeStepSys.dimension(TotSurfaces, 0.0); // Initialize total areas for all radiant systems - for (RadNum = 1; RadNum <= NumOfVentSlabs; ++RadNum) { - VentSlab(RadNum).TotalSurfaceArea = 0.0; - for (SurfNum = 1; SurfNum <= VentSlab(RadNum).NumOfSurfaces; ++SurfNum) { - VentSlab(RadNum).TotalSurfaceArea += Surface(VentSlab(RadNum).SurfacePtr(SurfNum)).Area; + for (RadNum = 1; RadNum <= state.dataVentilatedSlab->NumOfVentSlabs; ++RadNum) { + state.dataVentilatedSlab->VentSlab(RadNum).TotalSurfaceArea = 0.0; + for (SurfNum = 1; SurfNum <= state.dataVentilatedSlab->VentSlab(RadNum).NumOfSurfaces; ++SurfNum) { + state.dataVentilatedSlab->VentSlab(RadNum).TotalSurfaceArea += Surface(state.dataVentilatedSlab->VentSlab(RadNum).SurfacePtr(SurfNum)).Area; } } MyEnvrnFlag = true; - MySizeFlag = true; + state.dataVentilatedSlab->MySizeFlag = true; MyPlantScanFlag = true; MyZoneEqFlag = true; - MyOneTimeFlag = false; + state.dataVentilatedSlab->MyOneTimeFlag = false; } if (allocated(ZoneComp)) { if (MyZoneEqFlag(Item)) { // initialize the name of each availability manager list and zone number - ZoneComp(VentilatedSlab_Num).ZoneCompAvailMgrs(Item).AvailManagerListName = VentSlab(Item).AvailManagerListName; + ZoneComp(VentilatedSlab_Num).ZoneCompAvailMgrs(Item).AvailManagerListName = state.dataVentilatedSlab->VentSlab(Item).AvailManagerListName; ZoneComp(VentilatedSlab_Num).ZoneCompAvailMgrs(Item).ZoneNum = VentSlabZoneNum; MyZoneEqFlag(Item) = false; } - VentSlab(Item).AvailStatus = ZoneComp(VentilatedSlab_Num).ZoneCompAvailMgrs(Item).AvailStatus; + state.dataVentilatedSlab->VentSlab(Item).AvailStatus = ZoneComp(VentilatedSlab_Num).ZoneCompAvailMgrs(Item).AvailStatus; } if (MyPlantScanFlag(Item) && allocated(PlantLoop)) { - if ((VentSlab(Item).HCoil_PlantTypeNum == TypeOf_CoilWaterSimpleHeating) || - (VentSlab(Item).HCoil_PlantTypeNum == TypeOf_CoilSteamAirHeating)) { + if ((state.dataVentilatedSlab->VentSlab(Item).HCoil_PlantTypeNum == TypeOf_CoilWaterSimpleHeating) || + (state.dataVentilatedSlab->VentSlab(Item).HCoil_PlantTypeNum == TypeOf_CoilSteamAirHeating)) { errFlag = false; ScanPlantLoopsForObject(state, - VentSlab(Item).HCoilName, - VentSlab(Item).HCoil_PlantTypeNum, - VentSlab(Item).HWLoopNum, - VentSlab(Item).HWLoopSide, - VentSlab(Item).HWBranchNum, - VentSlab(Item).HWCompNum, + state.dataVentilatedSlab->VentSlab(Item).HCoilName, + state.dataVentilatedSlab->VentSlab(Item).HCoil_PlantTypeNum, + state.dataVentilatedSlab->VentSlab(Item).HWLoopNum, + state.dataVentilatedSlab->VentSlab(Item).HWLoopSide, + state.dataVentilatedSlab->VentSlab(Item).HWBranchNum, + state.dataVentilatedSlab->VentSlab(Item).HWCompNum, errFlag, _, _, @@ -1495,39 +1407,39 @@ namespace VentilatedSlab { _, _); if (errFlag) { - ShowContinueError("Reference Unit=\"" + VentSlab(Item).Name + "\", type=ZoneHVAC:VentilatedSlab"); + ShowContinueError("Reference Unit=\"" + state.dataVentilatedSlab->VentSlab(Item).Name + "\", type=ZoneHVAC:VentilatedSlab"); ShowFatalError("InitVentilatedSlab: Program terminated due to previous condition(s)."); } - VentSlab(Item).HotCoilOutNodeNum = PlantLoop(VentSlab(Item).HWLoopNum) - .LoopSide(VentSlab(Item).HWLoopSide) - .Branch(VentSlab(Item).HWBranchNum) - .Comp(VentSlab(Item).HWCompNum) + state.dataVentilatedSlab->VentSlab(Item).HotCoilOutNodeNum = PlantLoop(state.dataVentilatedSlab->VentSlab(Item).HWLoopNum) + .LoopSide(state.dataVentilatedSlab->VentSlab(Item).HWLoopSide) + .Branch(state.dataVentilatedSlab->VentSlab(Item).HWBranchNum) + .Comp(state.dataVentilatedSlab->VentSlab(Item).HWCompNum) .NodeNumOut; } - if ((VentSlab(Item).CCoil_PlantTypeNum == TypeOf_CoilWaterCooling) || - (VentSlab(Item).CCoil_PlantTypeNum == TypeOf_CoilWaterDetailedFlatCooling)) { + if ((state.dataVentilatedSlab->VentSlab(Item).CCoil_PlantTypeNum == TypeOf_CoilWaterCooling) || + (state.dataVentilatedSlab->VentSlab(Item).CCoil_PlantTypeNum == TypeOf_CoilWaterDetailedFlatCooling)) { errFlag = false; ScanPlantLoopsForObject(state, - VentSlab(Item).CCoilPlantName, - VentSlab(Item).CCoil_PlantTypeNum, - VentSlab(Item).CWLoopNum, - VentSlab(Item).CWLoopSide, - VentSlab(Item).CWBranchNum, - VentSlab(Item).CWCompNum, + state.dataVentilatedSlab->VentSlab(Item).CCoilPlantName, + state.dataVentilatedSlab->VentSlab(Item).CCoil_PlantTypeNum, + state.dataVentilatedSlab->VentSlab(Item).CWLoopNum, + state.dataVentilatedSlab->VentSlab(Item).CWLoopSide, + state.dataVentilatedSlab->VentSlab(Item).CWBranchNum, + state.dataVentilatedSlab->VentSlab(Item).CWCompNum, errFlag); if (errFlag) { - ShowContinueError("Reference Unit=\"" + VentSlab(Item).Name + "\", type=ZoneHVAC:VentilatedSlab"); + ShowContinueError("Reference Unit=\"" + state.dataVentilatedSlab->VentSlab(Item).Name + "\", type=ZoneHVAC:VentilatedSlab"); ShowFatalError("InitVentilatedSlab: Program terminated due to previous condition(s)."); } - VentSlab(Item).ColdCoilOutNodeNum = PlantLoop(VentSlab(Item).CWLoopNum) - .LoopSide(VentSlab(Item).CWLoopSide) - .Branch(VentSlab(Item).CWBranchNum) - .Comp(VentSlab(Item).CWCompNum) + state.dataVentilatedSlab->VentSlab(Item).ColdCoilOutNodeNum = PlantLoop(state.dataVentilatedSlab->VentSlab(Item).CWLoopNum) + .LoopSide(state.dataVentilatedSlab->VentSlab(Item).CWLoopSide) + .Branch(state.dataVentilatedSlab->VentSlab(Item).CWBranchNum) + .Comp(state.dataVentilatedSlab->VentSlab(Item).CWCompNum) .NodeNumOut; } else { - if (VentSlab(Item).CCoilPresent) - ShowFatalError("InitVentilatedSlab: Unit=" + VentSlab(Item).Name + ", invalid cooling coil type. Program terminated."); + if (state.dataVentilatedSlab->VentSlab(Item).CCoilPresent) + ShowFatalError("InitVentilatedSlab: Unit=" + state.dataVentilatedSlab->VentSlab(Item).Name + ", invalid cooling coil type. Program terminated."); } MyPlantScanFlag(Item) = false; } else if (MyPlantScanFlag(Item) && !AnyPlantInModel) { @@ -1537,39 +1449,39 @@ namespace VentilatedSlab { // need to check all Ventilated Slab units to see if they are on Zone Equipment List or issue warning if (!ZoneEquipmentListChecked && ZoneEquipInputsFilled) { ZoneEquipmentListChecked = true; - for (RadNum = 1; RadNum <= NumOfVentSlabs; ++RadNum) { - if (CheckZoneEquipmentList(cMO_VentilatedSlab, VentSlab(RadNum).Name)) continue; - ShowSevereError("InitVentilatedSlab: Ventilated Slab Unit=[" + cMO_VentilatedSlab + ',' + VentSlab(RadNum).Name + + for (RadNum = 1; RadNum <= state.dataVentilatedSlab->NumOfVentSlabs; ++RadNum) { + if (CheckZoneEquipmentList(state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(RadNum).Name)) continue; + ShowSevereError("InitVentilatedSlab: Ventilated Slab Unit=[" + state.dataVentilatedSlab->cMO_VentilatedSlab + ',' + state.dataVentilatedSlab->VentSlab(RadNum).Name + "] is not on any ZoneHVAC:EquipmentList. It will not be simulated."); } } - if (!SysSizingCalc && MySizeFlag(Item) && !MyPlantScanFlag(Item)) { + if (!SysSizingCalc && state.dataVentilatedSlab->MySizeFlag(Item) && !MyPlantScanFlag(Item)) { SizeVentilatedSlab(state, Item); - MySizeFlag(Item) = false; + state.dataVentilatedSlab->MySizeFlag(Item) = false; } // Do the one time initializations if (BeginEnvrnFlag && MyEnvrnFlag(Item) && !MyPlantScanFlag(Item)) { // Coil Part - InNode = VentSlab(Item).ReturnAirNode; - OutNode = VentSlab(Item).RadInNode; - HotConNode = VentSlab(Item).HotControlNode; - ColdConNode = VentSlab(Item).ColdControlNode; - OutsideAirNode = VentSlab(Item).OutsideAirNode; + InNode = state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode; + OutNode = state.dataVentilatedSlab->VentSlab(Item).RadInNode; + HotConNode = state.dataVentilatedSlab->VentSlab(Item).HotControlNode; + ColdConNode = state.dataVentilatedSlab->VentSlab(Item).ColdControlNode; + OutsideAirNode = state.dataVentilatedSlab->VentSlab(Item).OutsideAirNode; RhoAir = StdRhoAir; // Radiation Panel Part - ZeroSourceSumHATsurf = 0.0; - QRadSysSrcAvg = 0.0; - LastQRadSysSrc = 0.0; - LastSysTimeElapsed = 0.0; - LastTimeStepSys = 0.0; - if (NumOfVentSlabs > 0) { - for (auto &e : VentSlab) { + state.dataVentilatedSlab->ZeroSourceSumHATsurf = 0.0; + state.dataVentilatedSlab->QRadSysSrcAvg = 0.0; + state.dataVentilatedSlab->LastQRadSysSrc = 0.0; + state.dataVentilatedSlab->LastSysTimeElapsed = 0.0; + state.dataVentilatedSlab->LastTimeStepSys = 0.0; + if (state.dataVentilatedSlab->NumOfVentSlabs > 0) { + for (auto &e : state.dataVentilatedSlab->VentSlab) { e.RadHeatingPower = 0.0; e.RadHeatingEnergy = 0.0; e.RadCoolingPower = 0.0; @@ -1580,78 +1492,78 @@ namespace VentilatedSlab { // set the initial Temperature of Return Air // set the mass flow rates from the input volume flow rates - VentSlab(Item).MaxAirMassFlow = RhoAir * VentSlab(Item).MaxAirVolFlow; - VentSlab(Item).OutAirMassFlow = RhoAir * VentSlab(Item).OutAirVolFlow; - VentSlab(Item).MinOutAirMassFlow = RhoAir * VentSlab(Item).MinOutAirVolFlow; - if (VentSlab(Item).OutAirMassFlow > VentSlab(Item).MaxAirMassFlow) { - VentSlab(Item).OutAirMassFlow = VentSlab(Item).MaxAirMassFlow; - VentSlab(Item).MinOutAirMassFlow = VentSlab(Item).OutAirMassFlow * (VentSlab(Item).MinOutAirVolFlow / VentSlab(Item).OutAirVolFlow); - ShowWarningError("Outdoor air mass flow rate higher than unit flow rate, reset to unit flow rate for " + VentSlab(Item).Name); + state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow = RhoAir * state.dataVentilatedSlab->VentSlab(Item).MaxAirVolFlow; + state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow = RhoAir * state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow; + state.dataVentilatedSlab->VentSlab(Item).MinOutAirMassFlow = RhoAir * state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow; + if (state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow > state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow) { + state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow = state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow; + state.dataVentilatedSlab->VentSlab(Item).MinOutAirMassFlow = state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow * (state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow / state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow); + ShowWarningError("Outdoor air mass flow rate higher than unit flow rate, reset to unit flow rate for " + state.dataVentilatedSlab->VentSlab(Item).Name); } // set the node max and min mass flow rates - Node(OutsideAirNode).MassFlowRateMax = VentSlab(Item).OutAirMassFlow; + Node(OutsideAirNode).MassFlowRateMax = state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow; Node(OutsideAirNode).MassFlowRateMin = 0.0; - Node(OutNode).MassFlowRateMax = VentSlab(Item).MaxAirMassFlow; + Node(OutNode).MassFlowRateMax = state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow; Node(OutNode).MassFlowRateMin = 0.0; - Node(InNode).MassFlowRateMax = VentSlab(Item).MaxAirMassFlow; + Node(InNode).MassFlowRateMax = state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow; Node(InNode).MassFlowRateMin = 0.0; - if (VentSlab(Item).HCoilPresent) { // Only initialize these if a heating coil is actually present + if (state.dataVentilatedSlab->VentSlab(Item).HCoilPresent) { // Only initialize these if a heating coil is actually present - if (VentSlab(Item).HCoil_PlantTypeNum == TypeOf_CoilWaterSimpleHeating && !MyPlantScanFlag(Item)) { + if (state.dataVentilatedSlab->VentSlab(Item).HCoil_PlantTypeNum == TypeOf_CoilWaterSimpleHeating && !MyPlantScanFlag(Item)) { rho = GetDensityGlycol( - state, PlantLoop(VentSlab(Item).HWLoopNum).FluidName, HWInitConvTemp, PlantLoop(VentSlab(Item).HWLoopNum).FluidIndex, RoutineName); - - VentSlab(Item).MaxHotWaterFlow = rho * VentSlab(Item).MaxVolHotWaterFlow; - VentSlab(Item).MinHotWaterFlow = rho * VentSlab(Item).MinVolHotWaterFlow; - - InitComponentNodes(VentSlab(Item).MinHotWaterFlow, - VentSlab(Item).MaxHotWaterFlow, - VentSlab(Item).HotControlNode, - VentSlab(Item).HotCoilOutNodeNum, - VentSlab(Item).HWLoopNum, - VentSlab(Item).HWLoopSide, - VentSlab(Item).HWBranchNum, - VentSlab(Item).HWCompNum); + state, PlantLoop(state.dataVentilatedSlab->VentSlab(Item).HWLoopNum).FluidName, HWInitConvTemp, PlantLoop(state.dataVentilatedSlab->VentSlab(Item).HWLoopNum).FluidIndex, RoutineName); + + state.dataVentilatedSlab->VentSlab(Item).MaxHotWaterFlow = rho * state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow; + state.dataVentilatedSlab->VentSlab(Item).MinHotWaterFlow = rho * state.dataVentilatedSlab->VentSlab(Item).MinVolHotWaterFlow; + + InitComponentNodes(state.dataVentilatedSlab->VentSlab(Item).MinHotWaterFlow, + state.dataVentilatedSlab->VentSlab(Item).MaxHotWaterFlow, + state.dataVentilatedSlab->VentSlab(Item).HotControlNode, + state.dataVentilatedSlab->VentSlab(Item).HotCoilOutNodeNum, + state.dataVentilatedSlab->VentSlab(Item).HWLoopNum, + state.dataVentilatedSlab->VentSlab(Item).HWLoopSide, + state.dataVentilatedSlab->VentSlab(Item).HWBranchNum, + state.dataVentilatedSlab->VentSlab(Item).HWCompNum); } - if (VentSlab(Item).HCoil_PlantTypeNum == TypeOf_CoilSteamAirHeating && !MyPlantScanFlag(Item)) { + if (state.dataVentilatedSlab->VentSlab(Item).HCoil_PlantTypeNum == TypeOf_CoilSteamAirHeating && !MyPlantScanFlag(Item)) { TempSteamIn = 100.00; - SteamDensity = GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, VentSlab(Item).HCoil_FluidIndex, RoutineName); - VentSlab(Item).MaxHotSteamFlow = SteamDensity * VentSlab(Item).MaxVolHotSteamFlow; - VentSlab(Item).MinHotSteamFlow = SteamDensity * VentSlab(Item).MinVolHotSteamFlow; - - InitComponentNodes(VentSlab(Item).MinHotSteamFlow, - VentSlab(Item).MaxHotSteamFlow, - VentSlab(Item).HotControlNode, - VentSlab(Item).HotCoilOutNodeNum, - VentSlab(Item).HWLoopNum, - VentSlab(Item).HWLoopSide, - VentSlab(Item).HWBranchNum, - VentSlab(Item).HWCompNum); + SteamDensity = GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, state.dataVentilatedSlab->VentSlab(Item).HCoil_FluidIndex, RoutineName); + state.dataVentilatedSlab->VentSlab(Item).MaxHotSteamFlow = SteamDensity * state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow; + state.dataVentilatedSlab->VentSlab(Item).MinHotSteamFlow = SteamDensity * state.dataVentilatedSlab->VentSlab(Item).MinVolHotSteamFlow; + + InitComponentNodes(state.dataVentilatedSlab->VentSlab(Item).MinHotSteamFlow, + state.dataVentilatedSlab->VentSlab(Item).MaxHotSteamFlow, + state.dataVentilatedSlab->VentSlab(Item).HotControlNode, + state.dataVentilatedSlab->VentSlab(Item).HotCoilOutNodeNum, + state.dataVentilatedSlab->VentSlab(Item).HWLoopNum, + state.dataVentilatedSlab->VentSlab(Item).HWLoopSide, + state.dataVentilatedSlab->VentSlab(Item).HWBranchNum, + state.dataVentilatedSlab->VentSlab(Item).HWCompNum); } - } //(VentSlab(Item)%HCoilPresent) + } //(state.dataVentilatedSlab->VentSlab(Item)%HCoilPresent) - if (VentSlab(Item).CCoilPresent && !MyPlantScanFlag(Item)) { + if (state.dataVentilatedSlab->VentSlab(Item).CCoilPresent && !MyPlantScanFlag(Item)) { // Only initialize these if a cooling coil is actually present - if ((VentSlab(Item).CCoil_PlantTypeNum == TypeOf_CoilWaterCooling) || - (VentSlab(Item).CCoil_PlantTypeNum == TypeOf_CoilWaterDetailedFlatCooling)) { - rho = GetDensityGlycol(state, PlantLoop(VentSlab(Item).CWLoopNum).FluidName, + if ((state.dataVentilatedSlab->VentSlab(Item).CCoil_PlantTypeNum == TypeOf_CoilWaterCooling) || + (state.dataVentilatedSlab->VentSlab(Item).CCoil_PlantTypeNum == TypeOf_CoilWaterDetailedFlatCooling)) { + rho = GetDensityGlycol(state, PlantLoop(state.dataVentilatedSlab->VentSlab(Item).CWLoopNum).FluidName, DataGlobals::CWInitConvTemp, - PlantLoop(VentSlab(Item).CWLoopNum).FluidIndex, + PlantLoop(state.dataVentilatedSlab->VentSlab(Item).CWLoopNum).FluidIndex, RoutineName); - VentSlab(Item).MaxColdWaterFlow = rho * VentSlab(Item).MaxVolColdWaterFlow; - VentSlab(Item).MinColdWaterFlow = rho * VentSlab(Item).MinVolColdWaterFlow; - InitComponentNodes(VentSlab(Item).MinColdWaterFlow, - VentSlab(Item).MaxColdWaterFlow, - VentSlab(Item).ColdControlNode, - VentSlab(Item).ColdCoilOutNodeNum, - VentSlab(Item).CWLoopNum, - VentSlab(Item).CWLoopSide, - VentSlab(Item).CWBranchNum, - VentSlab(Item).CWCompNum); + state.dataVentilatedSlab->VentSlab(Item).MaxColdWaterFlow = rho * state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow; + state.dataVentilatedSlab->VentSlab(Item).MinColdWaterFlow = rho * state.dataVentilatedSlab->VentSlab(Item).MinVolColdWaterFlow; + InitComponentNodes(state.dataVentilatedSlab->VentSlab(Item).MinColdWaterFlow, + state.dataVentilatedSlab->VentSlab(Item).MaxColdWaterFlow, + state.dataVentilatedSlab->VentSlab(Item).ColdControlNode, + state.dataVentilatedSlab->VentSlab(Item).ColdCoilOutNodeNum, + state.dataVentilatedSlab->VentSlab(Item).CWLoopNum, + state.dataVentilatedSlab->VentSlab(Item).CWLoopSide, + state.dataVentilatedSlab->VentSlab(Item).CWBranchNum, + state.dataVentilatedSlab->VentSlab(Item).CWCompNum); } } @@ -1665,33 +1577,33 @@ namespace VentilatedSlab { } // These initializations are done every iteration... - InNode = VentSlab(Item).ReturnAirNode; - OutNode = VentSlab(Item).RadInNode; - OutsideAirNode = VentSlab(Item).OutsideAirNode; - AirRelNode = VentSlab(Item).AirReliefNode; - ZoneAirInNode = VentSlab(Item).ZoneAirInNode; - MixOut = VentSlab(Item).OAMixerOutNode; + InNode = state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode; + OutNode = state.dataVentilatedSlab->VentSlab(Item).RadInNode; + OutsideAirNode = state.dataVentilatedSlab->VentSlab(Item).OutsideAirNode; + AirRelNode = state.dataVentilatedSlab->VentSlab(Item).AirReliefNode; + ZoneAirInNode = state.dataVentilatedSlab->VentSlab(Item).ZoneAirInNode; + MixOut = state.dataVentilatedSlab->VentSlab(Item).OAMixerOutNode; // First, set the flow conditions up so that there is flow through the ventilated // slab system(this will be shut down if the system is not available or there // is no load - Node(InNode).MassFlowRate = VentSlab(Item).MaxAirMassFlow; - Node(InNode).MassFlowRateMaxAvail = VentSlab(Item).MaxAirMassFlow; - Node(InNode).MassFlowRateMinAvail = VentSlab(Item).MaxAirMassFlow; - Node(OutNode).MassFlowRate = VentSlab(Item).MaxAirMassFlow; - Node(OutNode).MassFlowRateMaxAvail = VentSlab(Item).MaxAirMassFlow; - Node(OutNode).MassFlowRateMinAvail = VentSlab(Item).MaxAirMassFlow; - Node(OutsideAirNode).MassFlowRate = VentSlab(Item).OutAirMassFlow; - Node(OutsideAirNode).MassFlowRateMaxAvail = VentSlab(Item).OutAirMassFlow; - Node(OutsideAirNode).MassFlowRateMinAvail = VentSlab(Item).OutAirMassFlow; - Node(AirRelNode).MassFlowRate = VentSlab(Item).OutAirMassFlow; - Node(AirRelNode).MassFlowRateMaxAvail = VentSlab(Item).OutAirMassFlow; - Node(AirRelNode).MassFlowRateMinAvail = VentSlab(Item).OutAirMassFlow; + Node(InNode).MassFlowRate = state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow; + Node(InNode).MassFlowRateMaxAvail = state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow; + Node(InNode).MassFlowRateMinAvail = state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow; + Node(OutNode).MassFlowRate = state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow; + Node(OutNode).MassFlowRateMaxAvail = state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow; + Node(OutNode).MassFlowRateMinAvail = state.dataVentilatedSlab->VentSlab(Item).MaxAirMassFlow; + Node(OutsideAirNode).MassFlowRate = state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow; + Node(OutsideAirNode).MassFlowRateMaxAvail = state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow; + Node(OutsideAirNode).MassFlowRateMinAvail = state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow; + Node(AirRelNode).MassFlowRate = state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow; + Node(AirRelNode).MassFlowRateMaxAvail = state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow; + Node(AirRelNode).MassFlowRateMinAvail = state.dataVentilatedSlab->VentSlab(Item).OutAirMassFlow; // Initialize the relief air (same as inlet conditions to the Ventilated Slab .. // Note that mass flow rates will be taken care of later. Node(AirRelNode) = Node(InNode); - OAMassFlowRate = 0.0; + state.dataVentilatedSlab->OAMassFlowRate = 0.0; // Just in case the system is off and conditions do not get sent through // the system for some reason, set the outlet conditions equal to the inlet @@ -1709,14 +1621,14 @@ namespace VentilatedSlab { Node(OutsideAirNode).Press = OutBaroPress; // The first pass through in a particular time step - ZoneNum = VentSlab(Item).ZonePtr; - ZeroSourceSumHATsurf(ZoneNum) = SumHATsurf(ZoneNum); // Set this to figure what part of the load the radiant system meets - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); - QRadSysSrcAvg(SurfNum) = 0.0; // Initialize this variable to zero (radiant system defaults to off) - LastQRadSysSrc(SurfNum) = 0.0; // At the start of a time step, reset to zero so average calculation can begin again - LastSysTimeElapsed(SurfNum) = 0.0; // At the start of a time step, reset to zero so average calculation can begin again - LastTimeStepSys(SurfNum) = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + ZoneNum = state.dataVentilatedSlab->VentSlab(Item).ZonePtr; + state.dataVentilatedSlab->ZeroSourceSumHATsurf(ZoneNum) = SumHATsurf(ZoneNum); // Set this to figure what part of the load the radiant system meets + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); + state.dataVentilatedSlab->QRadSysSrcAvg(SurfNum) = 0.0; // Initialize this variable to zero (radiant system defaults to off) + state.dataVentilatedSlab->LastQRadSysSrc(SurfNum) = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + state.dataVentilatedSlab->LastSysTimeElapsed(SurfNum) = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + state.dataVentilatedSlab->LastTimeStepSys(SurfNum) = 0.0; // At the start of a time step, reset to zero so average calculation can begin again } } } @@ -1831,24 +1743,24 @@ namespace VentilatedSlab { HeatingAirVolFlowScalable = 0.0; DataScalableSizingON = false; DataScalableCapSizingON = false; - CompType = cMO_VentilatedSlab; - CompName = VentSlab(Item).Name; - DataZoneNumber = VentSlab(Item).ZonePtr; - if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + CompType = state.dataVentilatedSlab->cMO_VentilatedSlab; + CompName = state.dataVentilatedSlab->VentSlab(Item).Name; + DataZoneNumber = state.dataVentilatedSlab->VentSlab(Item).ZonePtr; + if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { DataSizing::DataFanEnumType = DataAirSystems::objectVectorOOFanSystemModel; } else { DataSizing::DataFanEnumType = DataAirSystems::structArrayLegacyFanModels; } - DataSizing::DataFanIndex = VentSlab(Item).Fan_Index; + DataSizing::DataFanIndex = state.dataVentilatedSlab->VentSlab(Item).Fan_Index; // ventilated slab unit is always blow thru DataSizing::DataFanPlacement = DataSizing::zoneFanPlacement::zoneBlowThru; - if (VentSlab(Item).HVACSizingIndex > 0) { - zoneHVACIndex = VentSlab(Item).HVACSizingIndex; + if (state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex > 0) { + zoneHVACIndex = state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex; // N1 , \field Maximum Supply Air Flow Rate FieldNum = 1; PrintFlag = true; - SizingString = VentSlabNumericFields(Item).FieldNames(FieldNum) + " [m3/s]"; + SizingString = state.dataVentilatedSlab->VentSlabNumericFields(Item).FieldNames(FieldNum) + " [m3/s]"; if (ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod > 0) { SizingMethod = DataHVACGlobals::CoolingAirflowSizing; SAFMethod = ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod; @@ -1954,44 +1866,44 @@ namespace VentilatedSlab { } } // DataScalableSizingON = false; - VentSlab(Item).MaxAirVolFlow = max(CoolingAirVolFlowScalable, HeatingAirVolFlowScalable); + state.dataVentilatedSlab->VentSlab(Item).MaxAirVolFlow = max(CoolingAirVolFlowScalable, HeatingAirVolFlowScalable); } else { // no scalble sizing method has been specified. Sizing proceeds using the method // specified in the zoneHVAC object // N1 , \field Maximum Supply Air Flow Rate FieldNum = 1; PrintFlag = true; - SizingString = VentSlabNumericFields(Item).FieldNames(FieldNum) + " [m3/s]"; - TempSize = VentSlab(Item).MaxAirVolFlow; + SizingString = state.dataVentilatedSlab->VentSlabNumericFields(Item).FieldNames(FieldNum) + " [m3/s]"; + TempSize = state.dataVentilatedSlab->VentSlab(Item).MaxAirVolFlow; SystemAirFlowSizer sizerSystemAirFlow; sizerSystemAirFlow.overrideSizingString(SizingString); // sizerSystemAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizerSystemAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - VentSlab(Item).MaxAirVolFlow = sizerSystemAirFlow.size(state, TempSize, ErrorsFound); + state.dataVentilatedSlab->VentSlab(Item).MaxAirVolFlow = sizerSystemAirFlow.size(state, TempSize, ErrorsFound); } IsAutoSize = false; - if (VentSlab(Item).OutAirVolFlow == AutoSize) { + if (state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow == AutoSize) { IsAutoSize = true; } if (CurZoneEqNum > 0) { if (!IsAutoSize && !ZoneSizingRunDone) { - if (VentSlab(Item).OutAirVolFlow > 0.0) { + if (state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow > 0.0) { BaseSizer::reportSizerOutput( - cMO_VentilatedSlab, VentSlab(Item).Name, "User-Specified Maximum Outdoor Air Flow Rate [m3/s]", VentSlab(Item).OutAirVolFlow); + state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name, "User-Specified Maximum Outdoor Air Flow Rate [m3/s]", state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow); } } else { // Autosize or hard-size with sizing run - CheckZoneSizing(cMO_VentilatedSlab, VentSlab(Item).Name); - OutAirVolFlowDes = VentSlab(Item).MaxAirVolFlow; + CheckZoneSizing(state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name); + OutAirVolFlowDes = state.dataVentilatedSlab->VentSlab(Item).MaxAirVolFlow; if (IsAutoSize) { - VentSlab(Item).OutAirVolFlow = OutAirVolFlowDes; + state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow = OutAirVolFlowDes; BaseSizer::reportSizerOutput( - cMO_VentilatedSlab, VentSlab(Item).Name, "Design Size Maximum Outdoor Air Flow Rate [m3/s]", OutAirVolFlowDes); + state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Maximum Outdoor Air Flow Rate [m3/s]", OutAirVolFlowDes); } else { - if (VentSlab(Item).OutAirVolFlow > 0.0 && OutAirVolFlowDes > 0.0) { - OutAirVolFlowUser = VentSlab(Item).OutAirVolFlow; - BaseSizer::reportSizerOutput(cMO_VentilatedSlab, - VentSlab(Item).Name, + if (state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow > 0.0 && OutAirVolFlowDes > 0.0) { + OutAirVolFlowUser = state.dataVentilatedSlab->VentSlab(Item).OutAirVolFlow; + BaseSizer::reportSizerOutput(state.dataVentilatedSlab->cMO_VentilatedSlab, + state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Maximum Outdoor Air Flow Rate [m3/s]", OutAirVolFlowDes, "User-Specified Maximum Outdoor Air Flow Rate [m3/s]", @@ -1999,7 +1911,7 @@ namespace VentilatedSlab { if (DisplayExtraWarnings) { if ((std::abs(OutAirVolFlowDes - OutAirVolFlowUser) / OutAirVolFlowUser) > AutoVsHardSizingThreshold) { ShowMessage("SizeVentilatedSlab: Potential issue with equipment sizing for ZoneHVAC:VentilatedSlab = \"" + - VentSlab(Item).Name + "\"."); + state.dataVentilatedSlab->VentSlab(Item).Name + "\"."); ShowContinueError("User-Specified Maximum Outdoor Air Flow Rate of " + RoundSigDigits(OutAirVolFlowUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Maximum Outdoor Air Flow Rate of " + RoundSigDigits(OutAirVolFlowDes, 5) + @@ -2014,32 +1926,32 @@ namespace VentilatedSlab { } IsAutoSize = false; - if (VentSlab(Item).MinOutAirVolFlow == AutoSize) { + if (state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow == AutoSize) { IsAutoSize = true; } if (CurZoneEqNum > 0) { if (!IsAutoSize && !ZoneSizingRunDone) { - if (VentSlab(Item).MinOutAirVolFlow > 0.0) { - BaseSizer::reportSizerOutput(cMO_VentilatedSlab, - VentSlab(Item).Name, + if (state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow > 0.0) { + BaseSizer::reportSizerOutput(state.dataVentilatedSlab->cMO_VentilatedSlab, + state.dataVentilatedSlab->VentSlab(Item).Name, "User-Specified Minimum Outdoor Air Flow Rate [m3/s]", - VentSlab(Item).MinOutAirVolFlow); + state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow); } } else { - CheckZoneSizing(cMO_VentilatedSlab, VentSlab(Item).Name); - MinOutAirVolFlowDes = min(FinalZoneSizing(CurZoneEqNum).MinOA, VentSlab(Item).MaxAirVolFlow); + CheckZoneSizing(state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name); + MinOutAirVolFlowDes = min(FinalZoneSizing(CurZoneEqNum).MinOA, state.dataVentilatedSlab->VentSlab(Item).MaxAirVolFlow); if (MinOutAirVolFlowDes < SmallAirVolFlow) { MinOutAirVolFlowDes = 0.0; } if (IsAutoSize) { - VentSlab(Item).MinOutAirVolFlow = MinOutAirVolFlowDes; + state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow = MinOutAirVolFlowDes; BaseSizer::reportSizerOutput( - cMO_VentilatedSlab, VentSlab(Item).Name, "Design Size Minimum Outdoor Air Flow Rate [m3/s]", MinOutAirVolFlowDes); + state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Minimum Outdoor Air Flow Rate [m3/s]", MinOutAirVolFlowDes); } else { // Hard-size with sizing data - if (VentSlab(Item).MinOutAirVolFlow > 0.0 && MinOutAirVolFlowDes > 0.0) { - MinOutAirVolFlowUser = VentSlab(Item).MinOutAirVolFlow; - BaseSizer::reportSizerOutput(cMO_VentilatedSlab, - VentSlab(Item).Name, + if (state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow > 0.0 && MinOutAirVolFlowDes > 0.0) { + MinOutAirVolFlowUser = state.dataVentilatedSlab->VentSlab(Item).MinOutAirVolFlow; + BaseSizer::reportSizerOutput(state.dataVentilatedSlab->cMO_VentilatedSlab, + state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Minimum Outdoor Air Flow Rate [m3/s]", MinOutAirVolFlowDes, "User-Specified Minimum Outdoor Air Flow Rate [m3/s]", @@ -2047,7 +1959,7 @@ namespace VentilatedSlab { if (DisplayExtraWarnings) { if ((std::abs(MinOutAirVolFlowDes - MinOutAirVolFlowUser) / MinOutAirVolFlowUser) > AutoVsHardSizingThreshold) { ShowMessage("SizeVentilatedSlab: Potential issue with equipment sizing for ZoneHVAC:VentilatedSlab = \"" + - VentSlab(Item).Name + "\"."); + state.dataVentilatedSlab->VentSlab(Item).Name + "\"."); ShowContinueError("User-Specified Minimum Outdoor Air Flow Rate of " + RoundSigDigits(MinOutAirVolFlowUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Minimum Outdoor Air Flow Rate of " + @@ -2062,28 +1974,28 @@ namespace VentilatedSlab { } IsAutoSize = false; - if (VentSlab(Item).MaxVolHotWaterFlow == AutoSize) { + if (state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow == AutoSize) { IsAutoSize = true; } - if (VentSlab(Item).HCoilType == Heating_WaterCoilType) { + if (state.dataVentilatedSlab->VentSlab(Item).HCoilType == state.dataVentilatedSlab->Heating_WaterCoilType) { if (CurZoneEqNum > 0) { if (!IsAutoSize && !ZoneSizingRunDone) { - if (VentSlab(Item).MaxVolHotWaterFlow > 0.0) { - BaseSizer::reportSizerOutput(cMO_VentilatedSlab, - VentSlab(Item).Name, + if (state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow > 0.0) { + BaseSizer::reportSizerOutput(state.dataVentilatedSlab->cMO_VentilatedSlab, + state.dataVentilatedSlab->VentSlab(Item).Name, "User-Specified Maximum Hot Water Flow [m3/s]", - VentSlab(Item).MaxVolHotWaterFlow); + state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow); } } else { // Autosize or hard-size with sizing run - CheckZoneSizing(cMO_VentilatedSlab, VentSlab(Item).Name); + CheckZoneSizing(state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name); - CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", VentSlab(Item).HCoilName, ErrorsFound); - CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, "Coil:Heating:Water", VentSlab(Item).HCoilName, ErrorsFound); + CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", state.dataVentilatedSlab->VentSlab(Item).HCoilName, ErrorsFound); + CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, "Coil:Heating:Water", state.dataVentilatedSlab->VentSlab(Item).HCoilName, ErrorsFound); if (IsAutoSize) { PltSizHeatNum = - MyPlantSizingIndex("Coil:Heating:Water", VentSlab(Item).HCoilName, CoilWaterInletNode, CoilWaterOutletNode, ErrorsFound); - CoilNum = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", VentSlab(Item).HCoilName, ErrorsFound); + MyPlantSizingIndex("Coil:Heating:Water", state.dataVentilatedSlab->VentSlab(Item).HCoilName, CoilWaterInletNode, CoilWaterOutletNode, ErrorsFound); + CoilNum = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", state.dataVentilatedSlab->VentSlab(Item).HCoilName, ErrorsFound); if (state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp) { WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp; DoWaterCoilSizing = true; @@ -2095,15 +2007,15 @@ namespace VentilatedSlab { DoWaterCoilSizing = false; // If there is no heating Plant Sizing object and autosizing was requested, issue fatal error message ShowSevereError("Autosizing of water flow requires a heating loop Sizing:Plant object"); - ShowContinueError("Occurs in " + cMO_VentilatedSlab + " Object=" + VentSlab(Item).Name); + ShowContinueError("Occurs in " + state.dataVentilatedSlab->cMO_VentilatedSlab + " Object=" + state.dataVentilatedSlab->VentSlab(Item).Name); ErrorsFound = true; } } if (DoWaterCoilSizing) { if (FinalZoneSizing(CurZoneEqNum).DesHeatMassFlow >= SmallAirVolFlow) { SizingMethod = HeatingCapacitySizing; - if (VentSlab(Item).HVACSizingIndex > 0) { - zoneHVACIndex = VentSlab(Item).HVACSizingIndex; + if (state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex > 0) { + zoneHVACIndex = state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex; CapSizingMethod = ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == HeatingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || @@ -2144,13 +2056,13 @@ namespace VentilatedSlab { sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); DesCoilLoad = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); } - rho = GetDensityGlycol(state, PlantLoop(VentSlab(Item).HWLoopNum).FluidName, + rho = GetDensityGlycol(state, PlantLoop(state.dataVentilatedSlab->VentSlab(Item).HWLoopNum).FluidName, HWInitConvTemp, - PlantLoop(VentSlab(Item).HWLoopNum).FluidIndex, + PlantLoop(state.dataVentilatedSlab->VentSlab(Item).HWLoopNum).FluidIndex, RoutineName); - Cp = GetSpecificHeatGlycol(state, PlantLoop(VentSlab(Item).HWLoopNum).FluidName, + Cp = GetSpecificHeatGlycol(state, PlantLoop(state.dataVentilatedSlab->VentSlab(Item).HWLoopNum).FluidName, HWInitConvTemp, - PlantLoop(VentSlab(Item).HWLoopNum).FluidIndex, + PlantLoop(state.dataVentilatedSlab->VentSlab(Item).HWLoopNum).FluidIndex, RoutineName); MaxVolHotWaterFlowDes = DesCoilLoad / (WaterCoilSizDeltaT * Cp * rho); } else { @@ -2160,14 +2072,14 @@ namespace VentilatedSlab { } if (IsAutoSize) { - VentSlab(Item).MaxVolHotWaterFlow = MaxVolHotWaterFlowDes; + state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow = MaxVolHotWaterFlowDes; BaseSizer::reportSizerOutput( - cMO_VentilatedSlab, VentSlab(Item).Name, "Design Size Maximum Hot Water Flow [m3/s]", MaxVolHotWaterFlowDes); + state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Maximum Hot Water Flow [m3/s]", MaxVolHotWaterFlowDes); } else { // Hard-size with sizing data - if (VentSlab(Item).MaxVolHotWaterFlow > 0.0 && MaxVolHotWaterFlowDes > 0.0) { - MaxVolHotWaterFlowUser = VentSlab(Item).MaxVolHotWaterFlow; - BaseSizer::reportSizerOutput(cMO_VentilatedSlab, - VentSlab(Item).Name, + if (state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow > 0.0 && MaxVolHotWaterFlowDes > 0.0) { + MaxVolHotWaterFlowUser = state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow; + BaseSizer::reportSizerOutput(state.dataVentilatedSlab->cMO_VentilatedSlab, + state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Maximum Hot Water Flow [m3/s]", MaxVolHotWaterFlowDes, "User-Specified Maximum Hot Water Flow [m3/s]", @@ -2175,7 +2087,7 @@ namespace VentilatedSlab { if (DisplayExtraWarnings) { if ((std::abs(MaxVolHotWaterFlowDes - MaxVolHotWaterFlowUser) / MaxVolHotWaterFlowUser) > AutoVsHardSizingThreshold) { ShowMessage("SizeVentilatedSlab: Potential issue with equipment sizing for ZoneHVAC:VentilatedSlab = \"" + - VentSlab(Item).Name + "\"."); + state.dataVentilatedSlab->VentSlab(Item).Name + "\"."); ShowContinueError("User-Specified Maximum Hot Water Flow of " + RoundSigDigits(MaxVolHotWaterFlowUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Maximum Hot Water Flow of " + @@ -2189,34 +2101,34 @@ namespace VentilatedSlab { } } } else { - VentSlab(Item).MaxVolHotWaterFlow = 0.0; + state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow = 0.0; } IsAutoSize = false; - if (VentSlab(Item).MaxVolHotSteamFlow == AutoSize) { + if (state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow == AutoSize) { IsAutoSize = true; } - if (VentSlab(Item).HCoilType == Heating_SteamCoilType) { + if (state.dataVentilatedSlab->VentSlab(Item).HCoilType == state.dataVentilatedSlab->Heating_SteamCoilType) { if (CurZoneEqNum > 0) { if (!IsAutoSize && !ZoneSizingRunDone) { - if (VentSlab(Item).MaxVolHotSteamFlow > 0.0) { + if (state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow > 0.0) { BaseSizer::reportSizerOutput( - cMO_VentilatedSlab, VentSlab(Item).Name, "User-Specified Maximum Steam Flow [m3/s]", VentSlab(Item).MaxVolHotSteamFlow); + state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name, "User-Specified Maximum Steam Flow [m3/s]", state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow); } } else { // Autosize or hard-size with sizing run - CheckZoneSizing("ZoneHVAC:VentilatedSlab", VentSlab(Item).Name); + CheckZoneSizing("ZoneHVAC:VentilatedSlab", state.dataVentilatedSlab->VentSlab(Item).Name); - CoilSteamInletNode = GetCoilSteamInletNode(state, "Coil:Heating:Steam", VentSlab(Item).HCoilName, ErrorsFound); - CoilSteamOutletNode = GetCoilSteamOutletNode(state, "Coil:Heating:Steam", VentSlab(Item).HCoilName, ErrorsFound); + CoilSteamInletNode = GetCoilSteamInletNode(state, "Coil:Heating:Steam", state.dataVentilatedSlab->VentSlab(Item).HCoilName, ErrorsFound); + CoilSteamOutletNode = GetCoilSteamOutletNode(state, "Coil:Heating:Steam", state.dataVentilatedSlab->VentSlab(Item).HCoilName, ErrorsFound); if (IsAutoSize) { PltSizHeatNum = - MyPlantSizingIndex("Coil:Heating:Steam", VentSlab(Item).HCoilName, CoilSteamInletNode, CoilSteamOutletNode, ErrorsFound); + MyPlantSizingIndex("Coil:Heating:Steam", state.dataVentilatedSlab->VentSlab(Item).HCoilName, CoilSteamInletNode, CoilSteamOutletNode, ErrorsFound); if (PltSizHeatNum > 0) { if (FinalZoneSizing(CurZoneEqNum).DesHeatMassFlow >= SmallAirVolFlow) { SizingMethod = HeatingCapacitySizing; - if (VentSlab(Item).HVACSizingIndex > 0) { - zoneHVACIndex = VentSlab(Item).HVACSizingIndex; + if (state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex > 0) { + zoneHVACIndex = state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex; CapSizingMethod = ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == HeatingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || @@ -2258,11 +2170,11 @@ namespace VentilatedSlab { DesCoilLoad = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); } TempSteamIn = 100.00; - EnthSteamInDry = GetSatEnthalpyRefrig(state, fluidNameSteam, TempSteamIn, 1.0, VentSlab(Item).HCoil_FluidIndex, RoutineName); + EnthSteamInDry = GetSatEnthalpyRefrig(state, fluidNameSteam, TempSteamIn, 1.0, state.dataVentilatedSlab->VentSlab(Item).HCoil_FluidIndex, RoutineName); EnthSteamOutWet = - GetSatEnthalpyRefrig(state, fluidNameSteam, TempSteamIn, 0.0, VentSlab(Item).HCoil_FluidIndex, RoutineName); + GetSatEnthalpyRefrig(state, fluidNameSteam, TempSteamIn, 0.0, state.dataVentilatedSlab->VentSlab(Item).HCoil_FluidIndex, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - SteamDensity = GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, VentSlab(Item).HCoil_FluidIndex, RoutineName); + SteamDensity = GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, state.dataVentilatedSlab->VentSlab(Item).HCoil_FluidIndex, RoutineName); Cp = GetSpecificHeatGlycol(state, fluidNameWater, HWInitConvTemp, DummyWaterIndex, RoutineName); rho = GetDensityGlycol(state, fluidNameWater, HWInitConvTemp, DummyWaterIndex, RoutineName); MaxVolHotSteamFlowDes = @@ -2272,19 +2184,19 @@ namespace VentilatedSlab { } } else { ShowSevereError("Autosizing of Steam flow requires a heating loop Sizing:Plant object"); - ShowContinueError("Occurs in ZoneHVAC:VentilatedSlab Object=" + VentSlab(Item).Name); + ShowContinueError("Occurs in ZoneHVAC:VentilatedSlab Object=" + state.dataVentilatedSlab->VentSlab(Item).Name); ErrorsFound = true; } } if (IsAutoSize) { - VentSlab(Item).MaxVolHotSteamFlow = MaxVolHotSteamFlowDes; + state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow = MaxVolHotSteamFlowDes; BaseSizer::reportSizerOutput( - cMO_VentilatedSlab, VentSlab(Item).Name, "Design Size Maximum Steam Flow [m3/s]", MaxVolHotSteamFlowDes); + state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Maximum Steam Flow [m3/s]", MaxVolHotSteamFlowDes); } else { - if (VentSlab(Item).MaxVolHotSteamFlow > 0.0 && MaxVolHotSteamFlowDes > 0.0) { - MaxVolHotSteamFlowUser = VentSlab(Item).MaxVolHotSteamFlow; - BaseSizer::reportSizerOutput(cMO_VentilatedSlab, - VentSlab(Item).Name, + if (state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow > 0.0 && MaxVolHotSteamFlowDes > 0.0) { + MaxVolHotSteamFlowUser = state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow; + BaseSizer::reportSizerOutput(state.dataVentilatedSlab->cMO_VentilatedSlab, + state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Maximum Steam Flow [m3/s]", MaxVolHotSteamFlowDes, "User-Specified Maximum Steam Flow [m3/s]", @@ -2292,7 +2204,7 @@ namespace VentilatedSlab { if (DisplayExtraWarnings) { if ((std::abs(MaxVolHotSteamFlowDes - MaxVolHotSteamFlowUser) / MaxVolHotSteamFlowUser) > AutoVsHardSizingThreshold) { ShowMessage("SizeVentilatedSlab: Potential issue with equipment sizing for ZoneHVAC:VentilatedSlab = \"" + - VentSlab(Item).Name + "\"."); + state.dataVentilatedSlab->VentSlab(Item).Name + "\"."); ShowContinueError("User-Specified Maximum Steam Flow of " + RoundSigDigits(MaxVolHotSteamFlowUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Maximum Steam Flow of " + RoundSigDigits(MaxVolHotSteamFlowDes, 5) + @@ -2306,27 +2218,27 @@ namespace VentilatedSlab { } } } else { - VentSlab(Item).MaxVolHotSteamFlow = 0.0; + state.dataVentilatedSlab->VentSlab(Item).MaxVolHotSteamFlow = 0.0; } IsAutoSize = false; - if (VentSlab(Item).MaxVolColdWaterFlow == AutoSize) { + if (state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow == AutoSize) { IsAutoSize = true; } if (CurZoneEqNum > 0) { if (!IsAutoSize && !ZoneSizingRunDone) { - if (VentSlab(Item).MaxVolColdWaterFlow > 0.0) { + if (state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow > 0.0) { BaseSizer::reportSizerOutput( - cMO_VentilatedSlab, VentSlab(Item).Name, "User-Specified Maximum Cold Water Flow [m3/s]", VentSlab(Item).MaxVolColdWaterFlow); + state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name, "User-Specified Maximum Cold Water Flow [m3/s]", state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow); } } else { - CheckZoneSizing(cMO_VentilatedSlab, VentSlab(Item).Name); - if (VentSlab(Item).CCoilType == Cooling_CoilHXAssisted) { - CoolingCoilName = GetHXDXCoilName(state, VentSlab(Item).CCoilTypeCh, VentSlab(Item).CCoilName, ErrorsFound); - CoolingCoilType = GetHXCoilType(state, VentSlab(Item).CCoilTypeCh, VentSlab(Item).CCoilName, ErrorsFound); + CheckZoneSizing(state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name); + if (state.dataVentilatedSlab->VentSlab(Item).CCoilType == state.dataVentilatedSlab->Cooling_CoilHXAssisted) { + CoolingCoilName = GetHXDXCoilName(state, state.dataVentilatedSlab->VentSlab(Item).CCoilTypeCh, state.dataVentilatedSlab->VentSlab(Item).CCoilName, ErrorsFound); + CoolingCoilType = GetHXCoilType(state, state.dataVentilatedSlab->VentSlab(Item).CCoilTypeCh, state.dataVentilatedSlab->VentSlab(Item).CCoilName, ErrorsFound); } else { - CoolingCoilName = VentSlab(Item).CCoilName; - CoolingCoilType = VentSlab(Item).CCoilTypeCh; + CoolingCoilName = state.dataVentilatedSlab->VentSlab(Item).CCoilName; + CoolingCoilType = state.dataVentilatedSlab->VentSlab(Item).CCoilTypeCh; } CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); @@ -2344,15 +2256,15 @@ namespace VentilatedSlab { DoWaterCoilSizing = false; // If there is no cooling Plant Sizing object and autosizing was requested, issue fatal error message ShowSevereError("Autosizing of water flow requires a cooling loop Sizing:Plant object"); - ShowContinueError("Occurs in " + cMO_VentilatedSlab + " Object=" + VentSlab(Item).Name); + ShowContinueError("Occurs in " + state.dataVentilatedSlab->cMO_VentilatedSlab + " Object=" + state.dataVentilatedSlab->VentSlab(Item).Name); ErrorsFound = true; } } if (DoWaterCoilSizing) { if (FinalZoneSizing(CurZoneEqNum).DesCoolMassFlow >= SmallAirVolFlow) { SizingMethod = CoolingCapacitySizing; - if (VentSlab(Item).HVACSizingIndex > 0) { - zoneHVACIndex = VentSlab(Item).HVACSizingIndex; + if (state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex > 0) { + zoneHVACIndex = state.dataVentilatedSlab->VentSlab(Item).HVACSizingIndex; CapSizingMethod = ZoneHVACSizing(zoneHVACIndex).CoolingCapMethod; ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == CoolingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || @@ -2395,9 +2307,9 @@ namespace VentilatedSlab { DesCoilLoad = sizerCoolingCapacity.size(state, TempSize, ErrorsFound); } rho = GetDensityGlycol( - state, PlantLoop(VentSlab(Item).CWLoopNum).FluidName, 5., PlantLoop(VentSlab(Item).CWLoopNum).FluidIndex, RoutineName); + state, PlantLoop(state.dataVentilatedSlab->VentSlab(Item).CWLoopNum).FluidName, 5., PlantLoop(state.dataVentilatedSlab->VentSlab(Item).CWLoopNum).FluidIndex, RoutineName); Cp = GetSpecificHeatGlycol( - state, PlantLoop(VentSlab(Item).CWLoopNum).FluidName, 5., PlantLoop(VentSlab(Item).CWLoopNum).FluidIndex, RoutineName); + state, PlantLoop(state.dataVentilatedSlab->VentSlab(Item).CWLoopNum).FluidName, 5., PlantLoop(state.dataVentilatedSlab->VentSlab(Item).CWLoopNum).FluidIndex, RoutineName); MaxVolColdWaterFlowDes = DesCoilLoad / (WaterCoilSizDeltaT * Cp * rho); } else { MaxVolColdWaterFlowDes = 0.0; @@ -2405,14 +2317,14 @@ namespace VentilatedSlab { } } if (IsAutoSize) { - VentSlab(Item).MaxVolColdWaterFlow = MaxVolColdWaterFlowDes; + state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow = MaxVolColdWaterFlowDes; BaseSizer::reportSizerOutput( - cMO_VentilatedSlab, VentSlab(Item).Name, "Design Size Maximum Cold Water Flow [m3/s]", MaxVolColdWaterFlowDes); + state.dataVentilatedSlab->cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Maximum Cold Water Flow [m3/s]", MaxVolColdWaterFlowDes); } else { - if (VentSlab(Item).MaxVolColdWaterFlow > 0.0 && MaxVolColdWaterFlowDes > 0.0) { - MaxVolColdWaterFlowUser = VentSlab(Item).MaxVolColdWaterFlow; - BaseSizer::reportSizerOutput(cMO_VentilatedSlab, - VentSlab(Item).Name, + if (state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow > 0.0 && MaxVolColdWaterFlowDes > 0.0) { + MaxVolColdWaterFlowUser = state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow; + BaseSizer::reportSizerOutput(state.dataVentilatedSlab->cMO_VentilatedSlab, + state.dataVentilatedSlab->VentSlab(Item).Name, "Design Size Maximum Cold Water Flow [m3/s]", MaxVolColdWaterFlowDes, "User-Specified Maximum Cold Water Flow [m3/s]", @@ -2420,7 +2332,7 @@ namespace VentilatedSlab { if (DisplayExtraWarnings) { if ((std::abs(MaxVolColdWaterFlowDes - MaxVolColdWaterFlowUser) / MaxVolColdWaterFlowUser) > AutoVsHardSizingThreshold) { ShowMessage("SizeVentilatedSlab: Potential issue with equipment sizing for ZoneHVAC:VentilatedSlab = \"" + - VentSlab(Item).Name + "\"."); + state.dataVentilatedSlab->VentSlab(Item).Name + "\"."); ShowContinueError("User-Specified Maximum Cold Water Flow of " + RoundSigDigits(MaxVolColdWaterFlowUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Maximum Cold Water Flow of " + RoundSigDigits(MaxVolColdWaterFlowDes, 5) + @@ -2434,19 +2346,19 @@ namespace VentilatedSlab { } } - if (VentSlab(Item).CCoilType == Cooling_CoilHXAssisted) { - CoolingCoilName = GetHXDXCoilName(state, VentSlab(Item).CCoilTypeCh, VentSlab(Item).CCoilName, ErrorsFound); - CoolingCoilType = GetHXCoilType(state, VentSlab(Item).CCoilTypeCh, VentSlab(Item).CCoilName, ErrorsFound); + if (state.dataVentilatedSlab->VentSlab(Item).CCoilType == state.dataVentilatedSlab->Cooling_CoilHXAssisted) { + CoolingCoilName = GetHXDXCoilName(state, state.dataVentilatedSlab->VentSlab(Item).CCoilTypeCh, state.dataVentilatedSlab->VentSlab(Item).CCoilName, ErrorsFound); + CoolingCoilType = GetHXCoilType(state, state.dataVentilatedSlab->VentSlab(Item).CCoilTypeCh, state.dataVentilatedSlab->VentSlab(Item).CCoilName, ErrorsFound); } else { - CoolingCoilName = VentSlab(Item).CCoilName; - CoolingCoilType = VentSlab(Item).CCoilTypeCh; + CoolingCoilName = state.dataVentilatedSlab->VentSlab(Item).CCoilName; + CoolingCoilType = state.dataVentilatedSlab->VentSlab(Item).CCoilTypeCh; } - WaterCoils::SetCoilDesFlow(state, CoolingCoilType, CoolingCoilName, VentSlab(Item).MaxAirVolFlow, ErrorsFound); - WaterCoils::SetCoilDesFlow(state, VentSlab(Item).HCoilTypeCh, VentSlab(Item).HCoilName, VentSlab(Item).MaxAirVolFlow, ErrorsFound); + WaterCoils::SetCoilDesFlow(state, CoolingCoilType, CoolingCoilName, state.dataVentilatedSlab->VentSlab(Item).MaxAirVolFlow, ErrorsFound); + WaterCoils::SetCoilDesFlow(state, state.dataVentilatedSlab->VentSlab(Item).HCoilTypeCh, state.dataVentilatedSlab->VentSlab(Item).HCoilName, state.dataVentilatedSlab->VentSlab(Item).MaxAirVolFlow, ErrorsFound); if (CurZoneEqNum > 0) { - ZoneEqSizing(CurZoneEqNum).MaxHWVolFlow = VentSlab(Item).MaxVolHotWaterFlow; - ZoneEqSizing(CurZoneEqNum).MaxCWVolFlow = VentSlab(Item).MaxVolColdWaterFlow; + ZoneEqSizing(CurZoneEqNum).MaxHWVolFlow = state.dataVentilatedSlab->VentSlab(Item).MaxVolHotWaterFlow; + ZoneEqSizing(CurZoneEqNum).MaxCWVolFlow = state.dataVentilatedSlab->VentSlab(Item).MaxVolColdWaterFlow; } if (ErrorsFound) { @@ -2588,90 +2500,90 @@ namespace VentilatedSlab { static std::string const CurrentModuleObject("ZoneHVAC:VentilatedSlab"); { - auto const SELECT_CASE_var(VentSlab(Item).CoilOption); - if (SELECT_CASE_var == BothOption) { + auto const SELECT_CASE_var(state.dataVentilatedSlab->VentSlab(Item).CoilOption); + if (SELECT_CASE_var == state.dataVentilatedSlab->BothOption) { { - auto const SELECT_CASE_var1(VentSlab(Item).HCoilType); + auto const SELECT_CASE_var1(state.dataVentilatedSlab->VentSlab(Item).HCoilType); - if (SELECT_CASE_var1 == Heating_WaterCoilType) { - CheckWaterCoilSchedule(state, "Coil:Heating:Water", VentSlab(Item).HCoilName, VentSlab(Item).HCoilSchedValue, VentSlab(Item).HCoil_Index); - } else if (SELECT_CASE_var1 == Heating_SteamCoilType) { + if (SELECT_CASE_var1 == state.dataVentilatedSlab->Heating_WaterCoilType) { + CheckWaterCoilSchedule(state, "Coil:Heating:Water", state.dataVentilatedSlab->VentSlab(Item).HCoilName, state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Heating_SteamCoilType) { CheckSteamCoilSchedule(state, - "Coil:Heating:Steam", VentSlab(Item).HCoilName, VentSlab(Item).HCoilSchedValue, VentSlab(Item).HCoil_Index); - } else if (SELECT_CASE_var1 == Heating_ElectricCoilType) { + "Coil:Heating:Steam", state.dataVentilatedSlab->VentSlab(Item).HCoilName, state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Heating_ElectricCoilType) { CheckHeatingCoilSchedule( - state, "Coil:Heating:Electric", VentSlab(Item).HCoilName, VentSlab(Item).HCoilSchedValue, VentSlab(Item).HCoil_Index); - } else if (SELECT_CASE_var1 == Heating_GasCoilType) { + state, "Coil:Heating:Electric", state.dataVentilatedSlab->VentSlab(Item).HCoilName, state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Heating_GasCoilType) { CheckHeatingCoilSchedule( - state, "Coil:Heating:Fuel", VentSlab(Item).HCoilName, VentSlab(Item).HCoilSchedValue, VentSlab(Item).HCoil_Index); + state, "Coil:Heating:Fuel", state.dataVentilatedSlab->VentSlab(Item).HCoilName, state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); } else { } } { - auto const SELECT_CASE_var1(VentSlab(Item).CCoilType); + auto const SELECT_CASE_var1(state.dataVentilatedSlab->VentSlab(Item).CCoilType); - if (SELECT_CASE_var1 == Cooling_CoilWaterCooling) { - CheckWaterCoilSchedule(state, "Coil:Cooling:Water", VentSlab(Item).CCoilName, VentSlab(Item).CCoilSchedValue, VentSlab(Item).CCoil_Index); - } else if (SELECT_CASE_var1 == Cooling_CoilDetailedCooling) { + if (SELECT_CASE_var1 == state.dataVentilatedSlab->Cooling_CoilWaterCooling) { + CheckWaterCoilSchedule(state, "Coil:Cooling:Water", state.dataVentilatedSlab->VentSlab(Item).CCoilName, state.dataVentilatedSlab->VentSlab(Item).CCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).CCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Cooling_CoilDetailedCooling) { CheckWaterCoilSchedule(state, "Coil:Cooling:Water:DetailedGeometry", - VentSlab(Item).CCoilName, - VentSlab(Item).CCoilSchedValue, - VentSlab(Item).CCoil_Index); - } else if (SELECT_CASE_var1 == Cooling_CoilHXAssisted) { + state.dataVentilatedSlab->VentSlab(Item).CCoilName, + state.dataVentilatedSlab->VentSlab(Item).CCoilSchedValue, + state.dataVentilatedSlab->VentSlab(Item).CCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Cooling_CoilHXAssisted) { CheckHXAssistedCoolingCoilSchedule(state, "CoilSystem:Cooling:Water:HeatExchangerAssisted", - VentSlab(Item).CCoilName, - VentSlab(Item).CCoilSchedValue, - VentSlab(Item).CCoil_Index); + state.dataVentilatedSlab->VentSlab(Item).CCoilName, + state.dataVentilatedSlab->VentSlab(Item).CCoilSchedValue, + state.dataVentilatedSlab->VentSlab(Item).CCoil_Index); } else { } } - } else if (SELECT_CASE_var == HeatingOption) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->HeatingOption) { { - auto const SELECT_CASE_var1(VentSlab(Item).HCoilType); + auto const SELECT_CASE_var1(state.dataVentilatedSlab->VentSlab(Item).HCoilType); - if (SELECT_CASE_var1 == Heating_WaterCoilType) { - CheckWaterCoilSchedule(state, "Coil:Heating:Water", VentSlab(Item).HCoilName, VentSlab(Item).HCoilSchedValue, VentSlab(Item).HCoil_Index); - } else if (SELECT_CASE_var1 == Heating_SteamCoilType) { + if (SELECT_CASE_var1 == state.dataVentilatedSlab->Heating_WaterCoilType) { + CheckWaterCoilSchedule(state, "Coil:Heating:Water", state.dataVentilatedSlab->VentSlab(Item).HCoilName, state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Heating_SteamCoilType) { CheckSteamCoilSchedule(state, - "Coil:Heating:Steam", VentSlab(Item).HCoilName, VentSlab(Item).HCoilSchedValue, VentSlab(Item).HCoil_Index); - } else if (SELECT_CASE_var1 == Heating_ElectricCoilType) { + "Coil:Heating:Steam", state.dataVentilatedSlab->VentSlab(Item).HCoilName, state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Heating_ElectricCoilType) { CheckHeatingCoilSchedule( - state, "Coil:Heating:Electric", VentSlab(Item).HCoilName, VentSlab(Item).HCoilSchedValue, VentSlab(Item).HCoil_Index); - } else if (SELECT_CASE_var1 == Heating_GasCoilType) { + state, "Coil:Heating:Electric", state.dataVentilatedSlab->VentSlab(Item).HCoilName, state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Heating_GasCoilType) { CheckHeatingCoilSchedule( - state, "Coil:Heating:Fuel", VentSlab(Item).HCoilName, VentSlab(Item).HCoilSchedValue, VentSlab(Item).HCoil_Index); + state, "Coil:Heating:Fuel", state.dataVentilatedSlab->VentSlab(Item).HCoilName, state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); } else { } } - } else if (SELECT_CASE_var == CoolingOption) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->CoolingOption) { { - auto const SELECT_CASE_var1(VentSlab(Item).CCoilType); + auto const SELECT_CASE_var1(state.dataVentilatedSlab->VentSlab(Item).CCoilType); - if (SELECT_CASE_var1 == Cooling_CoilWaterCooling) { - CheckWaterCoilSchedule(state, "Coil:Cooling:Water", VentSlab(Item).CCoilName, VentSlab(Item).CCoilSchedValue, VentSlab(Item).CCoil_Index); - } else if (SELECT_CASE_var1 == Cooling_CoilDetailedCooling) { + if (SELECT_CASE_var1 == state.dataVentilatedSlab->Cooling_CoilWaterCooling) { + CheckWaterCoilSchedule(state, "Coil:Cooling:Water", state.dataVentilatedSlab->VentSlab(Item).CCoilName, state.dataVentilatedSlab->VentSlab(Item).CCoilSchedValue, state.dataVentilatedSlab->VentSlab(Item).CCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Cooling_CoilDetailedCooling) { CheckWaterCoilSchedule(state, "Coil:Cooling:Water:DetailedGeometry", - VentSlab(Item).CCoilName, - VentSlab(Item).CCoilSchedValue, - VentSlab(Item).CCoil_Index); - } else if (SELECT_CASE_var1 == Cooling_CoilHXAssisted) { + state.dataVentilatedSlab->VentSlab(Item).CCoilName, + state.dataVentilatedSlab->VentSlab(Item).CCoilSchedValue, + state.dataVentilatedSlab->VentSlab(Item).CCoil_Index); + } else if (SELECT_CASE_var1 == state.dataVentilatedSlab->Cooling_CoilHXAssisted) { CheckHXAssistedCoolingCoilSchedule(state, "CoilSystem:Cooling:Water:HeatExchangerAssisted", - VentSlab(Item).CCoilName, - VentSlab(Item).CCoilSchedValue, - VentSlab(Item).CCoil_Index); + state.dataVentilatedSlab->VentSlab(Item).CCoilName, + state.dataVentilatedSlab->VentSlab(Item).CCoilSchedValue, + state.dataVentilatedSlab->VentSlab(Item).CCoil_Index); } else { } } - } else if (SELECT_CASE_var == NoneOption) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->NoneOption) { } } @@ -2684,49 +2596,49 @@ namespace VentilatedSlab { MaxWaterFlow = 0.0; MinWaterFlow = 0.0; AirMassFlow = 0.0; - InletNode = VentSlab(Item).ReturnAirNode; - OutletNode = VentSlab(Item).RadInNode; - FanOutletNode = VentSlab(Item).FanOutletNode; - ZoneAirInNode = VentSlab(Item).ZoneAirInNode; - OutsideAirNode = VentSlab(Item).OutsideAirNode; - AirRelNode = VentSlab(Item).AirReliefNode; - MixoutNode = VentSlab(Item).OAMixerOutNode; - ReturnAirNode = VentSlab(Item).ReturnAirNode; - ZoneRadNum = VentSlab(Item).ZonePtr; - RadSurfNum = VentSlab(Item).NumOfSurfaces; + InletNode = state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode; + OutletNode = state.dataVentilatedSlab->VentSlab(Item).RadInNode; + FanOutletNode = state.dataVentilatedSlab->VentSlab(Item).FanOutletNode; + ZoneAirInNode = state.dataVentilatedSlab->VentSlab(Item).ZoneAirInNode; + OutsideAirNode = state.dataVentilatedSlab->VentSlab(Item).OutsideAirNode; + AirRelNode = state.dataVentilatedSlab->VentSlab(Item).AirReliefNode; + MixoutNode = state.dataVentilatedSlab->VentSlab(Item).OAMixerOutNode; + ReturnAirNode = state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode; + ZoneRadNum = state.dataVentilatedSlab->VentSlab(Item).ZonePtr; + RadSurfNum = state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; Tinlet = Node(InletNode).Temp; Toutdoor = Node(OutsideAirNode).Temp; // Control Type Check { - auto const SELECT_CASE_var(VentSlab(Item).ControlType); - if (SELECT_CASE_var == MATControl) { + auto const SELECT_CASE_var(state.dataVentilatedSlab->VentSlab(Item).ControlType); + if (SELECT_CASE_var == state.dataVentilatedSlab->MATControl) { SetPointTemp = MAT(ZoneNum); - } else if (SELECT_CASE_var == MRTControl) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->MRTControl) { SetPointTemp = MRT(ZoneNum); - } else if (SELECT_CASE_var == OPTControl) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->OPTControl) { SetPointTemp = 0.5 * (MAT(ZoneNum) + MRT(ZoneNum)); - } else if (SELECT_CASE_var == ODBControl) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->ODBControl) { SetPointTemp = OutDryBulbTemp; - } else if (SELECT_CASE_var == OWBControl) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->OWBControl) { SetPointTemp = OutWetBulbTemp; - } else if (SELECT_CASE_var == SURControl) { - SetPointTemp = TH(2, 1, VentSlab(Item).SurfacePtr(RadSurfNum)); - } else if (SELECT_CASE_var == DPTZControl) { - SetPointTemp = PsyTdpFnWPb(ZoneAirHumRat(VentSlab(Item).ZonePtr), OutBaroPress); + } else if (SELECT_CASE_var == state.dataVentilatedSlab->SURControl) { + SetPointTemp = TH(2, 1, state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum)); + } else if (SELECT_CASE_var == state.dataVentilatedSlab->DPTZControl) { + SetPointTemp = PsyTdpFnWPb(ZoneAirHumRat(state.dataVentilatedSlab->VentSlab(Item).ZonePtr), OutBaroPress); } else { // Should never get here SetPointTemp = 0.0; // Suppress uninitialized warning - ShowSevereError("Illegal control type in low temperature radiant system: " + VentSlab(Item).Name); + ShowSevereError("Illegal control type in low temperature radiant system: " + state.dataVentilatedSlab->VentSlab(Item).Name); ShowFatalError("Preceding condition causes termination."); } } // Load Check - AirTempHeatHi = GetCurrentScheduleValue(VentSlab(Item).HotCtrlHiTempSchedPtr); - AirTempCoolLo = GetCurrentScheduleValue(VentSlab(Item).ColdCtrlLoTempSchedPtr); + AirTempHeatHi = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).HotCtrlHiTempSchedPtr); + AirTempCoolLo = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).ColdCtrlLoTempSchedPtr); - if (((SetPointTemp >= AirTempHeatHi) && (SetPointTemp <= AirTempCoolLo)) || (GetCurrentScheduleValue(VentSlab(Item).SchedPtr) <= 0)) { + if (((SetPointTemp >= AirTempHeatHi) && (SetPointTemp <= AirTempCoolLo)) || (GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).SchedPtr) <= 0)) { // System is off or has no load upon it; set the flow rates to zero and then // simulate the components with the no flow conditions @@ -2752,25 +2664,25 @@ namespace VentilatedSlab { Node(FanOutletNode).MassFlowRateMaxAvail = 0.0; Node(FanOutletNode).MassFlowRateMinAvail = 0.0; AirMassFlow = 0.0; - HCoilOn = false; + state.dataVentilatedSlab->HCoilOn = false; // Node condition - Node(InletNode).Temp = TH(2, 1, VentSlab(Item).SurfacePtr(1)); + Node(InletNode).Temp = TH(2, 1, state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(1)); Node(FanOutletNode).Temp = Node(InletNode).Temp; Node(OutletNode).Temp = Node(FanOutletNode).Temp; // Node condition - if (VentSlab(Item).SysConfg == SeriesSlabs) { - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - SlabName = VentSlab(Item).SurfaceName(RadSurfNum); - MSlabIn = VentSlab(Item).SlabIn(RadSurfNum); - MSlabOut = VentSlab(Item).SlabOut(RadSurfNum); - VentSlab(Item).MSlabInNode = GetOnlySingleNode(state, + if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SeriesSlabs) { + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + SlabName = state.dataVentilatedSlab->VentSlab(Item).SurfaceName(RadSurfNum); + MSlabIn = state.dataVentilatedSlab->VentSlab(Item).SlabIn(RadSurfNum); + MSlabOut = state.dataVentilatedSlab->VentSlab(Item).SlabOut(RadSurfNum); + state.dataVentilatedSlab->VentSlab(Item).MSlabInNode = GetOnlySingleNode(state, MSlabIn, ErrorsFound, CurrentModuleObject, SlabName, NodeType_Air, NodeConnectionType_Internal, 1, ObjectIsNotParent); - VentSlab(Item).MSlabOutNode = GetOnlySingleNode(state, + state.dataVentilatedSlab->VentSlab(Item).MSlabOutNode = GetOnlySingleNode(state, MSlabOut, ErrorsFound, CurrentModuleObject, SlabName, NodeType_Air, NodeConnectionType_Internal, 1, ObjectIsNotParent); - MSlabInletNode = VentSlab(Item).MSlabInNode; - MSlabOutletNode = VentSlab(Item).MSlabOutNode; + MSlabInletNode = state.dataVentilatedSlab->VentSlab(Item).MSlabInNode; + MSlabOutletNode = state.dataVentilatedSlab->VentSlab(Item).MSlabOutNode; Node(MSlabInletNode).Temp = Node(InletNode).Temp; Node(MSlabOutletNode).Temp = Node(MSlabInletNode).Temp; @@ -2782,21 +2694,21 @@ namespace VentilatedSlab { } else { // System On if (SetPointTemp < AirTempHeatHi) { // HEATING MODE - OperatingMode = HeatingMode; + state.dataVentilatedSlab->OperatingMode = state.dataVentilatedSlab->HeatingMode; // Check the setpoint and temperature span - SetPointTempHi = GetCurrentScheduleValue(VentSlab(Item).HotCtrlHiTempSchedPtr); - SetPointTempLo = GetCurrentScheduleValue(VentSlab(Item).HotCtrlLoTempSchedPtr); + SetPointTempHi = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).HotCtrlHiTempSchedPtr); + SetPointTempLo = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).HotCtrlLoTempSchedPtr); if (SetPointTempHi < SetPointTempLo) { - ShowSevereError("Heating setpoint temperature mismatch in" + VentSlab(Item).Name); + ShowSevereError("Heating setpoint temperature mismatch in" + state.dataVentilatedSlab->VentSlab(Item).Name); ShowContinueError("High setpoint temperature is less than low setpoint temperature--check your schedule input"); ShowFatalError("Preceding condition causes termination."); } - AirTempHi = GetCurrentScheduleValue(VentSlab(Item).HotAirHiTempSchedPtr); - AirTempLo = GetCurrentScheduleValue(VentSlab(Item).HotAirLoTempSchedPtr); + AirTempHi = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).HotAirHiTempSchedPtr); + AirTempLo = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).HotAirLoTempSchedPtr); if (AirTempHi < AirTempLo) { - ShowSevereError("Heating Air temperature mismatch in" + VentSlab(Item).Name); + ShowSevereError("Heating Air temperature mismatch in" + state.dataVentilatedSlab->VentSlab(Item).Name); ShowContinueError("High Air temperature is less than low Air temperature--check your schedule input"); ShowFatalError("Preceding condition causes termination."); } @@ -2813,39 +2725,39 @@ namespace VentilatedSlab { RadInTemp = AirTempHi - (AirTempHi - AirTempLo) * (SetPointTemp - SetPointTempLo) / (SetPointTempHi - SetPointTempLo); } - Node(VentSlab(Item).RadInNode).Temp = RadInTemp; + Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).Temp = RadInTemp; - ControlNode = VentSlab(Item).HotControlNode; - MaxWaterFlow = VentSlab(Item).MaxHotWaterFlow; - MinWaterFlow = VentSlab(Item).MinHotWaterFlow; - MaxSteamFlow = VentSlab(Item).MaxHotSteamFlow; - MinSteamFlow = VentSlab(Item).MinHotSteamFlow; + ControlNode = state.dataVentilatedSlab->VentSlab(Item).HotControlNode; + MaxWaterFlow = state.dataVentilatedSlab->VentSlab(Item).MaxHotWaterFlow; + MinWaterFlow = state.dataVentilatedSlab->VentSlab(Item).MinHotWaterFlow; + MaxSteamFlow = state.dataVentilatedSlab->VentSlab(Item).MaxHotSteamFlow; + MinSteamFlow = state.dataVentilatedSlab->VentSlab(Item).MinHotSteamFlow; // On the first HVAC iteration the system values are given to the controller, but after that // the demand limits are in place and there needs to be feedback to the Zone Equipment - if (!FirstHVACIteration && VentSlab(Item).HCoilType == Heating_WaterCoilType) { + if (!FirstHVACIteration && state.dataVentilatedSlab->VentSlab(Item).HCoilType == state.dataVentilatedSlab->Heating_WaterCoilType) { MaxWaterFlow = Node(ControlNode).MassFlowRateMaxAvail; MinWaterFlow = Node(ControlNode).MassFlowRateMinAvail; } - if (!FirstHVACIteration && VentSlab(Item).HCoilType == Heating_SteamCoilType) { + if (!FirstHVACIteration && state.dataVentilatedSlab->VentSlab(Item).HCoilType == state.dataVentilatedSlab->Heating_SteamCoilType) { MaxSteamFlow = Node(ControlNode).MassFlowRateMaxAvail; MinSteamFlow = Node(ControlNode).MassFlowRateMinAvail; } - HCoilOn = true; + state.dataVentilatedSlab->HCoilOn = true; if (Node(OutsideAirNode).MassFlowRate > 0.0) { - MinOAFrac = GetCurrentScheduleValue(VentSlab(Item).MinOASchedPtr) * - (VentSlab(Item).MinOutAirMassFlow / Node(OutsideAirNode).MassFlowRate); + MinOAFrac = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).MinOASchedPtr) * + (state.dataVentilatedSlab->VentSlab(Item).MinOutAirMassFlow / Node(OutsideAirNode).MassFlowRate); } else { MinOAFrac = 0.0; } MinOAFrac = min(1.0, max(0.0, MinOAFrac)); - if ((!VentSlab(Item).HCoilPresent) || (VentSlab(Item).HCoilSchedValue <= 0.0)) { + if ((!state.dataVentilatedSlab->VentSlab(Item).HCoilPresent) || (state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue <= 0.0)) { // In heating mode, but there is no coil to provide heating. This is handled // differently than if there was a heating coil present. Fixed temperature // will still try to vary the amount of outside air to meet the desired @@ -2857,14 +2769,14 @@ namespace VentilatedSlab { OutletNode = FanOutletNode; { - auto const SELECT_CASE_var(VentSlab(Item).OAControlType); + auto const SELECT_CASE_var(state.dataVentilatedSlab->VentSlab(Item).OAControlType); - if (SELECT_CASE_var == FixedOAControl) { + if (SELECT_CASE_var == state.dataVentilatedSlab->FixedOAControl) { // In this control type, the outdoor air flow rate is fixed to the maximum value // which is equal to the minimum value, regardless of all the other conditions. - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; - } else if (SELECT_CASE_var == VariablePercent) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->VariablePercent) { // This algorithm is probably a bit simplistic in that it just bounces // back and forth between the maximum outside air and the minimum. In // reality, a system *might* vary between the two based on the load in @@ -2876,50 +2788,50 @@ namespace VentilatedSlab { if (Tinlet >= Toutdoor) { - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Tinlet < Toutdoor - MaxOAFrac = GetCurrentScheduleValue(VentSlab(Item).MaxOASchedPtr); - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + MaxOAFrac = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr); + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } - } else if (SELECT_CASE_var == FixedTemperature) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->FixedTemperature) { // This is basically the same algorithm as for the heating case... - Tdesired = GetCurrentScheduleValue(VentSlab(Item).TempSchedPtr); + Tdesired = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).TempSchedPtr); MaxOAFrac = 1.0; if (std::abs(Tinlet - Toutdoor) <= LowTempDiff) { // no difference in indoor and outdoor conditions-->set OA to minimum - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else if (std::abs(MaxOAFrac - MinOAFrac) <= LowOAFracDiff) { // no difference in outside air fractions - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else if (((Tdesired <= Tinlet) && (Tdesired >= Toutdoor)) || ((Tdesired >= Tinlet) && (Tdesired <= Toutdoor))) { // Desired temperature is between the inlet and outdoor temperatures // so vary the flow rate between no outside air and no recirculation air // then applying the maximum and minimum limits the user has scheduled // to make sure too much/little outside air is being introduced - OAMassFlowRate = ((Tdesired - Tinlet) / (Toutdoor - Tinlet)) * Node(InletNode).MassFlowRate; - OAMassFlowRate = max(OAMassFlowRate, (MinOAFrac * Node(OutsideAirNode).MassFlowRate)); - OAMassFlowRate = min(OAMassFlowRate, (MaxOAFrac * Node(OutsideAirNode).MassFlowRate)); + state.dataVentilatedSlab->OAMassFlowRate = ((Tdesired - Tinlet) / (Toutdoor - Tinlet)) * Node(InletNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = max(state.dataVentilatedSlab->OAMassFlowRate, (MinOAFrac * Node(OutsideAirNode).MassFlowRate)); + state.dataVentilatedSlab->OAMassFlowRate = min(state.dataVentilatedSlab->OAMassFlowRate, (MaxOAFrac * Node(OutsideAirNode).MassFlowRate)); } else if ((Tdesired < Tinlet) && (Tdesired < Toutdoor)) { // Desired temperature is below both the inlet and outdoor temperatures // so use whichever flow rate (max or min) that will get closer if (Tinlet < Toutdoor) { // Tinlet closer to Tdesired so use minimum outside air - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Toutdoor closer to Tdesired so use maximum outside air - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } } else if ((Tdesired > Tinlet) && (Tdesired > Toutdoor)) { // Desired temperature is above both the inlet and outdoor temperatures // so use whichever flow rate (max or min) that will get closer if (Tinlet > Toutdoor) { // Tinlet closer to Tdesired so use minimum outside air - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Toutdoor closer to Tdesired so use maximum outside air - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } } else { // It should NEVER get to this point, but just in case... - ShowFatalError("Ventilated Slab simulation control: illogical condition for " + VentSlab(Item).Name); + ShowFatalError("Ventilated Slab simulation control: illogical condition for " + state.dataVentilatedSlab->VentSlab(Item).Name); } } } @@ -2929,72 +2841,72 @@ namespace VentilatedSlab { } else { // Heating Coil present { - auto const SELECT_CASE_var(VentSlab(Item).OAControlType); + auto const SELECT_CASE_var(state.dataVentilatedSlab->VentSlab(Item).OAControlType); - if (SELECT_CASE_var == FixedOAControl) { + if (SELECT_CASE_var == state.dataVentilatedSlab->FixedOAControl) { // In this control type, the outdoor air flow rate is fixed to the maximum value // which is equal to the minimum value, regardless of all the other conditions. if (Node(OutsideAirNode).MassFlowRate > 0.0) { - MaxOAFrac = GetCurrentScheduleValue(VentSlab(Item).MaxOASchedPtr); + MaxOAFrac = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr); } else { MaxOAFrac = 0.0; } MaxOAFrac = min(1.0, max(0.0, MinOAFrac)); - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; - } else if (SELECT_CASE_var == VariablePercent) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->VariablePercent) { // In heating mode, the ouside air for "variable percent" control // is set to the minimum value - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; - } else if (SELECT_CASE_var == FixedTemperature) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->FixedTemperature) { // This is basically the same algorithm as for the heating case... - Tdesired = GetCurrentScheduleValue(VentSlab(Item).TempSchedPtr); + Tdesired = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).TempSchedPtr); MaxOAFrac = 1.0; if (std::abs(Tinlet - Toutdoor) <= LowTempDiff) { // no difference in indoor and outdoor conditions-->set OA to minimum - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else if (std::abs(MaxOAFrac - MinOAFrac) <= LowOAFracDiff) { // no difference in outside air fractions - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else if (((Tdesired <= Tinlet) && (Tdesired >= Toutdoor)) || ((Tdesired >= Tinlet) && (Tdesired <= Toutdoor))) { // Desired temperature is between the inlet and outdoor temperatures // so vary the flow rate between no outside air and no recirculation air // then applying the maximum and minimum limits the user has scheduled // to make sure too much/little outside air is being introduced - OAMassFlowRate = ((Tdesired - Tinlet) / (Toutdoor - Tinlet)) * Node(InletNode).MassFlowRate; - OAMassFlowRate = max(OAMassFlowRate, (MinOAFrac * Node(OutsideAirNode).MassFlowRate)); - OAMassFlowRate = min(OAMassFlowRate, (MaxOAFrac * Node(OutsideAirNode).MassFlowRate)); + state.dataVentilatedSlab->OAMassFlowRate = ((Tdesired - Tinlet) / (Toutdoor - Tinlet)) * Node(InletNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = max(state.dataVentilatedSlab->OAMassFlowRate, (MinOAFrac * Node(OutsideAirNode).MassFlowRate)); + state.dataVentilatedSlab->OAMassFlowRate = min(state.dataVentilatedSlab->OAMassFlowRate, (MaxOAFrac * Node(OutsideAirNode).MassFlowRate)); } else if ((Tdesired < Tinlet) && (Tdesired < Toutdoor)) { // Desired temperature is below both the inlet and outdoor temperatures // so use whichever flow rate (max or min) that will get closer if (Tinlet < Toutdoor) { // Tinlet closer to Tdesired so use minimum outside air - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Toutdoor closer to Tdesired so use maximum outside air - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } } else if ((Tdesired > Tinlet) && (Tdesired > Toutdoor)) { // Desired temperature is above both the inlet and outdoor temperatures // so use whichever flow rate (max or min) that will get closer if (Tinlet > Toutdoor) { // Tinlet closer to Tdesired so use minimum outside air - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Toutdoor closer to Tdesired so use maximum outside air - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } } else { // It should NEVER get to this point, but just in case... - ShowFatalError("Ventilated Slab simulation control: illogical condition for " + VentSlab(Item).Name); + ShowFatalError("Ventilated Slab simulation control: illogical condition for " + state.dataVentilatedSlab->VentSlab(Item).Name); } } } - SimVentSlabOAMixer(Item); + SimVentSlabOAMixer(state, Item); - if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - HVACFan::fanObjs[VentSlab(Item).Fan_Index]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); - } else if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { + if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + HVACFan::fanObjs[state.dataVentilatedSlab->VentSlab(Item).Fan_Index]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); + } else if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { Fans::SimulateFanComponents( - state, VentSlab(Item).FanName, FirstHVACIteration, VentSlab(Item).Fan_Index, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff); + state, state.dataVentilatedSlab->VentSlab(Item).FanName, FirstHVACIteration, state.dataVentilatedSlab->VentSlab(Item).Fan_Index, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff); } CpFan = PsyCpAirFnW(Node(FanOutletNode).HumRat); @@ -3002,14 +2914,14 @@ namespace VentilatedSlab { // Setup the coil configuration { - auto const SELECT_CASE_var(VentSlab(Item).HCoilType); + auto const SELECT_CASE_var(state.dataVentilatedSlab->VentSlab(Item).HCoilType); - if (SELECT_CASE_var == Heating_WaterCoilType) { + if (SELECT_CASE_var == state.dataVentilatedSlab->Heating_WaterCoilType) { // control water flow to obtain output matching QZnReq ControlCompOutput(state, - VentSlab(Item).Name, - cMO_VentilatedSlab, + state.dataVentilatedSlab->VentSlab(Item).Name, + state.dataVentilatedSlab->cMO_VentilatedSlab, Item, FirstHVACIteration, QZnReq, @@ -3017,19 +2929,19 @@ namespace VentilatedSlab { MaxWaterFlow, MinWaterFlow, 0.001, - VentSlab(Item).ControlCompTypeNum, - VentSlab(Item).CompErrIndex, + state.dataVentilatedSlab->VentSlab(Item).ControlCompTypeNum, + state.dataVentilatedSlab->VentSlab(Item).CompErrIndex, _, _, _, _, _, - VentSlab(Item).HWLoopNum, - VentSlab(Item).HWLoopSide, - VentSlab(Item).HWBranchNum); + state.dataVentilatedSlab->VentSlab(Item).HWLoopNum, + state.dataVentilatedSlab->VentSlab(Item).HWLoopSide, + state.dataVentilatedSlab->VentSlab(Item).HWBranchNum); - } else if ((SELECT_CASE_var == Heating_GasCoilType) || (SELECT_CASE_var == Heating_ElectricCoilType) || - (SELECT_CASE_var == Heating_SteamCoilType)) { + } else if ((SELECT_CASE_var == state.dataVentilatedSlab->Heating_GasCoilType) || (SELECT_CASE_var == state.dataVentilatedSlab->Heating_ElectricCoilType) || + (SELECT_CASE_var == state.dataVentilatedSlab->Heating_SteamCoilType)) { CalcVentilatedSlabComps(state, Item, FirstHVACIteration, QUnitOut); } @@ -3039,20 +2951,20 @@ namespace VentilatedSlab { } else if (SetPointTemp > AirTempCoolLo) { // Cooling Mode - OperatingMode = CoolingMode; + state.dataVentilatedSlab->OperatingMode = state.dataVentilatedSlab->CoolingMode; - SetPointTempHi = GetCurrentScheduleValue(VentSlab(Item).ColdCtrlHiTempSchedPtr); - SetPointTempLo = GetCurrentScheduleValue(VentSlab(Item).ColdCtrlLoTempSchedPtr); + SetPointTempHi = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).ColdCtrlHiTempSchedPtr); + SetPointTempLo = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).ColdCtrlLoTempSchedPtr); if (SetPointTempHi < SetPointTempLo) { - ShowSevereError("Cooling setpoint temperature mismatch in" + VentSlab(Item).Name); + ShowSevereError("Cooling setpoint temperature mismatch in" + state.dataVentilatedSlab->VentSlab(Item).Name); ShowContinueError("High setpoint temperature is less than low setpoint temperature--check your schedule input"); ShowFatalError("Preceding condition causes termination."); } - AirTempHi = GetCurrentScheduleValue(VentSlab(Item).ColdAirHiTempSchedPtr); - AirTempLo = GetCurrentScheduleValue(VentSlab(Item).ColdAirLoTempSchedPtr); + AirTempHi = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).ColdAirHiTempSchedPtr); + AirTempLo = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).ColdAirLoTempSchedPtr); if (AirTempHi < AirTempLo) { - ShowSevereError("Cooling Air temperature mismatch in" + VentSlab(Item).Name); + ShowSevereError("Cooling Air temperature mismatch in" + state.dataVentilatedSlab->VentSlab(Item).Name); ShowContinueError("High Air temperature is less than low Air temperature--check your schedule input"); ShowFatalError("Preceding condition causes termination."); } @@ -3068,27 +2980,27 @@ namespace VentilatedSlab { RadInTemp = AirTempHi - (AirTempHi - AirTempLo) * (SetPointTemp - SetPointTempLo) / (SetPointTempHi - SetPointTempLo); } - ControlNode = VentSlab(Item).ColdControlNode; - MaxWaterFlow = VentSlab(Item).MaxColdWaterFlow; - MinWaterFlow = VentSlab(Item).MinColdWaterFlow; + ControlNode = state.dataVentilatedSlab->VentSlab(Item).ColdControlNode; + MaxWaterFlow = state.dataVentilatedSlab->VentSlab(Item).MaxColdWaterFlow; + MinWaterFlow = state.dataVentilatedSlab->VentSlab(Item).MinColdWaterFlow; // On the first HVAC iteration the system values are given to the controller, but after that // the demand limits are in place and there needs to be feedback to the Zone Equipment - if ((!FirstHVACIteration) && (ControlNode > 0) && (VentSlab(Item).CCoilPresent)) { + if ((!FirstHVACIteration) && (ControlNode > 0) && (state.dataVentilatedSlab->VentSlab(Item).CCoilPresent)) { MaxWaterFlow = Node(ControlNode).MassFlowRateMaxAvail; MinWaterFlow = Node(ControlNode).MassFlowRateMinAvail; } - HCoilOn = false; + state.dataVentilatedSlab->HCoilOn = false; if (Node(OutsideAirNode).MassFlowRate > 0.0) { - MinOAFrac = GetCurrentScheduleValue(VentSlab(Item).MinOASchedPtr) * - (VentSlab(Item).MinOutAirMassFlow / Node(OutsideAirNode).MassFlowRate); + MinOAFrac = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).MinOASchedPtr) * + (state.dataVentilatedSlab->VentSlab(Item).MinOutAirMassFlow / Node(OutsideAirNode).MassFlowRate); } else { MinOAFrac = 0.0; } MinOAFrac = min(1.0, max(0.0, MinOAFrac)); - if ((!VentSlab(Item).CCoilPresent) || (VentSlab(Item).CCoilSchedValue <= 0.0)) { + if ((!state.dataVentilatedSlab->VentSlab(Item).CCoilPresent) || (state.dataVentilatedSlab->VentSlab(Item).CCoilSchedValue <= 0.0)) { // In cooling mode, but there is no coil to provide cooling. This is handled // differently than if there was a cooling coil present. Fixed temperature // will still try to vary the amount of outside air to meet the desired @@ -3099,20 +3011,20 @@ namespace VentilatedSlab { OutletNode = FanOutletNode; { - auto const SELECT_CASE_var(VentSlab(Item).OAControlType); + auto const SELECT_CASE_var(state.dataVentilatedSlab->VentSlab(Item).OAControlType); - if (SELECT_CASE_var == FixedOAControl) { + if (SELECT_CASE_var == state.dataVentilatedSlab->FixedOAControl) { // In this control type, the outdoor air flow rate is fixed to the maximum value // which is equal to the minimum value, regardless of all the other conditions. if (Node(OutsideAirNode).MassFlowRate > 0.0) { - MaxOAFrac = GetCurrentScheduleValue(VentSlab(Item).MaxOASchedPtr); + MaxOAFrac = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr); } else { MaxOAFrac = 0.0; } MaxOAFrac = min(1.0, max(0.0, MinOAFrac)); - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; - } else if (SELECT_CASE_var == VariablePercent) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->VariablePercent) { // This algorithm is probably a bit simplistic in that it just bounces // back and forth between the maximum outside air and the minimum. In // reality, a system *might* vary between the two based on the load in @@ -3125,50 +3037,50 @@ namespace VentilatedSlab { if (Tinlet <= Toutdoor) { - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Tinlet > Toutdoor - MaxOAFrac = GetCurrentScheduleValue(VentSlab(Item).MaxOASchedPtr); - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + MaxOAFrac = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr); + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } - } else if (SELECT_CASE_var == FixedTemperature) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->FixedTemperature) { // This is basically the same algorithm as for the heating case... - Tdesired = GetCurrentScheduleValue(VentSlab(Item).TempSchedPtr); + Tdesired = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).TempSchedPtr); MaxOAFrac = 1.0; if (std::abs(Tinlet - Toutdoor) <= LowTempDiff) { // no difference in indoor and outdoor conditions-->set OA to minimum - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else if (std::abs(MaxOAFrac - MinOAFrac) <= LowOAFracDiff) { // no difference in outside air fractions - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else if (((Tdesired <= Tinlet) && (Tdesired >= Toutdoor)) || ((Tdesired >= Tinlet) && (Tdesired <= Toutdoor))) { // Desired temperature is between the inlet and outdoor temperatures // so vary the flow rate between no outside air and no recirculation air // then applying the maximum and minimum limits the user has scheduled // to make sure too much/little outside air is being introduced - OAMassFlowRate = ((Tdesired - Tinlet) / (Toutdoor - Tinlet)) * Node(InletNode).MassFlowRate; - OAMassFlowRate = max(OAMassFlowRate, (MinOAFrac * Node(OutsideAirNode).MassFlowRate)); - OAMassFlowRate = min(OAMassFlowRate, (MaxOAFrac * Node(OutsideAirNode).MassFlowRate)); + state.dataVentilatedSlab->OAMassFlowRate = ((Tdesired - Tinlet) / (Toutdoor - Tinlet)) * Node(InletNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = max(state.dataVentilatedSlab->OAMassFlowRate, (MinOAFrac * Node(OutsideAirNode).MassFlowRate)); + state.dataVentilatedSlab->OAMassFlowRate = min(state.dataVentilatedSlab->OAMassFlowRate, (MaxOAFrac * Node(OutsideAirNode).MassFlowRate)); } else if ((Tdesired < Tinlet) && (Tdesired < Toutdoor)) { // Desired temperature is below both the inlet and outdoor temperatures // so use whichever flow rate (max or min) that will get closer if (Tinlet < Toutdoor) { // Tinlet closer to Tdesired so use minimum outside air - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Toutdoor closer to Tdesired so use maximum outside air - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } } else if ((Tdesired > Tinlet) && (Tdesired > Toutdoor)) { // Desired temperature is above both the inlet and outdoor temperatures // so use whichever flow rate (max or min) that will get closer if (Tinlet > Toutdoor) { // Tinlet closer to Tdesired so use minimum outside air - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Toutdoor closer to Tdesired so use maximum outside air - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } } else { // It should NEVER get to this point, but just in case... - ShowFatalError(cMO_VentilatedSlab + " simulation control: illogical condition for " + VentSlab(Item).Name); + ShowFatalError(state.dataVentilatedSlab->cMO_VentilatedSlab + " simulation control: illogical condition for " + state.dataVentilatedSlab->VentSlab(Item).Name); } } } @@ -3182,81 +3094,81 @@ namespace VentilatedSlab { // the desired mixed air temperature. { - auto const SELECT_CASE_var(VentSlab(Item).OAControlType); + auto const SELECT_CASE_var(state.dataVentilatedSlab->VentSlab(Item).OAControlType); - if (SELECT_CASE_var == FixedOAControl) { + if (SELECT_CASE_var == state.dataVentilatedSlab->FixedOAControl) { // In this control type, the outdoor air flow rate is fixed to the maximum value // which is equal to the minimum value, regardless of all the other conditions. if (Node(OutsideAirNode).MassFlowRate > 0.0) { - MaxOAFrac = GetCurrentScheduleValue(VentSlab(Item).MaxOASchedPtr); + MaxOAFrac = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).MaxOASchedPtr); } else { MaxOAFrac = 0.0; } MaxOAFrac = min(1.0, max(0.0, MinOAFrac)); - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; - } else if (SELECT_CASE_var == VariablePercent) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->VariablePercent) { // A cooling coil is present so let it try to do the cooling... - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; - } else if (SELECT_CASE_var == FixedTemperature) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->FixedTemperature) { // This is basically the same algorithm as for the heating case... - Tdesired = GetCurrentScheduleValue(VentSlab(Item).TempSchedPtr); + Tdesired = GetCurrentScheduleValue(state.dataVentilatedSlab->VentSlab(Item).TempSchedPtr); MaxOAFrac = 1.0; if (std::abs(Tinlet - Toutdoor) <= LowTempDiff) { // no difference in indoor and outdoor conditions-->set OA to minimum - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else if (std::abs(MaxOAFrac - MinOAFrac) <= LowOAFracDiff) { // no difference in outside air fractions - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else if (((Tdesired <= Tinlet) && (Tdesired >= Toutdoor)) || ((Tdesired >= Tinlet) && (Tdesired <= Toutdoor))) { // Desired temperature is between the inlet and outdoor temperatures // so vary the flow rate between no outside air and no recirculation air // then applying the maximum and minimum limits the user has scheduled // to make sure too much/little outside air is being introduced - OAMassFlowRate = ((Tdesired - Tinlet) / (Toutdoor - Tinlet)) * Node(InletNode).MassFlowRate; - OAMassFlowRate = max(OAMassFlowRate, (MinOAFrac * Node(OutsideAirNode).MassFlowRate)); - OAMassFlowRate = min(OAMassFlowRate, (MaxOAFrac * Node(OutsideAirNode).MassFlowRate)); + state.dataVentilatedSlab->OAMassFlowRate = ((Tdesired - Tinlet) / (Toutdoor - Tinlet)) * Node(InletNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = max(state.dataVentilatedSlab->OAMassFlowRate, (MinOAFrac * Node(OutsideAirNode).MassFlowRate)); + state.dataVentilatedSlab->OAMassFlowRate = min(state.dataVentilatedSlab->OAMassFlowRate, (MaxOAFrac * Node(OutsideAirNode).MassFlowRate)); } else if ((Tdesired < Tinlet) && (Tdesired < Toutdoor)) { // Desired temperature is below both the inlet and outdoor temperatures // so use whichever flow rate (max or min) that will get closer if (Tinlet < Toutdoor) { // Tinlet closer to Tdesired so use minimum outside air - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Toutdoor closer to Tdesired so use maximum outside air - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } } else if ((Tdesired > Tinlet) && (Tdesired > Toutdoor)) { // Desired temperature is above both the inlet and outdoor temperatures // so use whichever flow rate (max or min) that will get closer if (Tinlet > Toutdoor) { // Tinlet closer to Tdesired so use minimum outside air - OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * Node(OutsideAirNode).MassFlowRate; } else { // Toutdoor closer to Tdesired so use maximum outside air - OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; + state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * Node(OutsideAirNode).MassFlowRate; } } else { // It should NEVER get to this point, but just in case... - ShowFatalError(cMO_VentilatedSlab + " simulation control: illogical condition for " + VentSlab(Item).Name); + ShowFatalError(state.dataVentilatedSlab->cMO_VentilatedSlab + " simulation control: illogical condition for " + state.dataVentilatedSlab->VentSlab(Item).Name); } } } // control water flow to obtain output matching Low Setpoint Temperateure - HCoilOn = false; + state.dataVentilatedSlab->HCoilOn = false; - SimVentSlabOAMixer(Item); - if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - HVACFan::fanObjs[VentSlab(Item).Fan_Index]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); - } else if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { + SimVentSlabOAMixer(state, Item); + if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + HVACFan::fanObjs[state.dataVentilatedSlab->VentSlab(Item).Fan_Index]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); + } else if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { Fans::SimulateFanComponents( - state, VentSlab(Item).FanName, FirstHVACIteration, VentSlab(Item).Fan_Index, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff); + state, state.dataVentilatedSlab->VentSlab(Item).FanName, FirstHVACIteration, state.dataVentilatedSlab->VentSlab(Item).Fan_Index, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff); } CpFan = PsyCpAirFnW(Node(FanOutletNode).HumRat); QZnReq = (Node(OutletNode).MassFlowRate) * CpFan * (RadInTemp - Node(FanOutletNode).Temp); ControlCompOutput(state, - VentSlab(Item).Name, - cMO_VentilatedSlab, + state.dataVentilatedSlab->VentSlab(Item).Name, + state.dataVentilatedSlab->cMO_VentilatedSlab, Item, FirstHVACIteration, QZnReq, @@ -3264,16 +3176,16 @@ namespace VentilatedSlab { MaxWaterFlow, MinWaterFlow, 0.001, - VentSlab(Item).ControlCompTypeNum, - VentSlab(Item).CompErrIndex, + state.dataVentilatedSlab->VentSlab(Item).ControlCompTypeNum, + state.dataVentilatedSlab->VentSlab(Item).CompErrIndex, _, _, _, _, _, - VentSlab(Item).CWLoopNum, - VentSlab(Item).CWLoopSide, - VentSlab(Item).CWBranchNum); + state.dataVentilatedSlab->VentSlab(Item).CWLoopNum, + state.dataVentilatedSlab->VentSlab(Item).CWLoopSide, + state.dataVentilatedSlab->VentSlab(Item).CWBranchNum); } } // ...end of HEATING/COOLING IF-THEN block @@ -3286,10 +3198,10 @@ namespace VentilatedSlab { // in CalcVentilatedSlabRadComps AirMassFlow = Node(OutletNode).MassFlowRate; Real64 locFanElecPower = 0.0; - if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - locFanElecPower = HVACFan::fanObjs[VentSlab(Item).Fan_Index]->fanPower(); + if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + locFanElecPower = HVACFan::fanObjs[state.dataVentilatedSlab->VentSlab(Item).Fan_Index]->fanPower(); } else { - locFanElecPower = Fans::GetFanPower(VentSlab(Item).Fan_Index); + locFanElecPower = Fans::GetFanPower(state.dataVentilatedSlab->VentSlab(Item).Fan_Index); } if ((AirMassFlow <= 0.0) && (locFanElecPower > 0.0)) { Node(MixoutNode).MassFlowRate = 0.0; @@ -3298,15 +3210,15 @@ namespace VentilatedSlab { Node(FanOutletNode).MassFlowRate = 0.0; Node(FanOutletNode).MassFlowRateMaxAvail = 0.0; Node(FanOutletNode).MassFlowRateMinAvail = 0.0; - if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - HVACFan::fanObjs[VentSlab(Item).Fan_Index]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); - } else if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { + if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + HVACFan::fanObjs[state.dataVentilatedSlab->VentSlab(Item).Fan_Index]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); + } else if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { Fans::SimulateFanComponents( - state, VentSlab(Item).FanName, FirstHVACIteration, VentSlab(Item).Fan_Index, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff); + state, state.dataVentilatedSlab->VentSlab(Item).FanName, FirstHVACIteration, state.dataVentilatedSlab->VentSlab(Item).Fan_Index, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff); } } - CalcVentilatedSlabCoilOutput(Item, PowerMet, LatOutputProvided); + CalcVentilatedSlabCoilOutput(state, Item, PowerMet, LatOutputProvided); } void CalcVentilatedSlabComps(EnergyPlusData &state, @@ -3334,9 +3246,6 @@ namespace VentilatedSlab { // that a cooling coil must be present in order to call a cooling coil // simulation. Other than that, the subroutine is very straightforward. - // REFERENCES: - // na - // Using/Aliasing using DataHVACGlobals::ZoneCompTurnFansOff; using DataHVACGlobals::ZoneCompTurnFansOn; @@ -3345,18 +3254,6 @@ namespace VentilatedSlab { using SteamCoils::SimulateSteamCoilComponents; using WaterCoils::SimulateWaterCoilComponents; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 AirMassFlow; // total mass flow through the system Real64 CpAirZn; // specific heat of dry air at zone conditions (zone conditions same as system inlet) @@ -3369,73 +3266,71 @@ namespace VentilatedSlab { Real64 HCoilInAirTemp; // unused1208 REAL(r64) :: RadInTemp ! Set temperature for "Slab In Node" - // FLOW: - - SimVentSlabOAMixer(Item); - if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - HVACFan::fanObjs[VentSlab(Item).Fan_Index]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); - } else if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { + SimVentSlabOAMixer(state, Item); + if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + HVACFan::fanObjs[state.dataVentilatedSlab->VentSlab(Item).Fan_Index]->simulate(state, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff, _); + } else if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SimpleConstVolume) { Fans::SimulateFanComponents( - state, VentSlab(Item).FanName, FirstHVACIteration, VentSlab(Item).Fan_Index, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff); + state, state.dataVentilatedSlab->VentSlab(Item).FanName, FirstHVACIteration, state.dataVentilatedSlab->VentSlab(Item).Fan_Index, _, ZoneCompTurnFansOn, ZoneCompTurnFansOff); } - if ((VentSlab(Item).CCoilPresent) && (VentSlab(Item).CCoilSchedValue >= 0.0)) { - if (VentSlab(Item).CCoilType == Cooling_CoilHXAssisted) { - SimHXAssistedCoolingCoil(state, VentSlab(Item).CCoilName, FirstHVACIteration, On, 0.0, VentSlab(Item).CCoil_Index, ContFanCycCoil); + if ((state.dataVentilatedSlab->VentSlab(Item).CCoilPresent) && (state.dataVentilatedSlab->VentSlab(Item).CCoilSchedValue >= 0.0)) { + if (state.dataVentilatedSlab->VentSlab(Item).CCoilType == state.dataVentilatedSlab->Cooling_CoilHXAssisted) { + SimHXAssistedCoolingCoil(state, state.dataVentilatedSlab->VentSlab(Item).CCoilName, FirstHVACIteration, state.dataVentilatedSlab->On, 0.0, state.dataVentilatedSlab->VentSlab(Item).CCoil_Index, ContFanCycCoil); } else { - SimulateWaterCoilComponents(state, VentSlab(Item).CCoilName, FirstHVACIteration, VentSlab(Item).CCoil_Index); + SimulateWaterCoilComponents(state, state.dataVentilatedSlab->VentSlab(Item).CCoilName, FirstHVACIteration, state.dataVentilatedSlab->VentSlab(Item).CCoil_Index); } } - if ((VentSlab(Item).HCoilPresent) && (VentSlab(Item).HCoilSchedValue >= 0.0)) { + if ((state.dataVentilatedSlab->VentSlab(Item).HCoilPresent) && (state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue >= 0.0)) { { - auto const SELECT_CASE_var(VentSlab(Item).HCoilType); + auto const SELECT_CASE_var(state.dataVentilatedSlab->VentSlab(Item).HCoilType); - if (SELECT_CASE_var == Heating_WaterCoilType) { + if (SELECT_CASE_var == state.dataVentilatedSlab->Heating_WaterCoilType) { - SimulateWaterCoilComponents(state, VentSlab(Item).HCoilName, FirstHVACIteration, VentSlab(Item).HCoil_Index); + SimulateWaterCoilComponents(state, state.dataVentilatedSlab->VentSlab(Item).HCoilName, FirstHVACIteration, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); - } else if (SELECT_CASE_var == Heating_SteamCoilType) { + } else if (SELECT_CASE_var == state.dataVentilatedSlab->Heating_SteamCoilType) { - if (!HCoilOn) { + if (!state.dataVentilatedSlab->HCoilOn) { QCoilReq = 0.0; } else { - HCoilInAirNode = VentSlab(Item).FanOutletNode; + HCoilInAirNode = state.dataVentilatedSlab->VentSlab(Item).FanOutletNode; CpAirZn = PsyCpAirFnW(Node(HCoilInAirNode).HumRat); - QCoilReq = Node(HCoilInAirNode).MassFlowRate * CpAirZn * (Node(VentSlab(Item).RadInNode).Temp) - (Node(HCoilInAirNode).Temp); + QCoilReq = Node(HCoilInAirNode).MassFlowRate * CpAirZn * (Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).Temp) - (Node(HCoilInAirNode).Temp); } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SimulateSteamCoilComponents(state, VentSlab(Item).HCoilName, FirstHVACIteration, VentSlab(Item).HCoil_Index, QCoilReq); + SimulateSteamCoilComponents(state, state.dataVentilatedSlab->VentSlab(Item).HCoilName, FirstHVACIteration, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index, QCoilReq); - } else if ((SELECT_CASE_var == Heating_ElectricCoilType) || (SELECT_CASE_var == Heating_GasCoilType)) { + } else if ((SELECT_CASE_var == state.dataVentilatedSlab->Heating_ElectricCoilType) || (SELECT_CASE_var == state.dataVentilatedSlab->Heating_GasCoilType)) { - if (!HCoilOn) { + if (!state.dataVentilatedSlab->HCoilOn) { QCoilReq = 0.0; } else { - HCoilInAirTemp = Node(VentSlab(Item).FanOutletNode).Temp; - HCoilOutAirTemp = Node(VentSlab(Item).RadInNode).Temp; - CpAirZn = PsyCpAirFnW(Node(VentSlab(Item).RadInNode).HumRat); - QCoilReq = Node(VentSlab(Item).FanOutletNode).MassFlowRate * CpAirZn * (HCoilOutAirTemp - HCoilInAirTemp); + HCoilInAirTemp = Node(state.dataVentilatedSlab->VentSlab(Item).FanOutletNode).Temp; + HCoilOutAirTemp = Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).Temp; + CpAirZn = PsyCpAirFnW(Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).HumRat); + QCoilReq = Node(state.dataVentilatedSlab->VentSlab(Item).FanOutletNode).MassFlowRate * CpAirZn * (HCoilOutAirTemp - HCoilInAirTemp); } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SimulateHeatingCoilComponents(state, VentSlab(Item).HCoilName, FirstHVACIteration, QCoilReq, VentSlab(Item).HCoil_Index); + SimulateHeatingCoilComponents(state, state.dataVentilatedSlab->VentSlab(Item).HCoilName, FirstHVACIteration, QCoilReq, state.dataVentilatedSlab->VentSlab(Item).HCoil_Index); } } } - InletNode = VentSlab(Item).FanOutletNode; - OutletNode = VentSlab(Item).RadInNode; + InletNode = state.dataVentilatedSlab->VentSlab(Item).FanOutletNode; + OutletNode = state.dataVentilatedSlab->VentSlab(Item).RadInNode; AirMassFlow = Node(OutletNode).MassFlowRate; LoadMet = AirMassFlow * (PsyHFnTdbW(Node(OutletNode).Temp, Node(InletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(InletNode).HumRat)); } - void CalcVentilatedSlabCoilOutput(int const Item, // system index in ventilated slab array + void CalcVentilatedSlabCoilOutput(EnergyPlusData &state, int const Item, // system index in ventilated slab array Real64 &PowerMet, // power supplied (W) Real64 &LatOutputProvided // latent capacity supplied (kg/s) ) @@ -3464,8 +3359,8 @@ namespace VentilatedSlab { // FLOW: - OutletNode = VentSlab(Item).RadInNode; - FanOutletNode = VentSlab(Item).FanOutletNode; + OutletNode = state.dataVentilatedSlab->VentSlab(Item).RadInNode; + FanOutletNode = state.dataVentilatedSlab->VentSlab(Item).FanOutletNode; AirMassFlow = Node(OutletNode).MassFlowRate; // QTotUnitOut = AirMassFlow * ( Node( OutletNode ).Enthalpy - Node( FanOutletNode ).Enthalpy ); @@ -3477,16 +3372,16 @@ namespace VentilatedSlab { QUnitOut = max(QUnitOut, QTotUnitOut); // Report variables... - VentSlab(Item).HeatCoilPower = max(0.0, QUnitOut); - VentSlab(Item).SensCoolCoilPower = std::abs(min(0.0, QUnitOut)); - VentSlab(Item).TotCoolCoilPower = std::abs(min(0.0, QTotUnitOut)); - VentSlab(Item).LateCoolCoilPower = VentSlab(Item).TotCoolCoilPower - VentSlab(Item).SensCoolCoilPower; - if (VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { - VentSlab(Item).ElecFanPower = HVACFan::fanObjs[VentSlab(Item).Fan_Index]->fanPower(); + state.dataVentilatedSlab->VentSlab(Item).HeatCoilPower = max(0.0, QUnitOut); + state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower = std::abs(min(0.0, QUnitOut)); + state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower = std::abs(min(0.0, QTotUnitOut)); + state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower = state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower - state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower; + if (state.dataVentilatedSlab->VentSlab(Item).FanType_Num == DataHVACGlobals::FanType_SystemModelObject) { + state.dataVentilatedSlab->VentSlab(Item).ElecFanPower = HVACFan::fanObjs[state.dataVentilatedSlab->VentSlab(Item).Fan_Index]->fanPower(); } else { - VentSlab(Item).ElecFanPower = Fans::GetFanPower(VentSlab(Item).Fan_Index); + state.dataVentilatedSlab->VentSlab(Item).ElecFanPower = Fans::GetFanPower(state.dataVentilatedSlab->VentSlab(Item).Fan_Index); } - VentSlab(Item).AirMassFlowRate = AirMassFlow; + state.dataVentilatedSlab->VentSlab(Item).AirMassFlowRate = AirMassFlow; SpecHumOut = Node(OutletNode).HumRat; SpecHumIn = Node(FanOutletNode).HumRat; @@ -3607,31 +3502,29 @@ namespace VentilatedSlab { static int EnergyImbalanceErrorCount(0); // Counts for # times a temperature mismatch is found in the energy balance check static bool FirstTimeFlag(true); // for setting size of Ckj, Cmj, AirTempOut arrays - // FLOW: - if (FirstTimeFlag) { - AirTempOut.allocate(MaxCloNumOfSurfaces); + AirTempOut.allocate(state.dataVentilatedSlab->MaxCloNumOfSurfaces); FirstTimeFlag = false; } Ckj = 0.0; Cmj = 0.0; - SlabInNode = VentSlab(Item).RadInNode; - FanOutletNode = VentSlab(Item).FanOutletNode; - OAInletNode = VentSlab(Item).OutsideAirNode; - MixoutNode = VentSlab(Item).OAMixerOutNode; - ReturnAirNode = VentSlab(Item).ReturnAirNode; - ZoneAirInNode = VentSlab(Item).ZoneAirInNode; + SlabInNode = state.dataVentilatedSlab->VentSlab(Item).RadInNode; + FanOutletNode = state.dataVentilatedSlab->VentSlab(Item).FanOutletNode; + OAInletNode = state.dataVentilatedSlab->VentSlab(Item).OutsideAirNode; + MixoutNode = state.dataVentilatedSlab->VentSlab(Item).OAMixerOutNode; + ReturnAirNode = state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode; + ZoneAirInNode = state.dataVentilatedSlab->VentSlab(Item).ZoneAirInNode; // Set the conditions on the air side inlet - ZoneNum = VentSlab(Item).ZonePtr; + ZoneNum = state.dataVentilatedSlab->VentSlab(Item).ZonePtr; ZoneMult = double(Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier); - AirMassFlow = Node(VentSlab(Item).RadInNode).MassFlowRate / ZoneMult; + AirMassFlow = Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).MassFlowRate / ZoneMult; - if (OperatingMode == HeatingMode) { + if (state.dataVentilatedSlab->OperatingMode == state.dataVentilatedSlab->HeatingMode) { - if ((!VentSlab(Item).HCoilPresent) || (VentSlab(Item).HCoilSchedValue <= 0.0)) { + if ((!state.dataVentilatedSlab->VentSlab(Item).HCoilPresent) || (state.dataVentilatedSlab->VentSlab(Item).HCoilSchedValue <= 0.0)) { AirTempIn = Node(FanOutletNode).Temp; Node(SlabInNode).Temp = Node(FanOutletNode).Temp; // If coil not available or running, then coil in and out temps same @@ -3642,9 +3535,9 @@ namespace VentilatedSlab { } } - if (OperatingMode == CoolingMode) { + if (state.dataVentilatedSlab->OperatingMode == state.dataVentilatedSlab->CoolingMode) { - if ((!VentSlab(Item).CCoilPresent) || (VentSlab(Item).CCoilSchedValue <= 0.0)) { + if ((!state.dataVentilatedSlab->VentSlab(Item).CCoilPresent) || (state.dataVentilatedSlab->VentSlab(Item).CCoilSchedValue <= 0.0)) { AirTempIn = Node(FanOutletNode).Temp; Node(SlabInNode).Temp = Node(FanOutletNode).Temp; // If coil not available or running, then coil in and out temps same @@ -3661,14 +3554,14 @@ namespace VentilatedSlab { // or a slight mismatch between zone and system controls. This is not // necessarily a "problem" so this exception is necessary in the code. - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); QRadSysSource(SurfNum) = 0.0; if (Surface(SurfNum).ExtBoundCond > 0 && Surface(SurfNum).ExtBoundCond != SurfNum) QRadSysSource(Surface(SurfNum).ExtBoundCond) = 0.0; // Also zero the other side of an interzone } - VentSlab(Item).SlabOutTemp = VentSlab(Item).SlabInTemp; + state.dataVentilatedSlab->VentSlab(Item).SlabOutTemp = state.dataVentilatedSlab->VentSlab(Item).SlabInTemp; // zero out node flows Node(SlabInNode).MassFlowRate = 0.0; @@ -3682,18 +3575,18 @@ namespace VentilatedSlab { if (AirMassFlow > 0.0) { - if ((VentSlab(Item).SysConfg == SlabOnly) || (VentSlab(Item).SysConfg == SlabAndZone)) { + if ((state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabOnly) || (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabAndZone)) { - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); // Determine the heat exchanger "effectiveness" term - EpsMdotCpAirZn = CalcVentSlabHXEffectTerm(Item, + EpsMdotCpAirZn = CalcVentSlabHXEffectTerm(state, Item, AirTempIn, AirMassFlow, - VentSlab(Item).SurfaceFlowFrac(RadSurfNum), - VentSlab(Item).CoreLength, - VentSlab(Item).CoreDiameter, - VentSlab(Item).CoreNumbers); + state.dataVentilatedSlab->VentSlab(Item).SurfaceFlowFrac(RadSurfNum), + state.dataVentilatedSlab->VentSlab(Item).CoreLength, + state.dataVentilatedSlab->VentSlab(Item).CoreDiameter, + state.dataVentilatedSlab->VentSlab(Item).CoreNumbers); // Obtain the heat balance coefficients and calculate the intermediate coefficients // linking the inlet air temperature to the heat source/sink to the radiant system. @@ -3710,18 +3603,18 @@ namespace VentilatedSlab { Cf = RadSysToHBQsrcCoef(SurfNum); Cg = CTFTsrcConstPart(SurfNum); - Ch = double(dataConstruction.Construct(ConstrNum).CTFTSourceQ(0)); - Ci = double(dataConstruction.Construct(ConstrNum).CTFTSourceIn(0)); - Cj = double(dataConstruction.Construct(ConstrNum).CTFTSourceOut(0)); + Ch = double(state.dataConstruction->Construct(ConstrNum).CTFTSourceQ(0)); + Ci = double(state.dataConstruction->Construct(ConstrNum).CTFTSourceIn(0)); + Cj = double(state.dataConstruction->Construct(ConstrNum).CTFTSourceOut(0)); Ck = Cg + ((Ci * (Ca + Cb * Cd) + Cj * (Cd + Ce * Ca)) / (1.0 - Ce * Cb)); Cl = Ch + ((Ci * (Cc + Cb * Cf) + Cj * (Cf + Ce * Cc)) / (1.0 - Ce * Cb)); - Mdot = AirMassFlow * VentSlab(Item).SurfaceFlowFrac(RadSurfNum); - CpAirZn = PsyCpAirFnW(Node(VentSlab(Item).RadInNode).HumRat); + Mdot = AirMassFlow * state.dataVentilatedSlab->VentSlab(Item).SurfaceFlowFrac(RadSurfNum); + CpAirZn = PsyCpAirFnW(Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).HumRat); QRadSysSource(SurfNum) = - VentSlab(Item).CoreNumbers * EpsMdotCpAirZn * (AirTempIn - Ck) / (1.0 + (EpsMdotCpAirZn * Cl / Surface(SurfNum).Area)); + state.dataVentilatedSlab->VentSlab(Item).CoreNumbers * EpsMdotCpAirZn * (AirTempIn - Ck) / (1.0 + (EpsMdotCpAirZn * Cl / Surface(SurfNum).Area)); if (Surface(SurfNum).ExtBoundCond > 0 && Surface(SurfNum).ExtBoundCond != SurfNum) QRadSysSource(Surface(SurfNum).ExtBoundCond) = QRadSysSource(SurfNum); @@ -3736,8 +3629,8 @@ namespace VentilatedSlab { // is set to zero to avoid heating in cooling mode or cooling in heating // mode. - if (((OperatingMode == HeatingMode) && (QRadSysSource(SurfNum) <= 0.0)) || - ((OperatingMode == CoolingMode) && (QRadSysSource(SurfNum) >= 0.0))) { + if (((state.dataVentilatedSlab->OperatingMode == state.dataVentilatedSlab->HeatingMode) && (QRadSysSource(SurfNum) <= 0.0)) || + ((state.dataVentilatedSlab->OperatingMode == state.dataVentilatedSlab->CoolingMode) && (QRadSysSource(SurfNum) >= 0.0))) { // IF (.not. WarmupFlag) THEN // TempComparisonErrorCount = TempComparisonErrorCount + 1 @@ -3753,7 +3646,7 @@ namespace VentilatedSlab { // ELSE // CALL ShowRecurringWarningErrorAtEnd('Ventilated Slab ['//TRIM(VentSlab(Item)%Name)// & // '] Temperature Comparison Error shut-off occurrence continues.', & - // VentSlab(Item)%CondErrCount) + // state.dataVentilatedSlab->VentSlab(Item)%CondErrCount) // END IF // END IF @@ -3764,18 +3657,18 @@ namespace VentilatedSlab { Node(ReturnAirNode).MassFlowRate = 0.0; AirMassFlow = 0.0; - for (RadSurfNum2 = 1; RadSurfNum2 <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum2) { - SurfNum2 = VentSlab(Item).SurfacePtr(RadSurfNum2); + for (RadSurfNum2 = 1; RadSurfNum2 <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum2) { + SurfNum2 = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum2); QRadSysSource(SurfNum2) = 0.0; if (Surface(SurfNum2).ExtBoundCond > 0 && Surface(SurfNum2).ExtBoundCond != SurfNum2) QRadSysSource(Surface(SurfNum2).ExtBoundCond) = 0.0; // Also zero the other side of an interzone - if (VentSlab(Item).SysConfg == SlabOnly) { + if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabOnly) { // Node(Returnairnode)%Temp = MAT(Zonenum) - Node(ReturnAirNode).Temp = TH(2, 1, VentSlab(Item).SurfacePtr(RadSurfNum)); + Node(ReturnAirNode).Temp = TH(2, 1, state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum)); Node(FanOutletNode).Temp = Node(ReturnAirNode).Temp; Node(SlabInNode).Temp = Node(FanOutletNode).Temp; - } else if (VentSlab(Item).SysConfg == SlabAndZone) { + } else if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabAndZone) { Node(ReturnAirNode).Temp = MAT(ZoneNum); Node(SlabInNode).Temp = Node(ReturnAirNode).Temp; Node(FanOutletNode).Temp = Node(SlabInNode).Temp; @@ -3791,10 +3684,10 @@ namespace VentilatedSlab { // A safety parameter is added (hardwired parameter) to avoid getting too close to condensation // conditions. - if (OperatingMode == CoolingMode) { - DewPointTemp = PsyTdpFnWPb(ZoneAirHumRat(VentSlab(Item).ZonePtr), OutBaroPress); - for (RadSurfNum2 = 1; RadSurfNum2 <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum2) { - if (TH(2, 1, VentSlab(Item).SurfacePtr(RadSurfNum2)) < (DewPointTemp + CondDeltaTemp)) { + if (state.dataVentilatedSlab->OperatingMode == state.dataVentilatedSlab->CoolingMode) { + DewPointTemp = PsyTdpFnWPb(ZoneAirHumRat(state.dataVentilatedSlab->VentSlab(Item).ZonePtr), OutBaroPress); + for (RadSurfNum2 = 1; RadSurfNum2 <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum2) { + if (TH(2, 1, state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum2)) < (DewPointTemp + CondDeltaTemp)) { // Condensation warning--must shut off radiant system Node(SlabInNode).MassFlowRate = 0.0; Node(FanOutletNode).MassFlowRate = 0.0; @@ -3803,8 +3696,8 @@ namespace VentilatedSlab { Node(ReturnAirNode).MassFlowRate = 0.0; Node(FanOutletNode).Temp = Node(SlabInNode).Temp; AirMassFlow = 0.0; - for (RadSurfNum3 = 1; RadSurfNum3 <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum3) { - SurfNum2 = VentSlab(Item).SurfacePtr(RadSurfNum3); + for (RadSurfNum3 = 1; RadSurfNum3 <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum3) { + SurfNum2 = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum3); QRadSysSource(SurfNum2) = 0.0; if (Surface(SurfNum2).ExtBoundCond > 0 && Surface(SurfNum2).ExtBoundCond != SurfNum2) QRadSysSource(Surface(SurfNum2).ExtBoundCond) = 0.0; // Also zero the other side of an interzone @@ -3813,13 +3706,13 @@ namespace VentilatedSlab { if (!WarmupFlag) { ++CondensationErrorCount; - if (VentSlab(Item).CondErrIndex == 0) { - ShowWarningMessage(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + ']'); - ShowContinueError("Surface [" + Surface(VentSlab(Item).SurfacePtr(RadSurfNum2)).Name + + if (state.dataVentilatedSlab->VentSlab(Item).CondErrIndex == 0) { + ShowWarningMessage(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + ']'); + ShowContinueError("Surface [" + Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum2)).Name + "] temperature below dew-point temperature--potential for condensation exists"); ShowContinueError("Flow to the ventilated slab system will be shut-off to avoid condensation"); ShowContinueError("Predicted radiant system surface temperature = " + - RoundSigDigits(TH(2, 1, VentSlab(Item).SurfacePtr(RadSurfNum2)), 2)); + RoundSigDigits(TH(2, 1, state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum2)), 2)); ShowContinueError("Zone dew-point temperature + safety factor delta= " + RoundSigDigits(DewPointTemp + CondDeltaTemp, 2)); ShowContinueErrorTimeStamp(""); @@ -3829,9 +3722,9 @@ namespace VentilatedSlab { " C safety built-in to the shut-off criteria"); ShowContinueError("Note also that this affects all surfaces that are part of this system"); } - ShowRecurringWarningErrorAtEnd(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + + ShowRecurringWarningErrorAtEnd(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + "] condensation shut-off occurrence continues.", - VentSlab(Item).CondErrIndex, + state.dataVentilatedSlab->VentSlab(Item).CondErrIndex, DewPointTemp, DewPointTemp, _, @@ -3847,25 +3740,25 @@ namespace VentilatedSlab { // Total Radiant Power AirOutletTempCheck = 0.0; TotalVentSlabRadPower = 0.0; - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); TotalVentSlabRadPower += QRadSysSource(SurfNum); - AirOutletTempCheck += (VentSlab(Item).SurfaceFlowFrac(RadSurfNum) * AirTempOut(RadSurfNum)); + AirOutletTempCheck += (state.dataVentilatedSlab->VentSlab(Item).SurfaceFlowFrac(RadSurfNum) * AirTempOut(RadSurfNum)); } TotalVentSlabRadPower *= ZoneMult; // Return Air temp Check - if (VentSlab(Item).SysConfg == SlabOnly) { + if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabOnly) { if (AirMassFlow > 0.0) { - CpAirZn = PsyCpAirFnW(Node(VentSlab(Item).RadInNode).HumRat); + CpAirZn = PsyCpAirFnW(Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).HumRat); Node(ReturnAirNode).Temp = Node(SlabInNode).Temp - (TotalVentSlabRadPower / (AirMassFlow * CpAirZn)); if ((std::abs(Node(ReturnAirNode).Temp - AirOutletTempCheck) > TempCheckLimit) && (std::abs(TotalVentSlabRadPower) > ZeroSystemResp)) { if (!WarmupFlag) { ++EnergyImbalanceErrorCount; - if (VentSlab(Item).EnrgyImbalErrIndex == 0) { - ShowWarningMessage(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + ']'); + if (state.dataVentilatedSlab->VentSlab(Item).EnrgyImbalErrIndex == 0) { + ShowWarningMessage(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + ']'); ShowContinueError("Ventilated Slab (slab only type) air outlet temperature calculation mismatch."); ShowContinueError("This should not happen as it indicates a potential energy imbalance in the calculations."); ShowContinueError("However, it could also result from improper input for the ventilated slab or"); @@ -3879,9 +3772,9 @@ namespace VentilatedSlab { RoundSigDigits(TotalVentSlabRadPower, 4)); ShowContinueErrorTimeStamp(""); } - ShowRecurringWarningErrorAtEnd(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + + ShowRecurringWarningErrorAtEnd(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + "] temperature calculation mismatch occurrence continues.", - VentSlab(Item).EnrgyImbalErrIndex); + state.dataVentilatedSlab->VentSlab(Item).EnrgyImbalErrIndex); } } } else { @@ -3889,7 +3782,7 @@ namespace VentilatedSlab { } } - if (VentSlab(Item).SysConfg == SlabAndZone) { + if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabAndZone) { if (AirMassFlow > 0.0) { Node(ZoneAirInNode).Temp = Node(SlabInNode).Temp - (TotalVentSlabRadPower / (AirMassFlow * CpAirZn)); if ((std::abs(Node(ZoneAirInNode).Temp - AirOutletTempCheck) > TempCheckLimit) && @@ -3897,8 +3790,8 @@ namespace VentilatedSlab { if (!WarmupFlag) { ++EnergyImbalanceErrorCount; - if (VentSlab(Item).EnrgyImbalErrIndex == 0) { - ShowWarningMessage(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + ']'); + if (state.dataVentilatedSlab->VentSlab(Item).EnrgyImbalErrIndex == 0) { + ShowWarningMessage(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + ']'); ShowContinueError("Ventilated Slab (slab only type) air outlet temperature calculation mismatch."); ShowContinueError("This should not happen as it indicates a potential energy imbalance in the calculations."); ShowContinueError("However, it could also result from improper input for the ventilated slab or"); @@ -3912,13 +3805,13 @@ namespace VentilatedSlab { RoundSigDigits(TotalVentSlabRadPower, 4)); ShowContinueErrorTimeStamp(""); } - ShowRecurringWarningErrorAtEnd(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + + ShowRecurringWarningErrorAtEnd(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + "] temperature calculation mismatch occurrence continues.", - VentSlab(Item).EnrgyImbalErrIndex); + state.dataVentilatedSlab->VentSlab(Item).EnrgyImbalErrIndex); } } // IF ((.NOT. FirstHVACIteration) .AND. & - // (ABS(Node(ReturnAirNode)%Temp-MAT(Zonenum)) > VentSlabAirTempToler))THEN + // (ABS(Node(ReturnAirNode)%Temp-MAT(Zonenum)) > state.dataVentilatedSlab->VentSlabAirTempToler))THEN // NeedtoIterate = .TRUE. // END IF // Node(ReturnAirNode)%Temp = MAT(Zonenum) @@ -3937,19 +3830,19 @@ namespace VentilatedSlab { } // SYSCONFIG. SLABONLY&SLABANDZONE - if (VentSlab(Item).SysConfg == SeriesSlabs) { + if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SeriesSlabs) { - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - CNumDS = VentSlab(Item).CNumbers(RadSurfNum); - CLengDS = VentSlab(Item).CLength(RadSurfNum); // for check - CDiaDS = VentSlab(Item).CDiameter(RadSurfNum); // for check + CNumDS = state.dataVentilatedSlab->VentSlab(Item).CNumbers(RadSurfNum); + CLengDS = state.dataVentilatedSlab->VentSlab(Item).CLength(RadSurfNum); // for check + CDiaDS = state.dataVentilatedSlab->VentSlab(Item).CDiameter(RadSurfNum); // for check FlowFrac = 1.0; - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); // Determine the heat exchanger "effectiveness" term - EpsMdotCpAirZn = CalcVentSlabHXEffectTerm(Item, AirTempIn, AirMassFlow, FlowFrac, CLengDS, CDiaDS, CNumDS); + EpsMdotCpAirZn = CalcVentSlabHXEffectTerm(state, Item, AirTempIn, AirMassFlow, FlowFrac, CLengDS, CDiaDS, CNumDS); // Obtain the heat balance coefficients and calculate the intermediate coefficients // linking the inlet air temperature to the heat source/sink to the radiant system. @@ -3966,15 +3859,15 @@ namespace VentilatedSlab { Cf = RadSysToHBQsrcCoef(SurfNum); Cg = CTFTsrcConstPart(SurfNum); - Ch = double(dataConstruction.Construct(ConstrNum).CTFTSourceQ(0)); - Ci = double(dataConstruction.Construct(ConstrNum).CTFTSourceIn(0)); - Cj = double(dataConstruction.Construct(ConstrNum).CTFTSourceOut(0)); + Ch = double(state.dataConstruction->Construct(ConstrNum).CTFTSourceQ(0)); + Ci = double(state.dataConstruction->Construct(ConstrNum).CTFTSourceIn(0)); + Cj = double(state.dataConstruction->Construct(ConstrNum).CTFTSourceOut(0)); Ck = Cg + ((Ci * (Ca + Cb * Cd) + Cj * (Cd + Ce * Ca)) / (1.0 - Ce * Cb)); Cl = Ch + ((Ci * (Cc + Cb * Cf) + Cj * (Cf + Ce * Cc)) / (1.0 - Ce * Cb)); Mdot = AirMassFlow * FlowFrac; - CpAirZn = PsyCpAirFnW(Node(VentSlab(Item).RadInNode).HumRat); + CpAirZn = PsyCpAirFnW(Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).HumRat); QRadSysSource(SurfNum) = CNumDS * EpsMdotCpAirZn * (AirTempIn - Ck) / (1.0 + (EpsMdotCpAirZn * Cl / Surface(SurfNum).Area)); @@ -3993,8 +3886,8 @@ namespace VentilatedSlab { // mode. if (RadSurfNum == 1) { - if (((OperatingMode == HeatingMode) && (QRadSysSource(SurfNum) <= 0.0)) || - ((OperatingMode == CoolingMode) && (QRadSysSource(SurfNum) >= 0.0))) { + if (((state.dataVentilatedSlab->OperatingMode == state.dataVentilatedSlab->HeatingMode) && (QRadSysSource(SurfNum) <= 0.0)) || + ((state.dataVentilatedSlab->OperatingMode == state.dataVentilatedSlab->CoolingMode) && (QRadSysSource(SurfNum) >= 0.0))) { // IF (.not. WarmupFlag) THEN // TempComparisonErrorCount = TempComparisonErrorCount + 1 // IF (TempComparisonErrorCount <= NumOfVentSlabs) THEN @@ -4010,7 +3903,7 @@ namespace VentilatedSlab { // ELSE // CALL ShowRecurringWarningErrorAtEnd('Ventilated Slab ['//TRIM(VentSlab(Item)%Name)// & // '] shut-off occurrence continues due to temperature comparison error.', & - // VentSlab(Item)%CondErrCount) + // state.dataVentilatedSlab->VentSlab(Item)%CondErrCount) // END IF // END IF @@ -4021,13 +3914,13 @@ namespace VentilatedSlab { Node(ReturnAirNode).MassFlowRate = 0.0; AirMassFlow = 0.0; - for (RadSurfNum2 = 1; RadSurfNum2 <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum2) { - SurfNum2 = VentSlab(Item).SurfacePtr(RadSurfNum2); + for (RadSurfNum2 = 1; RadSurfNum2 <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum2) { + SurfNum2 = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum2); QRadSysSource(SurfNum2) = 0.0; if (Surface(SurfNum2).ExtBoundCond > 0 && Surface(SurfNum2).ExtBoundCond != SurfNum2) QRadSysSource(Surface(SurfNum2).ExtBoundCond) = 0.0; // Also zero the other side of an interzone } - Node(ReturnAirNode).Temp = TH(2, 1, VentSlab(Item).SurfacePtr(1)); + Node(ReturnAirNode).Temp = TH(2, 1, state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(1)); Node(FanOutletNode).Temp = Node(ReturnAirNode).Temp; Node(SlabInNode).Temp = Node(FanOutletNode).Temp; // Each Internal node is reseted at the surface temperature @@ -4041,10 +3934,10 @@ namespace VentilatedSlab { // A safety parameter is added (hardwired parameter) to avoid getting too close to condensation // conditions. - if (OperatingMode == CoolingMode) { - DewPointTemp = PsyTdpFnWPb(ZoneAirHumRat(VentSlab(Item).ZPtr(RadSurfNum)), OutBaroPress); - for (RadSurfNum2 = 1; RadSurfNum2 <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum2) { - if (TH(2, 1, VentSlab(Item).SurfacePtr(RadSurfNum2)) < (DewPointTemp + CondDeltaTemp)) { + if (state.dataVentilatedSlab->OperatingMode == state.dataVentilatedSlab->CoolingMode) { + DewPointTemp = PsyTdpFnWPb(ZoneAirHumRat(state.dataVentilatedSlab->VentSlab(Item).ZPtr(RadSurfNum)), OutBaroPress); + for (RadSurfNum2 = 1; RadSurfNum2 <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum2) { + if (TH(2, 1, state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum2)) < (DewPointTemp + CondDeltaTemp)) { // Condensation warning--must shut off radiant system Node(SlabInNode).MassFlowRate = 0.0; Node(FanOutletNode).MassFlowRate = 0.0; @@ -4053,8 +3946,8 @@ namespace VentilatedSlab { Node(ReturnAirNode).MassFlowRate = 0.0; Node(FanOutletNode).Temp = Node(SlabInNode).Temp; AirMassFlow = 0.0; - for (RadSurfNum3 = 1; RadSurfNum3 <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum3) { - SurfNum2 = VentSlab(Item).SurfacePtr(RadSurfNum3); + for (RadSurfNum3 = 1; RadSurfNum3 <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum3) { + SurfNum2 = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum3); QRadSysSource(SurfNum2) = 0.0; if (Surface(SurfNum2).ExtBoundCond > 0 && Surface(SurfNum2).ExtBoundCond != SurfNum2) QRadSysSource(Surface(SurfNum2).ExtBoundCond) = 0.0; // Also zero the other side of an interzone @@ -4062,13 +3955,13 @@ namespace VentilatedSlab { // Produce a warning message so that user knows the system was shut-off due to potential for condensation if (!WarmupFlag) { ++CondensationErrorCount; - if (VentSlab(Item).CondErrIndex == 0) { - ShowWarningMessage(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + ']'); - ShowContinueError("Surface [" + Surface(VentSlab(Item).SurfacePtr(RadSurfNum2)).Name + + if (state.dataVentilatedSlab->VentSlab(Item).CondErrIndex == 0) { + ShowWarningMessage(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + ']'); + ShowContinueError("Surface [" + Surface(state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum2)).Name + "] temperature below dew-point temperature--potential for condensation exists"); ShowContinueError("Flow to the ventilated slab system will be shut-off to avoid condensation"); ShowContinueError("Predicted radiant system surface temperature = " + - RoundSigDigits(TH(2, 1, VentSlab(Item).SurfacePtr(RadSurfNum2)), 2)); + RoundSigDigits(TH(2, 1, state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum2)), 2)); ShowContinueError("Zone dew-point temperature + safety factor delta= " + RoundSigDigits(DewPointTemp + CondDeltaTemp, 2)); ShowContinueErrorTimeStamp(""); @@ -4078,9 +3971,9 @@ namespace VentilatedSlab { " C safety built-in to the shut-off criteria"); ShowContinueError("Note also that this affects all surfaces that are part of this system"); } - ShowRecurringWarningErrorAtEnd(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + + ShowRecurringWarningErrorAtEnd(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + "] condensation shut-off occurrence continues.", - VentSlab(Item).CondErrIndex, + state.dataVentilatedSlab->VentSlab(Item).CondErrIndex, DewPointTemp, DewPointTemp, _, @@ -4096,8 +3989,8 @@ namespace VentilatedSlab { // Total Radiant Power AirOutletTempCheck = 0.0; TotalVentSlabRadPower = 0.0; - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); TotalVentSlabRadPower += QRadSysSource(SurfNum); AirOutletTempCheck = AirTempOut(RadSurfNum); } @@ -4107,21 +4000,21 @@ namespace VentilatedSlab { MSlabAirInTemp = Node(SlabInNode).Temp; - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - SlabName = VentSlab(Item).SurfaceName(RadSurfNum); - MSlabIn = VentSlab(Item).SlabIn(RadSurfNum); - MSlabOut = VentSlab(Item).SlabOut(RadSurfNum); - VentSlab(Item).MSlabInNode = GetOnlySingleNode(state, + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + SlabName = state.dataVentilatedSlab->VentSlab(Item).SurfaceName(RadSurfNum); + MSlabIn = state.dataVentilatedSlab->VentSlab(Item).SlabIn(RadSurfNum); + MSlabOut = state.dataVentilatedSlab->VentSlab(Item).SlabOut(RadSurfNum); + state.dataVentilatedSlab->VentSlab(Item).MSlabInNode = GetOnlySingleNode(state, MSlabIn, ErrorsFound, CurrentModuleObject, SlabName, NodeType_Air, NodeConnectionType_Internal, 1, ObjectIsNotParent); - VentSlab(Item).MSlabOutNode = GetOnlySingleNode(state, + state.dataVentilatedSlab->VentSlab(Item).MSlabOutNode = GetOnlySingleNode(state, MSlabOut, ErrorsFound, CurrentModuleObject, SlabName, NodeType_Air, NodeConnectionType_Internal, 1, ObjectIsNotParent); - MSlabInletNode = VentSlab(Item).MSlabInNode; - MSlabOutletNode = VentSlab(Item).MSlabOutNode; - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); + MSlabInletNode = state.dataVentilatedSlab->VentSlab(Item).MSlabInNode; + MSlabOutletNode = state.dataVentilatedSlab->VentSlab(Item).MSlabOutNode; + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); if (AirMassFlow > 0.0) { - CpAirZn = PsyCpAirFnW(Node(VentSlab(Item).RadInNode).HumRat); + CpAirZn = PsyCpAirFnW(Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).HumRat); Node(MSlabInletNode).Temp = MSlabAirInTemp; Node(MSlabOutletNode).Temp = Node(MSlabInletNode).Temp - (QRadSysSource(SurfNum) / (AirMassFlow * CpAirZn)); @@ -4135,7 +4028,7 @@ namespace VentilatedSlab { // Return Air temp Check if (AirMassFlow > 0.0) { - CpAirZn = PsyCpAirFnW(Node(VentSlab(Item).RadInNode).HumRat); + CpAirZn = PsyCpAirFnW(Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).HumRat); Node(ReturnAirNode).Temp = Node(SlabInNode).Temp - (TotalVentSlabRadPower / (AirMassFlow * CpAirZn)); if ((std::abs(Node(ReturnAirNode).Temp - AirOutletTempCheck) > TempCheckLimit) && @@ -4143,8 +4036,8 @@ namespace VentilatedSlab { if (!WarmupFlag) { ++EnergyImbalanceErrorCount; - if (VentSlab(Item).EnrgyImbalErrIndex == 0) { - ShowWarningMessage(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + ']'); + if (state.dataVentilatedSlab->VentSlab(Item).EnrgyImbalErrIndex == 0) { + ShowWarningMessage(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + ']'); ShowContinueError("Ventilated Slab (slab only type) air outlet temperature calculation mismatch."); ShowContinueError("This should not happen as it indicates a potential energy imbalance in the calculations."); ShowContinueError("However, it could also result from improper input for the ventilated slab or"); @@ -4157,9 +4050,9 @@ namespace VentilatedSlab { ShowContinueError("Total energy rate (power) [W] added to the slab = " + RoundSigDigits(TotalVentSlabRadPower, 4)); ShowContinueErrorTimeStamp(""); } - ShowRecurringWarningErrorAtEnd(cMO_VentilatedSlab + " [" + VentSlab(Item).Name + + ShowRecurringWarningErrorAtEnd(state.dataVentilatedSlab->cMO_VentilatedSlab + " [" + state.dataVentilatedSlab->VentSlab(Item).Name + "] temperature calculation mismatch occurrence continues.", - VentSlab(Item).EnrgyImbalErrIndex); + state.dataVentilatedSlab->VentSlab(Item).EnrgyImbalErrIndex); } } @@ -4180,7 +4073,7 @@ namespace VentilatedSlab { } //(AirMassFlow > 0.0d0) } - void SimVentSlabOAMixer(int const Item) // System index in Ventilated Slab array + void SimVentSlabOAMixer(EnergyPlusData &state, int const Item) // System index in Ventilated Slab array { // SUBROUTINE INFORMATION: @@ -4206,24 +4099,6 @@ namespace VentilatedSlab { // rates and perform an energy balance on the mixing of the return and // outdoor air streams. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int AirRelNode; // relief air node number in ventilated slab loop int InletNode; // inlet node number for ventilated slab loop @@ -4232,20 +4107,20 @@ namespace VentilatedSlab { int OutsideAirNode; // outside air node number in ventilated slab loop // FLOW: - AirRelNode = VentSlab(Item).AirReliefNode; - InletNode = VentSlab(Item).ReturnAirNode; - OAMixOutNode = VentSlab(Item).OAMixerOutNode; - OutsideAirNode = VentSlab(Item).OutsideAirNode; + AirRelNode = state.dataVentilatedSlab->VentSlab(Item).AirReliefNode; + InletNode = state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode; + OAMixOutNode = state.dataVentilatedSlab->VentSlab(Item).OAMixerOutNode; + OutsideAirNode = state.dataVentilatedSlab->VentSlab(Item).OutsideAirNode; // "Resolve" the air flow rates... - Node(OutsideAirNode).MassFlowRate = OAMassFlowRate; - Node(OutsideAirNode).MassFlowRateMinAvail = OAMassFlowRate; - Node(OutsideAirNode).MassFlowRateMaxAvail = OAMassFlowRate; + Node(OutsideAirNode).MassFlowRate = state.dataVentilatedSlab->OAMassFlowRate; + Node(OutsideAirNode).MassFlowRateMinAvail = state.dataVentilatedSlab->OAMassFlowRate; + Node(OutsideAirNode).MassFlowRateMaxAvail = state.dataVentilatedSlab->OAMassFlowRate; - Node(AirRelNode).MassFlowRate = OAMassFlowRate; - Node(AirRelNode).MassFlowRateMinAvail = OAMassFlowRate; - Node(AirRelNode).MassFlowRateMaxAvail = OAMassFlowRate; + Node(AirRelNode).MassFlowRate = state.dataVentilatedSlab->OAMassFlowRate; + Node(AirRelNode).MassFlowRateMinAvail = state.dataVentilatedSlab->OAMassFlowRate; + Node(AirRelNode).MassFlowRateMaxAvail = state.dataVentilatedSlab->OAMassFlowRate; Node(OAMixOutNode).MassFlowRate = Node(InletNode).MassFlowRate; Node(OAMixOutNode).MassFlowRateMinAvail = Node(InletNode).MassFlowRate; @@ -4277,7 +4152,7 @@ namespace VentilatedSlab { Node(OAMixOutNode).Press = Node(InletNode).Press; } - void UpdateVentilatedSlab(int const Item, // Index for the ventilated slab under consideration within the derived types + void UpdateVentilatedSlab(EnergyPlusData &state, int const Item, // Index for the ventilated slab under consideration within the derived types bool const EP_UNUSED(FirstHVACIteration) // TRUE if 1st HVAC simulation of system timestep !unused1208 ) { @@ -4304,9 +4179,6 @@ namespace VentilatedSlab { // time step elapsed is different, then we just need to add the new // values to the running average. - // REFERENCES: - // na - // Using/Aliasing using DataGlobals::TimeStepZone; using DataHeatBalance::Zone; @@ -4315,18 +4187,6 @@ namespace VentilatedSlab { using DataHVACGlobals::TimeStepSys; using DataLoopNode::Node; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 CpAppAir; // Specific heat of air int RadSurfNum; // DO loop counter for radiant surfaces in the ventilated slab @@ -4345,42 +4205,42 @@ namespace VentilatedSlab { int ZoneInletNode; // Node number for the air side inlet of the ventilated slab // FLOW: - ZoneNum = VentSlab(Item).ZonePtr; - TotRadSurfaces = VentSlab(Item).NumOfSurfaces; - MixOutNode = VentSlab(Item).OAMixerOutNode; - OANode = VentSlab(Item).OutsideAirNode; - AirOutletNode = VentSlab(Item).RadInNode; - FanOutNode = VentSlab(Item).FanOutletNode; + ZoneNum = state.dataVentilatedSlab->VentSlab(Item).ZonePtr; + TotRadSurfaces = state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; + MixOutNode = state.dataVentilatedSlab->VentSlab(Item).OAMixerOutNode; + OANode = state.dataVentilatedSlab->VentSlab(Item).OutsideAirNode; + AirOutletNode = state.dataVentilatedSlab->VentSlab(Item).RadInNode; + FanOutNode = state.dataVentilatedSlab->VentSlab(Item).FanOutletNode; AirMassFlow = Node(AirOutletNode).MassFlowRate; - ZoneInletNode = VentSlab(Item).ZoneAirInNode; + ZoneInletNode = state.dataVentilatedSlab->VentSlab(Item).ZoneAirInNode; CpAppAir = PsyCpAirFnW(Node(AirOutletNode).HumRat); - AirInletNode = VentSlab(Item).ReturnAirNode; + AirInletNode = state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode; for (RadSurfNum = 1; RadSurfNum <= TotRadSurfaces; ++RadSurfNum) { - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); - if (LastSysTimeElapsed(SurfNum) == SysTimeElapsed) { + if (state.dataVentilatedSlab->LastSysTimeElapsed(SurfNum) == SysTimeElapsed) { // Still iterating or reducing system time step, so subtract old values which were // not valid - QRadSysSrcAvg(SurfNum) -= LastQRadSysSrc(SurfNum) * LastTimeStepSys(SurfNum) / TimeStepZone; + state.dataVentilatedSlab->QRadSysSrcAvg(SurfNum) -= state.dataVentilatedSlab->LastQRadSysSrc(SurfNum) * state.dataVentilatedSlab->LastTimeStepSys(SurfNum) / TimeStepZone; } // Update the running average and the "last" values with the current values of the appropriate variables - QRadSysSrcAvg(SurfNum) += QRadSysSource(SurfNum) * TimeStepSys / TimeStepZone; + state.dataVentilatedSlab->QRadSysSrcAvg(SurfNum) += QRadSysSource(SurfNum) * TimeStepSys / TimeStepZone; - LastQRadSysSrc(SurfNum) = QRadSysSource(SurfNum); - LastSysTimeElapsed(SurfNum) = SysTimeElapsed; - LastTimeStepSys(SurfNum) = TimeStepSys; + state.dataVentilatedSlab->LastQRadSysSrc(SurfNum) = QRadSysSource(SurfNum); + state.dataVentilatedSlab->LastSysTimeElapsed(SurfNum) = SysTimeElapsed; + state.dataVentilatedSlab->LastTimeStepSys(SurfNum) = TimeStepSys; } // First sum up all of the heat sources/sinks associated with this system TotalHeatSource = 0.0; - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); TotalHeatSource += QRadSysSource(SurfNum); } - ZoneNum = VentSlab(Item).ZonePtr; + ZoneNum = state.dataVentilatedSlab->VentSlab(Item).ZonePtr; ZoneMult = double(Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier); TotalHeatSource *= ZoneMult; @@ -4388,26 +4248,26 @@ namespace VentilatedSlab { if ((CpAppAir > 0.0) && (AirMassFlow > 0.0)) { - if ((VentSlab(Item).SysConfg == SlabOnly) || (VentSlab(Item).SysConfg == SeriesSlabs)) { + if ((state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabOnly) || (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SeriesSlabs)) { Node(AirInletNode) = Node(AirInletNode); Node(AirInletNode).Temp = Node(AirOutletNode).Temp - TotalHeatSource / AirMassFlow / CpAppAir; Node(AirInletNode).MassFlowRate = Node(AirOutletNode).MassFlowRate; Node(AirInletNode).HumRat = Node(AirOutletNode).HumRat; - } else if (VentSlab(Item).SysConfg == SlabAndZone) { + } else if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabAndZone) { Node(ZoneInletNode) = Node(ZoneInletNode); Node(ZoneInletNode).Temp = Node(AirOutletNode).Temp - TotalHeatSource / AirMassFlow / CpAppAir; Node(ZoneInletNode).MassFlowRate = Node(AirOutletNode).MassFlowRate; Node(ZoneInletNode).HumRat = Node(AirOutletNode).HumRat; - Node(VentSlab(Item).ReturnAirNode).Temp = MAT(ZoneNum); + Node(state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode).Temp = MAT(ZoneNum); } } else { - if ((VentSlab(Item).SysConfg == SlabOnly) || (VentSlab(Item).SysConfg == SeriesSlabs)) { + if ((state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabOnly) || (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SeriesSlabs)) { Node(FanOutNode) = Node(AirOutletNode); QRadSysSource(SurfNum) = 0.0; - } else if (VentSlab(Item).SysConfg == SlabAndZone) { + } else if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabAndZone) { Node(ZoneInletNode) = Node(AirInletNode); Node(FanOutNode) = Node(AirOutletNode); // Fan Resolve QRadSysSource(SurfNum) = 0.0; @@ -4438,7 +4298,7 @@ namespace VentilatedSlab { } } - Real64 CalcVentSlabHXEffectTerm(int const Item, // Index number of radiant system under consideration + Real64 CalcVentSlabHXEffectTerm(EnergyPlusData &state, int const Item, // Index number of radiant system under consideration Real64 const Temperature, // Temperature of air entering the radiant system, in C Real64 const AirMassFlow, // Mass flow rate of water in the radiant system, in kg/s Real64 const FlowFraction, // Mass flow rate fraction for this surface in the radiant system @@ -4480,10 +4340,6 @@ namespace VentilatedSlab { // Return value Real64 CalcVentSlabHXEffectTerm; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: Real64 const MaxLaminarRe(2300.0); // Maximum Reynolds number for laminar flow int const NumOfPropDivisions(13); Real64 const MaxExpPower(50.0); // Maximum power after which EXP argument would be zero for DP variables @@ -4508,12 +4364,6 @@ namespace VentilatedSlab { {0.01275, 0.0255, 0.0258, 0.0261, 0.0264, 0.0267, 0.02705, 0.0274, 0.02775, 0.0281, 0.0284, 0.0287, 0.01435}); // Conductivity, in W/mK static Array1D const Pr(NumOfPropDivisions, 0.69); // Prandtl number (dimensionless) - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int Index; Real64 InterpFrac; @@ -4551,7 +4401,7 @@ namespace VentilatedSlab { PRactual = Pr(Index - 1) + InterpFrac * (Pr(Index) - Pr(Index - 1)); } // arguments are glycol name, temperature, and concentration - CpAppAir = PsyCpAirFnW(Node(VentSlab(Item).RadInNode).HumRat); + CpAppAir = PsyCpAirFnW(Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).HumRat); SysAirMassFlow = AirMassFlow / CoreNumbers; // Calculate the Reynold's number from RE=(4*Mdot)/(Pi*Mu*Diameter) @@ -4652,7 +4502,7 @@ namespace VentilatedSlab { return SumHATsurf; } - void ReportVentilatedSlab(int const Item) // Index for the ventilated slab under consideration within the derived types + void ReportVentilatedSlab(EnergyPlusData &state, int const Item) // Index for the ventilated slab under consideration within the derived types { // SUBROUTINE INFORMATION: @@ -4667,9 +4517,6 @@ namespace VentilatedSlab { // METHODOLOGY EMPLOYED: // Standard EnergyPlus methodology. - // REFERENCES: - // na - // Using/Aliasing using DataGlobals::SecInHour; using DataHeatBalance::Zone; @@ -4678,73 +4525,58 @@ namespace VentilatedSlab { using DataSurfaces::Surface; // unused-12/12/08 USE FluidProperties, ONLY : GetSpecificHeatGlycol - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int RadSurfNum; // DO loop counter for radiant surfaces in the system int SurfNum; // Surface number (index) in Surface derived type Real64 TotalVentSlabRadPower; // Total source/sink power for the radiant system (sum of all surfaces of the system) Real64 ZoneMult; // Total zone multiplier to apply to the system level variables - // FLOW: - // Slab Part TotalVentSlabRadPower = 0.0; ZoneMult = 1.0; - for (RadSurfNum = 1; RadSurfNum <= VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { - SurfNum = VentSlab(Item).SurfacePtr(RadSurfNum); + for (RadSurfNum = 1; RadSurfNum <= state.dataVentilatedSlab->VentSlab(Item).NumOfSurfaces; ++RadSurfNum) { + SurfNum = state.dataVentilatedSlab->VentSlab(Item).SurfacePtr(RadSurfNum); TotalVentSlabRadPower += QRadSysSource(SurfNum); } - ZoneMult = double(Zone(VentSlab(Item).ZonePtr).Multiplier * Zone(VentSlab(Item).ZonePtr).ListMultiplier); + ZoneMult = double(Zone(state.dataVentilatedSlab->VentSlab(Item).ZonePtr).Multiplier * Zone(state.dataVentilatedSlab->VentSlab(Item).ZonePtr).ListMultiplier); TotalVentSlabRadPower *= ZoneMult; - VentSlab(Item).RadHeatingPower = 0.0; - VentSlab(Item).RadCoolingPower = 0.0; + state.dataVentilatedSlab->VentSlab(Item).RadHeatingPower = 0.0; + state.dataVentilatedSlab->VentSlab(Item).RadCoolingPower = 0.0; if (TotalVentSlabRadPower >= 0.01) { - VentSlab(Item).RadHeatingPower = +TotalVentSlabRadPower; + state.dataVentilatedSlab->VentSlab(Item).RadHeatingPower = +TotalVentSlabRadPower; } else { - VentSlab(Item).RadCoolingPower = -TotalVentSlabRadPower; + state.dataVentilatedSlab->VentSlab(Item).RadCoolingPower = -TotalVentSlabRadPower; } - VentSlab(Item).RadHeatingEnergy = VentSlab(Item).RadHeatingPower * TimeStepSys * SecInHour; - VentSlab(Item).RadCoolingEnergy = VentSlab(Item).RadCoolingPower * TimeStepSys * SecInHour; + state.dataVentilatedSlab->VentSlab(Item).RadHeatingEnergy = state.dataVentilatedSlab->VentSlab(Item).RadHeatingPower * TimeStepSys * SecInHour; + state.dataVentilatedSlab->VentSlab(Item).RadCoolingEnergy = state.dataVentilatedSlab->VentSlab(Item).RadCoolingPower * TimeStepSys * SecInHour; // Coil Part - VentSlab(Item).HeatCoilEnergy = VentSlab(Item).HeatCoilPower * TimeStepSys * SecInHour; - VentSlab(Item).SensCoolCoilEnergy = VentSlab(Item).SensCoolCoilPower * TimeStepSys * SecInHour; - VentSlab(Item).LateCoolCoilEnergy = VentSlab(Item).LateCoolCoilPower * TimeStepSys * SecInHour; - VentSlab(Item).TotCoolCoilEnergy = VentSlab(Item).TotCoolCoilPower * TimeStepSys * SecInHour; - VentSlab(Item).ElecFanEnergy = VentSlab(Item).ElecFanPower * TimeStepSys * SecInHour; - - if ((VentSlab(Item).SysConfg == SlabOnly) || (VentSlab(Item).SysConfg == SeriesSlabs)) { - VentSlab(Item).SlabInTemp = Node(VentSlab(Item).RadInNode).Temp; - VentSlab(Item).SlabOutTemp = Node(VentSlab(Item).ReturnAirNode).Temp; - - } else if (VentSlab(Item).SysConfg == SlabAndZone) { - VentSlab(Item).SlabInTemp = Node(VentSlab(Item).RadInNode).Temp; - VentSlab(Item).ZoneInletTemp = Node(VentSlab(Item).ZoneAirInNode).Temp; - VentSlab(Item).SlabOutTemp = Node(VentSlab(Item).ReturnAirNode).Temp; + state.dataVentilatedSlab->VentSlab(Item).HeatCoilEnergy = state.dataVentilatedSlab->VentSlab(Item).HeatCoilPower * TimeStepSys * SecInHour; + state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilEnergy = state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower * TimeStepSys * SecInHour; + state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilEnergy = state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower * TimeStepSys * SecInHour; + state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilEnergy = state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower * TimeStepSys * SecInHour; + state.dataVentilatedSlab->VentSlab(Item).ElecFanEnergy = state.dataVentilatedSlab->VentSlab(Item).ElecFanPower * TimeStepSys * SecInHour; + + if ((state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabOnly) || (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SeriesSlabs)) { + state.dataVentilatedSlab->VentSlab(Item).SlabInTemp = Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).Temp; + state.dataVentilatedSlab->VentSlab(Item).SlabOutTemp = Node(state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode).Temp; + + } else if (state.dataVentilatedSlab->VentSlab(Item).SysConfg == state.dataVentilatedSlab->SlabAndZone) { + state.dataVentilatedSlab->VentSlab(Item).SlabInTemp = Node(state.dataVentilatedSlab->VentSlab(Item).RadInNode).Temp; + state.dataVentilatedSlab->VentSlab(Item).ZoneInletTemp = Node(state.dataVentilatedSlab->VentSlab(Item).ZoneAirInNode).Temp; + state.dataVentilatedSlab->VentSlab(Item).SlabOutTemp = Node(state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode).Temp; } - VentSlab(Item).ReturnAirTemp = Node(VentSlab(Item).ReturnAirNode).Temp; - VentSlab(Item).FanOutletTemp = Node(VentSlab(Item).FanOutletNode).Temp; + state.dataVentilatedSlab->VentSlab(Item).ReturnAirTemp = Node(state.dataVentilatedSlab->VentSlab(Item).ReturnAirNode).Temp; + state.dataVentilatedSlab->VentSlab(Item).FanOutletTemp = Node(state.dataVentilatedSlab->VentSlab(Item).FanOutletNode).Temp; - if (VentSlab(Item).FirstPass) { // reset sizing flags so other zone equipment can size normally + if (state.dataVentilatedSlab->VentSlab(Item).FirstPass) { // reset sizing flags so other zone equipment can size normally if (!DataGlobals::SysSizingCalc) { - DataSizing::resetHVACSizingGlobals(DataSizing::CurZoneEqNum, 0, VentSlab(Item).FirstPass); + DataSizing::resetHVACSizingGlobals(DataSizing::CurZoneEqNum, 0, state.dataVentilatedSlab->VentSlab(Item).FirstPass); } } } diff --git a/src/EnergyPlus/VentilatedSlab.hh b/src/EnergyPlus/VentilatedSlab.hh index 35a7a434966..27883000fcc 100644 --- a/src/EnergyPlus/VentilatedSlab.hh +++ b/src/EnergyPlus/VentilatedSlab.hh @@ -62,76 +62,6 @@ struct EnergyPlusData; namespace VentilatedSlab { - // Using/Aliasing - - // Data - // MODULE PARAMETER DEFINITIONS - - // Module Object - extern std::string const cMO_VentilatedSlab; - - // Parameters for outside air control types: - extern int const Heating_ElectricCoilType; - extern int const Heating_GasCoilType; - extern int const Heating_WaterCoilType; - extern int const Heating_SteamCoilType; - extern int const Cooling_CoilWaterCooling; - extern int const Cooling_CoilDetailedCooling; - extern int const Cooling_CoilHXAssisted; - extern int const VariablePercent; - extern int const FixedTemperature; - extern int const FixedOAControl; - extern int const NotOperating; // Parameter for use with OperatingMode variable, set for no heating/cooling - extern int const HeatingMode; // Parameter for use with OperatingMode variable, set for heating - extern int const CoolingMode; // Parameter for use with OperatingMode variable, set for cooling - // Ventilated Slab Configurations - extern int const SlabOnly; // Air circulate through cores of slab only - extern int const SlabAndZone; // Circulated Air is introduced to zone - extern int const SeriesSlabs; - // Control Types - extern int const MATControl; // Controls system using mean air temperature - extern int const MRTControl; // Controls system using mean radiant temperature - extern int const OPTControl; // Controls system using operative temperature - extern int const ODBControl; // Controls system using outside air dry-bulb temperature - extern int const OWBControl; // Controls system using outside air wet-bulb temperature - extern int const SURControl; // Controls system using surface temperature !Phase2-A - extern int const DPTZControl; // Controls system using dew-point temperature of zone!Phase2-A - - // coil operation - extern int const On; // normal coil operation - extern int const Off; // signal coil shouldn't run - extern int const NoneOption; - extern int const BothOption; - extern int const HeatingOption; - extern int const CoolingOption; - extern int OperatingMode; // Used to keep track of whether system is in heating or cooling mode - - // DERIVED TYPE DEFINITIONS - - // MODULE VARIABLE DECLARATIONS: - extern bool HCoilOn; // TRUE if the heating coil (gas or electric especially) should be running - extern int NumOfVentSlabs; // Number of ventilated slab in the input file - extern Real64 OAMassFlowRate; // Outside air mass flow rate for the ventilated slab - extern Array1D_double QRadSysSrcAvg; // Average source over the time step for a particular radiant surfaceD - extern Array1D ZeroSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source - extern int MaxCloNumOfSurfaces; // Used to set allocate size in CalcClo routine - extern Real64 QZnReq; // heating or cooling needed by system [watts] - - // Record keeping variables used to calculate QRadSysSrcAvg locally - - extern Array1D_double LastQRadSysSrc; // Need to keep the last value in case we are still iterating - extern Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - extern Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating - extern Array1D_bool CheckEquipName; - - // Autosizing variables - extern Array1D_bool MySizeFlag; - - // SUBROUTINE SPECIFICATIONS FOR MODULE VentilatedSlab - // PRIVATE UpdateVentilatedSlabValAvg - - // Types - struct VentilatedSlabData { // Members @@ -337,14 +267,8 @@ namespace VentilatedSlab { } }; - // Object Data - extern Array1D VentSlab; - extern Array1D VentSlabNumericFields; - // Functions - void clear_state(); - void SimVentilatedSlab(EnergyPlusData &state, std::string const &CompName, // name of the fan coil unit int const ZoneNum, // number of zone being served bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep @@ -373,7 +297,7 @@ namespace VentilatedSlab { Real64 &LoadMet // load met by the system (watts) ); - void CalcVentilatedSlabCoilOutput(int const Item, // system index in ventilated slab array + void CalcVentilatedSlabCoilOutput(EnergyPlusData &state, int const Item, // system index in ventilated slab array Real64 &PowerMet, // power supplied (W) Real64 &LatOutputProvided // latent capacity supplied (kg/s) ); @@ -382,13 +306,13 @@ namespace VentilatedSlab { bool const FirstHVACIteration // flag for 1st HVAV iteration in the time step !unused1208 ); - void SimVentSlabOAMixer(int const Item); // System index in Ventilated Slab array + void SimVentSlabOAMixer(EnergyPlusData &state, int const Item); // System index in Ventilated Slab array - void UpdateVentilatedSlab(int const Item, // Index for the ventilated slab under consideration within the derived types + void UpdateVentilatedSlab(EnergyPlusData &state, int const Item, // Index for the ventilated slab under consideration within the derived types bool const FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep !unused1208 ); - Real64 CalcVentSlabHXEffectTerm(int const Item, // Index number of radiant system under consideration + Real64 CalcVentSlabHXEffectTerm(EnergyPlusData &state, int const Item, // Index number of radiant system under consideration Real64 const Temperature, // Temperature of air entering the radiant system, in C Real64 const AirMassFlow, // Mass flow rate of water in the radiant system, in kg/s Real64 const FlowFraction, // Mass flow rate fraction for this surface in the radiant system @@ -398,12 +322,103 @@ namespace VentilatedSlab { Real64 SumHATsurf(int const ZoneNum); // Zone number - void ReportVentilatedSlab(int const Item); // Index for the ventilated slab under consideration within the derived types + void ReportVentilatedSlab(EnergyPlusData &state, int const Item); // Index for the ventilated slab under consideration within the derived types //***************************************************************************************** } // namespace VentilatedSlab +struct VentilatedSlabData : BaseGlobalStruct { + + std::string const cMO_VentilatedSlab = "ZoneHVAC:VentilatedSlab"; + + // Parameters for outside air control types: + int const Heating_ElectricCoilType = 1; + int const Heating_GasCoilType = 2; + int const Heating_WaterCoilType = 3; + int const Heating_SteamCoilType = 4; + int const Cooling_CoilWaterCooling = 1; + int const Cooling_CoilDetailedCooling = 2; + int const Cooling_CoilHXAssisted = 3; + int const VariablePercent = 1; + int const FixedTemperature = 2; + int const FixedOAControl = 3; + int const NotOperating = 0; // Parameter for use with OperatingMode variable, set for no heating/cooling + int const HeatingMode = 1; // Parameter for use with OperatingMode variable, set for heating + int const CoolingMode = 2; // Parameter for use with OperatingMode variable, set for cooling + // Ventilated Slab Configurations + int const SlabOnly = 1; // Air circulate through cores of slab only + int const SlabAndZone = 2; // Circulated Air is introduced to zone + int const SeriesSlabs = 3; + // Control Types + int const MATControl = 1; // Controls system using mean air temperature + int const MRTControl = 2; // Controls system using mean radiant temperature + int const OPTControl = 3; // Controls system using operative temperature + int const ODBControl = 4; // Controls system using outside air dry-bulb temperature + int const OWBControl = 5; // Controls system using outside air wet-bulb temperature + int const SURControl = 6; // Controls system using surface temperature !Phase2-A + int const DPTZControl = 7; // Controls system using dew-point temperature of zone!Phase2-A + + // coil operation + int const On = 1; // normal coil operation + int const Off = 0; // signal coil shouldn't run + int const NoneOption = 0; + int const BothOption = 1; + int const HeatingOption = 2; + int const CoolingOption = 3; + int OperatingMode = 0; // Used to keep track of whether system is in heating or cooling mode + + // MODULE VARIABLE DECLARATIONS: + bool HCoilOn = false; // TRUE if the heating coil (gas or electric especially) should be running + int NumOfVentSlabs = 0; // Number of ventilated slab in the input file + Real64 OAMassFlowRate = 0.0; // Outside air mass flow rate for the ventilated slab + Array1D_double QRadSysSrcAvg; // Average source over the time step for a particular radiant surfaceD + Array1D ZeroSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source + int MaxCloNumOfSurfaces = 0; // Used to set allocate size in CalcClo routine + Real64 QZnReq = 0.0; // heating or cooling needed by system [watts] + + // Record keeping variables used to calculate QRadSysSrcAvg locally + + Array1D_double LastQRadSysSrc; // Need to keep the last value in case we are still iterating + Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating + Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating + Array1D_bool CheckEquipName; + + // Autosizing variables + bool GetInputFlag = true; + bool MyOneTimeFlag = true; + Array1D_bool MySizeFlag; + + // Object Data + Array1D VentSlab; + Array1D VentSlabNumericFields; + + void clear_state() override + { + MyOneTimeFlag = true; + GetInputFlag = true; + HCoilOn = false; + NumOfVentSlabs = 0; + OAMassFlowRate = 0.0; + MaxCloNumOfSurfaces = 0; + QZnReq = 0.0; + QRadSysSrcAvg.deallocate(); + ZeroSourceSumHATsurf.deallocate(); + LastQRadSysSrc.deallocate(); + LastSysTimeElapsed.deallocate(); + LastTimeStepSys.deallocate(); + CheckEquipName.deallocate(); + MySizeFlag.deallocate(); + VentSlab.deallocate(); + VentSlabNumericFields.deallocate(); + } + + // Default Constructor + VentilatedSlabData() + { + } +}; + } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index 0a4a7c69f51..b1a1e8cd18b 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -1388,7 +1388,7 @@ namespace WaterThermalTanks { if (HPWH.bIsIHP) { HPWH.DXCoilType = "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE"; } else { - HPWH.DXCoilType = VariableSpeedCoils::VarSpeedCoil(HPWH.DXCoilNum).VarSpeedCoilType; + HPWH.DXCoilType = state.dataVariableSpeedCoils->VarSpeedCoil(HPWH.DXCoilNum).VarSpeedCoilType; } } else { // this is a single speed coil @@ -1541,8 +1541,8 @@ namespace WaterThermalTanks { } // issue #5630, set fan info in coils. if (bIsVScoil) { - VariableSpeedCoils::setVarSpeedHPWHFanTypeNum(HPWH.DXCoilNum, HPWH.FanType_Num); - VariableSpeedCoils::setVarSpeedHPWHFanIndex(HPWH.DXCoilNum, HPWH.FanNum); + VariableSpeedCoils::setVarSpeedHPWHFanTypeNum(state, HPWH.DXCoilNum, HPWH.FanType_Num); + VariableSpeedCoils::setVarSpeedHPWHFanIndex(state, HPWH.DXCoilNum, HPWH.FanNum); } else { DXCoils::SetDXCoolingCoilData( state, HPWH.DXCoilNum, errFlag, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, HPWH.FanName); @@ -5991,7 +5991,7 @@ namespace WaterThermalTanks { // IntegratedHeatPump::SimIHP(modBlankString, HPWaterHeater(HPNum).DXCoilNum, // 0, EMP1, EMP2, EMP3, 0, 0.0, 1, 0.0, 0.0, 0.0, false, 0.0); //conduct the sizing operation in the IHP int VSCoilID = IntegratedHeatPump::IntegratedHeatPumps(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).SCWHCoilIndex; - state.dataWaterThermalTanks->HPWaterHeater(HPNum).NumofSpeed = VariableSpeedCoils::VarSpeedCoil(VSCoilID).NumOfSpeeds; + state.dataWaterThermalTanks->HPWaterHeater(HPNum).NumofSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).NumOfSpeeds; } else if (UtilityRoutines::SameString(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilType, "Coil:WaterHeating:AirToWaterHeatPump:VariableSpeed") && (state.dataWaterThermalTanks->HPWaterHeater(HPNum).NumofSpeed == 0)) { @@ -6013,7 +6013,7 @@ namespace WaterThermalTanks { 0.0, 0.0); // conduct the sizing operation in the VS WSHP int VSCoilID = state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum; - state.dataWaterThermalTanks->HPWaterHeater(HPNum).NumofSpeed = VariableSpeedCoils::VarSpeedCoil(VSCoilID).NumOfSpeeds; + state.dataWaterThermalTanks->HPWaterHeater(HPNum).NumofSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).NumOfSpeeds; // below pass the flow rates from the VS coil to the water heater object } @@ -6026,11 +6026,11 @@ namespace WaterThermalTanks { // scale air flow rates Real64 MulSpeedFlowScale = - VariableSpeedCoils::VarSpeedCoil(VSCoilID).RatedAirVolFlowRate / - VariableSpeedCoils::VarSpeedCoil(VSCoilID).MSRatedAirVolFlowRate(VariableSpeedCoils::VarSpeedCoil(VSCoilID).NormSpedLevel); + state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).RatedAirVolFlowRate / + state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).NormSpedLevel); for (int Iter = 1; Iter <= state.dataWaterThermalTanks->HPWaterHeater(HPNum).NumofSpeed; ++Iter) { state.dataWaterThermalTanks->HPWaterHeater(HPNum).HPWHAirVolFlowRate(Iter) = - VariableSpeedCoils::VarSpeedCoil(VSCoilID).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; + state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale; } // check fan flow rate, should be larger than the max flow rate of the VS coil @@ -6073,16 +6073,16 @@ namespace WaterThermalTanks { // scale water flow rates MulSpeedFlowScale = - VariableSpeedCoils::VarSpeedCoil(VSCoilID).RatedWaterVolFlowRate / - VariableSpeedCoils::VarSpeedCoil(VSCoilID).MSRatedWaterVolFlowRate(VariableSpeedCoils::VarSpeedCoil(VSCoilID).NormSpedLevel); + state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).RatedWaterVolFlowRate / + state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).MSRatedWaterVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).NormSpedLevel); for (int Iter = 1; Iter <= state.dataWaterThermalTanks->HPWaterHeater(HPNum).NumofSpeed; ++Iter) { state.dataWaterThermalTanks->HPWaterHeater(HPNum).HPWHWaterVolFlowRate(Iter) = - VariableSpeedCoils::VarSpeedCoil(VSCoilID).MSRatedWaterVolFlowRate(Iter) * MulSpeedFlowScale; + state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).MSRatedWaterVolFlowRate(Iter) * MulSpeedFlowScale; state.dataWaterThermalTanks->HPWaterHeater(HPNum).HPWHWaterMassFlowRate(Iter) = - VariableSpeedCoils::VarSpeedCoil(VSCoilID).MSRatedWaterMassFlowRate(Iter) * MulSpeedFlowScale; + state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).MSRatedWaterMassFlowRate(Iter) * MulSpeedFlowScale; state.dataWaterThermalTanks->HPWaterHeater(HPNum).MSWaterSpeedRatio(Iter) = - VariableSpeedCoils::VarSpeedCoil(VSCoilID).MSRatedWaterVolFlowRate(Iter) / - VariableSpeedCoils::VarSpeedCoil(VSCoilID).MSRatedWaterVolFlowRate(state.dataWaterThermalTanks->HPWaterHeater(HPNum).NumofSpeed); + state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).MSRatedWaterVolFlowRate(Iter) / + state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilID).MSRatedWaterVolFlowRate(state.dataWaterThermalTanks->HPWaterHeater(HPNum).NumofSpeed); } Real64 rhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(DataEnvironment::OutBaroPress, HPInletDryBulbTemp, HPInletHumRat); @@ -7050,7 +7050,7 @@ namespace WaterThermalTanks { Real64 CoilTotalHeatingEnergyRate; if (HPWH.NumofSpeed > 0) { // VSHPWH - VariableSpeedCoils::VariableSpeedCoilData const &Coil = VariableSpeedCoils::VarSpeedCoil(HPWH.DXCoilNum); + VariableSpeedCoils::VariableSpeedCoilData const &Coil = state.dataVariableSpeedCoils->VarSpeedCoil(HPWH.DXCoilNum); CoilTotalHeatingEnergyRate = Coil.TotalHeatingEnergyRate; } else { // Single speed HPWH @@ -7923,7 +7923,7 @@ namespace WaterThermalTanks { } else if (DesupHtr.ReclaimHeatingSource == CoilObjEnum::DXVariableCooling) { AverageWasteHeat = DataHeatBalance::HeatReclaimVS_DXCoil(SourceID).AvailCapacity - DataHeatBalance::HeatReclaimVS_DXCoil(SourceID).HVACDesuperheaterReclaimedHeatTotal; - DesupHtr.DXSysPLR = VariableSpeedCoils::VarSpeedCoil(SourceID).PartLoadRatio; + DesupHtr.DXSysPLR = state.dataVariableSpeedCoils->VarSpeedCoil(SourceID).PartLoadRatio; } else if (DesupHtr.ReclaimHeatingSource == CoilObjEnum::AirWaterHeatPumpEQ) { AverageWasteHeat = DataHeatBalance::HeatReclaimSimple_WAHPCoil(SourceID).AvailCapacity - DataHeatBalance::HeatReclaimSimple_WAHPCoil(SourceID).HVACDesuperheaterReclaimedHeatTotal; @@ -9763,14 +9763,14 @@ namespace WaterThermalTanks { } else { assert(this->TypeNum == DataPlant::TypeOf_WtrHeaterStratified); // For a stratified tank, the PLR is applied to the Coil.TotalHeatingEnergyRate - // whether that's a VariableSpeedCoils::VarSpeedCoil or DXCoils::DXCoil. + // whether that's a state.dataVariableSpeedCoils->VarSpeedCoil or DXCoils::DXCoil. // Here we create a pointer to the TotalHeatingEnergyRate for the appropriate coil type. Real64 *CoilTotalHeatingEnergyRatePtr; if (isVariableSpeed) { if (HeatPump.bIsIHP) CoilTotalHeatingEnergyRatePtr = &IntegratedHeatPump::IntegratedHeatPumps(HeatPump.DXCoilNum).TotalWaterHeatingRate; else - CoilTotalHeatingEnergyRatePtr = &VariableSpeedCoils::VarSpeedCoil(HeatPump.DXCoilNum).TotalHeatingEnergyRate; + CoilTotalHeatingEnergyRatePtr = &state.dataVariableSpeedCoils->VarSpeedCoil(HeatPump.DXCoilNum).TotalHeatingEnergyRate; } else { CoilTotalHeatingEnergyRatePtr = &DXCoils::DXCoil(HeatPump.DXCoilNum).TotalHeatingEnergyRate; } @@ -11422,7 +11422,7 @@ namespace WaterThermalTanks { Real64 RhoWater = Psychrometrics::RhoH2O(this->TankTemp); auto &HPWH = state.dataWaterThermalTanks->HPWaterHeater(HPNum); this->SetVSHPWHFlowRates(state, - HPWH, VariableSpeedCoils::VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, 1.0, RhoWater, MdotWater, true); + HPWH, state.dataVariableSpeedCoils->VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, 1.0, RhoWater, MdotWater, true); // simulate the HPWH coil/fan to find heating capacity Real64 EMP1 = 0.0; Real64 EMP2 = 0.0; @@ -11443,7 +11443,7 @@ namespace WaterThermalTanks { EMP3, 1, 1.0, - VariableSpeedCoils::VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, + state.dataVariableSpeedCoils->VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, 1.0, 0.0, 0.0, @@ -11462,7 +11462,7 @@ namespace WaterThermalTanks { EMP3, 1, 1.0, - VariableSpeedCoils::VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, + state.dataVariableSpeedCoils->VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, 1.0, 0.0, 0.0, @@ -11478,7 +11478,7 @@ namespace WaterThermalTanks { EMP3, 1, 1.0, - VariableSpeedCoils::VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, + state.dataVariableSpeedCoils->VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, 1.0, 0.0, 0.0, @@ -11497,7 +11497,7 @@ namespace WaterThermalTanks { EMP3, 1, 1.0, - VariableSpeedCoils::VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, + state.dataVariableSpeedCoils->VarSpeedCoil(state.dataWaterThermalTanks->HPWaterHeater(HPNum).DXCoilNum).NormSpedLevel, 1.0, 0.0, 0.0, @@ -11509,9 +11509,9 @@ namespace WaterThermalTanks { } } - this->MaxCapacity = VariableSpeedCoils::VSHPWHHeatingCapacity; - this->MinCapacity = VariableSpeedCoils::VSHPWHHeatingCapacity; - this->Efficiency = VariableSpeedCoils::VSHPWHHeatingCOP; + this->MaxCapacity = state.dataVariableSpeedCoils->VSHPWHHeatingCapacity; + this->MinCapacity = state.dataVariableSpeedCoils->VSHPWHHeatingCapacity; + this->Efficiency = state.dataVariableSpeedCoils->VSHPWHHeatingCOP; } else { bIsVSCoil = false; // simulate the HPWH coil/fan to find heating capacity @@ -11659,7 +11659,7 @@ namespace WaterThermalTanks { OutputReportPredefined::PreDefTableEntry(OutputReportPredefined::pdchSWHType, equipName, state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).Type); OutputReportPredefined::PreDefTableEntry(OutputReportPredefined::pdchSWHVol, equipName, this->Volume); if (bIsVSCoil) { - OutputReportPredefined::PreDefTableEntry(OutputReportPredefined::pdchSWHHeatIn, equipName, VariableSpeedCoils::VSHPWHHeatingCapacity); + OutputReportPredefined::PreDefTableEntry(OutputReportPredefined::pdchSWHHeatIn, equipName, state.dataVariableSpeedCoils->VSHPWHHeatingCapacity); } else { OutputReportPredefined::PreDefTableEntry(OutputReportPredefined::pdchSWHHeatIn, equipName, DXCoils::HPWHHeatingCapacity); } diff --git a/src/EnergyPlus/WaterThermalTanks.hh b/src/EnergyPlus/WaterThermalTanks.hh index ba0416d06c7..0b0c16cfbbf 100644 --- a/src/EnergyPlus/WaterThermalTanks.hh +++ b/src/EnergyPlus/WaterThermalTanks.hh @@ -222,6 +222,7 @@ namespace WaterThermalTanks { struct HeatPumpWaterHeaterData : PlantComponent { + int MaxSpedLevels = 10; // Members std::string Name; // Name of heat pump water heater std::string Type; // Type of water heater (HEAT PUMP:WATER HEATER) @@ -374,10 +375,10 @@ namespace WaterThermalTanks { ShowSetPointWarning(true), HPWaterHeaterSensibleCapacity(0.0), HPWaterHeaterLatentCapacity(0.0), WrappedCondenserBottomLocation(0.0), WrappedCondenserTopLocation(0.0), ControlSensor1Height(-1.0), ControlSensor1Node(1), ControlSensor1Weight(1.0), ControlSensor2Height(-1.0), ControlSensor2Node(2), ControlSensor2Weight(0.0), ControlTempAvg(0.0), ControlTempFinal(0.0), - AllowHeatingElementAndHeatPumpToRunAtSameTime(true), NumofSpeed(0), HPWHAirVolFlowRate(VariableSpeedCoils::MaxSpedLevels, 0.0), - HPWHAirMassFlowRate(VariableSpeedCoils::MaxSpedLevels, 0.0), HPWHWaterVolFlowRate(VariableSpeedCoils::MaxSpedLevels, 0.0), - HPWHWaterMassFlowRate(VariableSpeedCoils::MaxSpedLevels, 0.0), MSAirSpeedRatio(VariableSpeedCoils::MaxSpedLevels, 0.0), - MSWaterSpeedRatio(VariableSpeedCoils::MaxSpedLevels, 0.0), bIsIHP(false), MyOneTimeFlagHP(true), MyTwoTimeFlagHP(true), + AllowHeatingElementAndHeatPumpToRunAtSameTime(true), NumofSpeed(0), HPWHAirVolFlowRate(MaxSpedLevels, 0.0), + HPWHAirMassFlowRate(MaxSpedLevels, 0.0), HPWHWaterVolFlowRate(MaxSpedLevels, 0.0), + HPWHWaterMassFlowRate(MaxSpedLevels, 0.0), MSAirSpeedRatio(MaxSpedLevels, 0.0), + MSWaterSpeedRatio(MaxSpedLevels, 0.0), bIsIHP(false), MyOneTimeFlagHP(true), MyTwoTimeFlagHP(true), CheckHPWHEquipName(true), myOneTimeInitFlag(true) { } diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index ea007c449a0..5b876555ef7 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -200,16 +200,16 @@ namespace WindowComplexManager { // below should be modified to enter both of the bases into the basis list. for (IConst = FirstBSDF; IConst <= FirstBSDF + TotComplexFenStates - 1; ++IConst) { - MatrixNo = dataConstruction.Construct(IConst).BSDFInput.BasisMatIndex; + MatrixNo = state.dataConstruction->Construct(IConst).BSDFInput.BasisMatIndex; if (NumBasis == 0) { NumBasis = 1; - ConstructBasis(IConst, state.dataWindowComplexManager->BasisList(1)); + ConstructBasis(state, IConst, state.dataWindowComplexManager->BasisList(1)); } else { for (IBasis = 1; IBasis <= NumBasis; ++IBasis) { if (MatrixNo == state.dataWindowComplexManager->BasisList(IBasis).BasisMatIndex) goto BsLoop_loop; } ++NumBasis; - ConstructBasis(IConst, state.dataWindowComplexManager->BasisList(NumBasis)); + ConstructBasis(state, IConst, state.dataWindowComplexManager->BasisList(NumBasis)); } BsLoop_loop:; } @@ -227,7 +227,7 @@ namespace WindowComplexManager { for (ISurf = 1; ISurf <= TotSurfaces; ++ISurf) { IConst = Surface(ISurf).Construction; if (IConst == 0) continue; // This is true for overhangs (Shading:Zone:Detailed) - if (!(dataConstruction.Construct(IConst).TypeIsWindow && (dataConstruction.Construct(IConst).WindowTypeBSDF))) continue; // Only BSDF windows + if (!(state.dataConstruction->Construct(IConst).TypeIsWindow && (state.dataConstruction->Construct(IConst).WindowTypeBSDF))) continue; // Only BSDF windows // Simon Check: Thermal construction removed // ThConst = Construct(IConst)%BSDFInput%ThermalConstruction SurfWinWindowModelType(ISurf) = WindowBSDFModel; @@ -247,7 +247,7 @@ namespace WindowComplexManager { // Simon Check: ThermalConstruction assigned to current construction // state.dataWindowComplexManager->WindowStateList(NumComplexWind, NumStates)%ThermConst = ThConst for (I = 1; I <= NumBasis; ++I) { // Find basis in Basis List - if (dataConstruction.Construct(IConst).BSDFInput.BasisMatIndex == state.dataWindowComplexManager->BasisList(I).BasisMatIndex) { + if (state.dataConstruction->Construct(IConst).BSDFInput.BasisMatIndex == state.dataWindowComplexManager->BasisList(I).BasisMatIndex) { state.dataWindowComplexManager->WindowStateList(NumStates, state.dataWindowComplexManager->NumComplexWind).IncBasisIndx = I; // Note: square property matrices state.dataWindowComplexManager->WindowStateList(NumStates, state.dataWindowComplexManager->NumComplexWind).TrnBasisIndx = I; // assumption } @@ -457,8 +457,8 @@ namespace WindowComplexManager { SurfaceWindow(iSurf).ComplexFen.State(NumOfStates).Konst = iConst; // load basis and setup window state geometry - ConstructBasis(iConst, ComplexWind(iSurf).Geom(NumOfStates).Inc); - ConstructBasis(iConst, ComplexWind(iSurf).Geom(NumOfStates).Trn); + ConstructBasis(state, iConst, ComplexWind(iSurf).Geom(NumOfStates).Inc); + ConstructBasis(state, iConst, ComplexWind(iSurf).Geom(NumOfStates).Trn); SetupComplexWindowStateGeometry(state, iSurf, NumOfStates, iConst, ComplexWind(iSurf), ComplexWind(iSurf).Geom(NumOfStates), SurfaceWindow(iSurf).ComplexFen.State(NumOfStates)); @@ -468,7 +468,7 @@ namespace WindowComplexManager { // calculate static properties for complex fenestration CalcWindowStaticProperties( - iSurf, NumOfStates, ComplexWind(iSurf), ComplexWind(iSurf).Geom(NumOfStates), SurfaceWindow(iSurf).ComplexFen.State(NumOfStates)); + state, iSurf, NumOfStates, ComplexWind(iSurf), ComplexWind(iSurf).Geom(NumOfStates), SurfaceWindow(iSurf).ComplexFen.State(NumOfStates)); // calculate hourly data from complex fenestration CFSShadeAndBeamInitialization(state, iSurf, NumOfStates); @@ -785,22 +785,22 @@ namespace WindowComplexManager { for (I = 1; I <= Window.NBkSurf; ++I) { // Back surface loop Sum1 = 0.0; for (J = 1; J <= Geom.NSurfInt(I); ++J) { // Ray loop - Sum1 += Geom.Trn.Lamda(Geom.SurfInt(J, I)) * dataConstruction.Construct(IConst).BSDFInput.SolFrtTrans(IBm, Geom.SurfInt(J, I)); + Sum1 += Geom.Trn.Lamda(Geom.SurfInt(J, I)) * state.dataConstruction->Construct(IConst).BSDFInput.SolFrtTrans(IBm, Geom.SurfInt(J, I)); } // Ray loop State.WinToSurfBmTrans(Hour, TS, I) = Sum1; } // Back surface loop // Calculate the directional-hemispherical transmittance Sum1 = 0.0; for (J = 1; J <= Geom.Trn.NBasis; ++J) { - Sum1 += Geom.Trn.Lamda(J) * dataConstruction.Construct(IConst).BSDFInput.SolFrtTrans(IBm, J); + Sum1 += Geom.Trn.Lamda(J) * state.dataConstruction->Construct(IConst).BSDFInput.SolFrtTrans(IBm, J); } State.WinDirHemiTrans(Hour, TS) = Sum1; // Calculate the directional specular transmittance // Note: again using assumption that Inc and Trn basis have same structure - State.WinDirSpecTrans(Hour, TS) = Geom.Trn.Lamda(IBm) * dataConstruction.Construct(IConst).BSDFInput.SolFrtTrans(IBm, IBm); + State.WinDirSpecTrans(Hour, TS) = Geom.Trn.Lamda(IBm) * state.dataConstruction->Construct(IConst).BSDFInput.SolFrtTrans(IBm, IBm); // Calculate the layer front absorptance for beam radiation for (L = 1; L <= State.NLayers; ++L) { - State.WinBmFtAbs(Hour, TS, L) = dataConstruction.Construct(IConst).BSDFInput.Layer(L).FrtAbs(IBm, 1); + State.WinBmFtAbs(Hour, TS, L) = state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).FrtAbs(IBm, 1); } } // Calculate, for a given beam direction, the transmittance into the zone @@ -814,7 +814,7 @@ namespace WindowComplexManager { Sum2 += Geom.SolBmGndWt(Hour, TS, J) * Geom.Inc.Lamda(JRay); for (M = 1; M <= Geom.Trn.NBasis; ++M) { // Outgoing ray loop Sum1 += - Geom.SolBmGndWt(Hour, TS, J) * Geom.Inc.Lamda(JRay) * Geom.Trn.Lamda(M) * dataConstruction.Construct(IConst).BSDFInput.SolFrtTrans(JRay, M); + Geom.SolBmGndWt(Hour, TS, J) * Geom.Inc.Lamda(JRay) * Geom.Trn.Lamda(M) * state.dataConstruction->Construct(IConst).BSDFInput.SolFrtTrans(JRay, M); } // Outgoing ray loop } } // Indcident ray loop @@ -834,7 +834,7 @@ namespace WindowComplexManager { JRay = Geom.GndIndex(J); if (Geom.SolBmGndWt(Hour, TS, J) > 0.0) { Sum2 += Geom.SolBmGndWt(Hour, TS, J) * Geom.Inc.Lamda(JRay); - Sum1 += Geom.SolBmGndWt(Hour, TS, J) * Geom.Inc.Lamda(JRay) * dataConstruction.Construct(IConst).BSDFInput.Layer(L).FrtAbs(JRay, 1); + Sum1 += Geom.SolBmGndWt(Hour, TS, J) * Geom.Inc.Lamda(JRay) * state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).FrtAbs(JRay, 1); } } // Incident ray loop if (Sum2 > 0.0) { @@ -869,11 +869,11 @@ namespace WindowComplexManager { // back surface window and hit this one! Sum1 = 0.0; for (J = 1; J <= Geom.Trn.NBasis; ++J) { - Sum1 += Geom.Trn.Lamda(J) * dataConstruction.Construct(IConst).BSDFInput.SolBkRefl(BkIncRay, J); + Sum1 += Geom.Trn.Lamda(J) * state.dataConstruction->Construct(IConst).BSDFInput.SolBkRefl(BkIncRay, J); } Refl = Sum1; for (L = 1; L <= State.NLayers; ++L) { - Absorb(L) = dataConstruction.Construct(IConst).BSDFInput.Layer(L).BkAbs(BkIncRay, 1); + Absorb(L) = state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).BkAbs(BkIncRay, 1); } } else { // solar ray can't be incident on back, so set properties equal to zero @@ -922,12 +922,13 @@ namespace WindowComplexManager { // IConst = WindowStateList ( IWind , IState )%Konst SurfaceWindow(ISurf).ComplexFen.State(IState).Konst = state.dataWindowComplexManager->WindowStateList(IState, IWind).Konst; CalcWindowStaticProperties( - ISurf, IState, ComplexWind(ISurf), ComplexWind(ISurf).Geom(IState), SurfaceWindow(ISurf).ComplexFen.State(IState)); + state, ISurf, IState, ComplexWind(ISurf), ComplexWind(ISurf).Geom(IState), SurfaceWindow(ISurf).ComplexFen.State(IState)); } } } - void CalculateBasisLength(BSDFWindowInputStruct const &Input, // BSDF data input struct for this construction + void CalculateBasisLength(EnergyPlusData &state, + BSDFWindowInputStruct const &Input, // BSDF data input struct for this construction int const IConst, // Construction number of input int &NBasis // Calculated Basis length ) @@ -950,7 +951,7 @@ namespace WindowComplexManager { } NBasis = 1; for (int I = 2; I <= Input.BasisMatNrows; ++I) { - NBasis += std::floor(dataConstruction.Construct(IConst).BSDFInput.BasisMat(2, I) + 0.001); + NBasis += std::floor(state.dataConstruction->Construct(IConst).BSDFInput.BasisMat(2, I) + 0.001); } } @@ -982,7 +983,8 @@ namespace WindowComplexManager { } } - void ConstructBasis(int const IConst, // Index for accessing Construct array + void ConstructBasis(EnergyPlusData &state, + int const IConst, // Index for accessing Construct array BasisStruct &Basis) { // SUBROUTINE INFORMATION: @@ -1014,10 +1016,10 @@ namespace WindowComplexManager { Array1D Thetas; // temp array holding theta values Array1D_int NPhis; // temp array holding number of phis for a given theta - NThetas = dataConstruction.Construct(IConst).BSDFInput.BasisMatNrows; // Note here assuming row by row input + NThetas = state.dataConstruction->Construct(IConst).BSDFInput.BasisMatNrows; // Note here assuming row by row input Basis.NThetas = NThetas; - Basis.BasisMatIndex = dataConstruction.Construct(IConst).BSDFInput.BasisMatIndex; - Basis.NBasis = dataConstruction.Construct(IConst).BSDFInput.NBasis; + Basis.BasisMatIndex = state.dataConstruction->Construct(IConst).BSDFInput.BasisMatIndex; + Basis.NBasis = state.dataConstruction->Construct(IConst).BSDFInput.NBasis; Basis.Grid.allocate(Basis.NBasis); Thetas.allocate(NThetas + 1); // Temp array // By convention the Thetas array contains a final point at Pi/2 which is not a basis element @@ -1025,12 +1027,12 @@ namespace WindowComplexManager { Basis.Thetas.allocate(NThetas + 1); Basis.NPhis.allocate(NThetas + 1); - Basis.Lamda.allocate(dataConstruction.Construct(IConst).BSDFInput.NBasis); - Basis.SolAng.allocate(dataConstruction.Construct(IConst).BSDFInput.NBasis); - if (dataConstruction.Construct(IConst).BSDFInput.BasisType == BasisType_WINDOW) { + Basis.Lamda.allocate(state.dataConstruction->Construct(IConst).BSDFInput.NBasis); + Basis.SolAng.allocate(state.dataConstruction->Construct(IConst).BSDFInput.NBasis); + if (state.dataConstruction->Construct(IConst).BSDFInput.BasisType == BasisType_WINDOW) { // WINDOW6 Basis Basis.BasisType = BasisType_WINDOW; - if (dataConstruction.Construct(IConst).BSDFInput.BasisSymmetryType == BasisSymmetry_None) { + if (state.dataConstruction->Construct(IConst).BSDFInput.BasisSymmetryType == BasisSymmetry_None) { // No basis symmetry Basis.BasisSymmetryType = BasisSymmetry_None; Thetas(1) = 0.0; // By convention, the first basis point is at the center (theta=0,phi=0) @@ -1038,8 +1040,8 @@ namespace WindowComplexManager { NPhis(1) = 1; NumElem = 1; for (I = 2; I <= NThetas; ++I) { - Thetas(I) = dataConstruction.Construct(IConst).BSDFInput.BasisMat(1, I) * DegToRadians; - NPhis(I) = std::floor(dataConstruction.Construct(IConst).BSDFInput.BasisMat(2, I) + 0.001); + Thetas(I) = state.dataConstruction->Construct(IConst).BSDFInput.BasisMat(1, I) * DegToRadians; + NPhis(I) = std::floor(state.dataConstruction->Construct(IConst).BSDFInput.BasisMat(2, I) + 0.001); if (NPhis(I) <= 0) ShowFatalError("WindowComplexManager: incorrect input, no. phis must be positive."); NumElem += NPhis(I); } @@ -1048,7 +1050,7 @@ namespace WindowComplexManager { Basis.BasisIndex.allocate(MaxNPhis, NThetas + 1); Basis.Phis = 0.0; // Initialize so undefined elements will contain zero Basis.BasisIndex = 0; // Initialize so undefined elements will contain zero - if (NumElem != dataConstruction.Construct(IConst).BSDFInput.NBasis) { // Constructed Basis must match property matrices + if (NumElem != state.dataConstruction->Construct(IConst).BSDFInput.NBasis) { // Constructed Basis must match property matrices ShowFatalError("WindowComplexManager: Constructed basis length does not match property matrices."); } Basis.Thetas = Thetas; @@ -1112,14 +1114,14 @@ namespace WindowComplexManager { NPhis = 1; // As insurance, define one phi for each theta NumElem = 1; for (I = 2; I <= NThetas; ++I) { - Thetas(I) = dataConstruction.Construct(IConst).BSDFInput.BasisMat(1, I) * DegToRadians; + Thetas(I) = state.dataConstruction->Construct(IConst).BSDFInput.BasisMat(1, I) * DegToRadians; ++NumElem; } Basis.Phis.allocate(1, NThetas); Basis.BasisIndex.allocate(1, NThetas); Basis.Phis = 0.0; // Initialize so undefined elements will contain zero Basis.BasisIndex = 0; // Initialize so undefined elements will contain zero - if (NumElem != dataConstruction.Construct(IConst).BSDFInput.NBasis) { // Constructed Basis must match property matrices + if (NumElem != state.dataConstruction->Construct(IConst).BSDFInput.NBasis) { // Constructed Basis must match property matrices ShowFatalError("WindowComplexManager: Constructed basis length does not match property matrices."); } Basis.Thetas = Thetas; @@ -1318,7 +1320,7 @@ namespace WindowComplexManager { // Note that on call the incoming and outgoing basis structure types have already been filled in // Define the central ray directions (in world coordinate system) - SurfaceWindow(ISurf).ComplexFen.State(IState).NLayers = dataConstruction.Construct(IConst).BSDFInput.NumLayers; + SurfaceWindow(ISurf).ComplexFen.State(IState).NLayers = state.dataConstruction->Construct(IConst).BSDFInput.NumLayers; Azimuth = DegToRadians * Surface(ISurf).Azimuth; Tilt = DegToRadians * Surface(ISurf).Tilt; @@ -1626,7 +1628,8 @@ namespace WindowComplexManager { TmpSjdotN.deallocate(); } - void CalcWindowStaticProperties(int const ISurf, // Surface number of the complex fenestration + void CalcWindowStaticProperties(EnergyPlusData &state, + int const ISurf, // Surface number of the complex fenestration int const IState, // State number of the complex fenestration state BSDFWindowGeomDescr &Window, // Window Geometry BSDFGeomDescr &Geom, // State Geometry @@ -1669,7 +1672,7 @@ namespace WindowComplexManager { for (J = 1; J <= Geom.Inc.NBasis; ++J) { // Incident ray loop Sum2 += Geom.Inc.Lamda(J); for (M = 1; M <= Geom.Trn.NBasis; ++M) { // Outgoing ray loop - Sum1 += Geom.Inc.Lamda(J) * Geom.Trn.Lamda(M) * dataConstruction.Construct(IConst).BSDFInput.SolFrtTrans(M, J); + Sum1 += Geom.Inc.Lamda(J) * Geom.Trn.Lamda(M) * state.dataConstruction->Construct(IConst).BSDFInput.SolFrtTrans(M, J); } // Outgoing ray loop } // Incident ray loop if (Sum2 > 0) { @@ -1686,7 +1689,7 @@ namespace WindowComplexManager { for (J = 1; J <= Geom.Inc.NBasis; ++J) { // Incident ray loop Sum2 += Geom.Inc.Lamda(J); for (M = 1; M <= Geom.Trn.NBasis; ++M) { // Outgoing ray loop - Sum1 += Geom.Inc.Lamda(J) * Geom.Trn.Lamda(M) * dataConstruction.Construct(IConst).BSDFInput.VisFrtTrans(M, J); + Sum1 += Geom.Inc.Lamda(J) * Geom.Trn.Lamda(M) * state.dataConstruction->Construct(IConst).BSDFInput.VisFrtTrans(M, J); } // Outgoing ray loop } // Incident ray loop if (Sum2 > 0.0) { @@ -1707,7 +1710,7 @@ namespace WindowComplexManager { for (JJ = 1; JJ <= Geom.NSky; ++JJ) { for (M = 1; M <= Geom.Trn.NBasis; ++M) { J = Geom.SkyIndex(JJ); - Sum1 += Geom.SolSkyWt(JJ) * dataConstruction.Construct(IConst).BSDFInput.SolFrtTrans(M, J) * Geom.Inc.Lamda(J) * Geom.Trn.Lamda(M); + Sum1 += Geom.SolSkyWt(JJ) * state.dataConstruction->Construct(IConst).BSDFInput.SolFrtTrans(M, J) * Geom.Inc.Lamda(J) * Geom.Trn.Lamda(M); } } for (JJ = 1; JJ <= Geom.NSky; ++JJ) { @@ -1727,7 +1730,7 @@ namespace WindowComplexManager { Sum3 = 0.0; for (JJ = 1; JJ <= Geom.NSky; ++JJ) { J = Geom.SkyIndex(JJ); - Sum3 += Geom.SolSkyWt(JJ) * Geom.Inc.Lamda(J) * dataConstruction.Construct(IConst).BSDFInput.Layer(L).FrtAbs(J, 1); + Sum3 += Geom.SolSkyWt(JJ) * Geom.Inc.Lamda(J) * state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).FrtAbs(J, 1); } if (Sum2 != 0.0) { @@ -1749,7 +1752,7 @@ namespace WindowComplexManager { for (JJ = 1; JJ <= Geom.NGnd; ++JJ) { for (M = 1; M <= Geom.Trn.NBasis; ++M) { J = Geom.GndIndex(JJ); - Sum1 += Geom.SolSkyGndWt(JJ) * dataConstruction.Construct(IConst).BSDFInput.SolFrtTrans(M, J) * Geom.Inc.Lamda(J) * Geom.Trn.Lamda(M); + Sum1 += Geom.SolSkyGndWt(JJ) * state.dataConstruction->Construct(IConst).BSDFInput.SolFrtTrans(M, J) * Geom.Inc.Lamda(J) * Geom.Trn.Lamda(M); } } @@ -1769,7 +1772,7 @@ namespace WindowComplexManager { Sum3 = 0.0; for (JJ = 1; JJ <= Geom.NGnd; ++JJ) { J = Geom.GndIndex(JJ); - Sum3 += Geom.SolSkyGndWt(JJ) * Geom.Inc.Lamda(J) * dataConstruction.Construct(IConst).BSDFInput.Layer(L).FrtAbs(J, 1); + Sum3 += Geom.SolSkyGndWt(JJ) * Geom.Inc.Lamda(J) * state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).FrtAbs(J, 1); } if (Sum2 != 0.0) { @@ -1787,7 +1790,7 @@ namespace WindowComplexManager { // Trn basis = incident basis for back incidence for (J = 1; J <= Geom.Trn.NBasis; ++J) { for (M = 1; M <= Geom.Inc.NBasis; ++M) { - Sum1 += dataConstruction.Construct(IConst).BSDFInput.SolBkRefl(M, J) * Geom.Trn.Lamda(J) * Geom.Inc.Lamda(M); + Sum1 += state.dataConstruction->Construct(IConst).BSDFInput.SolBkRefl(M, J) * Geom.Trn.Lamda(J) * Geom.Inc.Lamda(M); } } for (J = 1; J <= Geom.Trn.NBasis; ++J) { @@ -1800,12 +1803,12 @@ namespace WindowComplexManager { State.WinBkHemRefl = 0.0; } - dataConstruction.Construct(IConst).ReflectSolDiffBack = State.WinBkHemRefl; + state.dataConstruction->Construct(IConst).ReflectSolDiffBack = State.WinBkHemRefl; State.WinBkHemAbs.allocate(State.NLayers); for (L = 1; L <= State.NLayers; ++L) { for (J = 1; J <= Geom.Trn.NBasis; ++J) { - Sum3 += Geom.Trn.Lamda(J) * dataConstruction.Construct(IConst).BSDFInput.Layer(L).BkAbs(J, 1); + Sum3 += Geom.Trn.Lamda(J) * state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).BkAbs(J, 1); } if (Sum2 != 0.0) { @@ -1815,7 +1818,7 @@ namespace WindowComplexManager { } // Put this into the construction for use in non-detailed optical calculations - dataConstruction.Construct(IConst).AbsDiffBack(L) = State.WinBkHemAbs(L); + state.dataConstruction->Construct(IConst).AbsDiffBack(L) = State.WinBkHemAbs(L); } // Calculate Window Layer Front Hemispherical Absorptance @@ -1828,7 +1831,7 @@ namespace WindowComplexManager { for (L = 1; L <= State.NLayers; ++L) { Sum1 = 0.0; for (J = 1; J <= Geom.Inc.NBasis; ++J) { - Sum1 += Geom.Inc.Lamda(J) * dataConstruction.Construct(IConst).BSDFInput.Layer(L).FrtAbs(J, 1); + Sum1 += Geom.Inc.Lamda(J) * state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).FrtAbs(J, 1); } if (Sum2 != 0.0) { @@ -1838,7 +1841,7 @@ namespace WindowComplexManager { } // Put this into the construction for use in non-detailed optical calculations - dataConstruction.Construct(IConst).AbsDiff(L) = State.WinFtHemAbs(L); + state.dataConstruction->Construct(IConst).AbsDiff(L) = State.WinFtHemAbs(L); } // Calculate Window Back Hemispherical Visible Reflectance @@ -1848,7 +1851,7 @@ namespace WindowComplexManager { // Trn basis = incident basis for back incidence for (J = 1; J <= Geom.Trn.NBasis; ++J) { for (M = 1; M <= Geom.Inc.NBasis; ++M) { - Sum1 += dataConstruction.Construct(IConst).BSDFInput.VisBkRefl(M, J) * Geom.Trn.Lamda(J) * Geom.Inc.Lamda(M); + Sum1 += state.dataConstruction->Construct(IConst).BSDFInput.VisBkRefl(M, J) * Geom.Trn.Lamda(J) * Geom.Inc.Lamda(M); } } for (J = 1; J <= Geom.Trn.NBasis; ++J) { @@ -1861,7 +1864,7 @@ namespace WindowComplexManager { State.WinBkHemVisRefl = 0.0; } - dataConstruction.Construct(IConst).ReflectVisDiffBack = State.WinBkHemVisRefl; + state.dataConstruction->Construct(IConst).ReflectVisDiffBack = State.WinBkHemVisRefl; // * * * * // Note potential problem if one relaxes the assumption that Inc and Trn basis have same structure: @@ -1898,7 +1901,7 @@ namespace WindowComplexManager { Sum2 += Geom.Trn.Lamda(Geom.SurfInt(J, KBkSurf)); for (M = 1; M <= Geom.Inc.NBasis; ++M) { // Outgoing Ray loop Sum1 += Geom.Trn.Lamda(Geom.SurfInt(J, KBkSurf)) * Geom.Inc.Lamda(M) * - dataConstruction.Construct(IConst).BSDFInput.SolBkRefl(Geom.SurfInt(J, KBkSurf), M); + state.dataConstruction->Construct(IConst).BSDFInput.SolBkRefl(Geom.SurfInt(J, KBkSurf), M); } // Outgoing Ray loop } // Inc Ray loop if (Sum2 > 0.0) { @@ -1922,7 +1925,7 @@ namespace WindowComplexManager { Sum2 = 0.0; for (J = 1; J <= Geom.NSurfInt(KBkSurf); ++J) { // Inc Ray loop Sum2 += Geom.Trn.Lamda(Geom.SurfInt(J, KBkSurf)); - Sum1 += Geom.Trn.Lamda(Geom.SurfInt(J, KBkSurf)) * dataConstruction.Construct(IConst).BSDFInput.Layer(L).BkAbs(Geom.SurfInt(J, KBkSurf), 1); + Sum1 += Geom.Trn.Lamda(Geom.SurfInt(J, KBkSurf)) * state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).BkAbs(Geom.SurfInt(J, KBkSurf), 1); } // Inc Ray loop if (Sum2 > 0.0) { Hold = Sum1 / Sum2; @@ -1951,7 +1954,7 @@ namespace WindowComplexManager { for (J = 1; J <= Geom.Inc.NBasis; ++J) { Sum1 = 0.0; for (L = 1; L <= State.NLayers; ++L) { // layer loop - Sum1 += dataConstruction.Construct(IConst).BSDFInput.Layer(L).FrtAbs(J, 1); + Sum1 += state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).FrtAbs(J, 1); } State.IntegratedFtAbs(J) = Sum1; } @@ -1961,7 +1964,7 @@ namespace WindowComplexManager { for (J = 1; J <= Geom.Inc.NBasis; ++J) { // Incident ray loop Sum1 = 0.0; for (M = 1; M <= Geom.Trn.NBasis; ++M) { // Outgoing ray loop - Sum1 += Geom.Trn.Lamda(J) * dataConstruction.Construct(IConst).BSDFInput.SolFrtTrans(J, M); + Sum1 += Geom.Trn.Lamda(J) * state.dataConstruction->Construct(IConst).BSDFInput.SolFrtTrans(J, M); } // Outgoing ray loop State.IntegratedFtTrans(J) = Sum1; } // Incident ray loop @@ -1981,7 +1984,7 @@ namespace WindowComplexManager { for (J = 1; J <= Geom.Trn.NBasis; ++J) { Sum1 = 0.0; for (L = 1; L <= State.NLayers; ++L) { // layer loop - Sum1 += dataConstruction.Construct(IConst).BSDFInput.Layer(L).BkAbs(J, 1); + Sum1 += state.dataConstruction->Construct(IConst).BSDFInput.Layer(L).BkAbs(J, 1); } State.IntegratedBkAbs(J) = Sum1; } @@ -1991,7 +1994,7 @@ namespace WindowComplexManager { for (J = 1; J <= Geom.Trn.NBasis; ++J) { // Outgoing ray loop Sum1 = 0.0; for (M = 1; M <= Geom.Inc.NBasis; ++M) { // Incident ray loop - Sum1 += Geom.Inc.Lamda(J) * dataConstruction.Construct(IConst).BSDFInput.SolBkRefl(J, M); + Sum1 += Geom.Inc.Lamda(J) * state.dataConstruction->Construct(IConst).BSDFInput.SolBkRefl(J, M); } // Incident ray loop State.IntegratedBkRefl(J) = Sum1; } // Outgoing ray loop @@ -2774,8 +2777,8 @@ namespace WindowComplexManager { ShadeFlag = SurfWinShadingFlag(SurfNum); } - TotGlassLay = dataConstruction.Construct(ConstrNum).TotGlassLayers; - ngllayer = dataConstruction.Construct(ConstrNum).TotGlassLayers; + TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; + ngllayer = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; nglface = 2 * ngllayer; nglfacep = nglface; hrin = 0.0; @@ -2785,7 +2788,7 @@ namespace WindowComplexManager { Pa = OutBaroPress; - ThermalModelNum = dataConstruction.Construct(ConstrNum).BSDFInput.ThermalModel; + ThermalModelNum = state.dataConstruction->Construct(ConstrNum).BSDFInput.ThermalModel; standard = WindowThermalModel(ThermalModelNum).CalculationStandard; ThermalMod = WindowThermalModel(ThermalModelNum).ThermalModel; CalcDeflection = WindowThermalModel(ThermalModelNum).DeflectionModel; @@ -2794,7 +2797,7 @@ namespace WindowComplexManager { Tini = WindowThermalModel(ThermalModelNum).InitialTemperature - KelvinConv; Pini = WindowThermalModel(ThermalModelNum).InitialPressure; - nlayer = dataConstruction.Construct(ConstrNum).TotSolidLayers; + nlayer = state.dataConstruction->Construct(ConstrNum).TotSolidLayers; isky = 3; // IR radiation is provided from external source iwd = 0; // assume windward for now. TODO compare surface normal with wind direction @@ -2968,7 +2971,7 @@ namespace WindowComplexManager { fclr = 1.0 - CloudFraction; } - TotLay = dataConstruction.Construct(ConstrNum).TotLayers; + TotLay = state.dataConstruction->Construct(ConstrNum).TotLayers; IGap = 0; //**************************************************************************************************** @@ -2996,7 +2999,7 @@ namespace WindowComplexManager { IGlass = 0; IGap = 0; for (Lay = 1; Lay <= TotLay; ++Lay) { - LayPtr = dataConstruction.Construct(ConstrNum).LayerPoint(Lay); + LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); if ((dataMaterial.Material(LayPtr).Group == WindowGlass) || (dataMaterial.Material(LayPtr).Group == WindowSimpleGlazing)) { ++IGlass; @@ -3310,7 +3313,7 @@ namespace WindowComplexManager { if (CalcCondition == noCondition) { ShowContinueError("surface name = " + Surface(SurfNum).Name); } - ShowContinueError("construction name = " + dataConstruction.Construct(ConstrNum).Name); + ShowContinueError("construction name = " + state.dataConstruction->Construct(ConstrNum).Name); ShowFatalError("halting because of error in tarcog"); } else if (CalcCondition == winterCondition) { NominalU(ConstrNum) = ufactor; @@ -3334,7 +3337,7 @@ namespace WindowComplexManager { // CALL ShowWarningError('BSDF--Inc basis has zero projected solid angle') // endif - dataConstruction.Construct(ConstrNum).SummerSHGC = shgc; + state.dataConstruction->Construct(ConstrNum).SummerSHGC = shgc; // Construct(SurfNum)%VisTransNorm = SurfaceWindow(SurfNum)%ComplexFen%State(tempInt)%WinDiffVisTrans } else if (CalcCondition == noCondition) { // expect converged results... diff --git a/src/EnergyPlus/WindowComplexManager.hh b/src/EnergyPlus/WindowComplexManager.hh index df8ed68fa4c..d7d7ed98bf8 100644 --- a/src/EnergyPlus/WindowComplexManager.hh +++ b/src/EnergyPlus/WindowComplexManager.hh @@ -145,14 +145,16 @@ namespace WindowComplexManager { void CalcStaticProperties(EnergyPlusData &state); - void CalculateBasisLength(BSDFWindowInputStruct const &Input, // BSDF data input struct for this construction + void CalculateBasisLength(EnergyPlusData &state, + BSDFWindowInputStruct const &Input, // BSDF data input struct for this construction int const IConst, // Construction number of input int &NBasis // Calculated Basis length ); void DetermineMaxBackSurfaces(); - void ConstructBasis(int const IConst, // Index for accessing Construct array + void ConstructBasis(EnergyPlusData &state, + int const IConst, // Index for accessing Construct array BasisStruct &Basis); void FillBasisElement(Real64 const Theta, // Central polar angle of element @@ -174,7 +176,8 @@ namespace WindowComplexManager { BSDFStateDescr &State // State Description ); - void CalcWindowStaticProperties(int const ISurf, // Surface number of the complex fenestration + void CalcWindowStaticProperties(EnergyPlusData &state, + int const ISurf, // Surface number of the complex fenestration int const IState, // State number of the complex fenestration state BSDFWindowGeomDescr &Window, // Window Geometry BSDFGeomDescr &Geom, // State Geometry diff --git a/src/EnergyPlus/WindowEquivalentLayer.cc b/src/EnergyPlus/WindowEquivalentLayer.cc index 24c6303f14c..12fbeb7d690 100644 --- a/src/EnergyPlus/WindowEquivalentLayer.cc +++ b/src/EnergyPlus/WindowEquivalentLayer.cc @@ -164,16 +164,16 @@ namespace WindowEquivalentLayer { state.dataWindowEquivalentLayer->CFSDiffAbsTrans = 0.0; for (ConstrNum = 1; ConstrNum <= TotConstructs; ++ConstrNum) { - if (!dataConstruction.Construct(ConstrNum).TypeIsWindow) continue; - if (!dataConstruction.Construct(ConstrNum).WindowTypeEQL) continue; // skip if not equivalent layer window + if (!state.dataConstruction->Construct(ConstrNum).TypeIsWindow) continue; + if (!state.dataConstruction->Construct(ConstrNum).WindowTypeEQL) continue; // skip if not equivalent layer window SetEquivalentLayerWindowProperties(state, ConstrNum); } // end do for TotConstructs for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; - if (!dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) continue; + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) continue; SurfWinWindowModelType(SurfNum) = WindowEQLModel; @@ -206,24 +206,24 @@ namespace WindowEquivalentLayer { Array2D SysAbs1(2, CFSMAXNL + 1); // layers absorptance and system transmittance // Flow - if (!allocated(CFSLayers)) CFSLayers.allocate(dataConstruction.Construct(ConstrNum).TotLayers); + if (!allocated(CFSLayers)) CFSLayers.allocate(state.dataConstruction->Construct(ConstrNum).TotLayers); sLayer = 0; gLayer = 0; - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; - CFS(EQLNum).Name = dataConstruction.Construct(ConstrNum).Name; + CFS(EQLNum).Name = state.dataConstruction->Construct(ConstrNum).Name; - for (Layer = 1; Layer <= dataConstruction.Construct(ConstrNum).TotLayers; ++Layer) { + for (Layer = 1; Layer <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Layer) { - MaterNum = dataConstruction.Construct(ConstrNum).LayerPoint(Layer); + MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != GlassEquivalentLayer && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != ShadeEquivalentLayer && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != DrapeEquivalentLayer && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != ScreenEquivalentLayer && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != BlindEquivalentLayer && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != GapEquivalentLayer) + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != GlassEquivalentLayer && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != ShadeEquivalentLayer && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != DrapeEquivalentLayer && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != ScreenEquivalentLayer && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != BlindEquivalentLayer && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != GapEquivalentLayer) continue; if (dataMaterial.Material(MaterNum).Group == GapEquivalentLayer) { @@ -350,24 +350,24 @@ namespace WindowEquivalentLayer { FinalizeCFS(state, CFS(EQLNum)); // get total solid layers (glazing layers + shade layers) - dataConstruction.Construct(ConstrNum).TotSolidLayers = CFS(EQLNum).NL; + state.dataConstruction->Construct(ConstrNum).TotSolidLayers = CFS(EQLNum).NL; // Calculate layers diffuse absorptance and system diffuse transmittance CalcEQLWindowOpticalProperty(state, CFS(EQLNum), isDIFF, SysAbs1, 0.0, 0.0, 0.0); - dataConstruction.Construct(ConstrNum).TransDiffFrontEQL = SysAbs1(1, CFS(EQLNum).NL + 1); + state.dataConstruction->Construct(ConstrNum).TransDiffFrontEQL = SysAbs1(1, CFS(EQLNum).NL + 1); state.dataWindowEquivalentLayer->CFSDiffAbsTrans(_, _, EQLNum) = SysAbs1; - dataConstruction.Construct(ConstrNum).AbsDiffFrontEQL({1, CFSMAXNL}) = SysAbs1(1, {1, CFSMAXNL}); - dataConstruction.Construct(ConstrNum).AbsDiffBackEQL({1, CFSMAXNL}) = SysAbs1(2, {1, CFSMAXNL}); + state.dataConstruction->Construct(ConstrNum).AbsDiffFrontEQL({1, CFSMAXNL}) = SysAbs1(1, {1, CFSMAXNL}); + state.dataConstruction->Construct(ConstrNum).AbsDiffBackEQL({1, CFSMAXNL}) = SysAbs1(2, {1, CFSMAXNL}); // get construction front and back diffuse effective reflectance - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront = CFS(EQLNum).L(1).SWP_EL.RHOSFDD; - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack = CFS(EQLNum).L(CFS(EQLNum).NL).SWP_EL.RHOSBDD; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront = CFS(EQLNum).L(1).SWP_EL.RHOSFDD; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack = CFS(EQLNum).L(CFS(EQLNum).NL).SWP_EL.RHOSBDD; // calculate U-Value, SHGC and Normal Transmittance of EQL Window CalcEQLWindowStandardRatings(state, ConstrNum); if (CFSHasControlledShade(state, CFS(EQLNum)) > 0) CFS(EQLNum).ISControlled = true; // is controlled // set internal face emissivity - dataConstruction.Construct(ConstrNum).InsideAbsorpThermal = EffectiveEPSLB(CFS(EQLNum)); + state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal = EffectiveEPSLB(CFS(EQLNum)); } void CalcEQLWindowUvalue(EnergyPlusData &state, @@ -740,7 +740,7 @@ namespace WindowEquivalentLayer { QXConv = 0.0; ConvHeatFlowNatural = 0.0; - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; HcIn = HConvIn(SurfNum); // windows inside surface convective film conductance if (CalcCondition == noCondition) { @@ -8171,7 +8171,7 @@ namespace WindowEquivalentLayer { ProfAngHor = 0.0; ProfAngVer = 0.0; ConstrNum = Surface(SurfNum).Construction; - EQLNum = dataConstruction.Construct(Surface(SurfNum).Construction).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(Surface(SurfNum).Construction).EQLConsPtr; if (BeamDIffFlag != isDIFF) { if (CosIncAng(TimeStep, HourOfDay, SurfNum) <= 0.0) return; @@ -8204,17 +8204,17 @@ namespace WindowEquivalentLayer { CalcEQLWindowOpticalProperty(state, CFS(EQLNum), BeamDIffFlag, Abs1, IncAng, ProfAngVer, ProfAngHor); CFSAbs(_, {1, CFSMAXNL + 1}) = Abs1(_, {1, CFSMAXNL + 1}); state.dataWindowEquivalentLayer->CFSDiffAbsTrans(_, {1, CFSMAXNL + 1}, EQLNum) = Abs1(_, {1, CFSMAXNL + 1}); - dataConstruction.Construct(ConstrNum).TransDiff = Abs1(1, CFS(EQLNum).NL + 1); - dataConstruction.Construct(ConstrNum).AbsDiffFrontEQL({1, CFSMAXNL}) = Abs1(1, {1, CFSMAXNL}); - dataConstruction.Construct(ConstrNum).AbsDiffBackEQL({1, CFSMAXNL}) = Abs1(2, {1, CFSMAXNL}); - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront = CFS(EQLNum).L(1).SWP_EL.RHOSFDD; - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack = CFS(EQLNum).L(CFS(EQLNum).NL).SWP_EL.RHOSBDD; + state.dataConstruction->Construct(ConstrNum).TransDiff = Abs1(1, CFS(EQLNum).NL + 1); + state.dataConstruction->Construct(ConstrNum).AbsDiffFrontEQL({1, CFSMAXNL}) = Abs1(1, {1, CFSMAXNL}); + state.dataConstruction->Construct(ConstrNum).AbsDiffBackEQL({1, CFSMAXNL}) = Abs1(2, {1, CFSMAXNL}); + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront = CFS(EQLNum).L(1).SWP_EL.RHOSFDD; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack = CFS(EQLNum).L(CFS(EQLNum).NL).SWP_EL.RHOSBDD; if (!CFS(EQLNum).ISControlled) state.dataWindowEquivalentLayer->EQLDiffPropFlag(EQLNum) = false; } else { CFSAbs(_, {1, CFSMAXNL + 1}) = state.dataWindowEquivalentLayer->CFSDiffAbsTrans(_, {1, CFSMAXNL + 1}, EQLNum); - dataConstruction.Construct(ConstrNum).TransDiff = state.dataWindowEquivalentLayer->CFSDiffAbsTrans(1, CFS(EQLNum).NL + 1, EQLNum); - dataConstruction.Construct(ConstrNum).AbsDiffFrontEQL({1, CFSMAXNL}) = CFSAbs(1, {1, CFSMAXNL}); - dataConstruction.Construct(ConstrNum).AbsDiffBackEQL({1, CFSMAXNL}) = CFSAbs(2, {1, CFSMAXNL}); + state.dataConstruction->Construct(ConstrNum).TransDiff = state.dataWindowEquivalentLayer->CFSDiffAbsTrans(1, CFS(EQLNum).NL + 1, EQLNum); + state.dataConstruction->Construct(ConstrNum).AbsDiffFrontEQL({1, CFSMAXNL}) = CFSAbs(1, {1, CFSMAXNL}); + state.dataConstruction->Construct(ConstrNum).AbsDiffBackEQL({1, CFSMAXNL}) = CFSAbs(2, {1, CFSMAXNL}); } } if (CFS(EQLNum).VBLayerPtr > 0) { @@ -8247,7 +8247,7 @@ namespace WindowEquivalentLayer { SHGCSummer = 0.0; TransNormal = 0.0; - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; // calculate fenestration air-to-air U-value CalcEQLWindowUvalue(state, CFS(EQLNum), UValue); @@ -8255,11 +8255,11 @@ namespace WindowEquivalentLayer { // calculate the SHGC and Normal Transmittance CalcEQLWindowSHGCAndTransNormal(state, CFS(EQLNum), SHGCSummer, TransNormal); - dataConstruction.Construct(ConstrNum).SummerSHGC = SHGCSummer; - dataConstruction.Construct(ConstrNum).SolTransNorm = TransNormal; + state.dataConstruction->Construct(ConstrNum).SummerSHGC = SHGCSummer; + state.dataConstruction->Construct(ConstrNum).SolTransNorm = TransNormal; } - Real64 EQLWindowInsideEffectiveEmiss(int const ConstrNum) + Real64 EQLWindowInsideEffectiveEmiss(EnergyPlusData &state, int const ConstrNum) { // FUNCTION INFORMATION: // AUTHOR Bereket A Nigusse @@ -8271,10 +8271,10 @@ namespace WindowEquivalentLayer { // Given the consruction number, returns the equivalent layer inside // face effective longwave emmisivity. - return EffectiveEPSLB(CFS(dataConstruction.Construct(ConstrNum).EQLConsPtr)); + return EffectiveEPSLB(CFS(state.dataConstruction->Construct(ConstrNum).EQLConsPtr)); } - Real64 EQLWindowOutsideEffectiveEmiss(int const ConstrNum) + Real64 EQLWindowOutsideEffectiveEmiss(EnergyPlusData &state, int const ConstrNum) { // FUNCTION INFORMATION: // AUTHOR Bereket A Nigusse @@ -8291,7 +8291,7 @@ namespace WindowEquivalentLayer { int EQLNum; // EQL Window object number - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; OutSideLWEmiss = EffectiveEPSLF(CFS(EQLNum)); return OutSideLWEmiss; diff --git a/src/EnergyPlus/WindowEquivalentLayer.hh b/src/EnergyPlus/WindowEquivalentLayer.hh index b0e95d8f840..391ead6f063 100644 --- a/src/EnergyPlus/WindowEquivalentLayer.hh +++ b/src/EnergyPlus/WindowEquivalentLayer.hh @@ -749,9 +749,9 @@ namespace WindowEquivalentLayer { void CalcEQLWindowStandardRatings(EnergyPlusData &state, int const ConstrNum); // construction index - Real64 EQLWindowInsideEffectiveEmiss(int const ConstrNum); + Real64 EQLWindowInsideEffectiveEmiss(EnergyPlusData &state, int const ConstrNum); - Real64 EQLWindowOutsideEffectiveEmiss(int const ConstrNum); + Real64 EQLWindowOutsideEffectiveEmiss(EnergyPlusData &state, int const ConstrNum); Real64 HCInWindowStandardRatings(Real64 const Height, // Window height, 1.0 m Real64 const TSurfIn, // Inside surface temperature diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index e3dfe35f87f..4a235dc9730 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -337,21 +337,21 @@ namespace WindowManager { // shade, screen or blind // Loop over constructions and find those that are glazing constructions for (ConstrNum = 1; ConstrNum <= TotConstructs; ++ConstrNum) { - if (!dataConstruction.Construct(ConstrNum).TypeIsWindow) continue; - if (dataConstruction.Construct(ConstrNum).WindowTypeBSDF) continue; // Skip Complex Fenestrations, they have separate - if (dataConstruction.Construct(ConstrNum).WindowTypeEQL) continue; // skip Equivalent Layer Fenestration + if (!state.dataConstruction->Construct(ConstrNum).TypeIsWindow) continue; + if (state.dataConstruction->Construct(ConstrNum).WindowTypeBSDF) continue; // Skip Complex Fenestrations, they have separate + if (state.dataConstruction->Construct(ConstrNum).WindowTypeEQL) continue; // skip Equivalent Layer Fenestration // handling of optical properties for (IPhi = 1; IPhi <= 10; ++IPhi) { state.dataWindowManager->CosPhiIndepVar(IPhi) = std::cos((IPhi - 1) * 10.0 * DegToRadians); } - TotLay = dataConstruction.Construct(ConstrNum).TotLayers; + TotLay = state.dataConstruction->Construct(ConstrNum).TotLayers; // First layer must be glass, shade, screen or blind to be a glazing construction - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != WindowGlass && dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != Shade && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != Screen && dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != WindowBlind && - dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group != WindowSimpleGlazing) + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != WindowGlass && dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != Shade && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != Screen && dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != WindowBlind && + dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group != WindowSimpleGlazing) continue; ShadeLayNum = 0; @@ -365,61 +365,61 @@ namespace WindowManager { StormWinConst = false; state.dataWindowManager->lSimpleGlazingSystem = false; - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowSimpleGlazing) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowSimpleGlazing) { // what if outside layer is shade, blind, or screen? state.dataWindowManager->lSimpleGlazingSystem = true; - SimpleGlazingSHGC = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).SimpleWindowSHGC; - SimpleGlazingU = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).SimpleWindowUfactor; + SimpleGlazingSHGC = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).SimpleWindowSHGC; + SimpleGlazingU = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).SimpleWindowUfactor; } - if (has_prefix(dataConstruction.Construct(ConstrNum).Name, "BARECONSTRUCTIONWITHSTORMWIN") || - has_prefix(dataConstruction.Construct(ConstrNum).Name, "SHADEDCONSTRUCTIONWITHSTORMWIN")) + if (has_prefix(state.dataConstruction->Construct(ConstrNum).Name, "BARECONSTRUCTIONWITHSTORMWIN") || + has_prefix(state.dataConstruction->Construct(ConstrNum).Name, "SHADEDCONSTRUCTIONWITHSTORMWIN")) StormWinConst = true; // Get layer number of shade/blind - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == Shade) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == Shade) { ExtShade = true; ShadeLayNum = 1; - } else if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLay)).Group == Shade) { + } else if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLay)).Group == Shade) { IntShade = true; ShadeLayNum = TotLay; - } else if (dataConstruction.Construct(ConstrNum).TotLayers == 5) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(3)).Group == Shade) { + } else if (state.dataConstruction->Construct(ConstrNum).TotLayers == 5) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3)).Group == Shade) { BGShade = true; ShadeLayNum = 3; } - } else if (dataConstruction.Construct(ConstrNum).TotLayers == 7) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(5)).Group == Shade) { + } else if (state.dataConstruction->Construct(ConstrNum).TotLayers == 7) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5)).Group == Shade) { BGShade = true; ShadeLayNum = 5; } } - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == WindowBlind) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == WindowBlind) { ExtBlind = true; ShadeLayNum = 1; - BlNum = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).BlindDataPtr; - } else if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLay)).Group == WindowBlind) { + BlNum = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).BlindDataPtr; + } else if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLay)).Group == WindowBlind) { IntBlind = true; ShadeLayNum = TotLay; - BlNum = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).BlindDataPtr; - } else if (dataConstruction.Construct(ConstrNum).TotLayers == 5) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(3)).Group == WindowBlind) { + BlNum = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).BlindDataPtr; + } else if (state.dataConstruction->Construct(ConstrNum).TotLayers == 5) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3)).Group == WindowBlind) { BGBlind = true; ShadeLayNum = 3; - BlNum = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).BlindDataPtr; + BlNum = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).BlindDataPtr; } - } else if (dataConstruction.Construct(ConstrNum).TotLayers == 7) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(5)).Group == WindowBlind) { + } else if (state.dataConstruction->Construct(ConstrNum).TotLayers == 7) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5)).Group == WindowBlind) { BGBlind = true; ShadeLayNum = 5; - BlNum = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).BlindDataPtr; + BlNum = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).BlindDataPtr; } } - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).Group == Screen) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).Group == Screen) { ShadeLayNum = 1; - ScNum = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).ScreenDataPtr; + ScNum = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).ScreenDataPtr; // Disregard orphaned constructs with exterior screen if (ScNum == 0) continue; ExtScreen = true; @@ -435,7 +435,7 @@ namespace WindowManager { // for presence of interior shade. Assumes inner and outer glass layers have zero thermal transmittance. if (IntShade || ExtShade || ExtScreen) { - ShadeLayPtr = dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum); + ShadeLayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum); if (ExtScreen) { TauShIR = SurfaceScreens(ScNum).DifDifTrans; } else { @@ -444,13 +444,13 @@ namespace WindowManager { EpsShIR = dataMaterial.Material(ShadeLayPtr).AbsorpThermal; RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); if (ExtShade || ExtScreen) { // Exterior shade or screen - EpsGlIR = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(2)).AbsorpThermalFront; + EpsGlIR = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(2)).AbsorpThermalFront; } else { // Interior shade - EpsGlIR = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLay - 1)).AbsorpThermalBack; + EpsGlIR = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLay - 1)).AbsorpThermalBack; } RhoGlIR = max(0.0, 1.0 - EpsGlIR); - dataConstruction.Construct(ConstrNum).ShadeAbsorpThermal = EpsShIR * (1.0 + TauShIR * RhoGlIR / (1.0 - RhoShIR * RhoGlIR)); - if (IntShade) dataConstruction.Construct(ConstrNum).InsideAbsorpThermal *= TauShIR / (1.0 - RhoShIR * RhoGlIR); + state.dataConstruction->Construct(ConstrNum).ShadeAbsorpThermal = EpsShIR * (1.0 + TauShIR * RhoGlIR / (1.0 - RhoShIR * RhoGlIR)); + if (IntShade) state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal *= TauShIR / (1.0 - RhoShIR * RhoGlIR); } // From the individual glass layer properties, get the glazing system optical properties @@ -463,7 +463,7 @@ namespace WindowManager { // a correction is made for the effect of a shade, screen or blind if one of these // is present in the construction. - NGlass = dataConstruction.Construct(ConstrNum).TotGlassLayers; + NGlass = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; //-------------------------------------------------------------------------------------------- // Front calculation (solar incident from outside of room); bare glass portion of construction @@ -489,7 +489,7 @@ namespace WindowManager { } state.dataWindowManager->LayerNum(IGlass) = LayNum; - LayPtr = dataConstruction.Construct(ConstrNum).LayerPoint(LayNum); + LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(LayNum); SpecDataNum = dataMaterial.Material(LayPtr).GlassSpectralDataPtr; if (SpecDataNum != 0) { if (!state.dataWindowManager->BGFlag) AllGlassIsSpectralAverage = false; @@ -516,7 +516,7 @@ namespace WindowManager { ShowWarningError("Window glazing material \"" + dataMaterial.Material(LayPtr).Name + "\" was defined with full spectral data and has been converted to average spectral data"); ShowContinueError("due to its use with between-glass shades or blinds of the window construction \"" + - dataConstruction.Construct(ConstrNum).Name + "\"."); + state.dataConstruction->Construct(ConstrNum).Name + "\"."); ShowContinueError("All occurrences of this glazing material will be modeled as SpectralAverage."); ShowContinueError("If this material is also used in other window constructions without between-glass shades or blinds,"); ShowContinueError("then make a duplicate material (with new name) if you want to model those windows (and reference the new " @@ -565,7 +565,7 @@ namespace WindowManager { ShowWarningError("Window glazing material \"" + dataMaterial.Material(LayPtr).Name + "\" was defined with full spectral and angular data and has been converted to average spectral data"); ShowContinueError("due to its use with between-glass shades or blinds of the window construction \"" + - dataConstruction.Construct(ConstrNum).Name + "\"."); + state.dataConstruction->Construct(ConstrNum).Name + "\"."); ShowContinueError("All occurrences of this glazing material will be modeled as SpectralAverage."); ShowContinueError("If this material is also used in other window constructions without between-glass shades or blinds,"); ShowContinueError("then make a duplicate material (with new name) if you want to model those windows (and reference the new " @@ -602,7 +602,7 @@ namespace WindowManager { } // End of loop over glass layers in the construction for front calculation if (TotalIPhi > state.dataWindowManager->MaxNumOfIncidentAngles) { - ShowSevereError("WindowManage::InitGlassOpticalCalculations = " + dataConstruction.Construct(ConstrNum).Name + + ShowSevereError("WindowManage::InitGlassOpticalCalculations = " + state.dataConstruction->Construct(ConstrNum).Name + ", Invalid maximum value of common incidet angles = " + TrimSigDigits(TotalIPhi) + "."); ShowContinueError("The maximum number of incident angles for each construct is " + TrimSigDigits(state.dataWindowManager->MaxNumOfIncidentAngles) + ". Please rearrange the dataset."); @@ -622,7 +622,7 @@ namespace WindowManager { // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - LayPtr = dataConstruction.Construct(ConstrNum).LayerPoint(state.dataWindowManager->LayerNum(IGlass)); + LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataWindowManager->LayerNum(IGlass)); if (!dataMaterial.Material(LayPtr).GlassSpectralAndAngle) { for (ILam = 1; ILam <= state.dataWindowManager->numpt(IGlass); ++ILam) { TransAndReflAtPhi(CosPhi, @@ -696,45 +696,45 @@ namespace WindowManager { // only used by between-glass shades or blinds if (AllGlassIsSpectralAverage) { for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, tBareSolPhi(IGlass, _), 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).tBareSolCoef(_, IGlass)); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, tBareVisPhi(IGlass, _), 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).tBareVisCoef(_, IGlass)); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, rfBareSolPhi(IGlass, _), 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).rfBareSolCoef(_, IGlass)); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, rfBareVisPhi(IGlass, _), 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).rfBareVisCoef(_, IGlass)); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, rbBareSolPhi(IGlass, _), 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).rbBareSolCoef(_, IGlass)); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, rbBareVisPhi(IGlass, _), 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).rbBareVisCoef(_, IGlass)); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, afBareSolPhi(IGlass, _), 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).afBareSolCoef(_, IGlass)); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, abBareSolPhi(IGlass, _), 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).abBareSolCoef(_, IGlass)); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, tBareSolPhi(IGlass, _), 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).tBareSolCoef(_, IGlass)); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, tBareVisPhi(IGlass, _), 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).tBareVisCoef(_, IGlass)); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, rfBareSolPhi(IGlass, _), 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).rfBareSolCoef(_, IGlass)); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, rfBareVisPhi(IGlass, _), 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).rfBareVisCoef(_, IGlass)); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, rbBareSolPhi(IGlass, _), 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).rbBareSolCoef(_, IGlass)); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, rbBareVisPhi(IGlass, _), 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).rbBareVisCoef(_, IGlass)); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, afBareSolPhi(IGlass, _), 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).afBareSolCoef(_, IGlass)); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, abBareSolPhi(IGlass, _), 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).abBareSolCoef(_, IGlass)); } } - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront = DiffuseAverage(state.dataWindowManager->rfsolPhi); - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack = DiffuseAverage(state.dataWindowManager->rbsolPhi); - dataConstruction.Construct(ConstrNum).ReflectVisDiffFront = DiffuseAverage(state.dataWindowManager->rfvisPhi); - dataConstruction.Construct(ConstrNum).ReflectVisDiffBack = DiffuseAverage(state.dataWindowManager->rbvisPhi); + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront = DiffuseAverage(state.dataWindowManager->rfsolPhi); + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack = DiffuseAverage(state.dataWindowManager->rbsolPhi); + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront = DiffuseAverage(state.dataWindowManager->rfvisPhi); + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack = DiffuseAverage(state.dataWindowManager->rbvisPhi); tsolDiff = DiffuseAverage(state.dataWindowManager->tsolPhi); tvisDiff = DiffuseAverage(state.dataWindowManager->tvisPhi); - dataConstruction.Construct(ConstrNum).TransDiff = tsolDiff; - dataConstruction.Construct(ConstrNum).TransDiffVis = tvisDiff; + state.dataConstruction->Construct(ConstrNum).TransDiff = tsolDiff; + state.dataConstruction->Construct(ConstrNum).TransDiffVis = tvisDiff; for (IGlass = 1; IGlass <= NGlass; ++IGlass) { solabsPhiLay({1, TotalIPhi}) = state.dataWindowManager->solabsPhi(IGlass, {1, TotalIPhi}); solabsDiff(IGlass) = DiffuseAverage(solabsPhiLay); - dataConstruction.Construct(ConstrNum).AbsDiff(IGlass) = solabsDiff(IGlass); + state.dataConstruction->Construct(ConstrNum).AbsDiff(IGlass) = solabsDiff(IGlass); // For use with between-glass shade/blind, get diffuse properties of isolated glass for case when // all glass layers were input with spectral-average properties // only used by between-glass shades or blinds if (AllGlassIsSpectralAverage) { - dataConstruction.Construct(ConstrNum).tBareSolDiff(IGlass) = DiffuseAverage(tBareSolPhi(IGlass, {1, TotalIPhi})); - dataConstruction.Construct(ConstrNum).tBareVisDiff(IGlass) = DiffuseAverage(tBareVisPhi(IGlass, {1, TotalIPhi})); - dataConstruction.Construct(ConstrNum).rfBareSolDiff(IGlass) = DiffuseAverage(rfBareSolPhi(IGlass, {1, TotalIPhi})); - dataConstruction.Construct(ConstrNum).rfBareVisDiff(IGlass) = DiffuseAverage(rfBareVisPhi(IGlass, {1, TotalIPhi})); - dataConstruction.Construct(ConstrNum).rbBareSolDiff(IGlass) = DiffuseAverage(rbBareSolPhi(IGlass, {1, TotalIPhi})); - dataConstruction.Construct(ConstrNum).rbBareVisDiff(IGlass) = DiffuseAverage(rbBareVisPhi(IGlass, {1, TotalIPhi})); - dataConstruction.Construct(ConstrNum).afBareSolDiff(IGlass) = - max(0.0, 1.0 - (dataConstruction.Construct(ConstrNum).tBareSolDiff(IGlass) + dataConstruction.Construct(ConstrNum).rfBareSolDiff(IGlass))); - dataConstruction.Construct(ConstrNum).abBareSolDiff(IGlass) = - max(0.0, 1.0 - (dataConstruction.Construct(ConstrNum).tBareSolDiff(IGlass) + dataConstruction.Construct(ConstrNum).rbBareSolDiff(IGlass))); + state.dataConstruction->Construct(ConstrNum).tBareSolDiff(IGlass) = DiffuseAverage(tBareSolPhi(IGlass, {1, TotalIPhi})); + state.dataConstruction->Construct(ConstrNum).tBareVisDiff(IGlass) = DiffuseAverage(tBareVisPhi(IGlass, {1, TotalIPhi})); + state.dataConstruction->Construct(ConstrNum).rfBareSolDiff(IGlass) = DiffuseAverage(rfBareSolPhi(IGlass, {1, TotalIPhi})); + state.dataConstruction->Construct(ConstrNum).rfBareVisDiff(IGlass) = DiffuseAverage(rfBareVisPhi(IGlass, {1, TotalIPhi})); + state.dataConstruction->Construct(ConstrNum).rbBareSolDiff(IGlass) = DiffuseAverage(rbBareSolPhi(IGlass, {1, TotalIPhi})); + state.dataConstruction->Construct(ConstrNum).rbBareVisDiff(IGlass) = DiffuseAverage(rbBareVisPhi(IGlass, {1, TotalIPhi})); + state.dataConstruction->Construct(ConstrNum).afBareSolDiff(IGlass) = + max(0.0, 1.0 - (state.dataConstruction->Construct(ConstrNum).tBareSolDiff(IGlass) + state.dataConstruction->Construct(ConstrNum).rfBareSolDiff(IGlass))); + state.dataConstruction->Construct(ConstrNum).abBareSolDiff(IGlass) = + max(0.0, 1.0 - (state.dataConstruction->Construct(ConstrNum).tBareSolDiff(IGlass) + state.dataConstruction->Construct(ConstrNum).rbBareSolDiff(IGlass))); } } @@ -760,7 +760,7 @@ namespace WindowManager { } } state.dataWindowManager->LayerNum(IGlass) = LayNum; - LayPtr = dataConstruction.Construct(ConstrNum).LayerPoint(LayNum); + LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(LayNum); SpecDataNum = dataMaterial.Material(LayPtr).GlassSpectralDataPtr; if (SpecDataNum != 0) { @@ -814,7 +814,7 @@ namespace WindowManager { // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - LayPtr = dataConstruction.Construct(ConstrNum).LayerPoint(state.dataWindowManager->LayerNum(IGlass)); + LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataWindowManager->LayerNum(IGlass)); if (!dataMaterial.Material(LayPtr).GlassSpectralAndAngle) { for (ILam = 1; ILam <= state.dataWindowManager->numpt(IGlass); ++ILam) { @@ -858,7 +858,7 @@ namespace WindowManager { for (IGlass = 1; IGlass <= NGlass; ++IGlass) { IGlassBack = NGlass - IGlass + 1; - dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass) = DiffuseAverage(state.dataWindowManager->solabsBackPhi(IGlassBack, {1, 10})); + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass) = DiffuseAverage(state.dataWindowManager->solabsBackPhi(IGlassBack, {1, 10})); } //----------------------------------------------------------------------- @@ -880,11 +880,11 @@ namespace WindowManager { for (ISlatAng = 1; ISlatAng <= MaxSlatAngs; ++ISlatAng) { if (ShadeOn) { - ShadeAbs = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).AbsorpSolar; - ShadeTrans = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).Trans; - ShadeTransVis = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).TransVis; - ShadeRefl = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).ReflectShade; - ShadeReflVis = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(ShadeLayNum)).ReflectShadeVis; + ShadeAbs = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).AbsorpSolar; + ShadeTrans = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).Trans; + ShadeTransVis = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).TransVis; + ShadeRefl = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).ReflectShade; + ShadeReflVis = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(ShadeLayNum)).ReflectShadeVis; rsh = ShadeRefl; rshv = ShadeReflVis; tsh = ShadeTrans; @@ -938,11 +938,11 @@ namespace WindowManager { // Correction factors for inter-reflections between glass and shading device if (ExtShade || ExtBlind || ExtScreen) { - ShadeReflFac = 1.0 / (1.0 - ShadeRefl * dataConstruction.Construct(ConstrNum).ReflectSolDiffFront); - ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * dataConstruction.Construct(ConstrNum).ReflectVisDiffFront); + ShadeReflFac = 1.0 / (1.0 - ShadeRefl * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront); + ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront); } else if (IntShade || IntBlind) { - ShadeReflFac = 1.0 / (1.0 - ShadeRefl * dataConstruction.Construct(ConstrNum).ReflectSolDiffBack); - ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * dataConstruction.Construct(ConstrNum).ReflectVisDiffBack); + ShadeReflFac = 1.0 / (1.0 - ShadeRefl * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack); + ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack); } if (ExtShade || ExtBlind || ExtScreen) { // Exterior shade or blind @@ -956,7 +956,7 @@ namespace WindowManager { } state.dataWindowManager->tsolPhi(IPhi) = ShadeTrans * ShadeReflFac * tsolDiff; state.dataWindowManager->tvisPhi(IPhi) = ShadeTransVis * ShadeReflFacVis * tvisDiff; - state.dataWindowManager->solabsShadePhi(IPhi) = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * dataConstruction.Construct(ConstrNum).ReflectSolDiffFront); + state.dataWindowManager->solabsShadePhi(IPhi) = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront); } } @@ -964,62 +964,62 @@ namespace WindowManager { for (IGlass = 1; IGlass <= NGlass; ++IGlass) { if (ExtBlind) { - dataConstruction.Construct(ConstrNum).BlAbsDiff(ISlatAng, IGlass) = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); - dataConstruction.Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, IGlass) = ShadeTransGnd * ShadeReflFac * solabsDiff(IGlass); - dataConstruction.Construct(ConstrNum).BlAbsDiffSky(ISlatAng, IGlass) = ShadeTransSky * ShadeReflFac * solabsDiff(IGlass); + state.dataConstruction->Construct(ConstrNum).BlAbsDiff(ISlatAng, IGlass) = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); + state.dataConstruction->Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, IGlass) = ShadeTransGnd * ShadeReflFac * solabsDiff(IGlass); + state.dataConstruction->Construct(ConstrNum).BlAbsDiffSky(ISlatAng, IGlass) = ShadeTransSky * ShadeReflFac * solabsDiff(IGlass); } - if (ExtShade || ExtScreen) dataConstruction.Construct(ConstrNum).AbsDiff(IGlass) = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); + if (ExtShade || ExtScreen) state.dataConstruction->Construct(ConstrNum).AbsDiff(IGlass) = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); } if (ExtBlind) { - dataConstruction.Construct(ConstrNum).AbsDiffBlind(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBlind(ISlatAng) = Blind(BlNum).SolFrontDiffAbs(ISlatAng) + - ShadeTrans * ShadeReflFac * dataConstruction.Construct(ConstrNum).ReflectSolDiffFront * ShadeAbs; - dataConstruction.Construct(ConstrNum).AbsDiffBlindGnd(ISlatAng) = + ShadeTrans * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront * ShadeAbs; + state.dataConstruction->Construct(ConstrNum).AbsDiffBlindGnd(ISlatAng) = Blind(BlNum).SolFrontDiffAbsGnd(ISlatAng) + - ShadeTransGnd * ShadeReflFac * dataConstruction.Construct(ConstrNum).ReflectSolDiffFront * ShadeAbs; - dataConstruction.Construct(ConstrNum).AbsDiffBlindSky(ISlatAng) = + ShadeTransGnd * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront * ShadeAbs; + state.dataConstruction->Construct(ConstrNum).AbsDiffBlindSky(ISlatAng) = Blind(BlNum).SolFrontDiffAbsSky(ISlatAng) + - ShadeTransSky * ShadeReflFac * dataConstruction.Construct(ConstrNum).ReflectSolDiffFront * ShadeAbs; - dataConstruction.Construct(ConstrNum).BlTransDiff(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTrans; - dataConstruction.Construct(ConstrNum).BlTransDiffGnd(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransGnd; - dataConstruction.Construct(ConstrNum).BlTransDiffSky(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransSky; - dataConstruction.Construct(ConstrNum).BlTransDiffVis(ISlatAng) = tvisDiff * ShadeReflFacVis * ShadeTransVis; - dataConstruction.Construct(ConstrNum).BlReflectSolDiffFront(ISlatAng) = - ShadeRefl + pow_2(ShadeTrans) * dataConstruction.Construct(ConstrNum).ReflectSolDiffFront * ShadeReflFac; - dataConstruction.Construct(ConstrNum).BlReflectVisDiffFront(ISlatAng) = - ShadeReflVis + pow_2(ShadeTransVis) * dataConstruction.Construct(ConstrNum).ReflectVisDiffFront * ShadeReflFacVis; + ShadeTransSky * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront * ShadeAbs; + state.dataConstruction->Construct(ConstrNum).BlTransDiff(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTrans; + state.dataConstruction->Construct(ConstrNum).BlTransDiffGnd(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransGnd; + state.dataConstruction->Construct(ConstrNum).BlTransDiffSky(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransSky; + state.dataConstruction->Construct(ConstrNum).BlTransDiffVis(ISlatAng) = tvisDiff * ShadeReflFacVis * ShadeTransVis; + state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffFront(ISlatAng) = + ShadeRefl + pow_2(ShadeTrans) * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).BlReflectVisDiffFront(ISlatAng) = + ShadeReflVis + pow_2(ShadeTransVis) * state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront * ShadeReflFacVis; } if (ExtShade || ExtScreen) { - dataConstruction.Construct(ConstrNum).AbsDiffShade = - ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * dataConstruction.Construct(ConstrNum).ReflectSolDiffFront); - dataConstruction.Construct(ConstrNum).TransDiff = tsolDiff * ShadeReflFac * ShadeTrans; - dataConstruction.Construct(ConstrNum).TransDiffVis = tvisDiff * ShadeReflFacVis * ShadeTransVis; - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront = - ShadeRefl + pow_2(ShadeTrans) * dataConstruction.Construct(ConstrNum).ReflectSolDiffFront * ShadeReflFac; - dataConstruction.Construct(ConstrNum).ReflectVisDiffFront = - ShadeReflVis + pow_2(ShadeTransVis) * dataConstruction.Construct(ConstrNum).ReflectVisDiffFront * ShadeReflFacVis; + state.dataConstruction->Construct(ConstrNum).AbsDiffShade = + ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront); + state.dataConstruction->Construct(ConstrNum).TransDiff = tsolDiff * ShadeReflFac * ShadeTrans; + state.dataConstruction->Construct(ConstrNum).TransDiffVis = tvisDiff * ShadeReflFacVis * ShadeTransVis; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront = + ShadeRefl + pow_2(ShadeTrans) * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront = + ShadeReflVis + pow_2(ShadeTransVis) * state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront * ShadeReflFacVis; } // Back incident solar, diffuse, exterior shade/blind if (ExtBlind) { for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - dataConstruction.Construct(ConstrNum).BlAbsDiffBack(ISlatAng, IGlass) = - dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass) + tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); + state.dataConstruction->Construct(ConstrNum).BlAbsDiffBack(ISlatAng, IGlass) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass) + tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); } - dataConstruction.Construct(ConstrNum).AbsDiffBackBlind(ISlatAng) = tsolDiff * ShadeReflFac * ShadeAbs; - dataConstruction.Construct(ConstrNum).BlReflectSolDiffBack(ISlatAng) = - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack + tsolDiff_2 * ShadeRefl * ShadeReflFac; - dataConstruction.Construct(ConstrNum).BlReflectVisDiffBack(ISlatAng) = - dataConstruction.Construct(ConstrNum).ReflectVisDiffBack + tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; + state.dataConstruction->Construct(ConstrNum).AbsDiffBackBlind(ISlatAng) = tsolDiff * ShadeReflFac * ShadeAbs; + state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffBack(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack + tsolDiff_2 * ShadeRefl * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).BlReflectVisDiffBack(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack + tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; } if (ExtShade || ExtScreen) { for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass) += tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass) += tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); } - dataConstruction.Construct(ConstrNum).AbsDiffBackShade = tsolDiff * ShadeReflFac * ShadeAbs; - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack += tsolDiff_2 * ShadeRefl * ShadeReflFac; - dataConstruction.Construct(ConstrNum).ReflectVisDiffBack += tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; + state.dataConstruction->Construct(ConstrNum).AbsDiffBackShade = tsolDiff * ShadeReflFac * ShadeAbs; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack += tsolDiff_2 * ShadeRefl * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack += tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; } } // End check if exterior shade, screen or blind @@ -1031,7 +1031,7 @@ namespace WindowManager { if (IntShade) { for (IPhi = 1; IPhi <= 10; ++IPhi) { for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - state.dataWindowManager->solabsPhi(IGlass, IPhi) += state.dataWindowManager->tsolPhi(IPhi) * ShadeRefl * ShadeReflFac * dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass); + state.dataWindowManager->solabsPhi(IGlass, IPhi) += state.dataWindowManager->tsolPhi(IPhi) * ShadeRefl * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass); } state.dataWindowManager->solabsShadePhi(IPhi) = state.dataWindowManager->tsolPhi(IPhi) * ShadeReflFac * ShadeAbs; state.dataWindowManager->tsolPhi(IPhi) *= ShadeReflFac * ShadeTrans; @@ -1043,72 +1043,72 @@ namespace WindowManager { if (IntBlind) { for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - dataConstruction.Construct(ConstrNum).BlAbsDiff(ISlatAng, IGlass) = - dataConstruction.Construct(ConstrNum).AbsDiff(IGlass) + - tsolDiff * ShadeRefl * ShadeReflFac * dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass); - dataConstruction.Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, IGlass) = - dataConstruction.Construct(ConstrNum).AbsDiff(IGlass) + - tsolDiff * ShadeReflGnd * ShadeReflFac * dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass); - dataConstruction.Construct(ConstrNum).BlAbsDiffSky(ISlatAng, IGlass) = - dataConstruction.Construct(ConstrNum).AbsDiff(IGlass) + - tsolDiff * ShadeReflSky * ShadeReflFac * dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass); + state.dataConstruction->Construct(ConstrNum).BlAbsDiff(ISlatAng, IGlass) = + state.dataConstruction->Construct(ConstrNum).AbsDiff(IGlass) + + tsolDiff * ShadeRefl * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass); + state.dataConstruction->Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, IGlass) = + state.dataConstruction->Construct(ConstrNum).AbsDiff(IGlass) + + tsolDiff * ShadeReflGnd * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass); + state.dataConstruction->Construct(ConstrNum).BlAbsDiffSky(ISlatAng, IGlass) = + state.dataConstruction->Construct(ConstrNum).AbsDiff(IGlass) + + tsolDiff * ShadeReflSky * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass); } - dataConstruction.Construct(ConstrNum).AbsDiffBlind(ISlatAng) = tsolDiff * ShadeReflFac * ShadeAbs; - dataConstruction.Construct(ConstrNum).AbsDiffBlindGnd(ISlatAng) = tsolDiff * ShadeReflFac * Blind(BlNum).SolFrontDiffAbsGnd(ISlatAng); - dataConstruction.Construct(ConstrNum).AbsDiffBlindSky(ISlatAng) = tsolDiff * ShadeReflFac * Blind(BlNum).SolFrontDiffAbsSky(ISlatAng); - dataConstruction.Construct(ConstrNum).BlTransDiff(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTrans; - dataConstruction.Construct(ConstrNum).BlTransDiffGnd(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransGnd; - dataConstruction.Construct(ConstrNum).BlTransDiffSky(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransSky; - dataConstruction.Construct(ConstrNum).BlTransDiffVis(ISlatAng) = tvisDiff * ShadeReflFacVis * ShadeTransVis; - dataConstruction.Construct(ConstrNum).BlReflectSolDiffFront(ISlatAng) = - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront + tsolDiff_2 * ShadeRefl * ShadeReflFac; - dataConstruction.Construct(ConstrNum).BlReflectVisDiffFront(ISlatAng) = - dataConstruction.Construct(ConstrNum).ReflectVisDiffFront + tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; + state.dataConstruction->Construct(ConstrNum).AbsDiffBlind(ISlatAng) = tsolDiff * ShadeReflFac * ShadeAbs; + state.dataConstruction->Construct(ConstrNum).AbsDiffBlindGnd(ISlatAng) = tsolDiff * ShadeReflFac * Blind(BlNum).SolFrontDiffAbsGnd(ISlatAng); + state.dataConstruction->Construct(ConstrNum).AbsDiffBlindSky(ISlatAng) = tsolDiff * ShadeReflFac * Blind(BlNum).SolFrontDiffAbsSky(ISlatAng); + state.dataConstruction->Construct(ConstrNum).BlTransDiff(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTrans; + state.dataConstruction->Construct(ConstrNum).BlTransDiffGnd(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransGnd; + state.dataConstruction->Construct(ConstrNum).BlTransDiffSky(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransSky; + state.dataConstruction->Construct(ConstrNum).BlTransDiffVis(ISlatAng) = tvisDiff * ShadeReflFacVis * ShadeTransVis; + state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffFront(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront + tsolDiff_2 * ShadeRefl * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).BlReflectVisDiffFront(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront + tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; // Back incident solar, diffuse, interior blind for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - dataConstruction.Construct(ConstrNum).BlAbsDiffBack(ISlatAng, IGlass) = - dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass) * ShadeTrans * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).BlAbsDiffBack(ISlatAng, IGlass) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass) * ShadeTrans * ShadeReflFac; } - dataConstruction.Construct(ConstrNum).AbsDiffBackBlind(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBackBlind(ISlatAng) = Blind(BlNum).SolBackDiffAbs(ISlatAng) + - ShadeTrans * ShadeReflFac * dataConstruction.Construct(ConstrNum).ReflectSolDiffBack * ShadeAbs; - dataConstruction.Construct(ConstrNum).BlReflectSolDiffBack(ISlatAng) = + ShadeTrans * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack * ShadeAbs; + state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffBack(ISlatAng) = Blind(BlNum).SolBackDiffDiffRefl(ISlatAng) + - pow_2(ShadeTrans) * dataConstruction.Construct(ConstrNum).ReflectSolDiffBack * ShadeReflFac; - dataConstruction.Construct(ConstrNum).BlReflectVisDiffBack(ISlatAng) = + pow_2(ShadeTrans) * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).BlReflectVisDiffBack(ISlatAng) = Blind(BlNum).VisBackDiffDiffRefl(ISlatAng) + - pow_2(ShadeTransVis) * dataConstruction.Construct(ConstrNum).ReflectVisDiffBack * ShadeReflFacVis; + pow_2(ShadeTransVis) * state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack * ShadeReflFacVis; } // End of check if interior blind // Front incident solar, diffuse, interior shade if (IntShade) { for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - dataConstruction.Construct(ConstrNum).AbsDiff(IGlass) += tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); + state.dataConstruction->Construct(ConstrNum).AbsDiff(IGlass) += tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); } - dataConstruction.Construct(ConstrNum).AbsDiffShade = tsolDiff * ShadeReflFac * ShadeAbs; - dataConstruction.Construct(ConstrNum).TransDiff = tsolDiff * ShadeReflFac * ShadeTrans; - dataConstruction.Construct(ConstrNum).TransDiffVis = tvisDiff * ShadeReflFacVis * ShadeTransVis; - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront += tsolDiff_2 * ShadeRefl * ShadeReflFac; - dataConstruction.Construct(ConstrNum).ReflectVisDiffFront += tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; + state.dataConstruction->Construct(ConstrNum).AbsDiffShade = tsolDiff * ShadeReflFac * ShadeAbs; + state.dataConstruction->Construct(ConstrNum).TransDiff = tsolDiff * ShadeReflFac * ShadeTrans; + state.dataConstruction->Construct(ConstrNum).TransDiffVis = tvisDiff * ShadeReflFacVis * ShadeTransVis; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront += tsolDiff_2 * ShadeRefl * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront += tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; // Back incident solar, diffuse, interior shade for (IGlass = 1; IGlass <= NGlass; ++IGlass) { - dataConstruction.Construct(ConstrNum).AbsDiffBack(IGlass) *= ShadeTrans * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(IGlass) *= ShadeTrans * ShadeReflFac; } - dataConstruction.Construct(ConstrNum).AbsDiffBackShade = - ShadeAbs * (1 + ShadeTrans * ShadeReflFac * dataConstruction.Construct(ConstrNum).ReflectSolDiffBack); - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack = - ShadeRefl + pow_2(ShadeTrans) * dataConstruction.Construct(ConstrNum).ReflectSolDiffBack * ShadeReflFac; - dataConstruction.Construct(ConstrNum).ReflectVisDiffBack = - ShadeReflVis + pow_2(ShadeTransVis) * dataConstruction.Construct(ConstrNum).ReflectVisDiffBack * ShadeReflFacVis; + state.dataConstruction->Construct(ConstrNum).AbsDiffBackShade = + ShadeAbs * (1 + ShadeTrans * ShadeReflFac * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack); + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack = + ShadeRefl + pow_2(ShadeTrans) * state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack * ShadeReflFac; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack = + ShadeReflVis + pow_2(ShadeTransVis) * state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack * ShadeReflFacVis; } // End of check if interior shade } // End check if interior shade or blind @@ -1117,22 +1117,22 @@ namespace WindowManager { tsh2 = pow_2(tsh); tshv2 = pow_2(tshv); - td1 = dataConstruction.Construct(ConstrNum).tBareSolDiff(1); - td2 = dataConstruction.Construct(ConstrNum).tBareSolDiff(2); - td1v = dataConstruction.Construct(ConstrNum).tBareVisDiff(1); - td2v = dataConstruction.Construct(ConstrNum).tBareVisDiff(2); - afd1 = dataConstruction.Construct(ConstrNum).afBareSolDiff(1); - afd2 = dataConstruction.Construct(ConstrNum).afBareSolDiff(2); - abd1 = dataConstruction.Construct(ConstrNum).abBareSolDiff(1); - abd2 = dataConstruction.Construct(ConstrNum).abBareSolDiff(2); - rb1 = dataConstruction.Construct(ConstrNum).rbBareSolDiff(1); - rb2 = dataConstruction.Construct(ConstrNum).rbBareSolDiff(2); - rb1v = dataConstruction.Construct(ConstrNum).rbBareVisDiff(1); - rb2v = dataConstruction.Construct(ConstrNum).rbBareVisDiff(2); - rf1 = dataConstruction.Construct(ConstrNum).rfBareSolDiff(1); - rf2 = dataConstruction.Construct(ConstrNum).rfBareSolDiff(2); - rf1v = dataConstruction.Construct(ConstrNum).rfBareVisDiff(1); - rf2v = dataConstruction.Construct(ConstrNum).rfBareVisDiff(2); + td1 = state.dataConstruction->Construct(ConstrNum).tBareSolDiff(1); + td2 = state.dataConstruction->Construct(ConstrNum).tBareSolDiff(2); + td1v = state.dataConstruction->Construct(ConstrNum).tBareVisDiff(1); + td2v = state.dataConstruction->Construct(ConstrNum).tBareVisDiff(2); + afd1 = state.dataConstruction->Construct(ConstrNum).afBareSolDiff(1); + afd2 = state.dataConstruction->Construct(ConstrNum).afBareSolDiff(2); + abd1 = state.dataConstruction->Construct(ConstrNum).abBareSolDiff(1); + abd2 = state.dataConstruction->Construct(ConstrNum).abBareSolDiff(2); + rb1 = state.dataConstruction->Construct(ConstrNum).rbBareSolDiff(1); + rb2 = state.dataConstruction->Construct(ConstrNum).rbBareSolDiff(2); + rb1v = state.dataConstruction->Construct(ConstrNum).rbBareVisDiff(1); + rb2v = state.dataConstruction->Construct(ConstrNum).rbBareVisDiff(2); + rf1 = state.dataConstruction->Construct(ConstrNum).rfBareSolDiff(1); + rf2 = state.dataConstruction->Construct(ConstrNum).rfBareSolDiff(2); + rf1v = state.dataConstruction->Construct(ConstrNum).rfBareVisDiff(1); + rf2v = state.dataConstruction->Construct(ConstrNum).rfBareVisDiff(2); if (BGShade) { if (NGlass == 2) { @@ -1153,34 +1153,34 @@ namespace WindowManager { // Front incident solar, diffuse, between-glass shade, NGlass = 2 - dataConstruction.Construct(ConstrNum).TransDiff = td1 * (tsh + rsh * rb1 * tsh + tsh * rb2 * rsh) * td2; - dataConstruction.Construct(ConstrNum).TransDiffVis = td1v * (tshv + rshv * rb1v * tshv + tshv * rb2v * rshv) * td2v; - dataConstruction.Construct(ConstrNum).AbsDiffShade = td1 * (ash + rsh * rb1 * ash + tsh * rf2 * ash); - dataConstruction.Construct(ConstrNum).AbsDiff(1) = afd1 + td1 * (rsh + tsh * rb2 * tsh) * abd1; - dataConstruction.Construct(ConstrNum).AbsDiff(2) = td1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront = rf1 + td1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * td1; - dataConstruction.Construct(ConstrNum).ReflectVisDiffFront = rf1v + td1v * (rshv + rshv * rb1v * rshv + tshv * rf2v * tshv) * td1v; + state.dataConstruction->Construct(ConstrNum).TransDiff = td1 * (tsh + rsh * rb1 * tsh + tsh * rb2 * rsh) * td2; + state.dataConstruction->Construct(ConstrNum).TransDiffVis = td1v * (tshv + rshv * rb1v * tshv + tshv * rb2v * rshv) * td2v; + state.dataConstruction->Construct(ConstrNum).AbsDiffShade = td1 * (ash + rsh * rb1 * ash + tsh * rf2 * ash); + state.dataConstruction->Construct(ConstrNum).AbsDiff(1) = afd1 + td1 * (rsh + tsh * rb2 * tsh) * abd1; + state.dataConstruction->Construct(ConstrNum).AbsDiff(2) = td1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront = rf1 + td1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * td1; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront = rf1v + td1v * (rshv + rshv * rb1v * rshv + tshv * rf2v * tshv) * td1v; // Back incident solar, diffuse, between-glass shade, NGlass = 2 - dataConstruction.Construct(ConstrNum).AbsDiffBackShade = td2 * (ash + rsh * rf2 * ash + tsh * rb1 * ash); - dataConstruction.Construct(ConstrNum).AbsDiffBack(1) = td2 * (tsh + rsh * rf2 * tsh + tsh * rb1 * rsh) * abd1; - dataConstruction.Construct(ConstrNum).AbsDiffBack(2) = abd2 + td2 * (rsh + rsh * rf2 * rsh + tsh * rb1 * tsh) * afd2; - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack = rb2 + td2 * (rsh + rsh * rf2 * rsh + tsh * rb1 * tsh) * td2; - dataConstruction.Construct(ConstrNum).ReflectVisDiffBack = rb2v + td2v * (rshv + rshv * rf2v * rshv + tshv * rb1v * tshv) * td2v; + state.dataConstruction->Construct(ConstrNum).AbsDiffBackShade = td2 * (ash + rsh * rf2 * ash + tsh * rb1 * ash); + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(1) = td2 * (tsh + rsh * rf2 * tsh + tsh * rb1 * rsh) * abd1; + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(2) = abd2 + td2 * (rsh + rsh * rf2 * rsh + tsh * rb1 * tsh) * afd2; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack = rb2 + td2 * (rsh + rsh * rf2 * rsh + tsh * rb1 * tsh) * td2; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack = rb2v + td2v * (rshv + rshv * rf2v * rshv + tshv * rb1v * tshv) * td2v; } // End of check if NGlass = 2 if (NGlass == 3) { - td3 = dataConstruction.Construct(ConstrNum).tBareSolDiff(3); - td3v = dataConstruction.Construct(ConstrNum).tBareVisDiff(3); - afd3 = dataConstruction.Construct(ConstrNum).afBareSolDiff(3); - abd3 = dataConstruction.Construct(ConstrNum).abBareSolDiff(3); - rb3 = dataConstruction.Construct(ConstrNum).rbBareSolDiff(3); - rb3v = dataConstruction.Construct(ConstrNum).rbBareVisDiff(3); - rf3 = dataConstruction.Construct(ConstrNum).rfBareSolDiff(3); - rf3v = dataConstruction.Construct(ConstrNum).rfBareVisDiff(3); + td3 = state.dataConstruction->Construct(ConstrNum).tBareSolDiff(3); + td3v = state.dataConstruction->Construct(ConstrNum).tBareVisDiff(3); + afd3 = state.dataConstruction->Construct(ConstrNum).afBareSolDiff(3); + abd3 = state.dataConstruction->Construct(ConstrNum).abBareSolDiff(3); + rb3 = state.dataConstruction->Construct(ConstrNum).rbBareSolDiff(3); + rb3v = state.dataConstruction->Construct(ConstrNum).rbBareVisDiff(3); + rf3 = state.dataConstruction->Construct(ConstrNum).rfBareSolDiff(3); + rf3v = state.dataConstruction->Construct(ConstrNum).rfBareVisDiff(3); // Front incident solar, beam, between-glass shade, NGlass = 3 @@ -1208,35 +1208,35 @@ namespace WindowManager { // Front incident solar, diffuse, between-glass shade, NGlass = 3 - dataConstruction.Construct(ConstrNum).TransDiff = + state.dataConstruction->Construct(ConstrNum).TransDiff = td1 * td2 * (tsh + rsh * td2 * rb1 * td2 * tsh + rsh * rb2 * tsh + tsh * rf3 * rsh) * td3; - dataConstruction.Construct(ConstrNum).TransDiffVis = + state.dataConstruction->Construct(ConstrNum).TransDiffVis = td1v * td2v * (tshv + rshv * td2v * rb1v * td2v * tshv + rshv * rb2v * tshv + tshv * rf3v * rshv) * td3v; - dataConstruction.Construct(ConstrNum).AbsDiffShade = + state.dataConstruction->Construct(ConstrNum).AbsDiffShade = td1 * td2 * (ash * (1 + rsh * td2 * rb1 * td2 + rsh * rb2 * ash) + tsh * rf3 * ash); - dataConstruction.Construct(ConstrNum).AbsDiff(1) = + state.dataConstruction->Construct(ConstrNum).AbsDiff(1) = afd1 + td1 * (rf2 + td2 * (rsh + rsh * rb2 * rsh + tsh * rf3 * tsh + rsh * td2 * rb1 * td2 * rsh) * td2) * abd1; - dataConstruction.Construct(ConstrNum).AbsDiff(2) = td1 * (afd2 + td2 * (rsh + rsh * rb2 * rsh + tsh * rf3 * tsh) * abd2); - dataConstruction.Construct(ConstrNum).AbsDiff(3) = + state.dataConstruction->Construct(ConstrNum).AbsDiff(2) = td1 * (afd2 + td2 * (rsh + rsh * rb2 * rsh + tsh * rf3 * tsh) * abd2); + state.dataConstruction->Construct(ConstrNum).AbsDiff(3) = td1 * td2 * (tsh + rsh * rb2 * tsh + rsh * td2 * rb1 * td2 * tsh + tsh * rf3 * rsh) * afd3; - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront = + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront = rf1 + td1 * rf2 * td1 + td1 * td2 * (rsh + tsh * rf3 * tsh + rsh * rb2 * rsh + rsh * td2 * rb1 * td2 * rsh) * td2 * td1; - dataConstruction.Construct(ConstrNum).ReflectVisDiffFront = + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront = rf1v + td1v * rf2v * td1v + td1v * td2v * (rshv + tshv * rf3v * tshv + rshv * rb2v * rshv + rshv * td2v * rb1v * td2v * rshv) * td2v * td1v; // Back incident solar, diffuse, between-glass shade, NGlass = 3 - dataConstruction.Construct(ConstrNum).AbsDiffBackShade = td3 * ((1 + rsh * rf3) * ash + (tsh * td2 * rb1 * td2 + tsh * rb2) * ash); - dataConstruction.Construct(ConstrNum).AbsDiffBack(1) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBackShade = td3 * ((1 + rsh * rf3) * ash + (tsh * td2 * rb1 * td2 + tsh * rb2) * ash); + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(1) = td3 * (tsh + rsh * rf3 * tsh + tsh * rb2 * rsh + tsh * td2 * rb1 * td2 * rsh) * td2 * abd1; - dataConstruction.Construct(ConstrNum).AbsDiffBack(2) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(2) = td3 * ((tsh + rsh * rf3 * tsh) * abd2 + (tsh * td2 * rb1 * td2 + tsh * rb2) * afd2); - dataConstruction.Construct(ConstrNum).AbsDiffBack(3) = abd3 + td3 * (rsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * afd3; - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack = + state.dataConstruction->Construct(ConstrNum).AbsDiffBack(3) = abd3 + td3 * (rsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * afd3; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack = rb3 + td3 * (rsh + rsh * rf3 * rsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * td3; - dataConstruction.Construct(ConstrNum).ReflectVisDiffBack = + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffBack = rb3v + td3v * (rshv + rshv * rf3 * rshv + tshv * rb2v * tshv + tshv * td2v * rb1v * td2v * tshv) * td3v; } // End of check if NGlass = 3 @@ -1249,109 +1249,109 @@ namespace WindowManager { // Front incident solar, diffuse, between-glass blind, NGlass = 2 - dataConstruction.Construct(ConstrNum).BlAbsDiff(ISlatAng, 1) = afd1 + td1 * (rfsh + rfsh * rb1 * rfsh + tsh * rb2 * tsh) * abd1; - dataConstruction.Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 1) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiff(ISlatAng, 1) = afd1 + td1 * (rfsh + rfsh * rb1 * rfsh + tsh * rb2 * tsh) * abd1; + state.dataConstruction->Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 1) = afd1 + td1 * (rfshGnd + rfshGnd * rb1 * rfshGnd + tshGnd * rb2 * tsh) * abd1; - dataConstruction.Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 1) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 1) = afd1 + td1 * (rfshSky + rfshSky * rb1 * rfshSky + tshSky * rb2 * tsh) * abd1; - dataConstruction.Construct(ConstrNum).BlAbsDiff(ISlatAng, 2) = td1 * (tsh + rfsh * rb1 * tsh + tsh * rf2 * rbsh) * afd2; - dataConstruction.Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 2) = td1 * (tshGnd + rfshGnd * rb1 * tsh + tshGnd * rf2 * rbsh) * afd2; - dataConstruction.Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 2) = td1 * (tshSky + rfshSky * rb1 * tsh + tshSky * rf2 * rbsh) * afd2; - dataConstruction.Construct(ConstrNum).AbsDiffBlind(ISlatAng) = td1 * (afsh + rfsh * rb1 * afsh + tsh * rf2 * absh); - dataConstruction.Construct(ConstrNum).AbsDiffBlindGnd(ISlatAng) = td1 * (afshGnd + rfsh * rb1 * afsh + tshGnd * rf2 * absh); - dataConstruction.Construct(ConstrNum).AbsDiffBlindSky(ISlatAng) = td1 * (afshSky + rfsh * rb1 * afsh + tshSky * rf2 * absh); - dataConstruction.Construct(ConstrNum).BlTransDiff(ISlatAng) = td1 * (tsh + rfsh * rb1 * tsh + tsh * rb2 * rbsh) * td2; - dataConstruction.Construct(ConstrNum).BlTransDiffGnd(ISlatAng) = td1 * (tshGnd + rfsh * rb1 * tshGnd + tshGnd * rb2 * rbsh) * td2; - dataConstruction.Construct(ConstrNum).BlTransDiffSky(ISlatAng) = td1 * (tshSky + rfsh * rb1 * tshSky + tshSky * rb2 * rbsh) * td2; - dataConstruction.Construct(ConstrNum).BlTransDiffVis(ISlatAng) = td1v * (tshv + rfshv * rb1v * tshv + tshv * rb2v * rbshv) * td2v; - dataConstruction.Construct(ConstrNum).BlReflectSolDiffFront(ISlatAng) = rf1 + td1 * (rfsh + rfsh * rb1 * rfsh + tsh * rf2 * tsh) * td1; - dataConstruction.Construct(ConstrNum).BlReflectVisDiffFront(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiff(ISlatAng, 2) = td1 * (tsh + rfsh * rb1 * tsh + tsh * rf2 * rbsh) * afd2; + state.dataConstruction->Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 2) = td1 * (tshGnd + rfshGnd * rb1 * tsh + tshGnd * rf2 * rbsh) * afd2; + state.dataConstruction->Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 2) = td1 * (tshSky + rfshSky * rb1 * tsh + tshSky * rf2 * rbsh) * afd2; + state.dataConstruction->Construct(ConstrNum).AbsDiffBlind(ISlatAng) = td1 * (afsh + rfsh * rb1 * afsh + tsh * rf2 * absh); + state.dataConstruction->Construct(ConstrNum).AbsDiffBlindGnd(ISlatAng) = td1 * (afshGnd + rfsh * rb1 * afsh + tshGnd * rf2 * absh); + state.dataConstruction->Construct(ConstrNum).AbsDiffBlindSky(ISlatAng) = td1 * (afshSky + rfsh * rb1 * afsh + tshSky * rf2 * absh); + state.dataConstruction->Construct(ConstrNum).BlTransDiff(ISlatAng) = td1 * (tsh + rfsh * rb1 * tsh + tsh * rb2 * rbsh) * td2; + state.dataConstruction->Construct(ConstrNum).BlTransDiffGnd(ISlatAng) = td1 * (tshGnd + rfsh * rb1 * tshGnd + tshGnd * rb2 * rbsh) * td2; + state.dataConstruction->Construct(ConstrNum).BlTransDiffSky(ISlatAng) = td1 * (tshSky + rfsh * rb1 * tshSky + tshSky * rb2 * rbsh) * td2; + state.dataConstruction->Construct(ConstrNum).BlTransDiffVis(ISlatAng) = td1v * (tshv + rfshv * rb1v * tshv + tshv * rb2v * rbshv) * td2v; + state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffFront(ISlatAng) = rf1 + td1 * (rfsh + rfsh * rb1 * rfsh + tsh * rf2 * tsh) * td1; + state.dataConstruction->Construct(ConstrNum).BlReflectVisDiffFront(ISlatAng) = rf1v + td1v * (rfshv + rfshv * rb1v * rfshv + tshv * rf2v * tshv) * td1v; // Back incident solar, diffuse, between-glass blind, NGlass = 2 - dataConstruction.Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 1) = td2 * (tsh + rbsh * rf2 * tsh + tsh * rb1 * rfsh) * abd1; - dataConstruction.Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 2) = abd2 + td2 * (rbsh + rbsh * rf2 * rbsh + tsh * rb1 * tsh) * afd2; - dataConstruction.Construct(ConstrNum).AbsDiffBackBlind(ISlatAng) = td2 * (absh + rbsh * rf2 * absh + tsh * rb1 * afsh); - dataConstruction.Construct(ConstrNum).BlReflectSolDiffBack(ISlatAng) = rb2 + td2 * (rbsh + rbsh * rf2 * rbsh + tsh * rb1 * tsh) * td2; - dataConstruction.Construct(ConstrNum).BlReflectVisDiffBack(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 1) = td2 * (tsh + rbsh * rf2 * tsh + tsh * rb1 * rfsh) * abd1; + state.dataConstruction->Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 2) = abd2 + td2 * (rbsh + rbsh * rf2 * rbsh + tsh * rb1 * tsh) * afd2; + state.dataConstruction->Construct(ConstrNum).AbsDiffBackBlind(ISlatAng) = td2 * (absh + rbsh * rf2 * absh + tsh * rb1 * afsh); + state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffBack(ISlatAng) = rb2 + td2 * (rbsh + rbsh * rf2 * rbsh + tsh * rb1 * tsh) * td2; + state.dataConstruction->Construct(ConstrNum).BlReflectVisDiffBack(ISlatAng) = rb2v + td2v * (rbshv + rbshv * rf2v * rbshv + tshv * rb1v * tshv) * td2v; } // End of check if NGlass = 2 if (NGlass == 3) { - td3 = dataConstruction.Construct(ConstrNum).tBareSolDiff(3); - td3v = dataConstruction.Construct(ConstrNum).tBareVisDiff(3); - afd3 = dataConstruction.Construct(ConstrNum).afBareSolDiff(3); - abd3 = dataConstruction.Construct(ConstrNum).abBareSolDiff(3); - rb3 = dataConstruction.Construct(ConstrNum).rbBareSolDiff(3); - rb3v = dataConstruction.Construct(ConstrNum).rbBareVisDiff(3); - rf3 = dataConstruction.Construct(ConstrNum).rfBareSolDiff(3); - rf3v = dataConstruction.Construct(ConstrNum).rfBareVisDiff(3); + td3 = state.dataConstruction->Construct(ConstrNum).tBareSolDiff(3); + td3v = state.dataConstruction->Construct(ConstrNum).tBareVisDiff(3); + afd3 = state.dataConstruction->Construct(ConstrNum).afBareSolDiff(3); + abd3 = state.dataConstruction->Construct(ConstrNum).abBareSolDiff(3); + rb3 = state.dataConstruction->Construct(ConstrNum).rbBareSolDiff(3); + rb3v = state.dataConstruction->Construct(ConstrNum).rbBareVisDiff(3); + rf3 = state.dataConstruction->Construct(ConstrNum).rfBareSolDiff(3); + rf3v = state.dataConstruction->Construct(ConstrNum).rfBareVisDiff(3); // Front incident solar, diffuse, between-glass blind, NGlass = 3 - dataConstruction.Construct(ConstrNum).BlAbsDiff(ISlatAng, 1) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiff(ISlatAng, 1) = afd1 + td1 * (rf2 + td2 * (rfsh + rfsh * rb2 * rfsh + tsh * rf3 * tsh + rfsh * td2 * rb1 * td2 * rfsh) * td2) * abd1; - dataConstruction.Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 1) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 1) = afd1 + td1 * (rf2 + td2 * (rfshGnd + rfshGnd * rb2 * rfsh + tshGnd * rf3 * tsh + rfshGnd * td2 * rb1 * td2 * rfsh) * td2) * abd1; - dataConstruction.Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 1) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 1) = afd1 + td1 * (rf2 + td2 * (rfshSky + rfshSky * rb2 * rfsh + tshSky * rf3 * tsh + rfshSky * td2 * rb1 * td2 * rfsh) * td2) * abd1; - dataConstruction.Construct(ConstrNum).BlAbsDiff(ISlatAng, 2) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiff(ISlatAng, 2) = td1 * (afd2 + td2 * (rfsh + rfsh * rb2 * rfsh + tsh * rf3 * tsh) * abd2); - dataConstruction.Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 2) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 2) = td1 * (afd2 + td2 * (rfshGnd + rfshGnd * rb2 * rfsh + tshGnd * rf3 * tsh) * abd2); - dataConstruction.Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 2) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 2) = td1 * (afd2 + td2 * (rfshSky + rfshSky * rb2 * rfsh + tshSky * rf3 * tsh) * abd2); - dataConstruction.Construct(ConstrNum).BlAbsDiff(ISlatAng, 3) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiff(ISlatAng, 3) = td1 * td2 * (tsh + rfsh * rb2 * tsh + rfsh * td2 * rb1 * td2 * tsh + tsh * rf3 * rbsh) * afd3; - dataConstruction.Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 3) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffGnd(ISlatAng, 3) = td1 * td2 * (tshGnd + rfshGnd * rb2 * tsh + rfshGnd * td2 * rb1 * td2 * tsh + tshGnd * rf3 * rbsh) * afd3; - dataConstruction.Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 3) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffSky(ISlatAng, 3) = td1 * td2 * (tshSky + rfshSky * rb2 * tsh + rfshSky * td2 * rb1 * td2 * tsh + tshSky * rf3 * rbsh) * afd3; - dataConstruction.Construct(ConstrNum).AbsDiffBlind(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBlind(ISlatAng) = td1 * td2 * (afsh * (1 + rfsh * td2 * rb1 * td2) + rfsh * rb2 * afsh + tsh * rf3 * absh); - dataConstruction.Construct(ConstrNum).AbsDiffBlindGnd(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBlindGnd(ISlatAng) = td1 * td2 * (afshGnd + afsh * rfsh * (td2 * rb1 * td2 + rb2) + tshGnd * rf3 * absh); - dataConstruction.Construct(ConstrNum).AbsDiffBlindSky(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBlindSky(ISlatAng) = td1 * td2 * (afshSky + afsh * rfsh * (td2 * rb1 * td2 + rb2) + tshSky * rf3 * absh); - dataConstruction.Construct(ConstrNum).BlTransDiff(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlTransDiff(ISlatAng) = td1 * td2 * (tsh + rfsh * td2 * rb1 * td2 * tsh + rfsh * rb2 * tsh + tsh * rf3 * rbsh) * td3; - dataConstruction.Construct(ConstrNum).BlTransDiffGnd(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlTransDiffGnd(ISlatAng) = td1 * td2 * (tshGnd + rfsh * td2 * rb1 * td2 * tshGnd + rfsh * rb2 * tshGnd + tshGnd * rf3 * rbsh) * td3; - dataConstruction.Construct(ConstrNum).BlTransDiffSky(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlTransDiffSky(ISlatAng) = td1 * td2 * (tshSky + rfsh * td2 * rb1 * td2 * tshSky + rfsh * rb2 * tshSky + tshSky * rf3 * rbsh) * td3; - dataConstruction.Construct(ConstrNum).BlTransDiffVis(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlTransDiffVis(ISlatAng) = td1v * td2v * (tshv + rfshv * td2v * rb1v * td2v * tshv + rfshv * rb2v * tshv + tshv * rf3v * rbshv) * td3v; - dataConstruction.Construct(ConstrNum).BlReflectSolDiffFront(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffFront(ISlatAng) = rf1 + td1 * rf2 * td1 + td1 * td2 * (rfsh + tsh * rf3 * tsh + rfsh * rb2 * rfsh + rfsh * td2 * rb1 * td2 * rfsh) * td2 * td1; - dataConstruction.Construct(ConstrNum).BlReflectVisDiffFront(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlReflectVisDiffFront(ISlatAng) = rf1v + td1v * rf2v * td1v + td1v * td2v * (rfshv + tshv * rf3v * tshv + rfshv * rb2v * rfshv + rfshv * td2v * rb1v * td2v * rfshv) * td2v * td1v; // Back incident solar, diffuse, between-glass blind, NGlass = 3 - dataConstruction.Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 1) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 1) = td3 * (tsh + rbsh * rf3 * tsh + tsh * rb2 * rfsh + tsh * td2 * rb1 * td2 * rfsh) * td2 * abd1; - dataConstruction.Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 2) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 2) = td3 * ((tsh + rbsh * rf3 * tsh) * abd2 + (tsh * td2 * rb1 * td2 + tsh * rb2) * afd2); - dataConstruction.Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 3) = + state.dataConstruction->Construct(ConstrNum).BlAbsDiffBack(ISlatAng, 3) = abd3 + td3 * (rbsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * afd3; - dataConstruction.Construct(ConstrNum).AbsDiffBackBlind(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).AbsDiffBackBlind(ISlatAng) = td3 * ((1 + rbsh * rf3) * absh + (tsh * td2 * rb1 * td2 + tsh * rb2) * afsh); - dataConstruction.Construct(ConstrNum).BlReflectSolDiffBack(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffBack(ISlatAng) = rb3 + td3 * (rbsh + rbsh * rf3 * rbsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * td3; - dataConstruction.Construct(ConstrNum).BlReflectVisDiffBack(ISlatAng) = + state.dataConstruction->Construct(ConstrNum).BlReflectVisDiffBack(ISlatAng) = rb3v + td3v * (rbshv + rbshv * rf3v * rbshv + tshv * rb2v * tshv + tshv * td2v * rb1v * td2v * tshv) * td3v; } // End of check if NGlass = 3 @@ -1372,25 +1372,25 @@ namespace WindowManager { // visible transmittance as polynomials in cosine of incidence angle if (!BlindOn && !ScreenOn) { // Bare glass or shade on - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->tsolPhi, 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).TransSolBeamCoef); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->rfsolPhi, 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->rbsolPhi, 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).ReflSolBeamBackCoef({1, 6})); - W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->tvisPhi, 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).TransVisBeamCoef); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->tsolPhi, 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->rfsolPhi, 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->rbsolPhi, 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).ReflSolBeamBackCoef({1, 6})); + W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->tvisPhi, 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).TransVisBeamCoef); for (IGlass = 1; IGlass <= NGlass; ++IGlass) { // Front absorptance coefficients for glass layers state.dataWindowManager->DepVarCurveFit({1, TotalIPhi}) = state.dataWindowManager->solabsPhi(IGlass, {1, TotalIPhi}); W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->DepVarCurveFit, 6, 1, TotalIPhi, state.dataWindowManager->CoeffsCurveFit); - dataConstruction.Construct(ConstrNum).AbsBeamCoef({1, 6}, IGlass) = state.dataWindowManager->CoeffsCurveFit; + state.dataConstruction->Construct(ConstrNum).AbsBeamCoef({1, 6}, IGlass) = state.dataWindowManager->CoeffsCurveFit; // Back absorptance coefficients for glass layers IGlassBack = NGlass - IGlass + 1; state.dataWindowManager->DepVarCurveFit({1, TotalIPhi}) = state.dataWindowManager->solabsBackPhi(IGlassBack, {1, TotalIPhi}); W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->DepVarCurveFit, 6, 1, TotalIPhi, state.dataWindowManager->CoeffsCurveFit); - dataConstruction.Construct(ConstrNum).AbsBeamBackCoef({1, 6}, IGlass) = state.dataWindowManager->CoeffsCurveFit; + state.dataConstruction->Construct(ConstrNum).AbsBeamBackCoef({1, 6}, IGlass) = state.dataWindowManager->CoeffsCurveFit; } // To check goodness of fit //Tuned - auto const &solBeamCoef(dataConstruction.Construct(ConstrNum).TransSolBeamCoef); - auto const &visBeamCoef(dataConstruction.Construct(ConstrNum).TransVisBeamCoef); + auto const &solBeamCoef(state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); + auto const &visBeamCoef(state.dataConstruction->Construct(ConstrNum).TransVisBeamCoef); for (IPhi = 1; IPhi <= TotalIPhi; ++IPhi) { tsolPhiFit(IPhi) = 0.0; tvisPhiFit(IPhi) = 0.0; @@ -1407,7 +1407,7 @@ namespace WindowManager { } } - if (ShadeOn) W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->solabsShadePhi, 6, 1, TotalIPhi, dataConstruction.Construct(ConstrNum).AbsBeamShadeCoef); + if (ShadeOn) W5LsqFit(state.dataWindowManager->CosPhiIndepVar, state.dataWindowManager->solabsShadePhi, 6, 1, TotalIPhi, state.dataConstruction->Construct(ConstrNum).AbsBeamShadeCoef); } // End of loop over constructions @@ -1418,27 +1418,27 @@ namespace WindowManager { // Loop for ordinary windows for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (!Surface(SurfNum).HeatTransSurf) continue; - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; if (SurfWinWindowModelType(SurfNum) == WindowBSDFModel) continue; // Irrelevant for Complex Fen - if (dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) continue; // not required + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) continue; // not required ConstrNumSh = Surface(SurfNum).activeShadedConstruction; if (ConstrNumSh == 0) continue; - TotLay = dataConstruction.Construct(ConstrNumSh).TotLayers; + TotLay = state.dataConstruction->Construct(ConstrNumSh).TotLayers; IntShade = false; IntBlind = false; - if (dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay)).Group == Shade) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay)).Group == Shade) { IntShade = true; - ShadeLayPtr = dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay); + ShadeLayPtr = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay); } - if (dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay)).Group == WindowBlind) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay)).Group == WindowBlind) { IntBlind = true; - BlNum = dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay)).BlindDataPtr; + BlNum = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay)).BlindDataPtr; } if (IntShade || IntBlind) { for (ISlatAng = 1; ISlatAng <= MaxSlatAngs; ++ISlatAng) { if (IntShade || IntBlind) { - EpsGlIR = dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay - 1)).AbsorpThermalBack; + EpsGlIR = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay - 1)).AbsorpThermalBack; RhoGlIR = 1 - EpsGlIR; } if (IntShade) { @@ -1466,12 +1466,12 @@ namespace WindowManager { for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (Surface(SurfNum).Construction <= 0) continue; - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; ConstrNum = Surface(SurfNum).Construction; // Total thickness of glazing system (used in calculation of inside reveal reflection/absorption SurfWinTotGlazingThickness(SurfNum) = 0.0; - for (LayNum = 1; LayNum <= dataConstruction.Construct(ConstrNum).TotLayers; ++LayNum) { - SurfWinTotGlazingThickness(SurfNum) += dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(LayNum)).Thickness; + for (LayNum = 1; LayNum <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++LayNum) { + SurfWinTotGlazingThickness(SurfNum) += dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(LayNum)).Thickness; } // Sine and cosine of azimuth and tilt // SurfaceWindow(SurfNum)%SinAzim = Surface(SurfNum)%SinAzim @@ -1541,25 +1541,25 @@ namespace WindowManager { // FLOW for (ConstrNum = 1; ConstrNum <= TotConstructs; ++ConstrNum) { - if (dataConstruction.Construct(ConstrNum).FromWindow5DataFile) continue; - if (dataConstruction.Construct(ConstrNum).WindowTypeBSDF) continue; - if (dataConstruction.Construct(ConstrNum).TypeIsAirBoundaryInteriorWindow) continue; - dataConstruction.Construct(ConstrNum).TransDiff = 0.0; - dataConstruction.Construct(ConstrNum).TransDiffVis = 0.0; - dataConstruction.Construct(ConstrNum).AbsDiffBackShade = 0.0; - dataConstruction.Construct(ConstrNum).ShadeAbsorpThermal = 0.0; - dataConstruction.Construct(ConstrNum).ReflectSolDiffBack = 0.0; - dataConstruction.Construct(ConstrNum).ReflectSolDiffFront = 0.0; - dataConstruction.Construct(ConstrNum).ReflectVisDiffFront = 0.0; - dataConstruction.Construct(ConstrNum).AbsBeamShadeCoef = 0.0; - dataConstruction.Construct(ConstrNum).TransSolBeamCoef = 0.0; - dataConstruction.Construct(ConstrNum).ReflSolBeamFrontCoef = 0.0; - dataConstruction.Construct(ConstrNum).ReflSolBeamBackCoef = 0.0; - dataConstruction.Construct(ConstrNum).TransVisBeamCoef = 0.0; - dataConstruction.Construct(ConstrNum).AbsBeamCoef = 0.0; - dataConstruction.Construct(ConstrNum).AbsBeamBackCoef = 0.0; - dataConstruction.Construct(ConstrNum).AbsDiff = 0.0; - dataConstruction.Construct(ConstrNum).AbsDiffBack = 0.0; + if (state.dataConstruction->Construct(ConstrNum).FromWindow5DataFile) continue; + if (state.dataConstruction->Construct(ConstrNum).WindowTypeBSDF) continue; + if (state.dataConstruction->Construct(ConstrNum).TypeIsAirBoundaryInteriorWindow) continue; + state.dataConstruction->Construct(ConstrNum).TransDiff = 0.0; + state.dataConstruction->Construct(ConstrNum).TransDiffVis = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsDiffBackShade = 0.0; + state.dataConstruction->Construct(ConstrNum).ShadeAbsorpThermal = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflectSolDiffFront = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflectVisDiffFront = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsBeamShadeCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflSolBeamFrontCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).ReflSolBeamBackCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).TransVisBeamCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsBeamCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsBeamBackCoef = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsDiff = 0.0; + state.dataConstruction->Construct(ConstrNum).AbsDiffBack = 0.0; } for (SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { @@ -1634,7 +1634,7 @@ namespace WindowManager { if (Surface(SurfNum).Class == SurfaceClass_Window && Surface(SurfNum).ExtBoundCond == ExternalEnvironment && Surface(SurfNum).StormWinConstruction == 0) { ConstrNum = Surface(SurfNum).Construction; - MatNum = dataConstruction.Construct(ConstrNum).LayerPoint(dataConstruction.Construct(ConstrNum).TotLayers); + MatNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataConstruction->Construct(ConstrNum).TotLayers); if (dataMaterial.Material(MatNum).SolarDiffusing) { if (!Surface(SurfNum).HasShadeControl) { SurfWinSolarDiffusing(SurfNum) = true; @@ -2145,10 +2145,10 @@ namespace WindowManager { CalcComplexWindowThermal(state, SurfNum, temp, HextConvCoeff, SurfInsideTemp, SurfOutsideTemp, SurfOutsideEmiss, noCondition); ConstrNum = surface.Construction; - TotGlassLay = dataConstruction.Construct(ConstrNum).TotGlassLayers; - state.dataWindowManager->ngllayer = dataConstruction.Construct(ConstrNum).TotSolidLayers; // Simon: This is necessary to keep for frame calculations + TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; + state.dataWindowManager->ngllayer = state.dataConstruction->Construct(ConstrNum).TotSolidLayers; // Simon: This is necessary to keep for frame calculations // Simon: need to transfer surface temperatures because of frames calculation - for (i = 1; i <= 2 * dataConstruction.Construct(ConstrNum).TotSolidLayers; ++i) { + for (i = 1; i <= 2 * state.dataConstruction->Construct(ConstrNum).TotSolidLayers; ++i) { state.dataWindowManager->thetas(i) = window.ThetaFace(i); } state.dataWindowManager->hcout = HextConvCoeff; @@ -2192,10 +2192,10 @@ namespace WindowManager { if (SurfWinStormWinFlag(SurfNum) > 0) ConstrNum = surface.StormWinConstruction; // Added for thermochromic windows - state.dataWindowManager->locTCFlag = (dataConstruction.Construct(ConstrNum).TCFlag == 1); + state.dataWindowManager->locTCFlag = (state.dataConstruction->Construct(ConstrNum).TCFlag == 1); if (state.dataWindowManager->locTCFlag) { - locTCSpecTemp = dataMaterial.Material(dataConstruction.Construct(ConstrNum).TCLayer).SpecTemp; + locTCSpecTemp = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).TCLayer).SpecTemp; SurfWinSpecTemp(SurfNum) = locTCSpecTemp; // Check to see whether needs to switch to a new TC window construction locTCLayerTemp = SurfWinTCLayerTemp(SurfNum); @@ -2206,8 +2206,8 @@ namespace WindowManager { deltaTemp = 0.0; IDConst = 0; for (k = 1; k <= TotConstructs; ++k) { - if (dataConstruction.Construct(k).TCMasterConst == dataConstruction.Construct(ConstrNum).TCMasterConst) { - dT1 = std::abs(locTCLayerTemp - dataMaterial.Material(dataConstruction.Construct(k).TCLayer).SpecTemp); + if (state.dataConstruction->Construct(k).TCMasterConst == state.dataConstruction->Construct(ConstrNum).TCMasterConst) { + dT1 = std::abs(locTCLayerTemp - dataMaterial.Material(state.dataConstruction->Construct(k).TCLayer).SpecTemp); if (dT1 < dT0) { ++i; deltaTemp(i) = dT1; @@ -2221,15 +2221,15 @@ namespace WindowManager { // Use the new TC window construction ConstrNum = IDConst(iMinDT(1)); surface.Construction = ConstrNum; - SurfWinSpecTemp(SurfNum) = dataMaterial.Material(dataConstruction.Construct(ConstrNum).TCLayer).SpecTemp; + SurfWinSpecTemp(SurfNum) = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).TCLayer).SpecTemp; } } } // end new TC code ZoneNum = surface.Zone; - TotLay = dataConstruction.Construct(ConstrNum).TotLayers; - TotGlassLay = dataConstruction.Construct(ConstrNum).TotGlassLayers; + TotLay = state.dataConstruction->Construct(ConstrNum).TotLayers; + TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; state.dataWindowManager->ngllayer = TotGlassLay; state.dataWindowManager->nglface = 2 * state.dataWindowManager->ngllayer; ShadeFlag = SurfWinShadingFlag(SurfNum); @@ -2349,14 +2349,14 @@ namespace WindowManager { IConst = surface.activeShadedConstruction; if (SurfWinStormWinFlag(SurfNum) > 0) IConst = surface.activeStormWinShadedConstruction; } - TotLay = dataConstruction.Construct(IConst).TotLayers; + TotLay = state.dataConstruction->Construct(IConst).TotLayers; IGlass = 0; IGap = 0; // Fill window layer properties needed for window layer heat balance calculation for (Lay = 1; Lay <= TotLay; ++Lay) { - LayPtr = dataConstruction.Construct(IConst).LayerPoint(Lay); + LayPtr = state.dataConstruction->Construct(IConst).LayerPoint(Lay); if ((dataMaterial.Material(LayPtr).Group == WindowGlass) || (dataMaterial.Material(LayPtr).Group == WindowSimpleGlazing)) { ++IGlass; @@ -2369,11 +2369,11 @@ namespace WindowManager { } if (dataMaterial.Material(LayPtr).Group == Shade || dataMaterial.Material(LayPtr).Group == WindowBlind || dataMaterial.Material(LayPtr).Group == Screen) { - if (ShadeFlag == IntShadeOn || ShadeFlag == IntBlindOn) ShadeLayPtr = dataConstruction.Construct(IConst).LayerPoint(dataConstruction.Construct(IConst).TotLayers); - if (ShadeFlag == ExtShadeOn || ShadeFlag == ExtBlindOn || ShadeFlag == ExtScreenOn) ShadeLayPtr = dataConstruction.Construct(IConst).LayerPoint(1); + if (ShadeFlag == IntShadeOn || ShadeFlag == IntBlindOn) ShadeLayPtr = state.dataConstruction->Construct(IConst).LayerPoint(state.dataConstruction->Construct(IConst).TotLayers); + if (ShadeFlag == ExtShadeOn || ShadeFlag == ExtBlindOn || ShadeFlag == ExtScreenOn) ShadeLayPtr = state.dataConstruction->Construct(IConst).LayerPoint(1); if (ShadeFlag == BGShadeOn || ShadeFlag == BGBlindOn) { - ShadeLayPtr = dataConstruction.Construct(IConst).LayerPoint(3); - if (TotGlassLay == 3) ShadeLayPtr = dataConstruction.Construct(IConst).LayerPoint(5); + ShadeLayPtr = state.dataConstruction->Construct(IConst).LayerPoint(3); + if (TotGlassLay == 3) ShadeLayPtr = state.dataConstruction->Construct(IConst).LayerPoint(5); } if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || ShadeFlag == ExtScreenOn) { // Shade or screen on @@ -2614,13 +2614,13 @@ namespace WindowManager { // Added TH 12/23/2008 for thermochromic windows to save the current TC layer temperature if (state.dataWindowManager->locTCFlag) { SurfWinTCLayerTemp(SurfNum) = - (state.dataWindowManager->thetas(2 * dataConstruction.Construct(ConstrNum).TCGlassID - 1) + state.dataWindowManager->thetas(2 * dataConstruction.Construct(ConstrNum).TCGlassID)) / 2 - state.dataWindowManager->TKelvin; // degree C + (state.dataWindowManager->thetas(2 * state.dataConstruction->Construct(ConstrNum).TCGlassID - 1) + state.dataWindowManager->thetas(2 * state.dataConstruction->Construct(ConstrNum).TCGlassID)) / 2 - state.dataWindowManager->TKelvin; // degree C } } // regular window, not BSDF, not EQL // Set condensation flag to 1 if condensation expected to occur on the innermost glass face, // or, for airflow windows, on either or the two glass faces in the airflow gap - if (!dataConstruction.Construct(surface.Construction).WindowTypeEQL) { + if (!state.dataConstruction->Construct(surface.Construction).WindowTypeEQL) { InsideGlassTemp = state.dataWindowManager->thetas(2 * state.dataWindowManager->ngllayer) - state.dataWindowManager->TKelvin; RoomHumRat = ZoneAirHumRat(surface.Zone); RoomDewPoint = PsyTdpFnWPb(RoomHumRat, OutBaroPress); @@ -3530,16 +3530,16 @@ namespace WindowManager { ConstrNumSh = Surface(SurfNum).activeStormWinShadedConstruction; } - TransDiff = dataConstruction.Construct(ConstrNum).TransDiff; // Default value for TransDiff here + TransDiff = state.dataConstruction->Construct(ConstrNum).TransDiff; // Default value for TransDiff here if (ShadeFlag <= 0) { - TransDiff = dataConstruction.Construct(ConstrNum).TransDiff; + TransDiff = state.dataConstruction->Construct(ConstrNum).TransDiff; } else if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn || ShadeFlag == BGShadeOn || ShadeFlag == ExtScreenOn) { - TransDiff = dataConstruction.Construct(ConstrNumSh).TransDiff; + TransDiff = state.dataConstruction->Construct(ConstrNumSh).TransDiff; } else if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn || ShadeFlag == BGBlindOn) { TransDiff = - InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), dataConstruction.Construct(ConstrNumSh).BlTransDiff); + InterpSlatAng(SurfWinSlatAngThisTS(SurfNum), SurfWinMovableSlats(SurfNum), state.dataConstruction->Construct(ConstrNumSh).BlTransDiff); } else if (ShadeFlag == SwitchableGlazing) { - TransDiff = InterpSw(SurfWinSwitchingFactor(SurfNum), dataConstruction.Construct(ConstrNum).TransDiff, dataConstruction.Construct(ConstrNumSh).TransDiff); + TransDiff = InterpSw(SurfWinSwitchingFactor(SurfNum), state.dataConstruction->Construct(ConstrNum).TransDiff, state.dataConstruction->Construct(ConstrNumSh).TransDiff); } SurfWinHeatGain(SurfNum) -= QS(Surface(SurfNum).SolarEnclIndex) * Surface(SurfNum).Area * TransDiff; SurfWinHeatTransfer(SurfNum) -= QS(Surface(SurfNum).SolarEnclIndex) * Surface(SurfNum).Area * TransDiff; @@ -3668,16 +3668,16 @@ namespace WindowManager { ConstrNumSh = Surface(SurfNum).activeShadedConstruction; if (SurfWinStormWinFlag(SurfNum) == 1) ConstrNumSh = Surface(SurfNum).activeStormWinShadedConstruction; ShadeFlag = SurfWinShadingFlag(SurfNum); - nglassfaces = 2 * dataConstruction.Construct(ConstrNumSh).TotGlassLayers; - TotGaps = dataConstruction.Construct(ConstrNumSh).TotGlassLayers; + nglassfaces = 2 * state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; + TotGaps = state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; if (ShadeFlag == IntShadeOn || ShadeFlag == IntBlindOn) { // Interior shade or blind - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(nglassfaces); + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(nglassfaces); TGapInlet = state.dataWindowManager->tin; TGlassFace = state.dataWindowManager->thetas(nglassfaces); TShadeFace = state.dataWindowManager->thetas(nglassfaces + 1); } else { // Exterior shade, screen or blind - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(1); + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1); TGapInlet = state.dataWindowManager->tout; TGlassFace = state.dataWindowManager->thetas(1); TShadeFace = state.dataWindowManager->thetas(nglassfaces + 2); @@ -3865,17 +3865,17 @@ namespace WindowManager { ConstrNumSh = Surface(SurfNum).activeShadedConstruction; ShadeFlag = SurfWinShadingFlag(SurfNum); - nglassfaces = 2 * dataConstruction.Construct(ConstrNumSh).TotGlassLayers; + nglassfaces = 2 * state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; - if (dataConstruction.Construct(ConstrNumSh).TotGlassLayers == 2) { // Double glazing - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(3); + if (state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers == 2) { // Double glazing + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(3); IGapInc = 0; for (IGap = 1; IGap <= 2; ++IGap) { TGlassFace(IGap) = state.dataWindowManager->thetas(IGap + 1); TShadeFace(IGap) = state.dataWindowManager->thetas(IGap + 4); } } else { // Triple glazing - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(5); + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(5); IGapInc = 1; for (IGap = 1; IGap <= 2; ++IGap) { TGlassFace(IGap) = state.dataWindowManager->thetas(IGap + 3); @@ -4044,7 +4044,7 @@ namespace WindowManager { // DATA AirProps / 1.29, -0.4d-2, 2.41d-2, 7.6d-5, 1.73d-5, 1.0d-7, 0.72, 1.8d-3 / ConstrNum = Surface(SurfNum).Construction; - NGlass = dataConstruction.Construct(ConstrNum).TotGlassLayers; + NGlass = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; TGlassFace1 = state.dataWindowManager->thetas(2 * NGlass - 2); TGlassFace2 = state.dataWindowManager->thetas(2 * NGlass - 1); GapNum = NGlass - 1; @@ -4067,7 +4067,7 @@ namespace WindowManager { NusseltNumber(state, SurfNum, TGlassFace1, TGlassFace2, GapNum, gr, pr, nu); hGapStill = con / state.dataWindowManager->gap(GapNum) * nu; GapHeight = Surface(SurfNum).Height; - GapDepth = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(2 * NGlass - 2)).Thickness; + GapDepth = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(2 * NGlass - 2)).Thickness; AGap = GapDepth * Surface(SurfNum).Width; VGap = SurfWinAirflowThisTS(SurfNum) / GapDepth; hcv = 2.0 * hGapStill + 4.0 * VGap; @@ -4160,15 +4160,15 @@ namespace WindowManager { ConstrNumSh = Surface(SurfNum).activeShadedConstruction; ShadeFlag = SurfWinShadingFlag(SurfNum); - if (dataConstruction.Construct(ConstrNumSh).TotGlassLayers == 2) { // Double glazing - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(3); + if (state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers == 2) { // Double glazing + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(3); IGapInc = 0; for (IGap = 1; IGap <= 2; ++IGap) { TGlassFace(IGap) = state.dataWindowManager->thetas(IGap + 1); TShadeFace(IGap) = state.dataWindowManager->thetas(IGap + 4); } } else { // Triple glazing - MatNumSh = dataConstruction.Construct(ConstrNumSh).LayerPoint(5); + MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(5); IGapInc = 1; for (IGap = 1; IGap <= 2; ++IGap) { TGlassFace(IGap) = state.dataWindowManager->thetas(IGap + 3); @@ -5798,10 +5798,10 @@ namespace WindowManager { TOutRad = root_4(Outir / state.dataWindowManager->sigma); ShadeFlag = SurfWinShadingFlag(SurfNum); FrDivNum = Surface(SurfNum).FrameDivider; - TotLayers = dataConstruction.Construct(ConstrNum).TotLayers; - TotGlassLayers = dataConstruction.Construct(ConstrNum).TotSolidLayers; - EmisGlassOut = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; - EmisGlassIn = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(TotLayers)).AbsorpThermalBack; + TotLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; + TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotSolidLayers; + EmisGlassOut = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; + EmisGlassIn = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers)).AbsorpThermalBack; FrameHeatGain = 0.0; DividerHeatGain = 0.0; SurfWinFrameHeatGain(SurfNum) = 0.0; @@ -5870,8 +5870,8 @@ namespace WindowManager { DivEmisIn = SurfWinDividerEmis(SurfNum); DivEmisOut = DivEmisIn; } else { // Suspended (between-glass) divider - DivEmisOut = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; - DivEmisIn = dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(dataConstruction.Construct(ConstrNum).TotLayers)).AbsorpThermalBack; + DivEmisOut = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)).AbsorpThermalFront; + DivEmisIn = dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataConstruction->Construct(ConstrNum).TotLayers)).AbsorpThermalBack; } TOutRadDiv = TOutRad * root_4((1.0 + SurfWinProjCorrDivOut(SurfNum)) / (1.0 + 2.0 * SurfWinProjCorrDivOut(SurfNum))); @@ -6093,8 +6093,8 @@ namespace WindowManager { Rbare = 0.0; // Autodesk:Uninit Force default initialization errFlag = 0; - TotLay = dataConstruction.Construct(ConstrNum).TotLayers; - TotGlassLay = dataConstruction.Construct(ConstrNum).TotGlassLayers; + TotLay = state.dataConstruction->Construct(ConstrNum).TotLayers; + TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; state.dataWindowManager->ngllayer = TotGlassLay; // Autodesk:Uninit This routine needs to check/enforce 1<=ngllayer<=4 // EPTeam - believe that is done on input. state.dataWindowManager->nglface = 2 * state.dataWindowManager->ngllayer; @@ -6139,8 +6139,8 @@ namespace WindowManager { // Determine whether construction has an exterior or interior shade or blind ShadeFlag = NoShade; ShadeRes = 0.0; - MatOutside = dataConstruction.Construct(ConstrNum).LayerPoint(1); - MatInside = dataConstruction.Construct(ConstrNum).LayerPoint(TotLay); + MatOutside = state.dataConstruction->Construct(ConstrNum).LayerPoint(1); + MatInside = state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLay); if (dataMaterial.Material(MatOutside).Group == 2) { // Exterior shade present MatShade = MatOutside; ShadeFlag = ExtShadeOn; @@ -6165,11 +6165,11 @@ namespace WindowManager { BlNum = dataMaterial.Material(MatShade).BlindDataPtr; ShadeFlag = IntBlindOn; } else if (TotGlassLay == 2) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(3)).Group == 2) ShadeFlag = BGShadeOn; - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(3)).Group == 5) ShadeFlag = BGBlindOn; + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3)).Group == 2) ShadeFlag = BGShadeOn; + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3)).Group == 5) ShadeFlag = BGBlindOn; } else if (TotGlassLay == 3) { - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(5)).Group == 2) ShadeFlag = BGShadeOn; - if (dataMaterial.Material(dataConstruction.Construct(ConstrNum).LayerPoint(5)).Group == 5) ShadeFlag = BGBlindOn; + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5)).Group == 2) ShadeFlag = BGShadeOn; + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5)).Group == 5) ShadeFlag = BGBlindOn; } if (ShadeFlag == BGShadeOn || ShadeFlag == BGBlindOn) { @@ -6177,28 +6177,28 @@ namespace WindowManager { return; } - TSolNorm = POLYF(1.0, dataConstruction.Construct(ConstrNum).TransSolBeamCoef); - TVisNorm = POLYF(1.0, dataConstruction.Construct(ConstrNum).TransVisBeamCoef); + TSolNorm = POLYF(1.0, state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); + TVisNorm = POLYF(1.0, state.dataConstruction->Construct(ConstrNum).TransVisBeamCoef); AbsBeamShadeNorm = 0.0; if (ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn) { // Exterior or interior shade on - AbsBeamShadeNorm = POLYF(1.0, dataConstruction.Construct(ConstrNum).AbsBeamShadeCoef); + AbsBeamShadeNorm = POLYF(1.0, state.dataConstruction->Construct(ConstrNum).AbsBeamShadeCoef); // Exterior blind or screen or interior blind on } else if (ShadeFlag == IntBlindOn || ShadeFlag == ExtBlindOn || ShadeFlag == ExtScreenOn) { // Find unshaded construction that goes with this construction w/blind or screen ConstrNumBare = 0; for (ConstrNum1 = 1; ConstrNum1 <= TotConstructs; ++ConstrNum1) { - if (ConstrNum1 != ConstrNum && dataConstruction.Construct(ConstrNum1).TypeIsWindow && - dataConstruction.Construct(ConstrNum1).TotGlassLayers == dataConstruction.Construct(ConstrNum1).TotSolidLayers && - dataConstruction.Construct(ConstrNum1).TotGlassLayers == dataConstruction.Construct(ConstrNum).TotGlassLayers) { + if (ConstrNum1 != ConstrNum && state.dataConstruction->Construct(ConstrNum1).TypeIsWindow && + state.dataConstruction->Construct(ConstrNum1).TotGlassLayers == state.dataConstruction->Construct(ConstrNum1).TotSolidLayers && + state.dataConstruction->Construct(ConstrNum1).TotGlassLayers == state.dataConstruction->Construct(ConstrNum).TotGlassLayers) { // We have an unshaded window construction with the same number of glass layers as ConstrNum; // see if the glass and gas layers match ConstrNumBare = ConstrNum1; - for (Lay = 1; Lay <= dataConstruction.Construct(ConstrNum1).TotLayers; ++Lay) { - LayPtr = dataConstruction.Construct(ConstrNum1).LayerPoint(Lay); + for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum1).TotLayers; ++Lay) { + LayPtr = state.dataConstruction->Construct(ConstrNum1).LayerPoint(Lay); if (ShadeFlag == IntBlindOn) { // The shaded construction has an interior blind - LayPtrSh = dataConstruction.Construct(ConstrNum).LayerPoint(Lay); + LayPtrSh = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); } else { // The shaded construction has an exterior blind or screen - LayPtrSh = dataConstruction.Construct(ConstrNum).LayerPoint(Lay + 1); + LayPtrSh = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay + 1); } if (LayPtrSh != LayPtr) ConstrNumBare = 0; } @@ -6211,8 +6211,8 @@ namespace WindowManager { return; } - TBmBm = POLYF(1.0, dataConstruction.Construct(ConstrNumBare).TransSolBeamCoef); - TBmBmVis = POLYF(1.0, dataConstruction.Construct(ConstrNumBare).TransVisBeamCoef); + TBmBm = POLYF(1.0, state.dataConstruction->Construct(ConstrNumBare).TransSolBeamCoef); + TBmBmVis = POLYF(1.0, state.dataConstruction->Construct(ConstrNumBare).TransVisBeamCoef); if (ShadeFlag == ExtScreenOn) { // Don't need to call subroutine, use normal incident properties (SUBROUTINE CalcNominalWindowCond) // Last call to CalcScreenTransmittance(ISurf) was done at direct normal angle (0,0) in CalcWindowScreenProperties @@ -6220,16 +6220,16 @@ namespace WindowManager { TScBmBmVis = SurfaceScreens(ScNum).BmBmTransVis; TScBmDif = SurfaceScreens(ScNum).BmDifTrans; TScBmDifVis = SurfaceScreens(ScNum).BmDifTransVis; - TDif = dataConstruction.Construct(ConstrNumBare).TransDiff; - TDifVis = dataConstruction.Construct(ConstrNumBare).TransDiffVis; + TDif = state.dataConstruction->Construct(ConstrNumBare).TransDiff; + TDifVis = state.dataConstruction->Construct(ConstrNumBare).TransDiffVis; RScBack = SurfaceScreens(ScNum).ReflectScreen; RScBackVis = SurfaceScreens(ScNum).ReflectScreenVis; RScDifBack = SurfaceScreens(ScNum).DifReflect; RScDifBackVis = SurfaceScreens(ScNum).DifReflectVis; - RGlFront = POLYF(1.0, dataConstruction.Construct(ConstrNumBare).ReflSolBeamFrontCoef); - RGlFrontVis = POLYF(1.0, dataConstruction.Construct(ConstrNumBare).ReflSolBeamFrontCoef); - RGlDiffFront = dataConstruction.Construct(ConstrNumBare).ReflectSolDiffFront; - RGlDiffFrontVis = dataConstruction.Construct(ConstrNumBare).ReflectVisDiffFront; + RGlFront = POLYF(1.0, state.dataConstruction->Construct(ConstrNumBare).ReflSolBeamFrontCoef); + RGlFrontVis = POLYF(1.0, state.dataConstruction->Construct(ConstrNumBare).ReflSolBeamFrontCoef); + RGlDiffFront = state.dataConstruction->Construct(ConstrNumBare).ReflectSolDiffFront; + RGlDiffFrontVis = state.dataConstruction->Construct(ConstrNumBare).ReflectVisDiffFront; TSolNorm = TScBmBm * (TBmBm + TDif * RGlFront * RScBack / (1 - RGlDiffFront * RScDifBack)) + TScBmDif * TDif / (1 - RGlDiffFront * RScDifBack); TVisNorm = TScBmBmVis * (TBmBmVis + TDifVis * RGlFrontVis * RScBackVis / (1 - RGlDiffFrontVis * RScDifBackVis)) + @@ -6243,11 +6243,11 @@ namespace WindowManager { TBmBmBlVis = TBmBmVis * TBlBmBm; TBlBmDif = InterpProfSlatAng(0.0, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamDiffTrans); TBlBmDifVis = InterpProfSlatAng(0.0, SlatAng, VarSlats, Blind(BlNum).VisFrontBeamDiffTrans); - TDif = dataConstruction.Construct(ConstrNumBare).TransDiff; - TDifVis = dataConstruction.Construct(ConstrNumBare).TransDiffVis; + TDif = state.dataConstruction->Construct(ConstrNumBare).TransDiff; + TDifVis = state.dataConstruction->Construct(ConstrNumBare).TransDiffVis; if (ShadeFlag == IntBlindOn) { - RGlDiffBack = dataConstruction.Construct(ConstrNumBare).ReflectSolDiffBack; - RGlDiffBackVis = dataConstruction.Construct(ConstrNumBare).ReflectVisDiffBack; + RGlDiffBack = state.dataConstruction->Construct(ConstrNumBare).ReflectSolDiffBack; + RGlDiffBackVis = state.dataConstruction->Construct(ConstrNumBare).ReflectVisDiffBack; RhoBlFront = InterpProfSlatAng(0.0, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamDiffRefl); RhoBlFrontVis = InterpProfSlatAng(0.0, SlatAng, VarSlats, Blind(BlNum).VisFrontBeamDiffRefl); AbsBlFront = InterpProfSlatAng(0.0, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamAbs); @@ -6264,13 +6264,13 @@ namespace WindowManager { } // (IntBlind) if (ShadeFlag == ExtBlindOn) { TBlBmBm = BlindBeamBeamTrans(0.0, SlatAng, Blind(BlNum).SlatWidth, Blind(BlNum).SlatSeparation, Blind(BlNum).SlatThickness); - RGlFront = POLYF(1.0, dataConstruction.Construct(ConstrNumBare).ReflSolBeamFrontCoef); - RGlFrontVis = POLYF(1.0, dataConstruction.Construct(ConstrNumBare).ReflSolBeamFrontCoef); + RGlFront = POLYF(1.0, state.dataConstruction->Construct(ConstrNumBare).ReflSolBeamFrontCoef); + RGlFrontVis = POLYF(1.0, state.dataConstruction->Construct(ConstrNumBare).ReflSolBeamFrontCoef); AbsBlFront = InterpProfSlatAng(0.0, SlatAng, VarSlats, Blind(BlNum).SolFrontBeamAbs); AbsBlBack = InterpProfSlatAng(0.0, SlatAng, VarSlats, Blind(BlNum).SolBackBeamAbs); AbsBlDiffBack = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolBackDiffAbs); - RGlDiffFront = dataConstruction.Construct(ConstrNumBare).ReflectSolDiffFront; - RGlDiffFrontVis = dataConstruction.Construct(ConstrNumBare).ReflectVisDiffFront; + RGlDiffFront = state.dataConstruction->Construct(ConstrNumBare).ReflectSolDiffFront; + RGlDiffFrontVis = state.dataConstruction->Construct(ConstrNumBare).ReflectVisDiffFront; RhoBlDiffBack = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).SolBackDiffDiffRefl); RhoBlDiffBackVis = InterpSlatAng(SlatAng, VarSlats, Blind(BlNum).VisBackDiffDiffRefl); RhoBlBack = InterpProfSlatAng(0.0, SlatAng, VarSlats, Blind(BlNum).SolBackBeamDiffRefl); @@ -6278,7 +6278,7 @@ namespace WindowManager { AbsBeamShadeNorm = AbsBlFront + AbsBlBack * RGlFront * TBlBmBm + (AbsBlDiffBack * RGlDiffFront / (1.0 - RhoBlDiffBack * RGlDiffFront)) * (RGlFront * TBlBmBm * RhoBlBack + TBlBmDif); - RGlDiffFront = dataConstruction.Construct(ConstrNumBare).ReflectSolDiffFront; + RGlDiffFront = state.dataConstruction->Construct(ConstrNumBare).ReflectSolDiffFront; TSolNorm = TBlBmBm * (TBmBm + TDif * RGlFront * RhoBlBack / (1 - RGlDiffFront * RhoBlDiffBack)) + TBlBmDif * TDif / (1.0 - RGlDiffFront * RhoBlDiffBack); TVisNorm = TBlBmBm * (TBmBmVis + TDifVis * RGlFrontVis * RhoBlBackVis / (1 - RGlDiffFrontVis * RhoBlDiffBackVis)) + @@ -6303,7 +6303,7 @@ namespace WindowManager { IGap = 0; for (Lay = 1; Lay <= TotLay; ++Lay) { - LayPtr = dataConstruction.Construct(ConstrNum).LayerPoint(Lay); + LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); if ((dataMaterial.Material(LayPtr).Group == WindowGlass) || (dataMaterial.Material(LayPtr).Group == WindowSimpleGlazing)) { ++IGlass; state.dataWindowManager->thick(IGlass) = dataMaterial.Material(LayPtr).Thickness; @@ -6312,20 +6312,20 @@ namespace WindowManager { state.dataWindowManager->emis(2 * IGlass) = dataMaterial.Material(LayPtr).AbsorpThermalBack; state.dataWindowManager->tir(2 * IGlass - 1) = dataMaterial.Material(LayPtr).TransThermal; state.dataWindowManager->tir(2 * IGlass) = dataMaterial.Material(LayPtr).TransThermal; - AbsBeamNorm(IGlass) = POLYF(1.0, dataConstruction.Construct(ConstrNum).AbsBeamCoef({1, 6}, IGlass)); + AbsBeamNorm(IGlass) = POLYF(1.0, state.dataConstruction->Construct(ConstrNum).AbsBeamCoef({1, 6}, IGlass)); if (ShadeFlag == IntBlindOn) { // Interior blind on - AbsBeamNorm(IGlass) = POLYF(1.0, dataConstruction.Construct(ConstrNumBare).AbsBeamCoef({1, 6}, IGlass)); - AGlDiffBack = dataConstruction.Construct(ConstrNumBare).AbsDiffBack(IGlass); + AbsBeamNorm(IGlass) = POLYF(1.0, state.dataConstruction->Construct(ConstrNumBare).AbsBeamCoef({1, 6}, IGlass)); + AGlDiffBack = state.dataConstruction->Construct(ConstrNumBare).AbsDiffBack(IGlass); AbsBeamNorm(IGlass) += TBmBm * AGlDiffBack * RhoBlFront / (1.0 - RhoBlFront * RGlDiffBack); } else if (ShadeFlag == ExtBlindOn) { // Exterior blind on - AbsBeamNorm(IGlass) = POLYF(1.0, dataConstruction.Construct(ConstrNumBare).AbsBeamCoef({1, 6}, IGlass)); + AbsBeamNorm(IGlass) = POLYF(1.0, state.dataConstruction->Construct(ConstrNumBare).AbsBeamCoef({1, 6}, IGlass)); AbsBeamNorm(IGlass) = TBlBmBm * AbsBeamNorm(IGlass) + (TBlBmBm * RGlFront * RhoBlBack + TBlBmDif) * - dataConstruction.Construct(ConstrNumBare).AbsDiff(IGlass) / + state.dataConstruction->Construct(ConstrNumBare).AbsDiff(IGlass) / (1.0 - RGlDiffFront * RhoBlDiffBack); } else if (ShadeFlag == ExtScreenOn) { // Exterior screen on - AbsBeamNorm(IGlass) = POLYF(1.0, dataConstruction.Construct(ConstrNumBare).AbsBeamCoef({1, 6}, IGlass)); + AbsBeamNorm(IGlass) = POLYF(1.0, state.dataConstruction->Construct(ConstrNumBare).AbsBeamCoef({1, 6}, IGlass)); AbsBeamNorm(IGlass) = TScBmBm * AbsBeamNorm(IGlass) + (TScBmBm * RGlFront * RScBack + TScBmDif) * - dataConstruction.Construct(ConstrNumBare).AbsDiff(IGlass) / + state.dataConstruction->Construct(ConstrNumBare).AbsDiff(IGlass) / (1.0 - RGlDiffFront * RScDifBack); } state.dataWindowManager->AbsRadGlassFace(2 * IGlass - 1) = 0.5 * BeamSolarInc * AbsBeamNorm(IGlass); @@ -6714,7 +6714,7 @@ namespace WindowManager { // No convergence after MaxIterations; and/or error tolerance if (errtemp >= 10 * errtemptol) { // Fatal error: didn't converge - ShowFatalError("Convergence error in WindowTempsForNominalCond for construction " + dataConstruction.Construct(ConstrNum).Name); + ShowFatalError("Convergence error in WindowTempsForNominalCond for construction " + state.dataConstruction->Construct(ConstrNum).Name); } } @@ -6839,10 +6839,10 @@ namespace WindowManager { // EXIT // ENDDO - if (std::any_of(dataConstruction.Construct.begin(), dataConstruction.Construct.end(), [](Construction::ConstructionProps const &e) { return e.TypeIsWindow; })) state.dataWindowManager->HasWindows = true; - if (std::any_of(dataConstruction.Construct.begin(), dataConstruction.Construct.end(), [](Construction::ConstructionProps const &e) { return e.WindowTypeBSDF; })) + if (std::any_of(state.dataConstruction->Construct.begin(), state.dataConstruction->Construct.end(), [](Construction::ConstructionProps const &e) { return e.TypeIsWindow; })) state.dataWindowManager->HasWindows = true; + if (std::any_of(state.dataConstruction->Construct.begin(), state.dataConstruction->Construct.end(), [](Construction::ConstructionProps const &e) { return e.WindowTypeBSDF; })) state.dataWindowManager->HasComplexWindows = true; // Yes, this is a bit different than actually using them. - if (std::any_of(dataConstruction.Construct.begin(), dataConstruction.Construct.end(), [](Construction::ConstructionProps const &e) { return e.WindowTypeEQL; })) + if (std::any_of(state.dataConstruction->Construct.begin(), state.dataConstruction->Construct.end(), [](Construction::ConstructionProps const &e) { return e.WindowTypeEQL; })) state.dataWindowManager->HasEQLWindows = true; // for reporting purpose only // DO ThisNum=1,TotSurfaces @@ -6928,7 +6928,7 @@ namespace WindowManager { for (ThisNum = 1; ThisNum <= TotConstructs; ++ThisNum) { - if (dataConstruction.Construct(ThisNum).WindowTypeBSDF) { + if (state.dataConstruction->Construct(ThisNum).WindowTypeBSDF) { i = ThisNum; CalcComplexWindowThermal(state, 0, i, TempVar, TempVar, TempVar, TempVar, winterCondition); @@ -6937,41 +6937,41 @@ namespace WindowManager { static constexpr auto Format_800(" WindowConstruction:Complex,{},{},{},{:.3R},{:.3R}\n"); print(state.files.eio, Format_800, - dataConstruction.Construct(ThisNum).Name, + state.dataConstruction->Construct(ThisNum).Name, ThisNum, - dataConstruction.Construct(ThisNum).TotSolidLayers, + state.dataConstruction->Construct(ThisNum).TotSolidLayers, NominalU(ThisNum), - dataConstruction.Construct(ThisNum).SummerSHGC); + state.dataConstruction->Construct(ThisNum).SummerSHGC); - } else if (dataConstruction.Construct(ThisNum).TypeIsWindow) { + } else if (state.dataConstruction->Construct(ThisNum).TypeIsWindow) { // Calculate for ASHRAE winter and summer conditions: // (1) nominal center-of-glass conductance, including inside and outside air films, // (2) solar heat gain coefficient (SHGC), // (3) solar transmittance at normal incidence, and (4) visible transmittance at normal incidence. - if (dataConstruction.Construct(ThisNum).WindowTypeEQL) { + if (state.dataConstruction->Construct(ThisNum).WindowTypeEQL) { // for equivalent layer Window already calculated // NominalU(ThisNum)=NominalConductanceWinter // Save the SHGC for later use in tabular report IVRS // Construct(ThisNum)%SummerSHGC = SHGCSummer - dataConstruction.Construct(ThisNum).VisTransNorm = 0.0; // TODO list + state.dataConstruction->Construct(ThisNum).VisTransNorm = 0.0; // TODO list static constexpr auto Format_799(" Construction:WindowEquivalentLayer,{},{},{},{:.3R},{:.3R},{:.3R}\n"); print(state.files.eio, Format_799, - dataConstruction.Construct(ThisNum).Name, + state.dataConstruction->Construct(ThisNum).Name, ThisNum, - dataConstruction.Construct(ThisNum).TotSolidLayers, + state.dataConstruction->Construct(ThisNum).TotSolidLayers, NominalU(ThisNum), - dataConstruction.Construct(ThisNum).SummerSHGC, - dataConstruction.Construct(ThisNum).SolTransNorm); + state.dataConstruction->Construct(ThisNum).SummerSHGC, + state.dataConstruction->Construct(ThisNum).SolTransNorm); } else { CalcNominalWindowCond(state, ThisNum, 1, NominalConductanceWinter, SHGCWinter, TransSolNorm, TransVisNorm, errFlag); if (errFlag == 1) { - ShowWarningError("Window construction " + dataConstruction.Construct(ThisNum).Name + " has an interior or exterior blind"); + ShowWarningError("Window construction " + state.dataConstruction->Construct(ThisNum).Name + " has an interior or exterior blind"); ShowContinueError("but the corresponding construction without the blind cannot be found."); ShowContinueError("The ReportGlass entry for this construction will not be printed in eplusout.eio."); continue; @@ -6981,26 +6981,26 @@ namespace WindowManager { // nominal conductance and SHGC. if (errFlag == 2) { - ShowWarningError("Window construction " + dataConstruction.Construct(ThisNum).Name + " has a between-glass shade or blind"); + ShowWarningError("Window construction " + state.dataConstruction->Construct(ThisNum).Name + " has a between-glass shade or blind"); ShowContinueError("The ReportGlass entry for this construction will not be printed in eplusout.eio."); continue; } NominalU(ThisNum) = NominalConductanceWinter; - if (!dataConstruction.Construct(ThisNum).WindowTypeEQL) { + if (!state.dataConstruction->Construct(ThisNum).WindowTypeEQL) { CalcNominalWindowCond(state, ThisNum, 2, NominalConductanceSummer, SHGCSummer, TransSolNorm, TransVisNorm, errFlag); } // Save the SHGC for later use in tabular report IVRS - dataConstruction.Construct(ThisNum).SummerSHGC = SHGCSummer; - dataConstruction.Construct(ThisNum).VisTransNorm = TransVisNorm; + state.dataConstruction->Construct(ThisNum).SummerSHGC = SHGCSummer; + state.dataConstruction->Construct(ThisNum).VisTransNorm = TransVisNorm; static constexpr auto Format_700(" WindowConstruction,{},{},{},{},{:.3R},{:.3R},{:.3R},{:.3R}\n"); print(state.files.eio, Format_700, - dataConstruction.Construct(ThisNum).Name, + state.dataConstruction->Construct(ThisNum).Name, ThisNum, - dataConstruction.Construct(ThisNum).TotLayers, - Roughness(dataConstruction.Construct(ThisNum).OutsideRoughness), + state.dataConstruction->Construct(ThisNum).TotLayers, + Roughness(state.dataConstruction->Construct(ThisNum).OutsideRoughness), NominalConductanceWinter, SHGCSummer, TransSolNorm, @@ -7008,8 +7008,8 @@ namespace WindowManager { } // Write(OutputFileConstrainParams, 705) TRIM(Construct(ThisNum)%Name), SHGCSummer ,TransVisNorm - for (i = 1; i <= dataConstruction.Construct(ThisNum).TotLayers; ++i) { - Layer = dataConstruction.Construct(ThisNum).LayerPoint(i); + for (i = 1; i <= state.dataConstruction->Construct(ThisNum).TotLayers; ++i) { + Layer = state.dataConstruction->Construct(ThisNum).LayerPoint(i); { auto const SELECT_CASE_var(dataMaterial.Material(Layer).Group); if (SELECT_CASE_var == WindowGas) { @@ -7222,8 +7222,8 @@ namespace WindowManager { for (ThisNum = 1; ThisNum <= TotConstructs; ++ThisNum) { - if (!dataConstruction.Construct(ThisNum).TypeIsWindow) continue; - if (dataConstruction.Construct(ThisNum).WindowTypeEQL) continue; // skip if equivalent layer window + if (!state.dataConstruction->Construct(ThisNum).TypeIsWindow) continue; + if (state.dataConstruction->Construct(ThisNum).WindowTypeEQL) continue; // skip if equivalent layer window // Calculate for ASHRAE winter and summer conditions: (1)nominal center-of-glass conductance, // (2) solar heat gain coefficient (SHGC), including inside and outside air films, @@ -7532,7 +7532,7 @@ namespace WindowManager { if (Surface(SurfNum).HasShadeControl) { ConstrNumSh = Surface(SurfNum).activeShadedConstruction; - MatNum = dataConstruction.Construct(ConstrNumSh).LayerPoint(1); + MatNum = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1); ShadingType = WindowShadingControl(Surface(SurfNum).activeWindowShadingControl).ShadingType; if (ShadingType == WSC_ST_ExteriorScreen) { diff --git a/src/EnergyPlus/WindowManagerExteriorOptical.cc b/src/EnergyPlus/WindowManagerExteriorOptical.cc index 6b77f4c027e..72f53d1733a 100644 --- a/src/EnergyPlus/WindowManagerExteriorOptical.cc +++ b/src/EnergyPlus/WindowManagerExteriorOptical.cc @@ -49,6 +49,7 @@ // EnergyPlus headers #include +#include #include #include #include @@ -185,7 +186,7 @@ namespace WindowManager { auto & aWinConstSimp = CWindowConstructionsSimplified::instance(); for (auto ConstrNum = 1; ConstrNum <= TotConstructs; ++ConstrNum) { - auto &construction(dataConstruction.Construct(ConstrNum)); + auto &construction(state.dataConstruction->Construct(ConstrNum)); if (construction.isGlazingConstruction()) { for (auto LayNum = 1; LayNum <= construction.TotLayers; ++LayNum) { auto &material(dataMaterial.Material(construction.LayerPoint(LayNum))); @@ -214,23 +215,23 @@ namespace WindowManager { for (auto SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { if (!Surface(SurfNum).HeatTransSurf) continue; - if (!dataConstruction.Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; + if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue; if (SurfWinWindowModelType(SurfNum) == WindowBSDFModel) continue; // Irrelevant for Complex Fen - if (dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) continue; // not required + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) continue; // not required auto ConstrNumSh = Surface(SurfNum).activeShadedConstruction; if (ConstrNumSh == 0) continue; - auto TotLay = dataConstruction.Construct(ConstrNumSh).TotLayers; + auto TotLay = state.dataConstruction->Construct(ConstrNumSh).TotLayers; auto IntShade = false; auto IntBlind = false; auto ShadeLayPtr = 0; auto BlNum = 0; - if (dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay)).Group == Shade) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay)).Group == Shade) { IntShade = true; - ShadeLayPtr = dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay); + ShadeLayPtr = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay); } - if (dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay)).Group == WindowBlind) { + if (dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay)).Group == WindowBlind) { IntBlind = true; - BlNum = dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay)).BlindDataPtr; + BlNum = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay)).BlindDataPtr; } if (IntShade || IntBlind) { @@ -238,7 +239,7 @@ namespace WindowManager { auto EpsGlIR = 0.0; auto RhoGlIR = 0.0; if (IntShade || IntBlind) { - EpsGlIR = dataMaterial.Material(dataConstruction.Construct(ConstrNumSh).LayerPoint(TotLay - 1)).AbsorpThermalBack; + EpsGlIR = dataMaterial.Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay - 1)).AbsorpThermalBack; RhoGlIR = 1 - EpsGlIR; } if (IntShade) { diff --git a/src/EnergyPlus/WindowManagerExteriorOptical.hh b/src/EnergyPlus/WindowManagerExteriorOptical.hh index 63a6e808017..349978b7722 100644 --- a/src/EnergyPlus/WindowManagerExteriorOptical.hh +++ b/src/EnergyPlus/WindowManagerExteriorOptical.hh @@ -88,6 +88,9 @@ class CMaterialSingleBand; namespace EnergyPlus { +// Forward declarations +struct EnergyPlusData; + namespace WindowManager { class CWCEIntegrator; diff --git a/src/EnergyPlus/WindowManagerExteriorThermal.cc b/src/EnergyPlus/WindowManagerExteriorThermal.cc index 95020bcf032..4565ddd27d0 100644 --- a/src/EnergyPlus/WindowManagerExteriorThermal.cc +++ b/src/EnergyPlus/WindowManagerExteriorThermal.cc @@ -47,6 +47,7 @@ // EnergyPlus headers #include +#include #include #include #include @@ -96,12 +97,12 @@ namespace WindowManager { auto &window(SurfaceWindow(SurfNum)); auto &surface(Surface(SurfNum)); auto ConstrNum = surface.Construction; - auto &construction(dataConstruction.Construct(ConstrNum)); + auto &construction(state.dataConstruction->Construct(ConstrNum)); auto const solutionTolerance = 0.02; // Tarcog thermal system for solving heat transfer through the window - auto aFactory = CWCEHeatTransferFactory(surface, SurfNum); + auto aFactory = CWCEHeatTransferFactory(state, surface, SurfNum); auto aSystem = aFactory.getTarcogSystem(state, HextConvCoeff); aSystem->setTolerance(solutionTolerance); @@ -226,7 +227,7 @@ namespace WindowManager { SurfWinHeatTransfer(SurfNum) -= QS(surface.SolarEnclIndex) * surface.Area * TransDiff; SurfWinLossSWZoneToOutWinRep(SurfNum) = QS(Surface(SurfNum).SolarEnclIndex) * surface.Area * TransDiff; - for (auto k = 1; k <= surface.getTotLayers(); ++k) { + for (auto k = 1; k <= surface.getTotLayers(state); ++k) { SurfaceWindow(SurfNum).ThetaFace(2 * k - 1) = state.dataWindowManager->thetas(2 * k - 1); SurfaceWindow(SurfNum).ThetaFace(2 * k) = state.dataWindowManager->thetas(2 * k); @@ -240,7 +241,7 @@ namespace WindowManager { // CWCEHeatTransferFactory ///////////////////////////////////////////////////////////////////////////////////////// - CWCEHeatTransferFactory::CWCEHeatTransferFactory(SurfaceData const &surface, int const t_SurfNum) + CWCEHeatTransferFactory::CWCEHeatTransferFactory(EnergyPlusData &state, SurfaceData const &surface, int const t_SurfNum) : m_Surface(surface), m_SurfNum(t_SurfNum), m_SolidLayerIndex(0), m_InteriorBSDFShade(false), m_ExteriorShade(false) { m_Window = SurfaceWindow(t_SurfNum); @@ -255,7 +256,7 @@ namespace WindowManager { if (SurfWinStormWinFlag(t_SurfNum) > 0) m_ConstructionNumber = m_Surface.activeStormWinShadedConstruction; } - m_TotLay = getNumOfLayers(); + m_TotLay = getNumOfLayers(state); if (ShadeFlag == IntShadeOn || ShadeFlag == IntBlindOn) { m_ShadePosition = ShadePosition::Interior; @@ -279,17 +280,17 @@ namespace WindowManager { // pick-up all layers and put them in IGU (this includes gap layers as well) for (auto i = 0; i < m_TotLay; ++i) { - auto aLayer = getIGULayer(i + 1); + auto aLayer = getIGULayer(state, i + 1); assert(aLayer != nullptr); // IDF for "standard" windows do not insert gas between glass and shade. Tarcog needs that gas // and it will be created here if (m_ShadePosition == ShadePosition::Interior && i == m_TotLay - 1) { - auto aAirLayer = getShadeToGlassLayer(i + 1); + auto aAirLayer = getShadeToGlassLayer(state, i + 1); aIGU->addLayer(aAirLayer); } aIGU->addLayer(aLayer); if (m_ShadePosition == ShadePosition::Exterior && i == 0) { - auto aAirLayer = getShadeToGlassLayer(i + 1); + auto aAirLayer = getShadeToGlassLayer(state, i + 1); aIGU->addLayer(aAirLayer); } } @@ -300,7 +301,7 @@ namespace WindowManager { } ///////////////////////////////////////////////////////////////////////////////////////// - Material::MaterialProperties *CWCEHeatTransferFactory::getLayerMaterial(int const t_Index) const + Material::MaterialProperties *CWCEHeatTransferFactory::getLayerMaterial(EnergyPlusData &state, int const t_Index) const { auto ConstrNum = m_Surface.Construction; @@ -311,17 +312,17 @@ namespace WindowManager { if (SurfWinStormWinFlag(m_SurfNum) > 0) ConstrNum = m_Surface.activeStormWinShadedConstruction; } - auto &construction(dataConstruction.Construct(ConstrNum)); + auto &construction(state.dataConstruction->Construct(ConstrNum)); auto LayPtr = construction.LayerPoint(t_Index); return &dataMaterial.Material(LayPtr); } ///////////////////////////////////////////////////////////////////////////////////////// - std::shared_ptr CWCEHeatTransferFactory::getIGULayer(int const t_Index) + std::shared_ptr CWCEHeatTransferFactory::getIGULayer(EnergyPlusData &state, int const t_Index) { std::shared_ptr aLayer = nullptr; - auto material = getLayerMaterial(t_Index); + auto material = getLayerMaterial(state, t_Index); auto matGroup = material->Group; @@ -339,9 +340,9 @@ namespace WindowManager { } ///////////////////////////////////////////////////////////////////////////////////////// - int CWCEHeatTransferFactory::getNumOfLayers() const + int CWCEHeatTransferFactory::getNumOfLayers(EnergyPlusData &state) const { - return dataConstruction.Construct(m_ConstructionNumber).TotLayers; + return state.dataConstruction->Construct(m_ConstructionNumber).TotLayers; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -486,7 +487,7 @@ namespace WindowManager { } ///////////////////////////////////////////////////////////////////////////////////////// - std::shared_ptr CWCEHeatTransferFactory::getShadeToGlassLayer(int const t_Index) const + std::shared_ptr CWCEHeatTransferFactory::getShadeToGlassLayer(EnergyPlusData &state, int const t_Index) const { // SUBROUTINE INFORMATION: // AUTHOR Simon Vidanovic @@ -504,7 +505,7 @@ namespace WindowManager { thickness = Blind(SurfWinBlindNumber(m_SurfNum)).BlindToGlassDist; } if (SurfWinShadingFlag(m_SurfNum) == IntShadeOn || SurfWinShadingFlag(m_SurfNum) == ExtShadeOn || SurfWinShadingFlag(m_SurfNum) == ExtScreenOn) { - auto material = getLayerMaterial(t_Index); + auto material = getLayerMaterial(state, t_Index); thickness = material->WinShadeToGlassDist; } std::shared_ptr aLayer = std::make_shared(thickness, pres, aGas); diff --git a/src/EnergyPlus/WindowManagerExteriorThermal.hh b/src/EnergyPlus/WindowManagerExteriorThermal.hh index 61da95534f8..7d23e19ac2c 100644 --- a/src/EnergyPlus/WindowManagerExteriorThermal.hh +++ b/src/EnergyPlus/WindowManagerExteriorThermal.hh @@ -78,6 +78,9 @@ class CGas; namespace EnergyPlus { +// Forward declarations +struct EnergyPlusData; + namespace WindowManager { enum class ShadePosition @@ -100,11 +103,11 @@ namespace WindowManager { class CWCEHeatTransferFactory { public: - CWCEHeatTransferFactory(EnergyPlus::DataSurfaces::SurfaceData const &surface, int const t_SurfNum); + CWCEHeatTransferFactory(EnergyPlusData &state, EnergyPlus::DataSurfaces::SurfaceData const &surface, int const t_SurfNum); std::shared_ptr getTarcogSystem(EnergyPlusData &state, Real64 const t_HextConvCoeff); - std::shared_ptr getIGULayer(int const t_Index); + std::shared_ptr getIGULayer(EnergyPlusData &state, int const t_Index); std::shared_ptr getIndoor() const; std::shared_ptr getOutdoor(EnergyPlusData &state, Real64 const t_Hext) const; std::shared_ptr getIGU(); @@ -129,7 +132,7 @@ namespace WindowManager { bool m_InteriorBSDFShade; bool m_ExteriorShade; - int getNumOfLayers() const; + int getNumOfLayers(EnergyPlusData &state) const; std::shared_ptr getSolidLayer(DataSurfaces::SurfaceData const &surface, Material::MaterialProperties const &material, @@ -138,13 +141,13 @@ namespace WindowManager { std::shared_ptr getGapLayer(Material::MaterialProperties const &material) const; - std::shared_ptr getShadeToGlassLayer(int const t_Index) const; + std::shared_ptr getShadeToGlassLayer(EnergyPlusData &state, int const t_Index) const; std::shared_ptr getComplexGapLayer(Material::MaterialProperties const &material) const; std::shared_ptr getGas(Material::MaterialProperties const &material) const; std::shared_ptr getAir() const; - Material::MaterialProperties *getLayerMaterial(int const t_Index) const; + Material::MaterialProperties *getLayerMaterial(EnergyPlusData &state, int const t_Index) const; }; } // namespace WindowManager diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index c7cfd829886..04a1d77c293 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -92,6 +92,7 @@ #include #include #include +#include #include #include #include @@ -6291,7 +6292,7 @@ namespace ZoneTempPredictorCorrector { } // Other convection term is applicable to equivalent layer window (ASHWAT) model - if (dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) SumIntGain += SurfWinOtherConvHeatGain(SurfNum); + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) SumIntGain += SurfWinOtherConvHeatGain(SurfNum); // Convective heat gain from natural convection in gap between glass and interior shade or blind if (shading_flag == IntShadeOn || shading_flag == IntBlindOn) SumIntGain += SurfWinConvHeatFlowNatural(SurfNum); @@ -6626,7 +6627,7 @@ namespace ZoneTempPredictorCorrector { } // Other convection term is applicable to equivalent layer window (ASHWAT) model - if (dataConstruction.Construct(Surface(SurfNum).Construction).WindowTypeEQL) SumIntGains += SurfWinOtherConvHeatGain(SurfNum); + if (state.dataConstruction->Construct(Surface(SurfNum).Construction).WindowTypeEQL) SumIntGains += SurfWinOtherConvHeatGain(SurfNum); // Convective heat gain from natural convection in gap between glass and interior shade or blind if (SurfWinShadingFlag(SurfNum) == IntShadeOn || SurfWinShadingFlag(SurfNum) == IntBlindOn) @@ -7140,21 +7141,21 @@ namespace ZoneTempPredictorCorrector { if (SELECT_CASE_var == static_cast(AverageMethod::NO)) { PeopleNum = ComfortControlledZone(RelativeZoneNum).SpecificObjectNum; if (ComfortControlType(ActualZoneNum) == static_cast(ComfortControl::SglCoolSetPointFanger)) { - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, SetPointLo); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, SetPointLo); } else { - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, SetPointLo); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, SetPointLo); } if (ComfortControlType(ActualZoneNum) == static_cast(ComfortControl::DualSetPointFanger)) - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, SetPointHi); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, SetPointHi); } else if (SELECT_CASE_var == static_cast(AverageMethod::SPE)) { PeopleNum = ComfortControlledZone(RelativeZoneNum).SpecificObjectNum; if (ComfortControlType(ActualZoneNum) == static_cast(ComfortControl::SglCoolSetPointFanger)) { - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, SetPointLo); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, SetPointLo); } else { - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, SetPointLo); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, SetPointLo); } if (ComfortControlType(ActualZoneNum) == static_cast(ComfortControl::DualSetPointFanger)) - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, SetPointHi); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, SetPointHi); } else if (SELECT_CASE_var == static_cast(AverageMethod::OBJ)) { ObjectCount = 0; SetPointLo = 0.0; @@ -7162,10 +7163,10 @@ namespace ZoneTempPredictorCorrector { for (PeopleNum = 1; PeopleNum <= TotPeople; ++PeopleNum) { if (ActualZoneNum == People(PeopleNum).ZonePtr) { ++ObjectCount; - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, Tset); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, Tset); SetPointLo += Tset; if (ComfortControlType(ActualZoneNum) == static_cast(ComfortControl::DualSetPointFanger)) { - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, Tset); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, Tset); SetPointHi += Tset; } } @@ -7180,10 +7181,10 @@ namespace ZoneTempPredictorCorrector { if (ActualZoneNum == People(PeopleNum).ZonePtr) { NumberOccupants = People(PeopleNum).NumberOfPeople * GetCurrentScheduleValue(People(PeopleNum).NumberOfPeoplePtr); PeopleCount += NumberOccupants; - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, Tset); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, Tset); SetPointLo += Tset * NumberOccupants; if (ComfortControlType(ActualZoneNum) == static_cast(ComfortControl::DualSetPointFanger)) { - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, Tset); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, Tset); SetPointHi += Tset * NumberOccupants; } } @@ -7212,10 +7213,10 @@ namespace ZoneTempPredictorCorrector { for (PeopleNum = 1; PeopleNum <= TotPeople; ++PeopleNum) { if (ActualZoneNum == People(PeopleNum).ZonePtr) { ++ObjectCount; - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, Tset); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).LowPMV, Tset); SetPointLo += Tset; if (ComfortControlType(ActualZoneNum) == static_cast(ComfortControl::DualSetPointFanger)) { - GetComfortSetPoints(PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, Tset); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, ZoneComfortControlsFanger(ActualZoneNum).HighPMV, Tset); SetPointHi += Tset; } } @@ -7365,7 +7366,8 @@ namespace ZoneTempPredictorCorrector { } } - void GetComfortSetPoints(int const PeopleNum, + void GetComfortSetPoints(EnergyPlusData &state, + int const PeopleNum, int const ComfortControlNum, Real64 const PMVSet, Real64 &Tset // drybulb setpoint temperature for a given PMV value @@ -7410,14 +7412,14 @@ namespace ZoneTempPredictorCorrector { Tmin = ComfortControlledZone(ComfortControlNum).TdbMinSetPoint; Tmax = ComfortControlledZone(ComfortControlNum).TdbMaxSetPoint; - CalcThermalComfortFanger(PeopleNum, Tmin, PMVResult); + CalcThermalComfortFanger(state, PeopleNum, Tmin, PMVResult); PMVMin = PMVResult; - CalcThermalComfortFanger(PeopleNum, Tmax, PMVResult); + CalcThermalComfortFanger(state, PeopleNum, Tmax, PMVResult); PMVMax = PMVResult; if (PMVSet > PMVMin && PMVSet < PMVMax) { Par(1) = PMVSet; Par(2) = double(PeopleNum); - SolveRoot(Acc, MaxIter, SolFla, Tset, PMVResidual, Tmin, Tmax, Par); + TempSolveRoot::SolveRoot(state, Acc, MaxIter, SolFla, Tset, PMVResidual, Tmin, Tmax, Par); if (SolFla == -1) { if (!WarmupFlag) { ++IterLimitExceededNum1; @@ -7454,7 +7456,8 @@ namespace ZoneTempPredictorCorrector { } } - Real64 PMVResidual(Real64 const Tset, + Real64 PMVResidual(EnergyPlusData &state, + Real64 const Tset, Array1D const &Par // par(1) = PMV set point ) { @@ -7482,7 +7485,7 @@ namespace ZoneTempPredictorCorrector { Real64 PMVresult; // resulting PMV values PeopleNum = int(Par(2)); - CalcThermalComfortFanger(PeopleNum, Tset, PMVresult); + CalcThermalComfortFanger(state, PeopleNum, Tset, PMVresult); PMVResidual = Par(1) - PMVresult; return PMVResidual; } diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.hh b/src/EnergyPlus/ZoneTempPredictorCorrector.hh index 0e174193960..f038f9c3605 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.hh +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.hh @@ -317,13 +317,15 @@ namespace ZoneTempPredictorCorrector { void CalcZoneAirComfortSetPoints(EnergyPlusData& state); - void GetComfortSetPoints(int const PeopleNum, + void GetComfortSetPoints(EnergyPlusData &state, + int const PeopleNum, int const ComfortControlNum, Real64 const PMVSet, Real64 &Tset // drybulb setpoint temperature for a given PMV value ); - Real64 PMVResidual(Real64 const Tset, + Real64 PMVResidual(EnergyPlusData &state, + Real64 const Tset, Array1D const &Par // par(1) = PMV set point ); diff --git a/src/EnergyPlus/api/datatransfer.cc b/src/EnergyPlus/api/datatransfer.cc index 69ed0a4a49c..259003995da 100644 --- a/src/EnergyPlus/api/datatransfer.cc +++ b/src/EnergyPlus/api/datatransfer.cc @@ -664,10 +664,11 @@ int kindOfSim(EnergyPlusState) { return EnergyPlus::DataGlobals::KindOfSim; } -int getConstructionHandle(EnergyPlusState, const char* constructionName) { +int getConstructionHandle(EnergyPlusState state, const char* constructionName) { int handle = 0; std::string const nameUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(constructionName); - for (auto const & construct : EnergyPlus::dataConstruction.Construct) { + auto thisState = reinterpret_cast(state); + for (auto const & construct : thisState->dataConstruction->Construct) { handle++; std::string const thisNameUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(construct.Name); if (nameUC == thisNameUC) { diff --git a/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc b/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc index f41fb39da2a..b4576e45eeb 100644 --- a/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc +++ b/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc @@ -85,5 +85,5 @@ TEST_F(EnergyPlusFixture, ConstructionInternalSource) GetConstructData(state, errorsFound); - EXPECT_NEAR(0.1524, dataConstruction.Construct(1).ThicknessPerpend, 0.0001); + EXPECT_NEAR(0.1524, state.dataConstruction->Construct(1).ThicknessPerpend, 0.0001); } diff --git a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc index ba7bdb1efbd..dbec445c6bb 100644 --- a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc +++ b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc @@ -597,14 +597,14 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateIntHcModelsFisherPedersen) DataSurfaces::TotSurfaces = 1; DataGlobals::NumOfZones = 1; DataSurfaces::Surface.allocate( 1 ); - dataConstruction.Construct.allocate( 1 ); + state.dataConstruction->Construct.allocate( 1 ); DataHeatBalance::Zone.allocate( 1 ); DataLoopNode::Node.allocate( 1 ); DataSurfaces::Surface( SurfNum ).Zone = 1; DataSurfaces::Surface( SurfNum ).Construction = 1; DataSurfaces::Surface(SurfNum).TAirRef = 0; - dataConstruction.Construct( 1 ).TypeIsWindow = false; + state.dataConstruction->Construct( 1 ).TypeIsWindow = false; DataHeatBalance::Zone( 1 ).SystemZoneNodeNumber = 1; DataHeatBalance::Zone( 1 ).Multiplier = 1.0; DataHeatBalance::Zone( 1 ).ListMultiplier = 1.0; diff --git a/tst/EnergyPlus/unit/DataHeatBalance.unit.cc b/tst/EnergyPlus/unit/DataHeatBalance.unit.cc index 9b143832b53..022a8f7a46e 100644 --- a/tst/EnergyPlus/unit/DataHeatBalance.unit.cc +++ b/tst/EnergyPlus/unit/DataHeatBalance.unit.cc @@ -831,62 +831,62 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_CheckConstructLayers) ErrorsFound = false; SurfaceGeometry::SetupZoneGeometry(state, - ErrorsFound); // this calls GetSurfaceData() and SetFlagForWindowConstructionWithShadeOrBlindLayer() + ErrorsFound); // this calls GetSurfaceData() and SetFlagForWindowConstructionWithShadeOrBlindLayer(state) EXPECT_FALSE(ErrorsFound); - EXPECT_EQ(dataConstruction.Construct(4).Name, "WIN-CON-DOUBLEPANE"); // glass, air gap, glass - EXPECT_EQ(dataConstruction.Construct(4).TotLayers, 3); // outer glass, air gap, inner glass - EXPECT_EQ(dataConstruction.Construct(4).TotGlassLayers, 2); // outer glass, inner glass - EXPECT_EQ(dataConstruction.Construct(4).TotSolidLayers, 2); // outer glass, inner glass + EXPECT_EQ(state.dataConstruction->Construct(4).Name, "WIN-CON-DOUBLEPANE"); // glass, air gap, glass + EXPECT_EQ(state.dataConstruction->Construct(4).TotLayers, 3); // outer glass, air gap, inner glass + EXPECT_EQ(state.dataConstruction->Construct(4).TotGlassLayers, 2); // outer glass, inner glass + EXPECT_EQ(state.dataConstruction->Construct(4).TotSolidLayers, 2); // outer glass, inner glass EXPECT_EQ(dataMaterial.Material(4).Name, "SINGLEPANE"); // single pane glass EXPECT_EQ(dataMaterial.Material(5).Name, "WINGAS"); // air gap EXPECT_EQ(dataMaterial.Material(6).Name, "BLIND"); // window blind // construction layer material pointers. this construction has no blind - EXPECT_EQ(dataConstruction.Construct(4).LayerPoint(1), 4); // glass, outer layer - EXPECT_EQ(dataConstruction.Construct(4).LayerPoint(2), 5); // air gap - EXPECT_EQ(dataConstruction.Construct(4).LayerPoint(3), 4); // glass, inner layer + EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(1), 4); // glass, outer layer + EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(2), 5); // air gap + EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(3), 4); // glass, inner layer int windowSurfNum = UtilityRoutines::FindItemInList("ZN001:WALL001:WIN001", DataSurfaces::Surface); EXPECT_FALSE(SurfWinHasShadeOrBlindLayer(windowSurfNum)); // the window construction has no blind // check if the construction has a blind material layer - SetFlagForWindowConstructionWithShadeOrBlindLayer(); + SetFlagForWindowConstructionWithShadeOrBlindLayer(state); EXPECT_FALSE(SurfWinHasShadeOrBlindLayer(windowSurfNum)); // the window construction has no blind GetEMSInput(state); // check if EMS actuator is not setup because there is no blind/shade layer - SetupWindowShadingControlActuators(); + SetupWindowShadingControlActuators(state); EXPECT_EQ(numEMSActuatorsAvailable, 0); // no EMS actuator because there is shade/blind layer // add a blind layer in between glass - dataConstruction.Construct(4).TotLayers = 5; - dataConstruction.Construct(4).TotGlassLayers = 2; - dataConstruction.Construct(4).TotSolidLayers = 3; - dataConstruction.Construct(4).LayerPoint(1) = 4; // glass - dataConstruction.Construct(4).LayerPoint(2) = 5; // air gap - dataConstruction.Construct(4).LayerPoint(3) = 6; // window blind - dataConstruction.Construct(4).LayerPoint(4) = 5; // air gap - dataConstruction.Construct(4).LayerPoint(5) = 4; // glass + state.dataConstruction->Construct(4).TotLayers = 5; + state.dataConstruction->Construct(4).TotGlassLayers = 2; + state.dataConstruction->Construct(4).TotSolidLayers = 3; + state.dataConstruction->Construct(4).LayerPoint(1) = 4; // glass + state.dataConstruction->Construct(4).LayerPoint(2) = 5; // air gap + state.dataConstruction->Construct(4).LayerPoint(3) = 6; // window blind + state.dataConstruction->Construct(4).LayerPoint(4) = 5; // air gap + state.dataConstruction->Construct(4).LayerPoint(5) = 4; // glass // updated contruction and material layers data - EXPECT_EQ(dataConstruction.Construct(4).TotLayers, 5); // outer glass, air gap, blind, air gap, inner glass - EXPECT_EQ(dataConstruction.Construct(4).TotGlassLayers, 2); // outer glass, inner glass - EXPECT_EQ(dataConstruction.Construct(4).TotSolidLayers, 3); // glass, blind, glass + EXPECT_EQ(state.dataConstruction->Construct(4).TotLayers, 5); // outer glass, air gap, blind, air gap, inner glass + EXPECT_EQ(state.dataConstruction->Construct(4).TotGlassLayers, 2); // outer glass, inner glass + EXPECT_EQ(state.dataConstruction->Construct(4).TotSolidLayers, 3); // glass, blind, glass // construction layer material pointers. this construction has blind - EXPECT_EQ(dataConstruction.Construct(4).LayerPoint(1), 4); // glass, outer layer - EXPECT_EQ(dataConstruction.Construct(4).LayerPoint(2), 5); // air gap - EXPECT_EQ(dataConstruction.Construct(4).LayerPoint(3), 6); // blind - EXPECT_EQ(dataConstruction.Construct(4).LayerPoint(4), 5); // air gap - EXPECT_EQ(dataConstruction.Construct(4).LayerPoint(5), 4); // glass, inner layer + EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(1), 4); // glass, outer layer + EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(2), 5); // air gap + EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(3), 6); // blind + EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(4), 5); // air gap + EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(5), 4); // glass, inner layer // check if the construction has a blind material layer - SetFlagForWindowConstructionWithShadeOrBlindLayer(); + SetFlagForWindowConstructionWithShadeOrBlindLayer(state); EXPECT_TRUE(SurfWinHasShadeOrBlindLayer(windowSurfNum)); // the window construction has blind // set the blind to movable SurfWinMovableSlats(windowSurfNum) = true; // check if EMS actuator is available when blind layer is added - SetupWindowShadingControlActuators(); + SetupWindowShadingControlActuators(state); EXPECT_EQ(numEMSActuatorsAvailable, 2); EXPECT_EQ(EMSActuatorAvailable(1).ComponentTypeName, "Window Shading Control"); EXPECT_EQ(EMSActuatorAvailable(1).ControlTypeName, "Control Status"); @@ -903,8 +903,8 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_setUserTemperatureLocationPerpendicula Real64 expectedReturnValue; Real64 actualReturnValue; - dataConstruction.Construct.allocate(1); - auto &thisConstruct(dataConstruction.Construct(1)); + state.dataConstruction->Construct.allocate(1); + auto &thisConstruct(state.dataConstruction->Construct(1)); thisConstruct.Name = "RadiantSystem1"; // Test 1: User value is less than zero--should be reset to zero @@ -931,8 +931,8 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_setNodeSourceAndUserTemp) { int expectedNodeNumberAtSource; int expectedNodeNumberAtUserSpecifiedLocation; - dataConstruction.Construct.allocate(1); - auto &thisConstruct(dataConstruction.Construct(1)); + state.dataConstruction->Construct.allocate(1); + auto &thisConstruct(state.dataConstruction->Construct(1)); thisConstruct.NumOfPerpendNodes = 4; // Data common to all tests diff --git a/tst/EnergyPlus/unit/DaylightingManager.unit.cc b/tst/EnergyPlus/unit/DaylightingManager.unit.cc index 2a4c5841fd3..4816deed89d 100644 --- a/tst/EnergyPlus/unit/DaylightingManager.unit.cc +++ b/tst/EnergyPlus/unit/DaylightingManager.unit.cc @@ -887,10 +887,10 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) int zoneNum = 1; // test that tmp arrays are allocated to correct dimension // zone 1 has only 1 daylighting reference point - DayltgInteriorIllum(zoneNum); + DayltgInteriorIllum(state, zoneNum); zoneNum += 1; // zone 2 has 2 daylighting reference points and will crash if not dimensioned appropriately. - DayltgInteriorIllum(zoneNum); + DayltgInteriorIllum(state, zoneNum); } TEST_F(EnergyPlusFixture, DaylightingManager_ProfileAngle_Test) @@ -1359,7 +1359,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) ZoneDaylight(ZoneNum).DaylSourceFacSky = 0.0; ZoneDaylight(ZoneNum).DaylSourceFacSun = 0.0; ZoneDaylight(ZoneNum).DaylSourceFacSunDisk = 0.0; - DaylightingManager::DayltgInteriorIllum(ZoneNum); + DaylightingManager::DayltgInteriorIllum(state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 0.0, 0.001); int ISky = 1; @@ -1381,12 +1381,12 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) // Window5 model - expect 100 for unshaded and 50 for shaded (10 and 5 for RefPt2) SurfWinWindowModelType(IWin) = Window5DetailedModel; SurfWinShadingFlag(IWin) = DataSurfaces::NoShade; - DaylightingManager::DayltgInteriorIllum(ZoneNum); + DaylightingManager::DayltgInteriorIllum(state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 100.0, 0.001); EXPECT_NEAR(DaylightingManager::DaylIllum(2), 10.0, 0.001); SurfWinShadingFlag(IWin) = DataSurfaces::ExtBlindOn; - DaylightingManager::DayltgInteriorIllum(ZoneNum); + DaylightingManager::DayltgInteriorIllum(state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 50.0, 0.001); EXPECT_NEAR(DaylightingManager::DaylIllum(2), 5.0, 0.001); @@ -1394,12 +1394,12 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) // BSDF does shading differently, it's integrated in the base state SurfWinWindowModelType(IWin) = WindowBSDFModel; SurfWinShadingFlag(IWin) = DataSurfaces::NoShade; - DaylightingManager::DayltgInteriorIllum(ZoneNum); + DaylightingManager::DayltgInteriorIllum(state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 100.0, 0.001); EXPECT_NEAR(DaylightingManager::DaylIllum(2), 10.0, 0.001); SurfWinShadingFlag(IWin) = DataSurfaces::ExtBlindOn; - DaylightingManager::DayltgInteriorIllum(ZoneNum); + DaylightingManager::DayltgInteriorIllum(state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 100.0, 0.001); EXPECT_NEAR(DaylightingManager::DaylIllum(2), 10.0, 0.001); } @@ -2166,10 +2166,10 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) int zoneNum = 1; // test that tmp arrays are allocated to correct dimension // zone 1 has only 1 daylighting reference point - DayltgInteriorIllum(zoneNum); + DayltgInteriorIllum(state, zoneNum); zoneNum += 1; // zone 2 has 2 daylighting reference points and will crash if not dimensioned appropriately. - DayltgInteriorIllum(zoneNum); + DayltgInteriorIllum(state, zoneNum); // EIO/DFS output uses specifically newline `\n`, so pass that in or on Windows it'll use '\r\n` std::string const delim = "\n"; @@ -2857,7 +2857,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_TDD_NoDaylightingControls) EXPECT_FALSE(foundErrors); // expect no errors HeatBalanceIntRadExchange::InitSolarViewFactors(state); - dataConstruction.Construct(Surface(7).Construction).TransDiff = 0.001; // required for GetTDDInput function to work. + state.dataConstruction->Construct(Surface(7).Construction).TransDiff = 0.001; // required for GetTDDInput function to work. DaylightingDevices::GetTDDInput(state); CalcDayltgCoefficients(state); diff --git a/tst/EnergyPlus/unit/EMSManager.unit.cc b/tst/EnergyPlus/unit/EMSManager.unit.cc index 6c62c91ec7b..2ff1246a27f 100644 --- a/tst/EnergyPlus/unit/EMSManager.unit.cc +++ b/tst/EnergyPlus/unit/EMSManager.unit.cc @@ -1588,7 +1588,7 @@ TEST_F(EnergyPlusFixture, EMSManager_TestWindowShadingControlExteriorScreenOptio // #7586 DataSurfaces::Surface.allocate(2); EnergyPlus::SurfaceGeometry::AllocateSurfaceWindows(2); - dataConstruction.Construct.allocate(1); + state.dataConstruction->Construct.allocate(1); DataSurfaces::WindowShadingControl.allocate(2); DataDaylighting::ZoneDaylight.allocate(1); DataSurfaces::Surface(1).Name = "Surface1"; @@ -1609,7 +1609,7 @@ TEST_F(EnergyPlusFixture, EMSManager_TestWindowShadingControlExteriorScreenOptio DataSurfaces::Surface(1).activeShadedConstruction = 1; DataSurfaces::Surface(2).activeShadedConstruction = 1; - dataConstruction.Construct(1).Name = "Construction1"; + state.dataConstruction->Construct(1).Name = "Construction1"; DataSurfaces::WindowShadingControl(1).ShadingType = 0; DataSurfaces::WindowShadingControl(2).ShadingType = DataSurfaces::WSC_ST_ExteriorScreen; @@ -1619,7 +1619,7 @@ TEST_F(EnergyPlusFixture, EMSManager_TestWindowShadingControlExteriorScreenOptio DataSurfaces::Surface(1).activeWindowShadingControl = DataSurfaces::Surface(1).windowShadingControlList[SolarShading::selectActiveWindowShadingControlIndex(1)]; DataSurfaces::Surface(2).activeWindowShadingControl = DataSurfaces::Surface(1).windowShadingControlList[SolarShading::selectActiveWindowShadingControlIndex(2)]; - SetupWindowShadingControlActuators(); + SetupWindowShadingControlActuators(state); EXPECT_FALSE(DataSurfaces::SurfWinShadingFlagEMSOn(2)); EXPECT_EQ(DataSurfaces::SurfWinShadingFlagEMSValue(2), 0); diff --git a/tst/EnergyPlus/unit/HVACDXSystem.unit.cc b/tst/EnergyPlus/unit/HVACDXSystem.unit.cc index 2a2ed8b0bf1..ecdf87c131c 100644 --- a/tst/EnergyPlus/unit/HVACDXSystem.unit.cc +++ b/tst/EnergyPlus/unit/HVACDXSystem.unit.cc @@ -407,7 +407,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_DOASDXCoilTest) HVACDXSystem::GetDXCoolingSystemInput(state); EXPECT_EQ(HVACDXSystem::DXCoolingSystem(1).Name, "DX COOLING COIL SYSTEM"); EXPECT_FALSE(HVACDXSystem::DXCoolingSystem(1).ISHundredPercentDOASDXCoil); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).Name, "VS DX COOLING COIL"); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).Name, "VS DX COOLING COIL"); } TEST_F(EnergyPlusFixture, VariableSpeedCoils_RHControl) @@ -530,7 +530,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_RHControl) HVACDXSystem::GetDXCoolingSystemInput(state); EXPECT_EQ(HVACDXSystem::DXCoolingSystem(DXSystemNum).Name, "DX COOLING COIL SYSTEM"); EXPECT_FALSE(HVACDXSystem::DXCoolingSystem(DXSystemNum).ISHundredPercentDOASDXCoil); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(DXSystemNum).Name, "VS DX COOLING COIL"); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(DXSystemNum).Name, "VS DX COOLING COIL"); EXPECT_EQ(2, HVACDXSystem::DXCoolingSystem(DXSystemNum).DXSystemControlNodeNum); // set up outdoor environment @@ -708,19 +708,19 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_LatentDegradation_Test) // test sensible control HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); - Real64 SHR = VariableSpeedCoils::VarSpeedCoil(1).QSensible / VariableSpeedCoils::VarSpeedCoil(1).QLoadTotal; + Real64 SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state.dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; EXPECT_NEAR(SHR, 0.49605, 0.0001); - EXPECT_EQ(1, VariableSpeedCoils::VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed - EXPECT_NEAR(0.199, VariableSpeedCoils::VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is low + EXPECT_EQ(1, state.dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed + EXPECT_NEAR(0.199, state.dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is low // add latent degradation model - VariableSpeedCoils::VarSpeedCoil(1).Twet_Rated = 1000.0; - VariableSpeedCoils::VarSpeedCoil(1).Gamma_Rated = 1.5; + state.dataVariableSpeedCoils->VarSpeedCoil(1).Twet_Rated = 1000.0; + state.dataVariableSpeedCoils->VarSpeedCoil(1).Gamma_Rated = 1.5; HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); - SHR = VariableSpeedCoils::VarSpeedCoil(1).QSensible / VariableSpeedCoils::VarSpeedCoil(1).QLoadTotal; + SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state.dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; EXPECT_NEAR(SHR, 1.0, 0.0001); // more sensible capacity so PLR should be lower - EXPECT_EQ(1, VariableSpeedCoils::VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed - EXPECT_NEAR(0.099, VariableSpeedCoils::VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is lower, latent capacity is 0 + EXPECT_EQ(1, state.dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed + EXPECT_NEAR(0.099, state.dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is lower, latent capacity is 0 // test more reasonable zone RH,about 50% DataLoopNode::Node(InletNode).HumRat = 0.0092994; @@ -729,23 +729,23 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_LatentDegradation_Test) DataLoopNode::Node(ControlNode).TempSetPoint = HVACDXSystem::DXCoolingSystem(DXSystemNum).DesiredOutletTemp; // remove latent degradation model - VariableSpeedCoils::VarSpeedCoil(1).Twet_Rated = 0.0; - VariableSpeedCoils::VarSpeedCoil(1).Gamma_Rated = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(1).Twet_Rated = 0.0; + state.dataVariableSpeedCoils->VarSpeedCoil(1).Gamma_Rated = 0.0; HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); - SHR = VariableSpeedCoils::VarSpeedCoil(1).QSensible / VariableSpeedCoils::VarSpeedCoil(1).QLoadTotal; + SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state.dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; EXPECT_NEAR(SHR, 0.7624, 0.0001); - EXPECT_EQ(1, VariableSpeedCoils::VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed - EXPECT_NEAR(0.143, VariableSpeedCoils::VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is low + EXPECT_EQ(1, state.dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed + EXPECT_NEAR(0.143, state.dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is low // add latent degradation model - VariableSpeedCoils::VarSpeedCoil(1).Twet_Rated = 1000.0; - VariableSpeedCoils::VarSpeedCoil(1).Gamma_Rated = 1.5; + state.dataVariableSpeedCoils->VarSpeedCoil(1).Twet_Rated = 1000.0; + state.dataVariableSpeedCoils->VarSpeedCoil(1).Gamma_Rated = 1.5; HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); - SHR = VariableSpeedCoils::VarSpeedCoil(1).QSensible / VariableSpeedCoils::VarSpeedCoil(1).QLoadTotal; + SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state.dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; EXPECT_NEAR(SHR, 1.0, 0.0001); // more sensible capacity so PLR should be lower - EXPECT_EQ(1, VariableSpeedCoils::VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed - EXPECT_NEAR(0.109, VariableSpeedCoils::VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is lower, latent capacity is 0 + EXPECT_EQ(1, state.dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed + EXPECT_NEAR(0.109, state.dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is lower, latent capacity is 0 } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc index 887898cab62..d84cdf2574b 100644 --- a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc @@ -293,7 +293,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT bool DidMIChange; int SurfNum; - dataConstruction.Construct.allocate(1); + state.dataConstruction->Construct.allocate(1); dataMaterial.Material.allocate(1); DataSurfaces::Surface.allocate(1); @@ -303,7 +303,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT DataSurfaces::Surface(1).MovInsulIntPresentPrevTS = false; DataSurfaces::Surface(1).Construction = 1; DataSurfaces::Surface(1).MaterialMovInsulInt = 1; - dataConstruction.Construct(1).InsideAbsorpThermal = 0.9; + state.dataConstruction->Construct(1).InsideAbsorpThermal = 0.9; dataMaterial.Material(1).AbsorpThermal = 0.5; dataMaterial.Material(1).Resistance = 1.25; DataSurfaces::Surface(1).SchedMovInsulInt = -1; @@ -311,19 +311,19 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT // Test 1: Movable insulation present but wasn't in previous time step, also movable insulation emissivity different than base construction // This should result in a true value from the algorithm which will cause interior radiant exchange matrices to be recalculated - HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(DidMIChange, SurfNum); + HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(state, DidMIChange, SurfNum); EXPECT_TRUE(DidMIChange); // Test 2: Movable insulation present and was also present in previous time step. This should result in a false value since nothing has changed. DataSurfaces::Surface(1).MovInsulIntPresentPrevTS = true; - HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(DidMIChange, SurfNum); + HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(state, DidMIChange, SurfNum); EXPECT_TRUE(!DidMIChange); // Test 2: Movable insulation present but wasn't in previous time step. However, the emissivity of the movable insulation and that of the // construction are the same so nothing has actually changed. This should result in a false value. DataSurfaces::Surface(1).MovInsulIntPresentPrevTS = false; - dataMaterial.Material(1).AbsorpThermal = dataConstruction.Construct(1).InsideAbsorpThermal; - HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(DidMIChange, SurfNum); + dataMaterial.Material(1).AbsorpThermal = state.dataConstruction->Construct(1).InsideAbsorpThermal; + HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(state, DidMIChange, SurfNum); EXPECT_TRUE(!DidMIChange); } diff --git a/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc index 56bec7b972d..36b39e4a41e 100644 --- a/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc @@ -361,7 +361,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetWindowConstructData) EXPECT_FALSE(ErrorsFound); // Clear shared arrays that were allocated in GetConstructData - dataConstruction.Construct.deallocate(); + state.dataConstruction->Construct.deallocate(); // call to get invalid window material type // Material( 2 ).Group = 16; // BlindEquivalentLayer, this layer is invalid in plain windows @@ -1581,7 +1581,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_EMSConstructionTest) HeatBalanceManager::ManageHeatBalance(state); // Find the fenestration surface int winSurfNum = UtilityRoutines::FindItemInList("FENESTRATIONSURFACE", DataSurfaces::Surface); - int win1ConstNum = UtilityRoutines::FindItemInList("WINDOWCONSTRUCTION1", dataConstruction.Construct); + int win1ConstNum = UtilityRoutines::FindItemInList("WINDOWCONSTRUCTION1", state.dataConstruction->Construct); EXPECT_EQ(DataSurfaces::Surface(winSurfNum).Construction, win1ConstNum); Real64 transSol = DataSurfaces::SurfWinSysSolTransmittance(winSurfNum); EXPECT_GT(transSol, 0.8); @@ -1596,7 +1596,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_EMSConstructionTest) HeatBalanceManager::ManageHeatBalance(state); // For now, must call this twice in order to hit the BeginTimeStepBeforePredictor EMS calling point HeatBalanceManager::ManageHeatBalance(state); - int win2ConstNum = UtilityRoutines::FindItemInList("WINDOWCONSTRUCTION2", dataConstruction.Construct); + int win2ConstNum = UtilityRoutines::FindItemInList("WINDOWCONSTRUCTION2", state.dataConstruction->Construct); EXPECT_EQ(DataSurfaces::Surface(winSurfNum).Construction, win2ConstNum); transSol = DataSurfaces::SurfWinSysSolTransmittance(winSurfNum); EXPECT_LT(transSol, 0.2); @@ -1834,48 +1834,48 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData) EXPECT_EQ(DataHeatBalance::TotConstructs, 3); - int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Non-Grouped Air Boundary"), dataConstruction.Construct); - EXPECT_TRUE(UtilityRoutines::SameString(dataConstruction.Construct(constrNum).Name, "Non-Grouped Air Boundary")); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundary); - EXPECT_FALSE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); - EXPECT_FALSE(dataConstruction.Construct(constrNum).TypeIsAirBoundarySolar); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryInteriorWindow); - EXPECT_TRUE(dataConstruction.Construct(constrNum).IsUsedCTF); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryIRTSurface); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryMixing); - EXPECT_EQ(dataConstruction.Construct(constrNum).TotLayers, 1); - EXPECT_TRUE(UtilityRoutines::SameString(dataMaterial.Material(dataConstruction.Construct(constrNum).LayerPoint(1)).Name, "~AirBoundary-IRTMaterial")); - EXPECT_EQ(dataConstruction.Construct(constrNum).AirBoundaryACH, 0.5); // Default value from IDD - EXPECT_EQ(dataConstruction.Construct(constrNum).AirBoundaryMixingSched, -1); + int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Non-Grouped Air Boundary"), state.dataConstruction->Construct); + EXPECT_TRUE(UtilityRoutines::SameString(state.dataConstruction->Construct(constrNum).Name, "Non-Grouped Air Boundary")); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundary); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).IsUsedCTF); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).TotLayers, 1); + EXPECT_TRUE(UtilityRoutines::SameString(dataMaterial.Material(state.dataConstruction->Construct(constrNum).LayerPoint(1)).Name, "~AirBoundary-IRTMaterial")); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryACH, 0.5); // Default value from IDD + EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryMixingSched, -1); EXPECT_EQ(DataHeatBalance::NominalRforNominalUCalculation(constrNum), 0.01); - constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Grouped Air Boundary"), dataConstruction.Construct); - EXPECT_TRUE(UtilityRoutines::SameString(dataConstruction.Construct(constrNum).Name, "Grouped Air Boundary")); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundary); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundarySolar); - EXPECT_FALSE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryInteriorWindow); - EXPECT_FALSE(dataConstruction.Construct(constrNum).IsUsedCTF); - EXPECT_FALSE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryIRTSurface); - EXPECT_FALSE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryMixing); - EXPECT_EQ(dataConstruction.Construct(constrNum).TotLayers, 0); - EXPECT_EQ(dataConstruction.Construct(constrNum).AirBoundaryACH, 0.0); // Not processed for GroupedZone mixing option - EXPECT_EQ(dataConstruction.Construct(constrNum).AirBoundaryMixingSched, 0); + constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Grouped Air Boundary"), state.dataConstruction->Construct); + EXPECT_TRUE(UtilityRoutines::SameString(state.dataConstruction->Construct(constrNum).Name, "Grouped Air Boundary")); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundary); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).IsUsedCTF); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).TotLayers, 0); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryACH, 0.0); // Not processed for GroupedZone mixing option + EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 0); EXPECT_EQ(DataHeatBalance::NominalRforNominalUCalculation(constrNum), 0.0); - constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Good Mixing Schedule"), dataConstruction.Construct); - EXPECT_TRUE(UtilityRoutines::SameString(dataConstruction.Construct(constrNum).Name, "Air Boundary with Good Mixing Schedule")); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundary); - EXPECT_FALSE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); - EXPECT_FALSE(dataConstruction.Construct(constrNum).TypeIsAirBoundarySolar); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryInteriorWindow); - EXPECT_TRUE(dataConstruction.Construct(constrNum).IsUsedCTF); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryIRTSurface); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryMixing); - EXPECT_EQ(dataConstruction.Construct(constrNum).TotLayers, 1); - EXPECT_TRUE(UtilityRoutines::SameString(dataMaterial.Material(dataConstruction.Construct(constrNum).LayerPoint(1)).Name, "~AirBoundary-IRTMaterial")); - EXPECT_EQ(dataConstruction.Construct(constrNum).AirBoundaryACH, 0.4); - EXPECT_EQ(dataConstruction.Construct(constrNum).AirBoundaryMixingSched, 1); + constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Good Mixing Schedule"), state.dataConstruction->Construct); + EXPECT_TRUE(UtilityRoutines::SameString(state.dataConstruction->Construct(constrNum).Name, "Air Boundary with Good Mixing Schedule")); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundary); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).IsUsedCTF); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).TotLayers, 1); + EXPECT_TRUE(UtilityRoutines::SameString(dataMaterial.Material(state.dataConstruction->Construct(constrNum).LayerPoint(1)).Name, "~AirBoundary-IRTMaterial")); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryACH, 0.4); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 1); EXPECT_EQ(DataHeatBalance::NominalRforNominalUCalculation(constrNum), 0.01); } @@ -1921,18 +1921,18 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2) EXPECT_EQ(DataHeatBalance::TotConstructs, 1); - int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Bad Mixing Schedule"), dataConstruction.Construct); - EXPECT_TRUE(UtilityRoutines::SameString(dataConstruction.Construct(constrNum).Name, "Air Boundary with Bad Mixing Schedule")); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundary); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundarySolar); - EXPECT_FALSE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryInteriorWindow); - EXPECT_FALSE(dataConstruction.Construct(constrNum).IsUsedCTF); - EXPECT_FALSE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryIRTSurface); - EXPECT_TRUE(dataConstruction.Construct(constrNum).TypeIsAirBoundaryMixing); - EXPECT_EQ(dataConstruction.Construct(constrNum).TotLayers, 0); - EXPECT_EQ(dataConstruction.Construct(constrNum).AirBoundaryACH, 0.1); - EXPECT_EQ(dataConstruction.Construct(constrNum).AirBoundaryMixingSched, 0); + int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Bad Mixing Schedule"), state.dataConstruction->Construct); + EXPECT_TRUE(UtilityRoutines::SameString(state.dataConstruction->Construct(constrNum).Name, "Air Boundary with Bad Mixing Schedule")); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundary); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).IsUsedCTF); + EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); + EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).TotLayers, 0); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryACH, 0.1); + EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 0); EXPECT_EQ(DataHeatBalance::NominalRforNominalUCalculation(constrNum), 0.0); } @@ -1971,7 +1971,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_UpdateWindowFaceTempsNonBSDFWin) DataSurfaces::TotSurfaces = 3; DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); DataHeatBalance::TotConstructs = 3; - dataConstruction.Construct.allocate( DataHeatBalance::TotConstructs); + state.dataConstruction->Construct.allocate( DataHeatBalance::TotConstructs); DataSurfaces::Surface(1).Class = DataSurfaces::SurfaceClass_Wall; DataSurfaces::Surface(2).Class = DataSurfaces::SurfaceClass_Window; @@ -1979,13 +1979,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_UpdateWindowFaceTempsNonBSDFWin) DataSurfaces::Surface(1).Construction = 1; DataSurfaces::Surface(2).Construction = 2; DataSurfaces::Surface(3).Construction = 3; - dataConstruction.Construct(1).WindowTypeBSDF = false; - dataConstruction.Construct(2).WindowTypeBSDF = false; - dataConstruction.Construct(3).WindowTypeBSDF = true; + state.dataConstruction->Construct(1).WindowTypeBSDF = false; + state.dataConstruction->Construct(2).WindowTypeBSDF = false; + state.dataConstruction->Construct(3).WindowTypeBSDF = true; int SurfsForRegWindow = 3; - dataConstruction.Construct(1).TotLayers = 1; - dataConstruction.Construct(2).TotLayers = SurfsForRegWindow; - dataConstruction.Construct(3).TotLayers = 1; + state.dataConstruction->Construct(1).TotLayers = 1; + state.dataConstruction->Construct(2).TotLayers = SurfsForRegWindow; + state.dataConstruction->Construct(3).TotLayers = 1; SurfWinFenLaySurfTempFront.dimension(10, DataSurfaces::TotSurfaces, 0.0); SurfWinFenLaySurfTempBack.dimension(10, DataSurfaces::TotSurfaces, 0.0); @@ -2000,7 +2000,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_UpdateWindowFaceTempsNonBSDFWin) Real64 ZeroResult = 0.0; - HeatBalanceManager::UpdateWindowFaceTempsNonBSDFWin(); + HeatBalanceManager::UpdateWindowFaceTempsNonBSDFWin(state); // First surface is NOT a window so these should NOT be set EXPECT_NEAR(SurfWinFenLaySurfTempFront(1,1),ZeroResult,0.0001); diff --git a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc index c4e40a1626c..3560292cdef 100644 --- a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc @@ -101,11 +101,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_CalcOutsideSurfTemp) TempExt = 23.0; ErrorFlag = false; - dataConstruction.Construct.allocate(ConstrNum); - dataConstruction.Construct(ConstrNum).Name = "TestConstruct"; - dataConstruction.Construct(ConstrNum).CTFCross(0) = 0.0; - dataConstruction.Construct(ConstrNum).CTFOutside(0) = 1.0; - dataConstruction.Construct(ConstrNum).SourceSinkPresent = true; + state.dataConstruction->Construct.allocate(ConstrNum); + state.dataConstruction->Construct(ConstrNum).Name = "TestConstruct"; + state.dataConstruction->Construct(ConstrNum).CTFCross(0) = 0.0; + state.dataConstruction->Construct(ConstrNum).CTFOutside(0) = 1.0; + state.dataConstruction->Construct(ConstrNum).SourceSinkPresent = true; dataMaterial.Material.allocate(1); dataMaterial.Material(1).Name = "TestMaterial"; @@ -147,7 +147,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_CalcOutsideSurfTemp) DataHeatBalSurface::QHeatEmiReport.allocate(SurfNum); DataGlobals::TimeStepZoneSec = 900.0; - CalcOutsideSurfTemp(SurfNum, ZoneNum, ConstrNum, HMovInsul, TempExt, ErrorFlag); + CalcOutsideSurfTemp(state, SurfNum, ZoneNum, ConstrNum, HMovInsul, TempExt, ErrorFlag); std::string const error_string = delimited_string({ " ** Severe ** Exterior movable insulation is not valid with embedded sources/sinks", @@ -274,14 +274,14 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_ComputeIntThermalAbsorpFacto DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); DataSurfaces::SurfaceWindow.allocate(DataSurfaces::TotSurfaces); SurfaceGeometry::AllocateSurfaceWindows(DataSurfaces::TotSurfaces); - dataConstruction.Construct.allocate(DataHeatBalance::TotConstructs); + state.dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); dataMaterial.Material.allocate(DataHeatBalance::TotMaterials); DataSurfaces::Surface(1).HeatTransSurf = true; DataSurfaces::Surface(1).Construction = 1; DataSurfaces::SurfWinShadingFlag(1) = 0; - dataConstruction.Construct(1).InsideAbsorpThermal = 0.9; - dataConstruction.Construct(1).TransDiff = 0.0; + state.dataConstruction->Construct(1).InsideAbsorpThermal = 0.9; + state.dataConstruction->Construct(1).TransDiff = 0.0; DataSurfaces::Surface(1).MaterialMovInsulInt = 1; dataMaterial.Material(1).AbsorpThermal = 0.2; dataMaterial.Material(1).AbsorpSolar = 0.5; @@ -289,7 +289,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_ComputeIntThermalAbsorpFacto DataSurfaces::Surface(1).SchedMovInsulInt = -1; // According to schedule manager protocol, an index of -1 returns a 1.0 value for the schedule dataMaterial.Material(1).Resistance = 1.25; - ComputeIntThermalAbsorpFactors(); + ComputeIntThermalAbsorpFactors(state); EXPECT_EQ(0.2, DataHeatBalance::ITABSF(1)); } @@ -302,7 +302,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateFinalThermalHistories) DataHeatBalance::Zone.allocate(DataGlobals::NumOfZones); DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); DataSurfaces::SurfaceWindow.allocate(DataSurfaces::TotSurfaces); - dataConstruction.Construct.allocate(DataHeatBalance::TotConstructs); + state.dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); DataHeatBalance::AnyConstructInternalSourceInInput = true; AllocateSurfaceHeatBalArrays(state); // allocates a host of variables related to CTF calculations @@ -313,12 +313,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateFinalThermalHistories) DataSurfaces::Surface(1).ExtBoundCond = 1; DataSurfaces::Surface(1).Construction = 1; - dataConstruction.Construct(1).NumCTFTerms = 2; - dataConstruction.Construct(1).SourceSinkPresent = true; - dataConstruction.Construct(1).NumHistories = 1; - dataConstruction.Construct(1).CTFTUserOut(0) = 0.5; - dataConstruction.Construct(1).CTFTUserIn(0) = 0.25; - dataConstruction.Construct(1).CTFTUserSource(0) = 0.25; + state.dataConstruction->Construct(1).NumCTFTerms = 2; + state.dataConstruction->Construct(1).SourceSinkPresent = true; + state.dataConstruction->Construct(1).NumHistories = 1; + state.dataConstruction->Construct(1).CTFTUserOut(0) = 0.5; + state.dataConstruction->Construct(1).CTFTUserIn(0) = 0.25; + state.dataConstruction->Construct(1).CTFTUserSource(0) = 0.25; DataHeatBalSurface::SUMH(1) = 0; DataHeatBalSurface::TH(1, 1, 1) = 20.0; @@ -326,12 +326,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateFinalThermalHistories) DataHeatBalFanSys::CTFTuserConstPart(1) = 0.0; - UpdateThermalHistories(); // First check to see if it is calculating the user location temperature properly + UpdateThermalHistories(state); // First check to see if it is calculating the user location temperature properly EXPECT_EQ(12.5, DataHeatBalSurface::TempUserLoc(1)); EXPECT_EQ(0.0, DataHeatBalSurface::TuserHist(1, 3)); - UpdateThermalHistories(); + UpdateThermalHistories(state); EXPECT_EQ(12.5, DataHeatBalSurface::TuserHist(1, 3)); // Now check to see that it is shifting the temperature history properly } @@ -1315,7 +1315,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyLocalEnv) AllocateSurfaceHeatBalArrays(state); createFacilityElectricPowerServiceObject(); SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(); + SolarShading::DetermineShadowingCombinations(state); OutAirNodeManager::GetOutAirNodesInput(state); ScheduleManager::Schedule(1).CurrentValue = 25.0; ScheduleManager::Schedule(2).CurrentValue = 20.0; @@ -1884,7 +1884,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySrdSurfLWR) AllocateSurfaceHeatBalArrays(state); createFacilityElectricPowerServiceObject(); SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(); + SolarShading::DetermineShadowingCombinations(state); InitSurfaceHeatBalance(state); @@ -1946,7 +1946,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_SurfaceCOnstructionIndexTest DataHeatBalance::Zone.allocate(DataGlobals::NumOfZones); DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); DataSurfaces::SurfaceWindow.allocate(DataSurfaces::TotSurfaces); - dataConstruction.Construct.allocate(DataHeatBalance::TotConstructs); + state.dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); DataHeatBalance::AnyConstructInternalSourceInInput = true; DataSurfaces::Surface(1).Class = DataSurfaces::SurfaceClass_Wall; @@ -1955,12 +1955,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_SurfaceCOnstructionIndexTest DataSurfaces::Surface(1).ExtBoundCond = 1; DataSurfaces::Surface(1).Construction = 1; - dataConstruction.Construct(1).NumCTFTerms = 2; - dataConstruction.Construct(1).SourceSinkPresent = true; - dataConstruction.Construct(1).NumHistories = 1; - dataConstruction.Construct(1).CTFTUserOut(0) = 0.5; - dataConstruction.Construct(1).CTFTUserIn(0) = 0.25; - dataConstruction.Construct(1).CTFTUserSource(0) = 0.25; + state.dataConstruction->Construct(1).NumCTFTerms = 2; + state.dataConstruction->Construct(1).SourceSinkPresent = true; + state.dataConstruction->Construct(1).NumHistories = 1; + state.dataConstruction->Construct(1).CTFTUserOut(0) = 0.5; + state.dataConstruction->Construct(1).CTFTUserIn(0) = 0.25; + state.dataConstruction->Construct(1).CTFTUserSource(0) = 0.25; AllocateSurfaceHeatBalArrays(state); // allocates a host of variables related to CTF calculations OutputProcessor::GetReportVariableInput(state); @@ -2453,7 +2453,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceA AllocateSurfaceHeatBalArrays(state); createFacilityElectricPowerServiceObject(); SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(); + SolarShading::DetermineShadowingCombinations(state); InitSurfaceHeatBalance(state); for (int SurfNum = 1; SurfNum <= 6; SurfNum++) { DataSurfaces::Surface(SurfNum).ExtConvCoeff = -1; @@ -2568,9 +2568,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInterzoneRadFactorCalc) DataHeatBalance::Zone.allocate(DataGlobals::NumOfZones); DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); - dataConstruction.Construct.allocate(DataHeatBalance::TotConstructs); + state.dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); DataHeatBalSurface::EnclSolVMULT.allocate(DataGlobals::NumOfZones); - dataConstruction.Construct(1).TransDiff = 0.1; + state.dataConstruction->Construct(1).TransDiff = 0.1; DataHeatBalSurface::EnclSolVMULT(1) = 1.0; DataHeatBalSurface::EnclSolVMULT(2) = 1.0; @@ -2589,7 +2589,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInterzoneRadFactorCalc) DataSurfaces::Surface(1).SolarEnclIndex = 1; DataSurfaces::Surface(2).SolarEnclIndex = 2; - ComputeDifSolExcZonesWIZWindows(DataGlobals::NumOfZones); + ComputeDifSolExcZonesWIZWindows(state, DataGlobals::NumOfZones); EXPECT_EQ(1, DataHeatBalSurface::FractDifShortZtoZ(1, 1)); EXPECT_EQ(1, DataHeatBalSurface::FractDifShortZtoZ(2, 2)); @@ -2599,13 +2599,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInterzoneRadFactorCalc) DataHeatBalance::Zone(1).HasInterZoneWindow = true; DataHeatBalance::Zone(2).HasInterZoneWindow = true; - ComputeDifSolExcZonesWIZWindows(DataGlobals::NumOfZones); + ComputeDifSolExcZonesWIZWindows(state, DataGlobals::NumOfZones); EXPECT_TRUE(DataHeatBalSurface::RecDifShortFromZ(1)); EXPECT_TRUE(DataHeatBalSurface::RecDifShortFromZ(2)); DataGlobals::KickOffSimulation = true; - ComputeDifSolExcZonesWIZWindows(DataGlobals::NumOfZones); + ComputeDifSolExcZonesWIZWindows(state, DataGlobals::NumOfZones); EXPECT_EQ(1, DataHeatBalSurface::FractDifShortZtoZ(1, 1)); EXPECT_EQ(1, DataHeatBalSurface::FractDifShortZtoZ(2, 2)); @@ -3091,7 +3091,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInitHBInterzoneWindow) AllocateSurfaceHeatBalArrays(state); createFacilityElectricPowerServiceObject(); SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(); + SolarShading::DetermineShadowingCombinations(state); InitSurfaceHeatBalance(state); @@ -3108,10 +3108,10 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInitHBInterzoneWindow) DataHeatBalSurface::InterZoneWindow = false; DataHeatBalance::ZoneBmSolFrIntWinsRep(1) = 10.0; DataEnvironment::SunIsUp = false; - InitIntSolarDistribution(); + InitIntSolarDistribution(state); EXPECT_EQ(0.0, DataHeatBalance::SurfIntBmIncInsSurfIntensRep(1)); DataEnvironment::SunIsUp = true; - InitIntSolarDistribution(); + InitIntSolarDistribution(state); EXPECT_NEAR(1.666667, DataHeatBalance::SurfIntBmIncInsSurfIntensRep(1), 0.00001); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/ICSCollector.unit.cc b/tst/EnergyPlus/unit/ICSCollector.unit.cc index f2fbfa852cd..0a98058f3f7 100644 --- a/tst/EnergyPlus/unit/ICSCollector.unit.cc +++ b/tst/EnergyPlus/unit/ICSCollector.unit.cc @@ -109,9 +109,9 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest Surface(SurfNum).ExtConvCoeff = 0; Surface(SurfNum).ExtWind = false; // allocate construction variable data - dataConstruction.Construct.allocate(ConstrNum); - dataConstruction.Construct(ConstrNum).LayerPoint.allocate(MatNum); - dataConstruction.Construct(ConstrNum).LayerPoint(MatNum) = 1; + state.dataConstruction->Construct.allocate(ConstrNum); + state.dataConstruction->Construct(ConstrNum).LayerPoint.allocate(MatNum); + state.dataConstruction->Construct(ConstrNum).LayerPoint(MatNum) = 1; dataMaterial.Material.allocate(MatNum); dataMaterial.Material(MatNum).AbsorpThermal = 0.8; // allocate exterior vented cavaity variable data @@ -163,8 +163,8 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest // deallocated variables Surface.deallocate(); - dataConstruction.Construct(ConstrNum).LayerPoint.deallocate(); - dataConstruction.Construct.deallocate(); + state.dataConstruction->Construct(ConstrNum).LayerPoint.deallocate(); + state.dataConstruction->Construct.deallocate(); dataMaterial.Material.deallocate(); ExtVentedCavity(NumOfSurf).SurfPtrs.deallocate(); ExtVentedCavity.deallocate(); diff --git a/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc b/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc index cb280050467..dae0de4e753 100644 --- a/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc @@ -178,7 +178,7 @@ TEST_F(EnergyPlusFixture, ASIHP_GetMaxSpeedNumIHP) VariableSpeedCoils::VariableSpeedCoilData vsCoil; vsCoil.NumOfSpeeds = 999; - VariableSpeedCoils::VarSpeedCoil.push_back(vsCoil); + state.dataVariableSpeedCoils->VarSpeedCoil.push_back(vsCoil); IntegratedHeatPumpData IHP; IHP.Name = "ASIHP"; diff --git a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc index 46560f1f886..7c33880e884 100644 --- a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc +++ b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc @@ -250,8 +250,8 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantVariableFlow) Surface.allocate(1); Surface(1).Construction = 1; Surface(1).Area = 1500.0; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).ThicknessPerpend = 0.075; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).ThicknessPerpend = 0.075; SizeLowTempRadiantSystem(state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, HydrRadSys(RadSysNum).WaterVolFlowMaxHeat, 0.1); @@ -331,8 +331,8 @@ TEST_F(LowTempRadiantSystemTest, SizeCapacityLowTempRadiantVariableFlow) Surface.allocate(1); Surface(1).Construction = 1; Surface(1).Area = 1500.0; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).ThicknessPerpend = 0.075; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).ThicknessPerpend = 0.075; SizeLowTempRadiantSystem(state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, HydrRadSys(RadSysNum).ScaledHeatingCapacity, 0.1); @@ -399,8 +399,8 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantConstantFlow) Surface.allocate(1); Surface(1).Construction = 1; Surface(1).Area = 150.0; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).ThicknessPerpend = 0.075; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).ThicknessPerpend = 0.075; SizeLowTempRadiantSystem(state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, CFloRadSys(RadSysNum).WaterVolFlowMax, 0.001); @@ -1504,8 +1504,8 @@ TEST_F(LowTempRadiantSystemTest, LowTempElecRadSurfaceGroupTest) Surface(4).ZoneName = "EAST ZONE"; Surface(4).Zone = 2; Surface(4).Construction = 1; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).SourceSinkPresent = true; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).SourceSinkPresent = true; GetLowTempRadiantSystem(state); EXPECT_EQ(2, LowTempRadiantSystem::NumOfElecLowTempRadSys); @@ -1680,60 +1680,60 @@ TEST_F(LowTempRadiantSystemTest, SizeRadSysTubeLengthTest) Surface(3).Construction = 3; Surface(3).Area = 300.0; - dataConstruction.Construct.allocate(3); - dataConstruction.Construct(1).ThicknessPerpend = 0.05; - dataConstruction.Construct(2).ThicknessPerpend = 0.125; + state.dataConstruction->Construct.allocate(3); + state.dataConstruction->Construct(1).ThicknessPerpend = 0.05; + state.dataConstruction->Construct(2).ThicknessPerpend = 0.125; // Test 1: Hydronic radiant system 1 (one surface) RadSysType = HydronicSystem; RadSysNum = 1; - FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); EXPECT_NEAR(FuncCalc, 1000.0, 0.1); // Test 2: Hydronic radiant system 2 (two surfaces) RadSysType = HydronicSystem; RadSysNum = 2; - FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); EXPECT_NEAR(FuncCalc, 1800.0, 0.1); // Test 3: Constant flow radiant system 1 (one surface) RadSysType = ConstantFlowSystem; RadSysNum = 1; - FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); EXPECT_NEAR(FuncCalc, 1000.0, 0.1); // Test 4: Constant flow radiant system 2 (two surfaces) RadSysType = ConstantFlowSystem; RadSysNum = 2; - FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); EXPECT_NEAR(FuncCalc, 1800.0, 0.1); // Test 5: Hydronic radiant system 3 (thickness out of range, low side) RadSysType = HydronicSystem; RadSysNum = 3; - dataConstruction.Construct(3).ThicknessPerpend = 0.004; - FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + state.dataConstruction->Construct(3).ThicknessPerpend = 0.004; + FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); EXPECT_NEAR(FuncCalc, 2000.0, 0.1); // Test 6: Hydronic radiant system 3 (thickness out of range, high side) RadSysType = HydronicSystem; RadSysNum = 3; - dataConstruction.Construct(3).ThicknessPerpend = 0.6; - FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + state.dataConstruction->Construct(3).ThicknessPerpend = 0.6; + FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); EXPECT_NEAR(FuncCalc, 2000.0, 0.1); // Test 7: Constant flow radiant system 3 (thickness out of range, low side) RadSysType = ConstantFlowSystem; RadSysNum = 3; - dataConstruction.Construct(3).ThicknessPerpend = 0.004; - FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + state.dataConstruction->Construct(3).ThicknessPerpend = 0.004; + FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); EXPECT_NEAR(FuncCalc, 2000.0, 0.1); // Test 8: Constant flow radiant system 3 (thickness out of range, high side) RadSysType = ConstantFlowSystem; RadSysNum = 3; - dataConstruction.Construct(3).ThicknessPerpend = 0.6; - FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(); + state.dataConstruction->Construct(3).ThicknessPerpend = 0.6; + FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); EXPECT_NEAR(FuncCalc, 2000.0, 0.1); } @@ -1764,8 +1764,8 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadConFlowSystemAutoSizeTempTest) Surface.allocate(1); Surface(1).Construction = 1; Surface(1).Area = 150.0; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).ThicknessPerpend = 0.075; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).ThicknessPerpend = 0.075; // Hydronic - Hot water volume flow rate autosize CFloRadSys(RadSysNum).ColdWaterInNode = 0; @@ -2332,9 +2332,9 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) thisRadSys.ZonePtr = 1; Surface.allocate(3); Zone.allocate(3); - dataConstruction.Construct.allocate(2); - dataConstruction.Construct(1).SourceSinkPresent = true; - dataConstruction.Construct(2).SourceSinkPresent = false; + state.dataConstruction->Construct.allocate(2); + state.dataConstruction->Construct(1).SourceSinkPresent = true; + state.dataConstruction->Construct(2).SourceSinkPresent = false; // Test 1a: Surfaces are in the same zones, zone multipliers are all the same, and the construct has a source/sink. // Everything is "ok" so the result should be the error flag is FALSE. @@ -2351,7 +2351,7 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) Surface(1).Construction = 1; Surface(2).Construction = 1; Surface(3).Construction = 1; - thisRadSys.errorCheckZonesAndConstructions(actualErrorsFound); + thisRadSys.errorCheckZonesAndConstructions(state, actualErrorsFound); EXPECT_FALSE(actualErrorsFound); // Test 1b: Surfaces are in different zones, zone multipliers are all the same, and the construct has a source/sink. @@ -2369,7 +2369,7 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) Surface(1).Construction = 1; Surface(2).Construction = 1; Surface(3).Construction = 1; - thisRadSys.errorCheckZonesAndConstructions(actualErrorsFound); + thisRadSys.errorCheckZonesAndConstructions(state, actualErrorsFound); EXPECT_FALSE(actualErrorsFound); // Test 2: Surfaces are in different zones, zone multipliers are NOT all the same (one is 7 instead of 2), and the construct has a source/sink. @@ -2387,7 +2387,7 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) Surface(1).Construction = 1; Surface(2).Construction = 1; Surface(3).Construction = 1; - thisRadSys.errorCheckZonesAndConstructions(actualErrorsFound); + thisRadSys.errorCheckZonesAndConstructions(state, actualErrorsFound); EXPECT_TRUE(actualErrorsFound); // Test 3: Surfaces are in the same zones, zone multipliers are all the same, and one construct does NOT have a source/sink. @@ -2405,7 +2405,7 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) Surface(1).Construction = 1; Surface(2).Construction = 1; Surface(3).Construction = 2; - thisRadSys.errorCheckZonesAndConstructions(actualErrorsFound); + thisRadSys.errorCheckZonesAndConstructions(state, actualErrorsFound); EXPECT_TRUE(actualErrorsFound); } @@ -2688,8 +2688,8 @@ TEST_F(LowTempRadiantSystemTest, calculateUFromISOStandardTest) int SurfNum = 1; DataSurfaces::Surface.allocate(1); Surface(1).Construction = 1; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).ThicknessPerpend = 0.5; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).ThicknessPerpend = 0.5; CFloRadSys.allocate(1); auto &thisCFloSys (CFloRadSys(1)); thisCFloSys.TubeDiameterInner = 0.01; @@ -2700,7 +2700,7 @@ TEST_F(LowTempRadiantSystemTest, calculateUFromISOStandardTest) Real64 expectedResult = 28.00687; Real64 allowedDifference = 0.00001; - Real64 actualResult = thisCFloSys.calculateUFromISOStandard(SurfNum, WaterMassFlow); + Real64 actualResult = thisCFloSys.calculateUFromISOStandard(state, SurfNum, WaterMassFlow); EXPECT_NEAR(expectedResult, actualResult, allowedDifference); } diff --git a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc index 469b131d230..b794bf5859d 100644 --- a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc +++ b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc @@ -122,8 +122,8 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc) // Construction surface.Construction = 1; - dataConstruction.Construct.allocate(1); - Construction::ConstructionProps &construction = dataConstruction.Construct(1); + state.dataConstruction->Construct.allocate(1); + Construction::ConstructionProps &construction = state.dataConstruction->Construct(1); construction.TotLayers = 1; construction.LayerPoint(construction.TotLayers) = UtilityRoutines::FindItemInList("CONCRETE", dataMaterial.Material); @@ -248,8 +248,8 @@ TEST_F(EnergyPlusFixture, EMPDRcoating) // Construction surface.Construction = 1; - dataConstruction.Construct.allocate(1); - Construction::ConstructionProps &construction = dataConstruction.Construct(1); + state.dataConstruction->Construct.allocate(1); + Construction::ConstructionProps &construction = state.dataConstruction->Construct(1); construction.TotLayers = 1; construction.LayerPoint(construction.TotLayers) = UtilityRoutines::FindItemInList("CONCRETE", dataMaterial.Material); @@ -340,8 +340,8 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) // Construction int constNum = 1; surface.Construction = constNum; - dataConstruction.Construct.allocate( constNum ); - Construction::ConstructionProps &construction = dataConstruction.Construct( constNum ); + state.dataConstruction->Construct.allocate( constNum ); + Construction::ConstructionProps &construction = state.dataConstruction->Construct( constNum ); construction.TotLayers = constNum; construction.LayerPoint(construction.TotLayers) = UtilityRoutines::FindItemInList("WOOD", dataMaterial.Material); diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index a6c71b8a5bb..36a6ff6c8ef 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -7385,11 +7385,11 @@ TEST_F(EnergyPlusFixture, AzimuthToCardinal) // Allocate some needed arrays DataHeatBalance::Zone.allocate(1); DataHeatBalance::Zone(1).ListMultiplier = 1; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).Name = "A Construction"; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).Name = "A Construction"; // Avoid trigerring CalcNominalWindowCond - dataConstruction.Construct(1).SummerSHGC = 0.70; - dataConstruction.Construct(1).VisTransNorm = 0.80; + state.dataConstruction->Construct(1).SummerSHGC = 0.70; + state.dataConstruction->Construct(1).VisTransNorm = 0.80; DataHeatBalance::NominalU.allocate(1); DataHeatBalance::NominalU(1) = 0.2; @@ -7509,9 +7509,9 @@ TEST_F(EnergyPlusFixture, InteriorSurfaceEnvelopeSummaryReport) DataHeatBalance::Zone.allocate(2); DataHeatBalance::Zone(1).ListMultiplier = 1; DataHeatBalance::Zone(2).ListMultiplier = 1; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).Name = "A Construction"; - dataConstruction.Construct(1).OutsideAbsorpSolar = 0.4; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).Name = "A Construction"; + state.dataConstruction->Construct(1).OutsideAbsorpSolar = 0.4; DataHeatBalance::NominalU.allocate(1); DataHeatBalance::NominalU(1) = 0.2; @@ -8332,7 +8332,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatGainReport) EnergyPlus::DataHeatBalance::ZoneWinHeatGainRepEnergy.allocate(1); EnergyPlus::DataHeatBalance::ZoneWinHeatLossRepEnergy.allocate(1); - GatherHeatGainReport(OutputProcessor::TimeStepType::TimeStepSystem); + GatherHeatGainReport(state, OutputProcessor::TimeStepType::TimeStepSystem); EXPECT_EQ(1.0*(EnergyPlus::DataHVACGlobals::TimeStepSys)*SecInHour, DataHeatBalance::ZonePreDefRep(1).SHGSAnZoneEqHt); EXPECT_EQ(0.0*(EnergyPlus::DataHVACGlobals::TimeStepSys)*SecInHour, DataHeatBalance::ZonePreDefRep(1).SHGSAnZoneEqCl); diff --git a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc index d5e66ee7c6b..3d4f13eecf9 100644 --- a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc @@ -467,19 +467,19 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = VarSpeedCoil(1).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataVariableSpeedCoils->VarSpeedCoil(1).Name; PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilVSWAHPCoolingEquationFit; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = VarSpeedCoil(1).WaterInletNodeNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = VarSpeedCoil(1).WaterOutletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataVariableSpeedCoils->VarSpeedCoil(1).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataVariableSpeedCoils->VarSpeedCoil(1).WaterOutletNodeNum; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = VarSpeedCoil(2).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataVariableSpeedCoils->VarSpeedCoil(2).Name; PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilVSWAHPHeatingEquationFit; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = VarSpeedCoil(2).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = VarSpeedCoil(2).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataVariableSpeedCoils->VarSpeedCoil(2).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataVariableSpeedCoils->VarSpeedCoil(2).WaterOutletNodeNum; DataSizing::CurZoneEqNum = 1; DataSizing::ZoneSizingRunDone = true; @@ -501,40 +501,40 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) // For this reason, the parent object would size to an air flow that was different than the child. // identify coil - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).Name, "LOBBY_ZN_1_FLR_2 WSHP COOLING MODE"); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).Name, "LOBBY_ZN_1_FLR_2 WSHP COOLING MODE"); // expect coil air flow to equal PTUnit cooling air flow - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).RatedAirVolFlowRate, PTUnit(1).MaxCoolAirVolFlow); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(9), PTUnit(1).MaxCoolAirVolFlow); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate, PTUnit(1).MaxCoolAirVolFlow); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9), PTUnit(1).MaxCoolAirVolFlow); // expect the ratio of air flow to capacity to be equal to the reference air flow and capacity ratio specified in coil input Real64 refAirflowCapacityRatio = 0.891980668 / 16092.825525; // speed 9 reference cooling data Real64 sizingAirflowCapacityRatio = - VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(9) / VariableSpeedCoils::VarSpeedCoil(1).MSRatedTotCap(9); + state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9) / state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedTotCap(9); EXPECT_EQ(refAirflowCapacityRatio, sizingAirflowCapacityRatio); // this same ratio should also equal the internal flow per capacity variable used to back calculate operating air flow rate - EXPECT_EQ(sizingAirflowCapacityRatio, VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowPerRatedTotCap(9)); + EXPECT_EQ(sizingAirflowCapacityRatio, state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowPerRatedTotCap(9)); // identify coil - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).Name, "LOBBY_ZN_1_FLR_2 WSHP HEATING MODE"); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).Name, "LOBBY_ZN_1_FLR_2 WSHP HEATING MODE"); // expect coil air flow to equal PTUnit heating air flow - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).RatedAirVolFlowRate, ZoneEqSizing(CurZoneEqNum).HeatingAirVolFlow); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).RatedAirVolFlowRate, PTUnit(1).MaxHeatAirVolFlow); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(9), PTUnit(1).MaxHeatAirVolFlow); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).RatedAirVolFlowRate, ZoneEqSizing(CurZoneEqNum).HeatingAirVolFlow); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).RatedAirVolFlowRate, PTUnit(1).MaxHeatAirVolFlow); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(9), PTUnit(1).MaxHeatAirVolFlow); // expect the ratio of air flow to capacity to equal to the reference air flow and capacity specified in coil input refAirflowCapacityRatio = 0.891980668 / 20894.501936; // speed 9 reference heating data - sizingAirflowCapacityRatio = VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(9) / VariableSpeedCoils::VarSpeedCoil(2).MSRatedTotCap(9); + sizingAirflowCapacityRatio = state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(9) / state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedTotCap(9); EXPECT_EQ(refAirflowCapacityRatio, sizingAirflowCapacityRatio); // this same ratio should also equal the internal flow per capacity variable used to back calculate operating air flow rate - EXPECT_EQ(sizingAirflowCapacityRatio, VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowPerRatedTotCap(9)); + EXPECT_EQ(sizingAirflowCapacityRatio, state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowPerRatedTotCap(9)); SizeFan(state, 1); // the fan vol flow rate should equal the max of cooling and heating coil flow rates - Real64 maxCoilAirFlow = max(VariableSpeedCoils::VarSpeedCoil( 1 ).RatedAirVolFlowRate, VariableSpeedCoils::VarSpeedCoil( 2 ).RatedAirVolFlowRate); + Real64 maxCoilAirFlow = max(state.dataVariableSpeedCoils->VarSpeedCoil( 1 ).RatedAirVolFlowRate, state.dataVariableSpeedCoils->VarSpeedCoil( 2 ).RatedAirVolFlowRate); EXPECT_EQ(Fan(1).MaxAirFlowRate, maxCoilAirFlow); EXPECT_EQ(Fan(1).MaxAirFlowRate, max(PTUnit(1).MaxCoolAirVolFlow, PTUnit(1).MaxHeatAirVolFlow)); @@ -561,7 +561,7 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) // VS coils set SystemAirFlow to true and AirVolFlow to a value, all PTUnits set CoolingAirFlow and HeatingAirFlow, and CoolingAirVolFlow and // HeatingAirVolFlow EXPECT_TRUE(ZoneEqSizing(1).SystemAirFlow); - EXPECT_EQ(ZoneEqSizing(1).AirVolFlow, VariableSpeedCoils::VarSpeedCoil(1).RatedAirVolFlowRate); + EXPECT_EQ(ZoneEqSizing(1).AirVolFlow, state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate); EXPECT_TRUE(ZoneEqSizing(1).CoolingAirFlow); EXPECT_TRUE(ZoneEqSizing(1).HeatingAirFlow); EXPECT_EQ(ZoneEqSizing(1).CoolingAirVolFlow, PTUnit(1).MaxCoolAirVolFlow); diff --git a/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc b/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc index a3a506efbe0..e4f04ae0fb1 100644 --- a/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc +++ b/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc @@ -51,59 +51,17 @@ #include // EnergyPlus Headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include -#include #include #include #include -#include #include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + +#include "Fixtures/EnergyPlusFixture.hh" using namespace EnergyPlus; using namespace OutputProcessor; @@ -112,22 +70,14 @@ using namespace DataPlant; using namespace DataSizing; using namespace OutputReportPredefined; -class SizingAnalysisObjectsTest : public testing::Test +class SizingAnalysisObjectsTest : public EnergyPlusFixture { -public: - Real64 lowLogVal; - Real64 midLogVal; - Real64 hiLogVal; - Real64 LogVal; // actual variable pointed to - int averagingWindow; - int logIndex; - - SizingLoggerFramework sizingLoggerFrameObj; - - // constructor for test fixture class - SizingAnalysisObjectsTest() +protected: + void SetUp() override { + EnergyPlus::EnergyPlusFixture::SetUp(); + state.files.eio.open_as_stringstream(); // fill in test log data values lowLogVal = 50.0; @@ -182,21 +132,22 @@ class SizingAnalysisObjectsTest : public testing::Test PlantLoop(1).VolumeWasAutoSized = true; SetPredefinedTables(); - } - // destructor - ~SizingAnalysisObjectsTest() - { - TotNumLoops = 0; - PlantLoop(1).LoopSide.deallocate(); - PlantLoop.deallocate(); - state.dataWeatherManager->Environment.deallocate(); - PlantSizData.deallocate(); - TimeValue.clear(); } + void TearDown() override + { + EnergyPlus::EnergyPlusFixture::TearDown(); // Remember to tear down the base fixture after cleaning up derived fixture! + }; - EnergyPlusData state; +public: + Real64 lowLogVal; + Real64 midLogVal; + Real64 hiLogVal; + Real64 LogVal; // actual variable pointed to + int averagingWindow; + int logIndex; + SizingLoggerFramework sizingLoggerFrameObj; }; TEST_F(SizingAnalysisObjectsTest, testZoneUpdateInLoggerFramework) diff --git a/tst/EnergyPlus/unit/SolarShading.unit.cc b/tst/EnergyPlus/unit/SolarShading.unit.cc index c438d79ee5b..647dfbb665c 100644 --- a/tst/EnergyPlus/unit/SolarShading.unit.cc +++ b/tst/EnergyPlus/unit/SolarShading.unit.cc @@ -654,7 +654,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_FigureSolarBeamAtTimestep) EXPECT_FALSE(FoundError); SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(); + SolarShading::DetermineShadowingCombinations(state); DataEnvironment::DayOfYear_Schedule = 168; DataEnvironment::DayOfWeek = 6; DataGlobals::TimeStep = 4; @@ -1050,7 +1050,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_ExternalShadingIO) EXPECT_FALSE(FoundError); SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(); + SolarShading::DetermineShadowingCombinations(state); DataEnvironment::DayOfYear_Schedule = 168; DataEnvironment::DayOfWeek = 6; DataGlobals::TimeStep = 4; @@ -1835,7 +1835,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonClippingDirect) EXPECT_FALSE(FoundError); SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(); + SolarShading::DetermineShadowingCombinations(state); DataEnvironment::DayOfYear_Schedule = 168; DataEnvironment::DayOfWeek = 6; DataGlobals::TimeStep = 4; @@ -2246,7 +2246,7 @@ WindowMaterial:SimpleGlazingSystem, EXPECT_FALSE(FoundError); SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(); + SolarShading::DetermineShadowingCombinations(state); std::string error_string = delimited_string({"** Severe ** Problem in interior solar distribution calculation (CHKBKS)"}); @@ -2559,7 +2559,7 @@ EXPECT_FALSE(FoundError); if (SolarShading::penumbra) { SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(); + SolarShading::DetermineShadowingCombinations(state); std::string error_string = delimited_string({"** Severe ** Problem in interior solar distribution calculation (CHKBKS)"}); diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 585082e9733..29fece299c4 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -3171,8 +3171,8 @@ TEST_F(EnergyPlusFixture, InitialAssociateWindowShadingControlFenestration_test) WindowShadingControl(3).FenestrationName(1) = "Fene-08"; WindowShadingControl(3).FenestrationName(2) = "Fene-09"; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).WindowTypeEQL = false; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).WindowTypeEQL = false; SurfaceTmp.allocate(9); @@ -3215,55 +3215,55 @@ TEST_F(EnergyPlusFixture, InitialAssociateWindowShadingControlFenestration_test) bool Err = false; int surfNum = 1; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).activeWindowShadingControl, 2); EXPECT_FALSE(Err); surfNum = 2; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).activeWindowShadingControl, 2); EXPECT_FALSE(Err); surfNum = 3; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).activeWindowShadingControl, 2); EXPECT_FALSE(Err); surfNum = 4; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).activeWindowShadingControl, 1); EXPECT_FALSE(Err); surfNum = 5; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).activeWindowShadingControl, 1); EXPECT_FALSE(Err); surfNum = 6; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).activeWindowShadingControl, 1); EXPECT_FALSE(Err); surfNum = 7; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).activeWindowShadingControl, 2); EXPECT_FALSE(Err); surfNum = 8; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).activeWindowShadingControl, 3); EXPECT_FALSE(Err); surfNum = 9; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).activeWindowShadingControl, 3); EXPECT_FALSE(Err); @@ -3305,8 +3305,8 @@ TEST_F(EnergyPlusFixture, InitialAssociateWindowShadingControlFenestration_Multi WindowShadingControl(3).FenestrationName(1) = "Fene-03"; WindowShadingControl(3).FenestrationName(2) = "Fene-05"; - dataConstruction.Construct.allocate(1); - dataConstruction.Construct(1).WindowTypeEQL = false; + state.dataConstruction->Construct.allocate(1); + state.dataConstruction->Construct(1).WindowTypeEQL = false; SurfaceTmp.allocate(5); @@ -3333,14 +3333,14 @@ TEST_F(EnergyPlusFixture, InitialAssociateWindowShadingControlFenestration_Multi bool Err = false; int surfNum = 1; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList.size(), 1u); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList[0], 1); EXPECT_FALSE(Err); surfNum = 2; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList.size(), 2u); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList[0], 1); @@ -3348,7 +3348,7 @@ TEST_F(EnergyPlusFixture, InitialAssociateWindowShadingControlFenestration_Multi EXPECT_FALSE(Err); surfNum = 3; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList.size(), 3u); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList[0], 1); @@ -3357,14 +3357,14 @@ TEST_F(EnergyPlusFixture, InitialAssociateWindowShadingControlFenestration_Multi EXPECT_FALSE(Err); surfNum = 4; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList.size(), 1u); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList[0], 2); EXPECT_FALSE(Err); surfNum = 5; - InitialAssociateWindowShadingControlFenestration(Err, surfNum); + InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); EXPECT_TRUE(SurfaceTmp(surfNum).HasShadeControl); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList.size(), 2u); EXPECT_EQ(SurfaceTmp(surfNum).windowShadingControlList[0], 2); @@ -3664,26 +3664,26 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_createAirMaterialFromDistance_Test) TEST_F(EnergyPlusFixture, SurfaceGeometry_createConstructionWithStorm_Test) { TotConstructs = 1; - dataConstruction.Construct.allocate(TotConstructs); + state.dataConstruction->Construct.allocate(TotConstructs); dataMaterial.Material.allocate(60); dataMaterial.Material(47).AbsorpThermalFront = 0.11; // Case 1a: Constructs with regular materials are a reverse of each other--material layers match in reverse (should get a "false" answer) - dataConstruction.Construct(TotConstructs).TotLayers = 3; - dataConstruction.Construct(TotConstructs).LayerPoint(1) = 11; - dataConstruction.Construct(TotConstructs).LayerPoint(2) = 22; - dataConstruction.Construct(TotConstructs).LayerPoint(3) = 33; + state.dataConstruction->Construct(TotConstructs).TotLayers = 3; + state.dataConstruction->Construct(TotConstructs).LayerPoint(1) = 11; + state.dataConstruction->Construct(TotConstructs).LayerPoint(2) = 22; + state.dataConstruction->Construct(TotConstructs).LayerPoint(3) = 33; - createConstructionWithStorm(1, "construction_A", 47, 59); + createConstructionWithStorm(state, 1, "construction_A", 47, 59); EXPECT_EQ(TotConstructs, 2); - EXPECT_EQ(dataConstruction.Construct(TotConstructs).Name, "construction_A"); - EXPECT_EQ(dataConstruction.Construct(TotConstructs).LayerPoint(1), 47); - EXPECT_EQ(dataConstruction.Construct(TotConstructs).LayerPoint(2), 59); - EXPECT_EQ(dataConstruction.Construct(TotConstructs).LayerPoint(3), 11); - EXPECT_EQ(dataConstruction.Construct(TotConstructs).LayerPoint(4), 22); - EXPECT_EQ(dataConstruction.Construct(TotConstructs).LayerPoint(5), 33); - EXPECT_EQ(dataConstruction.Construct(TotConstructs).OutsideAbsorpThermal, 0.11); + EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).Name, "construction_A"); + EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(1), 47); + EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(2), 59); + EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(3), 11); + EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(4), 22); + EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(5), 33); + EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).OutsideAbsorpThermal, 0.11); } @@ -4869,43 +4869,43 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test4) TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) { bool RevLayerDiffs; - dataConstruction.Construct.allocate(6); + state.dataConstruction->Construct.allocate(6); dataMaterial.Material.allocate(7); // Case 1a: Constructs with regular materials are a reverse of each other--material layers match in reverse (should get a "false" answer) - dataConstruction.Construct(1).TotLayers = 3; - dataConstruction.Construct(1).LayerPoint(1) = 1; - dataConstruction.Construct(1).LayerPoint(2) = 2; - dataConstruction.Construct(1).LayerPoint(3) = 3; - dataConstruction.Construct(2).TotLayers = 3; - dataConstruction.Construct(2).LayerPoint(1) = 3; - dataConstruction.Construct(2).LayerPoint(2) = 2; - dataConstruction.Construct(2).LayerPoint(3) = 1; + state.dataConstruction->Construct(1).TotLayers = 3; + state.dataConstruction->Construct(1).LayerPoint(1) = 1; + state.dataConstruction->Construct(1).LayerPoint(2) = 2; + state.dataConstruction->Construct(1).LayerPoint(3) = 3; + state.dataConstruction->Construct(2).TotLayers = 3; + state.dataConstruction->Construct(2).LayerPoint(1) = 3; + state.dataConstruction->Construct(2).LayerPoint(2) = 2; + state.dataConstruction->Construct(2).LayerPoint(3) = 1; RevLayerDiffs = true; // ExpectResult = false; - CheckForReversedLayers(RevLayerDiffs, 1, 2, 3); + CheckForReversedLayers(state, RevLayerDiffs, 1, 2, 3); EXPECT_FALSE(RevLayerDiffs); // Case 1a: Constructs with regular materials are not reverse of each other--material layers do not match in reverse (should get a "true" answer) - dataConstruction.Construct(2).LayerPoint(1) = 1; - dataConstruction.Construct(2).LayerPoint(3) = 3; + state.dataConstruction->Construct(2).LayerPoint(1) = 1; + state.dataConstruction->Construct(2).LayerPoint(3) = 3; dataMaterial.Material(1).Group = RegularMaterial; dataMaterial.Material(2).Group = RegularMaterial; dataMaterial.Material(3).Group = RegularMaterial; RevLayerDiffs = false; // ExpectResult = true; - CheckForReversedLayers(RevLayerDiffs, 1, 2, 3); + CheckForReversedLayers(state, RevLayerDiffs, 1, 2, 3); EXPECT_TRUE(RevLayerDiffs); // Case 2a: Constructs are reverse of each other using WindowGlass, front/back properties properly switched (should get a "false" answer) - dataConstruction.Construct(3).TotLayers = 3; - dataConstruction.Construct(3).LayerPoint(1) = 4; - dataConstruction.Construct(3).LayerPoint(2) = 2; - dataConstruction.Construct(3).LayerPoint(3) = 5; - dataConstruction.Construct(4).TotLayers = 3; - dataConstruction.Construct(4).LayerPoint(1) = 4; - dataConstruction.Construct(4).LayerPoint(2) = 2; - dataConstruction.Construct(4).LayerPoint(3) = 5; + state.dataConstruction->Construct(3).TotLayers = 3; + state.dataConstruction->Construct(3).LayerPoint(1) = 4; + state.dataConstruction->Construct(3).LayerPoint(2) = 2; + state.dataConstruction->Construct(3).LayerPoint(3) = 5; + state.dataConstruction->Construct(4).TotLayers = 3; + state.dataConstruction->Construct(4).LayerPoint(1) = 4; + state.dataConstruction->Construct(4).LayerPoint(2) = 2; + state.dataConstruction->Construct(4).LayerPoint(3) = 5; dataMaterial.Material(4).Group = WindowGlass; dataMaterial.Material(4).Thickness = 0.15; dataMaterial.Material(4).ReflectSolBeamFront = 0.35; @@ -4938,7 +4938,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) dataMaterial.Material(5).PoissonsRatio = 1.11; RevLayerDiffs = true; // ExpectResult = false; - CheckForReversedLayers(RevLayerDiffs, 3, 4, 3); + CheckForReversedLayers(state, RevLayerDiffs, 3, 4, 3); EXPECT_FALSE(RevLayerDiffs); // Case 2b: Constructs are reverse of each other using WindowGlass, front/back properties NOT properly switched (should get a "true" answer) @@ -4946,14 +4946,14 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) dataMaterial.Material(5).ReflectVisBeamBack = 0.24; // correct would be 0.34 RevLayerDiffs = false; // ExpectResult = true; - CheckForReversedLayers(RevLayerDiffs, 3, 4, 3); + CheckForReversedLayers(state, RevLayerDiffs, 3, 4, 3); EXPECT_TRUE(RevLayerDiffs); // Case 3a: Single layer constructs using Equivalent Glass, front/back properties properly switched (should get a "false" answer) - dataConstruction.Construct(5).TotLayers = 1; - dataConstruction.Construct(5).LayerPoint(1) = 6; - dataConstruction.Construct(6).TotLayers = 1; - dataConstruction.Construct(6).LayerPoint(1) = 7; + state.dataConstruction->Construct(5).TotLayers = 1; + state.dataConstruction->Construct(5).LayerPoint(1) = 6; + state.dataConstruction->Construct(6).TotLayers = 1; + state.dataConstruction->Construct(6).LayerPoint(1) = 7; dataMaterial.Material(6).Group = GlassEquivalentLayer; dataMaterial.Material(6).TausFrontBeamBeam = 0.39; dataMaterial.Material(6).TausBackBeamBeam = 0.29; @@ -5010,14 +5010,14 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) dataMaterial.Material(7).Resistance = 1.234; RevLayerDiffs = true; // ExpectResult = false; - CheckForReversedLayers(RevLayerDiffs, 5, 6, 1); + CheckForReversedLayers(state, RevLayerDiffs, 5, 6, 1); EXPECT_FALSE(RevLayerDiffs); // Case 3a: Single layer constructs using Equivalent Glass, front/back properties NOT properly switched (should get a "true" answer) dataMaterial.Material(7).EmissThermalFront = 0.888; RevLayerDiffs = false; // ExpectResult = true; - CheckForReversedLayers(RevLayerDiffs, 5, 6, 1); + CheckForReversedLayers(state, RevLayerDiffs, 5, 6, 1); EXPECT_TRUE(RevLayerDiffs); } diff --git a/tst/EnergyPlus/unit/SwimmingPool.unit.cc b/tst/EnergyPlus/unit/SwimmingPool.unit.cc index 05f867647a7..f37f9857b7f 100644 --- a/tst/EnergyPlus/unit/SwimmingPool.unit.cc +++ b/tst/EnergyPlus/unit/SwimmingPool.unit.cc @@ -265,7 +265,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) NumSwimmingPools = 1; Pool.allocate(NumSwimmingPools); DataSurfaces::Surface.allocate(1); - dataConstruction.Construct.allocate(1); + state.dataConstruction->Construct.allocate(1); // testing variables static std::string const Alpha1("FirstString"); @@ -279,7 +279,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) ErrFnd = false; poolReference.SurfacePtr = 0; - poolReference.ErrorCheckSetupPoolSurface(Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -288,7 +288,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) poolReference.SurfacePtr = 1; DataSurfaces::Surface(poolReference.SurfacePtr).IsRadSurfOrVentSlabOrPool = true; - poolReference.ErrorCheckSetupPoolSurface(Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -298,7 +298,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).IsRadSurfOrVentSlabOrPool = false; DataSurfaces::Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel_CondFD; - poolReference.ErrorCheckSetupPoolSurface(Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -309,7 +309,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel_CTF; DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass_Window; - poolReference.ErrorCheckSetupPoolSurface(Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -321,7 +321,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass_Floor; DataSurfaces::Surface(poolReference.SurfacePtr).MaterialMovInsulInt = 1; - poolReference.ErrorCheckSetupPoolSurface(Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -333,9 +333,9 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass_Floor; DataSurfaces::Surface(poolReference.SurfacePtr).MaterialMovInsulInt = 1; DataSurfaces::Surface(poolReference.SurfacePtr).Construction = 1; - dataConstruction.Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = true; + state.dataConstruction->Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = true; - poolReference.ErrorCheckSetupPoolSurface(Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -346,9 +346,9 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel_CTF; DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass_Wall; DataSurfaces::Surface(poolReference.SurfacePtr).MaterialMovInsulInt = 1; - dataConstruction.Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; + state.dataConstruction->Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; - poolReference.ErrorCheckSetupPoolSurface(Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -359,13 +359,13 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel_CTF; DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass_Floor; DataSurfaces::Surface(poolReference.SurfacePtr).MaterialMovInsulInt = 0; - dataConstruction.Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; + state.dataConstruction->Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; DataSurfaces::Surface(poolReference.SurfacePtr).Zone = 7; DataSurfaces::Surface(poolReference.SurfacePtr).IsRadSurfOrVentSlabOrPool = false; DataSurfaces::Surface(poolReference.SurfacePtr).IsPool = false; poolReference.ZonePtr = 0; - poolReference.ErrorCheckSetupPoolSurface(Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_FALSE(ErrFnd); EXPECT_TRUE(DataSurfaces::Surface(poolReference.SurfacePtr).IsRadSurfOrVentSlabOrPool); diff --git a/tst/EnergyPlus/unit/ThermalComfort.unit.cc b/tst/EnergyPlus/unit/ThermalComfort.unit.cc index 6c1b8fb2be8..cd7b974b7f8 100644 --- a/tst/EnergyPlus/unit/ThermalComfort.unit.cc +++ b/tst/EnergyPlus/unit/ThermalComfort.unit.cc @@ -713,7 +713,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) MRT(1) = 26.0; ZoneAirHumRatAvgComf(1) = 0.00529; // 0.002 to 0.006 - CalcThermalComfortFanger(); + CalcThermalComfortFanger(state); EXPECT_NEAR(ThermalComfortData(1).FangerPMV, -1.262, 0.005); EXPECT_NEAR(ThermalComfortData(1).FangerPPD, 38.3, 0.1); @@ -722,7 +722,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) MRT(1) = 27.0; ZoneAirHumRatAvgComf(1) = 0.00529; // 0.002 to 0.006 - CalcThermalComfortFanger(); + CalcThermalComfortFanger(state); EXPECT_NEAR(ThermalComfortData(1).FangerPMV, -0.860, 0.005); EXPECT_NEAR(ThermalComfortData(1).FangerPPD, 20.6, 0.1); @@ -731,7 +731,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) MRT(1) = 28.0; ZoneAirHumRatAvgComf(1) = 0.00529; // 0.002 to 0.006 - CalcThermalComfortFanger(); + CalcThermalComfortFanger(state); EXPECT_NEAR(ThermalComfortData(1).FangerPMV, -0.460, 0.005); EXPECT_NEAR(ThermalComfortData(1).FangerPPD, 9.4, 0.1); @@ -740,7 +740,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) MRT(1) = 26.0; ZoneAirHumRatAvgComf(1) = 0.00629; // 0.002 to 0.006 - CalcThermalComfortFanger(); + CalcThermalComfortFanger(state); EXPECT_NEAR(ThermalComfortData(1).FangerPMV, -1.201, 0.005); EXPECT_NEAR(ThermalComfortData(1).FangerPPD, 35.3, 0.1); @@ -761,7 +761,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcSurfaceWeightedMRT) NumOfZones = 1; TH.allocate(2, 2, TotSurfaces); Surface.allocate(TotSurfaces); - dataConstruction.Construct.allocate(TotSurfaces); + state.dataConstruction->Construct.allocate(TotSurfaces); Zone.allocate(1); Surface(1).Area = 20.0; @@ -773,9 +773,9 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcSurfaceWeightedMRT) Surface(1).Construction = 1; Surface(2).Construction = 2; Surface(3).Construction = 3; - dataConstruction.Construct(1).InsideAbsorpThermal = 1.0; - dataConstruction.Construct(2).InsideAbsorpThermal = 0.9; - dataConstruction.Construct(3).InsideAbsorpThermal = 0.8; + state.dataConstruction->Construct(1).InsideAbsorpThermal = 1.0; + state.dataConstruction->Construct(2).InsideAbsorpThermal = 0.9; + state.dataConstruction->Construct(3).InsideAbsorpThermal = 0.8; Surface(1).Zone = 1; Surface(2).Zone = 1; Surface(3).Zone = 1; @@ -787,17 +787,17 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcSurfaceWeightedMRT) SurfNum = 1; ThermalComfort::clear_state(); - RadTemp = CalcSurfaceWeightedMRT(ZoneNum, SurfNum); + RadTemp = CalcSurfaceWeightedMRT(state, ZoneNum, SurfNum); EXPECT_NEAR(RadTemp, 16.6, 0.1); SurfNum = 2; ThermalComfort::clear_state(); - RadTemp = CalcSurfaceWeightedMRT(ZoneNum, SurfNum); + RadTemp = CalcSurfaceWeightedMRT(state, ZoneNum, SurfNum); EXPECT_NEAR(RadTemp, 16.1, 0.1); SurfNum = 3; ThermalComfort::clear_state(); - RadTemp = CalcSurfaceWeightedMRT(ZoneNum, SurfNum); + RadTemp = CalcSurfaceWeightedMRT(state, ZoneNum, SurfNum); EXPECT_NEAR(RadTemp, 14.0, 0.1); } @@ -822,9 +822,9 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcAngleFactorMRT) TotSurfaces = AngleFactorList(1).TotAngleFacSurfaces; TH.allocate(2, 2, TotSurfaces); Surface.deallocate(); - dataConstruction.Construct.deallocate(); + state.dataConstruction->Construct.deallocate(); Surface.allocate(TotSurfaces); - dataConstruction.Construct.allocate(TotSurfaces); + state.dataConstruction->Construct.allocate(TotSurfaces); TH(2, 1, 1) = 20.0; TH(2, 1, 2) = 15.0; @@ -832,11 +832,11 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcAngleFactorMRT) Surface(1).Construction = 1; Surface(2).Construction = 2; Surface(3).Construction = 3; - dataConstruction.Construct(1).InsideAbsorpThermal = 1.0; - dataConstruction.Construct(2).InsideAbsorpThermal = 0.9; - dataConstruction.Construct(3).InsideAbsorpThermal = 0.8; + state.dataConstruction->Construct(1).InsideAbsorpThermal = 1.0; + state.dataConstruction->Construct(2).InsideAbsorpThermal = 0.9; + state.dataConstruction->Construct(3).InsideAbsorpThermal = 0.8; - RadTemp = CalcAngleFactorMRT(1); + RadTemp = CalcAngleFactorMRT(state, 1); EXPECT_NEAR(RadTemp, 16.9, 0.1); } @@ -992,7 +992,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortPierceSET) QSteamBaseboardToPerson(1) = 0.0; QElecBaseboardToPerson(1) = 0.0; - CalcThermalComfortPierce(); + CalcThermalComfortPierce(state); EXPECT_NEAR(ThermalComfortData(1).PiercePMVSET, -3.350, 0.005); EXPECT_NEAR(ThermalComfortData(1).PierceSET, 23.62, 0.01); diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 9e08d7b436b..449dc240209 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -2821,66 +2821,66 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultispeedPerformance) EXPECT_EQ(RatedSourceTempCool, 35.0); Real64 CoolCoolCapAtPeak = 32454.876753104443; Real64 TotCapTempModFac = CurveManager::CurveValue( - state, VariableSpeedCoils::VarSpeedCoil(1).MSCCapFTemp(VariableSpeedCoils::VarSpeedCoil(1).NormSpedLevel), 17.410329442560833, RatedSourceTempCool); + state, state.dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapFTemp(state.dataVariableSpeedCoils->VarSpeedCoil(1).NormSpedLevel), 17.410329442560833, RatedSourceTempCool); EXPECT_NEAR(TotCapTempModFac, 0.930018048445091, 0.001); Real64 RatedCapCoolTotalDes = CoolCoolCapAtPeak / TotCapTempModFac; EXPECT_NEAR(RatedCapCoolTotalDes, 34897.0396944, 0.001); EXPECT_NEAR(thisSys->m_DesignCoolingCapacity, RatedCapCoolTotalDes, 0.001); - EXPECT_EQ(thisSys->m_DesignCoolingCapacity, VariableSpeedCoils::VarSpeedCoil(1).RatedCapCoolTotal); + EXPECT_EQ(thisSys->m_DesignCoolingCapacity, state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedCapCoolTotal); EXPECT_NEAR(thisSys->m_DesignHeatingCapacity, RatedCapCoolTotalDes, 0.001); - EXPECT_EQ(thisSys->m_DesignHeatingCapacity, VariableSpeedCoils::VarSpeedCoil(2).RatedCapHeat); + EXPECT_EQ(thisSys->m_DesignHeatingCapacity, state.dataVariableSpeedCoils->VarSpeedCoil(2).RatedCapHeat); // variable speed coils size air flow differently than other models. The design air volume flow rate is back calculated from design capacity - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).RatedAirVolFlowRate, - VariableSpeedCoils::VarSpeedCoil(1).RatedCapCoolTotal * VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowPerRatedTotCap(10)); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedCapCoolTotal * state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowPerRatedTotCap(10)); Real64 fullFlow = 1.949442; - EXPECT_NEAR(VariableSpeedCoils::VarSpeedCoil(1).RatedAirVolFlowRate, fullFlow, 0.00001); // different than unitary system air volume flow rate - EXPECT_NEAR(VariableSpeedCoils::VarSpeedCoil(2).RatedAirVolFlowRate, 1.70, 0.01); // VS DX heating coil was not autosized + EXPECT_NEAR(state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate, fullFlow, 0.00001); // different than unitary system air volume flow rate + EXPECT_NEAR(state.dataVariableSpeedCoils->VarSpeedCoil(2).RatedAirVolFlowRate, 1.70, 0.01); // VS DX heating coil was not autosized // checks on autosized cooling air flow rates EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[1], fullFlow * 0.1, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_CoolVolumeFlowRate[1]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_CoolVolumeFlowRate[1]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[2], fullFlow * 0.2, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_CoolVolumeFlowRate[2]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_CoolVolumeFlowRate[2]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[3], fullFlow * 0.3, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_CoolVolumeFlowRate[3]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_CoolVolumeFlowRate[3]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[4], fullFlow * 0.4, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(4), thisSys->m_CoolVolumeFlowRate[4]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(4), thisSys->m_CoolVolumeFlowRate[4]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[5], fullFlow * 0.5, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(5), thisSys->m_CoolVolumeFlowRate[5]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(5), thisSys->m_CoolVolumeFlowRate[5]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[6], fullFlow * 0.6, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(6), thisSys->m_CoolVolumeFlowRate[6]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(6), thisSys->m_CoolVolumeFlowRate[6]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[7], fullFlow * 0.7, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(7), thisSys->m_CoolVolumeFlowRate[7]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(7), thisSys->m_CoolVolumeFlowRate[7]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[8], fullFlow * 0.8, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(8), thisSys->m_CoolVolumeFlowRate[8]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(8), thisSys->m_CoolVolumeFlowRate[8]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[9], fullFlow * 0.9, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(9), thisSys->m_CoolVolumeFlowRate[9]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9), thisSys->m_CoolVolumeFlowRate[9]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[10], fullFlow * 1.0, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(10), thisSys->m_CoolVolumeFlowRate[10]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(10), thisSys->m_CoolVolumeFlowRate[10]); // checks on autosized heating air flow rates EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[1], 0.171700, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(1), thisSys->m_HeatVolumeFlowRate[1]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(1), thisSys->m_HeatVolumeFlowRate[1]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[2], 0.341700, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(2), thisSys->m_HeatVolumeFlowRate[2]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(2), thisSys->m_HeatVolumeFlowRate[2]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[3], 0.511699, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(3), thisSys->m_HeatVolumeFlowRate[3]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(3), thisSys->m_HeatVolumeFlowRate[3]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[4], 0.681699, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(4), thisSys->m_HeatVolumeFlowRate[4]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(4), thisSys->m_HeatVolumeFlowRate[4]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[5], 0.851700, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(5), thisSys->m_HeatVolumeFlowRate[5]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(5), thisSys->m_HeatVolumeFlowRate[5]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[6], 1.021699, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(6), thisSys->m_HeatVolumeFlowRate[6]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(6), thisSys->m_HeatVolumeFlowRate[6]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[7], 1.191700, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(7), thisSys->m_HeatVolumeFlowRate[7]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(7), thisSys->m_HeatVolumeFlowRate[7]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[8], 1.361700, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(8), thisSys->m_HeatVolumeFlowRate[8]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(8), thisSys->m_HeatVolumeFlowRate[8]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[9], 1.531700, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(9), thisSys->m_HeatVolumeFlowRate[9]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(9), thisSys->m_HeatVolumeFlowRate[9]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[10], 1.700000, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(10), thisSys->m_HeatVolumeFlowRate[10]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(10), thisSys->m_HeatVolumeFlowRate[10]); // spot check MSHP volume flow rate data. NOTE: design spec object is 0 based EXPECT_EQ(thisSys->m_CoolVolumeFlowRate[7], thisSys->m_CoolVolumeFlowRate[10] * UnitarySystems::designSpecMSHP[0].coolingVolFlowRatio[6]); @@ -7499,7 +7499,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXCoilSizing) EXPECT_EQ(thisSys->m_DesignCoolingCapacity, DXCoils::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, - VariableSpeedCoils::VarSpeedCoil(thisSys->m_HeatingCoilIndex).MSRatedTotCap(thisSys->m_NumOfSpeedHeating), + state.dataVariableSpeedCoils->VarSpeedCoil(thisSys->m_HeatingCoilIndex).MSRatedTotCap(thisSys->m_NumOfSpeedHeating), 0.001); // 3 cooling speeds with autosized MSHP design spec yielding equally distributed air flow at 1/3 per speed @@ -7526,25 +7526,25 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXCoilSizing) // 10 heating speeds with autosized MSHP design spec yielding equally distributed air flow at 1/10 per speed EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[1], 0.008237, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_HeatVolumeFlowRate[1]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_HeatVolumeFlowRate[1]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[2], 0.016473, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_HeatVolumeFlowRate[2]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_HeatVolumeFlowRate[2]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[3], 0.024710, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_HeatVolumeFlowRate[3]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_HeatVolumeFlowRate[3]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[4], 0.032946, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(4), thisSys->m_HeatVolumeFlowRate[4]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(4), thisSys->m_HeatVolumeFlowRate[4]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[5], 0.041183, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(5), thisSys->m_HeatVolumeFlowRate[5]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(5), thisSys->m_HeatVolumeFlowRate[5]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[6], 0.049420, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(6), thisSys->m_HeatVolumeFlowRate[6]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(6), thisSys->m_HeatVolumeFlowRate[6]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[7], 0.057656, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(7), thisSys->m_HeatVolumeFlowRate[7]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(7), thisSys->m_HeatVolumeFlowRate[7]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[8], 0.065892, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(8), thisSys->m_HeatVolumeFlowRate[8]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(8), thisSys->m_HeatVolumeFlowRate[8]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[9], 0.074129, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(9), thisSys->m_HeatVolumeFlowRate[9]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9), thisSys->m_HeatVolumeFlowRate[9]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[10], 0.082366, 0.000001); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(10), thisSys->m_HeatVolumeFlowRate[10]); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(10), thisSys->m_HeatVolumeFlowRate[10]); } TEST_F(EnergyPlusFixture, UnitarySystemModel_WaterToAirHeatPump) @@ -14693,9 +14693,9 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_VariableSpeedDXCoilsNoLoadFlowRate EXPECT_EQ(1.500, thisSys->m_MaxHeatAirVolFlow); Real64 results_noLoadHeatingFlowRatio = - VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(1) / VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(5); + state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1) / state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(5); Real64 results_noLoadCoolingFlowRatio = - VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(1) / VariableSpeedCoils::VarSpeedCoil(2).MSRatedAirVolFlowRate(5); + state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(1) / state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(5); Real64 results_noLoadFlowRatioMin = min(results_noLoadHeatingFlowRatio, results_noLoadCoolingFlowRatio); EXPECT_NEAR(results_noLoadFlowRatioMin, thisSys->m_NoLoadAirFlowRateRatio, 0.00001); diff --git a/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc b/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc index ceb0ba14a5c..b11f2ceb3c5 100644 --- a/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc +++ b/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc @@ -2487,9 +2487,9 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_mixedCoilTypesInput) VariableSpeedCoils::GetVarSpeedCoilInput(state); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(1).Name, "LOBBY_ZN_1_FLR_2 WSHP COOLING MODE"); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).Name, "LOBBY_ZN_1_FLR_2 WSHP COOLING MODE"); - EXPECT_EQ(VariableSpeedCoils::VarSpeedCoil(2).Name, "PSZ-AC_1:5_COOLC STANDARD 4-COMPRESSOR IPAK"); + EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).Name, "PSZ-AC_1:5_COOLC STANDARD 4-COMPRESSOR IPAK"); } TEST_F(EnergyPlusFixture, CoilHeatingDXVariableSpeed_MinOADBTempCompOperLimit) @@ -2656,8 +2656,8 @@ TEST_F(EnergyPlusFixture, CoilHeatingDXVariableSpeed_MinOADBTempCompOperLimit) VariableSpeedCoils::GetVarSpeedCoilInput(state); - ASSERT_EQ("HEATING COIL VARIABLESPEED", VariableSpeedCoils::VarSpeedCoil(1).Name); // Heating Coil Variable Speed - ASSERT_EQ(-60.0, VariableSpeedCoils::VarSpeedCoil(1).MinOATCompressor); // removed the minimum limit of -50.0C + ASSERT_EQ("HEATING COIL VARIABLESPEED", state.dataVariableSpeedCoils->VarSpeedCoil(1).Name); // Heating Coil Variable Speed + ASSERT_EQ(-60.0, state.dataVariableSpeedCoils->VarSpeedCoil(1).MinOATCompressor); // removed the minimum limit of -50.0C } TEST_F(EnergyPlusFixture, VariableSpeedCoils_Test_CalcTotCap_VSWSHP) @@ -2757,25 +2757,25 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_Test_CalcTotCap_VSWSHP) Real64 LSInletHumRat = 0.013019367; Real64 LSInletEnth = 57256.90248; Real64 LSInletWBTemp = 20.0; - Real64 AirMassFlowRatio = VariableSpeedCoils::VarSpeedCoil(1).MSRatedAirVolFlowRate(1); + Real64 AirMassFlowRatio = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1); Real64 WaterMassFlowRatio = 0.0; Real64 LSMassFlowRate = 1.45; Real64 CBFSpeed = 0.000001; - Real64 MSRatedTotCap = VariableSpeedCoils::VarSpeedCoil(1).MSRatedTotCap(1); - int MSCapFTemp = VariableSpeedCoils::VarSpeedCoil(1).MSCCapFTemp(1); - int MSCapAirFFlow = VariableSpeedCoils::VarSpeedCoil(1).MSCCapAirFFlow(1); - int MSCapWaterFFlow = VariableSpeedCoils::VarSpeedCoil(1).MSCCapWaterFFlow(1); + Real64 MSRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedTotCap(1); + int MSCapFTemp = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapFTemp(1); + int MSCapAirFFlow = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapAirFFlow(1); + int MSCapWaterFFlow = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapWaterFFlow(1); Real64 QLoadTotal = 0.0; Real64 QLoadTotal1 = 0.0; Real64 QLoadTotal2 = 0.0; - Real64 SHR = VariableSpeedCoils::VarSpeedCoil(1).MSRatedSHR(1); + Real64 SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedSHR(1); Real64 SSInletTemp = 24.0; Real64 InletAirPressure = 101320.0; VariableSpeedCoils::CalcTotCapSHR_VSWSHP(state, LSInletDBTemp, LSInletHumRat, LSInletEnth, LSInletWBTemp, AirMassFlowRatio, WaterMassFlowRatio, LSMassFlowRate, CBFSpeed, MSRatedTotCap, MSCapFTemp, MSCapAirFFlow, MSCapWaterFFlow, 0.0, 0, 0, 0, QLoadTotal1, QLoadTotal2, QLoadTotal, SHR, SSInletTemp, InletAirPressure, 0.0, 1, - VariableSpeedCoils::VarSpeedCoil(1).capModFacTotal); + state.dataVariableSpeedCoils->VarSpeedCoil(1).capModFacTotal); // same calculations as in CalcTotCapSHR_VSWSHP (except CapFTemp term is 1 so no need to add that calc here) Real64 hDelta = MSRatedTotCap / LSMassFlowRate; // Change in air enthalpy across the cooling coil [J/kg] diff --git a/tst/EnergyPlus/unit/VentilatedSlab.unit.cc b/tst/EnergyPlus/unit/VentilatedSlab.unit.cc index 92952bc7f21..5c7b020bb75 100644 --- a/tst/EnergyPlus/unit/VentilatedSlab.unit.cc +++ b/tst/EnergyPlus/unit/VentilatedSlab.unit.cc @@ -85,13 +85,13 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) Real64 PowerMet = 0.0; Real64 LatOutputProvided = 0.0; - NumOfVentSlabs = 1; - VentSlab.allocate(NumOfVentSlabs); + state.dataVentilatedSlab->NumOfVentSlabs = 1; + state.dataVentilatedSlab->VentSlab.allocate(state.dataVentilatedSlab->NumOfVentSlabs); int Item = 1; int FanOutletNode = 1; int OutletNode = 2; - VentSlab(Item).FanOutletNode = FanOutletNode; - VentSlab(Item).RadInNode = OutletNode; + state.dataVentilatedSlab->VentSlab(Item).FanOutletNode = FanOutletNode; + state.dataVentilatedSlab->VentSlab(Item).RadInNode = OutletNode; Node.allocate(2); Node(OutletNode).MassFlowRate = 0.5; @@ -108,12 +108,12 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) Node(FanOutletNode).HumRat = 0.003; Node(OutletNode).Temp = 20.0; Node(OutletNode).HumRat = 0.003; - CalcVentilatedSlabCoilOutput(Item, PowerMet, LatOutputProvided); + CalcVentilatedSlabCoilOutput(state, Item, PowerMet, LatOutputProvided); - EXPECT_TRUE(VentSlab(Item).HeatCoilPower > 0.0); - EXPECT_TRUE(VentSlab(Item).SensCoolCoilPower == 0.0); - EXPECT_TRUE(VentSlab(Item).TotCoolCoilPower == 0.0); - EXPECT_TRUE(VentSlab(Item).LateCoolCoilPower == 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).HeatCoilPower > 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower == 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower == 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower == 0.0); EXPECT_TRUE(LatOutputProvided == 0.0); EXPECT_TRUE(PowerMet > 0.0); @@ -122,12 +122,12 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) Node(FanOutletNode).HumRat = 0.003; Node(OutletNode).Temp = 20.0; Node(OutletNode).HumRat = 0.003; - CalcVentilatedSlabCoilOutput(Item, PowerMet, LatOutputProvided); + CalcVentilatedSlabCoilOutput(state, Item, PowerMet, LatOutputProvided); - EXPECT_TRUE(VentSlab(Item).HeatCoilPower == 0.0); - EXPECT_TRUE(VentSlab(Item).SensCoolCoilPower > 0.0); - EXPECT_TRUE(VentSlab(Item).TotCoolCoilPower == VentSlab(Item).SensCoolCoilPower); - EXPECT_TRUE(VentSlab(Item).LateCoolCoilPower == 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).HeatCoilPower == 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower > 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower == state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower == 0.0); EXPECT_TRUE(LatOutputProvided == 0.0); EXPECT_TRUE(PowerMet < 0.0); @@ -136,12 +136,12 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) Node(FanOutletNode).HumRat = 0.008; Node(OutletNode).Temp = 20.0; Node(OutletNode).HumRat = 0.003; - CalcVentilatedSlabCoilOutput(Item, PowerMet, LatOutputProvided); + CalcVentilatedSlabCoilOutput(state, Item, PowerMet, LatOutputProvided); - EXPECT_TRUE(VentSlab(Item).HeatCoilPower == 0.0); - EXPECT_TRUE(VentSlab(Item).SensCoolCoilPower > 0.0); - EXPECT_TRUE(VentSlab(Item).TotCoolCoilPower > VentSlab(Item).SensCoolCoilPower); - EXPECT_TRUE(VentSlab(Item).LateCoolCoilPower > 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).HeatCoilPower == 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower > 0.0); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower > state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower); + EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower > 0.0); EXPECT_TRUE(LatOutputProvided < 0.0); EXPECT_TRUE(PowerMet < 0.0); @@ -2329,11 +2329,11 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_InitVentilatedSlabTest) EXPECT_FALSE(ErrorsFound); GetVentilatedSlabInput(state); // read ventilated slab data - EXPECT_EQ(2, NumOfVentSlabs); - EXPECT_EQ("ZONE1VENTSLAB", VentSlab(1).Name); - EXPECT_EQ("ZONE4VENTSLAB", VentSlab(2).Name); + EXPECT_EQ(2, state.dataVentilatedSlab->NumOfVentSlabs); + EXPECT_EQ("ZONE1VENTSLAB", state.dataVentilatedSlab->VentSlab(1).Name); + EXPECT_EQ("ZONE4VENTSLAB", state.dataVentilatedSlab->VentSlab(2).Name); InitVentilatedSlab(state, Item, VentSlabZoneNum, FirstHVACIteration); - EXPECT_EQ(324.38499999999999, VentSlab(1).TotalSurfaceArea); - EXPECT_EQ(139.21499999999997, VentSlab(2).TotalSurfaceArea); + EXPECT_EQ(324.38499999999999, state.dataVentilatedSlab->VentSlab(1).TotalSurfaceArea); + EXPECT_EQ(139.21499999999997, state.dataVentilatedSlab->VentSlab(2).TotalSurfaceArea); } diff --git a/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc b/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc index 7290bf51a93..06dcf0ca665 100644 --- a/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc +++ b/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc @@ -196,7 +196,7 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_GetInput) int ConstrNum = 1; int EQLNum = 0; InitEquivalentLayerWindowCalculations(state); - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; EXPECT_EQ(CFS(EQLNum).L(CFS(EQLNum).VBLayerPtr).CNTRL, state.dataWindowEquivalentLayer->lscVBNOBM); } @@ -940,8 +940,8 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_InvalidLayerTest) GetConstructData(state, ErrorsFound); EXPECT_EQ(1, DataHeatBalance::TotConstructs); EXPECT_EQ(1, DataWindowEquivalentLayer::TotWinEquivLayerConstructs); - EXPECT_TRUE(dataConstruction.Construct(1).TypeIsWindow); - EXPECT_TRUE(dataConstruction.Construct(1).WindowTypeEQL); + EXPECT_TRUE(state.dataConstruction->Construct(1).TypeIsWindow); + EXPECT_TRUE(state.dataConstruction->Construct(1).WindowTypeEQL); EXPECT_TRUE(ErrorsFound); // error found due to invalid layer } @@ -1959,14 +1959,14 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBEffectiveEmissivityTest) } // get equivalent layer window contruction index for (int ConstrPtr = 1; ConstrPtr <= DataHeatBalance::TotConstructs; ++ConstrPtr) { - if (dataConstruction.Construct(ConstrPtr).WindowTypeEQL) { + if (state.dataConstruction->Construct(ConstrPtr).WindowTypeEQL) { ConstrNum = ConstrPtr; } } // check VB slat angle control for FixedSlatAngle EXPECT_EQ(dataMaterial.Material(VBMatNum).SlatAngleType, state.dataWindowEquivalentLayer->lscNONE); - EQLNum = dataConstruction.Construct(ConstrNum).EQLConsPtr; + EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; // check number of solid layers EXPECT_EQ(CFS(EQLNum).NL, 3); // check optical and thermal property of the VB layer (Inside Layer) @@ -1975,7 +1975,7 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBEffectiveEmissivityTest) EXPECT_EQ(CFS(EQLNum).L(3).LWP_MAT.EPSLF, 0.90); EXPECT_EQ(CFS(EQLNum).L(3).LWP_MAT.EPSLB, 0.90); // check inside face effective emissivity - EXPECT_NEAR(dataConstruction.Construct(ConstrNum).InsideAbsorpThermal, 0.91024, 0.00001); + EXPECT_NEAR(state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal, 0.91024, 0.00001); // for fixed slate angle the emissivity remains the same - EXPECT_NEAR(EQLWindowInsideEffectiveEmiss(ConstrNum), 0.91024, 0.00001); + EXPECT_NEAR(EQLWindowInsideEffectiveEmiss(state, ConstrNum), 0.91024, 0.00001); } diff --git a/tst/EnergyPlus/unit/WindowManager.unit.cc b/tst/EnergyPlus/unit/WindowManager.unit.cc index bb10b5270f5..c928ae70762 100644 --- a/tst/EnergyPlus/unit/WindowManager.unit.cc +++ b/tst/EnergyPlus/unit/WindowManager.unit.cc @@ -227,8 +227,8 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) int cNum; - for (size_t i = 1; i <= dataConstruction.Construct.size(); ++i) { - if (dataConstruction.Construct(i).TypeIsWindow) { + for (size_t i = 1; i <= state.dataConstruction->Construct.size(); ++i) { + if (state.dataConstruction->Construct(i).TypeIsWindow) { cNum = i; } } @@ -251,7 +251,7 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) DataHeatBalFanSys::MAT.dimension(1, T_in); // initial guess temperatures - int numTemps = 2 + 2 * dataConstruction.Construct(cNum).TotGlassLayers; + int numTemps = 2 + 2 * state.dataConstruction->Construct(cNum).TotGlassLayers; Real64 inSurfTemp = T_in - (1.0 / (numTemps - 1)) * (T_in - T_out); Real64 outSurfTemp = T_out + (1.0 / (numTemps - 1)) * (T_in - T_out);