diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 19c8da226b7..60f882d19e1 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -47,7 +47,7 @@ jobs: path: ./dist - name: Deploy on Test PyPi - uses: pypa/gh-action-pypi-publish@v1.9.0 + uses: pypa/gh-action-pypi-publish@v1.10.1 with: repository-url: https://test.pypi.org/legacy/ user: __token__ diff --git a/doc/engineering-reference/src/integrated-solution-manager/summary-of-time-marching-solution.tex b/doc/engineering-reference/src/integrated-solution-manager/summary-of-time-marching-solution.tex index 2628924b7b0..a2de37e2bf0 100644 --- a/doc/engineering-reference/src/integrated-solution-manager/summary-of-time-marching-solution.tex +++ b/doc/engineering-reference/src/integrated-solution-manager/summary-of-time-marching-solution.tex @@ -97,6 +97,9 @@ \subsubsection{SpaceHVAC:ZoneEquipmentMixer Adjustments}\label{space-hvac-zoneeq After all of the zone HVAC equipment is simulated, the flow rates on the space outlet nodes are set to the space fraction times the zone equipment inlet node flow rate. +\subsubsection{SpaceHVAC:ZoneReturnMixer Adjustments}\label{space-hvac-zoneretmixer-adjustments} +When a SpaceHVAC:ZoneReturnMixer is used, after zone-level return node flow rates are set, the space return node flow rates are set. The space flow rates are set based on the same method used for zones (sum of inlet flows minus sum of exhaust flows). Then the space flow rates are adjusted proportionately so the sum is equal to the previously determined zone-level return node flow rate. Then the conditions on the zone return nodes are set to the combined space outlet node conditions weighted by the space return node flow rates. + \subsection{References}\label{references-043} Ceylan, H. T., and G. E. Myers. 1980. Long-time Solutions to Heat Conduction Transients with Time-Dependent Inputs. ASME Journal of Heat Transfer, Volume 102, No. 1, pp.~115-120. diff --git a/doc/engineering-reference/src/loop-equipment-sizing-and-other-design-data/zone-design-loads-and-air-flow-rates.tex b/doc/engineering-reference/src/loop-equipment-sizing-and-other-design-data/zone-design-loads-and-air-flow-rates.tex index c0cffe63c7d..e88ff4790ea 100644 --- a/doc/engineering-reference/src/loop-equipment-sizing-and-other-design-data/zone-design-loads-and-air-flow-rates.tex +++ b/doc/engineering-reference/src/loop-equipment-sizing-and-other-design-data/zone-design-loads-and-air-flow-rates.tex @@ -243,6 +243,12 @@ \subsubsection{EndZoneSizingCalc}\label{endzonesizingcalc} If \emph{heating design air flow method} is \emph{flow/zone}, then \emph{heating design air flow rate} will be used for the design max heating air flow rate. If \emph{heating design air flow method} is \emph{design day}, then the design day calculation will set the design max heating air flow rate. If \emph{heating design air flow method} is \emph{design day with limit}, then the maximum from \emph{heating max flow per area}, \emph{heating max flow} and \emph{heating max flow fraction} will set an upper limit on the design max heating air flow rate. The design max heating air flow rate must always be \textgreater{} = the ventilation requirement. In each case, the outside airflow will be modified based on zone ventilation effectiveness specified in the zone sizing object. +\subsection{Space Sizing}\label{space-sizing} +When ZoneAirHeatBalanceAlgorithm ``Do Space Heat Balance for Sizing'' is ``Yes'', the same sizing calculations described above will be performed for each space that is part of a controlled zone, using the same thermostat setpoints as the parent zone. The space sizing results will be reported the same as zone sizing results (eio, table, and spsz outputs). + +\subsection{NonCoincident Zone Sizing}\label{noncoincident-zone-sizing} +Sizing:Zone has an option for ``Type of Space Sum to Use'', ``Coincident'' or ``NonCoincident''. Coincident zone sizing (the default) is always calculated first, with all spaces in the zone lumped together. For ``NonCoincident'' zone sizing, if the zone contains more than one space, the zone sizing results will be overwritten using the sums and averages of the space sizing results. If all spaces for a given load type (heating or cooling) peak on the same design day, then that day will be reported as the zone peak day, otherwise the zone design day will be "N/A". The zone peak time will be determined by scanning the peak zone sequential loads which are calculated by summing the space peak day sequential loads. + \textbf{This concludes the calculation of the zone design flow rates and loads.} \subsection{Air Terminal Unit Sizing}\label{air-terminal-unit-sizing} diff --git a/doc/engineering-reference/src/special-modules-reporting/resilience-metrics.tex b/doc/engineering-reference/src/special-modules-reporting/resilience-metrics.tex index 8f2b0d478dc..3055edd3414 100644 --- a/doc/engineering-reference/src/special-modules-reporting/resilience-metrics.tex +++ b/doc/engineering-reference/src/special-modules-reporting/resilience-metrics.tex @@ -66,69 +66,17 @@ \subsubsection{Heat Index}\label{heat-index} \end{tabular} \end{table} -The computation of the heat index is a refinement of a result obtained by +Before version 24.2, the computation of the heat index is a refinement of a result obtained by multiple regression analysis carried out by Lans P. Rothfusz and described in a -1990 National Weather Service (NWS) Technical Attachment (SR 90-23) [4-5]. The -calculation is based on degree Fahrenheit. +1990 National Weather Service (NWS) Technical Attachment (SR 90-23) [4-5]. -The regression equation of Rothfusz is -\begin{equation} \label{eq:rm-1} -HI = c_1 + c_2T + c_3R + c_4TR + c_5T^2 + c_6R^2 + c_7T^2R + c_8TR^2 + c_9T^2R^2 -\end{equation} - -where - -HI = heat index (expressed as an apparent temperature in degrees Fahrenheit), - -T = ambient dry-bulb temperature (in degrees Fahrenheit), - -R = relative humidity (percentage value between 0 and 100), - -$c_1$ = -42.379, - -$c_2$ = 2.04901523, - -$c_3$ = 10.14333127, - -$c_4$ = -0.22475541, - -$c_5$ = -0.00683783, - -$c_6$ = -0.05481717, - -$c_7$ = 0.00122874, - -$c_8$ = 0.00085282, - -$c_9$ = -0.00000199. - -If the RH is less than 13\% and the temperature is between 80 and \IP{112}{\fahrenheit}, then -the following adjustment is subtracted from HI: - -\begin{equation} \label{eq:rm-2} -HI = (13 - R) / 4 * ((17 - |T - 95|) / 17)^{0.5} -\end{equation} - -Otherwise, if the RH is greater than 85\% and the temperature is between 80 and -\IP{87}{\fahrenheit}, then the following adjustment is added to HI: - -\begin{equation} \label{eq:rm-3} -HI = (R - 85) / 10 * (87 - T) / 5 -\end{equation} - -The Rothfusz regression is not appropriate when conditions of temperature and -humidity warrant a heat index value below about \IP{80}{\fahrenheit}. In those cases, a simpler -formula is applied to calculate values consistent with Steadman's results: - -\begin{equation} \label{eq:rm-4} -HI = 0.5 * (T + 61.0 + (T - 68.0) * 1.2 + (R * 0.094)) -\end{equation} - -In practice, the simple formula is computed first based on the temperature and -humidity. If this heat index value is \IP{80}{\fahrenheit} or higher, the full regression -equation along with any adjustment as described above is applied. The Rothfusz -regression is not valid for extreme temperature and relative humidity conditions -beyond the range of data considered by Steadman. +Starting from version 24.2, the heat index calculation adopts the extended heat +index method developed by Lu \& Romps [17]. The previous heat index gives +unrealistic results for very hot and humid or very cold and dry conditions. The +extended index extends the domain of the heat index calculation to all +combinations of temperature and relative humidity and gives a more realistic heat +index for the extreme conditions. The implementation in EnergyPlus is based on +the released Python code by Lu and Romps [18]. The Heat Index Hours (accumulated hours for a space) and Heat Index OccupantHours (accumulated hours for the sum of all occupants in a space) of @@ -516,3 +464,11 @@ \subsection{References} {[}16{]} ACGIH, Threshold Limit Values (TLVs) and Biological Exposure Indices (BEIs), 2012. doi:10.1073/pnas.0703993104. + +{[}17{]} Lu, Yi-Chuan, and David M. Romps. ``Extending the heat index''. Journal +of Applied Meteorology and Climatology 61, no. 10 (2022): 1367-1383. +doi:10.1073/pnas.0703993104. + +{[}18{]} Lu, Yi-Chuan, and David M. Romps. ``Lu and Romps, Extending the heat index, JAMC, 2022'', +Physics of Climate, February 23, 2023. +https://romps.berkeley.edu/papers/pubs-2020-heatindex.html. diff --git a/doc/input-output-reference/src/overview/group-zone-equipment.tex b/doc/input-output-reference/src/overview/group-zone-equipment.tex index 600d3c236ef..f835340823a 100644 --- a/doc/input-output-reference/src/overview/group-zone-equipment.tex +++ b/doc/input-output-reference/src/overview/group-zone-equipment.tex @@ -487,7 +487,7 @@ \subsubsection{Inputs}\label{inputs-1-052-seqsplitter} \paragraph{Field: Space Fraction Method}\label{field-seqsplitter-space-sizing-basis} The method used to autosize the space fractions. The choices are: DesignCoolingLoad, DesignHeatingLoad, FloorArea, Volume, and PerimeterLength. The default is DesignCoolingLoad. -For example, if there are 3 Spaces listed below, the Space Output Fractions will be sized to Space1DesignCoolingLoad / Sum(Space1thru3DesignCoolingLoad). +For example, if there are 3 Spaces listed below, the Space 1 Output Fraction will be sized to Space1DesignCoolingLoad / Sum(Space1thru3DesignCoolingLoad). PerimeterLength sums the width of exterior walls in each space. \paragraph{Field: Space \textless{}x\textgreater{} Name}\label{field-seqsplitter-space-name} @@ -547,7 +547,7 @@ \subsubsection{Inputs}\label{inputs-1-052-seqmixer} \paragraph{Field: Space Fraction Method}\label{field-seqmixer-space-sizing-basis} The method used to autosize the space fractions. The choices are: DesignCoolingLoad, DesignHeatingLoad, FloorArea, Volume, and PerimeterLength. The default is DesignCoolingLoad. -For example, if there are 3 Spaces listed below, the Space Output Fractions will be sized to Space1DesignCoolingLoad / Sum(Space1thru3DesignCoolingLoad). +For example, if there are 3 Spaces listed below, the Space 1 Output Fraction will be sized to Space1DesignCoolingLoad / Sum(Space1thru3DesignCoolingLoad). PerimeterLength sums the width of exterior walls in each space. \paragraph{Field: Space \textless{}x\textgreater{} Name}\label{field-seqmixer-space-name} diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 47ea5d88962..bafc6e46b22 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -13398,8 +13398,8 @@ namespace AirflowNetwork { // REFERENCES: // na - auto &NetworkNumOfLinks = ActualNumOfLinks; auto &NetworkNumOfNodes = ActualNumOfNodes; + auto &NetworkNumOfLinks = ActualNumOfLinks; // Argument array dimensioning (these used to be arguments, need to also test newAU and newIK) EP_SIZE_CHECK(IK, NetworkNumOfNodes + 1); diff --git a/src/EnergyPlus/CMakeLists.txt b/src/EnergyPlus/CMakeLists.txt index cfb928e00dc..56f664ba014 100644 --- a/src/EnergyPlus/CMakeLists.txt +++ b/src/EnergyPlus/CMakeLists.txt @@ -262,6 +262,8 @@ set(SRC EvaporativeFluidCoolers.hh ExhaustAirSystemManager.cc ExhaustAirSystemManager.hh + ExtendedHI.cc + ExtendedHI.hh ExteriorEnergyUse.cc ExteriorEnergyUse.hh ExternalInterface.cc diff --git a/src/EnergyPlus/ChillerElectricASHRAE205.hh b/src/EnergyPlus/ChillerElectricASHRAE205.hh index d3726861bc0..d9672a179f0 100644 --- a/src/EnergyPlus/ChillerElectricASHRAE205.hh +++ b/src/EnergyPlus/ChillerElectricASHRAE205.hh @@ -150,7 +150,7 @@ struct ChillerElectricASHRAE205Data : BaseGlobalStruct bool getInputFlag = true; Array1D Electric205Chiller; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerElectricEIR.hh b/src/EnergyPlus/ChillerElectricEIR.hh index 7f7891e424c..83df4f2cef8 100644 --- a/src/EnergyPlus/ChillerElectricEIR.hh +++ b/src/EnergyPlus/ChillerElectricEIR.hh @@ -252,7 +252,7 @@ struct ChillerElectricEIRData : BaseGlobalStruct bool getInputFlag = true; Array1D ElectricEIRChiller; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerExhaustAbsorption.hh b/src/EnergyPlus/ChillerExhaustAbsorption.hh index 437e51fd7b1..2fd35a83631 100644 --- a/src/EnergyPlus/ChillerExhaustAbsorption.hh +++ b/src/EnergyPlus/ChillerExhaustAbsorption.hh @@ -222,7 +222,7 @@ struct ChillerExhaustAbsorptionData : BaseGlobalStruct bool Sim_GetInput = true; Array1D ExhaustAbsorber; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerGasAbsorption.hh b/src/EnergyPlus/ChillerGasAbsorption.hh index a73f00ee433..82b23f2cfa4 100644 --- a/src/EnergyPlus/ChillerGasAbsorption.hh +++ b/src/EnergyPlus/ChillerGasAbsorption.hh @@ -222,7 +222,7 @@ struct ChillerGasAbsorptionData : BaseGlobalStruct bool getGasAbsorberInputs = true; Array1D GasAbsorber; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerIndirectAbsorption.hh b/src/EnergyPlus/ChillerIndirectAbsorption.hh index 82a83743d08..b3136eab293 100644 --- a/src/EnergyPlus/ChillerIndirectAbsorption.hh +++ b/src/EnergyPlus/ChillerIndirectAbsorption.hh @@ -214,7 +214,7 @@ struct ChillerIndirectAbsoprtionData : BaseGlobalStruct bool GetInput = true; Array1D IndirectAbsorber; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerReformulatedEIR.hh b/src/EnergyPlus/ChillerReformulatedEIR.hh index f801cafba7a..58077b2c478 100644 --- a/src/EnergyPlus/ChillerReformulatedEIR.hh +++ b/src/EnergyPlus/ChillerReformulatedEIR.hh @@ -273,7 +273,7 @@ struct ChillerReformulatedEIRData : BaseGlobalStruct bool GetInputREIR = true; Array1D ElecReformEIRChiller; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/CondenserLoopTowers.hh b/src/EnergyPlus/CondenserLoopTowers.hh index f49d8b2ad8e..16170e121cf 100644 --- a/src/EnergyPlus/CondenserLoopTowers.hh +++ b/src/EnergyPlus/CondenserLoopTowers.hh @@ -441,7 +441,7 @@ struct CondenserLoopTowersData : BaseGlobalStruct bool GetInput = true; Array1D towers; // dimension to number of machines - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Construction.cc b/src/EnergyPlus/Construction.cc index 0fdd793bd68..267e9f56ed5 100644 --- a/src/EnergyPlus/Construction.cc +++ b/src/EnergyPlus/Construction.cc @@ -210,7 +210,7 @@ void ConstructionProps::calculateTransferFunction(EnergyPlusData &state, bool &E // Obtain thermal properties from the Material derived type - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(CurrentLayer)); + auto *thisMaterial = state.dataMaterial->materials(CurrentLayer); assert(thisMaterial != nullptr); dl(Layer) = thisMaterial->Thickness; @@ -289,7 +289,7 @@ void ConstructionProps::calculateTransferFunction(EnergyPlusData &state, bool &E // then use the "exact" approach to model a massless layer // based on the node equations for the state space method. - if ((Layer == 1) || (Layer == this->TotLayers) || (!state.dataMaterial->Material(this->LayerPoint(Layer))->ROnly)) { + if ((Layer == 1) || (Layer == this->TotLayers) || (!state.dataMaterial->materials(this->LayerPoint(Layer))->ROnly)) { cp(Layer) = 1.007; rho(Layer) = 1.1614; rk(Layer) = 0.0263; @@ -928,12 +928,12 @@ void ConstructionProps::calculateTransferFunction(EnergyPlusData &state, bool &E if (this->CTFTimeStep >= MaxAllowedTimeStep) { ShowSevereError(state, format("CTF calculation convergence problem for Construction=\"{}\".", this->Name)); ShowContinueError(state, "...with Materials (outside layer to inside)"); - ShowContinueError(state, format("(outside)=\"{}\"", state.dataMaterial->Material(this->LayerPoint(1))->Name)); + ShowContinueError(state, format("(outside)=\"{}\"", state.dataMaterial->materials(this->LayerPoint(1))->Name)); for (int Layer = 2; Layer <= this->TotLayers; ++Layer) { if (Layer != this->TotLayers) { - ShowContinueError(state, format("(next)=\"{}\"", state.dataMaterial->Material(this->LayerPoint(Layer))->Name)); + ShowContinueError(state, format("(next)=\"{}\"", state.dataMaterial->materials(this->LayerPoint(Layer))->Name)); } else { - ShowContinueError(state, format("(inside)=\"{}\"", state.dataMaterial->Material(this->LayerPoint(Layer))->Name)); + ShowContinueError(state, format("(inside)=\"{}\"", state.dataMaterial->materials(this->LayerPoint(Layer))->Name)); } } ShowContinueError(state, @@ -1875,9 +1875,9 @@ void ConstructionProps::reportTransferFunction(EnergyPlusData &state, int const for (int I = 1; I <= this->TotLayers; ++I) { int Layer = this->LayerPoint(I); - auto const *thisMaterial = state.dataMaterial->Material(Layer); + auto const *thisMaterial = state.dataMaterial->materials(Layer); switch (thisMaterial->group) { - case Material::Group::Air: { + case Material::Group::AirGap: { static constexpr std::string_view Format_702(" Material:Air,{},{:12.4N}\n"); print(state.files.eio, Format_702, thisMaterial->Name, thisMaterial->Resistance); } break; @@ -1927,8 +1927,8 @@ void ConstructionProps::reportLayers(EnergyPlusData &state) if (state.dataOutRptPredefined->pdchOpqConsLayCol.size() > 0) { for (int i = 1; i <= this->TotLayers; ++i) { int layerIndex = this->LayerPoint(i); - auto &thisMaterial = state.dataMaterial->Material(layerIndex); - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOpqConsLayCol[i - 1], this->Name, thisMaterial->Name); + auto const *mat = state.dataMaterial->materials(layerIndex); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOpqConsLayCol[i - 1], this->Name, mat->Name); } } } @@ -1942,10 +1942,9 @@ bool ConstructionProps::isGlazingConstruction(EnergyPlusData &state) const // PURPOSE OF THIS SUBROUTINE: // Commonly used routine in several places in EnergyPlus which examines if current // construction is glazing construction - const Material::Group MaterialGroup = state.dataMaterial->Material(LayerPoint(1))->group; - return (MaterialGroup == Material::Group::WindowGlass) || (MaterialGroup == Material::Group::Shade) || - (MaterialGroup == Material::Group::Screen) || (MaterialGroup == Material::Group::WindowBlind) || - (MaterialGroup == Material::Group::WindowSimpleGlazing); + const Material::Group group = state.dataMaterial->materials(LayerPoint(1))->group; + return (group == Material::Group::Glass) || (group == Material::Group::Shade) || (group == Material::Group::Screen) || + (group == Material::Group::Blind) || (group == Material::Group::GlassSimple); } Real64 ConstructionProps::setThicknessPerpendicular(EnergyPlusData &state, Real64 userValue) @@ -2015,10 +2014,7 @@ void ConstructionProps::setArraysBasedOnMaxSolidWinLayers(EnergyPlusData &state) { this->AbsDiff.allocate(state.dataHeatBal->MaxSolidWinLayers); this->AbsDiffBack.allocate(state.dataHeatBal->MaxSolidWinLayers); - this->BlAbsDiff.allocate(Material::MaxSlatAngs, state.dataHeatBal->MaxSolidWinLayers); - this->BlAbsDiffGnd.allocate(Material::MaxSlatAngs, state.dataHeatBal->MaxSolidWinLayers); - this->BlAbsDiffSky.allocate(Material::MaxSlatAngs, state.dataHeatBal->MaxSolidWinLayers); - this->BlAbsDiffBack.allocate(Material::MaxSlatAngs, state.dataHeatBal->MaxSolidWinLayers); + this->layerSlatBlindDfAbs.allocate(state.dataHeatBal->MaxSolidWinLayers); this->AbsBeamCoef.allocate(state.dataHeatBal->MaxSolidWinLayers); this->AbsBeamBackCoef.allocate(state.dataHeatBal->MaxSolidWinLayers); this->tBareSolCoef.allocate(state.dataHeatBal->MaxSolidWinLayers); @@ -2046,12 +2042,14 @@ void ConstructionProps::setArraysBasedOnMaxSolidWinLayers(EnergyPlusData &state) this->AbsDiff(Layer) = 0.0; this->AbsDiffBack(Layer) = 0.0; } - for (int Index = 1; Index <= Material::MaxSlatAngs; ++Index) { - for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - this->BlAbsDiff(Index, Layer) = 0.0; - this->BlAbsDiffGnd(Index, Layer) = 0.0; - this->BlAbsDiffSky(Index, Layer) = 0.0; - this->BlAbsDiffBack(Index, Layer) = 0.0; + for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { + auto &slatBlindDfAbs = this->layerSlatBlindDfAbs(Layer); + for (int iSlatAng = 0; iSlatAng < Material::MaxSlatAngs; ++iSlatAng) { + auto &blindDfAbs = slatBlindDfAbs[iSlatAng]; + blindDfAbs.Sol.Ft.Df.Abs = 0.0; + blindDfAbs.Sol.Ft.Df.AbsGnd = 0.0; + blindDfAbs.Sol.Ft.Df.AbsGnd = 0.0; + blindDfAbs.Sol.Bk.Df.Abs = 0.0; } } for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { diff --git a/src/EnergyPlus/Construction.hh b/src/EnergyPlus/Construction.hh index 9905104e4d4..1c95c7b513a 100644 --- a/src/EnergyPlus/Construction.hh +++ b/src/EnergyPlus/Construction.hh @@ -68,8 +68,68 @@ namespace Construction { // Note Sync with SurfaceGroundHeatExchanger::local::MaxCTFTerms // ** has to be big enough to hold no matter what window model // each window model should validate layers individually - int constexpr MaxSpectralDataElements(800); // Maximum number in Spectral Data arrays. + // Nested one-field structs just to keep overall structure + // consistent with Material::BlindTAR. See Material.hh for + // discussion of this approach. + struct BlindSolVis + { + struct + { + struct + { + Material::BlindDfTARGS Df; + } Ft; + struct + { + Material::BlindDfTAR Df; + } Bk; + } Sol; + struct + { + struct + { + Material::BlindDfTAR Df; + } Ft; + struct + { + Material::BlindDfTAR Df; + } Bk; + } Vis; + }; + + // Nested one-field structs keep overall structure consistent with Material::BlindTAR + struct BlindSolDfAbs + { + struct + { + struct + { + struct + { + Real64 Abs = 0.0; + Real64 AbsGnd = 0.0; + Real64 AbsSky = 0.0; + } Df; + } Ft; // Front + + struct + { + struct + { + Real64 Abs = 0.0; + } Df; + } Bk; // Back + } Sol; + }; + + struct TCLayer + { + int constrNum; + Real64 specTemp; + }; + + // This needs to get broken up too struct ConstructionProps { // Members @@ -143,42 +203,31 @@ namespace Construction { // Variables for window constructions Array1D AbsDiff; // Diffuse solar absorptance for each glass layer, // bare glass or shade on - Array2D BlAbsDiff; // Diffuse solar absorptance for each glass layer vs. - // slat angle, blind on - Array2D BlAbsDiffGnd; // Diffuse ground solar absorptance for each glass layer - // vs. slat angle, blind on - Array2D BlAbsDiffSky; // Diffuse sky solar absorptance for each glass layer - // vs. slat angle, blind on - Array1D AbsDiffBack; // Diffuse back solar absorptance for each glass layer - Array2D BlAbsDiffBack; // Diffuse back solar absorptance for each glass layer, - // vs. slat angle, blind on + + std::array effShadeBlindEmi; + std::array effGlassEmi; + + std::array blindTARs; + + // Sol diffuse absorptance per glass layer with blind on + Array1D> layerSlatBlindDfAbs; + + Array1D AbsDiffBack; // Diffuse back solar absorptance for each glass layer Real64 AbsDiffShade = 0.0; // Diffuse solar absorptance for shade - Array1D AbsDiffBlind; // Diffuse solar absorptance for blind, vs. slat angle - Array1D AbsDiffBlindGnd; // Diffuse ground solar absorptance for blind, vs. slat angle - Array1D AbsDiffBlindSky; // Diffuse sky solar absorptance for blind, vs. slat angle Real64 AbsDiffBackShade = 0.0; // Diffuse back solar absorptance for shade - Array1D AbsDiffBackBlind; // Diffuse back solar absorptance for blind, vs. slat angle Real64 ShadeAbsorpThermal = 0.0; // Diffuse back thermal absorptance of shade Array1D> AbsBeamCoef; // Coefficients of incidence-angle polynomial for solar // absorptance for each solid glazing layer Array1D> AbsBeamBackCoef; // As for AbsBeamCoef but for back-incident solar Array1D AbsBeamShadeCoef; // Coefficients of incidence-angle polynomial for solar // absorptance of shade - Real64 TransDiff = 0.0; // Diffuse solar transmittance, bare glass or shade on - Array1D BlTransDiff; // Diffuse solar transmittance, blind present, vs. slat angle - Array1D BlTransDiffGnd; // Ground diffuse solar transmittance, blind present, vs. slat angle - Array1D BlTransDiffSky; // Sky diffuse solar transmittance, blind present, vs. slat angle - Real64 TransDiffVis; // Diffuse visible transmittance, bare glass or shade on - Array1D BlTransDiffVis; // Diffuse visible transmittance, blind present, vs. slat angle - Real64 ReflectSolDiffBack = 0.0; // Diffuse back solar reflectance, bare glass or shade on - Array1D BlReflectSolDiffBack; // Diffuse back solar reflectance, blind present, vs. slat angle - Real64 ReflectSolDiffFront = 0.0; // Diffuse front solar reflectance, bare glass or shade on - Array1D BlReflectSolDiffFront; // Diffuse front solar reflectance, blind present, vs. slat angle - Real64 ReflectVisDiffBack = 0.0; // Diffuse back visible reflectance, bare glass or shade on - Array1D BlReflectVisDiffBack; // Diffuse back visible reflectance, blind present, vs. slat angle - Real64 ReflectVisDiffFront = 0.0; // Diffuse front visible reflectance, bare glass or shade on - Array1D BlReflectVisDiffFront; // Diffuse front visible reflectance, blind present, vs. slat angle - Array1D TransSolBeamCoef; // Coeffs of incidence-angle polynomial for beam sol trans, + Real64 TransDiff = 0.0; // Diffuse solar transmittance, bare glass or shade on + Real64 TransDiffVis; // Diffuse visible transmittance, bare glass or shade on + Real64 ReflectSolDiffBack = 0.0; // Diffuse back solar reflectance, bare glass or shade on + Real64 ReflectSolDiffFront = 0.0; // Diffuse front solar reflectance, bare glass or shade on + Real64 ReflectVisDiffBack = 0.0; // Diffuse back visible reflectance, bare glass or shade on + Real64 ReflectVisDiffFront = 0.0; // Diffuse front visible reflectance, bare glass or shade on + Array1D TransSolBeamCoef; // Coeffs of incidence-angle polynomial for beam sol trans, // bare glass or shade on Array1D TransVisBeamCoef; // Coeffs of incidence-angle polynomial for beam vis trans, // bare glass or shade on @@ -218,13 +267,18 @@ namespace Construction { bool TypeIsIRT = false; // -- true for construction with IRT material bool TypeIsCfactorWall = false; // -- true for construction with Construction:CfactorUndergroundWall bool TypeIsFfactorFloor = false; // -- true for construction with Construction:FfactorGroundFloor + // Added TH 12/22/2008 for thermochromic windows - int TCFlag = 0; // 0: this construction is not a thermochromic window construction - // 1: it is a TC window construction - int TCLayer = 0; // Reference to the TC glazing material layer in the Material array - int TCMasterConst = 0; // The master TC construction referenced by its slave constructions - int TCLayerID = 0; // Which material layer is the TC glazing, counting all material layers. - int TCGlassID = 0; // Which glass layer is the TC glazing, counting from glass layers only. + bool isTCWindow = false; + bool isTCMaster = false; + int TCMasterConstrNum = 0; // The master TC construction referenced by its slave constructions + int TCMasterMatNum = 0; // The master TC material + int TCLayerNum = 0; // Which material layer is the TC glazing, counting all material layers. + int TCGlassNum = 0; // Which glass layer is the TC glazing, counting from glass layers only. + int numTCChildConstrs; + Array1D TCChildConstrs; + Real64 specTemp; + // For CFactor underground walls Real64 CFactor = 0.0; Real64 Height = 0.0; @@ -271,14 +325,9 @@ namespace Construction { // Default Constructor ConstructionProps() - : LayerPoint(MaxLayersInConstruct, 0), AbsDiffBlind(Material::MaxSlatAngs, 0.0), AbsDiffBlindGnd(Material::MaxSlatAngs, 0.0), - AbsDiffBlindSky(Material::MaxSlatAngs, 0.0), AbsDiffBackBlind(Material::MaxSlatAngs, 0.0), AbsBeamShadeCoef(6, 0.0), - BlTransDiff(Material::MaxSlatAngs, 0.0), BlTransDiffGnd(Material::MaxSlatAngs, 0.0), BlTransDiffSky(Material::MaxSlatAngs, 0.0), - TransDiffVis(0.0), BlTransDiffVis(Material::MaxSlatAngs, 0.0), BlReflectSolDiffBack(Material::MaxSlatAngs, 0.0), - BlReflectSolDiffFront(Material::MaxSlatAngs, 0.0), BlReflectVisDiffBack(Material::MaxSlatAngs, 0.0), - BlReflectVisDiffFront(Material::MaxSlatAngs, 0.0), TransSolBeamCoef(6, 0.0), TransVisBeamCoef(6, 0.0), ReflSolBeamFrontCoef(6, 0.0), - ReflSolBeamBackCoef(6, 0.0), tBareSolDiff(5, 0.0), tBareVisDiff(5, 0.0), rfBareSolDiff(5, 0.0), rfBareVisDiff(5, 0.0), - rbBareSolDiff(5, 0.0), rbBareVisDiff(5, 0.0), afBareSolDiff(5, 0.0), abBareSolDiff(5, 0.0), + : LayerPoint(MaxLayersInConstruct, 0), AbsBeamShadeCoef(6, 0.0), TransDiffVis(0.0), TransSolBeamCoef(6, 0.0), TransVisBeamCoef(6, 0.0), + ReflSolBeamFrontCoef(6, 0.0), ReflSolBeamBackCoef(6, 0.0), tBareSolDiff(5, 0.0), tBareVisDiff(5, 0.0), rfBareSolDiff(5, 0.0), + rfBareVisDiff(5, 0.0), rbBareSolDiff(5, 0.0), rbBareVisDiff(5, 0.0), afBareSolDiff(5, 0.0), abBareSolDiff(5, 0.0), AbsDiffFrontEQL(DataWindowEquivalentLayer::CFSMAXNL, 0.0), AbsDiffBackEQL(DataWindowEquivalentLayer::CFSMAXNL, 0.0) { BMat.allocate(3); diff --git a/src/EnergyPlus/ConvectionCoefficients.cc b/src/EnergyPlus/ConvectionCoefficients.cc index 7c33104830f..8524c1b5800 100644 --- a/src/EnergyPlus/ConvectionCoefficients.cc +++ b/src/EnergyPlus/ConvectionCoefficients.cc @@ -3628,7 +3628,7 @@ Real64 EvaluateExtHcModels(EnergyPlusData &state, int const SurfNum, HcExt const } Material::SurfaceRoughness Roughness = - state.dataMaterial->Material(state.dataConstruction->Construct(surface.Construction).LayerPoint(1))->Roughness; + state.dataMaterial->materials(state.dataConstruction->Construct(surface.Construction).LayerPoint(1))->Roughness; switch (ForcedConvModelEqNum) { case HcExt::None: { @@ -4054,7 +4054,9 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu } } break; case DataZoneEquipment::ZoneEquipType::VentilatedSlab: - case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiant: { + case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantConstFlow: + case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantVarFlow: + case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantElectric: { if (zoneEquipConfig.InFloorActiveElement) { for (int spaceNumLoop : zone.spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNumLoop); @@ -6299,7 +6301,7 @@ Real64 CalcClearRoof(EnergyPlusData &state, Real64 Rf = RoughnessMultiplier[(int)RoughnessIndex]; if (Rex > 0.1) { // avoid zero and crazy small denominators - Real64 tmp = std::log(1.0 + GrLn / pow_2(Rex)); + Real64 tmp = std::log1p(GrLn / pow_2(Rex)); eta = tmp / (1.0 + tmp); } else { eta = 1.0; // forced convection gone because no wind @@ -6318,7 +6320,7 @@ Real64 CalcClearRoof(EnergyPlusData &state, Real64 const RoofPerimeter) { Material::SurfaceRoughness const RoughnessIndex = - state.dataMaterial->Material(state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).LayerPoint(1))->Roughness; + state.dataMaterial->materials(state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).LayerPoint(1))->Roughness; // find x, don't know x. avoid time consuming geometry algorithm Real64 x = std::sqrt(RoofArea) / 2.0; // quick simplification, geometry routines to develop diff --git a/src/EnergyPlus/CoolTower.hh b/src/EnergyPlus/CoolTower.hh index 0353f82aa39..4da1b7a67f8 100644 --- a/src/EnergyPlus/CoolTower.hh +++ b/src/EnergyPlus/CoolTower.hh @@ -145,7 +145,7 @@ struct CoolTowerData : BaseGlobalStruct bool GetInputFlag = true; Array1D CoolTowerSys; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/CostEstimateManager.hh b/src/EnergyPlus/CostEstimateManager.hh index b80b3ddd145..4d82595fd08 100644 --- a/src/EnergyPlus/CostEstimateManager.hh +++ b/src/EnergyPlus/CostEstimateManager.hh @@ -189,7 +189,7 @@ struct CostEstimateManagerData : BaseGlobalStruct Array1D monetaryUnit; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/CrossVentMgr.hh b/src/EnergyPlus/CrossVentMgr.hh index 2aa176f544b..d05afc87e2d 100644 --- a/src/EnergyPlus/CrossVentMgr.hh +++ b/src/EnergyPlus/CrossVentMgr.hh @@ -81,7 +81,7 @@ struct CrossVentMgrData : BaseGlobalStruct bool InitUCSDCV_MyOneTimeFlag = true; Array1D_bool InitUCSDCV_MyEnvrnFlag; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DElightManagerF.cc b/src/EnergyPlus/DElightManagerF.cc index a7d4d7fcfd6..44c6e41837d 100644 --- a/src/EnergyPlus/DElightManagerF.cc +++ b/src/EnergyPlus/DElightManagerF.cc @@ -352,10 +352,7 @@ namespace DElightManagerF { 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) - auto const *thisMaterial = - dynamic_cast(state.dataMaterial->Material(iMatlLayer)); - assert(thisMaterial != nullptr); - rExtVisRefl = 1.0 - thisMaterial->AbsorpVisible; + rExtVisRefl = 1.0 - state.dataMaterial->materials(iMatlLayer)->AbsorpVisible; } else { rExtVisRefl = 0.0; } diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index cc8fb70b8d8..dc78db35aa7 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -7271,60 +7271,29 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) int Mode; // Operating mode for MultiMode DX coil; Always 1 for other coil types int NumOfSpeedCompanion; // Number of speed for a companion cooling coil (Multispeed HO heating coil only std::string equipName; - Real64 RatedAirVolFlowRateDes; // Design rated air volume flow for reporting - Real64 RatedAirVolFlowRateUser; // Hard-sized rated air volume flow for reporting - Real64 RatedAirVolFlowRate2Des; // Design rated low speed air volume flow for reporting - Real64 RatedAirVolFlowRate2User; // Hard-sized rated low speed air volume flow for reporting - Real64 RatedTotCapDes; // Design rated total capacity for reproting - Real64 RatedTotCapUser; // Hard-sized rated total capacity for reproting - Real64 RatedTotCap2Des; // Design rated low speed total capacity for reproting - Real64 RatedTotCap2User; // Hard-sized rated low speed total capacity for reproting - Real64 RatedSHRDes; // Design ratd SHR for reporting - Real64 RatedSHRUser; // Hard-sized ratd SHR for reporting - Real64 RatedSHR2Des; // Design ratd low speed SHR for reporting - Real64 RatedSHR2User; // Hard-sized ratd low speed SHR for reporting - Real64 EvapCondAirFlowDes; // Design evaporative condenser air flow for reporting - Real64 EvapCondAirFlowUser; // Hard-sized evaporative condenser air flow for reporting - Real64 EvapCondAirFlow2Des; // Design low speed evaporative condenser air flow for reporting - Real64 EvapCondAirFlow2User; // Hard-sized low speed evaporative condenser air flow for reporting - Real64 EvapCondPumpElecNomPowerDes; // Design evaporative condenser pump rated power consumption for reporting - Real64 EvapCondPumpElecNomPowerUser; // Hard-sized evaporative condenser pump rated power consumption for reporting - Real64 EvapCondPumpElecNomPower2Des; // Design low speed condenser pump rated power consumption for reporting - Real64 EvapCondPumpElecNomPower2User; // Hard-sized low speed condenser pump rated power consumption for reporting - Real64 DefrostCapacityDes; // Design defrost heater capacity for reporting - Real64 DefrostCapacityUser; // Hard-sized defrost heater capacity for reporting - Real64 MSRatedAirVolFlowRateDes; // Design multispeed rated air volume flow rate for reporting - Real64 MSRatedAirVolFlowRateUser; // Hard-sized multispeed rated air volume flow rate for reporting - Real64 MSRatedTotCapDesAtMaxSpeed; // Design multispeed rated total capacity for reporting (at maximum speed) - Real64 MSRatedTotCapUser; // Hard-sized multispeed rated total capacity for reporting - Real64 MSRatedSHRDes; // Design multispeed rated SHR for reporting - Real64 MSRatedSHRUser; // Hard-sized multispeed rated SHR for reporting - Real64 MSEvapCondAirFlowDes; // Design evaporative condenser air flow for reporting - Real64 MSEvapCondAirFlowUser; // Hard-sized evaporative condenser air flow for reporting - Real64 MSEvapCondAirFlow2Des; // Design low speed evaporative condenser air flow for reporting - Real64 MSEvapCondAirFlow2User; // Hard-sized low speed evaporative condenser air flow for reporting - Real64 MSEvapCondPumpElecNomPowerDes; // Design evaporative condenser pump rated power consumption for reporting - Real64 MSEvapCondPumpElecNomPowerUser; // Hard-sized evaporative condenser pump rated power consumption for reporting - Real64 MSEvapCondPumpElecNomPower2Des; // Design low speed condenser pump rated power consumption for reporting - Real64 MSEvapCondPumpElecNomPower2User; // Hard-sized low speed condenser pump rated power consumption for reporting - Real64 MSDefrostCapacityDes; // Design defrost heater capacity for reporting - Real64 MSDefrostCapacityUser; // Hard-sized defrost heater capacity for reporting - bool HardSizeNoDesRun; // Indicator to a hard-sized field with no design sizing data - bool IsAutoSize; // Indicator to autosize for reporting - bool IsCoolCoilCapAutoSize; // Indicator to cooling capacity autosize for reporting - bool SizingDesRunThisAirSys; // true if a particular air system had a Sizing:System object and system sizing done - bool SizingDesRunThisZone; // true if a particular zone had a Sizing:Zone object and zone sizing was done - std::string CompName; // component name - std::string CompType; // component type - std::string SizingString; // input field sizing description (e.g., Nominal Capacity) - bool bPRINT = true; // TRUE if sizing is reported to output (eio) - Real64 TempSize; // autosized value of coil input field - int FieldNum = 2; // IDD numeric field number where input field description is found - int SizingMethod; // Integer representation of sizing method (e.g., CoolingAirflowSizing, HeatingCapacitySizing, etc.) - bool PrintFlag; // TRUE when sizing information is reported in the eio file - bool SizeSecDXCoil; // if true do sizing calculation for secondary coil - Real64 SecCoilAirFlowDes; // Design secondary DX coil air flow for reporting - Real64 SecCoilAirFlowUser; // Hard-sized secondary DX coil air flow for reporting + Real64 DefrostCapacityDes; // Design defrost heater capacity for reporting + Real64 DefrostCapacityUser; // Hard-sized defrost heater capacity for reporting + Real64 MSRatedAirVolFlowRateDes; // Design multispeed rated air volume flow rate for reporting + Real64 MSRatedTotCapDesAtMaxSpeed; // Design multispeed rated total capacity for reporting (at maximum speed) + Real64 MSRatedSHRDes; // Design multispeed rated SHR for reporting + Real64 MSEvapCondAirFlowDes; // Design evaporative condenser air flow for reporting + Real64 MSEvapCondAirFlowUser; // Hard-sized evaporative condenser air flow for reporting + Real64 MSEvapCondPumpElecNomPowerDes; // Design evaporative condenser pump rated power consumption for reporting + Real64 MSEvapCondPumpElecNomPowerUser; // Hard-sized evaporative condenser pump rated power consumption for reporting + bool HardSizeNoDesRun; // Indicator to a hard-sized field with no design sizing data + bool IsAutoSize; // Indicator to autosize for reporting + bool SizingDesRunThisAirSys; // true if a particular air system had a Sizing:System object and system sizing done + bool SizingDesRunThisZone; // true if a particular zone had a Sizing:Zone object and zone sizing was done + std::string CompName; // component name + std::string CompType; // component type + std::string SizingString; // input field sizing description (e.g., Nominal Capacity) + bool bPRINT = true; // TRUE if sizing is reported to output (eio) + Real64 TempSize; // autosized value of coil input field + int FieldNum = 2; // IDD numeric field number where input field description is found + bool PrintFlag; // TRUE when sizing information is reported in the eio file + bool SizeSecDXCoil; // if true do sizing calculation for secondary coil + Real64 SecCoilAirFlowDes; // Design secondary DX coil air flow for reporting + Real64 SecCoilAirFlowUser; // Hard-sized secondary DX coil air flow for reporting // Initiate all reporting variables if (state.dataSize->SysSizingRunDone || state.dataSize->ZoneSizingRunDone) { @@ -7345,47 +7314,16 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } IsAutoSize = false; - IsCoolCoilCapAutoSize = false; SizeSecDXCoil = false; - RatedAirVolFlowRateDes = 0.0; - RatedAirVolFlowRateUser = 0.0; - RatedAirVolFlowRate2Des = 0.0; - RatedAirVolFlowRate2User = 0.0; - RatedTotCapDes = 0.0; - RatedTotCapUser = 0.0; - RatedTotCap2Des = 0.0; - RatedTotCap2User = 0.0; MSRatedTotCapDesAtMaxSpeed = 0.0; - RatedSHRDes = 0.0; - RatedSHRUser = 0.0; - RatedSHR2Des = 0.0; - RatedSHR2User = 0.0; - EvapCondAirFlowDes = 0.0; - EvapCondAirFlowUser = 0.0; - EvapCondAirFlow2Des = 0.0; - EvapCondAirFlow2User = 0.0; - EvapCondPumpElecNomPowerDes = 0.0; - EvapCondPumpElecNomPowerUser = 0.0; - EvapCondPumpElecNomPower2Des = 0.0; - EvapCondPumpElecNomPower2User = 0.0; DefrostCapacityDes = 0.0; DefrostCapacityUser = 0.0; MSRatedAirVolFlowRateDes = 0.0; - MSRatedAirVolFlowRateUser = 0.0; - // MSRatedTotCapDes = 0.0; - MSRatedTotCapUser = 0.0; MSRatedSHRDes = 0.0; - MSRatedSHRUser = 0.0; MSEvapCondAirFlowDes = 0.0; MSEvapCondAirFlowUser = 0.0; - MSEvapCondAirFlow2Des = 0.0; - MSEvapCondAirFlow2User = 0.0; MSEvapCondPumpElecNomPowerDes = 0.0; MSEvapCondPumpElecNomPowerUser = 0.0; - MSEvapCondPumpElecNomPower2Des = 0.0; - MSEvapCondPumpElecNomPower2User = 0.0; - MSDefrostCapacityDes = 0.0; - MSDefrostCapacityUser = 0.0; SecCoilAirFlowDes = 0.0; SecCoilAirFlowUser = 0.0; @@ -7550,14 +7488,12 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) PrintFlag = true; state.dataSize->DataTotCapCurveIndex = thisDXCoil.CCapFTemp(Mode); if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) { - SizingMethod = HVAC::CoolingCapacitySizing; CompName = thisDXCoil.Name + ":" + thisDXCoil.CoilPerformanceName(Mode); FieldNum = 1; TempSize = thisDXCoil.RatedTotCap(Mode); SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatingEmpirical || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Heating || thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Heating) { - SizingMethod = HVAC::HeatingCapacitySizing; CompName = thisDXCoil.Name; FieldNum = 1; TempSize = thisDXCoil.RatedTotCap(Mode); @@ -7565,7 +7501,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) state.dataSize->DataCoolCoilCap = state.dataSize->DXCoolCap; } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) { - SizingMethod = HVAC::CoolingCapacitySizing; CompName = thisDXCoil.Name; FieldNum = 1; TempSize = thisDXCoil.RatedTotCap(Mode); @@ -7574,7 +7509,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) state.dataLoopNodes->Node(thisDXCoil.WaterInNode).Temp = thisDXCoil.RatedInletWaterTemp; // set the rated water inlet node for HPWHs for use in CalcHPWHDXCoil } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_FluidTCtrl_Cooling) { - SizingMethod = HVAC::CoolingCapacitySizing; CompName = thisDXCoil.Name; FieldNum = 1; TempSize = thisDXCoil.RatedTotCap(Mode); @@ -7593,7 +7527,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } CalcVRFCoilCapModFac(state, 0, _, CompName, CoilInTemp, _, _, _, state.dataSize->DataTotCapCurveValue); } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedCooling) { - SizingMethod = HVAC::CoolingCapacitySizing; CompName = thisDXCoil.Name; FieldNum = 7 + (thisDXCoil.NumOfSpeeds - 1) * 13; state.dataSize->DataTotCapCurveIndex = thisDXCoil.MSCCapFTemp(thisDXCoil.NumOfSpeeds); @@ -7601,15 +7534,13 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) PrintFlag = false; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_MultiSpeedHeating) { - SizingMethod = HVAC::HeatingCapacitySizing; CompName = thisDXCoil.Name; - FieldNum = 10 + (thisDXCoil.NumOfSpeeds - 1) * 5; + FieldNum = 10 + (thisDXCoil.NumOfSpeeds - 1) * 6; state.dataSize->DataTotCapCurveIndex = thisDXCoil.MSCCapFTemp(thisDXCoil.NumOfSpeeds); TempSize = thisDXCoil.MSRatedTotCap(thisDXCoil.NumOfSpeeds); PrintFlag = false; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [W]"; } else { - SizingMethod = HVAC::CoolingCapacitySizing; CompName = thisDXCoil.Name; FieldNum = 1; TempSize = thisDXCoil.RatedTotCap(Mode); @@ -7750,7 +7681,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) CompName = thisDXCoil.Name; FieldNum = 15; // Low Speed Evaporative Condenser Air Flow Rate SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum) + " [m3/s]"; - SizingMethod = HVAC::AutoCalculateSizing; CompType = thisDXCoil.DXCoilType; // Autosize low speed condenser air flow to 1/3 Total Capacity * 0.000114 m3/s/w (850 cfm/ton) state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedTotCap(Mode); @@ -7784,7 +7714,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (state.dataGlobal->isEpJSON) stringOverride = "evaporative_condenser_pump_rated_power_consumption [W]"; } } - SizingMethod = HVAC::AutoCalculateSizing; CompType = thisDXCoil.DXCoilType; // Autosize high speed evap condenser pump power to Total Capacity * 0.004266 w/w (15 w/ton) state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedTotCap(Mode); @@ -7893,7 +7822,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) CompName = thisDXCoil.Name; FieldNum = 7; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(Mode).FieldNames(FieldNum); - SizingMethod = HVAC::AutoCalculateSizing; CompType = thisDXCoil.DXCoilType; // Autosize low speed SHR to be the same as high speed SHR state.dataSize->DataConstantUsedForSizing = thisDXCoil.RatedSHR(Mode); @@ -7975,7 +7903,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) FieldNum = 10 + (Mode - 1) * 14; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; if (IsAutoSize || !HardSizeNoDesRun) { - SizingMethod = HVAC::AutoCalculateSizing; // Autosize low speed flow to fraction of the highest speed flow state.dataSize->DataConstantUsedForSizing = thisDXCoil.MSRatedAirVolFlowRate(thisDXCoil.NumOfSpeeds); if (!IsAutoSize && !HardSizeNoDesRun) state.dataSize->DataConstantUsedForSizing = MSRatedAirVolFlowRateDes; @@ -8026,7 +7953,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (Mode == thisDXCoil.NumOfSpeeds) { PrintFlag = true; state.dataSize->DataFlowUsedForSizing = thisDXCoil.MSRatedAirVolFlowRate(Mode); - SizingMethod = HVAC::CoolingCapacitySizing; FieldNum = 7 + (Mode - 1) * 14; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; state.dataSize->DataEMSOverrideON = thisDXCoil.RatedTotCapEMSOverrideOn(Mode); @@ -8040,7 +7966,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) sizerCoolingCapacity.overrideSizingString(SizingString); sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); TempSize = sizerCoolingCapacity.size(state, TempSize, ErrorsFound); - SizingMethod = HVAC::AutoCalculateSizing; state.dataSize->DataConstantUsedForSizing = TempSize; state.dataSize->DataFractionUsedForSizing = 1.0; MSRatedTotCapDesAtMaxSpeed = TempSize; @@ -8060,11 +7985,9 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } else { // cooling capacity at lower speeds PrintFlag = true; - SizingMethod = HVAC::CoolingCapacitySizing; FieldNum = 7 + (Mode - 1) * 14; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; if (IsAutoSize || !HardSizeNoDesRun) { - SizingMethod = HVAC::AutoCalculateSizing; // autosize low speed capacity to fraction of the highest speed capacity if (!HardSizeNoDesRun) { state.dataSize->DataConstantUsedForSizing = MSRatedTotCapDesAtMaxSpeed; @@ -8319,7 +8242,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) FieldNum = 12 + (Mode - 1) * 6; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [m3/s]"; if (IsAutoSize || !HardSizeNoDesRun) { - SizingMethod = HVAC::AutoCalculateSizing; // Auto-size low speed flow to fraction of the highest speed capacity state.dataSize->DataConstantUsedForSizing = thisDXCoil.MSRatedAirVolFlowRate(thisDXCoil.NumOfSpeeds); if (!IsAutoSize && !HardSizeNoDesRun) state.dataSize->DataConstantUsedForSizing = MSRatedAirVolFlowRateDes; @@ -8408,7 +8330,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) CompName = thisDXCoil.Name; CompType = thisDXCoil.DXCoilType; if (Mode == thisDXCoil.NumOfSpeeds) { - SizingMethod = HVAC::HeatingCapacitySizing; state.dataSize->DataFlowUsedForSizing = thisDXCoil.MSRatedAirVolFlowRate(Mode); FieldNum = 10 + (Mode - 1) * 6; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; @@ -8416,7 +8337,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) if (IsAutoSize || !HardSizeNoDesRun) { // Heating capacity is assumed to be equal to the cooling capacity PrintFlag = false; - SizingMethod = HVAC::AutoCalculateSizing; state.dataSize->DataFractionUsedForSizing = 1.0; if (thisDXCoil.CompanionUpstreamDXCoil > 0) { NumOfSpeedCompanion = state.dataDXCoils->DXCoil(thisDXCoil.CompanionUpstreamDXCoil).NumOfSpeeds; @@ -8432,7 +8352,6 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); MSRatedTotCapDesAtMaxSpeed = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); - SizingMethod = HVAC::AutoCalculateSizing; state.dataSize->DataConstantUsedForSizing = MSRatedTotCapDesAtMaxSpeed; state.dataSize->DataFractionUsedForSizing = 1.0; } @@ -8450,11 +8369,9 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } } else { PrintFlag = true; - SizingMethod = HVAC::HeatingCapacitySizing; FieldNum = 10 + (Mode - 1) * 6; SizingString = state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames(FieldNum) + " [W]"; if (IsAutoSize || !HardSizeNoDesRun) { - SizingMethod = HVAC::AutoCalculateSizing; // autosize low speed capacity to fraction of the highest speed capacity if (!HardSizeNoDesRun) { state.dataSize->DataConstantUsedForSizing = MSRatedTotCapDesAtMaxSpeed; @@ -9196,8 +9113,6 @@ void CalcDoe2DXCoil(EnergyPlusData &state, Real64 HeatRTF; // heating coil part-load ratio, used for cycling fan RH control Real64 HeatingCoilPLF; // heating coil PLF (function of PLR), used for cycling fan RH control - auto &DXCT = state.dataHVACGlobal->DXCT; - // If Performance mode not present, then set to 1. Used only by Multimode/Multispeed DX coil (otherwise mode = 1) if (present(PerfMode)) { Mode = PerfMode; @@ -10229,8 +10144,6 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, AirFlowRatio = 1.0; } - auto &DXCT = state.dataHVACGlobal->DXCT; - MaxIter = 30; RF = 0.4; Counter = 0; @@ -10892,10 +10805,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, AirFlowRatio = 1.0; } - auto &DXCT = state.dataHVACGlobal->DXCT; - auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); - // Get condenser outdoor node info from DX Heating Coil if (thisDXCoil.CondenserInletNodeNum(1) != 0) { OutdoorDryBulb = state.dataLoopNodes->Node(thisDXCoil.CondenserInletNodeNum(1)).Temp; @@ -11946,8 +11856,6 @@ Real64 CalcCBF(EnergyPlusData &state, Real64 adjustedSHR; // SHR calculated using adjusted outlet air properties [] bool CBFErrors(false); // Set to true if errors in CBF calculation, fatal at end of routine - auto &DXCT = state.dataHVACGlobal->DXCT; - if (AirVolFlowRate <= 0.0 || TotCap <= 0.0) { // Coil not running or has no capacity, don't calculate CBF return CBF; } @@ -12619,8 +12527,6 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, Real64 AirVolumeFlowRate; // Air volume flow rate across the heating coil Real64 VolFlowperRatedTotCap; // Air volume flow rate divided by rated total heating capacity - auto &DXCT = state.dataHVACGlobal->DXCT; - auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); if (thisDXCoil.CondenserInletNodeNum(DXMode) != 0) { @@ -13465,7 +13371,6 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, // Autodesk:Uninit Initialize variables used uninitialized FullLoadOutAirEnth = 0.0; // Autodesk:Uninit Force default initialization - auto &DXCT = state.dataHVACGlobal->DXCT; auto &thisDXCoil = state.dataDXCoils->DXCoil(DXCoilNum); if (SpeedNum > 1) { @@ -16885,7 +16790,7 @@ void CalcVRFCoolingCoil_FluidTCtrl(EnergyPlusData &state, } // If cycling fan, send coil part-load fraction to on/off fan via HVACDataGlobals - if (fanOp == HVAC::FanOp::Cycling) state.dataHVACGlobal->OnOffFanPartLoadFraction = PLF; + if (fanOp == HVAC::FanOp::Cycling) state.dataHVACGlobal->OnOffFanPartLoadFraction = thisDXCoil.CoolingCoilRuntimeFraction; // Check for saturation error and modify temperature at constant enthalpy if (OutletAirTemp < PsyTsatFnHPb(state, OutletAirEnthalpy, OutdoorPressure)) { diff --git a/src/EnergyPlus/DataAirLoop.hh b/src/EnergyPlus/DataAirLoop.hh index e1a6e359749..03eea3ca392 100644 --- a/src/EnergyPlus/DataAirLoop.hh +++ b/src/EnergyPlus/DataAirLoop.hh @@ -85,7 +85,7 @@ namespace DataAirLoop { Array1D_int TermUnitCoolSizingIndex; // Air terminal sizing numbers for zones cooled by this air loop Array1D_int TermUnitHeatSizingIndex; // Air terminal sizing numbers for zones heated by this air loop Array1D SupplyDuctType; // 1=main, 2=cooling, 3=heating, 4=other - EPVector SupplyDuctBranchNum; // Supply duct branch number + EPVector SupplyDuctBranchNum; // Supply duct branch number (airloop branchnum, not the actual branch index) EPVector SupplyAirPathNum; // Supply air path indexes EPVector ReturnAirPathNum; // Return air path indexes }; diff --git a/src/EnergyPlus/DataAirSystems.hh b/src/EnergyPlus/DataAirSystems.hh index 4a029e8b81d..984e35c3da2 100644 --- a/src/EnergyPlus/DataAirSystems.hh +++ b/src/EnergyPlus/DataAirSystems.hh @@ -190,7 +190,7 @@ namespace DataAirSystems { AirLoopMixerData Mixer; // Data for mixer (if any) Array1D_bool ControlConverged; // Convergence Parameter for controllers int NumOutletBranches = 0; - std::array OutletBranchNum = {0}; // branch numbers of system outlets + std::array OutletBranchNum = {0}; // airloop branch numbers of system outlets (not the actual branch index) int NumInletBranches = 0; std::array InletBranchNum = {0}; // branch number of system inlets bool CentralHeatCoilExists = true; // true if there are central heating coils diff --git a/src/EnergyPlus/DataBSDFWindow.hh b/src/EnergyPlus/DataBSDFWindow.hh index 4c23302753e..044fdea031d 100644 --- a/src/EnergyPlus/DataBSDFWindow.hh +++ b/src/EnergyPlus/DataBSDFWindow.hh @@ -74,6 +74,8 @@ namespace DataBSDFWindow { Num }; + static constexpr std::array basisNamesUC = {"LBNLWINDOW", "USERDEFINED"}; + enum class BasisSymmetry { Invalid = -1, @@ -82,6 +84,8 @@ namespace DataBSDFWindow { Num }; + static constexpr std::array basisSymmetryNamesUC = {"AXISSYMMETRIC", "NONE"}; + // Thermal calculations for complex fenestration can be used to generate reports for standard cases // noCondition is used when performing timestep calculations // 'Summer' will override certain parameters so that produced results are matching standard summer WINDOW = software results diff --git a/src/EnergyPlus/DataComplexFenestration.hh b/src/EnergyPlus/DataComplexFenestration.hh index 22e339e9c65..44daa8e5c2e 100644 --- a/src/EnergyPlus/DataComplexFenestration.hh +++ b/src/EnergyPlus/DataComplexFenestration.hh @@ -60,21 +60,6 @@ namespace EnergyPlus { namespace DataComplexFenestration { - struct GapSupportPillar - { - // Members - std::string Name; // Name of support pillar - Real64 Spacing = 0.0; // Spacing between centers of support pillars (m) - Real64 Radius = 0.0; // Support pillar radius (m) - }; - - struct GapDeflectionState - { - // Members - std::string Name; // Name of deflection state - Real64 DeflectedThickness = 0.0; - }; - } // namespace DataComplexFenestration } // namespace EnergyPlus diff --git a/src/EnergyPlus/DataConvergParams.hh b/src/EnergyPlus/DataConvergParams.hh index ec19078adda..ccb329ae122 100644 --- a/src/EnergyPlus/DataConvergParams.hh +++ b/src/EnergyPlus/DataConvergParams.hh @@ -183,7 +183,7 @@ struct ConvergParamsData : BaseGlobalStruct Array1D AirLoopConvergence; Array1D PlantConvergence; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataDaylighting.hh b/src/EnergyPlus/DataDaylighting.hh index 9f61690fc42..36b8c0a78c4 100644 --- a/src/EnergyPlus/DataDaylighting.hh +++ b/src/EnergyPlus/DataDaylighting.hh @@ -214,7 +214,8 @@ namespace Dayltg { // 3: Reference point number (1 to Total Daylighting Reference Points) // 4: Sky type (1 to 4; 1 = clear, 2 = clear turbid, 3 = intermediate, 4 = overcast // 5: Daylit window number (1 to NumOfDayltgExtWins) - std::array>, (int)Constant::HoursInDay + 1> daylFac; + std::array, (int)DataSurfaces::WinCover::Num>>, (int)Constant::HoursInDay + 1> + daylFac; // Time exceeding daylight illuminance setpoint at reference points (hours) // Array1D TimeExceedingDaylightIlluminanceSPAtRefPt; @@ -270,7 +271,7 @@ namespace Dayltg { // 3: Reference point number (1 to Total Map Reference Points) // 4: Shading index (1 to MaxSlatAngs+1; 1 = bare window; 2 = with shade, or, if blinds // 2 = first slat position, 3 = second position, ..., MaxSlatAngs+1 = last position) - std::array, (int)Constant::HoursInDay + 1> daylFac; + std::array>, (int)Constant::HoursInDay + 1> daylFac; }; struct RefPointData diff --git a/src/EnergyPlus/DataDaylightingDevices.hh b/src/EnergyPlus/DataDaylightingDevices.hh index ff7f95cf38e..7b2a98d0d05 100644 --- a/src/EnergyPlus/DataDaylightingDevices.hh +++ b/src/EnergyPlus/DataDaylightingDevices.hh @@ -136,7 +136,7 @@ struct DataDaylightingDevicesData : BaseGlobalStruct Array1D TDDPipe; Array1D Shelf; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataGenerators.hh b/src/EnergyPlus/DataGenerators.hh index 58ee7af1587..88246121787 100644 --- a/src/EnergyPlus/DataGenerators.hh +++ b/src/EnergyPlus/DataGenerators.hh @@ -327,7 +327,7 @@ struct GeneratorsData : BaseGlobalStruct Real64 TrialMdotcw = 0.0; // test or estimate of what the plant flows are going to be (kg/s) Real64 LimitMinMdotcw = 0.0; // lower limit for cooling water flow for generatior operation (kg/s) - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataHeatBalance.cc b/src/EnergyPlus/DataHeatBalance.cc index dbc9ccd8b04..0561b8aa23e 100644 --- a/src/EnergyPlus/DataHeatBalance.cc +++ b/src/EnergyPlus/DataHeatBalance.cc @@ -348,6 +348,7 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, // This routine checks some properties of entered constructions; sets some properties; and sets // an error flag for certain error conditions. + auto &s_mat = state.dataMaterial; auto &thisConstruct = state.dataConstruction->Construct(ConstrNum); int TotLayers = thisConstruct.TotLayers; // Number of layers in a construction @@ -360,7 +361,7 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, thisConstruct.DayltPropPtr = 0; int InsideMaterNum = thisConstruct.LayerPoint(InsideLayer); // Material "number" of the Inside layer if (InsideMaterNum != 0) { - auto const *mat = state.dataMaterial->Material(InsideMaterNum); + auto const *mat = s_mat->materials(InsideMaterNum); thisConstruct.InsideAbsorpVis = mat->AbsorpVisible; thisConstruct.InsideAbsorpSolar = mat->AbsorpSolar; @@ -370,7 +371,7 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, int OutsideMaterNum = thisConstruct.LayerPoint(1); // Material "number" of the Outside layer if (OutsideMaterNum != 0) { - auto const *mat = state.dataMaterial->Material(OutsideMaterNum); + auto const *mat = s_mat->materials(OutsideMaterNum); thisConstruct.OutsideAbsorpVis = mat->AbsorpVisible; thisConstruct.OutsideAbsorpSolar = mat->AbsorpSolar; } @@ -386,26 +387,24 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, for (int Layer = 1; Layer <= TotLayers; ++Layer) { int const MaterNum = thisConstruct.LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later - auto const *thisMaterial = state.dataMaterial->Material(MaterNum); + auto const *mat = s_mat->materials(MaterNum); thisConstruct.TypeIsWindow = - (thisMaterial->group == Material::Group::WindowGlass || thisMaterial->group == Material::Group::WindowGas || - thisMaterial->group == Material::Group::WindowGasMixture || thisMaterial->group == Material::Group::Shade || - thisMaterial->group == Material::Group::WindowBlind || thisMaterial->group == Material::Group::Screen || - thisMaterial->group == Material::Group::WindowSimpleGlazing || thisMaterial->group == Material::Group::ComplexWindowShade || - thisMaterial->group == Material::Group::ComplexWindowGap || thisMaterial->group == Material::Group::GlassEquivalentLayer || - thisMaterial->group == Material::Group::ShadeEquivalentLayer || thisMaterial->group == Material::Group::DrapeEquivalentLayer || - thisMaterial->group == Material::Group::ScreenEquivalentLayer || thisMaterial->group == Material::Group::BlindEquivalentLayer || - thisMaterial->group == Material::Group::GapEquivalentLayer); - bool TypeIsNotWindow = (thisMaterial->group == Material::Group::Invalid || thisMaterial->group == Material::Group::Air || - thisMaterial->group == Material::Group::Regular || thisMaterial->group == Material::Group::EcoRoof || - thisMaterial->group == Material::Group::IRTransparent); + (mat->group == Material::Group::Glass || mat->group == Material::Group::Gas || mat->group == Material::Group::GasMixture || + mat->group == Material::Group::Shade || mat->group == Material::Group::Blind || mat->group == Material::Group::Screen || + mat->group == Material::Group::GlassSimple || mat->group == Material::Group::ComplexShade || + mat->group == Material::Group::ComplexWindowGap || mat->group == Material::Group::GlassEQL || mat->group == Material::Group::ShadeEQL || + mat->group == Material::Group::DrapeEQL || mat->group == Material::Group::ScreenEQL || mat->group == Material::Group::BlindEQL || + mat->group == Material::Group::WindowGapEQL); + bool TypeIsNotWindow = + (mat->group == Material::Group::Invalid || mat->group == Material::Group::AirGap || mat->group == Material::Group::Regular || + mat->group == Material::Group::EcoRoof || mat->group == Material::Group::IRTransparent); if (!thisConstruct.TypeIsWindow && !TypeIsNotWindow) assert(false); } if (InsideMaterNum == 0) return; - auto const *thisMaterialInside = state.dataMaterial->Material(InsideMaterNum); + auto const *matInside = s_mat->materials(InsideMaterNum); if (OutsideMaterNum == 0) return; - auto const *thisMaterialOutside = state.dataMaterial->Material(OutsideMaterNum); + auto const *matOutside = s_mat->materials(OutsideMaterNum); if (thisConstruct.TypeIsWindow) { @@ -415,16 +414,15 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, for (int Layer = 1; Layer <= TotLayers; ++Layer) { int const MaterNum = thisConstruct.LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later - auto const *thisMaterial = state.dataMaterial->Material(MaterNum); + auto const *mat = s_mat->materials(MaterNum); WrongMaterialsMix = - !((thisMaterial->group == Material::Group::WindowGlass) || (thisMaterial->group == Material::Group::WindowGas) || - (thisMaterial->group == Material::Group::WindowGasMixture) || (thisMaterial->group == Material::Group::Shade) || - (thisMaterial->group == Material::Group::WindowBlind) || (thisMaterial->group == Material::Group::Screen) || - (thisMaterial->group == Material::Group::WindowSimpleGlazing) || (thisMaterial->group == Material::Group::ComplexWindowShade) || - (thisMaterial->group == Material::Group::ComplexWindowGap) || (thisMaterial->group == Material::Group::GlassEquivalentLayer) || - (thisMaterial->group == Material::Group::ShadeEquivalentLayer) || (thisMaterial->group == Material::Group::DrapeEquivalentLayer) || - (thisMaterial->group == Material::Group::ScreenEquivalentLayer) || (thisMaterial->group == Material::Group::BlindEquivalentLayer) || - (thisMaterial->group == Material::Group::GapEquivalentLayer)); + !((mat->group == Material::Group::Glass) || (mat->group == Material::Group::Gas) || (mat->group == Material::Group::GasMixture) || + (mat->group == Material::Group::Shade) || (mat->group == Material::Group::Blind) || (mat->group == Material::Group::Screen) || + (mat->group == Material::Group::GlassSimple) || (mat->group == Material::Group::ComplexShade) || + (mat->group == Material::Group::ComplexWindowGap) || (mat->group == Material::Group::GlassEQL) || + (mat->group == Material::Group::ShadeEQL) || (mat->group == Material::Group::DrapeEQL) || + (mat->group == Material::Group::ScreenEQL) || (mat->group == Material::Group::BlindEQL) || + (mat->group == Material::Group::WindowGapEQL)); } if (WrongMaterialsMix) { // Illegal material for a window construction @@ -443,12 +441,11 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, ErrorsFound = true; } else if (TotLayers == 1) { - auto const *thisMaterial = state.dataMaterial->Material(thisConstruct.LayerPoint(1)); - Material::Group thisMaterialGroup = thisMaterial->group; - if ((thisMaterialGroup == Material::Group::Shade) || (thisMaterialGroup == Material::Group::WindowGas) || - (thisMaterialGroup == Material::Group::WindowGasMixture) || (thisMaterialGroup == Material::Group::WindowBlind) || - (thisMaterialGroup == Material::Group::Screen) || (thisMaterialGroup == Material::Group::ComplexWindowShade) || - (thisMaterialGroup == Material::Group::ComplexWindowGap)) { + auto const *mat = s_mat->materials(thisConstruct.LayerPoint(1)); + Material::Group matGroup = mat->group; + if ((matGroup == Material::Group::Shade) || (matGroup == Material::Group::Gas) || (matGroup == Material::Group::GasMixture) || + (matGroup == Material::Group::Blind) || (matGroup == Material::Group::Screen) || (matGroup == Material::Group::ComplexShade) || + (matGroup == Material::Group::ComplexWindowGap)) { ShowSevereError(state, format("CheckAndSetConstructionProperties: The single-layer window construction={} has a gas, complex gap, shade, " "complex shade, screen or blind material; it should be glass of simple glazing system.", @@ -466,20 +463,19 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, for (int Layer = 1; Layer <= TotLayers; ++Layer) { int const MaterNum = thisConstruct.LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later - auto const *thisMaterial = state.dataMaterial->Material(MaterNum); - if (thisMaterial->group == Material::Group::WindowGlass) ++TotGlassLayers; - if (thisMaterial->group == Material::Group::WindowSimpleGlazing) ++TotGlassLayers; - if (thisMaterial->group == Material::Group::Shade || thisMaterial->group == Material::Group::WindowBlind || - thisMaterial->group == Material::Group::Screen || thisMaterial->group == Material::Group::ComplexWindowShade) + auto const *mat = s_mat->materials(MaterNum); + if (mat->group == Material::Group::Glass) ++TotGlassLayers; + if (mat->group == Material::Group::GlassSimple) ++TotGlassLayers; + if (mat->group == Material::Group::Shade || mat->group == Material::Group::Blind || mat->group == Material::Group::Screen || + mat->group == Material::Group::ComplexShade) ++TotShadeLayers; - if (thisMaterial->group == Material::Group::WindowGas || thisMaterial->group == Material::Group::WindowGasMixture || - thisMaterial->group == Material::Group::ComplexWindowGap) + if (mat->group == Material::Group::Gas || mat->group == Material::Group::GasMixture || mat->group == Material::Group::ComplexWindowGap) ++TotGasLayers; if (Layer < TotLayers) { int const MaterNumNext = thisConstruct.LayerPoint(Layer + 1); // Adjacent layers of same type not allowed if (MaterNumNext == 0) continue; - if (thisMaterial->group == state.dataMaterial->Material(MaterNumNext)->group) WrongWindowLayering = true; + if (mat->group == s_mat->materials(MaterNumNext)->group) WrongWindowLayering = true; } } @@ -488,19 +484,19 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, if (thisConstruct.WindowTypeBSDF) { thisConstruct.TotGlassLayers = TotGlassLayers; thisConstruct.TotSolidLayers = TotGlassLayers + TotShadeLayers; - thisConstruct.InsideAbsorpThermal = thisMaterialInside->AbsorpThermalBack; - thisConstruct.OutsideAbsorpThermal = thisMaterialOutside->AbsorpThermalFront; + thisConstruct.InsideAbsorpThermal = matInside->AbsorpThermalBack; + thisConstruct.OutsideAbsorpThermal = matOutside->AbsorpThermalFront; return; } if (thisConstruct.WindowTypeEQL) { - thisConstruct.InsideAbsorpThermal = thisMaterialInside->AbsorpThermalBack; - thisConstruct.OutsideAbsorpThermal = thisMaterialOutside->AbsorpThermalFront; + thisConstruct.InsideAbsorpThermal = matInside->AbsorpThermalBack; + thisConstruct.OutsideAbsorpThermal = matOutside->AbsorpThermalFront; return; } - if (thisMaterialOutside->group == Material::Group::WindowGas || thisMaterialOutside->group == Material::Group::WindowGasMixture || - thisMaterialInside->group == Material::Group::WindowGas || thisMaterialInside->group == Material::Group::WindowGasMixture) + if (matOutside->group == Material::Group::Gas || matOutside->group == Material::Group::GasMixture || + matInside->group == Material::Group::Gas || matInside->group == Material::Group::GasMixture) WrongWindowLayering = true; // Gas cannot be first or last layer if (TotShadeLayers > 1) WrongWindowLayering = true; // At most one shade, screen or blind allowed @@ -508,12 +504,9 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, for (int Layer = 1; Layer <= TotLayers; ++Layer) { int const MatNum = thisConstruct.LayerPoint(Layer); if (MatNum == 0) continue; // error -- has been caught will stop program later - auto const *mat = state.dataMaterial->Material(MatNum); - if (mat->group != Material::Group::WindowGlass && mat->group != Material::Group::WindowSimpleGlazing && - mat->group != Material::Group::GlassEquivalentLayer) - continue; - - auto const *matGlass = dynamic_cast(mat); + auto const *mat = s_mat->materials(MatNum); + if (mat->group != Material::Group::Glass) continue; + auto const *matGlass = dynamic_cast(mat); assert(matGlass != nullptr); if (matGlass->SolarDiffusing && TotShadeLayers > 0) { ErrorsFound = true; @@ -529,10 +522,10 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, for (int Layer = 1; Layer <= TotLayers; ++Layer) { int const MatNum = thisConstruct.LayerPoint(Layer); if (MatNum == 0) continue; // error -- has been caught will stop program later - auto const *mat = state.dataMaterial->Material(MatNum); - if (mat->group != Material::Group::WindowGlass) continue; + auto const *mat = s_mat->materials(MatNum); + if (mat->group != Material::Group::Glass) continue; - auto const *matGlass = dynamic_cast(mat); + auto const *matGlass = dynamic_cast(mat); assert(matGlass != nullptr); ++GlassLayNum; if (GlassLayNum < TotGlassLayers && matGlass->SolarDiffusing) { @@ -544,16 +537,15 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, } // interior window screen is not allowed. Check for invalid between-glass screen is checked below. - if (TotShadeLayers == 1 && thisMaterialInside->group == Material::Group::Screen && TotLayers != 1) { + if (TotShadeLayers == 1 && matInside->group == Material::Group::Screen && TotLayers != 1) { WrongWindowLayering = true; } // Consistency checks for a construction with a between-glass shade or blind - if (TotShadeLayers == 1 && thisMaterialOutside->group != Material::Group::Shade && - thisMaterialOutside->group != Material::Group::WindowBlind && thisMaterialOutside->group != Material::Group::Screen && - thisMaterialInside->group != Material::Group::Shade && thisMaterialInside->group != Material::Group::WindowBlind && - thisMaterialInside->group != Material::Group::ComplexWindowShade && !WrongWindowLayering) { + if (TotShadeLayers == 1 && matOutside->group != Material::Group::Shade && matOutside->group != Material::Group::Blind && + matOutside->group != Material::Group::Screen && matInside->group != Material::Group::Shade && + matInside->group != Material::Group::Blind && matInside->group != Material::Group::ComplexShade && !WrongWindowLayering) { // This is a construction with a between-glass shade or blind @@ -566,33 +558,33 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, if (TotLayers != 5) { WrongWindowLayering = true; } else { - if (thisMaterialOutside->group == Material::Group::WindowGlass && - (state.dataMaterial->Material(thisConstruct.LayerPoint(2))->group == Material::Group::WindowGas || - state.dataMaterial->Material(thisConstruct.LayerPoint(2))->group == Material::Group::WindowGasMixture) && - ((state.dataMaterial->Material(thisConstruct.LayerPoint(3))->group == Material::Group::Shade || - state.dataMaterial->Material(thisConstruct.LayerPoint(3))->group == Material::Group::WindowBlind) && - state.dataMaterial->Material(thisConstruct.LayerPoint(3))->group != Material::Group::Screen) && - (state.dataMaterial->Material(thisConstruct.LayerPoint(4))->group == Material::Group::WindowGas || - state.dataMaterial->Material(thisConstruct.LayerPoint(4))->group == Material::Group::WindowGasMixture) && - state.dataMaterial->Material(thisConstruct.LayerPoint(5))->group == Material::Group::WindowGlass) + if (matOutside->group == Material::Group::Glass && + (s_mat->materials(thisConstruct.LayerPoint(2))->group == Material::Group::Gas || + s_mat->materials(thisConstruct.LayerPoint(2))->group == Material::Group::GasMixture) && + ((s_mat->materials(thisConstruct.LayerPoint(3))->group == Material::Group::Shade || + s_mat->materials(thisConstruct.LayerPoint(3))->group == Material::Group::Blind) && + s_mat->materials(thisConstruct.LayerPoint(3))->group != Material::Group::Screen) && + (s_mat->materials(thisConstruct.LayerPoint(4))->group == Material::Group::Gas || + s_mat->materials(thisConstruct.LayerPoint(4))->group == Material::Group::GasMixture) && + s_mat->materials(thisConstruct.LayerPoint(5))->group == Material::Group::Glass) ValidBGShadeBlindConst = true; } } else { // TotGlassLayers = 3 if (TotLayers != 7) { WrongWindowLayering = true; } else { - if (thisMaterialOutside->group == Material::Group::WindowGlass && - (state.dataMaterial->Material(thisConstruct.LayerPoint(2))->group == Material::Group::WindowGas || - state.dataMaterial->Material(thisConstruct.LayerPoint(2))->group == Material::Group::WindowGasMixture) && - state.dataMaterial->Material(thisConstruct.LayerPoint(3))->group == Material::Group::WindowGlass && - (state.dataMaterial->Material(thisConstruct.LayerPoint(4))->group == Material::Group::WindowGas || - state.dataMaterial->Material(thisConstruct.LayerPoint(4))->group == Material::Group::WindowGasMixture) && - ((state.dataMaterial->Material(thisConstruct.LayerPoint(5))->group == Material::Group::Shade || - state.dataMaterial->Material(thisConstruct.LayerPoint(5))->group == Material::Group::WindowBlind) && - state.dataMaterial->Material(thisConstruct.LayerPoint(5))->group != Material::Group::Screen) && - (state.dataMaterial->Material(thisConstruct.LayerPoint(6))->group == Material::Group::WindowGas || - state.dataMaterial->Material(thisConstruct.LayerPoint(6))->group == Material::Group::WindowGasMixture) && - state.dataMaterial->Material(thisConstruct.LayerPoint(7))->group == Material::Group::WindowGlass) + if (matOutside->group == Material::Group::Glass && + (s_mat->materials(thisConstruct.LayerPoint(2))->group == Material::Group::Gas || + s_mat->materials(thisConstruct.LayerPoint(2))->group == Material::Group::GasMixture) && + s_mat->materials(thisConstruct.LayerPoint(3))->group == Material::Group::Glass && + (s_mat->materials(thisConstruct.LayerPoint(4))->group == Material::Group::Gas || + s_mat->materials(thisConstruct.LayerPoint(4))->group == Material::Group::GasMixture) && + ((s_mat->materials(thisConstruct.LayerPoint(5))->group == Material::Group::Shade || + s_mat->materials(thisConstruct.LayerPoint(5))->group == Material::Group::Blind) && + s_mat->materials(thisConstruct.LayerPoint(5))->group != Material::Group::Screen) && + (s_mat->materials(thisConstruct.LayerPoint(6))->group == Material::Group::Gas || + s_mat->materials(thisConstruct.LayerPoint(6))->group == Material::Group::GasMixture) && + s_mat->materials(thisConstruct.LayerPoint(7))->group == Material::Group::Glass) ValidBGShadeBlindConst = true; } } // End of check if TotGlassLayers = 2 or 3 @@ -600,57 +592,52 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, if (!WrongWindowLayering) { int const LayNumSh = 2 * TotGlassLayers - 1; int const MatSh = thisConstruct.LayerPoint(LayNumSh); - auto const *thisMaterialSh = dynamic_cast(state.dataMaterial->Material(MatSh)); - assert(thisMaterialSh != nullptr); + auto const *matSh = s_mat->materials(MatSh); // For double pane, shade/blind must be layer #3. // For triple pane, it must be layer #5 (i.e., between two inner panes). - if (thisMaterialSh->group != Material::Group::Shade && thisMaterialSh->group != Material::Group::WindowBlind) - WrongWindowLayering = true; + if (matSh->group != Material::Group::Shade && matSh->group != Material::Group::Blind) 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 int const MatGapL = thisConstruct.LayerPoint(LayNumSh - 1); int const MatGapR = thisConstruct.LayerPoint(LayNumSh + 1); - auto const *thisMaterialGapL = dynamic_cast(state.dataMaterial->Material(MatGapL)); - auto const *thisMaterialGapR = dynamic_cast(state.dataMaterial->Material(MatGapR)); + auto const *matGapL = dynamic_cast(s_mat->materials(MatGapL)); + auto const *matGapR = dynamic_cast(s_mat->materials(MatGapR)); for (int IGas = 0; IGas < Material::maxMixGases; ++IGas) { - if ((thisMaterialGapL->gases[IGas].type != thisMaterialGapR->gases[IGas].type) || - (thisMaterialGapL->gasFracts[IGas] != thisMaterialGapR->gasFracts[IGas])) + if ((matGapL->gases[IGas].type != matGapR->gases[IGas].type) || (matGapL->gasFracts[IGas] != matGapR->gasFracts[IGas])) WrongWindowLayering = true; } // Gap width on either side of a between-glass shade/blind must be the same - if (std::abs(thisMaterialGapL->Thickness - thisMaterialGapR->Thickness) > 0.0005) WrongWindowLayering = true; - if (thisMaterialSh->group == Material::Group::WindowBlind) { - int const BlNum = thisMaterialSh->BlindDataPtr; - if (BlNum > 0) { - if ((thisMaterialGapL->Thickness + thisMaterialGapR->Thickness) < state.dataMaterial->Blind(BlNum).SlatWidth) { - ErrorsFound = true; - ShowSevereError(state, - format("CheckAndSetConstructionProperties: For window construction {}", thisConstruct.Name)); - ShowContinueError(state, "the slat width of the between-glass blind is greater than"); - ShowContinueError(state, "the sum of the widths of the gas layers adjacent to the blind."); - } - } // End of check if BlNum > 0 - } // End of check if material is window blind - } // End of check if WrongWindowLayering - } // End of check if WrongWindowLayering - } // End of check on total glass layers - } // End of check if construction has between-glass shade/blind + if (std::abs(matGapL->Thickness - matGapR->Thickness) > 0.0005) WrongWindowLayering = true; + if (matSh->group == Material::Group::Blind) { + auto const *matBlind = dynamic_cast(matSh); + assert(matBlind != nullptr); + if ((matGapL->Thickness + matGapR->Thickness) < matBlind->SlatWidth) { + ErrorsFound = true; + ShowSevereError(state, format("CheckAndSetConstructionProperties: For window construction {}", thisConstruct.Name)); + ShowContinueError(state, "the slat width of the between-glass blind is greater than"); + ShowContinueError(state, "the sum of the widths of the gas layers adjacent to the blind."); + } + } // End of check if material is window blind + } // End of check if WrongWindowLayering + } // End of check if WrongWindowLayering + } // End of check on total glass layers + } // End of check if construction has between-glass shade/blind // Check Simple Windows, - if (state.dataMaterial->Material(thisConstruct.LayerPoint(1))->group == Material::Group::WindowSimpleGlazing) { + if (s_mat->materials(thisConstruct.LayerPoint(1))->group == Material::Group::GlassSimple) { if (TotLayers > 1) { // check that none of the other layers are glazing or gas for (int Layer = 1; Layer <= TotLayers; ++Layer) { int const MaterNum = thisConstruct.LayerPoint(Layer); if (MaterNum == 0) continue; // error -- has been caught will stop program later - auto const *thisMaterial = state.dataMaterial->Material(MaterNum); - if (thisMaterial->group == Material::Group::WindowGlass) { + auto const *mat = s_mat->materials(MaterNum); + if (mat->group == Material::Group::Glass) { ErrorsFound = true; ShowSevereError(state, format("CheckAndSetConstructionProperties: Error in window construction {}--", thisConstruct.Name)); ShowContinueError(state, "For simple window constructions, no other glazing layers are allowed."); } - if (thisMaterial->group == Material::Group::WindowGas) { + if (mat->group == Material::Group::Gas) { ErrorsFound = true; ShowSevereError(state, format("CheckAndSetConstructionProperties: Error in window construction {}--", thisConstruct.Name)); ShowContinueError(state, "For simple window constructions, no other gas layers are allowed."); @@ -686,60 +673,59 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, // 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 (thisMaterialInside->group == Material::Group::Shade || thisMaterialInside->group == Material::Group::WindowBlind) { + if (matInside->group == Material::Group::Shade || matInside->group == Material::Group::Blind) { --InsideLayer; } if (InsideLayer > 0) { InsideMaterNum = thisConstruct.LayerPoint(InsideLayer); - thisConstruct.InsideAbsorpThermal = thisMaterialInside->AbsorpThermalBack; + thisConstruct.InsideAbsorpThermal = matInside->AbsorpThermalBack; } if (InsideMaterNum != 0) { - auto const *thisInsideMaterial = dynamic_cast(state.dataMaterial->Material(InsideMaterNum)); + auto const *thisInsideMaterial = s_mat->materials(InsideMaterNum); thisConstruct.InsideAbsorpVis = thisInsideMaterial->AbsorpVisible; thisConstruct.InsideAbsorpSolar = thisInsideMaterial->AbsorpSolar; } - if ((thisMaterialOutside->group == Material::Group::WindowGlass) || - (thisMaterialOutside->group == Material::Group::WindowSimpleGlazing)) { // Glass - thisConstruct.OutsideAbsorpThermal = thisMaterialOutside->AbsorpThermalFront; + if ((matOutside->group == Material::Group::Glass) || (matOutside->group == Material::Group::GlassSimple)) { // Glass + thisConstruct.OutsideAbsorpThermal = matOutside->AbsorpThermalFront; } else { // Exterior shade, blind or screen - thisConstruct.OutsideAbsorpThermal = thisMaterialOutside->AbsorpThermal; + thisConstruct.OutsideAbsorpThermal = matOutside->AbsorpThermal; } } else { // Opaque surface - thisConstruct.InsideAbsorpThermal = thisMaterialInside->AbsorpThermal; - thisConstruct.OutsideAbsorpThermal = thisMaterialOutside->AbsorpThermal; + thisConstruct.InsideAbsorpThermal = matInside->AbsorpThermal; + thisConstruct.OutsideAbsorpThermal = matOutside->AbsorpThermal; } - thisConstruct.OutsideRoughness = thisMaterialOutside->Roughness; + thisConstruct.OutsideRoughness = matOutside->Roughness; - if (thisMaterialOutside->group == Material::Group::Air) { + if (matOutside->group == Material::Group::AirGap) { ShowSevereError(state, format("CheckAndSetConstructionProperties: Outside Layer is Air for construction {}", thisConstruct.Name)); - ShowContinueError(state, format(" Error in material {}", thisMaterialOutside->Name)); + ShowContinueError(state, format(" Error in material {}", matOutside->Name)); ErrorsFound = true; } if (InsideLayer > 0) { - if (thisMaterialInside->group == Material::Group::Air) { + if (matInside->group == Material::Group::AirGap) { ShowSevereError(state, format("CheckAndSetConstructionProperties: Inside Layer is Air for construction {}", thisConstruct.Name)); - ShowContinueError(state, format(" Error in material {}", thisMaterialInside->Name)); + ShowContinueError(state, format(" Error in material {}", matInside->Name)); ErrorsFound = true; } } - if (thisMaterialOutside->group == Material::Group::EcoRoof) { + if (matOutside->group == Material::Group::EcoRoof) { thisConstruct.TypeIsEcoRoof = true; // need to check EcoRoof is not non-outside layer for (int Layer = 2; Layer <= TotLayers; ++Layer) { - if (state.dataMaterial->Material(thisConstruct.LayerPoint(Layer))->group == Material::Group::EcoRoof) { + if (s_mat->materials(thisConstruct.LayerPoint(Layer))->group == Material::Group::EcoRoof) { ShowSevereError(state, format("CheckAndSetConstructionProperties: Interior Layer is EcoRoof for construction {}", thisConstruct.Name)); - ShowContinueError(state, format(" Error in material {}", state.dataMaterial->Material(thisConstruct.LayerPoint(Layer))->Name)); + ShowContinueError(state, format(" Error in material {}", s_mat->materials(thisConstruct.LayerPoint(Layer))->Name)); ErrorsFound = true; } } } - if (thisMaterialOutside->group == Material::Group::IRTransparent) { + if (matOutside->group == Material::Group::IRTransparent) { thisConstruct.TypeIsIRT = true; if (thisConstruct.TotLayers != 1) { ShowSevereError( @@ -768,6 +754,7 @@ int AssignReverseConstructionNumber(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Create reverse layers. Look in current constructions to see if match. If no match, create a new one. + auto &s_mat = state.dataMaterial; // Return value int NewConstrNum; // Reverse Construction Number @@ -826,7 +813,7 @@ int AssignReverseConstructionNumber(EnergyPlusData &state, state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).LayerPoint(nLayer) = state.dataConstruction->LayerPoint(nLayer); if (state.dataConstruction->LayerPoint(nLayer) != 0) { state.dataHeatBal->NominalRforNominalUCalculation(state.dataHeatBal->TotConstructs) += - state.dataHeatBal->NominalR(state.dataConstruction->LayerPoint(nLayer)); + s_mat->materials(state.dataConstruction->LayerPoint(nLayer))->NominalR; } } @@ -843,114 +830,6 @@ int AssignReverseConstructionNumber(EnergyPlusData &state, return NewConstrNum; } -void AddVariableSlatBlind(EnergyPlusData &state, - int const inBlindNumber, // current Blind Number/pointer to name - int &outBlindNumber, // resultant Blind Number to pass back - bool &errFlag // error flag should one be needed -) -{ - - // SUBROUTINE INFORMATION: - // AUTHOR Linda Lawrie - // DATE WRITTEN September 2009 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // Window Blinds are presented as "fixed" slat blinds. However for certain Window Shading Controls, - // the program needs to set the property to "variable"/movable slats. Since a blind could be in use - // elsewhere with "fixed", a material needs to be added with variable properties -- having most of the - // "fixed" properties in tact. - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Found; - Real64 MinSlatAngGeom; - Real64 MaxSlatAngGeom; - - // Object Data - - // maybe it's already there - errFlag = false; - Found = Util::FindItemInList("~" + state.dataMaterial->Blind(inBlindNumber).Name, state.dataMaterial->Blind); - if (Found == 0) { - // Add a new blind - state.dataHeatBal->TotBlinds += 1; - state.dataMaterial->Blind.push_back(Material::WindowBlindProperties()); - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds) = state.dataMaterial->Blind(inBlindNumber); - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).Name = "~" + state.dataMaterial->Blind(inBlindNumber).Name; - outBlindNumber = state.dataHeatBal->TotBlinds; - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).SlatAngleType = DataWindowEquivalentLayer::AngleType::Variable; - - // Minimum and maximum slat angles allowed by slat geometry - if (state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).SlatWidth > - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).SlatSeparation) { - MinSlatAngGeom = std::asin(state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).SlatThickness / - (state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).SlatThickness + - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).SlatSeparation)) / - Constant::DegToRadians; - } else { - MinSlatAngGeom = 0.0; - } - MaxSlatAngGeom = 180.0 - MinSlatAngGeom; - - // Error if maximum slat angle less than minimum - - if (state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MaxSlatAngle < - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MinSlatAngle) { - errFlag = true; - ShowSevereError(state, format("WindowMaterial:Blind=\"{}\", Illegal value combination.", state.dataMaterial->Blind(inBlindNumber).Name)); - ShowContinueError(state, - format("Minimum Slat Angle=[{:.1R}], is greater than Maximum Slat Angle=[{:.1R}] deg.", - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MinSlatAngle, - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MaxSlatAngle)); - } - - // Error if input slat angle not in input min/max range - - if (state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MaxSlatAngle > - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MinSlatAngle && - (state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).SlatAngle < - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MinSlatAngle || - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).SlatAngle > - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MaxSlatAngle)) { - errFlag = true; - ShowSevereError(state, format("WindowMaterial:Blind=\"{}\", Illegal value combination.", state.dataMaterial->Blind(inBlindNumber).Name)); - ShowContinueError(state, - format("Slat Angle=[{:.1R}] is outside of the input min/max range, min=[{:.1R}], max=[{:.1R}] deg.", - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).SlatAngle, - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MinSlatAngle, - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MaxSlatAngle)); - } - - // Warning if input minimum slat angle is less than that allowed by slat geometry - - if (state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MinSlatAngle < MinSlatAngGeom) { - ShowWarningError(state, format("WindowMaterial:Blind=\"{}\", Illegal value combination.", state.dataMaterial->Blind(inBlindNumber).Name)); - ShowContinueError( - state, - format("Minimum Slat Angle=[{:.1R}] is less than the smallest allowed by slat dimensions and spacing, min=[{:.1R}] deg.", - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MinSlatAngle, - MinSlatAngGeom)); - ShowContinueError(state, format("Minimum Slat Angle will be set to {:.1R} deg.", MinSlatAngGeom)); - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MinSlatAngle = MinSlatAngGeom; - } - - // Warning if input maximum slat angle is greater than that allowed by slat geometry - - if (state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MaxSlatAngle > MaxSlatAngGeom) { - ShowWarningError(state, format("WindowMaterial:Blind=\"{}\", Illegal value combination.", state.dataMaterial->Blind(inBlindNumber).Name)); - ShowContinueError(state, - format("Maximum Slat Angle=[{:.1R}] is greater than the largest allowed by slat dimensions and spacing, [{:.1R}] deg.", - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MaxSlatAngle, - MaxSlatAngGeom)); - ShowContinueError(state, format("Maximum Slat Angle will be set to {:.1R} deg.", MaxSlatAngGeom)); - state.dataMaterial->Blind(state.dataHeatBal->TotBlinds).MaxSlatAngle = MaxSlatAngGeom; - } - } else { - outBlindNumber = Found; - } -} - Real64 ComputeNominalUwithConvCoeffs(EnergyPlusData &state, int const numSurf, // index for Surface array. bool &isValid // returns true if result is valid @@ -1063,6 +942,8 @@ void SetFlagForWindowConstructionWithShadeOrBlindLayer(EnergyPlusData &state) int Layer(0); // construction material layer index int MaterNum(0); // construction material index + auto &s_mat = state.dataMaterial; + for (loopSurfNum = 1; loopSurfNum <= state.dataSurface->TotSurfaces; ++loopSurfNum) { if (state.dataSurface->Surface(loopSurfNum).Class != DataSurfaces::SurfaceClass::Window) continue; @@ -1077,8 +958,8 @@ void SetFlagForWindowConstructionWithShadeOrBlindLayer(EnergyPlusData &state) for (Layer = 1; Layer <= NumLayers; ++Layer) { MaterNum = thisConstruct.LayerPoint(Layer); if (MaterNum == 0) continue; - auto const *thisMaterial = state.dataMaterial->Material(MaterNum); - if (thisMaterial->group == Material::Group::Shade || thisMaterial->group == Material::Group::WindowBlind) + auto const *mat = s_mat->materials(MaterNum); + if (mat->group == Material::Group::Shade || mat->group == Material::Group::Blind) state.dataSurface->SurfWinHasShadeOrBlindLayer(loopSurfNum) = true; } } diff --git a/src/EnergyPlus/DataHeatBalance.hh b/src/EnergyPlus/DataHeatBalance.hh index 6458c81e7e8..d0c04f26035 100644 --- a/src/EnergyPlus/DataHeatBalance.hh +++ b/src/EnergyPlus/DataHeatBalance.hh @@ -58,7 +58,6 @@ // EnergyPlus Headers #include #include -#include #include #include #include @@ -76,9 +75,6 @@ struct EnergyPlusData; namespace DataHeatBalance { // Using/Aliasing - using namespace DataComplexFenestration; - using DataComplexFenestration::GapDeflectionState; - using DataComplexFenestration::GapSupportPillar; using DataVectorTypes::Vector; // Parameters for Interior and Exterior Solar Distribution @@ -427,27 +423,6 @@ namespace DataHeatBalance { constexpr Real64 SurfInitialTemp(23.0); // Surface temperature for initialization constexpr Real64 SurfInitialConvCoeff(3.076); // Surface convective coefficient for initialization - struct TCGlazingsType - { - // Members - std::string Name; // Name - int NumGlzMat = 0; // Number of TC glazing materials - Array1D_int LayerPoint; // Layer pointer - Array1D SpecTemp; // Temperature corresponding to the specified TC glazing optical data - Array1D_string LayerName; // Name of the referenced WindowMaterial:Glazing object - }; - - struct SpectralDataProperties - { - // Members - std::string Name; // Name of spectral data set - int NumOfWavelengths = 0; // Number of wavelengths in the data set - Array1D WaveLength; // Wavelength (microns) - Array1D Trans; // Transmittance at normal incidence - Array1D ReflFront; // Front reflectance at normal incidence - Array1D ReflBack; // Back reflectance at normal incidence - }; - struct ZoneSpaceData { // Base class for zones and spaces. @@ -458,6 +433,7 @@ namespace DataHeatBalance { Real64 Volume = Constant::AutoCalculate; // Volume entered by user [m3] or calculated Real64 ExtGrossWallArea = 0.0; // Exterior Wall Area for Zone (Gross) Real64 ExteriorTotalSurfArea = 0.0; // Total surface area of all exterior surfaces for Zone + Real64 extPerimeter = 0.0; // Total exposed perimeter (sum of width of exterior walls) int SystemZoneNodeNumber = 0; // This is the zone or space node number for the system for a controlled zone Real64 FloorArea = 0.0; // Floor area used for this space Real64 TotOccupants = 0.0; // total design occupancy (sum of NumberOfPeople for the space People objects, not multiplied) @@ -472,7 +448,6 @@ namespace DataHeatBalance { int spaceTypeNum = 0; // Points to spaceType for this space EPVector tags; // Optional tags for reporting EPVector surfaces; // Pointers to surfaces in this space - Real64 calcFloorArea = 0.0; // Calculated floor area used for this space bool hasFloor = false; // Has "Floor" surface Real64 fracZoneFloorArea = 0.0; // fraction of total floor area for all spaces in zone Real64 fracZoneVolume = 0.0; // fraction of total volume for all spaces in zone @@ -586,7 +561,6 @@ namespace DataHeatBalance { // 2=Plenum Zone, 11=Solar Wall, 12=Roof Pond Real64 UserEnteredFloorArea = Constant::AutoCalculate; // User input floor area for this zone // Calculated after input - Real64 CalcFloorArea = 0.0; // Calculated floor area excluding air boundary surfaces Real64 geometricFloorArea = 0.0; // Calculated floor area including air boundary surfaces Real64 CeilingArea = 0.0; // Ceiling area excluding air boundary surfaces Real64 geometricCeilingArea = 0.0; // Ceiling area area including air boundary surfaces @@ -1761,19 +1735,6 @@ namespace DataHeatBalance { int ConstrNum, // Existing Construction number of first surface bool &ErrorsFound); - void AddVariableSlatBlind(EnergyPlusData &state, - int inBlindNumber, // current Blind Number/pointer to name - int &outBlindNumber, // resultant Blind Number to pass back - bool &errFlag // error flag should one be needed - ); - - void CalcScreenTransmittance(EnergyPlusData &state, - int SurfaceNum, - ObjexxFCL::Optional Phi = _, // Optional sun altitude relative to surface outward normal (radians) - ObjexxFCL::Optional Theta = _, // Optional sun azimuth relative to surface outward normal (radians) - ObjexxFCL::Optional_int_const ScreenNumber = _ // Optional screen number - ); - Real64 ComputeNominalUwithConvCoeffs(EnergyPlusData &state, int numSurf, // index for Surface array. bool &isValid // returns true if result is valid @@ -1830,7 +1791,6 @@ struct HeatBalanceData : BaseGlobalStruct bool AnyKiva = false; // Kiva used bool AnyAirBoundary = false; // Construction:AirBoundary used (implies grouped solar and radiant is present) bool AnyBSDF = false; // True if any WindowModelType == WindowModel:: BSDF - bool AnyVariableAbsorptance = false; // true if any MaterialProperty:VariableAbsorptance is present int MaxNumberOfWarmupDays = 25; // Maximum number of warmup days allowed int MinNumberOfWarmupDays = 1; // Minimum number of warmup days allowed Real64 CondFDRelaxFactor = 1.0; // Relaxation factor, for looping across all the surfaces. @@ -1847,46 +1807,26 @@ struct HeatBalanceData : BaseGlobalStruct Real64 SysTotalHVACReliefHeatLoss = 0.0; // Building total heat emission through HVAC system relief air; Real64 SysTotalHVACRejectHeatLoss = 0.0; // Building total heat emission through HVAC system heat rejection; // END SiteData - int NumOfZoneLists = 0; // Total number of zone lists - int NumOfZoneGroups = 0; // Total number of zone groups - int TotPeople = 0; // Total People instances after expansion to spaces - int TotLights = 0; // Total Lights instances after expansion to spaces - int TotElecEquip = 0; // Total Electric Equipment instances after expansion to spaces - int TotGasEquip = 0; // Total Gas Equipment instances after expansion to spaces - int TotOthEquip = 0; // Total Other Equipment instances after expansion to spaces - int TotHWEquip = 0; // Total Hot Water Equipment instances after expansion to spaces - int TotStmEquip = 0; // Total Steam Equipment instances after expansion to spaces - int TotITEquip = 0; // Total IT Equipment instances after expansion to spaces - int TotInfiltration = 0; // Total Infiltration (all types) instances after expansion to spaces - int TotVentilation = 0; // Total Ventilation (all types) instances after expansion to spaces - int TotMixing = 0; // Total Mixing Statementsn instances after expansion to spaces - int TotCrossMixing = 0; // Total Cross Mixing Statementsn instances after expansion to spaces - int TotRefDoorMixing = 0; // Total RefrigerationDoor Mixing Statements in input - int TotBBHeat = 0; // Total BBHeat Statements instances after expansion to spaces - int TotConstructs = 0; // Total number of unique constructions in this simulation - int TotSpectralData = 0; // Total window glass spectral data sets - int W5GlsMat = 0; // Window5 Glass Materials, specified by transmittance and front and back reflectance - int W5GlsMatAlt = 0; // Window5 Glass Materials, specified by index of refraction and extinction coeff - int W5GasMat = 0; // Window5 Single-Gas Materials - int W5GasMatMixture = 0; // Window5 Gas Mixtures - int W7SupportPillars = 0; // Complex fenestration support pillars - int W7DeflectionStates = 0; // Complex fenestration deflection states - int W7MaterialGaps = 0; // Complex fenestration material gaps - int TotBlinds = 0; // Total number of blind materials - int TotScreens = 0; // Total number of exterior window screen materials - int TotTCGlazings = 0; // Number of TC glazing object - WindowMaterial:Glazing:Thermochromic found in the idf file - int NumScreens = 0; // Total number of screens on exterior windows - int TotShades = 0; // Total number of shade materials - int TotComplexGaps = 0; // Total number of window gaps for complex fenestrations - int TotSimpleWindow = 0; // number of simple window systems. - int W5GlsMatEQL = 0; // Window5 Single-Gas Materials for Equivalent Layer window model - int TotShadesEQL = 0; // Total number of shade materials for Equivalent Layer window model - int TotDrapesEQL = 0; // Total number of drape materials for Equivalent Layer window model - int TotBlindsEQL = 0; // Total number of blind materials for Equivalent Layer window model - int TotScreensEQL = 0; // Total number of exterior window screen materials for Equivalent Layer window model - int W5GapMatEQL = 0; // Window5 Equivalent Layer Single-Gas Materials - int TotZoneAirBalance = 0; // Total Zone Air Balance Statements in input - int TotFrameDivider = 0; // Total number of window frame/divider objects + int NumOfZoneLists = 0; // Total number of zone lists + int NumOfZoneGroups = 0; // Total number of zone groups + int TotPeople = 0; // Total People instances after expansion to spaces + int TotLights = 0; // Total Lights instances after expansion to spaces + int TotElecEquip = 0; // Total Electric Equipment instances after expansion to spaces + int TotGasEquip = 0; // Total Gas Equipment instances after expansion to spaces + int TotOthEquip = 0; // Total Other Equipment instances after expansion to spaces + int TotHWEquip = 0; // Total Hot Water Equipment instances after expansion to spaces + int TotStmEquip = 0; // Total Steam Equipment instances after expansion to spaces + int TotITEquip = 0; // Total IT Equipment instances after expansion to spaces + int TotInfiltration = 0; // Total Infiltration (all types) instances after expansion to spaces + int TotVentilation = 0; // Total Ventilation (all types) instances after expansion to spaces + int TotMixing = 0; // Total Mixing Statementsn instances after expansion to spaces + int TotCrossMixing = 0; // Total Cross Mixing Statementsn instances after expansion to spaces + int TotRefDoorMixing = 0; // Total RefrigerationDoor Mixing Statements in input + int TotBBHeat = 0; // Total BBHeat Statements instances after expansion to spaces + int TotConstructs = 0; // Total number of unique constructions in this simulation + int TotSpectralData = 0; // Total window glass spectral data sets + int TotZoneAirBalance = 0; // Total Zone Air Balance Statements in input + int TotFrameDivider = 0; // Total number of window frame/divider objects bool AirFlowFlag = false; int TotCO2Gen = 0; // Total CO2 source and sink statements in input bool CalcWindowRevealReflection = false; // True if window reveal reflection is to be calculated for at least one exterior window @@ -1981,7 +1921,6 @@ struct HeatBalanceData : BaseGlobalStruct Array1D SurfTempEffBulkAir; // air temperature adjacent to the surface used for inside surface heat balances // Material - Array1D NominalR; // Nominal R value of each material -- used in matching interzone surfaces Array1D NominalRforNominalUCalculation; // Nominal R values are summed to calculate NominalU values for constructions Array1D NominalU; // Nominal U value for each construction -- used in matching interzone surfaces Array1D NominalUBeforeAdjusted; // Nominal U value for glazing system only @@ -2024,9 +1963,6 @@ struct HeatBalanceData : BaseGlobalStruct EPVector ZoneIntGain; EPVector spaceIntGain; EPVector spaceIntGainDevices; - EPVector SupportPillar; - EPVector DeflectionState; - EPVector SpectralData; EPVector space; EPVector spaceList; EPVector Zone; @@ -2058,7 +1994,6 @@ struct HeatBalanceData : BaseGlobalStruct EPVector HeatReclaimSimple_WAHPCoil; EPVector ZnAirRpt; EPVector spaceAirRpt; - EPVector TCGlazings; EPVector ZoneCO2Gen; EPVector ZoneRpt; EPVector spaceRpt; diff --git a/src/EnergyPlus/DataMoistureBalance.hh b/src/EnergyPlus/DataMoistureBalance.hh index 8cce3fd74e2..da72293b4fd 100644 --- a/src/EnergyPlus/DataMoistureBalance.hh +++ b/src/EnergyPlus/DataMoistureBalance.hh @@ -92,7 +92,7 @@ struct MoistureBalanceData : BaseGlobalStruct Array1D HGrndFD; // Ground Convection Coefficient Array1D HAirFD; // Air Convection Coefficient - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataMoistureBalanceEMPD.hh b/src/EnergyPlus/DataMoistureBalanceEMPD.hh index 107bc2964d4..66411f76f34 100644 --- a/src/EnergyPlus/DataMoistureBalanceEMPD.hh +++ b/src/EnergyPlus/DataMoistureBalanceEMPD.hh @@ -76,7 +76,7 @@ struct MoistureBalanceEMPDData : BaseGlobalStruct Array1D RVDeepLayer; Array1D RVwall; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataOutputs.hh b/src/EnergyPlus/DataOutputs.hh index 9308bcb29c0..73e9e96f9f4 100644 --- a/src/EnergyPlus/DataOutputs.hh +++ b/src/EnergyPlus/DataOutputs.hh @@ -112,7 +112,7 @@ struct OutputsData : BaseGlobalStruct Util::case_insensitive_comparator> OutputVariablesForSimulation; - void init_state([[maybe_unused]] EnergyPlusData &state) + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataSizing.cc b/src/EnergyPlus/DataSizing.cc index 66f30fcabfc..c2fadb6cbe1 100644 --- a/src/EnergyPlus/DataSizing.cc +++ b/src/EnergyPlus/DataSizing.cc @@ -762,16 +762,12 @@ Real64 OARequirementsData::calcOAFlowRate(EnergyPlusData &state, Real64 curNumOccupants = 0.0; Real64 maxOccupants = 0.0; if (spaceNum > 0) { - floorArea = state.dataHeatBal->space(spaceNum).FloorArea; - // TODO MJW: For now just proportion space volume by floor area - if (thisZone.FloorArea > 0.0) { - volume = thisZone.Volume * state.dataHeatBal->space(spaceNum).FloorArea / thisZone.FloorArea; - } else { - volume = 0.0; - } - nomTotOccupants = state.dataHeatBal->space(spaceNum).TotOccupants; + auto &thisSpace = state.dataHeatBal->space(spaceNum); + floorArea = thisSpace.FloorArea; + volume = thisSpace.Volume; + nomTotOccupants = thisSpace.TotOccupants; curNumOccupants = state.dataHeatBal->spaceIntGain(spaceNum).NOFOCC; - maxOccupants = state.dataHeatBal->space(spaceNum).maxOccupants; + maxOccupants = thisSpace.maxOccupants; } else { floorArea = thisZone.FloorArea; volume = thisZone.Volume; diff --git a/src/EnergyPlus/DataSurfaces.cc b/src/EnergyPlus/DataSurfaces.cc index 2517ea0271a..77d09bf2bd7 100644 --- a/src/EnergyPlus/DataSurfaces.cc +++ b/src/EnergyPlus/DataSurfaces.cc @@ -730,18 +730,16 @@ Real64 AbsBackSide(EnergyPlusData &state, int SurfNum) void GetVariableAbsorptanceSurfaceList(EnergyPlusData &state) { - if (!state.dataHeatBal->AnyVariableAbsorptance) return; + if (!state.dataMaterial->AnyVariableAbsorptance) return; for (int surfNum : state.dataSurface->AllHTSurfaceList) { auto const &thisSurface = state.dataSurface->Surface(surfNum); - int ConstrNum = thisSurface.Construction; - auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); - int TotLayers = thisConstruct.TotLayers; - if (TotLayers == 0) continue; - int materNum = thisConstruct.LayerPoint(1); - if (materNum == 0) continue; // error finding material number - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(materNum)); - assert(thisMaterial != nullptr); - if (thisMaterial->absorpVarCtrlSignal != Material::VariableAbsCtrlSignal::Invalid) { + auto const &thisConstruct = state.dataConstruction->Construct(thisSurface.Construction); + if (thisConstruct.TotLayers == 0) continue; + if (thisConstruct.LayerPoint(1) == 0) continue; // error finding material number + auto const *mat = state.dataMaterial->materials(thisConstruct.LayerPoint(1)); + if (mat->group != Material::Group::Regular) continue; + + if (mat->absorpVarCtrlSignal != Material::VariableAbsCtrlSignal::Invalid) { // check for dynamic coating defined on interior surface if (thisSurface.ExtBoundCond != ExternalEnvironment) { ShowWarningError(state, @@ -757,16 +755,17 @@ void GetVariableAbsorptanceSurfaceList(EnergyPlusData &state) for (int ConstrNum = 1; ConstrNum <= state.dataHeatBal->TotConstructs; ++ConstrNum) { auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); for (int Layer = 2; Layer <= thisConstruct.TotLayers; ++Layer) { - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(Layer))); - if (thisMaterial->absorpVarCtrlSignal != Material::VariableAbsCtrlSignal::Invalid) { + auto const *mat = state.dataMaterial->materials(thisConstruct.LayerPoint(Layer)); + if (mat->group != Material::Group::Regular) continue; + if (mat->absorpVarCtrlSignal != Material::VariableAbsCtrlSignal::Invalid) { ShowWarningError(state, format("MaterialProperty:VariableAbsorptance defined on a inside-layer materials, {}. This VariableAbsorptance " "property will be ignored here", - thisMaterial->Name)); + mat->Name)); } } } -} +} // GetVariableAbsorptanceSurfaceList() Compass4 AzimuthToCompass4(Real64 azimuth) { diff --git a/src/EnergyPlus/DataSurfaces.hh b/src/EnergyPlus/DataSurfaces.hh index f0857020e6d..c1c96b5beb2 100644 --- a/src/EnergyPlus/DataSurfaces.hh +++ b/src/EnergyPlus/DataSurfaces.hh @@ -905,7 +905,7 @@ namespace DataSurfaces { Real64 edgeGlassCorrFac = 1.0; // Correction factor to center-of-glass conductance to account for 2-D glass conduction thermal bridging // effects near frame and divider - int screenNum = 0; // Screen number for a window with a screen (do not confuse with material number) + int screenNum = 0; // Screen material number for a window with a screen Real64 lightWellEff = 1.0; // Light well efficiency (multiplier on exterior window vis trans due to light well losses) // What is 10 here? @@ -917,8 +917,6 @@ namespace DataSurfaces { // Multiplier on sunlit fraction due to shadowing of glass by // frame and divider inside and outside projections std::array InOutProjSLFracMult = {1.0}; - std::array EffShBlindEmiss = {0.0}; // Effective emissivity of interior blind or shade - std::array EffGlassEmiss = {0.0}; // Effective emissivity of glass adjacent to interior blind or shade // for shadowing of ground by building and obstructions [W/m2] // Enclosure inside surface area minus this surface and its @@ -930,6 +928,45 @@ namespace DataSurfaces { std::array EnclAreaReflProdMinusThisSurf = {0.0, 0.0, 0.0}; BSDFWindowDescript ComplexFen; // Data for complex fenestration, see DataBSDFWindow.cc for declaration + bool hasShade = false; + bool hasBlind = false; + bool hasScreen = false; + }; + + struct SurfaceShade + { + struct + { + int matNum = 0; + bool movableSlats = false; // True if window has a blind with movable slats + Real64 slatAng = 0.0; // Slat angle this time step for window with blind on (radians) + Real64 slatAngDeg = 0.0; // Slat angle this time step for window with blind on (deg) + bool slatAngDegEMSon = false; // flag that indicate EMS system is actuating SlatAngThisTSDeg + Real64 slatAngDegEMSValue = 0.0; // value that EMS sets for slat angle in degrees + bool slatBlockBeam = false; // True if blind slats block incident beam solar + int slatAngIdxLo = -1; + int slatAngIdxHi = -1; + Real64 slatAngInterpFac = 0.0; + Real64 profAng = 0.0; + int profAngIdxLo = 0; + int profAngIdxHi = 0; + Real64 profAngInterpFac = 0.0; + Real64 bmBmTrans = 0.0; + Real64 airFlowPermeability = 0.0; // Blind air-flow permeability for calculation of convective flow in gap between blind and glass + + // Properties are profile-angle dependent + Material::BlindTraAbsRef TAR; + } blind; + + // Save these from the glass in case we need to recalculate blind properties + struct + { + Real64 epsIR = 0.0; + Real64 rhoIR = 0.0; + } glass; + + Real64 effShadeEmi = 0.0; // Effective emissivity of interior blind or shade + Real64 effGlassEmi = 0.0; // Effective emissivity of glass adjacent to interior blind or shade }; struct SurfaceWindowFrameDiv @@ -1735,30 +1772,16 @@ struct SurfacesData : BaseGlobalStruct Array1D SurfWinConvCoeffWithShade; // Convection coefficient from glass or shade to gap air when interior // or exterior shade is present (W/m2-K) Array1D SurfWinOtherConvHeatGain; // other convective = total conv - standard model prediction for EQL window model (W) - Array1D SurfWinBlindNumber; // Blind number for a window with a blind Array1D SurfWinEffInsSurfTemp; // Effective inside surface temperature for window with interior blind or shade; combination of shade/blind // and glass temperatures (C) - Array1D SurfWinMovableSlats; // True if window has a blind with movable slats - Array1D SurfWinSlatAngThisTS; // Slat angle this time step for window with blind on (radians) - Array1D SurfWinSlatAngThisTSDeg; // Slat angle this time step for window with blind on (deg) - Array1D SurfWinSlatAngThisTSDegEMSon; // flag that indicate EMS system is actuating SlatAngThisTSDeg - Array1D SurfWinSlatAngThisTSDegEMSValue; // value that EMS sets for slat angle in degrees - Array1D SurfWinSlatsBlockBeam; // True if blind slats block incident beam solar - Array1D SurfWinSlatsAngIndex; - Array1D SurfWinSlatsAngInterpFac; - Array1D SurfWinProfileAng; - Array1D SurfWinProfAngIndex; - Array1D SurfWinProfAngInterpFac; - Array1D SurfWinBlindBmBmTrans; - Array1D SurfWinBlindAirFlowPermeability; // Blind air-flow permeability for calculation of convective flow in gap between blind and glass - Array1D SurfWinTotGlazingThickness; // Total glazing thickness from outside of outer glass to inside of inner glass (m) - Array1D SurfWinTanProfileAngHor; // Tangent of horizontal profile angle - Array1D SurfWinTanProfileAngVert; // Tangent of vertical profile angle - Array1D SurfWinInsideSillDepth; // Depth of inside sill (m) - Array1D SurfWinInsideReveal; // Depth of inside reveal (m) - Array1D SurfWinInsideSillSolAbs; // Solar absorptance of inside sill - Array1D SurfWinInsideRevealSolAbs; // Solar absorptance of inside reveal - Array1D SurfWinOutsideRevealSolAbs; // Solar absorptance of outside reveal + Array1D SurfWinTotGlazingThickness; // Total glazing thickness from outside of outer glass to inside of inner glass (m) + Array1D SurfWinTanProfileAngHor; // Tangent of horizontal profile angle + Array1D SurfWinTanProfileAngVert; // Tangent of vertical profile angle + Array1D SurfWinInsideSillDepth; // Depth of inside sill (m) + Array1D SurfWinInsideReveal; // Depth of inside reveal (m) + Array1D SurfWinInsideSillSolAbs; // Solar absorptance of inside sill + Array1D SurfWinInsideRevealSolAbs; // Solar absorptance of inside reveal + Array1D SurfWinOutsideRevealSolAbs; // Solar absorptance of outside reveal Array1D SurfWinAirflowSource; // Source of gap airflow (INSIDEAIR, OUTSIDEAIR, etc.) Array1D SurfWinAirflowDestination; // Destination of gap airflow (INSIDEAIR, OUTSIDEAIR, etc.) Array1D SurfWinAirflowReturnNodePtr; // Return node pointer for destination = ReturnAir @@ -1790,6 +1813,7 @@ struct SurfacesData : BaseGlobalStruct EPVector Surface; EPVector SurfaceWindow; + EPVector surfShades; Array1D FrameDivider; EPVector StormWindow; EPVector WindowShadingControl; @@ -1806,8 +1830,6 @@ struct SurfacesData : BaseGlobalStruct EPVector IntMassObjects; EPVector GroundSurfsProperty; - int actualMaxSlatAngs = Material::MaxSlatAngs; // If there are no blinds in the model, then this is changed to 1 (used for shades) - void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataWindowEquivalentLayer.hh b/src/EnergyPlus/DataWindowEquivalentLayer.hh index de20f77972a..3a245c1691b 100644 --- a/src/EnergyPlus/DataWindowEquivalentLayer.hh +++ b/src/EnergyPlus/DataWindowEquivalentLayer.hh @@ -108,6 +108,9 @@ namespace DataWindowEquivalentLayer { Num }; + static constexpr std::array orientationNames = {"Horizontal", "Vertical"}; + static constexpr std::array orientationNamesUC = {"HORIZONTAL", "VERTICAL"}; + enum class AngleType { Invalid = -1, diff --git a/src/EnergyPlus/DataZoneEquipment.cc b/src/EnergyPlus/DataZoneEquipment.cc index 869dfd51857..64a59f8158b 100644 --- a/src/EnergyPlus/DataZoneEquipment.cc +++ b/src/EnergyPlus/DataZoneEquipment.cc @@ -126,10 +126,13 @@ constexpr std::array(ZoneEquipType::Num)> zon "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:WATER", // BaseboardWater "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:ELECTRIC", // BaseboardElectric "ZONEHVAC:HIGHTEMPERATURERADIANT", // HighTempRadiant - "ZONEHVAC:LOWTEMPERATURERADIANT:VARIABLEFLOW", // LowTempRadiant + "ZONEHVAC:LOWTEMPERATURERADIANT:CONSTANTFLOW", // LowTempRadiantConstFlow + "ZONEHVAC:LOWTEMPERATURERADIANT:VARIABLEFLOW", // LowTempRadiantVarFlow + "ZONEHVAC:LOWTEMPERATURERADIANT:ELECTRIC", // LowTempRadiantElectric "FAN:ZONEEXHAUST", // ExhaustFan "HEATEXCHANGER:AIRTOAIR:FLATPLATE", // HeatExchanger - "WATERHEATER:HEATPUMP:PUMPEDCONDENSER", // HeatPumpWaterHeater + "WATERHEATER:HEATPUMP:PUMPEDCONDENSER", // HeatPumpWaterHeaterPumpedCondenser + "WATERHEATER:HEATPUMP:WRAPPEDCONDENSER", // HeatPumpWaterHeaterWrappedCondenser "ZONEHVAC:DEHUMIDIFIER:DX", // DXDehumidifier "ZONEHVAC:REFRIGERATIONCHILLERSET", // RefrigerationAirChillerSet "ZONEHVAC:FORCEDAIR:USERDEFINED", // UserDefinedVACForcedAir @@ -984,16 +987,9 @@ void processZoneEquipmentInput(EnergyPlusData &state, } if (thisZoneEquipList.EquipType(ZoneEquipTypeNum) == ZoneEquipType::Invalid) { - if (thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "ZONEHVAC:LOWTEMPERATURERADIANT:CONSTANTFLOW" || - thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "ZONEHVAC:LOWTEMPERATURERADIANT:ELECTRIC") { - thisZoneEquipList.EquipType(ZoneEquipTypeNum) = ZoneEquipType::LowTemperatureRadiant; - } else if (thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "WATERHEATER:HEATPUMP:WRAPPEDCONDENSER") { - thisZoneEquipList.EquipType(ZoneEquipTypeNum) = DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater; - } else { - ShowSevereError(state, format("{}{} = {}", RoutineName, CurrentModuleObject, thisZoneEquipList.Name)); - ShowContinueError(state, format("..Invalid Equipment Type = {}", thisZoneEquipList.EquipType(ZoneEquipTypeNum))); - state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true; - } + ShowSevereError(state, format("{}{} = {}", RoutineName, CurrentModuleObject, thisZoneEquipList.Name)); + ShowContinueError(state, format("..Invalid Equipment Type = {}", thisZoneEquipList.EquipType(ZoneEquipTypeNum))); + state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true; } } } // End parsing all extensible Zone Equipment info @@ -1216,17 +1212,10 @@ void processZoneEquipSplitterInput(EnergyPlusData &state, auto &ip = state.dataInputProcessing->inputProcessor; std::string const zeqTypeName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "zone_equipment_object_type"); thisZeqSplitter.zoneEquipType = DataZoneEquipment::ZoneEquipType(getEnumValue(zoneEquipTypeNamesUC, zeqTypeName)); - // SpaceHVAC TODO: Copied this block from processZoneEquipmentInput section for ZoneHVAC:EquipmentList - seems this could be simplified if (thisZeqSplitter.zoneEquipType == ZoneEquipType::Invalid) { - if (zeqTypeName == "ZONEHVAC:LOWTEMPERATURERADIANT:CONSTANTFLOW" || zeqTypeName == "ZONEHVAC:LOWTEMPERATURERADIANT:ELECTRIC") { - thisZeqSplitter.zoneEquipType = ZoneEquipType::LowTemperatureRadiant; - } else if (zeqTypeName == "WATERHEATER:HEATPUMP:WRAPPEDCONDENSER") { - thisZeqSplitter.zoneEquipType = DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater; - } else { - ShowSevereError(state, format("{}{} = {}", RoutineName, zeqSplitterModuleObject, thisZeqSplitter.Name)); - ShowContinueError(state, format("..Invalid Equipment Type = {}", zeqTypeName)); - state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true; - } + ShowSevereError(state, format("{}{} = {}", RoutineName, zeqSplitterModuleObject, thisZeqSplitter.Name)); + ShowContinueError(state, format("..Invalid Equipment Type = {}", zeqTypeName)); + state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true; } thisZeqSplitter.zoneEquipName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "zone_equipment_name"); @@ -1867,11 +1856,9 @@ void ZoneEquipmentSplitterMixer::size(EnergyPlusData &state) } break; case DataZoneEquipment::SpaceEquipSizingBasis::PerimeterLength: - ShowFatalError(state, - format("ZoneEquipmentSplitterMixer::size: Space Fraction Method={} not supported for {}={}", - DataZoneEquipment::spaceEquipSizingBasisNamesUC[(int)this->spaceSizingBasis], - BranchNodeConnections::ConnectionObjectTypeNames[(int)this->spaceEquipType], - this->Name)); + for (auto &thisSpace : this->spaces) { + spacesTotal += state.dataHeatBal->space(thisSpace.spaceIndex).extPerimeter; + } break; default: // If method is not set, then return @@ -1890,43 +1877,41 @@ void ZoneEquipmentSplitterMixer::size(EnergyPlusData &state) for (auto &thisSpace : this->spaces) { thisSpace.fraction = spaceFrac; } - return; + } else { + // Calculate space fractions + for (auto &thisSpace : this->spaces) { + if (thisSpace.fraction == DataSizing::AutoSize) { + switch (this->spaceSizingBasis) { + case DataZoneEquipment::SpaceEquipSizingBasis::DesignCoolingLoad: + thisSpace.fraction = state.dataSize->FinalSpaceSizing(thisSpace.spaceIndex).DesCoolLoad / spacesTotal; + break; + case DataZoneEquipment::SpaceEquipSizingBasis::DesignHeatingLoad: + thisSpace.fraction = state.dataSize->FinalSpaceSizing(thisSpace.spaceIndex).DesHeatLoad / spacesTotal; + break; + case DataZoneEquipment::SpaceEquipSizingBasis::FloorArea: + thisSpace.fraction = state.dataHeatBal->space(thisSpace.spaceIndex).FloorArea / spacesTotal; + break; + case DataZoneEquipment::SpaceEquipSizingBasis::Volume: + thisSpace.fraction = state.dataHeatBal->space(thisSpace.spaceIndex).Volume / spacesTotal; + break; + case DataZoneEquipment::SpaceEquipSizingBasis::PerimeterLength: + thisSpace.fraction = state.dataHeatBal->space(thisSpace.spaceIndex).extPerimeter / spacesTotal; + break; + default: + break; + } + } + } } - - // Calculate space fractions + // Report sizing results int spaceCounter = 0; for (auto &thisSpace : this->spaces) { ++spaceCounter; - if (thisSpace.fraction == DataSizing::AutoSize) { - switch (this->spaceSizingBasis) { - case DataZoneEquipment::SpaceEquipSizingBasis::DesignCoolingLoad: - thisSpace.fraction = state.dataSize->FinalSpaceSizing(thisSpace.spaceIndex).DesCoolLoad / spacesTotal; - break; - case DataZoneEquipment::SpaceEquipSizingBasis::DesignHeatingLoad: - thisSpace.fraction = state.dataSize->FinalSpaceSizing(thisSpace.spaceIndex).DesHeatLoad / spacesTotal; - break; - case DataZoneEquipment::SpaceEquipSizingBasis::FloorArea: - thisSpace.fraction = state.dataHeatBal->space(thisSpace.spaceIndex).FloorArea / spacesTotal; - break; - case DataZoneEquipment::SpaceEquipSizingBasis::Volume: - thisSpace.fraction = state.dataHeatBal->space(thisSpace.spaceIndex).Volume / spacesTotal; - break; - case DataZoneEquipment::SpaceEquipSizingBasis::PerimeterLength: - ShowFatalError(state, - format("ZoneEquipmentSplitterMixer::size: Space Fraction Method={} not supported for {}={}", - DataZoneEquipment::spaceEquipSizingBasisNamesUC[(int)this->spaceSizingBasis], - BranchNodeConnections::ConnectionObjectTypeNames[(int)this->spaceEquipType], - this->Name)); - break; - default: - break; - } - BaseSizer::reportSizerOutput(state, - BranchNodeConnections::ConnectionObjectTypeNames[(int)this->spaceEquipType], - this->Name, - format("Space {} Fraction", spaceCounter), - thisSpace.fraction); - } + BaseSizer::reportSizerOutput(state, + BranchNodeConnections::ConnectionObjectTypeNames[(int)this->spaceEquipType], + this->Name, + format("Space {} Fraction", spaceCounter), + thisSpace.fraction); } } diff --git a/src/EnergyPlus/DataZoneEquipment.hh b/src/EnergyPlus/DataZoneEquipment.hh index 008be07c127..282de4e6652 100644 --- a/src/EnergyPlus/DataZoneEquipment.hh +++ b/src/EnergyPlus/DataZoneEquipment.hh @@ -135,10 +135,13 @@ namespace DataZoneEquipment { BaseboardWater, BaseboardElectric, HighTemperatureRadiant, - LowTemperatureRadiant, + LowTemperatureRadiantConstFlow, + LowTemperatureRadiantVarFlow, + LowTemperatureRadiantElectric, ExhaustFan, HeatExchanger, - HeatPumpWaterHeater, + HeatPumpWaterHeaterPumpedCondenser, + HeatPumpWaterHeaterWrappedCondenser, DehumidifierDX, RefrigerationChillerSet, UserDefinedHVACForcedAir, @@ -282,8 +285,9 @@ namespace DataZoneEquipment { int InNode; // Air distribution unit inlet node int OutNode; // Air distribution unit Outlet node bool SupplyAirPathExists; - int MainBranchIndex; - int SupplyBranchIndex; + int AirLoopNum = 0; // airloop number serving this ADU + int MainBranchIndex; // airloop branch index (not the actual branch index) + int SupplyBranchIndex; // airloop branch index (not the actual branch index) int AirDistUnitIndex; // equipment number in EquipList int TermUnitSizingIndex; // Pointer to TermUnitSizing and TermUnitFinalZoneSizing data for this terminal unit int SupplyAirPathIndex; // Pointer to SupplyAirPath serving this terminal unit diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index 003445caa9e..7ae0f6da916 100644 --- a/src/EnergyPlus/DaylightingManager.cc +++ b/src/EnergyPlus/DaylightingManager.cc @@ -172,6 +172,7 @@ void DayltgAveInteriorReflectance(EnergyPlusData &state, int const enclNum) // E // REFERENCES: // Based on DOE-2.1E subroutine DAVREF auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; // Total inside surface area, including windows Real64 AInsTot = 0.0; @@ -185,7 +186,7 @@ void DayltgAveInteriorReflectance(EnergyPlusData &state, int const enclNum) // E auto &thisEnclosure = state.dataViewFactor->EnclSolInfo(enclNum); for (int ISurf : thisEnclosure.SurfacePtr) { - auto const &surf = state.dataSurface->Surface(ISurf); + auto const &surf = s_surf->Surface(ISurf); SurfaceClass IType = surf.Class; // Error if window has multiplier > 1 since this causes incorrect illuminance calc @@ -204,24 +205,22 @@ void DayltgAveInteriorReflectance(EnergyPlusData &state, int const enclNum) // E IType == SurfaceClass::Door) { Real64 AREA = surf.Area; // In following, FrameArea and DividerArea can be non-zero only for exterior windows - AInsTot += AREA + state.dataSurface->SurfWinFrameArea(ISurf) * (1.0 + 0.5 * state.dataSurface->SurfWinProjCorrFrIn(ISurf)) + - state.dataSurface->SurfWinDividerArea(ISurf) * (1.0 + state.dataSurface->SurfWinProjCorrDivIn(ISurf)); - ARHTOT += AREA * state.dataConstruction->Construct(surf.Construction).ReflectVisDiffBack + - state.dataSurface->SurfWinFrameArea(ISurf) * (1.0 + 0.5 * state.dataSurface->SurfWinProjCorrFrIn(ISurf)) * - (1.0 - state.dataSurface->SurfWinFrameSolAbsorp(ISurf)) + - state.dataSurface->SurfWinDividerArea(ISurf) * (1.0 + state.dataSurface->SurfWinProjCorrDivIn(ISurf)) * - (1.0 - state.dataSurface->SurfWinDividerSolAbsorp(ISurf)); + AInsTot += AREA + s_surf->SurfWinFrameArea(ISurf) * (1.0 + 0.5 * s_surf->SurfWinProjCorrFrIn(ISurf)) + + s_surf->SurfWinDividerArea(ISurf) * (1.0 + s_surf->SurfWinProjCorrDivIn(ISurf)); + ARHTOT += + AREA * state.dataConstruction->Construct(surf.Construction).ReflectVisDiffBack + + s_surf->SurfWinFrameArea(ISurf) * (1.0 + 0.5 * s_surf->SurfWinProjCorrFrIn(ISurf)) * (1.0 - s_surf->SurfWinFrameSolAbsorp(ISurf)) + + s_surf->SurfWinDividerArea(ISurf) * (1.0 + s_surf->SurfWinProjCorrDivIn(ISurf)) * (1.0 - s_surf->SurfWinDividerSolAbsorp(ISurf)); FWC fwc = FWC::Ceiling; // Ceiling if (surf.Tilt > 10.0 && surf.Tilt < 170.0) fwc = FWC::Wall; // Wall if (surf.Tilt >= 170.0) fwc = FWC::Floor; // Floor - AR[(int)fwc] += AREA + state.dataSurface->SurfWinFrameArea(ISurf) * (1.0 + 0.5 * state.dataSurface->SurfWinProjCorrFrIn(ISurf)) + - state.dataSurface->SurfWinDividerArea(ISurf) * (1.0 + state.dataSurface->SurfWinProjCorrDivIn(ISurf)); - ARH[(int)fwc] += AREA * state.dataConstruction->Construct(surf.Construction).ReflectVisDiffBack + - state.dataSurface->SurfWinFrameArea(ISurf) * (1.0 + 0.5 * state.dataSurface->SurfWinProjCorrFrIn(ISurf)) * - (1.0 - state.dataSurface->SurfWinFrameSolAbsorp(ISurf)) + - state.dataSurface->SurfWinDividerArea(ISurf) * (1.0 + state.dataSurface->SurfWinProjCorrDivIn(ISurf)) * - (1.0 - state.dataSurface->SurfWinDividerSolAbsorp(ISurf)); + AR[(int)fwc] += AREA + s_surf->SurfWinFrameArea(ISurf) * (1.0 + 0.5 * s_surf->SurfWinProjCorrFrIn(ISurf)) + + s_surf->SurfWinDividerArea(ISurf) * (1.0 + s_surf->SurfWinProjCorrDivIn(ISurf)); + ARH[(int)fwc] += + AREA * state.dataConstruction->Construct(surf.Construction).ReflectVisDiffBack + + s_surf->SurfWinFrameArea(ISurf) * (1.0 + 0.5 * s_surf->SurfWinProjCorrFrIn(ISurf)) * (1.0 - s_surf->SurfWinFrameSolAbsorp(ISurf)) + + s_surf->SurfWinDividerArea(ISurf) * (1.0 + s_surf->SurfWinProjCorrDivIn(ISurf)) * (1.0 - s_surf->SurfWinDividerSolAbsorp(ISurf)); } } @@ -237,7 +236,7 @@ void DayltgAveInteriorReflectance(EnergyPlusData &state, int const enclNum) // E dl->enclDaylight(enclNum).floorVisRefl = ARH[iFWC_Ceiling] / (AR[iFWC_Ceiling] + 1.e-6); for (int ISurf : thisEnclosure.SurfacePtr) { - auto const &surf = state.dataSurface->Surface(ISurf); + auto const &surf = s_surf->Surface(ISurf); if (surf.Class != SurfaceClass::Wall && surf.Class != SurfaceClass::Floor && surf.Class != SurfaceClass::Roof) continue; // Remove this surface from the space inside surface area and area*reflectivity @@ -251,16 +250,15 @@ void DayltgAveInteriorReflectance(EnergyPlusData &state, int const enclNum) // E // Loop over windows and doors on this wall for (int IWinDr : thisEnclosure.SurfacePtr) { - auto const &surfWinDr = state.dataSurface->Surface(IWinDr); + auto const &surfWinDr = s_surf->Surface(IWinDr); if ((surfWinDr.Class != SurfaceClass::Window && surfWinDr.Class != SurfaceClass::Door) || surfWinDr.BaseSurf != ISurf) continue; - ATWL += surfWinDr.Area + state.dataSurface->SurfWinFrameArea(IWinDr) * (1.0 + 0.5 * state.dataSurface->SurfWinProjCorrFrIn(IWinDr)) + - state.dataSurface->SurfWinDividerArea(IWinDr) * (1.0 + state.dataSurface->SurfWinProjCorrDivIn(IWinDr)); - ARHTWL += surfWinDr.Area * state.dataConstruction->Construct(surfWinDr.Construction).ReflectVisDiffBack + - state.dataSurface->SurfWinFrameArea(IWinDr) * (1.0 + 0.5 * state.dataSurface->SurfWinProjCorrFrIn(IWinDr)) * - (1.0 - state.dataSurface->SurfWinFrameSolAbsorp(IWinDr)) + - state.dataSurface->SurfWinDividerArea(IWinDr) * (1.0 + state.dataSurface->SurfWinProjCorrDivIn(IWinDr)) * - (1.0 - state.dataSurface->SurfWinDividerSolAbsorp(IWinDr)); + ATWL += surfWinDr.Area + s_surf->SurfWinFrameArea(IWinDr) * (1.0 + 0.5 * s_surf->SurfWinProjCorrFrIn(IWinDr)) + + s_surf->SurfWinDividerArea(IWinDr) * (1.0 + s_surf->SurfWinProjCorrDivIn(IWinDr)); + ARHTWL += + surfWinDr.Area * state.dataConstruction->Construct(surfWinDr.Construction).ReflectVisDiffBack + + s_surf->SurfWinFrameArea(IWinDr) * (1.0 + 0.5 * s_surf->SurfWinProjCorrFrIn(IWinDr)) * (1.0 - s_surf->SurfWinFrameSolAbsorp(IWinDr)) + + s_surf->SurfWinDividerArea(IWinDr) * (1.0 + s_surf->SurfWinProjCorrDivIn(IWinDr)) * (1.0 - s_surf->SurfWinDividerSolAbsorp(IWinDr)); } std::array AP; @@ -275,23 +273,23 @@ void DayltgAveInteriorReflectance(EnergyPlusData &state, int const enclNum) // E ARHP[iFWC] = ARH[iFWC]; } } - state.dataSurface->SurfaceWindow(ISurf).EnclAreaMinusThisSurf = AP; - state.dataSurface->SurfaceWindow(ISurf).EnclAreaReflProdMinusThisSurf = ARHP; + s_surf->SurfaceWindow(ISurf).EnclAreaMinusThisSurf = AP; + s_surf->SurfaceWindow(ISurf).EnclAreaReflProdMinusThisSurf = ARHP; } // for (ISurf) for (int IWin : thisEnclosure.SurfacePtr) { - auto const &surf = state.dataSurface->Surface(IWin); + auto const &surf = s_surf->Surface(IWin); if (surf.Class != SurfaceClass::Window) continue; - auto &surfWin = state.dataSurface->SurfaceWindow(IWin); + auto &surfWin = s_surf->SurfaceWindow(IWin); auto const &zone = state.dataHeatBal->Zone(surf.Zone); int ISurf = surf.BaseSurf; // Ratio of floor-to-window-center height and average floor-to-ceiling height Real64 ETA = max(0.0, min(1.0, (surfWin.WinCenter.z - zone.OriginZ) * zone.FloorArea / zone.Volume)); - std::array AP = state.dataSurface->SurfaceWindow(ISurf).EnclAreaMinusThisSurf; - std::array ARHP = state.dataSurface->SurfaceWindow(ISurf).EnclAreaReflProdMinusThisSurf; + std::array AP = s_surf->SurfaceWindow(ISurf).EnclAreaMinusThisSurf; + std::array ARHP = s_surf->SurfaceWindow(ISurf).EnclAreaReflProdMinusThisSurf; // Average reflectance seen by light moving up (RhoCeilingWall) and down (RhoFloorWall) // across horizontal plane through center of window surfWin.rhoCeilingWall = (ARHP[iFWC_Wall] * (1.0 - ETA) + ARHP[iFWC_Ceiling]) / (AP[iFWC_Wall] * (1.0 - ETA) + AP[iFWC_Ceiling] + 1.0e-5); @@ -303,8 +301,8 @@ void DayltgAveInteriorReflectance(EnergyPlusData &state, int const enclNum) // E surfWin.fractionUpgoing = surf.Tilt / 180.0; // Daylighting shelf simplification: All light goes up to the ceiling regardless of orientation of shelf - if (state.dataSurface->SurfDaylightingShelfInd(IWin) > 0) { - if (state.dataDaylightingDevicesData->Shelf(state.dataSurface->SurfDaylightingShelfInd(IWin)).InSurf > 0) surfWin.fractionUpgoing = 1.0; + if (s_surf->SurfDaylightingShelfInd(IWin) > 0) { + if (state.dataDaylightingDevicesData->Shelf(s_surf->SurfDaylightingShelfInd(IWin)).InSurf > 0) surfWin.fractionUpgoing = 1.0; } } // for (IWin) } // DayltgAveInteriorReflectance() @@ -379,6 +377,7 @@ void CalcDayltgCoefficients(EnergyPlusData &state) // Based on DOE-2.1E subroutine DCOF. auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; if (dl->CalcDayltghCoefficients_firstTime) { GetDaylightingParametersInput(state); @@ -467,7 +466,7 @@ void CalcDayltgCoefficients(EnergyPlusData &state) dl->sunAnglesHr = {SunAngles()}; dl->horIllum = {Illums()}; for (int IHR = 1; IHR <= Constant::HoursInDay; ++IHR) { - auto const &surfSunCosHr = state.dataSurface->SurfSunCosHourly(IHR); + auto const &surfSunCosHr = s_surf->SurfSunCosHourly(IHR); if (surfSunCosHr.z < DataEnvironment::SunIsUpValue) continue; // Skip if sun is below horizon //Autodesk SurfSunCosHourly was uninitialized here @@ -481,7 +480,7 @@ void CalcDayltgCoefficients(EnergyPlusData &state) } else { // timestep integrated calculations dl->sunAngles = dl->sunAnglesHr[state.dataGlobal->HourOfDay] = {SunAngles()}; dl->horIllum[state.dataGlobal->HourOfDay] = Illums(); - auto const &surfSunCosHr = state.dataSurface->SurfSunCosHourly(state.dataGlobal->HourOfDay); + auto const &surfSunCosHr = s_surf->SurfSunCosHourly(state.dataGlobal->HourOfDay); if (!(surfSunCosHr.z < DataEnvironment::SunIsUpValue)) { // Skip if sun is below horizon Real64 phi = Constant::PiOvr2 - std::acos(surfSunCosHr.z); Real64 theta = std::atan2(surfSunCosHr.y, surfSunCosHr.x); @@ -511,7 +510,7 @@ void CalcDayltgCoefficients(EnergyPlusData &state) int windowSurfNum = thisEnclDaylight.DayltgExtWinSurfNums(windowCounter); // For this report, do not include ext wins in zone adjacent to ZoneNum since the inter-reflected // component will not be calculated for these windows until the time-step loop. - if (state.dataSurface->Surface(windowSurfNum).SolarEnclIndex != enclNum) continue; + if (s_surf->Surface(windowSurfNum).SolarEnclIndex != enclNum) continue; // Output for each reference point, for each sky. Group by sky type first static constexpr std::array skyTypeStrings = { @@ -519,14 +518,14 @@ void CalcDayltgCoefficients(EnergyPlusData &state) for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { for (int refPtNum = 1; refPtNum <= thisDayltgCtrl.TotalDaylRefPoints; ++refPtNum) { - Real64 DaylFac = thisDayltgCtrl.daylFac[12](windowCounter, refPtNum, 1)[iLum_Illum].sky[iSky]; + Real64 DaylFac = thisDayltgCtrl.daylFac[12](windowCounter, refPtNum)[iWinCover_Bare][iLum_Illum].sky[iSky]; print(state.files.eio, " Sky Daylight Factors,{},{},{},{},{},{},{:.4R}\n", skyTypeStrings[iSky], state.dataEnvrn->CurMnDy, thisDayltgCtrl.Name, state.dataViewFactor->EnclSolInfo(thisDayltgCtrl.enclIndex).Name, - state.dataSurface->Surface(windowSurfNum).Name, + s_surf->Surface(windowSurfNum).Name, dl->DaylRefPt(thisDayltgCtrl.refPts(refPtNum).num).Name, DaylFac); } // for (refPtNum) @@ -578,58 +577,38 @@ void CalcDayltgCoefficients(EnergyPlusData &state) for (int windowCounter = 1; windowCounter <= thisEnclDaylight.NumOfDayltgExtWins; ++windowCounter) { int windowSurfNum = thisEnclDaylight.DayltgExtWinSurfNums(windowCounter); - + auto &surf = s_surf->Surface(windowSurfNum); // For this report, do not include ext wins in zone/enclosure adjacent to ZoneNum since the inter-reflected // component will not be calculated for these windows until the time-step loop. - if (state.dataSurface->Surface(windowSurfNum).SolarEnclIndex == enclNum) { - - int ISA; - if (state.dataSurface->SurfWinMovableSlats(windowSurfNum)) { - // variable slat angle - MaxSlatangle sets - ISA = Material::MaxSlatAngs + 1; - } else if (state.dataSurface->Surface(windowSurfNum).HasShadeControl) { - // window shade or blind with fixed slat angle - ISA = 2; - } else { - // base window - ISA = 1; - } + if (surf.SolarEnclIndex == enclNum) { + + int numWinCover = surf.HasShadeControl ? (int)WinCover::Num : 1; // loop over each slat angle - for (int ISlatAngle = 1; ISlatAngle <= ISA; ++ISlatAngle) { - if (ISlatAngle == 1) { + for (int iWinCover = 0; iWinCover < numWinCover; ++iWinCover) { + if (iWinCover == iWinCover_Bare) { // base window without shades, screens, or blinds print(state.files.dfs, "{},{},{},{},Base Window\n", state.dataEnvrn->CurMnDy, state.dataViewFactor->EnclSolInfo(enclNum).Name, state.dataHeatBal->Zone(thisDayltgCtrl.zoneIndex).Name, - state.dataSurface->Surface(windowSurfNum).Name); - } else if (ISlatAngle == 2 && ISA == 2) { + s_surf->Surface(windowSurfNum).Name); + } else if (iWinCover == iWinCover_Shaded) { // window shade or blind with fixed slat angle print(state.files.dfs, "{},{},{},{},Blind or Slat Applied\n", state.dataEnvrn->CurMnDy, state.dataViewFactor->EnclSolInfo(enclNum).Name, state.dataHeatBal->Zone(thisDayltgCtrl.zoneIndex).Name, - state.dataSurface->Surface(windowSurfNum).Name); - } else { - // blind with variable slat angle - Real64 SlatAngle = 180.0 / double(Material::MaxSlatAngs - 1) * double(ISlatAngle - 2); - print(state.files.dfs, - "{},{},{},{},{:.1R}\n", - state.dataEnvrn->CurMnDy, - state.dataViewFactor->EnclSolInfo(enclNum).Name, - state.dataHeatBal->Zone(thisDayltgCtrl.zoneIndex).Name, - state.dataSurface->Surface(windowSurfNum).Name, - SlatAngle); + s_surf->Surface(windowSurfNum).Name); } for (int IHR = 1; IHR <= Constant::HoursInDay; ++IHR) { // For each Daylight Reference Point auto &daylFacHr = thisDayltgCtrl.daylFac[IHR]; for (int refPtNum = 1; refPtNum <= thisDayltgCtrl.TotalDaylRefPoints; ++refPtNum) { - auto &illums = daylFacHr(windowCounter, refPtNum, ISlatAngle)[iLum_Illum]; + auto &illums = daylFacHr(windowCounter, refPtNum)[iWinCover][iLum_Illum]; // write daylight factors - 4 sky types for each daylight ref point print(state.files.dfs, @@ -662,6 +641,7 @@ void CalcDayltgCoeffsRefMapPoints(EnergyPlusData &state) // This subroutine does the daylighting coefficient calculation for the // daylighting and illuminance map reference points. auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; if (dl->VeryFirstTime) { // make sure all necessary surfaces match to pipes @@ -669,13 +649,13 @@ void CalcDayltgCoeffsRefMapPoints(EnergyPlusData &state) for (int enclNum = 1; enclNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclNum) { for (int loopwin = 1; loopwin <= dl->enclDaylight(enclNum).NumOfDayltgExtWins; ++loopwin) { int IWin = dl->enclDaylight(enclNum).DayltgExtWinSurfNums(loopwin); - if (state.dataSurface->Surface(IWin).OriginalClass != SurfaceClass::TDD_Diffuser) continue; + if (s_surf->Surface(IWin).OriginalClass != SurfaceClass::TDD_Diffuser) continue; // Look up the TDD:DOME object - int PipeNum = state.dataSurface->SurfWinTDDPipeNum(IWin); + int PipeNum = s_surf->SurfWinTDDPipeNum(IWin); if (PipeNum == 0) { - ShowSevereError(state, - format("GetTDDInput: Surface={}, TDD:Dome object does not reference a valid Diffuser object.", - state.dataSurface->Surface(IWin).Name)); + ShowSevereError( + state, + format("GetTDDInput: Surface={}, TDD:Dome object does not reference a valid Diffuser object.", s_surf->Surface(IWin).Name)); ShowContinueError(state, "...needs DaylightingDevice:Tubular of same name as Surface."); ErrorsFound = true; } @@ -727,6 +707,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) // PURPOSE OF THIS SUBROUTINE: // Provides calculations for Daylighting Coefficients for daylighting reference points auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; // glare calculation (radians) int IConst; // Construction counter @@ -784,13 +765,13 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) int WinEl; // Current window element if (dl->refFirstTime && (dl->maxControlRefPoints > 0)) { - dl->RefErrIndex.allocate(dl->maxControlRefPoints, state.dataSurface->TotSurfaces); + dl->RefErrIndex.allocate(dl->maxControlRefPoints, s_surf->TotSurfaces); dl->RefErrIndex = 0; dl->refFirstTime = false; } auto &thisDayltgCtrl = dl->daylightControl(daylightCtrlNum); - auto &thisEnclDaylight = dl->enclDaylight(thisDayltgCtrl.enclIndex); + auto const &thisEnclDaylight = dl->enclDaylight(thisDayltgCtrl.enclIndex); int zoneNum = thisDayltgCtrl.zoneIndex; // Azimuth of view vector in absolute coord sys Real64 AZVIEW = (thisDayltgCtrl.ViewAzimuthForGlare + state.dataHeatBal->Zone(zoneNum).RelNorth + state.dataHeatBal->BuildingAzimuth + @@ -812,14 +793,13 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::HoursInDay; int numExtWins = thisEnclDaylight.NumOfDayltgExtWins; int numRefPts = thisDayltgCtrl.TotalDaylRefPoints; - int numSlatAngs = state.dataSurface->actualMaxSlatAngs + 1; for (int iHr = iHrBeg; iHr <= iHrEnd; ++iHr) { auto &daylFacHr = thisDayltgCtrl.daylFac[iHr]; for (int iWin = 1; iWin <= numExtWins; ++iWin) { for (int iRefPt = 1; iRefPt <= numRefPts; ++iRefPt) { - for (int iSlatAng = 1; iSlatAng <= numSlatAngs; ++iSlatAng) { - auto &daylFac = daylFacHr(iWin, iRefPt, iSlatAng); + for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { + auto &daylFac = daylFacHr(iWin, iRefPt)[iWinCover]; daylFac[iLum_Illum] = Illums(); daylFac[iLum_Source] = Illums(); daylFac[iLum_Back] = Illums(); @@ -831,7 +811,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) BRef = 0; for (int IL = 1; IL <= thisDayltgCtrl.TotalDaylRefPoints; ++IL) { - auto &refPt = thisDayltgCtrl.refPts(IL); + auto const &refPt = thisDayltgCtrl.refPts(IL); // Reference point in absolute coordinate system Vector3 RREF = refPt.absCoords; @@ -1083,10 +1063,10 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) // Was previously part of CalcDayltgCoeffsRefMapPoints -- broken out to all multiple // maps per zone auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; // In the following four variables, I=1 for clear sky, 2 for overcast. int numRefPts; // Number of daylighting reference points in a zone - int IL; // Reference point counter // glare calculation (radians) int IConst; // Construction counter int ICtrl; // Window control counter @@ -1141,17 +1121,17 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) Vector3 VIEWVC2; if (dl->mapFirstTime && (int)dl->illumMaps.size() > 0) { - IL = -999; + int IL = -999; for (int MapNum = 1; MapNum <= (int)dl->illumMaps.size(); ++MapNum) { IL = max(IL, dl->illumMaps(MapNum).TotalMapRefPoints); } - dl->MapErrIndex.dimension(IL, state.dataSurface->TotSurfaces, 0); + dl->MapErrIndex.dimension(IL, s_surf->TotSurfaces, 0); dl->mapFirstTime = false; } auto &illumMap = dl->illumMaps(mapNum); int enclNum = illumMap.enclIndex; - auto &thisEnclDaylight = dl->enclDaylight(enclNum); + auto const &thisEnclDaylight = dl->enclDaylight(enclNum); // Azimuth of view vector in absolute coord sys - set to zero here, because glare isn't calculated for map points // but these are arguments to some of the functions that are shared with regular reference points, so initalize here. @@ -1160,7 +1140,6 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) VIEWVC = {0.0, 0.0, 0.0}; numRefPts = illumMap.TotalMapRefPoints; - int numSlatAngs = state.dataSurface->actualMaxSlatAngs + 1; int numExtWins = thisEnclDaylight.NumOfDayltgExtWins; for (auto &refPt : illumMap.refPts) { @@ -1177,15 +1156,15 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) auto &daylFacHr = illumMap.daylFac[iHr]; for (int iWin = 1; iWin <= numExtWins; ++iWin) { for (int iRefPt = 1; iRefPt <= numRefPts; ++iRefPt) { - for (int iSlatAng = 1; iSlatAng <= numSlatAngs; ++iSlatAng) { - daylFacHr(iWin, iRefPt, iSlatAng) = Illums(); + for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { + daylFacHr(iWin, iRefPt)[iWinCover] = Illums(); } } } } for (int IL = 1; IL <= numRefPts; ++IL) { - auto &refPt = illumMap.refPts(IL); + auto const &refPt = illumMap.refPts(IL); Vector3 RREF = refPt.absCoords; // ------------- @@ -1454,6 +1433,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // switch as need to serve both reference points and map points based on calledFrom auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; int ShelfNum; // Daylighting shelf object number int NDIVX; // Number of window x divisions for daylighting calc @@ -1488,38 +1468,38 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, } IWin = dl->enclDaylight(enclNum).DayltgExtWinSurfNums(loopwin); - auto &surf = state.dataSurface->Surface(IWin); - auto &surfWin = state.dataSurface->SurfaceWindow(IWin); + auto &surf = s_surf->Surface(IWin); + auto &surfWin = s_surf->SurfaceWindow(IWin); - if (state.dataSurface->Surface(surf.BaseSurf).SolarEnclIndex == enclNum) { + if (s_surf->Surface(surf.BaseSurf).SolarEnclIndex == enclNum) { extWinType = ExtWinType::InZone; } else { extWinType = ExtWinType::AdjZone; } - IConst = state.dataSurface->SurfActiveConstruction(IWin); + IConst = s_surf->SurfActiveConstruction(IWin); // For thermochromic windows, the daylight and glare factors are calculated for a base window cosntruction // 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 (state.dataConstruction->Construct(IConst).TCFlag == 1) { + if (state.dataConstruction->Construct(IConst).isTCWindow) { // For thermochromic windows, use the base window construction at base temperature of the TC layer - IConst = state.dataConstruction->Construct(IConst).TCMasterConst; + IConst = state.dataConstruction->Construct(IConst).TCMasterConstrNum; } ICtrl = surf.activeWindowShadingControl; ShType = WinShadingType::NoShade; // 'NOSHADE' BlNum = 0; // ScNum = 0; //Unused Set but never used - if (surf.HasShadeControl) ShType = state.dataSurface->WindowShadingControl(ICtrl).ShadingType; - BlNum = state.dataSurface->SurfWinBlindNumber(IWin); + if (surf.HasShadeControl) ShType = s_surf->WindowShadingControl(ICtrl).ShadingType; + if (ANY_BLIND(ShType)) BlNum = s_surf->surfShades(IWin).blind.matNum; // ScNum = SurfaceWindow( IWin ).ScreenNumber; //Unused Set but never used - ShelfNum = state.dataSurface->SurfDaylightingShelfInd(IWin); + ShelfNum = s_surf->SurfDaylightingShelfInd(IWin); if (ShelfNum > 0) { - InShelfSurf = state.dataDaylightingDevicesData->Shelf(state.dataSurface->SurfDaylightingShelfInd(IWin)) - .InSurf; // Inside daylighting shelf present if > 0 + InShelfSurf = + state.dataDaylightingDevicesData->Shelf(s_surf->SurfDaylightingShelfInd(IWin)).InSurf; // Inside daylighting shelf present if > 0 } else { InShelfSurf = 0; } @@ -1546,15 +1526,14 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, LSHCAL = 0; // Visible transmittance at normal incidence - state.dataSurface->SurfWinVisTransSelected(IWin) = - General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + s_surf->SurfWinVisTransSelected(IWin) = General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // For windows with switchable glazing, ratio of visible transmittance at normal // incidence for fully switched (dark) state to that of unswitched state - state.dataSurface->SurfWinVisTransRatio(IWin) = 1.0; + s_surf->SurfWinVisTransRatio(IWin) = 1.0; if (ICtrl > 0) { if (ShType == WinShadingType::SwitchableGlazing) { int IConstShaded = surf.activeShadedConstruction; // Shaded construction counter - state.dataSurface->SurfWinVisTransRatio(IWin) = + s_surf->SurfWinVisTransRatio(IWin) = General::SafeDivide(General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef), General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef)); } @@ -1571,7 +1550,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, } else if (is_Triangle) { WC = W2 + (W23 + W21) / 3.0; } - state.dataSurface->SurfaceWindow(IWin).WinCenter = WC; + s_surf->SurfaceWindow(IWin).WinCenter = WC; Vector3 REFWC = WC - RREF; // Unit vectors W21 /= HW; @@ -1581,7 +1560,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, Vector3 WNORM = surf.lcsz; // Initialize number of window elements - NDIVX = 40; + NDIVX = 40; // Does this mean that windows are split into 1,600 points for daylighting? WHYYYYYY? NDIVY = 40; // Distance from ref point to window plane @@ -1650,7 +1629,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, if (extWinType == ExtWinType::AdjZone) { // Adjust number of exterior window elements to give acceptable number of rays through // interior windows in the zone (for accuracy of interior window daylighting calculation) - SolidAngExtWin = General::SafeDivide(((surf.Area + state.dataSurface->SurfWinDividerArea(IWin)) / surf.Multiplier), pow_2(ALF)); + SolidAngExtWin = General::SafeDivide(((surf.Area + s_surf->SurfWinDividerArea(IWin)) / surf.Multiplier), pow_2(ALF)); SolidAngMinIntWin = dl->enclDaylight(enclNum).MinIntWinSolidAng; SolidAngRatio = max(1.0, SolidAngExtWin / SolidAngMinIntWin); NDIVX *= std::sqrt(SolidAngRatio); @@ -1678,11 +1657,11 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, if (surf.OriginalClass == SurfaceClass::TDD_Diffuser) { // Look up the TDD:DOME object - int PipeNum = state.dataSurface->SurfWinTDDPipeNum(IWin); + int PipeNum = s_surf->SurfWinTDDPipeNum(IWin); IWin2 = state.dataDaylightingDevicesData->TDDPipe(PipeNum).Dome; - auto &surf2 = state.dataSurface->Surface(IWin2); - auto &surfWin2 = state.dataSurface->SurfaceWindow(IWin2); + auto &surf2 = s_surf->Surface(IWin2); + auto &surfWin2 = s_surf->SurfaceWindow(IWin2); // Calculate reference point coords relative to the diffuser coordinate system // W21, W23, and WNORM are the unit vectors @@ -1720,7 +1699,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, } else if (surf2.Sides == 3) { WC = U2 + (U23 + U21) / 3.0; } - state.dataSurface->SurfaceWindow(IWin2).WinCenter = WC; + s_surf->SurfaceWindow(IWin2).WinCenter = WC; // Unit vectors U21 /= HW; U23 /= WW; @@ -1763,7 +1742,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, } // Initialize bsdf daylighting coefficients here. Only one time initialization - if (state.dataSurface->SurfWinWindowModelType(IWin) == WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(IWin) == WindowModel::BSDF) { if (!state.dataBSDFWindow->ComplexWind(IWin).DaylightingInitialized) { int NRefPts = 0; if (CalledFrom == CalledFor::MapPoint) { @@ -1781,22 +1760,19 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, int iHrBeg = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : 1; int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::HoursInDay; - int numSlatAngs = state.dataSurface->actualMaxSlatAngs + 1; for (int iHr = iHrBeg; iHr <= iHrEnd; ++iHr) { - for (int iSlatAng = 1; iSlatAng <= numSlatAngs; ++iSlatAng) { - // Initialize sky and sun components of direct illuminance (arrays EDIRSK, EDIRSU, EDIRSUdisk) - // and average window luminance (arrays AVWLSK, AVWLSU, AVWLSUdisk), at ref pt. - dl->dirIllum(iHr, iSlatAng) = Illums(); - dl->avgWinLum(iHr, iSlatAng) = Illums(); - } + // Initialize sky and sun components of direct illuminance (arrays EDIRSK, EDIRSU, EDIRSUdisk) + // and average window luminance (arrays AVWLSK, AVWLSU, AVWLSUdisk), at ref pt. + dl->dirIllum(iHr)[iWinCover_Bare] = dl->dirIllum(iHr)[iWinCover_Shaded] = Illums(); + dl->avgWinLum(iHr)[iWinCover_Bare] = dl->avgWinLum(iHr)[iWinCover_Shaded] = Illums(); } if (CalledFrom == CalledFor::RefPoint) { // Initialize solid angle subtended by window wrt ref pt // and solid angle weighted by glare position factor - state.dataSurface->SurfaceWindow(IWin).refPts(iRefPoint).solidAng = 0.0; - state.dataSurface->SurfaceWindow(IWin).refPts(iRefPoint).solidAngWtd = 0.0; + s_surf->SurfaceWindow(IWin).refPts(iRefPoint).solidAng = 0.0; + s_surf->SurfaceWindow(IWin).refPts(iRefPoint).solidAngWtd = 0.0; } // Area of window element if (is_Rectangle) { @@ -1863,6 +1839,7 @@ void FigureDayltgCoeffsAtPointsForWindowElements( // REFERENCES: // switch as need to serve both reference points and map points based on calledFrom auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; Real64 RR; // Distance from ref point to intersection of view vector // and plane normal to view vector and window element (m) @@ -1875,7 +1852,7 @@ void FigureDayltgCoeffsAtPointsForWindowElements( // Local complex fenestration variables Real64 TransBeam; // Obstructions transmittance for incoming BSDF rays (temporary variable) - auto &surfWin = state.dataSurface->SurfaceWindow(IWin); + auto &surfWin = s_surf->SurfaceWindow(IWin); ++LSHCAL; SkyObstructionMult = 1.0; @@ -1942,15 +1919,15 @@ void FigureDayltgCoeffsAtPointsForWindowElements( TVISIntWin = 0.0; Vector3 HitPtIntWin = {0.0, 0.0, 0.0}; - auto &surf = state.dataSurface->Surface(IWin); + auto &surf = s_surf->Surface(IWin); if (surf.OriginalClass == SurfaceClass::TDD_Diffuser) { // Look up the TDD:DOME object - int PipeNum = state.dataSurface->SurfWinTDDPipeNum(IWin); + int PipeNum = s_surf->SurfWinTDDPipeNum(IWin); // Unshaded visible transmittance of TDD for a single ray from sky/ground element TVISB = TransTDD(state, PipeNum, COSB, RadType::VisibleBeam) * surfWin.glazedFrac; } else { // Regular window - if (state.dataSurface->SurfWinWindowModelType(IWin) != WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF) { // Vis trans of glass for COSB incidence angle TVISB = General::POLYF(COSB, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; } else { @@ -1971,11 +1948,11 @@ void FigureDayltgCoeffsAtPointsForWindowElements( for (int const spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int IntWin = thisSpace.WindowSurfaceFirst; IntWin <= thisSpace.WindowSurfaceLast; ++IntWin) { - auto const &surfIntWin = state.dataSurface->Surface(IntWin); + auto const &surfIntWin = s_surf->Surface(IntWin); // in develop this was Surface(IntWin).Class == SurfaceClass::Window && Surface(IntWin).ExtBoundCond >= 1 if (surfIntWin.ExtBoundCond < 1) continue; - if (state.dataSurface->Surface(surfIntWin.ExtBoundCond).Zone != surf.Zone) continue; + if (s_surf->Surface(surfIntWin.ExtBoundCond).Zone != surf.Zone) continue; hitIntWin = PierceSurface(state, IntWin, RREF, Ray, HitPtIntWin); if (hitIntWin) { @@ -2040,7 +2017,7 @@ void FigureDayltgCoeffsAtPointsForWindowElements( // Get product of transmittances of obstructions hit by ray. // ObTrans = 1.0 will be returned if no exterior obstructions are hit. - if (state.dataSurface->SurfWinWindowModelType(IWin) != WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF) { // the IHR (now HourOfDay) here is/was not correct, this is outside of hour loop // the hour is used to query schedule for transmission , not sure what to do // it will work for detailed and never did work correctly before. @@ -2079,7 +2056,7 @@ void FigureDayltgCoeffsAtPointsForWindowElements( } } - if (state.dataSurface->CalcSolRefl && PHRAY < 0.0 && ObTrans > 1.0e-6) { + if (s_surf->CalcSolRefl && PHRAY < 0.0 && ObTrans > 1.0e-6) { // Calculate effect of obstructions on shading of sky diffuse reaching the ground point hit // by the ray. This effect is given by the ratio SkyObstructionMult = // (obstructed sky diffuse at ground point)/(unobstructed sky diffuse at ground point). @@ -2088,8 +2065,8 @@ void FigureDayltgCoeffsAtPointsForWindowElements( Real64 Alfa = std::acos(-Ray.z); Real64 Beta = std::atan2(Ray.y, Ray.x); // Distance between ground hit point and proj'n of center of window element onto ground (m) - Real64 HorDis = (RWIN2.z - state.dataSurface->GroundLevelZ) * std::tan(Alfa); - Vector3 GroundHitPt = {RWIN2.x + HorDis * std::cos(Beta), RWIN2.y + HorDis * std::sin(Beta), state.dataSurface->GroundLevelZ}; + Real64 HorDis = (RWIN2.z - s_surf->GroundLevelZ) * std::tan(Alfa); + Vector3 GroundHitPt = {RWIN2.x + HorDis * std::cos(Beta), RWIN2.y + HorDis * std::sin(Beta), s_surf->GroundLevelZ}; SkyObstructionMult = CalcObstrMultiplier(state, GroundHitPt, DataSurfaces::AltAngStepsForSolReflCalc, DataSurfaces::AzimAngStepsForSolReflCalc); @@ -2115,6 +2092,7 @@ void InitializeCFSDaylighting(EnergyPlusData &state, // For incoming BSDF window direction calculates whether bin is coming from sky, ground or reflected surface. // Routine also calculates intersection points with ground and exterior reflection surfaces. auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; // Object Data DataBSDFWindow::BSDFDaylghtPosition elPos; // altitude and azimuth of intersection element @@ -2122,7 +2100,7 @@ void InitializeCFSDaylighting(EnergyPlusData &state, int NumOfWinEl = NWX * NWY; // Number of window elements - auto &surf = state.dataSurface->Surface(IWin); + auto &surf = s_surf->Surface(IWin); Real64 DWX = surf.Width / NWX; // Window element width Real64 DWY = surf.Height / NWY; // Window element height @@ -2277,6 +2255,7 @@ void InitializeCFSStateData(EnergyPlusData &state, // PURPOSE OF THIS SUBROUTINE: // Initialize daylight state data for current + auto &s_surf = state.dataSurface; // SUBROUTINE LOCAL VARIABLES int curWinEl; @@ -2299,23 +2278,23 @@ void InitializeCFSStateData(EnergyPlusData &state, // temporary arrays for surfaces // Each complex fenestration state can have different number of basis elements // This is the reason for making these temporary arrays local - Array1D_int TmpSkyInd(NBasis, 0); // Temporary sky index list - Array1D_int TmpGndInd(NBasis, 0); // Temporary gnd index list - Array1D TmpGndMultiplier(NBasis, 0.0); // Temporary ground obstruction multiplier - Array1D_int TmpRfSfInd(NBasis, 0); // Temporary RefSurfIndex - Array1D_int TmpRfRyNH(NBasis, 0); // Temporary RefRayNHits - Array2D_int TmpHSurfNo(state.dataSurface->TotSurfaces, NBasis, 0); // Temporary HitSurfNo - Array2D TmpHSurfDSq(state.dataSurface->TotSurfaces, NBasis, 0.0); // Temporary HitSurfDSq + Array1D_int TmpSkyInd(NBasis, 0); // Temporary sky index list + Array1D_int TmpGndInd(NBasis, 0); // Temporary gnd index list + Array1D TmpGndMultiplier(NBasis, 0.0); // Temporary ground obstruction multiplier + Array1D_int TmpRfSfInd(NBasis, 0); // Temporary RefSurfIndex + Array1D_int TmpRfRyNH(NBasis, 0); // Temporary RefRayNHits + Array2D_int TmpHSurfNo(s_surf->TotSurfaces, NBasis, 0); // Temporary HitSurfNo + Array2D TmpHSurfDSq(s_surf->TotSurfaces, NBasis, 0.0); // Temporary HitSurfDSq // Object Data - Vector3 Centroid; // current window element centroid - Vector3 HitPt; // surface hit point - Array1D> TmpGndPt(NBasis, Vector3(0.0, 0.0, 0.0)); // Temporary ground intersection list - Array2D> TmpHitPt(state.dataSurface->TotSurfaces, NBasis, Vector3(0.0, 0.0, 0.0)); // Temporary HitPt + Vector3 Centroid; // current window element centroid + Vector3 HitPt; // surface hit point + Array1D> TmpGndPt(NBasis, Vector3(0.0, 0.0, 0.0)); // Temporary ground intersection list + Array2D> TmpHitPt(s_surf->TotSurfaces, NBasis, Vector3(0.0, 0.0, 0.0)); // Temporary HitPt CFSRefPointPosFactor(state, RefPoint, StateRefPoint, iWin, CurFenState, NTrnBasis, AZVIEW); - auto &surf = state.dataSurface->Surface(iWin); + auto &surf = s_surf->Surface(iWin); curWinEl = 0; // loop through window elements. This will calculate sky, ground and reflection bins for each window element @@ -2339,8 +2318,8 @@ void InitializeCFSStateData(EnergyPlusData &state, hit = false; TotHits = 0; - for (int JSurf = 1; JSurf <= state.dataSurface->TotSurfaces; ++JSurf) { - auto &surf2 = state.dataSurface->Surface(JSurf); + for (int JSurf = 1; JSurf <= s_surf->TotSurfaces; ++JSurf) { + auto &surf2 = s_surf->Surface(JSurf); // the following test will cycle on anything except exterior surfaces and shading surfaces if (surf2.HeatTransSurf && surf2.ExtBoundCond != ExternalEnvironment) continue; @@ -2427,7 +2406,7 @@ void InitializeCFSStateData(EnergyPlusData &state, } } // do JSurf = 1, TotSurfaces if (TotHits <= 0) { - auto &sIncRay = state.dataBSDFWindow->ComplexWind(iWin).Geom(CurFenState).sInc(IRay); + auto const &sIncRay = state.dataBSDFWindow->ComplexWind(iWin).Geom(CurFenState).sInc(IRay); // This ray reached the sky or ground unobstructed if (sIncRay.z < 0.0) { // A ground ray @@ -2438,7 +2417,7 @@ void InitializeCFSStateData(EnergyPlusData &state, TmpGndPt(NGnd).z = 0.0; // for solar reflectance calculations, need to precalculate obstruction multipliers - if (state.dataSurface->CalcSolRefl) { + if (s_surf->CalcSolRefl) { GroundHitPt = TmpGndPt(NGnd); TmpGndMultiplier(NGnd) = CalcObstrMultiplier(state, GroundHitPt, AltAngStepsForSolReflCalc, DataSurfaces::AzimAngStepsForSolReflCalc); @@ -2475,7 +2454,7 @@ void InitializeCFSStateData(EnergyPlusData &state, } void AllocateForCFSRefPointsState( - EnergyPlusData &state, DataBSDFWindow::BSDFRefPoints &StateRefPoint, int const NumOfWinEl, int const NBasis, int const NTrnBasis) + [[maybe_unused]] EnergyPlusData &state, DataBSDFWindow::BSDFRefPoints &StateRefPoint, int const NumOfWinEl, int const NBasis, int const NTrnBasis) { // SUBROUTINE INFORMATION: // AUTHOR Simon Vidanovic @@ -2483,6 +2462,7 @@ void AllocateForCFSRefPointsState( // PURPOSE OF THIS SUBROUTINE: // Memory allocation for complex fenestration systems reference points geometry + auto &s_surf = state.dataSurface; if (!allocated(StateRefPoint.NSky)) { StateRefPoint.NSky.allocate(NumOfWinEl); @@ -2535,17 +2515,17 @@ void AllocateForCFSRefPointsState( } if (!allocated(StateRefPoint.HitSurfNo)) { - StateRefPoint.HitSurfNo.allocate(state.dataSurface->TotSurfaces, NBasis, NumOfWinEl); + StateRefPoint.HitSurfNo.allocate(s_surf->TotSurfaces, NBasis, NumOfWinEl); StateRefPoint.HitSurfNo = 0; } if (!allocated(StateRefPoint.HitSurfDSq)) { - StateRefPoint.HitSurfDSq.allocate(state.dataSurface->TotSurfaces, NBasis, NumOfWinEl); + StateRefPoint.HitSurfDSq.allocate(s_surf->TotSurfaces, NBasis, NumOfWinEl); StateRefPoint.HitSurfDSq = 0.0; } if (!allocated(StateRefPoint.HitPt)) { - StateRefPoint.HitPt.allocate(state.dataSurface->TotSurfaces, NBasis, NumOfWinEl); + StateRefPoint.HitPt.allocate(s_surf->TotSurfaces, NBasis, NumOfWinEl); StateRefPoint.HitPt = Vector(0.0, 0.0, 0.0); } @@ -2684,7 +2664,8 @@ Real64 CalcObstrMultiplier(EnergyPlusData &state, // Phi = 0 at the horizon; Phi = Pi/2 at the zenith. // Locals - auto &dl = state.dataDayltg; + auto const &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; bool hitObs; // True iff obstruction is hit @@ -2736,9 +2717,9 @@ Real64 CalcObstrMultiplier(EnergyPlusData &state, SkyGndUnObs += IncAngSolidAngFac; // Does this ground ray hit an obstruction? hitObs = false; - if (state.dataSurface->TotSurfaces < octreeCrossover) { // Linear search through surfaces + if (s_surf->TotSurfaces < octreeCrossover) { // Linear search through surfaces - for (int ObsSurfNum : state.dataSurface->AllShadowPossObstrSurfaceList) { + for (int ObsSurfNum : s_surf->AllShadowPossObstrSurfaceList) { hitObs = PierceSurface(state, ObsSurfNum, GroundHitPt, URay, ObsHitPt); // Check if ray pierces surface if (hitObs) break; } @@ -2796,18 +2777,18 @@ void FigureDayltgCoeffsAtPointsForSunPosition( Real64 const DOMEGA, // Solid angle subtended by window element wrt reference point (steradians) int const ICtrl, // Window control counter WinShadingType const ShType, // Window shading type - int const BlNum, // Window blind number - Real64 const THRAY, // Azimuth of ray from reference point to window element (radians) - Vector3 const &WNORM2, // Unit vector normal to window - ExtWinType const extWinType, // Exterior window type (InZoneExtWin, AdjZoneExtWin, NotInOrAdjZoneExtWin) - int const IConst, // Construction counter - Real64 const AZVIEW, // Azimuth of view vector in absolute coord system for glare calculation (radians) - Vector3 const &RREF2, // Location of virtual reference point in absolute coordinate system - bool const hitIntObs, // True iff interior obstruction hit - bool const hitExtObs, // True iff ray from ref pt to ext win hits an exterior obstruction - CalledFor const CalledFrom, // indicate which type of routine called this routine - Real64 TVISIntWin, // Visible transmittance of int win at COSBIntWin for light from ext win - Real64 &TVISIntWinDisk, // Visible transmittance of int win at COSBIntWin for sun + [[maybe_unused]] int const BlNum, // Window blind number + Real64 const THRAY, // Azimuth of ray from reference point to window element (radians) + Vector3 const &WNORM2, // Unit vector normal to window + ExtWinType const extWinType, // Exterior window type (InZoneExtWin, AdjZoneExtWin, NotInOrAdjZoneExtWin) + int const IConst, // Construction counter + Real64 const AZVIEW, // Azimuth of view vector in absolute coord system for glare calculation (radians) + Vector3 const &RREF2, // Location of virtual reference point in absolute coordinate system + bool const hitIntObs, // True iff interior obstruction hit + bool const hitExtObs, // True iff ray from ref pt to ext win hits an exterior obstruction + CalledFor const CalledFrom, // indicate which type of routine called this routine + Real64 TVISIntWin, // Visible transmittance of int win at COSBIntWin for light from ext win + Real64 &TVISIntWinDisk, // Visible transmittance of int win at COSBIntWin for sun int const MapNum) { @@ -2820,10 +2801,11 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // METHODOLOGY EMPLOYED: // switch as need to serve both reference points and map points based on calledFrom - - if (state.dataSurface->SurfSunCosHourly(iHour).z < DataEnvironment::SunIsUpValue) return; + auto &s_surf = state.dataSurface; + if (s_surf->SurfSunCosHourly(iHour).z < DataEnvironment::SunIsUpValue) return; auto &dl = state.dataDayltg; + auto &s_mat = state.dataMaterial; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Vector3 RREF{0.0, 0.0, 0.0}; // Location of a reference point in absolute coordinate system //Autodesk Was used uninitialized: @@ -2872,7 +2854,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( zoneNum = dl->illumMaps(MapNum).zoneIndex; enclNum = dl->illumMaps(MapNum).enclIndex; } - if (state.dataSurface->SurfWinWindowModelType(IWin) != WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF) { if (LSHCAL == 1) DayltgInterReflectedIllum(state, ISunPos, iHour, enclNum, IWin2); } else { if (LSHCAL == 1) DayltgInterReflectedIllumComplexFenestration(state, IWin2, WinEl, iHour, daylightCtrlNum, iRefPoint, CalledFrom, MapNum); @@ -2892,7 +2874,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( if (COSB <= 0.0) return; - auto &surfWin = state.dataSurface->SurfaceWindow(IWin); + auto &surfWin = s_surf->SurfaceWindow(IWin); Illums XDirIllum; Illums XAvgWinLum; @@ -2906,7 +2888,6 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // (EDIRSK, EDIRSU) and average window luminance (AVWLSK, AVWLSU) are: // I=1 for clear sky, =2 Clear turbid, =3 Intermediate, =4 Overcast; // J=1 for bare window, =2 for window with shade or fixed slat-angle blind; - // = 2,3,...,MaxSlatAngs+1 for window with variable slat-angle blind; // K = sun position index. // ----- CASE I -- BARE WINDOW (no shading device) @@ -2914,7 +2895,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // Beam solar and sky solar reflected from nearest obstruction. // In the following hitIntObs == false ==> no interior obstructions hit, and // hitExtObs == true ==> one or more exterior obstructions hit. - if (state.dataSurface->CalcSolRefl && !hitIntObs && hitExtObs) { + if (s_surf->CalcSolRefl && !hitIntObs && hitExtObs) { int NearestHitSurfNum; // Surface number of nearest obstruction Vector3 NearestHitPt; // Hit point of ray on nearest obstruction // One or more exterior obstructions was hit; get contribution of reflection @@ -2926,55 +2907,52 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // Beam solar reflected from nearest obstruction LumAtHitPtFrSun = DayltgSurfaceLumFromSun(state, iHour, Ray, NearestHitSurfNum, NearestHitPt); - dl->avgWinLum(iHour, 1).sun += LumAtHitPtFrSun * TVISB; - if (PHRAY >= 0.0) dl->dirIllum(iHour, 1).sun += LumAtHitPtFrSun * DOMEGA_Ray_3 * TVISB; + dl->avgWinLum(iHour)[iWinCover_Bare].sun += LumAtHitPtFrSun * TVISB; + if (PHRAY >= 0.0) dl->dirIllum(iHour)[iWinCover_Bare].sun += LumAtHitPtFrSun * DOMEGA_Ray_3 * TVISB; // Sky solar reflected from nearest obstruction - int const ObsConstrNum = state.dataSurface->SurfActiveConstruction(NearestHitSurfNum); + int const ObsConstrNum = s_surf->SurfActiveConstruction(NearestHitSurfNum); if (ObsConstrNum > 0) { // Exterior building surface is nearest hit if (!state.dataConstruction->Construct(ObsConstrNum).TypeIsWindow) { // Obstruction is not a window, i.e., is an opaque surface - ObsVisRefl = 1.0 - dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ObsConstrNum).LayerPoint(1))) - ->AbsorpVisible; + ObsVisRefl = 1.0 - s_mat->materials(state.dataConstruction->Construct(ObsConstrNum).LayerPoint(1))->AbsorpVisible; } else { // Obstruction is a window; assume it is bare ObsVisRefl = state.dataConstruction->Construct(ObsConstrNum).ReflectVisDiffFront; } } else { // Shadowing surface is nearest hit - if (state.dataSurface->SurfDaylightingShelfInd(NearestHitSurfNum) > 0) { + if (s_surf->SurfDaylightingShelfInd(NearestHitSurfNum) > 0) { // This is a daylighting shelf, for which reflection is separately calculated ObsVisRefl = 0.0; } else { - ObsVisRefl = state.dataSurface->SurfShadowDiffuseVisRefl(NearestHitSurfNum); - if (state.dataSurface->SurfShadowGlazingConstruct(NearestHitSurfNum) > 0) - ObsVisRefl += - state.dataSurface->SurfShadowGlazingFrac(NearestHitSurfNum) * - state.dataConstruction->Construct(state.dataSurface->SurfShadowGlazingConstruct(NearestHitSurfNum)).ReflectVisDiffFront; + ObsVisRefl = s_surf->SurfShadowDiffuseVisRefl(NearestHitSurfNum); + if (s_surf->SurfShadowGlazingConstruct(NearestHitSurfNum) > 0) + ObsVisRefl += s_surf->SurfShadowGlazingFrac(NearestHitSurfNum) * + state.dataConstruction->Construct(s_surf->SurfShadowGlazingConstruct(NearestHitSurfNum)).ReflectVisDiffFront; } } // Surface number to use when obstruction is a shadowing surface int NearestHitSurfNumX = NearestHitSurfNum; // Each shadowing surface has a "mirror" duplicate surface facing in the opposite direction. // The following gets the correct side of a shadowing surface for reflection. - if (state.dataSurface->Surface(NearestHitSurfNum).IsShadowing) { - if (dot(Ray, state.dataSurface->Surface(NearestHitSurfNum).OutNormVec) > 0.0) NearestHitSurfNumX = NearestHitSurfNum + 1; + if (s_surf->Surface(NearestHitSurfNum).IsShadowing) { + if (dot(Ray, s_surf->Surface(NearestHitSurfNum).OutNormVec) > 0.0) NearestHitSurfNumX = NearestHitSurfNum + 1; } - if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm || !state.dataSurface->ShadingTransmittanceVaries || + if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm || !s_surf->ShadingTransmittanceVaries || state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { - SkyReflVisLum = ObsVisRefl * state.dataSurface->Surface(NearestHitSurfNumX).ViewFactorSky * + SkyReflVisLum = ObsVisRefl * s_surf->Surface(NearestHitSurfNumX).ViewFactorSky * state.dataSolarShading->SurfDifShdgRatioIsoSky(NearestHitSurfNumX) / Constant::Pi; } else { - SkyReflVisLum = ObsVisRefl * state.dataSurface->Surface(NearestHitSurfNumX).ViewFactorSky * + SkyReflVisLum = ObsVisRefl * s_surf->Surface(NearestHitSurfNumX).ViewFactorSky * state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS(1, iHour, NearestHitSurfNumX) / Constant::Pi; } assert(equal_dimensions(dl->avgWinLum, dl->dirIllum)); auto &gilsk = dl->horIllum[iHour]; - auto &avwlsk = dl->avgWinLum(iHour, 1); - auto &edirsk = dl->dirIllum(iHour, 1); + auto &avwlsk = dl->avgWinLum(iHour)[iWinCover_Bare]; + auto &edirsk = dl->dirIllum(iHour)[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { XAvgWinLum.sky[iSky] = gilsk.sky[iSky] * SkyReflVisLum; @@ -2990,33 +2968,33 @@ void FigureDayltgCoeffsAtPointsForSunPosition( if (ObTrans > 1.e-6) { // Ray did not hit an obstruction or the transmittance product of hit obstructions is non-zero. // Contribution of sky or ground luminance in cd/m2 - if (state.dataSurface->Surface(IWin).OriginalClass == SurfaceClass::TDD_Diffuser) { + if (s_surf->Surface(IWin).OriginalClass == SurfaceClass::TDD_Diffuser) { // Make all transmitted light diffuse for a TDD with a bare diffuser assert(equal_dimensions(dl->avgWinLum, dl->winLum)); assert(equal_dimensions(dl->avgWinLum, dl->dirIllum)); - auto &avwlsk = dl->avgWinLum(iHour, 1); - auto &edirsk = dl->dirIllum(iHour, 1); - auto &wlumsk = dl->winLum(iHour, 1); + auto &avwlsk = dl->avgWinLum(iHour)[iWinCover_Bare]; + auto &edirsk = dl->dirIllum(iHour)[iWinCover_Bare]; + auto &wlumsk = dl->winLum(iHour)[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { avwlsk.sky[iSky] += wlumsk.sky[iSky]; if (PHRAY > 0.0) edirsk.sky[iSky] += wlumsk.sky[iSky] * DOMEGA_Ray_3; } - dl->avgWinLum(iHour, 1).sun += dl->winLum(iHour, 1).sun; - dl->avgWinLum(iHour, 1).sunDisk += dl->winLum(iHour, 1).sunDisk; + dl->avgWinLum(iHour)[iWinCover_Bare].sun += dl->winLum(iHour)[iWinCover_Bare].sun; + dl->avgWinLum(iHour)[iWinCover_Bare].sunDisk += dl->winLum(iHour)[iWinCover_Bare].sunDisk; - if (PHRAY > 0.0) dl->dirIllum(iHour, 1).sun += dl->winLum(iHour, 1).sun * DOMEGA_Ray_3; + if (PHRAY > 0.0) dl->dirIllum(iHour)[iWinCover_Bare].sun += dl->winLum(iHour)[iWinCover_Bare].sun * DOMEGA_Ray_3; } else { // Bare window Vector3 GroundHitPt; // Coordinates of point that ray hits ground (m) // Tuned Hoisted operations out of loop and linear indexing - if (state.dataSurface->CalcSolRefl) { // Coordinates of ground point hit by the ray + if (s_surf->CalcSolRefl) { // Coordinates of ground point hit by the ray Real64 Alfa = std::acos(-Ray_3); Real64 const Ray_1(Ray.x); Real64 const Ray_2(Ray.y); // Beta = std::atan2( Ray_2, Ray_1 ); //Unused Tuning below eliminated use // Distance between ground hit point and proj'n of center of window element onto ground (m) - Real64 HorDis = (RWIN2.z - state.dataSurface->GroundLevelZ) * std::tan(Alfa); - GroundHitPt.z = state.dataSurface->GroundLevelZ; + Real64 HorDis = (RWIN2.z - s_surf->GroundLevelZ) * std::tan(Alfa); + GroundHitPt.z = s_surf->GroundLevelZ; // Tuned Replaced by below: sqrt is faster than sincos // GroundHitPt( 1 ) = RWIN2( 1 ) + HorDis * std::cos( Beta ); // GroundHitPt( 2 ) = RWIN2( 2 ) + HorDis * std::sin( Beta ); @@ -3033,10 +3011,10 @@ void FigureDayltgCoeffsAtPointsForSunPosition( Real64 const GILSK_mult((state.dataEnvrn->GndReflectanceForDayltg / Constant::Pi) * ObTrans * SkyObstructionMult); Real64 const TVISB_ObTrans(TVISB * ObTrans); Real64 const AVWLSU_add(TVISB_ObTrans * dl->horIllum[iHour].sun * (state.dataEnvrn->GndReflectanceForDayltg / Constant::Pi)); - Vector3 const SUNCOS_iHour(state.dataSurface->SurfSunCosHourly(iHour)); + Vector3 const SUNCOS_iHour(s_surf->SurfSunCosHourly(iHour)); assert(equal_dimensions(dl->dirIllum, dl->avgWinLum)); - auto &edirsk = dl->dirIllum(iHour, 1); - auto &avwlsk = dl->avgWinLum(iHour, 1); + auto &edirsk = dl->dirIllum(iHour)[iWinCover_Bare]; + auto &avwlsk = dl->avgWinLum(iHour)[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { if (PHRAY > 0.0) { // Ray heads upward to sky @@ -3058,18 +3036,18 @@ void FigureDayltgCoeffsAtPointsForSunPosition( if (PHRAY <= 0.0) { // SunObstructionMult = 1.0; //Tuned - if (state.dataSurface->CalcSolRefl) { // Coordinates of ground point hit by the ray + if (s_surf->CalcSolRefl) { // Coordinates of ground point hit by the ray // Sun reaches ground point if vector from this point to the sun is unobstructed hitObs = false; Vector3 ObsHitPt; // Coordinates of hit point on an obstruction (m) - for (int ObsSurfNum : state.dataSurface->AllShadowPossObstrSurfaceList) { + for (int ObsSurfNum : s_surf->AllShadowPossObstrSurfaceList) { hitObs = PierceSurface(state, ObsSurfNum, GroundHitPt, SUNCOS_iHour, ObsHitPt); if (hitObs) break; } // if ( hitObs ) SunObstructionMult = 0.0; - if (!hitObs) dl->avgWinLum(iHour, 1).sun += AVWLSU_add; + if (!hitObs) dl->avgWinLum(iHour)[iWinCover_Bare].sun += AVWLSU_add; } else { - dl->avgWinLum(iHour, 1).sun += AVWLSU_add; + dl->avgWinLum(iHour)[iWinCover_Bare].sun += AVWLSU_add; } } // (PHRAY <= 0.0) } @@ -3120,10 +3098,10 @@ void FigureDayltgCoeffsAtPointsForSunPosition( for (int IntWinDisk = thisSpace.WindowSurfaceFirst, IntWinDisk_end = thisSpace.WindowSurfaceLast; IntWinDisk <= IntWinDisk_end; ++IntWinDisk) { - auto const &surfIntWinDisk = state.dataSurface->Surface(IntWinDisk); + auto const &surfIntWinDisk = s_surf->Surface(IntWinDisk); if (surfIntWinDisk.ExtBoundCond < 1) continue; - if (state.dataSurface->Surface(surfIntWinDisk.ExtBoundCond).Zone != state.dataSurface->Surface(IWin2).Zone) continue; + if (s_surf->Surface(surfIntWinDisk.ExtBoundCond).Zone != s_surf->Surface(IWin2).Zone) continue; hitIntWinDisk = PierceSurface(state, IntWinDisk, RREF, RAYCOS, HitPtIntWinDisk); if (!hitIntWinDisk) continue; @@ -3187,7 +3165,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // Sun reaches reference point; increment illuminance. // Direct normal illuminance is normalized to 1.0 - if (state.dataSurface->Surface(IWin).OriginalClass == SurfaceClass::TDD_Diffuser) { + if (s_surf->Surface(IWin).OriginalClass == SurfaceClass::TDD_Diffuser) { // No beam is transmitted. Takes care of TDD with a bare diffuser and all types of blinds. TVISS = 0.0; } else { @@ -3197,49 +3175,41 @@ void FigureDayltgCoeffsAtPointsForSunPosition( if (extWinType == ExtWinType::AdjZone && hitIntWinDisk) TVISS *= TVISIntWinDisk; } - dl->dirIllum(iHour, 1).sunDisk = RAYCOS.z * TVISS * ObTransDisk; // Bare window + dl->dirIllum(iHour)[iWinCover_Bare].sunDisk = RAYCOS.z * TVISS * ObTransDisk; // Bare window - std::array transBmBmMult; - std::fill(transBmBmMult.begin(), transBmBmMult.end(), 0.0); + Real64 transBmBmMult = 0.0; if (ANY_BLIND(ShType)) { - auto const &blind = state.dataMaterial->Blind(BlNum); - - Real64 ProfAng = ProfileAngle(state, IWin, RAYCOS, blind.SlatOrientation); - // Contribution of beam passing through slats and reaching reference point - for (int JB = 1; JB <= Material::MaxSlatAngs; ++JB) { - // IF (.NOT.SurfaceWindow(IWin)%MovableSlats .AND. JB > 1) EXIT - Real64 SlatAng = (state.dataSurface->SurfWinMovableSlats(IWin)) ? ((JB - 1) * Constant::Pi / (Material::MaxSlatAngs - 1)) - : (blind.SlatAngle * Constant::DegToRadians); - transBmBmMult[JB] = - Window::BlindBeamBeamTrans(ProfAng, SlatAng, blind.SlatWidth, blind.SlatSeparation, blind.SlatThickness); - dl->dirIllum(iHour, JB + 1).sunDisk = RAYCOS.z * TVISS * transBmBmMult[JB] * ObTransDisk; - - // do this only once for fixed slat blinds - if (!state.dataSurface->SurfWinMovableSlats(IWin)) break; - } + auto const &surfShade = s_surf->surfShades(IWin); + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + + Real64 ProfAng = ProfileAngle(state, IWin, RAYCOS, matBlind->SlatOrientation); + transBmBmMult = matBlind->BeamBeamTrans(ProfAng, surfShade.blind.slatAng); + dl->dirIllum(iHour)[iWinCover_Shaded].sunDisk = RAYCOS.z * TVISS * transBmBmMult * ObTransDisk; + } else if (ShType == WinShadingType::ExtScreen) { // pass angle from sun to window normal here using PHSUN and THSUN from above and surface angles // SunAltitudeToWindowNormalAngle = PHSUN - SurfaceWindow(IWin)%Phi // SunAzimuthToWindowNormalAngle = THSUN - SurfaceWindow(IWin)%Theta - auto const *screen = dynamic_cast(state.dataMaterial->Material(surfWin.screenNum)); + auto const *screen = dynamic_cast(s_mat->materials(surfWin.screenNum)); assert(screen != nullptr); Real64 phi = std::abs(dl->sunAngles.phi - surfWin.phi); Real64 theta = std::abs(dl->sunAngles.theta - surfWin.theta); int ip1, ip2, it1, it2; - General::BilinearInterpCoeffs coeffs; + BilinearInterpCoeffs coeffs; Material::NormalizePhiTheta(phi, theta); Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); GetBilinearInterpCoeffs( phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); - transBmBmMult[1] = BilinearInterp(screen->btars[ip1][it1].BmTrans, - screen->btars[ip1][it2].BmTrans, - screen->btars[ip2][it1].BmTrans, - screen->btars[ip2][it2].BmTrans, - coeffs); + transBmBmMult = BilinearInterp(screen->btars[ip1][it1].BmTrans, + screen->btars[ip1][it2].BmTrans, + screen->btars[ip2][it1].BmTrans, + screen->btars[ip2][it2].BmTrans, + coeffs); - dl->dirIllum(iHour, 2).sunDisk = RAYCOS.z * TVISS * transBmBmMult[1] * ObTransDisk; + dl->dirIllum(iHour)[iWinCover_Shaded].sunDisk = RAYCOS.z * TVISS * transBmBmMult * ObTransDisk; } if (CalledFrom == CalledFor::RefPoint) { @@ -3252,7 +3222,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( Real64 POSFAC = DayltgGlarePositionFactor(XR, YR); // Position factor for a window element / ref point / view vector combination - WindowSolidAngleDaylightPoint = state.dataSurface->SurfaceWindow(IWin).refPts(iRefPoint).solidAngWtd; + WindowSolidAngleDaylightPoint = s_surf->SurfaceWindow(IWin).refPts(iRefPoint).solidAngWtd; if (POSFAC != 0.0 && WindowSolidAngleDaylightPoint > 0.000001) { // Increment window luminance. Luminance of solar disk (cd/m2) @@ -3262,16 +3232,12 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // Solid angle subtended by sun is 0.000068 steradians XAVWL = 14700.0 * std::sqrt(0.000068 * POSFAC) * double(NWX * NWY) / std::pow(WindowSolidAngleDaylightPoint, 0.8); - dl->avgWinLum(iHour, 1).sunDisk = XAVWL * TVISS * ObTransDisk; // Bare window + dl->avgWinLum(iHour)[iWinCover_Bare].sunDisk = XAVWL * TVISS * ObTransDisk; // Bare window if (ANY_BLIND(ShType)) { - for (int JB = 1; JB <= Material::MaxSlatAngs; ++JB) { - // IF (.NOT. SurfaceWindow(IWin)%MovableSlats .AND. JB > 1) EXIT - dl->avgWinLum(iHour, JB + 1).sunDisk = XAVWL * TVISS * transBmBmMult[JB] * ObTransDisk; - if (!state.dataSurface->SurfWinMovableSlats(IWin)) break; - } + dl->avgWinLum(iHour)[iWinCover_Shaded].sunDisk = XAVWL * TVISS * transBmBmMult * ObTransDisk; } else if (ShType == WinShadingType::ExtScreen) { - dl->avgWinLum(iHour, 2).sunDisk = XAVWL * TVISS * transBmBmMult[1] * ObTransDisk; + dl->avgWinLum(iHour)[iWinCover_Shaded].sunDisk = XAVWL * TVISS * transBmBmMult * ObTransDisk; } } // Position Factor } // if (calledFrom == RefPt) @@ -3282,16 +3248,15 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // Beam solar reaching reference point after beam-beam (specular) reflection from // an exterior surface - if (state.dataSurface->CalcSolRefl) { + if (s_surf->CalcSolRefl) { // Receiving surface number corresponding this window - int RecSurfNum = state.dataSurface->SurfShadowRecSurfNum(IWin2); + int RecSurfNum = s_surf->SurfShadowRecSurfNum(IWin2); if (RecSurfNum > 0) { // interior windows do not apply if (state.dataSolarReflectionManager->SolReflRecSurf(RecSurfNum).NumPossibleObs > 0) { bool hitRefl; // True iff ray hits reflecting surface Vector3 HitPtRefl; // Point that ray hits reflecting surface Vector3 SunVecMir; // Sun ray mirrored in reflecting surface Vector3 ReflNorm; // Normal vector to reflecting surface - Vector3 TransBmBmMultRefl; // This window has associated obstructions that could reflect beam onto the window for (int loop = 1, loop_end = state.dataSolarReflectionManager->SolReflRecSurf(RecSurfNum).NumPossibleObs; loop <= loop_end; ++loop) { @@ -3299,13 +3264,12 @@ void FigureDayltgCoeffsAtPointsForSunPosition( int ReflSurfNumX = ReflSurfNum; // Each shadowing surface has a "mirror" duplicate surface facing in the opposite direction. // The following gets the correct side of a shadowing surface for reflection. - if (state.dataSurface->Surface(ReflSurfNum).IsShadowing) { - if (dot(RAYCOS, state.dataSurface->Surface(ReflSurfNum).OutNormVec) < 0.0) ReflSurfNumX = ReflSurfNum + 1; + if (s_surf->Surface(ReflSurfNum).IsShadowing) { + if (dot(RAYCOS, s_surf->Surface(ReflSurfNum).OutNormVec) < 0.0) ReflSurfNumX = ReflSurfNum + 1; } // Require that the surface can have specular reflection - if (state.dataSurface->Surface(ReflSurfNum).Class == SurfaceClass::Window || - state.dataSurface->SurfShadowGlazingFrac(ReflSurfNum) > 0.0) { - ReflNorm = state.dataSurface->Surface(ReflSurfNumX).OutNormVec; + if (s_surf->Surface(ReflSurfNum).Class == SurfaceClass::Window || s_surf->SurfShadowGlazingFrac(ReflSurfNum) > 0.0) { + ReflNorm = s_surf->Surface(ReflSurfNumX).OutNormVec; // Vector to sun that is mirrored in obstruction SunVecMir = RAYCOS - 2.0 * dot(RAYCOS, ReflNorm) * ReflNorm; // Skip if reflecting surface is not sunlit @@ -3314,7 +3278,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // reach reference point in this case if (SunVecMir.z <= 0.0) continue; // Cosine of incidence angle of reflected beam on window - Real64 CosIncAngRec = dot(state.dataSurface->Surface(IWin2).OutNormVec, SunVecMir); + Real64 CosIncAngRec = dot(s_surf->Surface(IWin2).OutNormVec, SunVecMir); if (CosIncAngRec <= 0.0) continue; // Does ray from ref. pt. along SunVecMir pass through window? hitWin = PierceSurface(state, IWin2, RREF2, SunVecMir, HP); @@ -3334,7 +3298,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( loop2 <= loop2_end; ++loop2) { int const ObsSurfNum = state.dataSolarReflectionManager->SolReflRecSurf(RecSurfNum).PossibleObsSurfNums(loop2); - if (ObsSurfNum == ReflSurfNum || ObsSurfNum == state.dataSurface->Surface(ReflSurfNum).BaseSurf) continue; + if (ObsSurfNum == ReflSurfNum || ObsSurfNum == s_surf->Surface(ReflSurfNum).BaseSurf) continue; hitObs = PierceSurface(state, ObsSurfNum, RREF2, SunVecMir, ReflDistance, HitPtObs); // ReflDistance cutoff added if (hitObs) { // => Could skip distance check (unless < vs <= ReflDistance really matters) if (distance_squared(HitPtObs, RREF2) < ReflDistanceSq) { // Distance squared from ref pt to reflection point @@ -3347,10 +3311,10 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // There is no obstruction for this ray between ref pt and hit pt on reflecting surface. // See if ray from hit pt on reflecting surface to original (unmirrored) sun position is obstructed hitObs = false; - if (state.dataSurface->Surface(ReflSurfNum).Class == SurfaceClass::Window) { + if (s_surf->Surface(ReflSurfNum).Class == SurfaceClass::Window) { // Reflecting surface is a window. // Receiving surface number for this reflecting window. - int ReflSurfRecNum = state.dataSurface->SurfShadowRecSurfNum(ReflSurfNum); + int ReflSurfRecNum = s_surf->SurfShadowRecSurfNum(ReflSurfNum); if (ReflSurfRecNum > 0) { // Loop over possible obstructions for this reflecting window for (int loop2 = 1, loop2_end = state.dataSolarReflectionManager->SolReflRecSurf(ReflSurfRecNum).NumPossibleObs; @@ -3364,7 +3328,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( } } else { // Reflecting surface is a building shade - for (int ObsSurfNum : state.dataSurface->AllShadowPossObstrSurfaceList) { + for (int ObsSurfNum : s_surf->AllShadowPossObstrSurfaceList) { if (ObsSurfNum == ReflSurfNum) continue; hitObs = PierceSurface(state, ObsSurfNum, HitPtRefl, RAYCOS, HitPtObs); if (hitObs) break; @@ -3376,59 +3340,51 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // No obstructions. Calculate reflected beam illuminance at ref. pt. from this reflecting surface. SpecReflectance = 0.0; Real64 CosIncAngRefl = std::abs(dot(RAYCOS, ReflNorm)); // Cos of angle of incidence of beam on reflecting surface - if (state.dataSurface->Surface(ReflSurfNum).Class == SurfaceClass::Window) { - int const ConstrNumRefl = state.dataSurface->SurfActiveConstruction(ReflSurfNum); + if (s_surf->Surface(ReflSurfNum).Class == SurfaceClass::Window) { + int const ConstrNumRefl = s_surf->SurfActiveConstruction(ReflSurfNum); SpecReflectance = General::POLYF(std::abs(CosIncAngRefl), state.dataConstruction->Construct(ConstrNumRefl).ReflSolBeamFrontCoef); } - if (state.dataSurface->Surface(ReflSurfNum).IsShadowing && state.dataSurface->SurfShadowGlazingConstruct(ReflSurfNum) > 0) + if (s_surf->Surface(ReflSurfNum).IsShadowing && s_surf->SurfShadowGlazingConstruct(ReflSurfNum) > 0) SpecReflectance = - state.dataSurface->SurfShadowGlazingFrac(ReflSurfNum) * - General::POLYF(std::abs(CosIncAngRefl), - state.dataConstruction->Construct(state.dataSurface->SurfShadowGlazingConstruct(ReflSurfNum)) - .ReflSolBeamFrontCoef); + s_surf->SurfShadowGlazingFrac(ReflSurfNum) * + General::POLYF( + std::abs(CosIncAngRefl), + state.dataConstruction->Construct(s_surf->SurfShadowGlazingConstruct(ReflSurfNum)).ReflSolBeamFrontCoef); TVisRefl = General::POLYF(CosIncAngRec, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; - dl->dirIllum(iHour, 1).sunDisk += SunVecMir.z * SpecReflectance * TVisRefl; // Bare window + dl->dirIllum(iHour)[iWinCover_Bare].sunDisk += SunVecMir.z * SpecReflectance * TVisRefl; // Bare window - TransBmBmMultRefl = 0.0; + Real64 TransBmBmMultRefl = 0.0; if (ANY_BLIND(ShType)) { - auto const &blind = state.dataMaterial->Blind(BlNum); - Real64 ProfAng = ProfileAngle(state, IWin, SunVecMir, blind.SlatOrientation); - // Contribution of reflected beam passing through slats and reaching reference point - Real64 const Pi_SlatAng_fac(Constant::Pi / (Material::MaxSlatAngs - 1)); - for (int JB = 1; JB <= Material::MaxSlatAngs; ++JB) { - // IF (.NOT.SurfaceWindow(IWin)%MovableSlats .AND. JB > 1) EXIT - Real64 SlatAng = (state.dataSurface->SurfWinMovableSlats(IWin)) ? (double(JB - 1) * Pi_SlatAng_fac) - : (blind.SlatAngle * Constant::DegToRadians); - - TransBmBmMultRefl(JB) = - Window::BlindBeamBeamTrans(ProfAng, SlatAng, blind.SlatWidth, blind.SlatSeparation, blind.SlatThickness); - dl->dirIllum(iHour, JB + 1).sunDisk += SunVecMir.z * SpecReflectance * TVisRefl * TransBmBmMultRefl(JB); - if (!state.dataSurface->SurfWinMovableSlats(IWin)) break; - } + auto const &surfShade = s_surf->surfShades(IWin); + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + + Real64 ProfAng = ProfileAngle(state, IWin, SunVecMir, matBlind->SlatOrientation); + TransBmBmMultRefl = matBlind->BeamBeamTrans(ProfAng, surfShade.blind.slatAng); + dl->dirIllum(iHour)[iWinCover_Shaded].sunDisk += SunVecMir.z * SpecReflectance * TVisRefl * TransBmBmMultRefl; } else if (ShType == WinShadingType::ExtScreen) { // pass angle from sun to window normal here using PHSUN and THSUN from above and // surface angles SunAltitudeToWindowNormalAngle = PHSUN - SurfaceWindow(IWin)%Phi // SunAzimuthToWindowNormalAngle = THSUN - SurfaceWindow(IWin)%Theta - auto const *screen = dynamic_cast(state.dataMaterial->Material(surfWin.screenNum)); + auto const *screen = dynamic_cast(s_mat->materials(surfWin.screenNum)); assert(screen != nullptr); Real64 phi = std::abs(dl->sunAngles.phi - surfWin.phi); Real64 theta = std::abs(dl->sunAngles.theta - surfWin.theta); int ip1, ip2, it1, it2; // lo/hi phi/theta interpolation map indices - General::BilinearInterpCoeffs coeffs; + BilinearInterpCoeffs coeffs; Material::NormalizePhiTheta(phi, theta); Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); - General::GetBilinearInterpCoeffs( + GetBilinearInterpCoeffs( phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); - TransBmBmMultRefl(1) = General::BilinearInterp(screen->btars[ip1][it1].BmTrans, - screen->btars[ip1][it2].BmTrans, - screen->btars[ip2][it1].BmTrans, - screen->btars[ip2][it2].BmTrans, - coeffs); - dl->dirIllum(iHour, 2).sunDisk += SunVecMir.z * SpecReflectance * TVisRefl * TransBmBmMultRefl(1); + TransBmBmMultRefl = BilinearInterp(screen->btars[ip1][it1].BmTrans, + screen->btars[ip1][it2].BmTrans, + screen->btars[ip2][it1].BmTrans, + screen->btars[ip2][it2].BmTrans, + coeffs); + dl->dirIllum(iHour)[iWinCover_Shaded].sunDisk += SunVecMir.z * SpecReflectance * TVisRefl * TransBmBmMultRefl; } // End of check if window has a blind or screen // Glare from reflected solar disk @@ -3438,18 +3394,14 @@ void FigureDayltgCoeffsAtPointsForSunPosition( Real64 XR = std::tan(std::abs(Constant::PiOvr2 - AZVIEW - THSUNrefl) + 0.001); Real64 YR = std::tan(PHSUNrefl + 0.001); Real64 POSFAC = DayltgGlarePositionFactor(XR, YR); - if (POSFAC != 0.0 && state.dataSurface->SurfaceWindow(IWin).refPts(iRefPoint).solidAngWtd > 0.000001) { + if (POSFAC != 0.0 && s_surf->SurfaceWindow(IWin).refPts(iRefPoint).solidAngWtd > 0.000001) { XAVWL = 14700.0 * std::sqrt(0.000068 * POSFAC) * double(NWX * NWY) / - std::pow(state.dataSurface->SurfaceWindow(IWin).refPts(iRefPoint).solidAngWtd, 0.8); - dl->avgWinLum(iHour, 1).sunDisk += XAVWL * TVisRefl * SpecReflectance; // Bare window + std::pow(s_surf->SurfaceWindow(IWin).refPts(iRefPoint).solidAngWtd, 0.8); + dl->avgWinLum(iHour)[iWinCover_Bare].sunDisk += XAVWL * TVisRefl * SpecReflectance; // Bare window if (ANY_BLIND(ShType)) { - for (int JB = 1; JB <= Material::MaxSlatAngs; ++JB) { - // IF(.NOT. SurfaceWindow(IWin)%MovableSlats .AND. JB > 1) EXIT - dl->avgWinLum(iHour, JB + 1).sunDisk += XAVWL * TVisRefl * SpecReflectance * TransBmBmMultRefl(JB); - if (!state.dataSurface->SurfWinMovableSlats(IWin)) break; - } + dl->avgWinLum(iHour)[iWinCover_Shaded].sunDisk += XAVWL * TVisRefl * SpecReflectance * TransBmBmMultRefl; } else if (ShType == WinShadingType::ExtScreen) { - dl->avgWinLum(iHour, 2).sunDisk += XAVWL * TVisRefl * SpecReflectance * TransBmBmMultRefl(1); + dl->avgWinLum(iHour)[iWinCover_Shaded].sunDisk += XAVWL * TVisRefl * SpecReflectance * TransBmBmMultRefl; } } } // End of check that obstruction can specularly reflect @@ -3461,39 +3413,34 @@ void FigureDayltgCoeffsAtPointsForSunPosition( } // Last pass - if ((ICtrl > 0 && (ANY_BLIND(ShType) || ANY_SHADE_SCREEN(ShType))) || state.dataSurface->SurfWinSolarDiffusing(IWin)) { + if ((ICtrl > 0 && (ANY_BLIND(ShType) || ANY_SHADE_SCREEN(ShType))) || s_surf->SurfWinSolarDiffusing(IWin)) { // ----- CASE II -- WINDOW WITH SCREEN, SHADE, BLIND, OR DIFFUSING WINDOW - // Interior window visible transmittance multiplier for exterior window in adjacent zone TVisIntWinMult = 1.0; TVisIntWinDiskMult = 1.0; - if (state.dataSurface->Surface(IWin).SolarEnclIndex != dl->daylightControl(daylightCtrlNum).enclIndex) { + if (s_surf->Surface(IWin).SolarEnclIndex != dl->daylightControl(daylightCtrlNum).enclIndex) { TVisIntWinMult = TVISIntWin; TVisIntWinDiskMult = TVISIntWinDisk; } Real64 const DOMEGA_Ray_3_TVisIntWinMult(DOMEGA_Ray_3 * TVisIntWinMult); - for (int JB = 1; JB <= Material::MaxSlatAngs; ++JB) { - // Sometimes this is JB > 2 and sometimes it's JB > 1, what gives? - if (!state.dataSurface->SurfWinMovableSlats(IWin) && JB > 1) break; - auto &wlumsk = dl->winLum(iHour, JB + 1); - auto &edirsk = dl->dirIllum(iHour, JB + 1); - auto &avwlsk = dl->avgWinLum(iHour, JB + 1); - for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { - // IF (.NOT.SurfaceWindow(IWin)%MovableSlats .AND. JB > 1) EXIT - avwlsk.sky[iSky] += wlumsk.sky[iSky] * TVisIntWinMult; - if (PHRAY > 0.0) edirsk.sky[iSky] += wlumsk.sky[iSky] * DOMEGA_Ray_3_TVisIntWinMult; - } // for (iSky) + auto &wlumsk = dl->winLum(iHour)[iWinCover_Shaded]; + auto &edirsk = dl->dirIllum(iHour)[iWinCover_Shaded]; + auto &avwlsk = dl->avgWinLum(iHour)[iWinCover_Shaded]; + for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { + // IF (.NOT.SurfaceWindow(IWin)%MovableSlats .AND. JB > 1) EXIT + avwlsk.sky[iSky] += wlumsk.sky[iSky] * TVisIntWinMult; + if (PHRAY > 0.0) edirsk.sky[iSky] += wlumsk.sky[iSky] * DOMEGA_Ray_3_TVisIntWinMult; + } // for (iSky) - dl->avgWinLum(iHour, JB + 1).sun += dl->winLum(iHour, JB + 1).sun * TVisIntWinMult; - dl->avgWinLum(iHour, JB + 1).sunDisk += dl->winLum(iHour, JB + 1).sunDisk * TVisIntWinDiskMult; + dl->avgWinLum(iHour)[iWinCover_Shaded].sun += dl->winLum(iHour)[iWinCover_Shaded].sun * TVisIntWinMult; + dl->avgWinLum(iHour)[iWinCover_Shaded].sunDisk += dl->winLum(iHour)[iWinCover_Shaded].sunDisk * TVisIntWinDiskMult; - if (PHRAY > 0.0) { - dl->dirIllum(iHour, JB + 1).sun += dl->winLum(iHour, JB + 1).sun * DOMEGA_Ray_3_TVisIntWinMult; - } - } // for (JB) + if (PHRAY > 0.0) { + dl->dirIllum(iHour)[iWinCover_Shaded].sun += dl->winLum(iHour)[iWinCover_Shaded].sun * DOMEGA_Ray_3_TVisIntWinMult; + } } } // FigureDayltgCoeffsAtPointsForSunPosition() @@ -3525,8 +3472,9 @@ void FigureRefPointDayltgFactorsToAddIllums(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; - if (state.dataSurface->SurfSunCosHourly(iHour).z < DataEnvironment::SunIsUpValue) return; + if (s_surf->SurfSunCosHourly(iHour).z < DataEnvironment::SunIsUpValue) return; ++ISunPos; @@ -3534,10 +3482,12 @@ void FigureRefPointDayltgFactorsToAddIllums(EnergyPlusData &state, dl->sunAngles = dl->sunAnglesHr[iHour]; auto &thisDayltgCtrl = dl->daylightControl(daylightCtrlNum); - int const enclNum = state.dataSurface->Surface(IWin).SolarEnclIndex; + + auto &surf = s_surf->Surface(IWin); + + int const enclNum = surf.SolarEnclIndex; // Loop over shading index (1=bare window; 2=diffusing glazing, shade, screen or fixed slat-angle blind; - // 2 to Material::MaxSlatAngs+1 for variable slat-angle blind) // TH. 9/22/2009. CR 7625 - daylight illuminance spikes during some sunset hours due to the calculated sky and sun // related daylight factors > 1, which theoretically can occur when sun is perpendicular to the window @@ -3547,15 +3497,14 @@ void FigureRefPointDayltgFactorsToAddIllums(EnergyPlusData &state, auto &daylFacHr = thisDayltgCtrl.daylFac[iHour]; - for (int JSH = 1; JSH <= Material::MaxSlatAngs + 1; ++JSH) { - if (!state.dataSurface->SurfWinMovableSlats(IWin) && JSH > 2) break; + for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { auto const &gilsk = dl->horIllum[iHour]; - auto const &edirsk = dl->dirIllum(iHour, JSH); - auto const &eintsk = dl->reflIllum(iHour, JSH); - auto const &avwlsk = dl->avgWinLum(iHour, JSH); + auto const &edirsk = dl->dirIllum(iHour)[iWinCover]; + auto const &eintsk = dl->reflIllum(iHour)[iWinCover]; + auto const &avwlsk = dl->avgWinLum(iHour)[iWinCover]; - auto &daylFac = daylFacHr(loopwin, iRefPoint, JSH); + auto &daylFac = daylFacHr(loopwin, iRefPoint)[iWinCover]; auto &illFac = daylFac[iLum_Illum]; auto &sourceFac = daylFac[iLum_Source]; auto &backFac = daylFac[iLum_Back]; @@ -3575,15 +3524,16 @@ void FigureRefPointDayltgFactorsToAddIllums(EnergyPlusData &state, } // for (iSky) if (dl->horIllum[iHour].sun > tmpDFCalc) { - auto &daylFac = daylFacHr(loopwin, iRefPoint, JSH); - daylFac[iLum_Illum].sun = (dl->dirIllum(iHour, JSH).sun + dl->reflIllum(iHour, JSH).sun) / (dl->horIllum[iHour].sun + 0.0001); - daylFac[iLum_Illum].sunDisk = (dl->dirIllum(iHour, JSH).sunDisk + dl->reflIllum(iHour, JSH).sunDisk) / (dl->horIllum[iHour].sun + 0.0001); - daylFac[iLum_Source].sun = dl->avgWinLum(iHour, JSH).sun / (NWX * NWY * (dl->horIllum[iHour].sun + 0.0001)); - daylFac[iLum_Source].sunDisk = dl->avgWinLum(iHour, JSH).sunDisk / (NWX * NWY * (dl->horIllum[iHour].sun + 0.0001)); - daylFac[iLum_Back].sun = - dl->reflIllum(iHour, JSH).sun * dl->enclDaylight(enclNum).aveVisDiffReflect / (Constant::Pi * (dl->horIllum[iHour].sun + 0.0001)); - daylFac[iLum_Back].sunDisk = - dl->reflIllum(iHour, JSH).sunDisk * dl->enclDaylight(enclNum).aveVisDiffReflect / (Constant::Pi * (dl->horIllum[iHour].sun + 0.0001)); + auto &daylFac = daylFacHr(loopwin, iRefPoint)[iWinCover]; + daylFac[iLum_Illum].sun = (dl->dirIllum(iHour)[iWinCover].sun + dl->reflIllum(iHour)[iWinCover].sun) / (dl->horIllum[iHour].sun + 0.0001); + daylFac[iLum_Illum].sunDisk = + (dl->dirIllum(iHour)[iWinCover].sunDisk + dl->reflIllum(iHour)[iWinCover].sunDisk) / (dl->horIllum[iHour].sun + 0.0001); + daylFac[iLum_Source].sun = dl->avgWinLum(iHour)[iWinCover].sun / (NWX * NWY * (dl->horIllum[iHour].sun + 0.0001)); + daylFac[iLum_Source].sunDisk = dl->avgWinLum(iHour)[iWinCover].sunDisk / (NWX * NWY * (dl->horIllum[iHour].sun + 0.0001)); + daylFac[iLum_Back].sun = dl->reflIllum(iHour)[iWinCover].sun * dl->enclDaylight(enclNum).aveVisDiffReflect / + (Constant::Pi * (dl->horIllum[iHour].sun + 0.0001)); + daylFac[iLum_Back].sunDisk = dl->reflIllum(iHour)[iWinCover].sunDisk * dl->enclDaylight(enclNum).aveVisDiffReflect / + (Constant::Pi * (dl->horIllum[iHour].sun + 0.0001)); } else { daylFac[iLum_Illum].sun = 0.0; daylFac[iLum_Illum].sunDisk = 0.0; @@ -3597,11 +3547,11 @@ void FigureRefPointDayltgFactorsToAddIllums(EnergyPlusData &state, } // for (jSH) // For switchable glazing put daylighting factors for switched (dark) state in IS=2 location - if (ICtrl > 0 && state.dataSurface->WindowShadingControl(ICtrl).ShadingType == WinShadingType::SwitchableGlazing) { + if (ICtrl > 0 && s_surf->WindowShadingControl(ICtrl).ShadingType == WinShadingType::SwitchableGlazing) { - Real64 VTR = state.dataSurface->SurfWinVisTransRatio(IWin); // Ratio of Tvis of fully-switched state to that of the unswitched state - auto &daylFac2 = daylFacHr(loopwin, iRefPoint, 2); - auto const &daylFac1 = daylFacHr(loopwin, iRefPoint, 1); + Real64 VTR = s_surf->SurfWinVisTransRatio(IWin); // Ratio of Tvis of fully-switched state to that of the unswitched state + auto &daylFac2 = daylFacHr(loopwin, iRefPoint)[iWinCover_Shaded]; + auto const &daylFac1 = daylFacHr(loopwin, iRefPoint)[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { daylFac2[iLum_Illum].sky[iSky] = daylFac1[iLum_Illum].sky[iSky] * VTR; @@ -3644,11 +3594,11 @@ void FigureMapPointDayltgFactorsToAddIllums(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; - if (state.dataSurface->SurfSunCosHourly(iHour).z < DataEnvironment::SunIsUpValue) return; + if (s_surf->SurfSunCosHourly(iHour).z < DataEnvironment::SunIsUpValue) return; - // Loop over shading index (1=bare window; 2=diffusing glazing, shade, screen or fixed slat-angle blind; - // 2 to Material::MaxSlatAngs+1 for variable slat-angle blind) + // Loop over shading index (1=bare window; 2=diffusing glazing, shade, screen or blind; // TH. 9/22/2009. CR 7625 - daylight illuminance spikes during some sunset hours due to the calculated sky and sun // related daylight factors > 1, which theoretically can occur when sun is perpendicular to the window @@ -3658,40 +3608,39 @@ void FigureMapPointDayltgFactorsToAddIllums(EnergyPlusData &state, auto &illumMap = dl->illumMaps(MapNum); auto &daylFacHr = illumMap.daylFac[iHour]; - for (int JSH = 1; JSH <= Material::MaxSlatAngs + 1; ++JSH) { - if (!state.dataSurface->SurfWinMovableSlats(IWin) && JSH > 2) break; + for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { auto const &gilsk = dl->horIllum[iHour]; - auto const &edirsk = dl->dirIllum(iHour, JSH); - auto const &eintsk = dl->reflIllum(iHour, JSH); - auto &illSky = daylFacHr(loopwin, iMapPoint, JSH); + auto const &edirsk = dl->dirIllum(iHour)[iWinCover]; + auto const &eintsk = dl->reflIllum(iHour)[iWinCover]; + auto &illSky = daylFacHr(loopwin, iMapPoint)[iWinCover]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { // Loop over sky types illSky.sky[iSky] = (gilsk.sky[iSky] > tmpDFCalc) ? ((edirsk.sky[iSky] + eintsk.sky[iSky]) / gilsk.sky[iSky]) : 0.0; } // for (iSky) if (dl->horIllum[iHour].sun > tmpDFCalc) { - daylFacHr(loopwin, iMapPoint, JSH).sun = - (dl->dirIllum(iHour, JSH).sun + dl->reflIllum(iHour, JSH).sun) / (dl->horIllum[iHour].sun + 0.0001); - daylFacHr(loopwin, iMapPoint, JSH).sunDisk = - (dl->dirIllum(iHour, JSH).sunDisk + dl->reflIllum(iHour, JSH).sunDisk) / (dl->horIllum[iHour].sun + 0.0001); + daylFacHr(loopwin, iMapPoint)[iWinCover].sun = + (dl->dirIllum(iHour)[iWinCover].sun + dl->reflIllum(iHour)[iWinCover].sun) / (dl->horIllum[iHour].sun + 0.0001); + daylFacHr(loopwin, iMapPoint)[iWinCover].sunDisk = + (dl->dirIllum(iHour)[iWinCover].sunDisk + dl->reflIllum(iHour)[iWinCover].sunDisk) / (dl->horIllum[iHour].sun + 0.0001); } else { - daylFacHr(loopwin, iMapPoint, JSH).sun = 0.0; - daylFacHr(loopwin, iMapPoint, JSH).sunDisk = 0.0; + daylFacHr(loopwin, iMapPoint)[iWinCover].sun = 0.0; + daylFacHr(loopwin, iMapPoint)[iWinCover].sunDisk = 0.0; } - } // for (jSH) + } // for (iWinCover) // For switchable glazing put daylighting factors for switched (dark) state in IS=2 location - if (ICtrl > 0 && state.dataSurface->WindowShadingControl(ICtrl).ShadingType == WinShadingType::SwitchableGlazing) { - Real64 VTR = state.dataSurface->SurfWinVisTransRatio(IWin); // ratio of Tvis of switched to unswitched state - auto &illSky2 = daylFacHr(loopwin, iMapPoint, 2); - auto const &illSky1 = daylFacHr(loopwin, iMapPoint, 1); + if (ICtrl > 0 && s_surf->WindowShadingControl(ICtrl).ShadingType == WinShadingType::SwitchableGlazing) { + Real64 VTR = s_surf->SurfWinVisTransRatio(IWin); // ratio of Tvis of switched to unswitched state + auto &illSky2 = daylFacHr(loopwin, iMapPoint)[iWinCover_Shaded]; + auto const &illSky1 = daylFacHr(loopwin, iMapPoint)[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { illSky2.sky[iSky] = illSky1.sky[iSky] * VTR; } - daylFacHr(loopwin, iMapPoint, 2).sun = daylFacHr(loopwin, iMapPoint, 1).sun * VTR; - daylFacHr(loopwin, iMapPoint, 2).sunDisk = daylFacHr(loopwin, iMapPoint, 1).sunDisk * VTR; + daylFacHr(loopwin, iMapPoint)[iWinCover_Shaded].sun = daylFacHr(loopwin, iMapPoint)[iWinCover_Bare].sun * VTR; + daylFacHr(loopwin, iMapPoint)[iWinCover_Shaded].sunDisk = daylFacHr(loopwin, iMapPoint)[iWinCover_Bare].sunDisk * VTR; } // ICtrl > 0 } @@ -3706,6 +3655,7 @@ void GetDaylightingParametersInput(EnergyPlusData &state) // This subroutine provides a simple structure to get all daylighting // parameters. auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; if (!dl->getDaylightingParametersInputFlag) return; dl->getDaylightingParametersInputFlag = false; @@ -3739,32 +3689,32 @@ void GetDaylightingParametersInput(EnergyPlusData &state) dl->maxEnclSubSurfaces = max(maxval(state.dataHeatBal->Zone, &DataHeatBalance::ZoneData::NumSubSurfaces), maxval(dl->enclDaylight, &EnclDaylightCalc::NumOfDayltgExtWins)); - for (int SurfNum : state.dataSurface->AllHTWindowSurfaceList) { - auto const &surf = state.dataSurface->Surface(SurfNum); + for (int SurfNum : s_surf->AllHTWindowSurfaceList) { + auto const &surf = s_surf->Surface(SurfNum); int const surfEnclNum = surf.SolarEnclIndex; int const numEnclRefPoints = state.dataViewFactor->EnclSolInfo(surfEnclNum).TotalEnclosureDaylRefPoints; - auto &surfWin = state.dataSurface->SurfaceWindow(SurfNum); + auto &surfWin = s_surf->SurfaceWindow(SurfNum); if (numEnclRefPoints > 0) { - if (!state.dataSurface->SurfWinSurfDayLightInit(SurfNum)) { + if (!s_surf->SurfWinSurfDayLightInit(SurfNum)) { surfWin.refPts.allocate(numEnclRefPoints); for (auto &refPt : surfWin.refPts) { new (&refPt) SurfaceWindowRefPt(); } - state.dataSurface->SurfWinSurfDayLightInit(SurfNum) = true; + s_surf->SurfWinSurfDayLightInit(SurfNum) = true; } } else { int SurfNumAdj = surf.ExtBoundCond; if (SurfNumAdj > 0) { - int const adjSurfEnclNum = state.dataSurface->Surface(SurfNumAdj).SolarEnclIndex; + int const adjSurfEnclNum = s_surf->Surface(SurfNumAdj).SolarEnclIndex; int const numAdjEnclRefPoints = state.dataViewFactor->EnclSolInfo(adjSurfEnclNum).TotalEnclosureDaylRefPoints; if (numAdjEnclRefPoints > 0) { - if (!state.dataSurface->SurfWinSurfDayLightInit(SurfNum)) { + if (!s_surf->SurfWinSurfDayLightInit(SurfNum)) { surfWin.refPts.allocate(numAdjEnclRefPoints); for (auto &refPt : surfWin.refPts) { new (&refPt) SurfaceWindowRefPt(); } - state.dataSurface->SurfWinSurfDayLightInit(SurfNum) = true; + s_surf->SurfWinSurfDayLightInit(SurfNum) = true; } } } @@ -3775,7 +3725,7 @@ void GetDaylightingParametersInput(EnergyPlusData &state) if (!surf.HasShadeControl) continue; auto &thisSurfEnclosure(state.dataViewFactor->EnclSolInfo(surf.SolarEnclIndex)); - if (state.dataSurface->WindowShadingControl(surf.activeWindowShadingControl).GlareControlIsActive) { + if (s_surf->WindowShadingControl(surf.activeWindowShadingControl).GlareControlIsActive) { // Error if GlareControlIsActive but window is not in a Daylighting:Detailed zone if (thisSurfEnclosure.TotalEnclosureDaylRefPoints == 0) { ShowSevereError(state, format("Window={} has Window Shading Control with", surf.Name)); @@ -3787,9 +3737,9 @@ void GetDaylightingParametersInput(EnergyPlusData &state) // an interior window adjacent to another Daylighting:Detailed zone/enclosure if (thisSurfEnclosure.TotalEnclosureDaylRefPoints > 0) { for (int const intWin : thisSurfEnclosure.SurfacePtr) { - int const SurfNumAdj = state.dataSurface->Surface(intWin).ExtBoundCond; - if (state.dataSurface->Surface(intWin).Class == SurfaceClass::Window && SurfNumAdj > 0) { - auto &adjSurfEnclosure(state.dataViewFactor->EnclSolInfo(state.dataSurface->Surface(SurfNumAdj).SolarEnclIndex)); + int const SurfNumAdj = s_surf->Surface(intWin).ExtBoundCond; + if (s_surf->Surface(intWin).Class == SurfaceClass::Window && SurfNumAdj > 0) { + auto &adjSurfEnclosure(state.dataViewFactor->EnclSolInfo(s_surf->Surface(SurfNumAdj).SolarEnclIndex)); if (adjSurfEnclosure.TotalEnclosureDaylRefPoints > 0) { ShowSevereError(state, format("Window={} has Window Shading Control with", surf.Name)); ShowContinueError(state, "GlareControlIsActive = Yes and is in a Daylighting zone or enclosure"); @@ -3802,8 +3752,7 @@ void GetDaylightingParametersInput(EnergyPlusData &state) } } - if (state.dataSurface->WindowShadingControl(surf.activeWindowShadingControl).shadingControlType != WindowShadingControlType::MeetDaylIlumSetp) - continue; + if (s_surf->WindowShadingControl(surf.activeWindowShadingControl).shadingControlType != WindowShadingControlType::MeetDaylIlumSetp) continue; // Error if window has shadingControlType = MeetDaylightingIlluminanceSetpoint & // but is not in a Daylighting:Detailed zone @@ -3818,9 +3767,9 @@ void GetDaylightingParametersInput(EnergyPlusData &state) // Error if window has shadingControlType = MeetDaylightIlluminanceSetpoint and is in a & // Daylighting:Detailed zone with an interior window adjacent to another Daylighting:Detailed zone for (int const intWin : thisSurfEnclosure.SurfacePtr) { - int const SurfNumAdj = state.dataSurface->Surface(intWin).ExtBoundCond; - if (state.dataSurface->Surface(intWin).Class == SurfaceClass::Window && SurfNumAdj > 0) { - auto &adjSurfEnclosure(state.dataViewFactor->EnclSolInfo(state.dataSurface->Surface(SurfNumAdj).SolarEnclIndex)); + int const SurfNumAdj = s_surf->Surface(intWin).ExtBoundCond; + if (s_surf->Surface(intWin).Class == SurfaceClass::Window && SurfNumAdj > 0) { + auto &adjSurfEnclosure(state.dataViewFactor->EnclSolInfo(s_surf->Surface(SurfNumAdj).SolarEnclIndex)); if (adjSurfEnclosure.TotalEnclosureDaylRefPoints > 0) { ShowSevereError(state, format("Window={} has Window Shading Control with", surf.Name)); ShowContinueError(state, "MeetDaylightIlluminanceSetpoint and is in a Daylighting zone or enclosure"); @@ -3833,8 +3782,8 @@ void GetDaylightingParametersInput(EnergyPlusData &state) } // for (SurfNum) if (!state.dataHeatBal->AnyAirBoundary) { - for (int SurfLoop = 1; SurfLoop <= state.dataSurface->TotSurfaces; ++SurfLoop) { - auto const &surf = state.dataSurface->Surface(SurfLoop); + for (int SurfLoop = 1; SurfLoop <= s_surf->TotSurfaces; ++SurfLoop) { + auto const &surf = s_surf->Surface(SurfLoop); if (surf.Class != SurfaceClass::Window || !surf.ExtSolar) continue; int const enclOfSurf = surf.SolarEnclIndex; @@ -3842,7 +3791,7 @@ void GetDaylightingParametersInput(EnergyPlusData &state) if (enclSol.TotalEnclosureDaylRefPoints == 0 || enclSol.HasInterZoneWindow || !dl->enclDaylight(enclOfSurf).hasSplitFluxDaylighting) continue; - auto &surfWin = state.dataSurface->SurfaceWindow(SurfLoop); + auto &surfWin = s_surf->SurfaceWindow(SurfLoop); for (int refPtNum = 1; refPtNum <= enclSol.TotalEnclosureDaylRefPoints; ++refPtNum) { auto &refPt = surfWin.refPts(refPtNum); SetupOutputVariable(state, @@ -3865,8 +3814,8 @@ void GetDaylightingParametersInput(EnergyPlusData &state) for (int enclNum = 1; enclNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclNum) { auto const &enclSol = state.dataViewFactor->EnclSolInfo(enclNum); for (int const enclSurfNum : enclSol.SurfacePtr) { - auto const &surf = state.dataSurface->Surface(enclSurfNum); - auto &surfWindow = state.dataSurface->SurfaceWindow(enclSurfNum); + auto const &surf = s_surf->Surface(enclSurfNum); + auto &surfWindow = s_surf->SurfaceWindow(enclSurfNum); if (surf.Class != SurfaceClass::Window || !surf.ExtSolar) continue; @@ -3996,6 +3945,7 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) // Perform the GetInput function for the Output:IlluminanceMap // Glazer - June 2016 (moved from GetDaylightingControls) auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; Array1D_bool ZoneMsgDone; @@ -4011,7 +3961,6 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) CheckForGeometricTransform(state, doTransform, OldAspectRatio, NewAspectRatio); - auto &ip = state.dataInputProcessing->inputProcessor; auto const &ipsc = state.dataIPShortCut; ipsc->cCurrentModuleObject = "Output:IlluminanceMap"; int TotIllumMaps = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); @@ -4022,6 +3971,7 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) int IOStat; int NumAlpha; int NumNumber; + auto &ip = state.dataInputProcessing->inputProcessor; for (int MapNum = 1; MapNum <= TotIllumMaps; ++MapNum) { ip->getObjectItem(state, ipsc->cCurrentModuleObject, @@ -4212,7 +4162,7 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) int iRefPt = (Y - 1) * illumMap.Xnum + X; auto &refPt = illumMap.refPts(iRefPt); - if (!state.dataSurface->DaylRefWorldCoordSystem) { + if (!s_surf->DaylRefWorldCoordSystem) { Real64 Xb = refPt.absCoords.x * CosZoneRelNorth - refPt.absCoords.y * SinZoneRelNorth + zone.OriginX; Real64 Yb = refPt.absCoords.x * SinZoneRelNorth + refPt.absCoords.y * CosZoneRelNorth + zone.OriginY; refPt.absCoords.x = Xb * CosBldgRelNorth - Yb * SinBldgRelNorth; @@ -4659,6 +4609,7 @@ void GeometryTransformForDaylighting(EnergyPlusData &state) // MODIFIED Glazer - July 2016 - separated this from GetInput function // For splitflux daylighting, transform the geometry auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; // Calc cos and sin of Building Relative North values for later use in transforming Reference Point coordinates Real64 CosBldgRelNorth = std::cos(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRadians); @@ -4686,7 +4637,7 @@ void GeometryTransformForDaylighting(EnergyPlusData &state) auto &refPt = daylCntrl.refPts(refPtNum); auto &curRefPt = dl->DaylRefPt(refPt.num); // get the active daylighting:referencepoint curRefPt.indexToFracAndIllum = refPtNum; // back reference to the index to the ZoneDaylight structure arrays related to reference points - if (state.dataSurface->DaylRefWorldCoordSystem) { + if (s_surf->DaylRefWorldCoordSystem) { // transform only by appendix G rotation refPt.absCoords.x = curRefPt.coords.x * CosBldgRotAppGonly - curRefPt.coords.y * SinBldgRotAppGonly; refPt.absCoords.y = curRefPt.coords.x * SinBldgRotAppGonly + curRefPt.coords.y * CosBldgRotAppGonly; @@ -4784,7 +4735,7 @@ void GetInputDayliteRefPt(EnergyPlusData &state, bool &ErrorsFound) { // Perform GetInput function for the Daylighting:ReferencePoint object // Glazer - July 2016 - auto &dl = state.dataDayltg; + auto const &dl = state.dataDayltg; auto &ip = state.dataInputProcessing->inputProcessor; auto const &ipsc = state.dataIPShortCut; ipsc->cCurrentModuleObject = "Daylighting:ReferencePoint"; @@ -4832,7 +4783,7 @@ void GetInputDayliteRefPt(EnergyPlusData &state, bool &ErrorsFound) bool doesDayLightingUseDElight(EnergyPlusData &state) { - auto &dl = state.dataDayltg; + auto const &dl = state.dataDayltg; for (auto const &znDayl : dl->daylightControl) { if (znDayl.DaylightMethod == DaylightingMethod::DElight) { return true; @@ -4858,12 +4809,14 @@ void CheckTDDsAndLightShelvesInDaylitZones(EnergyPlusData &state) // loop thru daylighting devices and check that their zones have daylight controls // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + auto &s_surf = state.dataSurface; + bool ErrorsFound = false; for (auto const &pipe : state.dataDaylightingDevicesData->TDDPipe) { int SurfNum = pipe.Diffuser; if (SurfNum > 0) { - int const pipeEnclNum = state.dataSurface->Surface(SurfNum).SolarEnclIndex; + int const pipeEnclNum = s_surf->Surface(SurfNum).SolarEnclIndex; if (state.dataViewFactor->EnclSolInfo(pipeEnclNum).TotalEnclosureDaylRefPoints == 0) { ShowWarningError(state, format("DaylightingDevice:Tubular = {}: is not connected to a Zone that has Daylighting, no visible transmittance " @@ -4891,7 +4844,9 @@ void CheckTDDsAndLightShelvesInDaylitZones(EnergyPlusData &state) void AssociateWindowShadingControlWithDaylighting(EnergyPlusData &state) { auto &dl = state.dataDayltg; - for (auto &winShadeControl : state.dataSurface->WindowShadingControl) { + auto &s_surf = state.dataSurface; + + for (auto &winShadeControl : s_surf->WindowShadingControl) { if (winShadeControl.DaylightingControlName.empty()) continue; int found = -1; for (int daylightCtrlNum = 1; daylightCtrlNum <= (int)dl->daylightControl.size(); ++daylightCtrlNum) { @@ -4937,6 +4892,7 @@ void GetLightWellData(EnergyPlusData &state, bool &ErrorsFound) // If errors fou int TotLightWells; // Total Light Well objects auto &ip = state.dataInputProcessing->inputProcessor; + auto &s_surf = state.dataSurface; auto const &ipsc = state.dataIPShortCut; // Get the total number of Light Well objects @@ -4959,7 +4915,7 @@ void GetLightWellData(EnergyPlusData &state, bool &ErrorsFound) // If errors fou ipsc->cAlphaFieldNames, ipsc->cNumericFieldNames); - int SurfNum = Util::FindItemInList(ipsc->cAlphaArgs(1), state.dataSurface->Surface); + int SurfNum = Util::FindItemInList(ipsc->cAlphaArgs(1), s_surf->Surface); if (SurfNum == 0) { ShowSevereError(state, format("{}: invalid {}=\"{}\" not found.", ipsc->cCurrentModuleObject, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); @@ -4967,8 +4923,8 @@ void GetLightWellData(EnergyPlusData &state, bool &ErrorsFound) // If errors fou continue; } - auto const &surf = state.dataSurface->Surface(SurfNum); - auto &surfWin = state.dataSurface->SurfaceWindow(SurfNum); + auto const &surf = s_surf->Surface(SurfNum); + auto &surfWin = s_surf->SurfaceWindow(SurfNum); // Check that associated surface is an exterior window // True if associated surface is not an exterior window if (surf.Class != SurfaceClass::Window && surf.ExtBoundCond != ExternalEnvironment) { @@ -4988,7 +4944,7 @@ void GetLightWellData(EnergyPlusData &state, bool &ErrorsFound) // If errors fou Real64 VisReflWell = ipsc->rNumericArgs(4); // Area-weighted visible reflectance of well walls // Warning if light well area is less than window area - if (AreaWell < (surf.Area + state.dataSurface->SurfWinDividerArea(SurfNum) - 0.1)) { + if (AreaWell < (surf.Area + s_surf->SurfWinDividerArea(SurfNum) - 0.1)) { ShowSevereError(state, format("{}: invalid {}=\"{}\" - Areas.", ipsc->cCurrentModuleObject, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); ShowContinueError(state, format("has Area of Bottom of Well={:.1R} that is less than window area={:.1R}", surf.Area, AreaWell)); @@ -5001,15 +4957,16 @@ void GetLightWellData(EnergyPlusData &state, bool &ErrorsFound) // If errors fou } // End of loop over light well objects } // GetLightWellData() -inline int findWinShadingStatus(EnergyPlusData &state, int const IWin) +inline WinCover findWinShadingStatus(EnergyPlusData &state, int const IWin) { // Return the window shading status, 1=unshaded, 2=shaded - bool WinShadedNoGlareControl = IS_SHADED_NO_GLARE_CTRL(state.dataSurface->SurfWinShadingFlag(IWin)); - return ((state.dataSurface->SurfWinWindowModelType(IWin) != WindowModel::BSDF) && - (WinShadedNoGlareControl || state.dataSurface->SurfWinSolarDiffusing(IWin))) - ? 2 - : 1; + auto &s_surf = state.dataSurface; + bool WinShadedNoGlareControl = IS_SHADED_NO_GLARE_CTRL(s_surf->SurfWinShadingFlag(IWin)); + + return ((s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF) && (WinShadedNoGlareControl || s_surf->SurfWinSolarDiffusing(IWin))) + ? WinCover::Shaded + : WinCover::Bare; } Real64 DayltgGlare(EnergyPlusData &state, @@ -5047,12 +5004,12 @@ Real64 DayltgGlare(EnergyPlusData &state, auto &thisEnclDaylight = dl->enclDaylight(thisDayltgCtrl.enclIndex); for (int loop = 1; loop <= thisEnclDaylight.NumOfDayltgExtWins; ++loop) { int IWin = thisEnclDaylight.DayltgExtWinSurfNums(loop); - int WinShadingIndex = findWinShadingStatus(state, IWin); + WinCover winCover = findWinShadingStatus(state, IWin); // Conversion from ft-L to cd/m2, with cd/m2 = 0.2936 ft-L, gives the 0.4794 factor // below, which is (0.2936)**0.6 auto const &extWin = thisDayltgCtrl.refPts(IL).extWins(loop); - Real64 GTOT1 = 0.4794 * (std::pow(extWin.lums[iLum_Source][WinShadingIndex - 1], 1.6)) * std::pow(extWin.solidAngWtd, 0.8); - Real64 GTOT2 = BLUM + 0.07 * std::sqrt(extWin.solidAng) * extWin.lums[iLum_Source][WinShadingIndex - 1]; + Real64 GTOT1 = 0.4794 * (std::pow(extWin.lums[iLum_Source][(int)winCover], 1.6)) * std::pow(extWin.solidAngWtd, 0.8); + Real64 GTOT2 = BLUM + 0.07 * std::sqrt(extWin.solidAng) * extWin.lums[iLum_Source][(int)winCover]; GTOT += GTOT1 / (GTOT2 + 0.000001); } @@ -5097,12 +5054,12 @@ void DayltgGlareWithIntWins(EnergyPlusData &state, // Loop over exterior windows associated with zone for (int loop = 1; loop <= thisEnclDaylight.NumOfDayltgExtWins; ++loop) { int IWin = thisEnclDaylight.DayltgExtWinSurfNums(loop); - int WinShadingIndex = findWinShadingStatus(state, IWin); + WinCover winCover = findWinShadingStatus(state, IWin); // Conversion from ft-L to cd/m2, with cd/m2 = 0.2936 ft-L, gives the 0.4794 factor // below, which is (0.2936)**0.6 auto const &extWin = thisDayltgCtrl.refPts(IL).extWins(loop); - Real64 GTOT1 = 0.4794 * (std::pow(extWin.lums[iLum_Source][WinShadingIndex - 1], 1.6)) * std::pow(extWin.solidAngWtd, 0.8); - Real64 GTOT2 = BackgroundLum + 0.07 * std::sqrt(extWin.solidAng) * extWin.lums[iLum_Source][WinShadingIndex - 1]; + Real64 GTOT1 = 0.4794 * (std::pow(extWin.lums[iLum_Source][(int)winCover], 1.6)) * std::pow(extWin.solidAngWtd, 0.8); + Real64 GTOT2 = BackgroundLum + 0.07 * std::sqrt(extWin.solidAng) * extWin.lums[iLum_Source][(int)winCover]; GTOT += GTOT1 / (GTOT2 + 0.000001); } @@ -5207,22 +5164,23 @@ Real64 DayltgHitObstruction(EnergyPlusData &state, // REFERENCES: // Based on DOE-2.1E subroutine DHITSH. + auto &s_surf = state.dataSurface; // Local declarations bool hit; // True iff a particular obstruction is hit Real64 ObTrans = 1.0; - auto const &window = state.dataSurface->Surface(IWin); + auto const &window = s_surf->Surface(IWin); int const window_iBaseSurf = window.BaseSurf; Vector3 DayltgHitObstructionHP; // Loop over potentially obstructing surfaces, which can be building elements, like walls, or shadowing surfaces, like overhangs // Building elements are assumed to be opaque // A shadowing surface is opaque unless its transmittance schedule value is non-zero - if (state.dataSurface->TotSurfaces < octreeCrossover) { // Linear search through surfaces + if (s_surf->TotSurfaces < octreeCrossover) { // Linear search through surfaces - for (int ISurf : state.dataSurface->AllShadowPossObstrSurfaceList) { - auto const &surface = state.dataSurface->Surface(ISurf); + for (int ISurf : s_surf->AllShadowPossObstrSurfaceList) { + auto const &surface = s_surf->Surface(ISurf); SurfaceClass IType = surface.Class; if ((IType == SurfaceClass::Wall || IType == SurfaceClass::Roof || IType == SurfaceClass::Floor) && (ISurf != window_iBaseSurf)) { hit = PierceSurface(state, ISurf, R1, RN, DayltgHitObstructionHP); @@ -5248,7 +5206,7 @@ Real64 DayltgHitObstruction(EnergyPlusData &state, } else { // Surface octree search - auto const &window_base(window_iBaseSurf > 0 ? state.dataSurface->Surface(window_iBaseSurf) : window); + auto const &window_base(window_iBaseSurf > 0 ? s_surf->Surface(window_iBaseSurf) : window); auto const *window_base_p(&window_base); // Lambda function for the octree to test for surface hit and update transmittance if hit @@ -5303,6 +5261,8 @@ bool DayltgHitInteriorObstruction(EnergyPlusData &state, // PURPOSE OF THIS SUBROUTINE: // This subroutine checks for interior obstructions between reference point and window element. + auto &s_surf = state.dataSurface; + // Preconditions assert(magnitude(R2 - R1) > 0.0); // Protect normalize() from divide by zero @@ -5310,19 +5270,19 @@ bool DayltgHitInteriorObstruction(EnergyPlusData &state, Vector3 RN = (R2 - R1).normalize(); // Make unit vector Real64 const d12 = distance(R1, R2); // Distance between R1 and R2 - auto const &window = state.dataSurface->Surface(IWin); + auto const &window = s_surf->Surface(IWin); int const window_Enclosure = window.SolarEnclIndex; int const window_iBaseSurf = window.BaseSurf; - auto const &window_base = window_iBaseSurf > 0 ? state.dataSurface->Surface(window_iBaseSurf) : window; + auto const &window_base = window_iBaseSurf > 0 ? s_surf->Surface(window_iBaseSurf) : window; int const window_base_iExtBoundCond = window_base.ExtBoundCond; // Loop over potentially obstructing surfaces, which can be building elements, like walls, or shadowing surfaces, like overhangs - if (state.dataSurface->TotSurfaces < octreeCrossover) { // Linear search through surfaces + if (s_surf->TotSurfaces < octreeCrossover) { // Linear search through surfaces // Hit coordinates, if ray hits an obstruction Vector3 DayltgHitInteriorObstructionHP; - for (int ISurf = 1; ISurf <= state.dataSurface->TotSurfaces; ++ISurf) { - auto const &surface = state.dataSurface->Surface(ISurf); + for (int ISurf = 1; ISurf <= s_surf->TotSurfaces; ++ISurf) { + auto const &surface = s_surf->Surface(ISurf); SurfaceClass IType = surface.Class; if ((surface.IsShadowing) || // Shadowing surface ((surface.SolarEnclIndex == window_Enclosure) && // Wall/ceiling/floor is in same zone as window @@ -5337,7 +5297,7 @@ bool DayltgHitInteriorObstruction(EnergyPlusData &state, } else { // Surface octree search auto const *window_base_p = &window_base; - auto const &window_base_adjacent = window_base_iExtBoundCond > 0 ? state.dataSurface->Surface(window_base_iExtBoundCond) : window_base; + auto const &window_base_adjacent = window_base_iExtBoundCond > 0 ? s_surf->Surface(window_base_iExtBoundCond) : window_base; auto const *window_base_adjacent_p = &window_base_adjacent; // Lambda function for the octree to test for surface hit @@ -5380,6 +5340,8 @@ bool DayltgHitBetWinObstruction(EnergyPlusData &state, // Determines if a ray from point R1 on window IWin1 to point R2 // on window IWin2 hits an obstruction + auto &s_surf = state.dataSurface; + // Preconditions assert(magnitude(R2 - R1) > 0.0); // Protect normalize() from divide by zero @@ -5391,15 +5353,15 @@ bool DayltgHitBetWinObstruction(EnergyPlusData &state, Real64 const d12 = distance(R1, R2); // Distance between R1 and R2 (m) - auto const &window1 = state.dataSurface->Surface(IWin1); + auto const &window1 = s_surf->Surface(IWin1); int const window1_iBaseSurf = window1.BaseSurf; - auto const &window1_base = window1_iBaseSurf > 0 ? state.dataSurface->Surface(window1_iBaseSurf) : window1; + auto const &window1_base = window1_iBaseSurf > 0 ? s_surf->Surface(window1_iBaseSurf) : window1; int const window1_base_iExtBoundCond = window1_base.ExtBoundCond; - auto const &window2 = state.dataSurface->Surface(IWin2); + auto const &window2 = s_surf->Surface(IWin2); int const window2_Enclosure = window2.SolarEnclIndex; int const window2_iBaseSurf = window2.BaseSurf; - auto const &window2_base = window2_iBaseSurf > 0 ? state.dataSurface->Surface(window2_iBaseSurf) : window2; + auto const &window2_base = window2_iBaseSurf > 0 ? s_surf->Surface(window2_iBaseSurf) : window2; int const window2_base_iExtBoundCond = window2_base.ExtBoundCond; // Preconditions @@ -5407,10 +5369,10 @@ bool DayltgHitBetWinObstruction(EnergyPlusData &state, // of only checking for wall/roof/floor for window2 zone below? // Loop over potentially obstructing surfaces, which can be building elements, like walls, or shadowing surfaces, like overhangs - if (state.dataSurface->TotSurfaces < octreeCrossover) { // Linear search through surfaces + if (s_surf->TotSurfaces < octreeCrossover) { // Linear search through surfaces - for (int ISurf = 1; ISurf <= state.dataSurface->TotSurfaces; ++ISurf) { - auto const &surface = state.dataSurface->Surface(ISurf); + for (int ISurf = 1; ISurf <= s_surf->TotSurfaces; ++ISurf) { + auto const &surface = s_surf->Surface(ISurf); IType = surface.Class; if ((surface.IsShadowing) || // Shadowing surface ((surface.SolarEnclIndex == window2_Enclosure) && // Wall/ceiling/floor is in same zone as windows @@ -5427,11 +5389,11 @@ bool DayltgHitBetWinObstruction(EnergyPlusData &state, } else { // Surface octree search auto const *window1_base_p = &window1_base; - auto const &window1_base_adjacent = window1_base_iExtBoundCond > 0 ? state.dataSurface->Surface(window1_base_iExtBoundCond) : window1_base; + auto const &window1_base_adjacent = window1_base_iExtBoundCond > 0 ? s_surf->Surface(window1_base_iExtBoundCond) : window1_base; auto const *window1_base_adjacent_p = &window1_base_adjacent; auto const *window2_base_p = &window2_base; - auto const &window2_base_adjacent = (window2_base_iExtBoundCond > 0) ? state.dataSurface->Surface(window2_base_iExtBoundCond) : window2_base; + auto const &window2_base_adjacent = (window2_base_iExtBoundCond > 0) ? s_surf->Surface(window2_base_iExtBoundCond) : window2_base; auto const *window2_base_adjacent_p = &window2_base_adjacent; // Lambda function for the octree to test for surface hit @@ -5464,9 +5426,10 @@ void initDaylighting(EnergyPlusData &state, bool const initSurfaceHeatBalancefir // simulate lighting control system to get overhead electric lighting reduction // factor due to daylighting. auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; - for (int SurfNum : state.dataSurface->AllExtSolWindowSurfaceList) { - for (auto &refPt : state.dataSurface->SurfaceWindow(SurfNum).refPts) { + for (int SurfNum : s_surf->AllExtSolWindowSurfaceList) { + for (auto &refPt : s_surf->SurfaceWindow(SurfNum).refPts) { refPt.illumFromWinRep = refPt.lumWinRep = 0.0; } } @@ -5507,8 +5470,8 @@ void initDaylighting(EnergyPlusData &state, bool const initSurfaceHeatBalancefir for (int extWinNum = 1; extWinNum <= thisEnclDaylight.NumOfDayltgExtWins; ++extWinNum) { int IWin = thisEnclDaylight.DayltgExtWinSurfNums(extWinNum); WinCover winCover = WinCover::Bare; - if (state.dataSurface->SurfWinWindowModelType(IWin) != WindowModel::BSDF && - (IS_SHADED(state.dataSurface->SurfWinShadingFlag(IWin)) || state.dataSurface->SurfWinSolarDiffusing(IWin))) { + if (s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF && + (IS_SHADED(s_surf->SurfWinShadingFlag(IWin)) || s_surf->SurfWinSolarDiffusing(IWin))) { winCover = WinCover::Shaded; } int refPtCount = 0; @@ -5518,7 +5481,7 @@ void initDaylighting(EnergyPlusData &state, bool const initSurfaceHeatBalancefir for (int refPtNum = 1; refPtNum <= daylCtrl.TotalDaylRefPoints; ++refPtNum) { ++refPtCount; // Count reference points across each daylighting control in the same enclosure - auto &refPt = state.dataSurface->SurfaceWindow(IWin).refPts(refPtCount); + auto &refPt = s_surf->SurfaceWindow(IWin).refPts(refPtCount); auto const &daylCtrlRefPt = daylCtrl.refPts(refPtNum); refPt.illumFromWinRep = daylCtrlRefPt.extWins(extWinNum).lums[iLum_Illum][(int)winCover]; refPt.lumWinRep = daylCtrlRefPt.extWins(extWinNum).lums[iLum_Source][(int)winCover]; @@ -5649,11 +5612,11 @@ void initDaylighting(EnergyPlusData &state, bool const initSurfaceHeatBalancefir for (int const spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.WindowSurfaceFirst; SurfNum <= thisSpace.WindowSurfaceLast; ++SurfNum) { - state.dataSurface->SurfWinFracTimeShadingDeviceOn(SurfNum) = 0.0; - if (IS_SHADED(state.dataSurface->SurfWinShadingFlag(SurfNum))) { - state.dataSurface->SurfWinFracTimeShadingDeviceOn(SurfNum) = 1.0; + s_surf->SurfWinFracTimeShadingDeviceOn(SurfNum) = 0.0; + if (IS_SHADED(s_surf->SurfWinShadingFlag(SurfNum))) { + s_surf->SurfWinFracTimeShadingDeviceOn(SurfNum) = 1.0; } else { - state.dataSurface->SurfWinFracTimeShadingDeviceOn(SurfNum) = 0.0; + s_surf->SurfWinFracTimeShadingDeviceOn(SurfNum) = 0.0; } } } @@ -5666,7 +5629,7 @@ void manageDaylighting(EnergyPlusData &state) if (state.dataEnvrn->SunIsUp && (state.dataEnvrn->BeamSolarRad + state.dataEnvrn->GndSolarRad + state.dataEnvrn->DifSolarRad > 0.0)) { for (int enclNum = 1; enclNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclNum) { - auto &enclSol = state.dataViewFactor->EnclSolInfo(enclNum); + auto const &enclSol = state.dataViewFactor->EnclSolInfo(enclNum); if (enclSol.TotalEnclosureDaylRefPoints == 0 || !enclSol.HasInterZoneWindow) continue; DayltgInterReflIllFrIntWins(state, enclNum); @@ -5719,6 +5682,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, // REFERENCES: // Based on DOE-2.1E subroutine DINTIL. auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; Real64 constexpr tmpSWIterStep(0.05); // step of switching factor, assuming maximum of 20 switching states @@ -5734,7 +5698,6 @@ void DayltgInteriorIllum(EnergyPlusData &state, int ISWFLG; // Switchable glazing flag: =1 if one or more windows in a zone // has switchable glazing that adjusts visible transmittance to just meet // daylighting setpoint; =0 otherwise. - int ICtrl; // Window shading control pointer Real64 VTRAT; // Ratio between switched and unswitched visible transmittance at normal incidence Real64 BACL; // Window background (surround) luminance for glare calc (cd/m2) Real64 SkyWeight; // Weighting factor used to average two different sky types @@ -5840,21 +5803,21 @@ void DayltgInteriorIllum(EnergyPlusData &state, // Added TH 6/29/2009 for thermochromic windows VTRatio = 1.0; if (NREFPT > 0) { - int const IConst = state.dataSurface->Surface(IWin).Construction; + int const IConst = s_surf->Surface(IWin).Construction; auto const &construction = state.dataConstruction->Construct(IConst); - if (construction.TCFlag == 1) { + if (construction.isTCWindow) { // 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 = General::POLYF(1.0, construction.TransVisBeamCoef); - VTMaster = General::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConst).TransVisBeamCoef); + VTMaster = General::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); VTRatio = VTNow / VTMaster; } } - bool ShadedOrDiffusingGlassWin = state.dataSurface->SurfWinWindowModelType(IWin) != WindowModel::BSDF && - (IS_SHADED(state.dataSurface->SurfWinShadingFlag(IWin)) || state.dataSurface->SurfWinSolarDiffusing(IWin)); + bool ShadedOrDiffusingGlassWin = s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF && + (IS_SHADED(s_surf->SurfWinShadingFlag(IWin)) || s_surf->SurfWinSolarDiffusing(IWin)); Real64 wgtCurrHr = state.dataGlobal->WeightNow; Real64 wgtPrevHr = state.dataGlobal->WeightPreviousHour; @@ -5866,8 +5829,8 @@ void DayltgInteriorIllum(EnergyPlusData &state, // Loop over reference points for (int IL = 1; IL <= NREFPT; ++IL) { - auto const &daylFacCurr = thisDayltgCtrl.daylFac[state.dataGlobal->HourOfDay](loop, IL, 1); - auto const &daylFacPrev = thisDayltgCtrl.daylFac[state.dataGlobal->PreviousHour](loop, IL, 1); + auto const &daylFacCurr = thisDayltgCtrl.daylFac[state.dataGlobal->HourOfDay](loop, IL)[iWinCover_Bare]; + auto const &daylFacPrev = thisDayltgCtrl.daylFac[state.dataGlobal->PreviousHour](loop, IL)[iWinCover_Bare]; // Daylight factors for current sun position auto const &illFacCurr = daylFacCurr[iLum_Illum]; auto const &illFacPrev = daylFacPrev[iLum_Illum]; @@ -5879,8 +5842,8 @@ void DayltgInteriorIllum(EnergyPlusData &state, auto const &sourceFacPrev = daylFacPrev[iLum_Source]; auto &sfhr = SFHR[iWinCover_Bare]; - auto const &daylFac2Curr = thisDayltgCtrl.daylFac[state.dataGlobal->HourOfDay](loop, IL, 2); - auto const &daylFac2Prev = thisDayltgCtrl.daylFac[state.dataGlobal->PreviousHour](loop, IL, 2); + auto const &daylFac2Curr = thisDayltgCtrl.daylFac[state.dataGlobal->HourOfDay](loop, IL)[iWinCover_Shaded]; + auto const &daylFac2Prev = thisDayltgCtrl.daylFac[state.dataGlobal->PreviousHour](loop, IL)[iWinCover_Shaded]; auto const &illFac2Curr = daylFac2Curr[iLum_Illum]; auto const &illFac2Prev = daylFac2Prev[iLum_Illum]; @@ -5892,31 +5855,19 @@ void DayltgInteriorIllum(EnergyPlusData &state, auto const &sourceFac2Prev = daylFac2Prev[iLum_Source]; auto &sfhr2 = SFHR[iWinCover_Shaded]; - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(IWin); - int slatAngLo = SurfWinSlatsAngIndex + 1; - int slatAngHi = min(Material::MaxSlatAngs + 1, slatAngLo + 1); - Real64 interpFac = state.dataSurface->SurfWinSlatsAngInterpFac(IWin); - - auto const &daylFacLoCurr = thisDayltgCtrl.daylFac[state.dataGlobal->HourOfDay](loop, IL, slatAngLo); - auto const &daylFacLoPrev = thisDayltgCtrl.daylFac[state.dataGlobal->PreviousHour](loop, IL, slatAngLo); - auto const &daylFacHiCurr = thisDayltgCtrl.daylFac[state.dataGlobal->HourOfDay](loop, IL, slatAngHi); - auto const &daylFacHiPrev = thisDayltgCtrl.daylFac[state.dataGlobal->PreviousHour](loop, IL, slatAngHi); +#ifdef GET_OUT + auto const &daylFacShCurr = thisDayltgCtrl.daylFac[state.dataGlobal->HourOfDay](loop, IL)[iWinCover_Shaded]; + auto const &daylFacShPrev = thisDayltgCtrl.daylFac[state.dataGlobal->PreviousHour](loop, IL)[iWinCover_Shaded]; - auto const &illFacLoCurr = daylFacLoCurr[iLum_Illum]; - auto const &illFacLoPrev = daylFacLoPrev[iLum_Illum]; - auto const &illFacHiCurr = daylFacHiCurr[iLum_Illum]; - auto const &illFacHiPrev = daylFacHiPrev[iLum_Illum]; + auto const &illFacShCurr = daylFacShCurr[iLum_Illum]; + auto const &illFacShPrev = daylFacShPrev[iLum_Illum]; - auto const &backFacLoCurr = daylFacLoCurr[iLum_Back]; - auto const &backFacLoPrev = daylFacLoPrev[iLum_Back]; - auto const &backFacHiCurr = daylFacHiCurr[iLum_Back]; - auto const &backFacHiPrev = daylFacHiPrev[iLum_Back]; - - auto const &sourceFacLoCurr = daylFacLoCurr[iLum_Source]; - auto const &sourceFacLoPrev = daylFacLoPrev[iLum_Source]; - auto const &sourceFacHiCurr = daylFacHiCurr[iLum_Source]; - auto const &sourceFacHiPrev = daylFacHiPrev[iLum_Source]; + auto const &backFacShCurr = daylFacShCurr[iLum_Back]; + auto const &backFacShPrev = daylFacShPrev[iLum_Back]; + auto const &sourceFacShCurr = daylFacShCurr[iLum_Source]; + auto const &sourceFacShPrev = daylFacShPrev[iLum_Source]; +#endif // GET_OUT for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { // ===Bare window=== @@ -5928,28 +5879,12 @@ void DayltgInteriorIllum(EnergyPlusData &state, if (ShadedOrDiffusingGlassWin) { // ===Shaded window or window with diffusing glass=== - if (!state.dataSurface->SurfWinMovableSlats(IWin)) { - // Shade, screen, blind with fixed slats, or diffusing glass - dfhr2.sky[iSky] = VTRatio * (wgtCurrHr * illFac2Curr.sky[iSky] + wgtPrevHr * illFac2Prev.sky[iSky]); - bfhr2.sky[iSky] = VTRatio * (wgtCurrHr * backFac2Curr.sky[iSky] + wgtPrevHr * backFac2Prev.sky[iSky]); - sfhr2.sky[iSky] = VTRatio * (wgtCurrHr * sourceFac2Curr.sky[iSky] + wgtPrevHr * sourceFac2Prev.sky[iSky]); - - } else { // Blind with movable slats - Real64 illSkyCurr = General::Interp(illFacLoCurr.sky[iSky], illFacHiCurr.sky[iSky], interpFac); - Real64 backSkyCurr = General::Interp(backFacLoCurr.sky[iSky], backFacHiCurr.sky[iSky], interpFac); - Real64 sourceSkyCurr = General::Interp(sourceFacLoCurr.sky[iSky], sourceFacHiCurr.sky[iSky], interpFac); - - Real64 illSkyPrev = General::Interp(illFacLoPrev.sky[iSky], illFacHiPrev.sky[iSky], interpFac); - Real64 backSkyPrev = General::Interp(backFacLoPrev.sky[iSky], backFacHiPrev.sky[iSky], interpFac); - Real64 sourceSkyPrev = General::Interp(sourceFacLoPrev.sky[iSky], sourceFacHiPrev.sky[iSky], interpFac); - - dfhr2.sky[iSky] = VTRatio * (wgtCurrHr * illSkyCurr + wgtPrevHr * illSkyPrev); - bfhr2.sky[iSky] = VTRatio * (wgtCurrHr * backSkyCurr + wgtPrevHr * backSkyPrev); - sfhr2.sky[iSky] = VTRatio * (wgtCurrHr * sourceSkyCurr + wgtPrevHr * sourceSkyPrev); - - } // End of check if window has blind with movable slats - } // End of check if window is shaded or has diffusing glass - } // for (iSky) + // Shade, screen, blind with fixed slats, or diffusing glass + dfhr2.sky[iSky] = VTRatio * (wgtCurrHr * illFac2Curr.sky[iSky] + wgtPrevHr * illFac2Prev.sky[iSky]); + bfhr2.sky[iSky] = VTRatio * (wgtCurrHr * backFac2Curr.sky[iSky] + wgtPrevHr * backFac2Prev.sky[iSky]); + sfhr2.sky[iSky] = VTRatio * (wgtCurrHr * sourceFac2Curr.sky[iSky] + wgtPrevHr * sourceFac2Prev.sky[iSky]); + } // End of check if window is shaded or has diffusing glass + } // for (iSky) // Sun daylight factor for bare/shaded window DFHR[iWinCover_Bare].sun = @@ -5966,49 +5901,18 @@ void DayltgInteriorIllum(EnergyPlusData &state, if (ShadedOrDiffusingGlassWin) { // ===Shaded window or window with diffusing glass=== - if (!state.dataSurface->SurfWinMovableSlats(IWin)) { - // Shade, screen, blind with fixed slats, or diffusing glass - DFHR[iWinCover_Shaded].sun = VTRatio * (wgtCurrHr * illFac2Curr.sun + wgtPrevHr * illFac2Prev.sun); - BFHR[iWinCover_Shaded].sun = VTRatio * (wgtCurrHr * backFac2Curr.sun + wgtPrevHr * backFac2Prev.sun); - SFHR[iWinCover_Shaded].sun = VTRatio * (wgtCurrHr * sourceFac2Curr.sun + wgtPrevHr * sourceFac2Prev.sun); - - if (!state.dataSurface->SurfWinSlatsBlockBeam(IWin)) { - DFHR[iWinCover_Shaded].sun += VTRatio * (wgtCurrHr * illFac2Curr.sunDisk + wgtPrevHr * illFac2Prev.sunDisk); - BFHR[iWinCover_Shaded].sun += VTRatio * (wgtCurrHr * backFac2Curr.sunDisk + wgtPrevHr * backFac2Prev.sunDisk); - SFHR[iWinCover_Shaded].sun += VTRatio * (wgtCurrHr * sourceFac2Curr.sunDisk + wgtPrevHr * sourceFac2Prev.sunDisk); - } - - } else { // Blind with movable slats - // int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(IWin); - // int slatAngLo = SurfWinSlatsAngIndex + 1; - // int slatAngHi = min(Material::MaxSlatAngs + 1, slatAngLo + 1); - Real64 SurfWinSlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(IWin); - - Real64 DaylIllFacSunNow = General::Interp(illFacLoCurr.sun, illFacHiCurr.sun, SurfWinSlatsAngInterpFac); - Real64 DaylBackFacSunNow = General::Interp(backFacLoCurr.sun, backFacHiCurr.sun, SurfWinSlatsAngInterpFac); - Real64 DaylSourceFacSunNow = General::Interp(sourceFacLoCurr.sun, sourceFacHiCurr.sun, SurfWinSlatsAngInterpFac); - Real64 DaylIllFacSunPrev = General::Interp(illFacLoPrev.sun, illFacHiPrev.sun, SurfWinSlatsAngInterpFac); - Real64 DaylBackFacSunPrev = General::Interp(backFacLoPrev.sun, backFacHiPrev.sun, SurfWinSlatsAngInterpFac); - Real64 DaylSourceFacSunPrev = General::Interp(sourceFacLoPrev.sun, sourceFacHiPrev.sun, SurfWinSlatsAngInterpFac); - DFHR[iWinCover_Shaded].sun = VTRatio * (wgtCurrHr * DaylIllFacSunNow + wgtPrevHr * DaylIllFacSunPrev); - BFHR[iWinCover_Shaded].sun = VTRatio * (wgtCurrHr * DaylBackFacSunNow + wgtPrevHr * DaylBackFacSunPrev); - SFHR[iWinCover_Shaded].sun = VTRatio * (wgtCurrHr * DaylSourceFacSunNow + wgtPrevHr * DaylSourceFacSunPrev); - - // We add the contribution from the solar disk if slats do not block beam solar - // TH CR 8010, DaylIllFacSunDisk needs to be interpolated - if (!state.dataSurface->SurfWinSlatsBlockBeam(IWin)) { - Real64 DaylIllFacSunDiskNow = General::Interp(illFacLoCurr.sunDisk, illFacHiCurr.sunDisk, SurfWinSlatsAngInterpFac); - Real64 DaylBackFacSunDiskNow = General::Interp(backFacLoCurr.sunDisk, backFacHiCurr.sunDisk, SurfWinSlatsAngInterpFac); - Real64 DaylSourceFacSunDiskNow = General::Interp(sourceFacLoCurr.sunDisk, sourceFacHiCurr.sunDisk, SurfWinSlatsAngInterpFac); - Real64 DaylIllFacSunDiskPrev = General::Interp(illFacLoPrev.sunDisk, illFacHiPrev.sunDisk, SurfWinSlatsAngInterpFac); - Real64 DaylBackFacSunDiskPrev = General::Interp(backFacLoPrev.sunDisk, backFacHiPrev.sunDisk, SurfWinSlatsAngInterpFac); - Real64 DaylSourceFacSunDiskPrev = General::Interp(sourceFacLoPrev.sunDisk, sourceFacHiPrev.sunDisk, SurfWinSlatsAngInterpFac); - DFHR[iWinCover_Shaded].sun += VTRatio * (wgtCurrHr * DaylIllFacSunDiskNow + wgtPrevHr * DaylIllFacSunDiskPrev); - BFHR[iWinCover_Shaded].sun += VTRatio * (wgtCurrHr * DaylBackFacSunDiskNow + wgtPrevHr * DaylBackFacSunDiskPrev); - SFHR[iWinCover_Shaded].sun += VTRatio * (wgtCurrHr * DaylSourceFacSunDiskNow + wgtPrevHr * DaylSourceFacSunDiskPrev); - } - } // End of check if window has blind with movable slats - } // End of check if window is shaded or has diffusing glass + // Shade, screen, blind with fixed slats, or diffusing glass + DFHR[iWinCover_Shaded].sun = VTRatio * (wgtCurrHr * illFac2Curr.sun + wgtPrevHr * illFac2Prev.sun); + BFHR[iWinCover_Shaded].sun = VTRatio * (wgtCurrHr * backFac2Curr.sun + wgtPrevHr * backFac2Prev.sun); + SFHR[iWinCover_Shaded].sun = VTRatio * (wgtCurrHr * sourceFac2Curr.sun + wgtPrevHr * sourceFac2Prev.sun); + + auto const &surfShade = s_surf->surfShades(IWin); + if (!surfShade.blind.slatBlockBeam) { + DFHR[iWinCover_Shaded].sun += VTRatio * (wgtCurrHr * illFac2Curr.sunDisk + wgtPrevHr * illFac2Prev.sunDisk); + BFHR[iWinCover_Shaded].sun += VTRatio * (wgtCurrHr * backFac2Curr.sunDisk + wgtPrevHr * backFac2Prev.sunDisk); + SFHR[iWinCover_Shaded].sun += VTRatio * (wgtCurrHr * sourceFac2Curr.sunDisk + wgtPrevHr * sourceFac2Prev.sunDisk); + } + } // End of check if window is shaded or has diffusing glass // Get illuminance at ref point from bare and shaded window by // multiplying daylight factors by exterior horizontal illuminance @@ -6031,22 +5935,22 @@ void DayltgInteriorIllum(EnergyPlusData &state, auto &daylFromWinAtRefPt = thisDayltgCtrl.refPts(IL).extWins(loop).lums; auto &tmpDayl = tmpDaylFromWinAtRefPt(IL, loop); for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { - auto const &dfhr = DFHR[iWinCover]; - auto const &bfhr = BFHR[iWinCover]; - auto const &sfhr = SFHR[iWinCover]; + auto const &dfhr3 = DFHR[iWinCover]; + auto const &bfhr3 = BFHR[iWinCover]; + auto const &sfhr3 = SFHR[iWinCover]; // What is this? if (iWinCover == iWinCover_Shaded && !ShadedOrDiffusingGlassWin) break; daylFromWinAtRefPt[iLum_Illum][iWinCover] = - dfhr.sun * state.dataEnvrn->HISUNF + - HorIllSkyFac * (dfhr.sky[iSky1] * SkyWeight * horIllSky1 + dfhr.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); + dfhr3.sun * state.dataEnvrn->HISUNF + + HorIllSkyFac * (dfhr3.sky[iSky1] * SkyWeight * horIllSky1 + dfhr3.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); daylFromWinAtRefPt[iLum_Back][iWinCover] = - bfhr.sun * state.dataEnvrn->HISUNF + - HorIllSkyFac * (bfhr.sky[iSky1] * SkyWeight * horIllSky1 + bfhr.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); + bfhr3.sun * state.dataEnvrn->HISUNF + + HorIllSkyFac * (bfhr3.sky[iSky1] * SkyWeight * horIllSky1 + bfhr3.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); daylFromWinAtRefPt[iLum_Source][iWinCover] = - sfhr.sun * state.dataEnvrn->HISUNF + - HorIllSkyFac * (sfhr.sky[iSky1] * SkyWeight * horIllSky1 + sfhr.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); + sfhr3.sun * state.dataEnvrn->HISUNF + + HorIllSkyFac * (sfhr3.sky[iSky1] * SkyWeight * horIllSky1 + sfhr3.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); daylFromWinAtRefPt[iLum_Source][iWinCover] = max(daylFromWinAtRefPt[iLum_Source][iWinCover], 0.0); @@ -6072,10 +5976,10 @@ void DayltgInteriorIllum(EnergyPlusData &state, for (int loop = 1; loop <= thisEnclDaylight.NumOfDayltgExtWins; ++loop) { int IWin = thisEnclDaylight.DayltgExtWinSurfNums(loop); - int ICtrl = state.dataSurface->Surface(IWin).activeWindowShadingControl; - if (state.dataSurface->Surface(IWin).HasShadeControl && ISWFLG == 0) { - if (state.dataSurface->WindowShadingControl(ICtrl).shadingControlType == WindowShadingControlType::MeetDaylIlumSetp && - state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::GlassConditionallyLightened) + int ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + if (s_surf->Surface(IWin).HasShadeControl && ISWFLG == 0) { + if (s_surf->WindowShadingControl(ICtrl).shadingControlType == WindowShadingControlType::MeetDaylIlumSetp && + s_surf->SurfWinShadingFlag(IWin) == WinShadingType::GlassConditionallyLightened) ISWFLG = 1; } @@ -6084,12 +5988,12 @@ void DayltgInteriorIllum(EnergyPlusData &state, // the shading flag is initialized at GlassConditionallyLightened (20), and // the window is initialized at clear state: IS = 1 // For other windows with glare control, the shading flag is initialized at >10, to be determined - int IS = findWinShadingStatus(state, IWin); + WinCover winCover = findWinShadingStatus(state, IWin); for (int IL = 1; IL <= NREFPT; ++IL) { auto &refPt = thisDayltgCtrl.refPts(IL); - dl->DaylIllum(IL) += refPt.extWins(loop).lums[iLum_Illum][IS - 1]; - refPt.lums[iLum_Back] += refPt.extWins(loop).lums[iLum_Back][IS - 1]; + dl->DaylIllum(IL) += refPt.extWins(loop).lums[iLum_Illum][(int)winCover]; + refPt.lums[iLum_Back] += refPt.extWins(loop).lums[iLum_Back][(int)winCover]; } } // End of second window loop over exterior windows associated with this zone @@ -6126,19 +6030,20 @@ void DayltgInteriorIllum(EnergyPlusData &state, int loop = thisDayltgCtrl.MapShdOrdToLoopNum(count); if (loop == 0) continue; - if (!state.dataSurface->Surface(IWin).HasShadeControl) continue; + if (!s_surf->Surface(IWin).HasShadeControl) continue; - int ICtrl = state.dataSurface->Surface(IWin).activeWindowShadingControl; - int IS = findWinShadingStatus(state, IWin); + int ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + WinCover winCover = findWinShadingStatus(state, IWin); auto const &daylFromWinAtRefPt = thisDayltgCtrl.refPts(1).extWins(loop).lums[iLum_Illum]; - if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::GlassConditionallyLightened && - state.dataSurface->WindowShadingControl(ICtrl).shadingControlType == WindowShadingControlType::MeetDaylIlumSetp && + if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::GlassConditionallyLightened && + s_surf->WindowShadingControl(ICtrl).shadingControlType == WindowShadingControlType::MeetDaylIlumSetp && !previously_shaded(loop)) { - shadeGroupLums.switchedWinLum += daylFromWinAtRefPt[IS - 1]; + shadeGroupLums.switchedWinLum += daylFromWinAtRefPt[(int)winCover]; previously_shaded(loop) = true; } else { - shadeGroupLums.unswitchedWinLum += !previously_shaded(loop) ? daylFromWinAtRefPt[IS - 1] : daylFromWinAtRefPt[iWinCover_Shaded]; + shadeGroupLums.unswitchedWinLum += + !previously_shaded(loop) ? daylFromWinAtRefPt[(int)winCover] : daylFromWinAtRefPt[iWinCover_Shaded]; } } // for (IWin) } // for (igroup) @@ -6161,74 +6066,70 @@ void DayltgInteriorIllum(EnergyPlusData &state, for (const int IWin : listOfExtWin) { ++count; - auto const &surfWin = state.dataSurface->SurfaceWindow(IWin); + auto const &surfWin = s_surf->SurfaceWindow(IWin); // need to map back to the original order of the "loop" to not change all the other data structures int loop = thisDayltgCtrl.MapShdOrdToLoopNum(count); if (loop > 0 && shadeGroupLums.lumRatio < 1.0) { - int ICtrl = state.dataSurface->Surface(IWin).activeWindowShadingControl; - if (!state.dataSurface->Surface(IWin).HasShadeControl) { + int ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + if (!s_surf->Surface(IWin).HasShadeControl) { continueOuterLoop = true; continue; } - if (state.dataSurface->SurfWinShadingFlag(IWin) != WinShadingType::GlassConditionallyLightened || - state.dataSurface->WindowShadingControl(ICtrl).shadingControlType != WindowShadingControlType::MeetDaylIlumSetp) { + if (s_surf->SurfWinShadingFlag(IWin) != WinShadingType::GlassConditionallyLightened || + s_surf->WindowShadingControl(ICtrl).shadingControlType != WindowShadingControlType::MeetDaylIlumSetp) { continueOuterLoop = true; continue; } - int const IConst = state.dataSurface->SurfActiveConstruction(IWin); + int const IConst = s_surf->SurfActiveConstruction(IWin); // Vis trans at normal incidence of unswitched glass shadeGroupLums.unswitchedTvis = General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // Vis trans at normal incidence of fully switched glass - int const IConstShaded = state.dataSurface->Surface(IWin).activeShadedConstruction; + int const IConstShaded = s_surf->Surface(IWin).activeShadedConstruction; shadeGroupLums.switchedTvis = General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; // Reset shading flag to indicate that window is shaded by being partially or fully switched - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::SwitchableGlazing; + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::SwitchableGlazing; // ASETIL < 0 means illuminance from non-daylight-switchable windows exceeds setpoint, // so completely switch all daylight-switchable windows to minimize solar gain if (shadeGroupLums.lumRatio <= 0.0) { - state.dataSurface->SurfWinSwitchingFactor(IWin) = 1.0; - state.dataSurface->SurfWinVisTransSelected(IWin) = shadeGroupLums.switchedTvis; + s_surf->SurfWinSwitchingFactor(IWin) = 1.0; + s_surf->SurfWinVisTransSelected(IWin) = shadeGroupLums.switchedTvis; } else { // Case where 0 < ASETIL < 1: darken glass in all // daylight-switchable windows to just meet illuminance setpoint // From this equation: SETPNT(1) = DILLUN + DILLSW/TVIS1 * VisTransSelected - state.dataSurface->SurfWinVisTransSelected(IWin) = + s_surf->SurfWinVisTransSelected(IWin) = max(shadeGroupLums.switchedTvis, shadeGroupLums.lumRatio * shadeGroupLums.unswitchedTvis) + 0.000001; - state.dataSurface->SurfWinSwitchingFactor(IWin) = - (shadeGroupLums.unswitchedTvis - state.dataSurface->SurfWinVisTransSelected(IWin)) / - (shadeGroupLums.unswitchedTvis - shadeGroupLums.switchedTvis + 0.000001); + s_surf->SurfWinSwitchingFactor(IWin) = (shadeGroupLums.unswitchedTvis - s_surf->SurfWinVisTransSelected(IWin)) / + (shadeGroupLums.unswitchedTvis - shadeGroupLums.switchedTvis + 0.000001); // bound switching factor between 0 and 1 - state.dataSurface->SurfWinSwitchingFactor(IWin) = min(1.0, state.dataSurface->SurfWinSwitchingFactor(IWin)); - state.dataSurface->SurfWinSwitchingFactor(IWin) = max(0.0, state.dataSurface->SurfWinSwitchingFactor(IWin)); + s_surf->SurfWinSwitchingFactor(IWin) = min(1.0, s_surf->SurfWinSwitchingFactor(IWin)); + s_surf->SurfWinSwitchingFactor(IWin) = max(0.0, s_surf->SurfWinSwitchingFactor(IWin)); } // Adjust daylight quantities based on ratio between switched and unswitched visible transmittance for (int IL = 1; IL <= NREFPT; ++IL) { - // DaylIllum(IL) and BacLum(IL) were calculated at the clear state: IS = 1, - // and need to adjusted for intermediate switched state at VisTransSelected: IS = 2 - int IS = 1; - + // DaylIllum(IL) and BacLum(IL) were calculated at the clear state: + // and need to adjusted for intermediate switched state at VisTransSelected: auto &daylFromWinAtRefPt = thisDayltgCtrl.refPts(IL).extWins(loop).lums; auto const &tmpDayl = tmpDaylFromWinAtRefPt(IL, loop); - VTRAT = state.dataSurface->SurfWinVisTransSelected(IWin) / (shadeGroupLums.unswitchedTvis + 0.000001); - dl->DaylIllum(IL) += (VTRAT - 1.0) * daylFromWinAtRefPt[iLum_Illum][IS - 1]; - thisDayltgCtrl.refPts(IL).lums[iLum_Back] += (VTRAT - 1.0) * daylFromWinAtRefPt[iLum_Back][IS - 1]; + VTRAT = s_surf->SurfWinVisTransSelected(IWin) / (shadeGroupLums.unswitchedTvis + 0.000001); + dl->DaylIllum(IL) += (VTRAT - 1.0) * daylFromWinAtRefPt[iLum_Illum][iWinCover_Bare]; + thisDayltgCtrl.refPts(IL).lums[iLum_Back] += (VTRAT - 1.0) * daylFromWinAtRefPt[iLum_Back][iWinCover_Bare]; // Adjust illum, background illum and source luminance for this window in intermediate switched state // for later use in the DayltgGlare calc because SurfaceWindow(IWin)%ShadingFlag = WinShadingType::SwitchableGlazing = 2 - IS = 2; - VTRAT = state.dataSurface->SurfWinVisTransSelected(IWin) / (shadeGroupLums.switchedTvis + 0.000001); - daylFromWinAtRefPt[iLum_Illum][IS - 1] = VTRAT * tmpDayl[iLum_Illum][IS - 1]; - daylFromWinAtRefPt[iLum_Back][IS - 1] = VTRAT * tmpDayl[iLum_Back][IS - 1]; - daylFromWinAtRefPt[iLum_Source][IS - 1] = VTRAT * tmpDayl[iLum_Source][IS - 1]; + VTRAT = s_surf->SurfWinVisTransSelected(IWin) / (shadeGroupLums.switchedTvis + 0.000001); + daylFromWinAtRefPt[iLum_Illum][iWinCover_Shaded] = VTRAT * tmpDayl[iLum_Illum][iWinCover_Shaded]; + daylFromWinAtRefPt[iLum_Back][iWinCover_Shaded] = VTRAT * tmpDayl[iLum_Back][iWinCover_Shaded]; + daylFromWinAtRefPt[iLum_Source][iWinCover_Shaded] = VTRAT * tmpDayl[iLum_Source][iWinCover_Shaded]; } // for (IL) } // if (loop > 0 && ASETIL < 1) // If new daylight does not exceed the illuminance setpoint, done, no more checking other groups of switchable glazings @@ -6248,8 +6149,8 @@ void DayltgInteriorIllum(EnergyPlusData &state, for (int igroup = 1; igroup <= (int)thisDayltgCtrl.ShadeDeployOrderExtWins.size(); igroup++) { for (int const IWin : thisDayltgCtrl.ShadeDeployOrderExtWins[igroup - 1]) { ++count; - int ICtrl = state.dataSurface->Surface(IWin).activeWindowShadingControl; - WindowShadingControlType shCtrlType = state.dataSurface->WindowShadingControl(ICtrl).shadingControlType; + int ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + WindowShadingControlType shCtrlType = s_surf->WindowShadingControl(ICtrl).shadingControlType; if (!((shCtrlType == WindowShadingControlType::HiSolar_HiLumin_OffMidNight) || (shCtrlType == WindowShadingControlType::HiSolar_HiLumin_OffSunset) || (shCtrlType == WindowShadingControlType::HiSolar_HiLumin_OffNextMorning))) @@ -6258,8 +6159,8 @@ void DayltgInteriorIllum(EnergyPlusData &state, int loop = thisDayltgCtrl.MapShdOrdToLoopNum(count); if (loop == 0) continue; - WinShadingType currentFlag = state.dataSurface->SurfWinShadingFlag(IWin); - WinShadingType ShType = state.dataSurface->WindowShadingControl(ICtrl).ShadingType; + WinShadingType currentFlag = s_surf->SurfWinShadingFlag(IWin); + WinShadingType ShType = s_surf->WindowShadingControl(ICtrl).ShadingType; if ((currentFlag != WinShadingType::IntShadeConditionallyOff) && (currentFlag != WinShadingType::GlassConditionallyLightened) && (currentFlag != WinShadingType::ExtShadeConditionallyOff) && (currentFlag != WinShadingType::IntBlindConditionallyOff) && (currentFlag != WinShadingType::ExtBlindConditionallyOff) && (currentFlag != WinShadingType::BGShadeConditionallyOff) && @@ -6267,9 +6168,9 @@ void DayltgInteriorIllum(EnergyPlusData &state, continue; auto const &daylFromWinAtRefPt = thisDayltgCtrl.refPts(1).extWins(loop).lums; - if (daylFromWinAtRefPt[iLum_Source][iWinCover_Bare] > state.dataSurface->WindowShadingControl(ICtrl).SetPoint2) { + if (daylFromWinAtRefPt[iLum_Source][iWinCover_Bare] > s_surf->WindowShadingControl(ICtrl).SetPoint2) { // shade on if luminance of this window is above setpoint - state.dataSurface->SurfWinShadingFlag(IWin) = ShType; + s_surf->SurfWinShadingFlag(IWin) = ShType; // update total illuminance and background luminance for (int IL = 1; IL <= NREFPT; ++IL) { dl->DaylIllum(IL) += daylFromWinAtRefPt[iLum_Illum][iWinCover_Shaded] - daylFromWinAtRefPt[iLum_Illum][iWinCover_Bare]; @@ -6278,7 +6179,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, } } else { // shade off if luminance is below setpoint - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::ShadeOff; + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::ShadeOff; } } // for (IWin) } // for (igroup) @@ -6325,22 +6226,22 @@ void DayltgInteriorIllum(EnergyPlusData &state, int loop = thisDayltgCtrl.MapShdOrdToLoopNum(count); if (loop == 0) continue; - auto const &surfWin = state.dataSurface->SurfaceWindow(IWin); + auto const &surfWin = s_surf->SurfaceWindow(IWin); // Check if window is eligible for glare control // TH 1/21/2010. Switchable glazings already in partially switched state // should be allowed to further dim to control glare // if (SurfWinShadingFlag(IWin) <= BGBlind && SurfWinShadingFlag(IWin) != SwitchableGlazing) { - if (NOT_SHADED(state.dataSurface->SurfWinShadingFlag(IWin)) || ANY_SHADE_SCREEN(state.dataSurface->SurfWinShadingFlag(IWin)) || - ANY_BLIND(state.dataSurface->SurfWinShadingFlag(IWin))) { + if (NOT_SHADED(s_surf->SurfWinShadingFlag(IWin)) || ANY_SHADE_SCREEN(s_surf->SurfWinShadingFlag(IWin)) || + ANY_BLIND(s_surf->SurfWinShadingFlag(IWin))) { continueOuterLoop = false; continue; } - ICtrl = state.dataSurface->Surface(IWin).activeWindowShadingControl; - if (!state.dataSurface->Surface(IWin).HasShadeControl) { + int ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + if (!s_surf->Surface(IWin).HasShadeControl) { continueOuterLoop = false; continue; } - if (state.dataSurface->WindowShadingControl(ICtrl).GlareControlIsActive) { + if (s_surf->WindowShadingControl(ICtrl).GlareControlIsActive) { atLeastOneGlareControlIsActive = true; // Illuminance (WDAYIL) and background luminance (WBACLU) contribution from this @@ -6361,37 +6262,37 @@ void DayltgInteriorIllum(EnergyPlusData &state, auto const &wdayil = shadeGroupLums.WDAYIL(IL); auto const &refPt = thisDayltgCtrl.refPts(IL); - if (state.dataSurface->SurfWinShadingFlag(IWin) != WinShadingType::SwitchableGlazing) { + if (s_surf->SurfWinShadingFlag(IWin) != WinShadingType::SwitchableGlazing) { // for non switchable glazings or switchable glazings not switched yet (still in clear state) // SurfaceWindow(IWin)%ShadingFlag = WinShadingFlag::GlassConditionallyLightened rdayil[iLum_Illum] = dl->DaylIllum(IL) - wdayil[iLum_Illum][iWinCover_Bare] + wdayil[iLum_Illum][iWinCover_Shaded]; rdayil[iLum_Back] = refPt.lums[iLum_Back] - wdayil[iLum_Back][iWinCover_Bare] + wdayil[iLum_Back][iWinCover_Shaded]; } else { // switchable glazings already in partially switched state when calc the RDAYIL(IL) & RBACLU(IL) - auto &tmpDayl = tmpDaylFromWinAtRefPt(loop, IL); + auto const &tmpDayl = tmpDaylFromWinAtRefPt(loop, IL); rdayil[iLum_Illum] = dl->DaylIllum(IL) - wdayil[iLum_Illum][iWinCover_Shaded] + tmpDayl[iLum_Illum][iWinCover_Shaded]; rdayil[iLum_Back] = refPt.lums[iLum_Back] - wdayil[iLum_Back][iWinCover_Shaded] + tmpDayl[iLum_Back][iWinCover_Shaded]; } } // for (IL) - if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::GlassConditionallyLightened) - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::SwitchableGlazing; - else if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::IntShadeConditionallyOff) - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::IntShade; - else if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::ExtShadeConditionallyOff) - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::ExtShade; - else if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::IntBlindConditionallyOff) - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::IntBlind; - else if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::ExtBlindConditionallyOff) - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::ExtBlind; - else if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::BGShadeConditionallyOff) - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::BGShade; - else if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::BGBlindConditionallyOff) - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::BGBlind; + if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::GlassConditionallyLightened) + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::SwitchableGlazing; + else if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::IntShadeConditionallyOff) + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::IntShade; + else if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::ExtShadeConditionallyOff) + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::ExtShade; + else if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::IntBlindConditionallyOff) + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::IntBlind; + else if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::ExtBlindConditionallyOff) + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::ExtBlind; + else if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::BGShadeConditionallyOff) + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::BGShade; + else if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::BGBlindConditionallyOff) + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::BGBlind; // For switchable glazings, it is switched to fully dark state, // update ZoneDaylight(ZoneNum)%SourceLumFromWinAtRefPt(IL,2,loop) for use in DayltgGlare - if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing) { + if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing) { for (int IL = 1; IL <= NREFPT; ++IL) { auto &daylFromWinAtRefPt = thisDayltgCtrl.refPts(IL).extWins(loop).lums; auto const &tmpDayl = tmpDaylFromWinAtRefPt(IL, loop); @@ -6401,13 +6302,13 @@ void DayltgInteriorIllum(EnergyPlusData &state, daylFromWinAtRefPt[iLum_Back][iWinCover_Shaded] = tmpDayl[iLum_Back][iWinCover_Shaded]; } - int const IConst = state.dataSurface->SurfActiveConstruction(IWin); + int const IConst = s_surf->SurfActiveConstruction(IWin); // Vis trans at normal incidence of unswitched glass shadeGroupLums.unswitchedTvis = General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // Vis trans at normal incidence of fully switched glass - int const IConstShaded = state.dataSurface->Surface(IWin).activeShadedConstruction; + int const IConstShaded = s_surf->Surface(IWin).activeShadedConstruction; shadeGroupLums.switchedTvis = General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; } // if (switchableGlazing) @@ -6472,21 +6373,21 @@ void DayltgInteriorIllum(EnergyPlusData &state, if (loop == 0) continue; // if (SurfWinShadingFlag(IWin) <= BGBlind && SurfWinShadingFlag(IWin) != SwitchableGlazing) { - if (NOT_SHADED(state.dataSurface->SurfWinShadingFlag(IWin)) || ANY_SHADE_SCREEN(state.dataSurface->SurfWinShadingFlag(IWin)) || - ANY_BLIND(state.dataSurface->SurfWinShadingFlag(IWin))) + if (NOT_SHADED(s_surf->SurfWinShadingFlag(IWin)) || ANY_SHADE_SCREEN(s_surf->SurfWinShadingFlag(IWin)) || + ANY_BLIND(s_surf->SurfWinShadingFlag(IWin))) continue; - ICtrl = state.dataSurface->Surface(IWin).activeWindowShadingControl; - if (!state.dataSurface->Surface(IWin).HasShadeControl) continue; - if (state.dataSurface->WindowShadingControl(ICtrl).GlareControlIsActive) { + int ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + if (!s_surf->Surface(IWin).HasShadeControl) continue; + if (s_surf->WindowShadingControl(ICtrl).GlareControlIsActive) { // Shading this window has not improved the glare situation. // Reset shading flag to no shading condition, go to next window. if (blnCycle) { // for switchable glazings, reset properties to clear state or partial switched state? - if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing) { - state.dataSurface->SurfWinSwitchingFactor(IWin) = 0.0; - state.dataSurface->SurfWinVisTransSelected(IWin) = shadeGroupLums.unswitchedTvis; + if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing) { + s_surf->SurfWinSwitchingFactor(IWin) = 0.0; + s_surf->SurfWinVisTransSelected(IWin) = shadeGroupLums.unswitchedTvis; // RESET properties for fully dark state for (int IL = 1; IL <= NREFPT; ++IL) { @@ -6498,7 +6399,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, } } - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::ShadeOff; + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::ShadeOff; continue; } @@ -6520,12 +6421,12 @@ void DayltgInteriorIllum(EnergyPlusData &state, // This was addressed in CR 7984 for E+ 5.0. 1/19/2010 // If switchable glazing, set switching factor to 1: fully switched. - if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing) { + if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing) { // tmpSWFactor0 = SurfaceWindow( IWin ).SwitchingFactor; // save original // switching factor ////Unused Set but never used - state.dataSurface->SurfWinSwitchingFactor(IWin) = 1.0; - state.dataSurface->SurfWinVisTransSelected(IWin) = shadeGroupLums.switchedTvis; + s_surf->SurfWinSwitchingFactor(IWin) = 1.0; + s_surf->SurfWinVisTransSelected(IWin) = shadeGroupLums.switchedTvis; // restore fully dark values for (int IL = 1; IL <= NREFPT; ++IL) { @@ -6551,8 +6452,8 @@ void DayltgInteriorIllum(EnergyPlusData &state, } if (GlareOK) { - if (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing && - state.dataSurface->WindowShadingControl(ICtrl).shadingControlType == WindowShadingControlType::MeetDaylIlumSetp) { + if (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing && + s_surf->WindowShadingControl(ICtrl).shadingControlType == WindowShadingControlType::MeetDaylIlumSetp) { // Added TH 1/14/2010 // Only for switchable glazings with MeetDaylightIlluminanceSetpoint control // The glazing is in fully dark state, it might lighten a bit to provide more daylight @@ -6654,8 +6555,8 @@ void DayltgInteriorIllum(EnergyPlusData &state, daylFromWinAtRefPt[iLum_Illum][iWinCover_Shaded] = tmpDayl[iLum_Illum][iWinCover_Shaded] * tmpMult; daylFromWinAtRefPt[iLum_Back][iWinCover_Shaded] = tmpDayl[iLum_Back][iWinCover_Shaded] * tmpMult; } - state.dataSurface->SurfWinSwitchingFactor(IWin) = tmpSWFactor; - state.dataSurface->SurfWinVisTransSelected(IWin) = + s_surf->SurfWinSwitchingFactor(IWin) = tmpSWFactor; + s_surf->SurfWinVisTransSelected(IWin) = shadeGroupLums.unswitchedTvis - (shadeGroupLums.unswitchedTvis - shadeGroupLums.switchedTvis) * tmpSWFactor; } else { @@ -6676,14 +6577,14 @@ void DayltgInteriorIllum(EnergyPlusData &state, for (int spaceNum : state.dataHeatBal->Zone(thisDayltgCtrl.zoneIndex).spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int IWin = thisSpace.WindowSurfaceFirst; IWin <= thisSpace.WindowSurfaceLast; ++IWin) { - if (state.dataSurface->Surface(IWin).ExtBoundCond != ExternalEnvironment) continue; - bool anyGlareControl = (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::IntShadeConditionallyOff) || - (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::GlassConditionallyLightened) || - (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::ExtShadeConditionallyOff) || - (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::IntBlindConditionallyOff) || - (state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::ExtBlindConditionallyOff); + if (s_surf->Surface(IWin).ExtBoundCond != ExternalEnvironment) continue; + bool anyGlareControl = (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::IntShadeConditionallyOff) || + (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::GlassConditionallyLightened) || + (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::ExtShadeConditionallyOff) || + (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::IntBlindConditionallyOff) || + (s_surf->SurfWinShadingFlag(IWin) == WinShadingType::ExtBlindConditionallyOff); if (anyGlareControl) { - state.dataSurface->SurfWinShadingFlag(IWin) = WinShadingType::ShadeOff; + s_surf->SurfWinShadingFlag(IWin) = WinShadingType::ShadeOff; } } } @@ -7027,13 +6928,10 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, Vector3 nearestHitPt; // Hit point of ray on nearest obstruction (m) Vector3 obsHitPt; // Coordinates of hit point on an obstruction (m) Vector3 groundHitPt; // Coordinates of point that ray from window center hits the ground (m) - // std::array FLFWSU = {0.0}; // Sun-related downgoing luminous flux, excluding entering beam - // std::array FLFWSUdisk = {0.0}; // Sun-related downgoing luminous flux, due to entering beam - // std::array FLCWSU = {0.0}; // Sun-related upgoing luminous flux - std::array FLCW = {Illums()}; // Sky-related upgoing luminous flux - std::array FLFW = {Illums()}; // Sky-related downgoing luminous flux - std::array transMult; - std::array transBmBmMult; + std::array FLCW = {Illums()}; // Sky-related upgoing luminous flux + std::array FLFW = {Illums()}; // Sky-related downgoing luminous flux + Real64 transMult; + Real64 transBmBmMult; // 3=intermediate, 4=overcast Real64 DPH; // Sky/ground element altitude and azimuth increments (radians) @@ -7069,7 +6967,6 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, bool ShadeOn; // True if exterior or interior window shade present bool BlindOn; // True if exterior or interior window blind present bool ScreenOn; // True if exterior window screen present - int BlNum; // Blind number // int ScNum; // Screen number //Unused Set but never used int PipeNum; // TDD pipe object number int ShelfNum; // Daylighting shelf object number @@ -7119,11 +7016,14 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, WinShadingType ShType; + auto &s_mat = state.dataMaterial; auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; + auto &thisEnclDaylight = dl->enclDaylight(enclNum); - auto const &surf = state.dataSurface->Surface(IWin); - auto const &surfWin = state.dataSurface->SurfaceWindow(IWin); - int const enclNumThisWin = state.dataSurface->Surface(surf.BaseSurf).SolarEnclIndex; + auto const &surf = s_surf->Surface(IWin); + auto const &surfWin = s_surf->SurfaceWindow(IWin); + int const enclNumThisWin = s_surf->Surface(surf.BaseSurf).SolarEnclIndex; // The inside surface area, ZoneDaylight(ZoneNum)%totInsSurfArea was calculated in subr DayltgAveInteriorReflectance if (enclNumThisWin == enclNum) { @@ -7144,22 +7044,22 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } // Initialize window luminance and fluxes for split-flux calculation - dl->winLum(IHR, _) = Illums(); + dl->winLum(IHR)[(int)iWinCover_Bare] = dl->winLum(IHR)[(int)iWinCover_Shaded] = Illums(); // dl->WLUMSU(IHR, _) = 0.0; // dl->WLUMSUdisk(IHR, _) = 0.0; - int const IConst = state.dataSurface->SurfActiveConstruction(IWin); + int const IConst = s_surf->SurfActiveConstruction(IWin); auto const &construct = state.dataConstruction->Construct(IConst); BlindOn = false; ShadeOn = false; ScreenOn = false; - if (state.dataSurface->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { - PipeNum = state.dataSurface->SurfWinTDDPipeNum(IWin); + if (s_surf->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { + PipeNum = s_surf->SurfWinTDDPipeNum(IWin); } - ShelfNum = state.dataSurface->SurfDaylightingShelfInd(IWin); + ShelfNum = s_surf->SurfDaylightingShelfInd(IWin); if (ShelfNum > 0) { InShelfSurf = state.dataDaylightingDevicesData->Shelf(ShelfNum).InSurf; // Inside daylighting shelf present if > 0 OutShelfSurf = state.dataDaylightingDevicesData->Shelf(ShelfNum).OutSurf; // Outside daylighting shelf present if > 0 @@ -7179,7 +7079,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, DPH = (PHMAX - PHMIN) / double(NPHMAX); // Sky/ground element altitude integration - Vector3 const SUNCOS_IHR(state.dataSurface->SurfSunCosHourly(IHR)); + Vector3 const SUNCOS_IHR(s_surf->SurfSunCosHourly(IHR)); for (int IPH = 1; IPH <= NPHMAX; ++IPH) { PH = PHMIN + (double(IPH) - 0.5) * DPH; @@ -7235,7 +7135,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, if (ISunPos == 1) { // Intersection calculation has to be done only for first sun position // Determine net transmittance of obstructions that the ray hits. ObTrans will be 1.0 // if no obstructions are hit. - ObTrans = DayltgHitObstruction(state, IHR, IWin, state.dataSurface->SurfaceWindow(IWin).WinCenter, U); + ObTrans = DayltgHitObstruction(state, IHR, IWin, s_surf->SurfaceWindow(IWin).WinCenter, U); dl->ObTransM[IPH][ITH] = ObTrans; dl->SkyObstructionMult[IPH][ITH] = 1.0; } @@ -7251,7 +7151,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, ZSK.sky[iSky] = DayltgSkyLuminance(state, static_cast(iSky), TH, PH) * COSB * DA * dl->ObTransM[IPH][ITH]; } } else { // PH <= 0.0; contribution is from ground - if (state.dataSurface->CalcSolRefl && dl->ObTransM[IPH][ITH] > 1.e-6 && ISunPos == 1) { + if (s_surf->CalcSolRefl && dl->ObTransM[IPH][ITH] > 1.e-6 && ISunPos == 1) { // Calculate effect of obstructions on shading of sky diffuse reaching the ground point hit // by the ray. This effect is given by the ratio SkyObstructionMult = // (obstructed sky diffuse at ground point)/(unobstructed sky diffuse at ground point). @@ -7259,10 +7159,10 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, // Ground point hit by the ray: Real64 Alfa = std::acos(-U.z); Real64 Beta = std::atan2(U.y, U.x); - Real64 HorDis = (state.dataSurface->SurfaceWindow(IWin).WinCenter.z - state.dataSurface->GroundLevelZ) * std::tan(Alfa); - groundHitPt.z = state.dataSurface->GroundLevelZ; - groundHitPt.x = state.dataSurface->SurfaceWindow(IWin).WinCenter.x + HorDis * std::cos(Beta); - groundHitPt.y = state.dataSurface->SurfaceWindow(IWin).WinCenter.y + HorDis * std::sin(Beta); + Real64 HorDis = (s_surf->SurfaceWindow(IWin).WinCenter.z - s_surf->GroundLevelZ) * std::tan(Alfa); + groundHitPt.z = s_surf->GroundLevelZ; + groundHitPt.x = s_surf->SurfaceWindow(IWin).WinCenter.x + HorDis * std::cos(Beta); + groundHitPt.y = s_surf->SurfaceWindow(IWin).WinCenter.y + HorDis * std::sin(Beta); dl->SkyObstructionMult[IPH][ITH] = CalcObstrMultiplier(state, groundHitPt, AltAngStepsForSolReflCalc, DataSurfaces::AzimAngStepsForSolReflCalc); @@ -7280,10 +7180,10 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, // the building itself, is considered in determining whether sun hits the ground point. // Otherwise this shading is ignored and the sun always hits the ground point. SunObstructionMult = 1.0; - if (state.dataSurface->CalcSolRefl && dl->ObTransM[IPH][ITH] > 1.e-6 && ISunPos == 1) { + if (s_surf->CalcSolRefl && dl->ObTransM[IPH][ITH] > 1.e-6 && ISunPos == 1) { // Sun reaches ground point if vector from this point to the sun is unobstructed hitObs = false; - for (int ObsSurfNum : state.dataSurface->AllShadowPossObstrSurfaceList) { + for (int ObsSurfNum : s_surf->AllShadowPossObstrSurfaceList) { hitObs = PierceSurface(state, ObsSurfNum, groundHitPt, SUNCOS_IHR, obsHitPt); if (hitObs) break; } @@ -7294,9 +7194,9 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } // BEAM SOLAR AND SKY SOLAR REFLECTED FROM NEAREST OBSTRUCTION - if (state.dataSurface->CalcSolRefl && dl->ObTransM[IPH][ITH] < 1.0) { + if (s_surf->CalcSolRefl && dl->ObTransM[IPH][ITH] < 1.0) { // Find obstruction whose hit point is closest to the center of the window - DayltgClosestObstruction(state, state.dataSurface->SurfaceWindow(IWin).WinCenter, U, NearestHitSurfNum, nearestHitPt); + DayltgClosestObstruction(state, s_surf->SurfaceWindow(IWin).WinCenter, U, NearestHitSurfNum, nearestHitPt); if (NearestHitSurfNum > 0) { // Beam solar reflected from nearest obstruction. @@ -7305,29 +7205,27 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, ZSU += ZSUObsRefl; // Sky solar reflected from nearest obstruction. - int const ObsConstrNum = state.dataSurface->Surface(NearestHitSurfNum).Construction; + int const ObsConstrNum = s_surf->Surface(NearestHitSurfNum).Construction; if (ObsConstrNum > 0) { // Exterior building surface is nearest hit if (!state.dataConstruction->Construct(ObsConstrNum).TypeIsWindow) { // Obstruction is not a window, i.e., is an opaque surface - ObsVisRefl = 1.0 - dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ObsConstrNum).LayerPoint(1))) - ->AbsorpVisible; + ObsVisRefl = 1.0 - s_mat->materials(state.dataConstruction->Construct(ObsConstrNum).LayerPoint(1))->AbsorpVisible; } else { // Obstruction is a window; assume it is bare ObsVisRefl = state.dataConstruction->Construct(ObsConstrNum).ReflectVisDiffFront; } } else { // Shadowing surface is nearest hit - if (state.dataSurface->SurfDaylightingShelfInd(NearestHitSurfNum) > 0) { + if (s_surf->SurfDaylightingShelfInd(NearestHitSurfNum) > 0) { // Skip daylighting shelves, whose reflection is separately calculated ObsVisRefl = 0.0; } else { - ObsVisRefl = state.dataSurface->SurfShadowDiffuseVisRefl(NearestHitSurfNum); - if (state.dataSurface->SurfShadowGlazingConstruct(NearestHitSurfNum) > 0) - ObsVisRefl += state.dataSurface->SurfShadowGlazingFrac(NearestHitSurfNum) * - state.dataConstruction->Construct(state.dataSurface->SurfShadowGlazingConstruct(NearestHitSurfNum)) - .ReflectVisDiffFront; + ObsVisRefl = s_surf->SurfShadowDiffuseVisRefl(NearestHitSurfNum); + if (s_surf->SurfShadowGlazingConstruct(NearestHitSurfNum) > 0) + ObsVisRefl += + s_surf->SurfShadowGlazingFrac(NearestHitSurfNum) * + state.dataConstruction->Construct(s_surf->SurfShadowGlazingConstruct(NearestHitSurfNum)).ReflectVisDiffFront; // Note in the above that ShadowSurfDiffuseVisRefl is the reflectance of opaque part of // shadowing surface times (1 - ShadowSurfGlazingFrac) } @@ -7335,15 +7233,15 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, NearestHitSurfNumX = NearestHitSurfNum; // Each shadowing surface has a "mirror" duplicate surface facing in the opposite direction. // The following gets the correct side of a shadowing surface for reflection. - if (state.dataSurface->Surface(NearestHitSurfNum).IsShadowing) { - if (dot(U, state.dataSurface->Surface(NearestHitSurfNum).OutNormVec) > 0.0) NearestHitSurfNumX = NearestHitSurfNum + 1; + if (s_surf->Surface(NearestHitSurfNum).IsShadowing) { + if (dot(U, s_surf->Surface(NearestHitSurfNum).OutNormVec) > 0.0) NearestHitSurfNumX = NearestHitSurfNum + 1; } - if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm || !state.dataSurface->ShadingTransmittanceVaries || + if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm || !s_surf->ShadingTransmittanceVaries || state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { - SkyReflVisLum = ObsVisRefl * state.dataSurface->Surface(NearestHitSurfNumX).ViewFactorSky * + SkyReflVisLum = ObsVisRefl * s_surf->Surface(NearestHitSurfNumX).ViewFactorSky * state.dataSolarShading->SurfDifShdgRatioIsoSky(NearestHitSurfNumX) / Constant::Pi; } else { - SkyReflVisLum = ObsVisRefl * state.dataSurface->Surface(NearestHitSurfNumX).ViewFactorSky * + SkyReflVisLum = ObsVisRefl * s_surf->Surface(NearestHitSurfNumX).ViewFactorSky * state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS(1, IHR, NearestHitSurfNumX) / Constant::Pi; } dReflObsSky = SkyReflVisLum * COSB * DA; @@ -7361,14 +7259,14 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, // FLCW--(I,J) = part of incoming flux (in lumens) that goes up to ceiling and upper part of walls. // FLFW--(I,J) = part that goes down to floor and lower part of walls - if (state.dataSurface->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { + if (s_surf->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { // Unshaded visible transmittance of TDD for a single ray from sky/ground element TVISBR = TransTDD(state, PipeNum, COSB, RadType::VisibleBeam) * surfWin.glazedFrac; // Make all transmitted light diffuse for a TDD with a bare diffuser - auto &wlumsk = dl->winLum(IHR, 1); - auto &flfwsk = FLFW[1]; - auto &flcwsk = FLCW[1]; + auto &wlumsk = dl->winLum(IHR)[iWinCover_Bare]; + auto &flfwsk = FLFW[iWinCover_Bare]; + auto &flcwsk = FLCW[iWinCover_Bare]; auto &tddFluxInc = dl->TDDFluxInc(IHR, PipeNum); auto &tddFluxTrans = dl->TDDFluxTrans(IHR, PipeNum); @@ -7386,9 +7284,9 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, tddFluxInc.sky[(int)SkyType::Clear] += ZSU; tddFluxTrans.sky[(int)SkyType::Clear] += ZSU * TVISBR; - dl->winLum(IHR, 1).sun += ZSU * TVISBR / Constant::Pi; - FLFW[1].sun += ZSU * TVISBR * (1.0 - surfWin.fractionUpgoing); - FLCW[1].sun += ZSU * TVISBR * surfWin.fractionUpgoing; + dl->winLum(IHR)[iWinCover_Bare].sun += ZSU * TVISBR / Constant::Pi; + flfwsk.sun += ZSU * TVISBR * (1.0 - surfWin.fractionUpgoing); + flcwsk.sun += ZSU * TVISBR * surfWin.fractionUpgoing; } else { // Bare window // Transmittance of bare window for this sky/ground element @@ -7397,11 +7295,11 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, if (InShelfSurf > 0) { // Inside daylighting shelf // Daylighting shelf simplification: All light is diffuse // SurfaceWindow(IWin)%FractionUpgoing is already set to 1.0 earlier - auto &flcwsk = FLCW[1]; + auto &flcwsk = FLCW[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { flcwsk.sky[iSky] += ZSK.sky[iSky] * TVISBR * surfWin.fractionUpgoing; } - FLCW[1].sun += ZSU * TVISBR * surfWin.fractionUpgoing; + flcwsk.sun += ZSU * TVISBR * surfWin.fractionUpgoing; } else { // Normal window @@ -7413,14 +7311,13 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, for (int IntWinLoop = 1; IntWinLoop <= thisEnclDaylight.IntWinAdjEnclExtWin(IntWinAdjZoneExtWinNum).NumOfIntWindows; ++IntWinLoop) { IntWinNum = thisEnclDaylight.IntWinAdjEnclExtWin(IntWinAdjZoneExtWinNum).IntWinNum(IntWinLoop); - auto const &surfIntWin = state.dataSurface->SurfaceWindow(IntWinNum); + auto const &surfIntWin = s_surf->SurfaceWindow(IntWinNum); hitObs = PierceSurface(state, IntWinNum, surfIntWin.WinCenter, SUNCOS_IHR, obsHitPt); if (hitObs) { // disk passes thru // cosine of incidence angle of light from sky or ground element for COSBintWin = SPH * std::sin(surfIntWin.phi) + CPH * std::cos(surfIntWin.phi) * std::cos(TH - surfIntWin.theta); - TVISBR *= General::POLYF( - COSBintWin, - state.dataConstruction->Construct(state.dataSurface->Surface(IntWinNum).Construction).TransVisBeamCoef); + TVISBR *= General::POLYF(COSBintWin, + state.dataConstruction->Construct(s_surf->Surface(IntWinNum).Construction).TransVisBeamCoef); break; } } @@ -7429,8 +7326,8 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } } - auto &flfwsk = FLFW[1]; - auto &flcwsk = FLCW[1]; + auto &flfwsk = FLFW[iWinCover_Bare]; + auto &flcwsk = FLCW[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { // IF (PH < 0.0d0) THEN // Fixed by FCW, Nov. 2003: @@ -7442,27 +7339,24 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } // for (iSky) if (PH > 0.0) { - FLFW[1].sun += ZSU * TVISBR; + flfwsk.sun += ZSU * TVISBR; } else { - FLCW[1].sun += ZSU * TVISBR; + flcwsk.sun += ZSU * TVISBR; } } // End of check if window with daylighting shelf or normal window } // End of check if TDD:DOME or bare window // Check if window has shade or blind - ICtrl = state.dataSurface->Surface(IWin).activeWindowShadingControl; - if (state.dataSurface->Surface(IWin).HasShadeControl) { - ShType = state.dataSurface->WindowShadingControl(ICtrl).ShadingType; - BlNum = state.dataSurface->SurfWinBlindNumber(IWin); - // ScNum = SurfaceWindow( IWin ).ScreenNumber; //Unused Set but never used - + ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + if (s_surf->Surface(IWin).HasShadeControl) { + ShType = s_surf->WindowShadingControl(ICtrl).ShadingType; ShadeOn = ANY_SHADE(ShType); BlindOn = ANY_BLIND(ShType); ScreenOn = (ShType == WinShadingType::ExtScreen); } - if (ShadeOn || BlindOn || ScreenOn || state.dataSurface->SurfWinSolarDiffusing(IWin)) { + if (ShadeOn || BlindOn || ScreenOn || s_surf->SurfWinSolarDiffusing(IWin)) { // ===Window with interior or exterior shade or blind, exterior screen, or with diffusing glass=== @@ -7483,36 +7377,35 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, // between the screen's cylinders goes either up or down depending on the altitude angle of the // element from which the light came. - int IConstShaded = state.dataSurface->SurfWinActiveShadedConstruction(IWin); - if (state.dataSurface->SurfWinSolarDiffusing(IWin)) IConstShaded = state.dataSurface->Surface(IWin).Construction; + int IConstShaded = s_surf->SurfWinActiveShadedConstruction(IWin); + if (s_surf->SurfWinSolarDiffusing(IWin)) IConstShaded = s_surf->Surface(IWin).Construction; // Transmittance of window including shade, screen or blind - std::fill(transBmBmMult.begin(), transBmBmMult.end(), 0.0); - std::fill(transMult.begin(), transMult.end(), 0.0); + Real64 transBmBmMult = 0.0; + Real64 transMult = 0.0; if (ShadeOn) { // Shade - if (state.dataSurface->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { + if (s_surf->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { // Shaded visible transmittance of TDD for a single ray from sky/ground element - transMult[1] = TransTDD(state, PipeNum, COSB, RadType::VisibleBeam) * surfWin.glazedFrac; + transMult = TransTDD(state, PipeNum, COSB, RadType::VisibleBeam) * surfWin.glazedFrac; } else { // Shade only, no TDD // Calculate transmittance of the combined window and shading device for this sky/ground element - transMult[1] = General::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * - surfWin.lightWellEff; + transMult = General::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * + surfWin.lightWellEff; } } else if (ScreenOn) { // Screen: get beam-beam, beam-diffuse and diffuse-diffuse vis trans/ref of screen and glazing system - auto const *screen = dynamic_cast(state.dataMaterial->Material(surfWin.screenNum)); + auto const *screen = dynamic_cast(s_mat->materials(surfWin.screenNum)); assert(screen != nullptr); Real64 phi = std::abs(PH - surfWin.phi); Real64 theta = std::abs(TH - surfWin.theta); int ip1, ip2, it1, it2; // lo/hi phi/theta interpolation map indices - General::BilinearInterpCoeffs coeffs; + BilinearInterpCoeffs coeffs; Material::NormalizePhiTheta(phi, theta); Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); - General::GetBilinearInterpCoeffs( - phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); + GetBilinearInterpCoeffs(phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); ReflGlDiffDiffFront = state.dataConstruction->Construct(IConst).ReflectVisDiffFront; ReflScDiffDiffBack = screen->DfRefVis; @@ -7522,118 +7415,110 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, auto const &b21 = screen->btars[ip2][it1]; auto const &b22 = screen->btars[ip2][it2]; - TransScBmDiffFront = General::BilinearInterp(b11.DfTransVis, b12.DfTransVis, b21.DfTransVis, b22.DfTransVis, coeffs); + TransScBmDiffFront = BilinearInterp(b11.DfTransVis, b12.DfTransVis, b21.DfTransVis, b22.DfTransVis, coeffs); - transMult[1] = TransScBmDiffFront * surfWin.glazedFrac * state.dataConstruction->Construct(IConst).TransDiffVis / - (1 - ReflGlDiffDiffFront * ReflScDiffDiffBack) * surfWin.lightWellEff; + transMult = TransScBmDiffFront * surfWin.glazedFrac * state.dataConstruction->Construct(IConst).TransDiffVis / + (1 - ReflGlDiffDiffFront * ReflScDiffDiffBack) * surfWin.lightWellEff; - transBmBmMult[1] = General::BilinearInterp(b11.BmTransVis, b12.BmTransVis, b21.BmTransVis, b22.BmTransVis, coeffs); + transBmBmMult = BilinearInterp(b11.BmTransVis, b12.BmTransVis, b21.BmTransVis, b22.BmTransVis, coeffs); } else if (BlindOn) { // Blind: get beam-diffuse and beam-beam vis trans of blind+glazing system // PETER: As long as only interior blinds are allowed for TDDs, no need to change TransMult calculation // for TDDs because it is based on TVISBR which is correctly calculated for TDDs above. - auto const &blind = state.dataMaterial->Blind(BlNum); - Real64 ProfAng = ProfileAngle(state, IWin, U, blind.SlatOrientation); - - for (int JB = 1; JB <= Material::MaxSlatAngs; ++JB) { - if (!state.dataSurface->SurfWinMovableSlats(IWin) && JB > 1) break; - - TransBlBmDiffFront = Window::InterpProfAng(ProfAng, blind.VisFrontBeamDiffTrans(JB, {1, 37})); - - if (ShType == WinShadingType::IntBlind) { // Interior blind - ReflGlDiffDiffBack = construct.ReflectVisDiffBack; - ReflBlBmDiffFront = Window::InterpProfAng(ProfAng, blind.VisFrontBeamDiffRefl(JB, {1, 37})); - ReflBlDiffDiffFront = blind.VisFrontDiffDiffRefl(JB); - TransBlDiffDiffFront = blind.VisFrontDiffDiffTrans(JB); - transMult[JB] = TVISBR * (TransBlBmDiffFront + ReflBlBmDiffFront * ReflGlDiffDiffBack * TransBlDiffDiffFront / - (1.0 - ReflBlDiffDiffFront * ReflGlDiffDiffBack)); - - } else if (ShType == WinShadingType::ExtBlind) { // Exterior blind - ReflGlDiffDiffFront = construct.ReflectVisDiffFront; - ReflBlDiffDiffBack = blind.VisBackDiffDiffRefl(JB); - transMult[JB] = TransBlBmDiffFront * surfWin.glazedFrac * construct.TransDiffVis / - (1.0 - ReflGlDiffDiffFront * ReflBlDiffDiffBack) * surfWin.lightWellEff; - - } else { // Between-glass blind - Real64 t1 = General::POLYF(COSB, construct.tBareVisCoef(1)); - td2 = construct.tBareVisDiff(2); - rbd1 = construct.rbBareVisDiff(1); - rfd2 = construct.rfBareVisDiff(2); - Real64 tfshBd = Window::InterpProfAng(ProfAng, blind.VisFrontBeamDiffTrans(JB, {1, 37})); - tfshd = blind.VisFrontDiffDiffTrans(JB); - Real64 rfshB = Window::InterpProfAng(ProfAng, blind.VisFrontBeamDiffRefl(JB, {1, 37})); - rbshd = blind.VisFrontDiffDiffRefl(JB); - if (construct.TotGlassLayers == 2) { // 2 glass layers - transMult[JB] = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; - } else { // 3 glass layers; blind between layers 2 and 3 - Real64 t2 = General::POLYF(COSB, construct.tBareVisCoef(2)); - td3 = construct.tBareVisDiff(3); - rfd3 = construct.rfBareVisDiff(3); - rbd2 = construct.rbBareVisDiff(2); - transMult[JB] = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * - surfWin.lightWellEff; - } + auto const &surfShade = s_surf->surfShades(IWin); + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + Real64 ProfAng = ProfileAngle(state, IWin, U, matBlind->SlatOrientation); + + auto &btar = surfShade.blind.TAR; + int idxLo = surfShade.blind.profAngIdxLo; + int idxHi = std::min(Material::MaxProfAngs, idxLo + 1); + Real64 interpFac = surfShade.blind.profAngInterpFac; + TransBlBmDiffFront = Interp(btar.Vis.Ft.Bm[idxLo].DfTra, btar.Vis.Ft.Bm[idxHi].DfTra, interpFac); + + if (ShType == WinShadingType::IntBlind) { // Interior blind + ReflGlDiffDiffBack = construct.ReflectVisDiffBack; + ReflBlBmDiffFront = Interp(btar.Vis.Ft.Bm[idxLo].DfRef, btar.Vis.Ft.Bm[idxHi].DfRef, interpFac); + ReflBlDiffDiffFront = btar.Vis.Ft.Df.Ref; + TransBlDiffDiffFront = btar.Vis.Ft.Df.Tra; + transMult = TVISBR * (TransBlBmDiffFront + ReflBlBmDiffFront * ReflGlDiffDiffBack * TransBlDiffDiffFront / + (1.0 - ReflBlDiffDiffFront * ReflGlDiffDiffBack)); + + } else if (ShType == WinShadingType::ExtBlind) { // Exterior blind + ReflGlDiffDiffFront = construct.ReflectVisDiffFront; + ReflBlDiffDiffBack = btar.Vis.Bk.Df.Ref; + transMult = TransBlBmDiffFront * surfWin.glazedFrac * construct.TransDiffVis / + (1.0 - ReflGlDiffDiffFront * ReflBlDiffDiffBack) * surfWin.lightWellEff; + + } else { // Between-glass blind + Real64 t1 = General::POLYF(COSB, construct.tBareVisCoef(1)); + td2 = construct.tBareVisDiff(2); + rbd1 = construct.rbBareVisDiff(1); + rfd2 = construct.rfBareVisDiff(2); + Real64 tfshBd = Interp(btar.Vis.Ft.Bm[idxLo].DfTra, btar.Vis.Ft.Bm[idxHi].DfTra, interpFac); + tfshd = btar.Vis.Ft.Df.Tra; + Real64 rfshB = Interp(btar.Vis.Ft.Bm[idxLo].DfRef, btar.Vis.Ft.Bm[idxHi].DfRef, interpFac); + rbshd = btar.Vis.Ft.Df.Ref; + if (construct.TotGlassLayers == 2) { // 2 glass layers + transMult = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; + } else { // 3 glass layers; blind between layers 2 and 3 + Real64 t2 = General::POLYF(COSB, construct.tBareVisCoef(2)); + td3 = construct.tBareVisDiff(3); + rfd3 = construct.rfBareVisDiff(3); + rbd2 = construct.rbBareVisDiff(2); + transMult = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * + surfWin.lightWellEff; } + } - Real64 SlatAng = (state.dataSurface->SurfWinMovableSlats(IWin)) ? ((JB - 1) * Constant::Pi / (Material::MaxSlatAngs - 1)) - : (blind.SlatAngle * Constant::DegToRadians); - - transBmBmMult[JB] = - TVISBR * Window::BlindBeamBeamTrans(ProfAng, SlatAng, blind.SlatWidth, blind.SlatSeparation, blind.SlatThickness); - } // End of loop over slat angles - + transBmBmMult = TVISBR * matBlind->BeamBeamTrans(ProfAng, surfShade.blind.slatAng); } else { // Diffusing glass - transMult[1] = General::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * - surfWin.lightWellEff; + transMult = General::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * + surfWin.lightWellEff; } // End of check if shade, blind or diffusing glass - if (state.dataSurface->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { + if (s_surf->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { // No beam is transmitted. This takes care of all types of screens and blinds. - std::fill(transBmBmMult.begin(), transBmBmMult.end(), 0.0); + transBmBmMult = 0.0; } // Daylighting shelf simplification: No beam makes it past end of shelf, all light is diffuse if (InShelfSurf > 0) { // Inside daylighting shelf - std::fill(transBmBmMult.begin(), transBmBmMult.end(), 0.0); + transBmBmMult = 0.0; } // DayltgInterReflectedIllumTransBmBmMult is used in the following for windows with blinds or screens to get contribution from light // passing directly between slats or between screen material without reflection. - for (int JB = 1; JB <= Material::MaxSlatAngs; ++JB) { - // EXIT after first pass if not movable slats or exterior window screen - if (!state.dataSurface->SurfWinMovableSlats(IWin) && JB > 1) break; - - auto &wlumsk = dl->winLum(IHR, JB + 1); - auto &flfwsk = FLFW[JB + 1]; - auto &flcwsk = FLCW[JB + 1]; - - for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { - - wlumsk.sky[iSky] += ZSK.sky[iSky] * transMult[JB] / Constant::Pi; - flfwsk.sky[iSky] += ZSK.sky[iSky] * transMult[JB] * (1.0 - surfWin.fractionUpgoing); - flcwsk.sky[iSky] += ZSK.sky[iSky] * transMult[JB] * surfWin.fractionUpgoing; + auto &wlumsk = dl->winLum(IHR)[iWinCover_Shaded]; + auto &flfwsk = FLFW[iWinCover_Shaded]; + auto &flcwsk = FLCW[iWinCover_Shaded]; - if (BlindOn || ScreenOn) { - if (PH > 0.0) { - flfwsk.sky[iSky] += ZSK.sky[iSky] * transBmBmMult[JB]; - } else { - flcwsk.sky[iSky] += ZSK.sky[iSky] * transBmBmMult[JB]; - } - } - } + for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { + // Should these be bare or shaded? + wlumsk.sky[iSky] += ZSK.sky[iSky] * transMult / Constant::Pi; + flfwsk.sky[iSky] += ZSK.sky[iSky] * transMult * (1.0 - surfWin.fractionUpgoing); + flcwsk.sky[iSky] += ZSK.sky[iSky] * transMult * surfWin.fractionUpgoing; - dl->winLum(IHR, JB + 1).sun += ZSU * transMult[JB] / Constant::Pi; - FLFW[JB + 1].sun += ZSU * transMult[JB] * (1.0 - surfWin.fractionUpgoing); - FLCW[JB + 1].sun += ZSU * transMult[JB] * surfWin.fractionUpgoing; if (BlindOn || ScreenOn) { if (PH > 0.0) { - FLFW[JB + 1].sun += ZSU * transBmBmMult[JB]; + flfwsk.sky[iSky] += ZSK.sky[iSky] * transBmBmMult; } else { - FLCW[JB + 1].sun += ZSU * transBmBmMult[JB]; + flcwsk.sky[iSky] += ZSK.sky[iSky] * transBmBmMult; } } } + + dl->winLum(IHR)[iWinCover_Shaded].sun += ZSU * transMult / Constant::Pi; + flfwsk.sun += ZSU * transMult * (1.0 - surfWin.fractionUpgoing); + flcwsk.sun += ZSU * transMult * surfWin.fractionUpgoing; + if (BlindOn || ScreenOn) { + if (PH > 0.0) { + flfwsk.sun += ZSU * transBmBmMult; + } else { + flcwsk.sun += ZSU * transBmBmMult; + } + } } // End of window with shade, screen, blind or diffusing glass } // End of azimuth integration loop, ITH @@ -7646,7 +7531,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, TVISBR = construct.TransDiffVis; // Assume diffuse transmittance for shelf illuminance auto const &gilsk = dl->horIllum[IHR]; - auto &flcwsk = FLCW[1]; + auto &flcwsk = FLCW[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { // This is only an estimate because the anisotropic sky view of the shelf is not yet taken into account. // SurfAnisoSkyMult would be great to use but it is not available until the heat balance starts up. @@ -7659,19 +7544,17 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, ZSU = dl->horIllum[IHR].sun * state.dataHeatBal->SurfSunlitFracHR(IHR, OutShelfSurf) * state.dataDaylightingDevicesData->Shelf(ShelfNum).OutReflectVis * state.dataDaylightingDevicesData->Shelf(ShelfNum).ViewFactor; - FLCW[1].sun += ZSU * TVISBR * surfWin.fractionUpgoing; + flcwsk.sun += ZSU * TVISBR * surfWin.fractionUpgoing; } // Sky-related portion of internally reflected illuminance. // The inside surface area, ZoneDaylight(ZoneNum)%totInsSurfArea, and ZoneDaylight(ZoneNum)%aveVisDiffReflect, // were calculated in subr DayltgAveInteriorReflectance. - for (int JSH = 1; JSH <= Material::MaxSlatAngs + 1; ++JSH) { - if (!state.dataSurface->SurfWinMovableSlats(IWin) && JSH > 2) break; - - auto &eintsk = dl->reflIllum(IHR, JSH); - auto const &flfwsk = FLFW[JSH]; - auto const &flcwsk = FLCW[JSH]; + for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { + auto &eintsk = dl->reflIllum(IHR)[iWinCover]; + auto const &flfwsk = FLFW[iWinCover]; + auto const &flcwsk = FLCW[iWinCover]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { // Full area of window is used in following since effect of dividers on reducing @@ -7679,7 +7562,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, eintsk.sky[iSky] = (flfwsk.sky[iSky] * surfWin.rhoFloorWall + flcwsk.sky[iSky] * surfWin.rhoCeilingWall) * (surf.Area / surfWin.glazedFrac) / (EnclInsideSurfArea * (1.0 - dl->enclDaylight(enclNum).aveVisDiffReflect)); } // for (iSky) - } // for (jSH) + } // for (iWinCover) // BEAM SOLAR RADIATION ON WINDOW @@ -7702,152 +7585,141 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, // -- Bare window - if (state.dataSurface->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { + if (s_surf->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { // Unshaded visible transmittance of TDD for collimated beam from the sun TVISBSun = TransTDD(state, PipeNum, COSBSun, RadType::VisibleBeam) * surfWin.glazedFrac; dl->TDDTransVisBeam(IHR, PipeNum) = TVISBSun; - FLFW[1].sunDisk = 0.0; // Diffuse light only + FLFW[iWinCover_Bare].sunDisk = 0.0; // Diffuse light only - dl->winLum(IHR, 1).sun += ZSU1 * TVISBSun / Constant::Pi; - FLFW[1].sun += ZSU1 * TVISBSun * (1.0 - surfWin.fractionUpgoing); - FLCW[1].sun += ZSU1 * TVISBSun * surfWin.fractionUpgoing; + dl->winLum(IHR)[iWinCover_Bare].sun += ZSU1 * TVISBSun / Constant::Pi; + FLFW[iWinCover_Bare].sun += ZSU1 * TVISBSun * (1.0 - surfWin.fractionUpgoing); + FLCW[iWinCover_Bare].sun += ZSU1 * TVISBSun * surfWin.fractionUpgoing; } else { // Bare window TVISBSun = General::POLYF(COSBSun, construct.TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; // Daylighting shelf simplification: No beam makes it past end of shelf, all light is diffuse - if (InShelfSurf > 0) { // Inside daylighting shelf - FLFW[1].sunDisk = 0.0; // Diffuse light only + if (InShelfSurf > 0) { // Inside daylighting shelf + FLFW[iWinCover_Bare].sunDisk = 0.0; // Diffuse light only // SurfaceWindow(IWin)%FractionUpgoing is already set to 1.0 earlier // WLUMSU(1,IHR) = WLUMSU(1,IHR) + ZSU1 * TVISBSun / PI // FLFWSU(1) = FLFWSU(1) + ZSU1 * TVISBSun * (1.0 - SurfaceWindow(IWin)%FractionUpgoing) - FLCW[1].sun += ZSU1 * TVISBSun * surfWin.fractionUpgoing; + FLCW[iWinCover_Bare].sun += ZSU1 * TVISBSun * surfWin.fractionUpgoing; } else { // Normal window - FLFW[1].sunDisk = ZSU1 * TVISBSun; + FLFW[iWinCover_Bare].sunDisk = ZSU1 * TVISBSun; } } // -- Window with shade, screen, blind or diffusing glass - if (ShadeOn || BlindOn || ScreenOn || state.dataSurface->SurfWinSolarDiffusing(IWin)) { - std::fill(transBmBmMult.begin(), transBmBmMult.end(), 0.0); - std::fill(transMult.begin(), transMult.end(), 0.0); - - // TH 7/7/2010 moved from inside the loop: DO JB = 1,MaxSlatAngs - Real64 ProfAng; - if (BlindOn) { - auto const &blind = state.dataMaterial->Blind(BlNum); - ProfAng = ProfileAngle(state, IWin, state.dataSurface->SurfSunCosHourly(IHR), blind.SlatOrientation); - } + if (ShadeOn || BlindOn || ScreenOn || s_surf->SurfWinSolarDiffusing(IWin)) { + Real64 transBmBmMult = 0.0; + Real64 transMult = 0.0; - for (int JB = 1; JB <= Material::MaxSlatAngs; ++JB) { - if (!state.dataSurface->SurfWinMovableSlats(IWin) && JB > 1) break; + if (ShadeOn || ScreenOn || s_surf->SurfWinSolarDiffusing(IWin)) { // Shade or screen on or diffusing glass + if (s_surf->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { + // Shaded visible transmittance of TDD for collimated beam from the sun + transMult = TransTDD(state, PipeNum, COSBSun, RadType::VisibleBeam) * surfWin.glazedFrac; - if (ShadeOn || ScreenOn || state.dataSurface->SurfWinSolarDiffusing(IWin)) { // Shade or screen on or diffusing glass - if (state.dataSurface->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { - // Shaded visible transmittance of TDD for collimated beam from the sun - transMult[1] = TransTDD(state, PipeNum, COSBSun, RadType::VisibleBeam) * surfWin.glazedFrac; - } else { - if (ScreenOn) { - auto const *screen = dynamic_cast(state.dataMaterial->Material(surfWin.screenNum)); - assert(screen != nullptr); - Real64 phi = std::abs(dl->sunAngles.phi - surfWin.phi); - Real64 theta = std::abs(dl->sunAngles.theta - surfWin.theta); - int ip1, ip2, it1, it2; - General::BilinearInterpCoeffs coeffs; - Material::NormalizePhiTheta(phi, theta); - Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); - General::GetBilinearInterpCoeffs( - phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); - Real64 BmBmTransVis = General::BilinearInterp(screen->btars[ip1][it1].BmTransVis, - screen->btars[ip1][it2].BmTransVis, - screen->btars[ip2][it1].BmTransVis, - screen->btars[ip2][it2].BmTransVis, - coeffs); + } else if (ScreenOn) { + auto const *screen = dynamic_cast(s_mat->materials(surfWin.screenNum)); + assert(screen != nullptr); + Real64 phi = std::abs(dl->sunAngles.phi - surfWin.phi); + Real64 theta = std::abs(dl->sunAngles.theta - surfWin.theta); + int ip1, ip2, it1, it2; + BilinearInterpCoeffs coeffs; + Material::NormalizePhiTheta(phi, theta); + Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); + GetBilinearInterpCoeffs( + phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); + Real64 BmBmTransVis = BilinearInterp(screen->btars[ip1][it1].BmTransVis, + screen->btars[ip1][it2].BmTransVis, + screen->btars[ip2][it1].BmTransVis, + screen->btars[ip2][it2].BmTransVis, + coeffs); - transMult[1] = BmBmTransVis * surfWin.glazedFrac * surfWin.lightWellEff; - } else { - int IConstShaded = state.dataSurface->SurfWinActiveShadedConstruction(IWin); - if (state.dataSurface->SurfWinSolarDiffusing(IWin)) IConstShaded = surf.Construction; - transMult[1] = General::POLYF(COSBSun, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * - surfWin.glazedFrac * surfWin.lightWellEff; - } - } + transMult = BmBmTransVis * surfWin.glazedFrac * surfWin.lightWellEff; + } else { + int IConstShaded = s_surf->SurfWinActiveShadedConstruction(IWin); + if (s_surf->SurfWinSolarDiffusing(IWin)) IConstShaded = surf.Construction; + transMult = General::POLYF(COSBSun, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * + surfWin.lightWellEff; + } - } else { // Blind on - - // As long as only interior blinds are allowed for TDDs, no need to change TransMult calculation - // for TDDs because it is based on TVISBSun which is correctly calculated for TDDs above. - auto const &blind = state.dataMaterial->Blind(BlNum); - - Real64 TransBlBmDiffFront = Window::InterpProfAng(ProfAng, blind.VisFrontBeamDiffTrans(JB, {1, 37})); - - if (ShType == WinShadingType::IntBlind) { // Interior blind - // TH CR 8121, 7/7/2010 - // ReflBlBmDiffFront = WindowManager::InterpProfAng(ProfAng,Blind(BlNum)%VisFrontBeamDiffRefl) - Real64 ReflBlBmDiffFront = Window::InterpProfAng(ProfAng, blind.VisFrontBeamDiffRefl(JB, {1, 37})); - - // TH added 7/12/2010 for CR 8121 - Real64 ReflBlDiffDiffFront = blind.VisFrontDiffDiffRefl(JB); - Real64 TransBlDiffDiffFront = blind.VisFrontDiffDiffTrans(JB); - - transMult[JB] = TVISBSun * (TransBlBmDiffFront + ReflBlBmDiffFront * ReflGlDiffDiffBack * TransBlDiffDiffFront / - (1.0 - ReflBlDiffDiffFront * ReflGlDiffDiffBack)); - - } else if (ShType == WinShadingType::ExtBlind) { // Exterior blind - transMult[JB] = TransBlBmDiffFront * - (construct.TransDiffVis / (1.0 - ReflGlDiffDiffFront * blind.VisBackDiffDiffRefl(JB))) * - surfWin.glazedFrac * surfWin.lightWellEff; - - } else { // Between-glass blind - Real64 t1 = General::POLYF(COSBSun, construct.tBareVisCoef(1)); - Real64 tfshBd = Window::InterpProfAng(ProfAng, blind.VisFrontBeamDiffTrans(JB, {1, 37})); - Real64 rfshB = Window::InterpProfAng(ProfAng, blind.VisFrontBeamDiffRefl(JB, {1, 37})); - if (construct.TotGlassLayers == 2) { // 2 glass layers - transMult[JB] = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; - } else { // 3 glass layers; blind between layers 2 and 3 - Real64 t2 = General::POLYF(COSBSun, construct.tBareVisCoef(2)); - transMult[JB] = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * - surfWin.lightWellEff; - } + } else { // Blind on + auto const &surfShade = s_surf->surfShades(IWin); + // As long as only interior blinds are allowed for TDDs, no need to change TransMult calculation + // for TDDs because it is based on TVISBSun which is correctly calculated for TDDs above. + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + + // These are "cached" in the surfShade struct + auto &btar = surfShade.blind.TAR; + int idxLo = surfShade.blind.profAngIdxLo; + int idxHi = surfShade.blind.profAngIdxHi; + int interpFac = surfShade.blind.profAngInterpFac; + Real64 TransBlBmDiffFront = Interp(btar.Vis.Ft.Bm[idxLo].DfTra, btar.Vis.Ft.Bm[idxHi].DfTra, interpFac); + + if (ShType == WinShadingType::IntBlind) { // Interior blind + // TH CR 8121, 7/7/2010 + // ReflBlBmDiffFront = WindowManager::InterpProfAng(ProfAng,Blind(BlNum)%VisFrontBeamDiffRefl) + Real64 ReflBlBmDiffFront = Interp(btar.Vis.Ft.Bm[idxLo].DfRef, btar.Vis.Ft.Bm[idxHi].DfRef, interpFac); + + // TH added 7/12/2010 for CR 8121 + Real64 ReflBlDiffDiffFront = btar.Vis.Ft.Df.Ref; + Real64 TransBlDiffDiffFront = btar.Vis.Ft.Df.Tra; + + transMult = TVISBSun * (TransBlBmDiffFront + ReflBlBmDiffFront * ReflGlDiffDiffBack * TransBlDiffDiffFront / + (1.0 - ReflBlDiffDiffFront * ReflGlDiffDiffBack)); + + } else if (ShType == WinShadingType::ExtBlind) { // Exterior blind + transMult = TransBlBmDiffFront * (construct.TransDiffVis / (1.0 - ReflGlDiffDiffFront * btar.Vis.Bk.Df.Ref)) * + surfWin.glazedFrac * surfWin.lightWellEff; + + } else { // Between-glass blind + Real64 t1 = General::POLYF(COSBSun, construct.tBareVisCoef(1)); + Real64 tfshBd = Interp(btar.Vis.Ft.Bm[idxLo].DfTra, btar.Vis.Ft.Bm[idxHi].DfTra, interpFac); + Real64 rfshB = Interp(btar.Vis.Ft.Bm[idxLo].DfRef, btar.Vis.Ft.Bm[idxHi].DfRef, interpFac); + if (construct.TotGlassLayers == 2) { // 2 glass layers + transMult = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; + } else { // 3 glass layers; blind between layers 2 and 3 + Real64 t2 = General::POLYF(COSBSun, construct.tBareVisCoef(2)); + transMult = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * + surfWin.lightWellEff; } + } - Real64 SlatAng = (state.dataSurface->SurfWinMovableSlats(IWin)) ? ((JB - 1) * Constant::Pi / (Material::MaxSlatAngs - 1)) - : (blind.SlatAngle * Constant::DegToRadians); - - transBmBmMult[JB] = - TVISBSun * Window::BlindBeamBeamTrans(ProfAng, SlatAng, blind.SlatWidth, blind.SlatSeparation, blind.SlatThickness); - } // ShadeOn/ScreenOn/BlindOn/Diffusing glass + transBmBmMult = TVISBSun * matBlind->BeamBeamTrans(surfShade.blind.profAng, surfShade.blind.slatAng); + } // ShadeOn/ScreenOn/BlindOn/Diffusing glass - if (state.dataSurface->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { - std::fill(transBmBmMult.begin(), transBmBmMult.end(), 0.0); // No beam, diffuse only - } + if (s_surf->Surface(IWin).OriginalClass == SurfaceClass::TDD_Dome) { + transBmBmMult = 0.0; // No beam, diffuse only + } - // Daylighting shelf simplification: No beam makes it past end of shelf, all light is diffuse - if (InShelfSurf > 0) { // Inside daylighting shelf - std::fill(transBmBmMult.begin(), transBmBmMult.end(), 0.0); // No beam, diffuse only - // SurfaceWindow(IWin)%FractionUpgoing is already set to 1.0 earlier - } + // Daylighting shelf simplification: No beam makes it past end of shelf, all light is diffuse + if (InShelfSurf > 0) { // Inside daylighting shelf + transBmBmMult = 0.0; // No beam, diffuse only + // SurfaceWindow(IWin)%FractionUpgoing is already set to 1.0 earlier + } - dl->winLum(IHR, JB + 1).sun += ZSU1 * transMult[JB] / Constant::Pi; - dl->winLum(IHR, JB + 1).sunDisk = ZSU1 * transBmBmMult[JB] / Constant::Pi; - FLFW[JB + 1].sun += ZSU1 * transMult[JB] * (1.0 - surfWin.fractionUpgoing); - FLFW[JB + 1].sunDisk = ZSU1 * transBmBmMult[JB]; - FLCW[JB + 1].sun += ZSU1 * transMult[JB] * surfWin.fractionUpgoing; - } // for (JB) - } // if (BlindOn || ShadeOn) - } // if (COSBSun > 0) - } // if (SurfSunlitFracHR > 0) + dl->winLum(IHR)[iWinCover_Shaded].sun += ZSU1 * transMult / Constant::Pi; + dl->winLum(IHR)[iWinCover_Shaded].sunDisk = ZSU1 * transBmBmMult / Constant::Pi; + FLFW[iWinCover_Shaded].sun += ZSU1 * transMult * (1.0 - surfWin.fractionUpgoing); + FLFW[iWinCover_Shaded].sunDisk = ZSU1 * transBmBmMult; + FLCW[iWinCover_Shaded].sun += ZSU1 * transMult * surfWin.fractionUpgoing; + } // if (BlindOn || ShadeOn) + } // if (COSBSun > 0) + } // if (SurfSunlitFracHR > 0) // Beam reaching window after specular reflection from exterior obstruction // In the following, Beam normal illuminance times ZSU1refl = illuminance on window due to // specular reflection from exterior surfaces - if (state.dataSurface->CalcSolRefl && state.dataSurface->Surface(IWin).OriginalClass != SurfaceClass::TDD_Dome) { + if (s_surf->CalcSolRefl && s_surf->Surface(IWin).OriginalClass != SurfaceClass::TDD_Dome) { - ZSU1refl = state.dataSurface->SurfReflFacBmToBmSolObs(IHR, IWin); + ZSU1refl = s_surf->SurfReflFacBmToBmSolObs(IHR, IWin); if (ZSU1refl > 0.0) { // Contribution to window luminance and downgoing flux @@ -7860,80 +7732,79 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, // 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 // actually be going upward. - FLFW[1].sunDisk += ZSU1refl * TVisSunRefl; + FLFW[iWinCover_Bare].sunDisk += ZSU1refl * TVisSunRefl; // -- Window with shade, blind or diffusing glass - if (ShadeOn || BlindOn || ScreenOn || state.dataSurface->SurfWinSolarDiffusing(IWin)) { - std::fill(transBmBmMult.begin(), transBmBmMult.end(), 0.0); - std::fill(transMult.begin(), transMult.end(), 0.0); - - for (int JB = 1; JB <= Material::MaxSlatAngs; ++JB) { - if (!state.dataSurface->SurfWinMovableSlats(IWin) && JB > 1) break; - - if (ShadeOn || state.dataSurface->SurfWinSolarDiffusing(IWin)) { // Shade on or diffusing glass - int IConstShaded = state.dataSurface->SurfWinActiveShadedConstruction(IWin); - if (state.dataSurface->SurfWinSolarDiffusing(IWin)) IConstShaded = state.dataSurface->Surface(IWin).Construction; - transMult[1] = state.dataConstruction->Construct(IConstShaded).TransDiffVis * surfWin.glazedFrac * surfWin.lightWellEff; - - } else if (ScreenOn) { // Exterior screen on - auto const *screen = dynamic_cast(state.dataMaterial->Material(surfWin.screenNum)); - Real64 TransScDiffDiffFront = screen->DfTransVis; - - transMult[1] = TransScDiffDiffFront * - (state.dataConstruction->Construct(IConst).TransDiffVis / (1.0 - ReflGlDiffDiffFront * ReflScDiffDiffBack)) * - surfWin.glazedFrac * surfWin.lightWellEff; - - } else { // Blind on - - auto const &blind = state.dataMaterial->Blind(BlNum); - TransBlDiffDiffFront = state.dataMaterial->Blind(BlNum).VisFrontDiffDiffTrans(JB); - if (ShType == WinShadingType::IntBlind) { // Interior blind - ReflBlDiffDiffFront = blind.VisFrontDiffDiffRefl(JB); - transMult[JB] = TVisSunRefl * (TransBlDiffDiffFront + ReflBlDiffDiffFront * ReflGlDiffDiffBack * TransBlDiffDiffFront / - (1.0 - ReflBlDiffDiffFront * ReflGlDiffDiffBack)); - - } else if (ShType == WinShadingType::ExtBlind) { // Exterior blind - transMult[JB] = TransBlDiffDiffFront * - (construct.TransDiffVis / (1.0 - ReflGlDiffDiffFront * blind.VisBackDiffDiffRefl(JB))) * - surfWin.glazedFrac * surfWin.lightWellEff; - - } else { // Between-glass blind - Real64 t1 = construct.tBareVisDiff(1); - Real64 tfshBd = blind.VisFrontDiffDiffTrans(JB); - Real64 rfshB = blind.VisFrontDiffDiffRefl(JB); - if (construct.TotGlassLayers == 2) { // 2 glass layers - transMult[JB] = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; - } else { // 3 glass layers; blind between layers 2 and 3 - Real64 t2 = construct.tBareVisDiff(2); - transMult[JB] = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * - surfWin.lightWellEff; - } - } // End of check of interior/exterior/between-glass blind - } // if (Blind) + if (ShadeOn || BlindOn || ScreenOn || s_surf->SurfWinSolarDiffusing(IWin)) { + transBmBmMult = 0.0; + transMult = 0.0; - dl->winLum(IHR, JB + 1).sun += ZSU1refl * transMult[JB] / Constant::Pi; - FLFW[JB + 1].sun += ZSU1refl * transMult[JB] * (1.0 - surfWin.fractionUpgoing); - FLCW[JB + 1].sun += ZSU1refl * transMult[JB] * surfWin.fractionUpgoing; - } // End of loop over slat angles - } // End of check if window has shade, blind or diffusing glass - } // End of check if ZSU1refl > 0.0 - } // End of check if solar reflections are in effect + if (ShadeOn || s_surf->SurfWinSolarDiffusing(IWin)) { // Shade on or diffusing glass + int IConstShaded = s_surf->SurfWinActiveShadedConstruction(IWin); + if (s_surf->SurfWinSolarDiffusing(IWin)) IConstShaded = s_surf->Surface(IWin).Construction; + transMult = state.dataConstruction->Construct(IConstShaded).TransDiffVis * surfWin.glazedFrac * surfWin.lightWellEff; - // Sun-related portion of internally reflected illuminance + } else if (ScreenOn) { // Exterior screen on + auto const *screen = dynamic_cast(s_mat->materials(surfWin.screenNum)); + assert(screen != nullptr); + Real64 TransScDiffDiffFront = screen->DfTransVis; + + transMult = TransScDiffDiffFront * + (state.dataConstruction->Construct(IConst).TransDiffVis / (1.0 - ReflGlDiffDiffFront * ReflScDiffDiffBack)) * + surfWin.glazedFrac * surfWin.lightWellEff; + + } else { // Blind on + + auto const &surfShade = s_surf->surfShades(IWin); + auto const &btar = surfShade.blind.TAR; + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + + assert(matBlind != nullptr); + + TransBlDiffDiffFront = btar.Vis.Ft.Df.Tra; + if (ShType == WinShadingType::IntBlind) { // Interior blind + ReflBlDiffDiffFront = btar.Vis.Ft.Df.Ref; + transMult = TVisSunRefl * (TransBlDiffDiffFront + ReflBlDiffDiffFront * ReflGlDiffDiffBack * TransBlDiffDiffFront / + (1.0 - ReflBlDiffDiffFront * ReflGlDiffDiffBack)); + + } else if (ShType == WinShadingType::ExtBlind) { // Exterior blind + transMult = TransBlDiffDiffFront * (construct.TransDiffVis / (1.0 - ReflGlDiffDiffFront * btar.Vis.Bk.Df.Ref)) * + surfWin.glazedFrac * surfWin.lightWellEff; + + } else { // Between-glass blind + Real64 t1 = construct.tBareVisDiff(1); + Real64 tfshBd = btar.Vis.Ft.Df.Tra; + Real64 rfshB = btar.Vis.Ft.Df.Ref; + if (construct.TotGlassLayers == 2) { // 2 glass layers + transMult = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; + } else { // 3 glass layers; blind between layers 2 and 3 + Real64 t2 = construct.tBareVisDiff(2); + transMult = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * + surfWin.lightWellEff; + } + } // End of check of interior/exterior/between-glass blind + } // if (Blind) - for (int JSH = 1; JSH <= Material::MaxSlatAngs + 1; ++JSH) { - if (!state.dataSurface->SurfWinMovableSlats(IWin) && JSH > 2) break; + dl->winLum(IHR)[iWinCover_Shaded].sun += ZSU1refl * transMult / Constant::Pi; + FLFW[iWinCover_Shaded].sun += ZSU1refl * transMult * (1.0 - surfWin.fractionUpgoing); + FLCW[iWinCover_Shaded].sun += ZSU1refl * transMult * surfWin.fractionUpgoing; + } // End of check if window has shade, blind or diffusing glass + } // End of check if ZSU1refl > 0.0 + } // End of check if solar reflections are in effect + + // Sun-related portion of internally reflected illuminance - // Full area of window is used in following since effect of dividers on reducing - // effective window transmittance already accounted for in calc of FLFWSU and FLCWSU - // CR 7869 added effect of intervening interior windows on transmittance and - // added inside surface area of adjacent zone - dl->reflIllum(IHR, JSH).sun = (FLFW[JSH].sun * surfWin.rhoFloorWall + FLCW[JSH].sun * surfWin.rhoCeilingWall) * - (surf.Area / surfWin.glazedFrac) / (EnclInsideSurfArea * (1.0 - thisEnclDaylight.aveVisDiffReflect)); + // Full area of window is used in following since effect of dividers on reducing + // effective window transmittance already accounted for in calc of FLFWSU and FLCWSU + // CR 7869 added effect of intervening interior windows on transmittance and + // added inside surface area of adjacent zone + for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { + dl->reflIllum(IHR)[iWinCover].sun = (FLFW[iWinCover].sun * surfWin.rhoFloorWall + FLCW[iWinCover].sun * surfWin.rhoCeilingWall) * + (surf.Area / surfWin.glazedFrac) / (EnclInsideSurfArea * (1.0 - thisEnclDaylight.aveVisDiffReflect)); - dl->reflIllum(IHR, JSH).sunDisk = FLFW[JSH].sunDisk * surfWin.rhoFloorWall * (surf.Area / surfWin.glazedFrac) / - (EnclInsideSurfArea * (1.0 - thisEnclDaylight.aveVisDiffReflect)); + dl->reflIllum(IHR)[iWinCover].sunDisk = FLFW[iWinCover].sunDisk * surfWin.rhoFloorWall * (surf.Area / surfWin.glazedFrac) / + (EnclInsideSurfArea * (1.0 - thisEnclDaylight.aveVisDiffReflect)); } } // DayltgInterReflectedIllum() @@ -7956,8 +7827,9 @@ void ComplexFenestrationLuminances(EnergyPlusData &state, Vector3 groundHitPt; // Coordinates of point that ray from window center hits the ground (m) auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; - int CurCplxFenState = state.dataSurface->SurfaceWindow(IWin).ComplexFen.CurrentState; + int CurCplxFenState = s_surf->SurfaceWindow(IWin).ComplexFen.CurrentState; auto &complexWinGeom = state.dataBSDFWindow->ComplexWind(IWin).Geom(CurCplxFenState); // Calculate luminance from sky and sun excluding exterior obstruction transmittances and obstruction multipliers int SolBmIndex = complexWinGeom.SolBmIndex(IHR, state.dataGlobal->TimeStep); @@ -8016,7 +7888,7 @@ void ComplexFenestrationLuminances(EnergyPlusData &state, // add exterior ground element obstruction multipliers to calculated luminances. For sun reflection, calculate if // sun reaches the ground for that point - Vector3 const SUNCOS_IHR = state.dataSurface->SurfSunCosHourly(IHR); + Vector3 const SUNCOS_IHR = s_surf->SurfSunCosHourly(IHR); for (int iGndElem = 1; iGndElem <= complexWinRefPoint.NGnd(WinEl); ++iGndElem) { // case for sky elements. Integration is done over upper ground hemisphere to determine how many obstructions // were hit in the process @@ -8031,9 +7903,9 @@ void ComplexFenestrationLuminances(EnergyPlusData &state, // direct sun disk reflect off the ground Real64 SunObstrMultiplier = 1.0; - if (state.dataSurface->CalcSolRefl) { + if (s_surf->CalcSolRefl) { // Sun reaches ground point if vector from this point to the sun is unobstructed - for (int ObsSurfNum : state.dataSurface->AllShadowPossObstrSurfaceList) { + for (int ObsSurfNum : s_surf->AllShadowPossObstrSurfaceList) { groundHitPt = complexWinRefPoint.GndPt(iGndElem, WinEl); bool hitObs = PierceSurface(state, ObsSurfNum, groundHitPt, SUNCOS_IHR, obsHitPt); if (hitObs) { @@ -8063,7 +7935,7 @@ void ComplexFenestrationLuminances(EnergyPlusData &state, // add exterior ground element obstruction multipliers to calculated luminances. For sun reflection, calculate if // sun reaches the ground for that point - Vector3 const SUNCOS_IHR = state.dataSurface->SurfSunCosHourly(IHR); + Vector3 const SUNCOS_IHR = s_surf->SurfSunCosHourly(IHR); for (int iGndElem = 1; iGndElem <= complexWinIllumMap.NGnd(WinEl); ++iGndElem) { // case for sky elements. Integration is done over upper ground hemisphere to determine how many obstructions // were hit in the process @@ -8077,9 +7949,9 @@ void ComplexFenestrationLuminances(EnergyPlusData &state, // direct sun disk reflect off the ground Real64 SunObstrMultiplier = 1.0; - if (state.dataSurface->CalcSolRefl) { + if (s_surf->CalcSolRefl) { // Sun reaches ground point if vector from this point to the sun is unobstructed - for (int ObsSurfNum : state.dataSurface->AllShadowPossObstrSurfaceList) { + for (int ObsSurfNum : s_surf->AllShadowPossObstrSurfaceList) { groundHitPt = complexWinIllumMap.GndPt(iGndElem, WinEl); bool hitObs = PierceSurface(state, ObsSurfNum, groundHitPt, SUNCOS_IHR, obsHitPt); @@ -8117,6 +7989,7 @@ void DayltgInterReflectedIllumComplexFenestration(EnergyPlusData &state, // light from the inside surfaces of the space. auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; Array1D FL; // Sky related luminous flux // Array1D FLSU; // Sun related luminous flux, excluding entering beam @@ -8145,8 +8018,8 @@ void DayltgInterReflectedIllumComplexFenestration(EnergyPlusData &state, // REAL(r64) :: LambdaTrn ! current lambda value for incoming direction Real64 dirTrans; // directional bsdf transmittance - auto const &surf = state.dataSurface->Surface(IWin); - auto const &surfWin = state.dataSurface->SurfaceWindow(IWin); + auto const &surf = s_surf->Surface(IWin); + auto const &surfWin = s_surf->SurfaceWindow(IWin); int CurCplxFenState = surfWin.ComplexFen.CurrentState; auto &complexWinGeom = state.dataBSDFWindow->ComplexWind(IWin).Geom(CurCplxFenState); @@ -8221,13 +8094,14 @@ void DayltgInterReflectedIllumComplexFenestration(EnergyPlusData &state, auto const &thisEnclDaylight = dl->enclDaylight(dl->daylightControl(daylightCtrlNum).enclIndex); Real64 EnclInsideSurfArea = thisEnclDaylight.totInsSurfArea; - auto &eintsk = dl->reflIllum(IHR, 1); + auto &eintsk = dl->reflIllum(IHR)[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { eintsk.sky[iSky] = FFTot.sky[iSky] * (surf.Area / surfWin.glazedFrac) / (EnclInsideSurfArea * (1.0 - thisEnclDaylight.aveVisDiffReflect)); } // for (iSky) - dl->reflIllum(IHR, 1).sun = FFTot.sun * (surf.Area / surfWin.glazedFrac) / (EnclInsideSurfArea * (1.0 - thisEnclDaylight.aveVisDiffReflect)); - dl->reflIllum(IHR, 1).sunDisk = + dl->reflIllum(IHR)[iWinCover_Bare].sun = + FFTot.sun * (surf.Area / surfWin.glazedFrac) / (EnclInsideSurfArea * (1.0 - thisEnclDaylight.aveVisDiffReflect)); + dl->reflIllum(IHR)[iWinCover_Bare].sunDisk = FFTot.sunDisk * (surf.Area / surfWin.glazedFrac) / (EnclInsideSurfArea * (1.0 - thisEnclDaylight.aveVisDiffReflect)); if (allocated(FL)) FL.deallocate(); @@ -8257,6 +8131,7 @@ void DayltgDirectIllumComplexFenestration(EnergyPlusData &state, // DATE WRITTEN June 2013 auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; // Luminances from different sources to the window Array1D ElementLuminance; // sky related luminance at window element (exterior side) @@ -8272,9 +8147,9 @@ void DayltgDirectIllumComplexFenestration(EnergyPlusData &state, Real64 zProjection; // z-axe projection of solid view angle (used to calculate amount of light at horizontal surface // laying at reference point) - int CurCplxFenState = state.dataSurface->SurfaceWindow(IWin).ComplexFen.CurrentState; + int CurCplxFenState = s_surf->SurfaceWindow(IWin).ComplexFen.CurrentState; auto &complexWin = state.dataBSDFWindow->ComplexWind(IWin); - int iConst = state.dataSurface->SurfaceWindow(IWin).ComplexFen.State(CurCplxFenState).Konst; + int iConst = s_surf->SurfaceWindow(IWin).ComplexFen.State(CurCplxFenState).Konst; int NIncBasis = complexWin.Geom(CurCplxFenState).Inc.NBasis; if (!allocated(ElementLuminance)) ElementLuminance.allocate(NIncBasis); @@ -8321,16 +8196,16 @@ void DayltgDirectIllumComplexFenestration(EnergyPlusData &state, } // Store solution in global variables - auto &avwlsk = dl->avgWinLum(IHR, 1); - auto &edirsk = dl->dirIllum(IHR, 1); + auto &avwlsk = dl->avgWinLum(IHR)[iWinCover_Bare]; + auto &edirsk = dl->dirIllum(IHR)[iWinCover_Bare]; for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { avwlsk.sky[iSky] += WinLum.sky[iSky]; edirsk.sky[iSky] += EDir.sky[iSky]; } - dl->avgWinLum(IHR, 1).sun += WinLum.sun; - dl->dirIllum(IHR, 1).sun += EDir.sun; + dl->avgWinLum(IHR)[iWinCover_Bare].sun += WinLum.sun; + dl->dirIllum(IHR)[iWinCover_Bare].sun += EDir.sun; // AVWLSUdisk(1,IHR) = AVWLSUdisk(1,IHR) + WinLumSUdisk } // DayltgDirectIllumComplexFenestration() @@ -8353,10 +8228,11 @@ void DayltgDirectSunDiskComplexFenestration(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; assert(CalledFrom != CalledFor::MapPoint || MapNum > 0); - auto const &window = state.dataSurface->SurfaceWindow(iWin); + auto const &window = s_surf->SurfaceWindow(iWin); int CurCplxFenState = window.ComplexFen.CurrentState; int iConst = window.ComplexFen.State(CurCplxFenState).Konst; @@ -8399,7 +8275,7 @@ void DayltgDirectSunDiskComplexFenestration(EnergyPlusData &state, Real64 dirTrans = (SolBmIndex > 0) ? state.dataConstruction->Construct(iConst).BSDFInput.VisFrtTrans(iTrnElem, SolBmIndex) : 0.0; Real64 LambdaTrn = complexWindowGeom.Trn.Lamda(iTrnElem); Vector3 V = -complexWindowGeom.sTrn(iTrnElem); - Vector3 RWin = state.dataSurface->Surface(iWin).Centroid; + Vector3 RWin = s_surf->Surface(iWin).Centroid; Real64 TransBeam = DayltgHitObstruction(state, iHour, iWin, RWin, V); WinLum.sunDisk += (14700.0 * std::sqrt(0.000068 * PosFac) * double(NumEl) / std::pow(WindowSolidAngleDaylightPoint, 0.8)) * dirTrans * @@ -8408,8 +8284,8 @@ void DayltgDirectSunDiskComplexFenestration(EnergyPlusData &state, ElemLum.sunDisk += RayZ * dirTrans * LambdaTrn * TransBeam; } // for (iTrnElem) - dl->avgWinLum(iHour, 1).sunDisk = WinLum.sunDisk; - dl->dirIllum(iHour, 1).sunDisk = ElemLum.sunDisk; + dl->avgWinLum(iHour)[iWinCover_Bare].sunDisk = WinLum.sunDisk; + dl->dirIllum(iHour)[iWinCover_Bare].sunDisk = ElemLum.sunDisk; } Real64 DayltgSkyLuminance(EnergyPlusData const &state, @@ -8446,7 +8322,7 @@ Real64 DayltgSkyLuminance(EnergyPlusData const &state, // PHSKY ranges from 0 to Pi starting with 0 at the horizon and Pi/2 at the zenith. // FUNCTION LOCAL VARIABLE DECLARATIONS: - auto &dl = state.dataDayltg; + auto const &dl = state.dataDayltg; Real64 G = 0.0; // Angle between sun and element of sky (radians) Real64 COSG = 0.0; // Cosine of G @@ -8516,14 +8392,14 @@ Real64 ProfileAngle(EnergyPlusData &state, // and parallel to the X-axis of the window (the axis along // which the width of the window is measured). // If VERTICAL, calculates ProfileAngVert - - auto const &surf = state.dataSurface->Surface(SurfNum); - if (HorOrVert == DataWindowEquivalentLayer::Orientation::Horizontal) { // Profile angle for horizontal structures - Real64 ElevWin = - Constant::PiOvr2 - surf.Tilt * Constant::DegToRadians; // Window elevation: angle between outward normal and horizontal (radians) - Real64 AzimWin = (90.0 - surf.Azimuth) * Constant::DegToRadians; // Window azimuth (radians) - Real64 ElevSun = std::asin(CosDirSun.z); // Sun elevation; angle between sun and horizontal (radians) - Real64 AzimSun = std::atan2(CosDirSun.y, CosDirSun.x); // Sun azimuth (radians) + auto &s_surf = state.dataSurface; + + auto const &surf = s_surf->Surface(SurfNum); + if (HorOrVert == DataWindowEquivalentLayer::Orientation::Horizontal) { // Profile angle for horizontal structures + Real64 ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRad; // Window elevation: angle between outward normal and horizontal (radians) + Real64 AzimWin = (90.0 - surf.Azimuth) * Constant::DegToRad; // Window azimuth (radians) + Real64 ElevSun = std::asin(CosDirSun.z); // Sun elevation; angle between sun and horizontal (radians) + Real64 AzimSun = std::atan2(CosDirSun.y, CosDirSun.x); // Sun azimuth (radians) return std::atan(std::sin(ElevSun) / std::abs(std::cos(ElevSun) * std::cos(AzimWin - AzimSun))) - ElevWin; } else { // Profile angle for vertical structures Real64 ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRadians; @@ -8571,6 +8447,7 @@ void DayltgClosestObstruction(EnergyPlusData &state, // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // = 0 if no obstruction is hit. + auto &s_surf = state.dataSurface; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Vector3 HitPt; // Hit point on an obstruction (m) @@ -8579,9 +8456,9 @@ void DayltgClosestObstruction(EnergyPlusData &state, NearestHitSurfNum = 0; Real64 NearestHitDistance_sq(std::numeric_limits::max()); // Distance squared from receiving point to nearest hit point for a ray (m^2) NearestHitPt = 0.0; - if (state.dataSurface->TotSurfaces < octreeCrossover) { // Linear search through surfaces + if (s_surf->TotSurfaces < octreeCrossover) { // Linear search through surfaces - for (int ObsSurfNum : state.dataSurface->AllShadowPossObstrSurfaceList) { + for (int ObsSurfNum : s_surf->AllShadowPossObstrSurfaceList) { // Determine if this ray hits the surface and, if so, get the distance from the receiving point to the hit hit = PierceSurface(state, ObsSurfNum, RecPt, RayVec, HitPt); if (!hit) // Ray pierces surface @@ -8589,8 +8466,7 @@ void DayltgClosestObstruction(EnergyPlusData &state, // If obstruction is a window and its base surface is the nearest obstruction hit so far set nearestHitSurface to this window // Note that in this case NearestHitDistance_sq has already been calculated, so does not have to be recalculated - if ((state.dataSurface->Surface(ObsSurfNum).Class == SurfaceClass::Window) && - (state.dataSurface->Surface(ObsSurfNum).BaseSurf == NearestHitSurfNum)) { + if ((s_surf->Surface(ObsSurfNum).Class == SurfaceClass::Window) && (s_surf->Surface(ObsSurfNum).BaseSurf == NearestHitSurfNum)) { NearestHitSurfNum = ObsSurfNum; } else { // Distance squared from receiving point to hit point @@ -8609,7 +8485,7 @@ void DayltgClosestObstruction(EnergyPlusData &state, SurfaceData const *nearestHitSurface(nullptr); // Lambda function for the octree to test for surface hit - auto surfaceHit = [=, &state, &RecPt, &RayVec, &hit, &NearestHitDistance_sq, &nearestHitSurface, &NearestHitPt](SurfaceData const &surface) { + auto surfaceHit = [&s_surf, &RecPt, &RayVec, &hit, &NearestHitDistance_sq, &nearestHitSurface, &NearestHitPt](SurfaceData const &surface) { if (surface.IsShadowPossibleObstruction) { Vector3 HitPt; // Determine if this ray hits the surface and, if so, get the distance from the receiving point to the hit @@ -8618,8 +8494,7 @@ void DayltgClosestObstruction(EnergyPlusData &state, // If obstruction is a window and its base surface is the nearest obstruction hit so far set nearestHitSurface to this window // Note that in this case NearestHitDistance_sq has already been calculated, so does not have to be recalculated - if ((surface.Class == SurfaceClass::Window) && (surface.BaseSurf > 0) && - (&state.dataSurface->Surface(surface.BaseSurf) == nearestHitSurface)) { + if ((surface.Class == SurfaceClass::Window) && (surface.BaseSurf > 0) && (&s_surf->Surface(surface.BaseSurf) == nearestHitSurface)) { nearestHitSurface = &surface; } else { // Distance squared from receiving point to hit point @@ -8638,8 +8513,8 @@ void DayltgClosestObstruction(EnergyPlusData &state, Vector3 const RayVec_inv(SurfaceOctreeCube::safe_inverse(RayVec)); state.dataHeatBalMgr->surfaceOctree.processSurfaceRayIntersectsCube(RecPt, RayVec, RayVec_inv, surfaceHit); if (nearestHitSurface != nullptr) { // Find surface number: This is inefficient: Improve when surfaces know their own number - for (int i = 1; i <= state.dataSurface->TotSurfaces; ++i) { - if (&state.dataSurface->Surface(i) == nearestHitSurface) { + for (int i = 1; i <= s_surf->TotSurfaces; ++i) { + if (&s_surf->Surface(i) == nearestHitSurface) { NearestHitSurfNum = i; break; } @@ -8674,10 +8549,11 @@ Real64 DayltgSurfaceLumFromSun(EnergyPlusData &state, bool hitObs; // True iff obstruction is hit Real64 DiffVisRefl; // Diffuse visible reflectance of ReflSurfNum + auto &s_surf = state.dataSurface; // Skip daylighting shelves since reflection from these is separately calculated - if (state.dataSurface->SurfDaylightingShelfInd(ReflSurfNum) > 0) return 0.0; + if (s_surf->SurfDaylightingShelfInd(ReflSurfNum) > 0) return 0.0; - auto const &reflSurf = state.dataSurface->Surface(ReflSurfNum); + auto const &reflSurf = s_surf->Surface(ReflSurfNum); // Normal to reflecting surface in hemisphere containing window element SurfaceLumFromSunReflNorm = reflSurf.OutNormVec; @@ -8687,13 +8563,13 @@ Real64 DayltgSurfaceLumFromSun(EnergyPlusData &state, } } // Cosine of angle of incidence of sun at HitPt if sun were to reach HitPt - Vector3 const SUNCOS_IHR = state.dataSurface->SurfSunCosHourly(IHR); + Vector3 const SUNCOS_IHR = s_surf->SurfSunCosHourly(IHR); Real64 CosIncAngAtHitPt = dot(SurfaceLumFromSunReflNorm, SUNCOS_IHR); // Require that the sun be in front of this surface relative to window element if (CosIncAngAtHitPt <= 0.0) return 0.0; // Sun is in back of reflecting surface // Sun reaches ReflHitPt if vector from ReflHitPt to sun is unobstructed hitObs = false; - for (int ObsSurfNum : state.dataSurface->AllShadowPossObstrSurfaceList) { + for (int ObsSurfNum : s_surf->AllShadowPossObstrSurfaceList) { // Exclude as a possible obstructor ReflSurfNum and its base surface (if it has one) if (ObsSurfNum == ReflSurfNum || ObsSurfNum == reflSurf.BaseSurf) continue; hitObs = PierceSurface(state, ObsSurfNum, ReflHitPt, SUNCOS_IHR, SurfaceLumFromSunObsHitPt); @@ -8704,7 +8580,7 @@ Real64 DayltgSurfaceLumFromSun(EnergyPlusData &state, // Obstruction was not hit; sun reaches ReflHitPt. // Calculate luminance at ReflHitPt due to beam solar reflection (for unit beam normal illuminance) if (reflSurf.IsShadowing) { - DiffVisRefl = state.dataSurface->SurfShadowDiffuseVisRefl(ReflSurfNum); + DiffVisRefl = s_surf->SurfShadowDiffuseVisRefl(ReflSurfNum); // Note that if the shadowing surface has a non-zero glazing fraction (e.g., neighboring bldg) that the above is // (1 - glazing fraction) * (vis refl of opaque part of shadowing surface); specular reflection is // excluded in this value of DiffVisRefl. @@ -8763,6 +8639,8 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) if (state.dataGlobal->WarmupFlag) return; + auto &s_surf = state.dataSurface; + daylight_illum.allocate(MaxMapRefPoints); // Initialize reference point illuminance and window background luminance @@ -8803,15 +8681,15 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) // Added TH 6/29/2009 for thermochromic windows Real64 VTRatio = 1.0; if (NREFPT > 0) { - int IConst = state.dataSurface->Surface(IWin).Construction; + int IConst = s_surf->Surface(IWin).Construction; auto const &construction = state.dataConstruction->Construct(IConst); - if (construction.TCFlag == 1) { + if (construction.isTCWindow) { // 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 Real64 VTNow = General::POLYF(1.0, construction.TransVisBeamCoef); - Real64 VTMaster = General::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConst).TransVisBeamCoef); + Real64 VTMaster = General::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); VTRatio = VTNow / VTMaster; } } @@ -8822,89 +8700,47 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) std::array DFHR; // Sky daylight factor for sky type, bare/shaded window auto &dfhr = DFHR[iWinCover_Bare]; - auto &dfhr2 = DFHR[iWinCover_Shaded]; - - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(IWin); - int slatAngLo = SurfWinSlatsAngIndex + 1; - int slatAngHi = min(slatAngLo + 1, Material::MaxSlatAngs + 1); - Real64 interpFac = state.dataSurface->SurfWinSlatsAngInterpFac(IWin); + auto &dfhrSh = DFHR[iWinCover_Shaded]; + auto &surfShade = s_surf->surfShades(IWin); // Loop over reference points for (int ILB = 1; ILB <= NREFPT; ++ILB) { - - auto const &illSkyCurr = daylFacHrCurr(loop, ILB, 1); - auto const &illSkyPrev = daylFacHrPrev(loop, ILB, 1); - auto const &ill2SkyCurr = daylFacHrCurr(loop, ILB, 2); - auto const &ill2SkyPrev = daylFacHrPrev(loop, ILB, 2); - - auto const &illLoSkyCurr = daylFacHrCurr(loop, ILB, slatAngLo); - auto const &illLoSkyPrev = daylFacHrPrev(loop, ILB, slatAngLo); - auto const &illHiSkyCurr = daylFacHrCurr(loop, ILB, slatAngHi); - auto const &illHiSkyPrev = daylFacHrPrev(loop, ILB, slatAngHi); + // if (ILB != 5) continue; + auto const &illSkyCurr = daylFacHrCurr(loop, ILB)[iWinCover_Bare]; + auto const &illSkyPrev = daylFacHrPrev(loop, ILB)[iWinCover_Bare]; + auto const &illShSkyCurr = daylFacHrCurr(loop, ILB)[iWinCover_Shaded]; + auto const &illShSkyPrev = daylFacHrPrev(loop, ILB)[iWinCover_Shaded]; // Daylight factors for current sun position for (int iSky = (int)SkyType::Clear; iSky < (int)SkyType::Num; ++iSky) { // ===Bare window=== dfhr.sky[iSky] = VTRatio * (wgtThisHr * illSkyCurr.sky[iSky] + wgtPrevHr * illSkyPrev.sky[iSky]); - if ((state.dataSurface->SurfWinWindowModelType(IWin) != WindowModel::BSDF) && - (IS_SHADED(state.dataSurface->SurfWinShadingFlag(IWin)) || state.dataSurface->SurfWinSolarDiffusing(IWin))) { + if ((s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF) && + (IS_SHADED(s_surf->SurfWinShadingFlag(IWin)) || s_surf->SurfWinSolarDiffusing(IWin))) { // ===Shaded window=== - if (!state.dataSurface->SurfWinMovableSlats(IWin)) { - // Shade, screen, blind with fixed slats, or diffusing glass - dfhr2.sky[iSky] = VTRatio * (wgtThisHr * ill2SkyCurr.sky[iSky] + wgtPrevHr * ill2SkyPrev.sky[iSky]); - - } else { // Blind with movable slats - Real64 illSkyCurr = General::Interp(illLoSkyCurr.sky[iSky], illHiSkyCurr.sky[iSky], interpFac); - Real64 illSkyPrev = General::Interp(illLoSkyPrev.sky[iSky], illHiSkyPrev.sky[iSky], interpFac); - - dfhr2.sky[iSky] = VTRatio * (wgtThisHr * illSkyCurr + wgtPrevHr * illSkyPrev); - } // End of check if window has blind with movable slats - } // End of check if window is shaded or has diffusing glass - } // for (iSky) + // Shade, screen, blind with fixed slats, or diffusing glass + dfhrSh.sky[iSky] = VTRatio * (wgtThisHr * illShSkyCurr.sky[iSky] + wgtPrevHr * illShSkyPrev.sky[iSky]); + } // End of check if window is shaded or has diffusing glass + } // for (iSky) // Sun daylight factor for bare/shaded window std::array tmpDFHR; - tmpDFHR[iWinCover_Bare].sun = VTRatio * (wgtThisHr * (daylFacHrCurr(loop, ILB, 1).sun + daylFacHrCurr(loop, ILB, 1).sunDisk) + - wgtPrevHr * (daylFacHrPrev(loop, ILB, 1).sun + daylFacHrPrev(loop, ILB, 1).sunDisk)); + tmpDFHR[iWinCover_Bare].sun = + VTRatio * (wgtThisHr * (illSkyCurr.sun + illSkyCurr.sunDisk) + wgtPrevHr * (illSkyPrev.sun + illSkyPrev.sunDisk)); - if ((state.dataSurface->SurfWinWindowModelType(IWin) != WindowModel::BSDF) && - (IS_SHADED(state.dataSurface->SurfWinShadingFlag(IWin)) || state.dataSurface->SurfWinSolarDiffusing(IWin))) { + if ((s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF) && + (IS_SHADED(s_surf->SurfWinShadingFlag(IWin)) || s_surf->SurfWinSolarDiffusing(IWin))) { // ===Shaded window=== - if (!state.dataSurface->SurfWinMovableSlats(IWin)) { - // Shade, screen, blind with fixed slats, or diffusing glass - tmpDFHR[iWinCover_Shaded].sun = - VTRatio * (wgtThisHr * daylFacHrCurr(loop, ILB, 2).sun + wgtPrevHr * daylFacHrPrev(loop, ILB, 2).sun); + // Shade, screen, blind with fixed slats, or diffusing glass + tmpDFHR[iWinCover_Shaded].sun = VTRatio * (wgtThisHr * illShSkyCurr.sun + wgtPrevHr * illShSkyPrev.sun); - if (!state.dataSurface->SurfWinSlatsBlockBeam(IWin)) { - tmpDFHR[iWinCover_Shaded].sun += - VTRatio * (wgtThisHr * daylFacHrCurr(loop, ILB, 2).sunDisk + wgtPrevHr * daylFacHrPrev(loop, ILB, 2).sunDisk); - } - } else { // Blind with movable slats - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(IWin); - int slatAngLo = SurfWinSlatsAngIndex + 1; - int slatAngHi = min(slatAngLo + 1, Material::MaxSlatAngs + 1); - Real64 interpFac = state.dataSurface->SurfWinSlatsAngInterpFac(IWin); - - Real64 DaylIllFacSunNow = - General::Interp(daylFacHrCurr(loop, ILB, slatAngLo).sun, daylFacHrCurr(loop, ILB, slatAngHi).sun, interpFac); - Real64 DaylIllFacSunPrev = - General::Interp(daylFacHrPrev(loop, ILB, slatAngLo).sun, daylFacHrPrev(loop, ILB, slatAngHi).sun, interpFac); - DFHR[iWinCover_Shaded].sun = VTRatio * (wgtThisHr * DaylIllFacSunNow + wgtPrevHr * DaylIllFacSunPrev); - - // We add the contribution from the solar disk if slats do not block beam solar - // TH CR 8010, DaylIllFacSunDisk needs to be interpolated - if (!state.dataSurface->SurfWinSlatsBlockBeam(IWin)) { - Real64 DaylIllFacSunDiskNow = - General::Interp(daylFacHrCurr(loop, ILB, slatAngLo).sunDisk, daylFacHrCurr(loop, ILB, slatAngHi).sunDisk, interpFac); - Real64 DaylIllFacSunDiskPrev = - General::Interp(daylFacHrPrev(loop, ILB, slatAngLo).sunDisk, daylFacHrPrev(loop, ILB, slatAngHi).sunDisk, interpFac); - DFHR[iWinCover_Shaded].sun += VTRatio * (wgtThisHr * DaylIllFacSunDiskNow + wgtPrevHr * DaylIllFacSunDiskPrev); - } - } // End of check if window has blind with movable slats - } // End of check if window is shaded or has diffusing glass + if (!surfShade.blind.slatBlockBeam) { + tmpDFHR[iWinCover_Shaded].sun += VTRatio * (wgtThisHr * illShSkyCurr.sunDisk + wgtPrevHr * illShSkyPrev.sunDisk); + } + } // End of check if window is shaded or has diffusing glass // Get illuminance at ref point from bare and shaded window by // multiplying daylight factors by exterior horizontal illuminance @@ -8925,14 +8761,14 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { if (iWinCover == iWinCover_Shaded) { - if (state.dataSurface->SurfWinWindowModelType(IWin) == WindowModel::BSDF) break; - if (NOT_SHADED(state.dataSurface->SurfWinShadingFlag(IWin)) && !state.dataSurface->SurfWinSolarDiffusing(IWin)) break; + if (s_surf->SurfWinWindowModelType(IWin) == WindowModel::BSDF) break; + if (NOT_SHADED(s_surf->SurfWinShadingFlag(IWin)) && !s_surf->SurfWinSolarDiffusing(IWin)) break; } - auto const &dfhr = DFHR[iWinCover]; + auto const &dfhr3 = DFHR[iWinCover]; thisMap.refPts(ILB).winLums(loop)[iWinCover] = tmpDFHR[iWinCover].sun * state.dataEnvrn->HISUNF + - HorIllSkyFac * (dfhr.sky[iSky1] * SkyWeight * tmpHorIll.sky[iSky1] + - dfhr.sky[iSky2] * (1.0 - SkyWeight) * tmpHorIll.sky[iSky2]); + HorIllSkyFac * (dfhr3.sky[iSky1] * SkyWeight * tmpHorIll.sky[iSky1] + + dfhr3.sky[iSky2] * (1.0 - SkyWeight) * tmpHorIll.sky[iSky2]); } } // End of reference point loop @@ -8944,32 +8780,32 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) for (int loop = 1; loop <= thisEnclDaylight.NumOfDayltgExtWins; ++loop) { int IWin = thisEnclDaylight.DayltgExtWinSurfNums(loop); - auto const &surfWin = state.dataSurface->SurfaceWindow(IWin); + auto const &surfWin = s_surf->SurfaceWindow(IWin); - int IS = findWinShadingStatus(state, IWin); + WinCover winCover = findWinShadingStatus(state, IWin); // CR 8057. 3/17/2010. // Switchable windows may be in partially switched state rather than fully dark state Real64 VTMULT = 1.0; - int ICtrl = state.dataSurface->Surface(IWin).activeWindowShadingControl; - if (state.dataSurface->Surface(IWin).HasShadeControl) { - if (state.dataSurface->WindowShadingControl(ICtrl).shadingControlType == WindowShadingControlType::MeetDaylIlumSetp && - state.dataSurface->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing) { + int ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + if (s_surf->Surface(IWin).HasShadeControl) { + if (s_surf->WindowShadingControl(ICtrl).shadingControlType == WindowShadingControlType::MeetDaylIlumSetp && + s_surf->SurfWinShadingFlag(IWin) == WinShadingType::SwitchableGlazing) { // switchable windows in partial or fully switched state, // get its intermediate VT calculated in DayltgInteriorIllum - int IConstShaded = state.dataSurface->Surface(IWin).activeShadedConstruction; + int IConstShaded = s_surf->Surface(IWin).activeShadedConstruction; if (IConstShaded > 0) { // Visible transmittance (VT) of electrochromic (EC) windows in fully dark state Real64 VTDark = General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; - if (VTDark > 0) VTMULT = state.dataSurface->SurfWinVisTransSelected(IWin) / VTDark; + if (VTDark > 0) VTMULT = s_surf->SurfWinVisTransSelected(IWin) / VTDark; } } } for (int IL = 1; IL <= NREFPT; ++IL) { // Determine if illuminance contribution is from bare or shaded window - daylight_illum(IL) += VTMULT * thisMap.refPts(IL).winLums(loop)[IS - 1]; + daylight_illum(IL) += VTMULT * thisMap.refPts(IL).winLums(loop)[(int)winCover]; } } // End of second window loop @@ -9229,6 +9065,7 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) // Count number of exterior Windows (use to allocate arrays) auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; for (int enclNum = 1; enclNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclNum) { auto &thisEnclDaylight = dl->enclDaylight(enclNum); @@ -9236,7 +9073,7 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) // Count exterior windows in this solar enclosure for (int const surfNum : state.dataViewFactor->EnclSolInfo(enclNum).SurfacePtr) { - auto const &surf = state.dataSurface->Surface(surfNum); + auto const &surf = s_surf->Surface(surfNum); if ((surf.Class == SurfaceClass::Window && surf.ExtBoundCond == ExternalEnvironment) || surf.OriginalClass == SurfaceClass::TDD_Diffuser) { ++thisEnclDaylight.TotalExtWindows; @@ -9256,8 +9093,8 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) // Require that adjEnclNum have a least one exterior window bool AdjEnclHasExtWins = false; for (int SurfNumAdj : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - if ((state.dataSurface->Surface(SurfNumAdj).Class == SurfaceClass::Window) && - (state.dataSurface->Surface(SurfNumAdj).ExtBoundCond == ExternalEnvironment)) { + if ((s_surf->Surface(SurfNumAdj).Class == SurfaceClass::Window) && + (s_surf->Surface(SurfNumAdj).ExtBoundCond == ExternalEnvironment)) { AdjEnclHasExtWins = true; break; } @@ -9265,10 +9102,10 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) if (!AdjEnclHasExtWins) continue; // Loop again through surfaces in ZoneNumAdj and see if any are interior windows adjacent to ZoneNum for (int SurfNumAdj : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - auto const &surfAdj = state.dataSurface->Surface(SurfNumAdj); + auto const &surfAdj = s_surf->Surface(SurfNumAdj); if ((surfAdj.Class == SurfaceClass::Window) && (surfAdj.ExtBoundCond >= 1)) { // This is an interior window in ZoneNumAdj - if (state.dataSurface->Surface(surfAdj.ExtBoundCond).SolarEnclIndex == enclNum) { + if (s_surf->Surface(surfAdj.ExtBoundCond).SolarEnclIndex == enclNum) { // This interior window is adjacent to ZoneNum ++NumList; break; @@ -9292,7 +9129,7 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) // Require that adjEnclNum have a least one exterior window bool AdjEnclHasExtWins = false; for (int SurfNumAdj : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - auto const &surfAdj = state.dataSurface->Surface(SurfNumAdj); + auto const &surfAdj = s_surf->Surface(SurfNumAdj); if (surfAdj.Class == SurfaceClass::Window && surfAdj.ExtBoundCond == ExternalEnvironment) { AdjEnclHasExtWins = true; break; @@ -9301,11 +9138,11 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) if (!AdjEnclHasExtWins) continue; // Loop again through surfaces in ZoneNumAdj and see if any are interior windows adjacent to enclNum for (int SurfNumAdj : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - auto const &surfAdj = state.dataSurface->Surface(SurfNumAdj); + auto const &surfAdj = s_surf->Surface(SurfNumAdj); if (surfAdj.Class != SurfaceClass::Window || surfAdj.ExtBoundCond < 1) continue; // This is an interior window in adjEnclNum - if (state.dataSurface->Surface(surfAdj.ExtBoundCond).SolarEnclIndex != enclNum) continue; + if (s_surf->Surface(surfAdj.ExtBoundCond).SolarEnclIndex != enclNum) continue; // This interior window is adjacent to ZoneNum ++NumList; @@ -9328,8 +9165,8 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) } for (int adjEnclNum : enclDayl.AdjIntWinEnclNums) { for (int SurfNumAdj : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - if ((state.dataSurface->Surface(SurfNumAdj).Class == SurfaceClass::Window) && - (state.dataSurface->Surface(SurfNumAdj).ExtBoundCond == ExternalEnvironment)) { + if ((s_surf->Surface(SurfNumAdj).Class == SurfaceClass::Window) && + (s_surf->Surface(SurfNumAdj).ExtBoundCond == ExternalEnvironment)) { ++enclDayl.NumOfIntWinAdjEnclExtWins; } } @@ -9341,7 +9178,7 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) int ExtWinIndex = 0; for (int adjEnclNum : enclDayl.AdjIntWinEnclNums) { for (int SurfNumAdj : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - auto const &surfAdj = state.dataSurface->Surface(SurfNumAdj); + auto const &surfAdj = s_surf->Surface(SurfNumAdj); if (surfAdj.Class != SurfaceClass::Window || surfAdj.ExtBoundCond != ExternalEnvironment) continue; ++ExtWinIndex; @@ -9351,10 +9188,10 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) // now count interior windows shared by both zones int NumOfIntWindowsCount = 0; for (int SurfNumAdj2 : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - auto const &surfAdj2 = state.dataSurface->Surface(SurfNumAdj2); + auto const &surfAdj2 = s_surf->Surface(SurfNumAdj2); if ((surfAdj2.Class == SurfaceClass::Window) && (surfAdj2.ExtBoundCond >= 1)) { // This is an interior window in ZoneNumAdj - if (state.dataSurface->Surface(surfAdj2.ExtBoundCond).SolarEnclIndex == enclNum) { + if (s_surf->Surface(surfAdj2.ExtBoundCond).SolarEnclIndex == enclNum) { // This interior window is adjacent to ZoneNum and associated with this ++NumOfIntWindowsCount; } @@ -9366,11 +9203,11 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) intWinAdjEnclExtWin.IntWinNum = 0; int IntWinIndex = 0; for (int SurfNumAdj2 : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - auto const &surfAdj2 = state.dataSurface->Surface(SurfNumAdj2); + auto const &surfAdj2 = s_surf->Surface(SurfNumAdj2); if (surfAdj2.Class != SurfaceClass::Window || surfAdj2.ExtBoundCond < 1) continue; // This is an interior window in ZoneNumAdj - if (state.dataSurface->Surface(surfAdj2.ExtBoundCond).SolarEnclIndex == enclNum) { + if (s_surf->Surface(surfAdj2.ExtBoundCond).SolarEnclIndex == enclNum) { // This interior window is adjacent to ZoneNum and associated with this intWinAdjEnclExtWin.IntWinNum(++IntWinIndex) = SurfNumAdj2; } @@ -9391,7 +9228,7 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) // Get exterior windows in this solar enclosure for (int const surfNum : state.dataViewFactor->EnclSolInfo(enclNum).SurfacePtr) { - auto const &surf = state.dataSurface->Surface(surfNum); + auto const &surf = s_surf->Surface(surfNum); if ((surf.Class == SurfaceClass::Window && surf.ExtBoundCond == ExternalEnvironment) || surf.OriginalClass == SurfaceClass::TDD_Diffuser) { ++enclExtWin(enclNum); @@ -9405,7 +9242,7 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) // Get exterior windows in EnclNumAdj -- there must be at least one, otherwise // it would not be an "AdjIntWinEncl" for (int SurfNumAdj : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - auto const &surfAdj = state.dataSurface->Surface(SurfNumAdj); + auto const &surfAdj = s_surf->Surface(SurfNumAdj); if ((surfAdj.Class == SurfaceClass::Window && surfAdj.ExtBoundCond == ExternalEnvironment) || surfAdj.OriginalClass == SurfaceClass::TDD_Diffuser) { ++enclExtWin(enclNum); @@ -9444,7 +9281,7 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) int enclExtWinCtr = 0; for (int const surfNum : state.dataViewFactor->EnclSolInfo(enclNum).SurfacePtr) { - auto const &surf = state.dataSurface->Surface(surfNum); + auto const &surf = s_surf->Surface(surfNum); if ((surf.Class == SurfaceClass::Window && surf.ExtBoundCond == ExternalEnvironment) || surf.OriginalClass == SurfaceClass::TDD_Diffuser) { ++enclExtWinCtr; @@ -9458,21 +9295,21 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) // Get exterior windows in EnclNumAdj -- there must be at least one, otherwise // it would not be an "AdjIntWinEncl" for (int SurfNumAdj : state.dataViewFactor->EnclSolInfo(adjEnclNum).SurfacePtr) { - auto &surfAdj = state.dataSurface->Surface(SurfNumAdj); + auto &surfAdj = s_surf->Surface(SurfNumAdj); if ((surfAdj.Class == SurfaceClass::Window && surfAdj.ExtBoundCond == ExternalEnvironment) || surfAdj.OriginalClass == SurfaceClass::TDD_Diffuser) { ++enclExtWinCtr; thisEnclDaylight.DayltgExtWinSurfNums(enclExtWinCtr) = SurfNumAdj; - auto &surfWinAdj = state.dataSurface->SurfaceWindow(SurfNumAdj); + auto &surfWinAdj = s_surf->SurfaceWindow(SurfNumAdj); // If no daylighting in the adjacent enclosure, set up variables anyway: if (state.dataViewFactor->EnclSolInfo(adjEnclNum).TotalEnclosureDaylRefPoints == 0 && - !state.dataSurface->SurfWinSurfDayLightInit(SurfNumAdj)) { + !s_surf->SurfWinSurfDayLightInit(SurfNumAdj)) { surfWinAdj.refPts.allocate(thisEnclNumRefPoints); for (auto &refPt : surfWinAdj.refPts) { new (&refPt) SurfaceWindowRefPt(); } - state.dataSurface->SurfWinSurfDayLightInit(SurfNumAdj) = true; + s_surf->SurfWinSurfDayLightInit(SurfNumAdj) = true; } } } // for (SurfNumAdj) @@ -9481,28 +9318,26 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) thisEnclDaylight.NumOfDayltgExtWins = enclExtWin(enclNum); int winSize = enclExtWin(enclNum); - int numSlatAngs = state.dataSurface->actualMaxSlatAngs + 1; for (int controlNum : thisEnclDaylight.daylightControlIndexes) { auto &thisDayltgCtrl = dl->daylightControl(controlNum); int refSize = thisDayltgCtrl.TotalDaylRefPoints; for (int iHr = 1; iHr <= (int)Constant::HoursInDay; ++iHr) { - thisDayltgCtrl.daylFac[iHr].allocate(winSize, refSize, numSlatAngs); + thisDayltgCtrl.daylFac[iHr].allocate(winSize, refSize); } } } // if (thisEncl.NumOfRefPoints > 0) - if (state.dataSurface->TotWinShadingControl > 0) { + if (s_surf->TotWinShadingControl > 0) { CreateShadeDeploymentOrder(state, enclNum); } } // for (enclNum) - int numSlatAngs = state.dataSurface->actualMaxSlatAngs + 1; for (int enclNum = 1; enclNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclNum) { auto const &thisEnclDaylight = dl->enclDaylight(enclNum); if (!thisEnclDaylight.hasSplitFluxDaylighting) continue; int thisEnclNumRefPoints = state.dataViewFactor->EnclSolInfo(enclNum).TotalEnclosureDaylRefPoints; if (thisEnclNumRefPoints > 0) { - if (state.dataSurface->TotWinShadingControl > 0) { + if (s_surf->TotWinShadingControl > 0) { MapShadeDeploymentOrderToLoopNumber(state, enclNum); } } @@ -9523,15 +9358,15 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) } for (int iHr = 1; iHr <= (int)Constant::HoursInDay; ++iHr) { - illumMap.daylFac[iHr].allocate(numExtWin, illumMap.TotalMapRefPoints, numSlatAngs); + illumMap.daylFac[iHr].allocate(numExtWin, illumMap.TotalMapRefPoints); } } // End of map loop - dl->dirIllum.dimension(Constant::HoursInDay, numSlatAngs, Illums()); - dl->reflIllum.dimension(Constant::HoursInDay, numSlatAngs, Illums()); - dl->winLum.dimension(Constant::HoursInDay, numSlatAngs, Illums()); - dl->avgWinLum.dimension(Constant::HoursInDay, numSlatAngs, Illums()); + dl->dirIllum.allocate(Constant::HoursInDay); + dl->reflIllum.allocate(Constant::HoursInDay); + dl->winLum.allocate(Constant::HoursInDay); + dl->avgWinLum.allocate(Constant::HoursInDay); static constexpr std::string_view Format_700("! , Enclosure Name, Number of Exterior Windows, " "Number of Exterior Windows in Adjacent Enclosures\n"); @@ -9572,10 +9407,11 @@ void CreateShadeDeploymentOrder(EnergyPlusData &state, int const enclNum) // create sorted list for shade deployment order // first step is to create a sortable list of WindowShadingControl objects by sequence auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; std::vector> shadeControlSequence; // sequence, WindowShadingControl - for (int iShadeCtrl = 1; iShadeCtrl <= state.dataSurface->TotWinShadingControl; ++iShadeCtrl) { - auto &winShadeControl = state.dataSurface->WindowShadingControl(iShadeCtrl); + for (int iShadeCtrl = 1; iShadeCtrl <= s_surf->TotWinShadingControl; ++iShadeCtrl) { + auto &winShadeControl = s_surf->WindowShadingControl(iShadeCtrl); for (int spaceNum : state.dataHeatBal->Zone(winShadeControl.ZoneIndex).spaceIndexes) { int shadeCtrlEnclNum = state.dataHeatBal->space(spaceNum).solarEnclosureNum; if (shadeCtrlEnclNum == enclNum) { @@ -9594,7 +9430,7 @@ void CreateShadeDeploymentOrder(EnergyPlusData &state, int const enclNum) auto &thisDaylightCtrl = dl->daylightControl(controlNum); for (auto sequence : shadeControlSequence) { // This is an iterator (THIS_AUTO_OK) int curShadeControlNum = sequence.second; - auto const &winShadeControl = state.dataSurface->WindowShadingControl(curShadeControlNum); + auto const &winShadeControl = s_surf->WindowShadingControl(curShadeControlNum); if (winShadeControl.multiSurfaceControl == MultiSurfaceControl::Group) { // add a group of surfaces since they should be deployed as a group std::vector group; @@ -9627,6 +9463,7 @@ void MapShadeDeploymentOrderToLoopNumber(EnergyPlusData &state, int const enclNu // Allow a way to map back to the original "loop" index that is used in many other places in the // ZoneDayLight data structure when traversing the list in the order of the window shaded deployment auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; auto const &thisEnclDaylight = dl->enclDaylight(enclNum); auto const &thisEnclSol = state.dataViewFactor->EnclSolInfo(enclNum); @@ -9651,7 +9488,7 @@ void MapShadeDeploymentOrderToLoopNumber(EnergyPlusData &state, int const enclNu "Check the Zone Name in the WindowShadingControl that references the following fenestration surfaces:"); showOnce = false; } - ShowContinueError(state, format(" - {}", state.dataSurface->Surface(IWinShdOrd).Name)); + ShowContinueError(state, format(" - {}", s_surf->Surface(IWinShdOrd).Name)); } for (int loop = 1; loop <= thisEnclDaylight.NumOfDayltgExtWins; ++loop) { int IWinLoop = thisEnclDaylight.DayltgExtWinSurfNums(loop); @@ -9679,19 +9516,20 @@ void DayltgInterReflIllFrIntWins(EnergyPlusData &state, int const enclNum) // at all reference points. auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; auto &enclDayl = dl->enclDaylight(enclNum); - auto &enclSol = state.dataViewFactor->EnclSolInfo(enclNum); + auto const &enclSol = state.dataViewFactor->EnclSolInfo(enclNum); enclDayl.InterReflIllFrIntWins = 0.0; for (int const IWin : enclSol.SurfacePtr) { - auto &surf = state.dataSurface->Surface(IWin); + auto &surf = s_surf->Surface(IWin); if (surf.Class != SurfaceClass::Window || surf.ExtBoundCond < 1) continue; - auto const &surfWin = state.dataSurface->SurfaceWindow(IWin); + auto const &surfWin = s_surf->SurfaceWindow(IWin); // This is an interior window in ZoneNum int const ConstrNum = surf.Construction; - int const adjEnclNum = state.dataSurface->Surface(surf.ExtBoundCond).SolarEnclIndex; + int const adjEnclNum = s_surf->Surface(surf.ExtBoundCond).SolarEnclIndex; // Luminous flux transmitted through an int win from adjacent zone's enclosure (lumens) Real64 QDifTrans = state.dataHeatBal->EnclSolQSDifSol(adjEnclNum) * state.dataConstruction->Construct(ConstrNum).TransDiffVis * surf.Area * state.dataEnvrn->PDIFLW; @@ -9725,6 +9563,7 @@ void CalcMinIntWinSolidAngs(EnergyPlusData &state) // exterior windows. auto &dl = state.dataDayltg; + auto &s_surf = state.dataSurface; for (int enclNum = 1; enclNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclNum) { auto &thisEnclDaylight = dl->enclDaylight(enclNum); @@ -9733,12 +9572,12 @@ void CalcMinIntWinSolidAngs(EnergyPlusData &state) if (thisEnclDaylight.NumOfIntWinAdjEncls == 0) continue; for (int IWin : state.dataViewFactor->EnclSolInfo(enclNum).SurfacePtr) { - auto const &surf = state.dataSurface->Surface(IWin); + auto const &surf = s_surf->Surface(IWin); if ((surf.Class != SurfaceClass::Window) || (surf.ExtBoundCond < 1)) continue; // This is an interior window in enclNum - int const winAdjEnclNum = state.dataSurface->Surface(surf.ExtBoundCond).SolarEnclIndex; + int const winAdjEnclNum = s_surf->Surface(surf.ExtBoundCond).SolarEnclIndex; bool IntWinNextToIntWinAdjZone = false; // True if an interior window is next to a zone with one or more exterior windows for (int adjEnclNum : thisEnclDaylight.AdjIntWinEnclNums) { if (winAdjEnclNum == adjEnclNum) { @@ -9776,8 +9615,7 @@ void CalcMinIntWinSolidAngs(EnergyPlusData &state) Vector3 W23 = W3 - W2; Real64 HW = W21.magnitude(); Real64 WW = W23.magnitude(); - Vector3 WC = - (is_Rectangle) ? (W2 + (W23 + W21) / 2.0) : (is_Triangle ? (W2 + (W23 + W21) / 3.0) : (W2 + (W23 + W21) / 3.0)); + Vector3 WC = (is_Rectangle) ? (W2 + (W23 + W21) / 2.0) : (W2 + (W23 + W21) / 3.0); // Vector from ref point to center of window Vector3 REFWC = WC - RREF; @@ -9833,6 +9671,8 @@ void CheckForGeometricTransform(EnergyPlusData &state, bool &doTransform, Real64 auto &ip = state.dataInputProcessing->inputProcessor; auto const &ipsc = state.dataIPShortCut; + auto &s_surf = state.dataSurface; + if (ip->getNumObjectsFound(state, CurrentModuleObject) == 1) { int NAlphas; int NNum; @@ -9856,11 +9696,11 @@ void CheckForGeometricTransform(EnergyPlusData &state, bool &doTransform, Real64 ShowWarningError(state, format("{}: invalid {}=\"{}...ignored.", CurrentModuleObject, ipsc->cAlphaFieldNames(1), cAlphas(1))); } doTransform = true; - state.dataSurface->AspectTransform = true; + s_surf->AspectTransform = true; } - if (state.dataSurface->WorldCoordSystem) { + if (s_surf->WorldCoordSystem) { doTransform = false; - state.dataSurface->AspectTransform = false; + s_surf->AspectTransform = false; } } diff --git a/src/EnergyPlus/DaylightingManager.hh b/src/EnergyPlus/DaylightingManager.hh index 8db767a9ec5..66c77d7fbc8 100644 --- a/src/EnergyPlus/DaylightingManager.hh +++ b/src/EnergyPlus/DaylightingManager.hh @@ -525,13 +525,12 @@ struct DaylightingData : BaseGlobalStruct // J = 1 for bare window, 2 - 12 for shaded; // K = sun position index. std::array horIllum = { - Dayltg::Illums()}; // Horizontal illuminance from sky, by sky type, for each hour of the day - Array2D dirIllum; // Sky-related component of direct illuminance - Array2D reflIllum; // Sky-related portion of internally reflected illuminance - Array2D winLum; // Sky-related window luminance - - Array2D avgWinLum; // Sky-related average window luminance + Dayltg::Illums()}; // Horizontal illuminance from sky, by sky type, for each hour of the day + Array1D> dirIllum; // Sky-related component of direct illuminance + Array1D> reflIllum; // Sky-related portion of internally reflected illuminance + Array1D> winLum; // Sky-related window luminance + Array1D> avgWinLum; // Sky-related average window luminance // Allocatable daylight factor arrays -- are in the ZoneDaylight Structure Array2D TDDTransVisBeam; diff --git a/src/EnergyPlus/EMSManager.cc b/src/EnergyPlus/EMSManager.cc index 567f8a931bd..bb2105de660 100644 --- a/src/EnergyPlus/EMSManager.cc +++ b/src/EnergyPlus/EMSManager.cc @@ -1699,10 +1699,11 @@ namespace EMSManager { // Loop thru SurfaceWindow and register any shading controls for (int loopSurfNum = 1; loopSurfNum <= state.dataSurface->TotSurfaces; ++loopSurfNum) { + auto &surf = state.dataSurface->Surface(loopSurfNum); - if (state.dataSurface->Surface(loopSurfNum).Class != DataSurfaces::SurfaceClass::Window) continue; - if (state.dataSurface->Surface(loopSurfNum).ExtBoundCond != DataSurfaces::ExternalEnvironment) continue; - if (!state.dataSurface->Surface(loopSurfNum).HasShadeControl) continue; + if (surf.Class != DataSurfaces::SurfaceClass::Window) continue; + if (surf.ExtBoundCond != DataSurfaces::ExternalEnvironment) continue; + if (!surf.HasShadeControl) continue; if (state.dataSurface->SurfWinHasShadeOrBlindLayer(loopSurfNum)) { SetupEMSActuator(state, @@ -1712,16 +1713,18 @@ namespace EMSManager { "[ShadeStatus]", state.dataSurface->SurfWinShadingFlagEMSOn(loopSurfNum), state.dataSurface->SurfWinShadingFlagEMSValue(loopSurfNum)); - if (state.dataSurface->SurfWinMovableSlats(loopSurfNum)) { + + auto &surfShade = state.dataSurface->surfShades(loopSurfNum); + if (surfShade.blind.movableSlats) { SetupEMSActuator(state, "Window Shading Control", - state.dataSurface->Surface(loopSurfNum).Name, + surf.Name, "Slat Angle", "[degrees]", - state.dataSurface->SurfWinSlatAngThisTSDegEMSon(loopSurfNum), - state.dataSurface->SurfWinSlatAngThisTSDegEMSValue(loopSurfNum)); + surfShade.blind.slatAngDegEMSon, + surfShade.blind.slatAngDegEMSValue); } - } else if (state.dataSurface->WindowShadingControl(state.dataSurface->Surface(loopSurfNum).activeWindowShadingControl).ShadingType == + } else if (state.dataSurface->WindowShadingControl(surf.activeWindowShadingControl).ShadingType == DataSurfaces::WinShadingType::ExtScreen) { SetupEMSActuator(state, "Window Shading Control", diff --git a/src/EnergyPlus/EcoRoofManager.cc b/src/EnergyPlus/EcoRoofManager.cc index 0b20a2dc349..978713dff92 100644 --- a/src/EnergyPlus/EcoRoofManager.cc +++ b/src/EnergyPlus/EcoRoofManager.cc @@ -192,8 +192,7 @@ namespace EcoRoofManager { } auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(1))); - assert(thisMaterial != nullptr); + auto const *thisMaterial = state.dataMaterial->materials(thisConstruct.LayerPoint(1)); RoughSurf = thisMaterial->Roughness; Real64 AbsThermSurf = thisMaterial->AbsorpThermal; // Thermal absoptance of the exterior surface Real64 HMovInsul = 0.0; // "Convection" coefficient of movable insulation @@ -507,9 +506,11 @@ namespace EcoRoofManager { void initEcoRoofFirstTime(EnergyPlusData &state, int const SurfNum, int const ConstrNum) { - auto const *thisMat = - dynamic_cast(state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))); - assert(thisMat != nullptr); + auto const *mat = state.dataMaterial->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)); + assert(mat->group == Material::Group::EcoRoof); + + auto const *matER = dynamic_cast(mat); + assert(matER != nullptr); auto &thisEcoRoof = state.dataEcoRoofMgr; thisEcoRoof->EcoRoofbeginFlag = false; @@ -520,19 +521,19 @@ namespace EcoRoofManager { "currently works only with CTF heat balance solution algorithm."); // ONLY READ ECOROOF PROPERTIES IN THE FIRST TIME - thisEcoRoof->Zf = thisMat->HeightOfPlants; // Plant height (m) - thisEcoRoof->LAI = thisMat->LAI; // Leaf Area Index - thisEcoRoof->Alphag = 1.0 - thisMat->AbsorpSolar; // albedo rather than absorptivity - thisEcoRoof->Alphaf = thisMat->Lreflectivity; // Leaf Reflectivity - thisEcoRoof->epsilonf = thisMat->LEmissitivity; // Leaf Emisivity - thisEcoRoof->StomatalResistanceMin = thisMat->RStomata; // Leaf min stomatal resistance - thisEcoRoof->epsilong = thisMat->AbsorpThermal; // Soil Emisivity - thisEcoRoof->MoistureMax = thisMat->Porosity; // Max moisture content in soil - thisEcoRoof->MoistureResidual = thisMat->MinMoisture; // Min moisture content in soil - thisEcoRoof->Moisture = thisMat->InitMoisture; // Initial moisture content in soil - thisEcoRoof->MeanRootMoisture = thisEcoRoof->Moisture; // DJS Oct 2007 Release --> all soil at same initial moisture for Reverse DD fix - - thisEcoRoof->SoilThickness = thisMat->Thickness; // Total thickness of soil layer (m) + thisEcoRoof->Zf = matER->HeightOfPlants; // Plant height (m) + thisEcoRoof->LAI = matER->LAI; // Leaf Area Index + thisEcoRoof->Alphag = 1.0 - matER->AbsorpSolar; // albedo rather than absorptivity + thisEcoRoof->Alphaf = matER->Lreflectivity; // Leaf Reflectivity + thisEcoRoof->epsilonf = matER->LEmissitivity; // Leaf Emisivity + thisEcoRoof->StomatalResistanceMin = matER->RStomata; // Leaf min stomatal resistance + thisEcoRoof->epsilong = matER->AbsorpThermal; // Soil Emisivity + thisEcoRoof->MoistureMax = matER->Porosity; // Max moisture content in soil + thisEcoRoof->MoistureResidual = matER->MinMoisture; // Min moisture content in soil + thisEcoRoof->Moisture = matER->InitMoisture; // Initial moisture content in soil + thisEcoRoof->MeanRootMoisture = thisEcoRoof->Moisture; // DJS Oct 2007 Release --> all soil at same initial moisture for Reverse DD fix + + thisEcoRoof->SoilThickness = matER->Thickness; // Total thickness of soil layer (m) thisEcoRoof->FirstEcoSurf = SurfNum; // this determines WHEN to updatesoilProps @@ -668,18 +669,19 @@ namespace EcoRoofManager { void initEcoRoof(EnergyPlusData &state, int const SurfNum, int const ConstrNum) { - auto const *thisMat = - dynamic_cast(state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))); - assert(thisMat != nullptr); + auto const *mat = state.dataMaterial->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)); + assert(mat->group == Material::Group::EcoRoof); + auto const *matER = dynamic_cast(mat); + assert(matER != nullptr); auto &thisSurf = state.dataSurface->Surface(SurfNum); // DJS July 2007 // Make sure the ecoroof module resets its conditions at start of EVERY warmup day and every new design day // for Reverse DD testing if (state.dataGlobal->BeginEnvrnFlag || state.dataGlobal->WarmupFlag) { - state.dataEcoRoofMgr->Moisture = thisMat->InitMoisture; // Initial moisture content in soil + state.dataEcoRoofMgr->Moisture = matER->InitMoisture; // Initial moisture content in soil state.dataEcoRoofMgr->MeanRootMoisture = state.dataEcoRoofMgr->Moisture; // Start the root zone moisture at the same value as the surface. - state.dataEcoRoofMgr->Alphag = 1.0 - thisMat->AbsorpSolar; // albedo rather than absorptivity + state.dataEcoRoofMgr->Alphag = 1.0 - matER->AbsorpSolar; // albedo rather than absorptivity } if (state.dataGlobal->BeginEnvrnFlag && state.dataEcoRoofMgr->CalcEcoRoofMyEnvrnFlag) { @@ -775,16 +777,16 @@ namespace EcoRoofManager { RatioMax = 1.0 + 0.20 * state.dataGlobal->MinutesPerTimeStep / 15.0; RatioMin = 1.0 - 0.20 * state.dataGlobal->MinutesPerTimeStep / 15.0; - auto *thisMaterial = - dynamic_cast(state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))); - assert(thisMaterial != nullptr); + auto *mat = state.dataMaterial->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)); + assert(mat->group == Material::Group::EcoRoof); + auto *matER = dynamic_cast(mat); if (state.dataEcoRoofMgr->UpdatebeginFlag) { // SET dry values that NEVER CHANGE - state.dataEcoRoofMgr->DryCond = thisMaterial->Conductivity; - state.dataEcoRoofMgr->DryDens = thisMaterial->Density; - state.dataEcoRoofMgr->DryAbsorp = thisMaterial->AbsorpSolar; - state.dataEcoRoofMgr->DrySpecHeat = thisMaterial->SpecHeat; + state.dataEcoRoofMgr->DryCond = matER->Conductivity; + state.dataEcoRoofMgr->DryDens = matER->Density; + state.dataEcoRoofMgr->DryAbsorp = matER->AbsorpSolar; + state.dataEcoRoofMgr->DrySpecHeat = matER->SpecHeat; // DETERMINE RELATIVE THICKNESS OF TWO LAYERS OF SOIL (also unchanging) if (SoilThickness > 0.12) { @@ -794,7 +796,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 (thisMaterial->EcoRoofCalculationMethod == 2) { + if (matER->calcMethod == Material::EcoRoofCalcMethod::SchaapGenuchten) { int index1; Real64 const depth_limit(depth_fac * std::pow(state.dataEcoRoofMgr->TopDepth + state.dataEcoRoofMgr->RootDepth, 2.07)); for (index1 = 1; index1 <= 20; ++index1) { @@ -908,7 +910,7 @@ namespace EcoRoofManager { Moisture = MoistureMax; } - if (thisMaterial->EcoRoofCalculationMethod == 1) { + if (matER->calcMethod == Material::EcoRoofCalcMethod::Simple) { // 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. @@ -1110,23 +1112,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 / thisMaterial->Conductivity; + TestRatio = SoilConductivity / matER->Conductivity; if (TestRatio > RatioMax) TestRatio = RatioMax; if (TestRatio < RatioMin) TestRatio = RatioMin; - thisMaterial->Conductivity *= TestRatio; - SoilConductivity = thisMaterial->Conductivity; + matER->Conductivity *= TestRatio; + SoilConductivity = matER->Conductivity; - TestRatio = SoilDensity / thisMaterial->Density; + TestRatio = SoilDensity / matER->Density; if (TestRatio > RatioMax) TestRatio = RatioMax; if (TestRatio < RatioMin) TestRatio = RatioMin; - thisMaterial->Density *= TestRatio; - SoilDensity = thisMaterial->Density; + matER->Density *= TestRatio; + SoilDensity = matER->Density; - TestRatio = SoilSpecHeat / thisMaterial->SpecHeat; + TestRatio = SoilSpecHeat / matER->SpecHeat; if (TestRatio > RatioMax) TestRatio = RatioMax; if (TestRatio < RatioMin) TestRatio = RatioMin; - thisMaterial->SpecHeat *= TestRatio; - SoilSpecHeat = thisMaterial->SpecHeat; + matER->SpecHeat *= TestRatio; + SoilSpecHeat = matER->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/ExtendedHI.cc b/src/EnergyPlus/ExtendedHI.cc new file mode 100644 index 00000000000..a585e8c37a0 --- /dev/null +++ b/src/EnergyPlus/ExtendedHI.cc @@ -0,0 +1,538 @@ +// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// The Regents of the University of California, through Lawrence Berkeley National Laboratory +// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge +// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other +// contributors. All rights reserved. +// +// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the +// U.S. Government consequently retains certain rights. As such, the U.S. Government has been +// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, +// worldwide license in the Software to reproduce, distribute copies to the public, prepare +// derivative works, and perform publicly and display publicly, and to permit others to do so. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// (1) Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// (2) Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, +// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific prior +// written permission. +// +// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form +// without changes from the version obtained under this License, or (ii) Licensee makes a +// reference solely to the software portion of its product, Licensee must refer to the +// software as "EnergyPlus version X" software, where "X" is the version number Licensee +// obtained under this License and may not use a different name for the software. Except as +// specifically required in this Section (4), Licensee shall not use in a company name, a +// product name, in advertising, publicity, or other promotional activities any name, trade +// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly +// similar designation, without the U.S. Department of Energy's prior written consent. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Adapted from the code Version 1.1 released by Yi-Chuan Lu on February 23, 2023. +// +// @article{20heatindex, +// Title = {Extending the Heat Index}, +// Author = {Yi-Chuan Lu and David M. Romps}, +// Journal = {Journal of Applied Meteorology and Climatology}, +// Year = {2022}, +// Volume = {61}, +// Number = {10}, +// Pages = {1367--1383}, +// Year = {2022}, +// } +// + +#include + +#include +#include +#include +#include + +namespace EnergyPlus { + +namespace ExtendedHI { + // Thermodynamic parameters + constexpr Real64 Ttrip = 273.16; // K + constexpr Real64 ptrip = 611.65; // Pa + constexpr Real64 E0v = 2.3740e6; // J/kg + constexpr Real64 E0s = 0.3337e6; // J/kg + constexpr Real64 rgasa = 287.04; // J/kg/K + constexpr Real64 rgasv = 461.; // J/kg/K + constexpr Real64 cva = 719.; // J/kg/K + constexpr Real64 cvv = 1418.; // J/kg/K + constexpr Real64 cvl = 4119.; // J/kg/K + constexpr Real64 cvs = 1861.; // J/kg/K + constexpr Real64 cpa = cva + rgasa; + constexpr Real64 cpv = cvv + rgasv; + + // The saturation vapor pressure + Real64 pvstar(Real64 T) + { + if (T == 0.0) { + return 0.0; + } else if (T < Ttrip) { + return ptrip * pow((T / Ttrip), ((cpv - cvs) / rgasv)) * exp((E0v + E0s - (cvv - cvs) * Ttrip) / rgasv * (1. / Ttrip - 1. / T)); + } else { + return ptrip * pow((T / Ttrip), ((cpv - cvl) / rgasv)) * exp((E0v - (cvv - cvl) * Ttrip) / rgasv * (1. / Ttrip - 1. / T)); + } + return 0.0; + } + + // The latent heat of vaporization of water + Real64 Le(Real64 T) + { + return (E0v + (cvv - cvl) * (T - Ttrip) + rgasv * T); + } + + // Thermoregulatory parameters + constexpr Real64 sigma = 5.67e-8; // W/m^2/K^4 , Stefan-Boltzmann constant + constexpr Real64 epsilon = 0.97; // , emissivity of surface, steadman1979 + constexpr Real64 M = 83.6; // kg , mass of average US adults, fryar2018 + constexpr Real64 H = 1.69; // m , height of average US adults, fryar2018 + Real64 A = 0.202 * pow(M, 0.425) * pow(H, 0.725); // m^2 , DuBois formula, parson2014 + constexpr Real64 cpc = 3492.; // J/kg/K , specific heat capacity of core, gagge1972 + Real64 C = M * cpc / A; // , heat capacity of core + constexpr Real64 r = 124.; // Pa/K , Zf/Rf, steadman1979 + constexpr Real64 Q = 180.; // W/m^2 , metabolic rate per skin area, steadman1979 + constexpr Real64 phi_salt = 0.9; // , vapor saturation pressure level of saline solution, steadman1979 + constexpr Real64 Tc = 310.; // K , core temperature, steadman1979 + Real64 Pc = phi_salt * pvstar(Tc); // , core vapor pressure + Real64 L = Le(310.); // , latent heat of vaporization at 310 K + constexpr Real64 p = 1.013e5; // Pa , atmospheric pressure + constexpr Real64 eta = 1.43e-6; // kg/J , "inhaled mass" / "metabolic rate", steadman1979 + constexpr Real64 Pa0 = 1.6e3; // Pa , reference air vapor pressure in regions III, IV, V, VI, steadman1979 + + // Function to calculate respiratory heat loss, W/m^2 + Real64 Qv(Real64 Ta, Real64 Pa) + { + return eta * Q * (cpa * (Tc - Ta) + L * rgasa / (p * rgasv) * (Pc - Pa)); + } + + // Function to calculate mass transfer resistance through skin, Pa m^2/W + Real64 Zs(Real64 Rs) + { + return (Rs == 0.0387) ? 52.1 : 6.0e8 * std::pow(Rs, 5); + } + + // Function to calculate heat transfer resistance through air, exposed part of skin, K m^2/W + Real64 Ra(Real64 Ts, Real64 Ta) + { + constexpr Real64 hc = 17.4; + constexpr Real64 phi_rad = 0.85; + Real64 hr = epsilon * phi_rad * sigma * (std::pow(Ts, 2) + std::pow(Ta, 2)) * (Ts + Ta); + return 1.0 / (hc + hr); + } + + // Function to calculate heat transfer resistance through air, clothed part of skin, K m^2/W + Real64 Ra_bar(Real64 Tf, Real64 Ta) + { + constexpr Real64 hc = 11.6; + constexpr Real64 phi_rad = 0.79; + Real64 hr = epsilon * phi_rad * sigma * (std::pow(Tf, 2) + std::pow(Ta, 2)) * (Tf + Ta); + return 1.0 / (hc + hr); + } + + // Function to calculate heat transfer resistance through air, when being naked, K m^2/W + Real64 Ra_un(Real64 Ts, Real64 Ta) + { + constexpr Real64 hc = 12.3; + constexpr Real64 phi_rad = 0.80; + Real64 hr = epsilon * phi_rad * sigma * (std::pow(Ts, 2) + std::pow(Ta, 2)) * (Ts + Ta); + return 1.0 / (hc + hr); + } + + constexpr Real64 Za = 60.6 / 17.4; // Pa m^2/W, mass transfer resistance through air, exposed part of skin + constexpr Real64 Za_bar = 60.6 / 11.6; // Pa m^2/W, mass transfer resistance through air, clothed part of skin + constexpr Real64 Za_un = 60.6 / 12.3; // Pa m^2/W, mass transfer resistance through air, when being naked + + constexpr Real64 tol = 1e-8; + constexpr Real64 maxIter = 100; + Real64 find_eqvar_phi(EnergyPlusData &state, Real64 Ta, Real64 RH) + { + + Real64 phi = 0.84; + Real64 Pa = RH * pvstar(Ta); + Real64 Rs = 0.0387; + Real64 m = (Pc - Pa) / (Zs(Rs) + Za); + Real64 Ts; + int SolFla; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra(Ts, Ta) + (Pc - Pa) / (Zs(Rs) + Za) - (Tc - Ts) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m)), + std::max(Tc, Ta) + Rs * std::abs(m)); + Real64 flux1 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs; + if (flux1 <= 0.0) { + phi = 1.0 - (Q - Qv(Ta, Pa)) * Rs / (Tc - Ts); + } + return phi; + } + + Real64 find_eqvar_Rf(EnergyPlusData &state, Real64 Ta, Real64 RH) + { + Real64 Pa = RH * pvstar(Ta); + Real64 Rs = 0.0387; + Real64 phi = 0.84; + Real64 m_bar = (Pc - Pa) / (Zs(Rs) + Za_bar); + Real64 m = (Pc - Pa) / (Zs(Rs) + Za); + Real64 Ts; + int SolFla; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra(Ts, Ta) + (Pc - Pa) / (Zs(Rs) + Za) - (Tc - Ts) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m)), + std::max(Tc, Ta) + Rs * std::abs(m)); + Real64 Tf; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Tf, + [&](Real64 Tf) { return (Tf - Ta) / Ra_bar(Tf, Ta) + (Pc - Pa) / (Zs(Rs) + Za_bar) - (Tc - Tf) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m_bar)), + std::max(Tc, Ta) + Rs * std::abs(m_bar)); + Real64 flux1 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs; + Real64 flux2 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs - phi * (Tc - Tf) / Rs; + Real64 Rf; + if (flux1 <= 0.0) { + Rf = std::numeric_limits::infinity(); + } else if (flux2 <= 0.0) { + Real64 Ts_bar = Tc - (Q - Qv(Ta, Pa)) * Rs / phi + (1.0 / phi - 1.0) * (Tc - Ts); + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Tf, + [&](Real64 Tf) { + return (Tf - Ta) / Ra_bar(Tf, Ta) + (Pc - Pa) * (Tf - Ta) / ((Zs(Rs) + Za_bar) * (Tf - Ta) + r * Ra_bar(Tf, Ta) * (Ts_bar - Tf)) - + (Tc - Ts_bar) / Rs; + }, + Ta, + Ts_bar); + Rf = Ra_bar(Tf, Ta) * (Ts_bar - Tf) / (Tf - Ta); + } else { + Rf = 0.0; + } + return Rf; + } + + Real64 find_eqvar_rs(EnergyPlusData &state, Real64 Ta, Real64 RH) + { + + Real64 Pa = RH * pvstar(Ta); + Real64 phi = 0.84; + Real64 Rs = 0.0387; + Real64 m = (Pc - Pa) / (Zs(Rs) + Za); + Real64 m_bar = (Pc - Pa) / (Zs(Rs) + Za_bar); + Real64 Ts; + int SolFla; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra(Ts, Ta) + (Pc - Pa) / (Zs(Rs) + Za) - (Tc - Ts) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m)), + std::max(Tc, Ta) + Rs * std::abs(m)); + Real64 Tf; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Tf, + [&](Real64 Tf) { return (Tf - Ta) / Ra_bar(Tf, Ta) + (Pc - Pa) / (Zs(Rs) + Za_bar) - (Tc - Tf) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m_bar)), + std::max(Tc, Ta) + Rs * std::abs(m_bar)); + Real64 flux1 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs; + Real64 flux2 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs - phi * (Tc - Tf) / Rs; + Real64 flux3 = Q - Qv(Ta, Pa) - (Tc - Ta) / Ra_un(Tc, Ta) - (phi_salt * pvstar(Tc) - Pa) / Za_un; + if (flux1 > 0 && flux2 > 0) { + if (flux3 < 0.0) { + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra_un(Ts, Ta) + (Pc - Pa) / (Zs((Tc - Ts) / (Q - Qv(Ta, Pa))) + Za_un) - (Q - Qv(Ta, Pa)); }, + 0.0, + Tc); + Rs = (Tc - Ts) / (Q - Qv(Ta, Pa)); + Real64 Ps = Pc - (Pc - Pa) * Zs(Rs) / (Zs(Rs) + Za_un); + if (Ps > phi_salt * pvstar(Ts)) { + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra_un(Ts, Ta) + (phi_salt * pvstar(Ts) - Pa) / Za_un - (Q - Qv(Ta, Pa)); }, + 0.0, + Tc); + Rs = (Tc - Ts) / (Q - Qv(Ta, Pa)); + } + } else { + Rs = 0.0; + } + } + return Rs; + } + + Real64 find_eqvar_dTcdt(EnergyPlusData &state, Real64 Ta, Real64 RH) + { + Real64 dTcdt = 0.0; + Real64 Pa = RH * pvstar(Ta); + Real64 Rs = 0.0387; + Real64 phi = 0.84; + Real64 m = (Pc - Pa) / (Zs(Rs) + Za); + Real64 m_bar = (Pc - Pa) / (Zs(Rs) + Za_bar); + Real64 Ts; + int SolFla; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra(Ts, Ta) + (Pc - Pa) / (Zs(Rs) + Za) - (Tc - Ts) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m)), + std::max(Tc, Ta) + Rs * std::abs(m)); + Real64 Tf; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Tf, + [&](Real64 Tf) { return (Tf - Ta) / Ra_bar(Tf, Ta) + (Pc - Pa) / (Zs(Rs) + Za_bar) - (Tc - Tf) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m_bar)), + std::max(Tc, Ta) + Rs * std::abs(m_bar)); + Real64 flux1 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs; + Real64 flux2 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs - phi * (Tc - Tf) / Rs; + Real64 flux3 = Q - Qv(Ta, Pa) - (Tc - Ta) / Ra_un(Tc, Ta) - (phi_salt * pvstar(Tc) - Pa) / Za_un; + if (flux1 > 0.0 && flux2 > 0.0 && flux3 >= 0.0) { + dTcdt = (1.0 / C) * flux3; + } + return dTcdt; + } + + int find_eqvar_name(EnergyPlusData &state, Real64 Ta, Real64 RH) + { + + Real64 Pa = RH * pvstar(Ta); + Real64 Rs = 0.0387; + Real64 phi = 0.84; + Real64 m = (Pc - Pa) / (Zs(Rs) + Za); + Real64 m_bar = (Pc - Pa) / (Zs(Rs) + Za_bar); + + int SolFla; + Real64 Ts; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra(Ts, Ta) + (Pc - Pa) / (Zs(Rs) + Za) - (Tc - Ts) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m)), + std::max(Tc, Ta) + Rs * std::abs(m)); + + Real64 Tf; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Tf, + [&](Real64 Tf) { return (Tf - Ta) / Ra_bar(Tf, Ta) + (Pc - Pa) / (Zs(Rs) + Za_bar) - (Tc - Tf) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m_bar)), + std::max(Tc, Ta) + Rs * std::abs(m_bar)); + Real64 flux1 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs; + Real64 flux2 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs - phi * (Tc - Tf) / Rs; + + if (flux1 <= 0.0) { + return static_cast(EqvarName::Phi); + } else if (flux2 <= 0.0) { + return static_cast(EqvarName::Rf); + } else { + Real64 flux3 = Q - Qv(Ta, Pa) - (Tc - Ta) / Ra_un(Tc, Ta) - (phi_salt * pvstar(Tc) - Pa) / Za_un; + if (flux3 < 0.0) { + return static_cast(EqvarName::Rs); + } else { + return static_cast(EqvarName::DTcdt); + } + } + } + + // given T and RH, returns a key and value pair + Real64 find_eqvar_value(EnergyPlusData &state, Real64 Ta, Real64 RH) + { + Real64 Pa = RH * pvstar(Ta); + Real64 Rs = 0.0387; + Real64 phi = 0.84; + Real64 dTcdt = 0.0; + Real64 m = (Pc - Pa) / (Zs(Rs) + Za); + Real64 m_bar = (Pc - Pa) / (Zs(Rs) + Za_bar); + + int SolFla; + Real64 Ts; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra(Ts, Ta) + (Pc - Pa) / (Zs(Rs) + Za) - (Tc - Ts) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m)), + std::max(Tc, Ta) + Rs * std::abs(m)); + + Real64 Tf; + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Tf, + [&](Real64 Tf) { return (Tf - Ta) / Ra_bar(Tf, Ta) + (Pc - Pa) / (Zs(Rs) + Za_bar) - (Tc - Tf) / Rs; }, + std::max(0.0, std::min(Tc, Ta) - Rs * std::abs(m_bar)), + std::max(Tc, Ta) + Rs * std::abs(m_bar)); + Real64 flux1 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs; + Real64 flux2 = Q - Qv(Ta, Pa) - (1.0 - phi) * (Tc - Ts) / Rs - phi * (Tc - Tf) / Rs; + Real64 Rf; + + if (flux1 <= 0.0) { + phi = 1.0 - (Q - Qv(Ta, Pa)) * Rs / (Tc - Ts); + return phi; + } else if (flux2 <= 0.0) { + Real64 Ts_bar = Tc - (Q - Qv(Ta, Pa)) * Rs / phi + (1.0 / phi - 1.0) * (Tc - Ts); + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Tf, + [&](Real64 Tf) { + return (Tf - Ta) / Ra_bar(Tf, Ta) + (Pc - Pa) * (Tf - Ta) / ((Zs(Rs) + Za_bar) * (Tf - Ta) + r * Ra_bar(Tf, Ta) * (Ts_bar - Tf)) - + (Tc - Ts_bar) / Rs; + }, + Ta, + Ts_bar); + Rf = Ra_bar(Tf, Ta) * (Ts_bar - Tf) / (Tf - Ta); + return Rf; + } else { + Real64 flux3 = Q - Qv(Ta, Pa) - (Tc - Ta) / Ra_un(Tc, Ta) - (phi_salt * pvstar(Tc) - Pa) / Za_un; + if (flux3 < 0.0) { + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra_un(Ts, Ta) + (Pc - Pa) / (Zs((Tc - Ts) / (Q - Qv(Ta, Pa))) + Za_un) - (Q - Qv(Ta, Pa)); }, + 0.0, + Tc); + Rs = (Tc - Ts) / (Q - Qv(Ta, Pa)); + Real64 Ps = Pc - (Pc - Pa) * Zs(Rs) / (Zs(Rs) + Za_un); + if (Ps > phi_salt * pvstar(Ts)) { + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + Ts, + [&](Real64 Ts) { return (Ts - Ta) / Ra_un(Ts, Ta) + (phi_salt * pvstar(Ts) - Pa) / Za_un - (Q - Qv(Ta, Pa)); }, + 0.0, + Tc); + Rs = (Tc - Ts) / (Q - Qv(Ta, Pa)); + } + return Rs; + } else { + Rs = 0.0; + dTcdt = (1.0 / C) * flux3; + return dTcdt; + } + } + } + + // Convert the find_T function + Real64 find_T(EnergyPlusData &state, int eqvar_name, Real64 eqvar) + { + Real64 T; + int SolFla; + + if (eqvar_name == static_cast(EqvarName::Phi)) { + General::SolveRoot( + state, tol, maxIter, SolFla, T, [&](Real64 T) { return find_eqvar_phi(state, T, 1.0) - eqvar; }, 0.0, 240.0); + } else if (eqvar_name == static_cast(EqvarName::Rf)) { + General::SolveRoot( + state, + tol, + maxIter, + SolFla, + T, + [&](Real64 T) { return (find_eqvar_Rf(state, T, std::min(1.0, Pa0 / pvstar(T)))) - eqvar; }, + 230.0, + 300.0); + } else if (eqvar_name == static_cast(EqvarName::Rs)) { + General::SolveRoot( + state, tol, maxIter, SolFla, T, [&](Real64 T) { return find_eqvar_rs(state, T, Pa0 / pvstar(T)) - eqvar; }, 295.0, 350.0); + } else { + General::SolveRoot( + state, tol, maxIter, SolFla, T, [&](Real64 T) { return find_eqvar_dTcdt(state, T, Pa0 / pvstar(T)) - eqvar; }, 340.0, 1000.0); + } + + return T; + } + + Real64 heatindex(EnergyPlusData &state, Real64 Ta, Real64 RH) + { + + // Ta: temperature in Kelvin + // RH: relative humidity in range of 0.0 to 1.0 + // The function computes the extended heat index, in Kelvinn + + auto const HVACSystemRootSolverBackup = state.dataRootFinder->HVACSystemRootFinding.HVACSystemRootSolver; + state.dataRootFinder->HVACSystemRootFinding.HVACSystemRootSolver = HVACSystemRootSolverAlgorithm::Bisection; + int eqvar_name = find_eqvar_name(state, Ta, RH); + Real64 eqvar_value = find_eqvar_value(state, Ta, RH); + + Real64 T = find_T(state, eqvar_name, eqvar_value); + + if (Ta == 0.0) T = 0.0; + + state.dataRootFinder->HVACSystemRootFinding.HVACSystemRootSolver = HVACSystemRootSolverBackup; + return T; + } + +} // namespace ExtendedHI +} // namespace EnergyPlus diff --git a/src/EnergyPlus/ExtendedHI.hh b/src/EnergyPlus/ExtendedHI.hh new file mode 100644 index 00000000000..b839ea571eb --- /dev/null +++ b/src/EnergyPlus/ExtendedHI.hh @@ -0,0 +1,91 @@ +// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// The Regents of the University of California, through Lawrence Berkeley National Laboratory +// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge +// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other +// contributors. All rights reserved. +// +// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the +// U.S. Government consequently retains certain rights. As such, the U.S. Government has been +// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, +// worldwide license in the Software to reproduce, distribute copies to the public, prepare +// derivative works, and perform publicly and display publicly, and to permit others to do so. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// (1) Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// (2) Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, +// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific prior +// written permission. +// +// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form +// without changes from the version obtained under this License, or (ii) Licensee makes a +// reference solely to the software portion of its product, Licensee must refer to the +// software as "EnergyPlus version X" software, where "X" is the version number Licensee +// obtained under this License and may not use a different name for the software. Except as +// specifically required in this Section (4), Licensee shall not use in a company name, a +// product name, in advertising, publicity, or other promotional activities any name, trade +// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly +// similar designation, without the U.S. Department of Energy's prior written consent. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef extendedHI_hh_INCLUDED +#define extendedHI_hh_INCLUDED + +// EnergyPlus Headers +#include +#include +#include + +namespace EnergyPlus { + +// Forward declarations +struct EnergyPlusData; + +namespace ExtendedHI { + + enum class EqvarName + { + Invalid = -1, + Phi = 1, + Rf = 2, + Rs = 3, + DTcdt = 4, + Num + }; + + Real64 pvstar(Real64 T); + Real64 Le(Real64 T); + Real64 Qv(Real64 Ta, Real64 Pa); + Real64 Zs(Real64 Rs); + Real64 Ra(Real64 Ts, Real64 Ta); + Real64 Ra_bar(Real64 Tf, Real64 Ta); + Real64 Ra_un(Real64 Ts, Real64 Ta); + int find_eqvar_name(EnergyPlusData &state, Real64 Ta, Real64 RH); + Real64 find_eqvar_value(EnergyPlusData &state, Real64 Ta, Real64 RH); + Real64 find_eqvar_phi(EnergyPlusData &state, Real64 Ta, Real64 RH); + Real64 find_eqvar_Rf(EnergyPlusData &state, Real64 Ta, Real64 RH); + Real64 find_eqvar_rs(EnergyPlusData &state, Real64 Ta, Real64 RH); + Real64 find_T(EnergyPlusData &state, int eqvar_name, Real64 eqvar); + Real64 heatindex(EnergyPlusData &state, Real64 Ta, Real64 RH); + +} // namespace ExtendedHI +} // namespace EnergyPlus + +#endif diff --git a/src/EnergyPlus/Fans.cc b/src/EnergyPlus/Fans.cc index 6252888f20e..6c0c23e29da 100644 --- a/src/EnergyPlus/Fans.cc +++ b/src/EnergyPlus/Fans.cc @@ -92,12 +92,10 @@ namespace EnergyPlus::Fans { // To encapsulate the data and algorithms required to // manage the Fan System Component -constexpr std::array minFlowFracMethodNames = {"Fraction", "FixedFlowRate"}; - constexpr std::array minFlowFracMethodNamesUC = {"FRACTION", "FIXEDFLOWRATE"}; void FanBase::simulate(EnergyPlusData &state, - bool const _FirstHVACIteration, + [[maybe_unused]] bool const _FirstHVACIteration, ObjexxFCL::Optional _speedRatio, // SpeedRatio for Fan:SystemModel // = current flow/ max design flow rate. It is not exactly the same as diff --git a/src/EnergyPlus/General.hh b/src/EnergyPlus/General.hh index bf4f2236f79..31f26cdf9f4 100644 --- a/src/EnergyPlus/General.hh +++ b/src/EnergyPlus/General.hh @@ -82,51 +82,6 @@ namespace General { Real64 X_0, // 1st bound of interval that contains the solution Real64 X_1); // 2nd bound of interval that contains the solution - constexpr Real64 Interp(Real64 const Lower, Real64 const Upper, Real64 const InterpFac) - { - return Lower + InterpFac * (Upper - Lower); - } - - // Disaggregated implementation of bilinear interpolation so that coefficients can be used with multiple variables - struct BilinearInterpCoeffs - { - Real64 denom; - Real64 x1y1; - Real64 x1y2; - Real64 x2y1; - Real64 x2y2; - }; - - inline void GetBilinearInterpCoeffs( - Real64 const X, Real64 const Y, Real64 const X1, Real64 const X2, Real64 const Y1, Real64 const Y2, BilinearInterpCoeffs &coeffs) - { - if (X1 == X2 && Y1 == Y2) { - coeffs.denom = coeffs.x1y1 = 1.0; - coeffs.x1y2 = coeffs.x2y1 = coeffs.x2y2 = 0.0; - } else if (X1 == X2) { - coeffs.denom = (Y2 - Y1); - coeffs.x1y1 = (Y2 - Y); - coeffs.x1y2 = (Y - Y1); - coeffs.x2y1 = coeffs.x2y2 = 0.0; - } else if (Y1 == Y2) { - coeffs.denom = (X2 - X1); - coeffs.x1y1 = (X2 - X); - coeffs.x2y1 = (X - X1); - coeffs.x1y2 = coeffs.x2y2 = 0.0; - } else { - coeffs.denom = (X2 - X1) * (Y2 - Y1); - coeffs.x1y1 = (X2 - X) * (Y2 - Y); - coeffs.x2y1 = (X - X1) * (Y2 - Y); - coeffs.x1y2 = (X2 - X) * (Y - Y1); - coeffs.x2y2 = (X - X1) * (Y - Y1); - } - } - - inline Real64 BilinearInterp(Real64 const Fx1y1, Real64 const Fx1y2, Real64 const Fx2y1, Real64 const Fx2y2, BilinearInterpCoeffs const &coeffs) - { - return (coeffs.x1y1 * Fx1y1 + coeffs.x2y1 * Fx2y1 + coeffs.x1y2 * Fx1y2 + coeffs.x2y2 * Fx2y2) / coeffs.denom; - } - constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence Array1D const &A // Polynomial coefficients ) @@ -301,6 +256,68 @@ namespace General { } } // namespace General +constexpr Real64 Interp(Real64 const Lower, Real64 const Upper, Real64 const InterpFac) +{ + return Lower + InterpFac * (Upper - Lower); +} + +struct InterpCoeffs +{ + Real64 x1; + Real64 x2; +}; + +inline void GetInterpCoeffs(Real64 X, Real64 X1, Real64 X2, InterpCoeffs &c) +{ + c.x1 = (X - X1) / (X2 - X1); + c.x2 = (X2 - X) / (X2 - X1); +} + +inline Real64 Interp2(Real64 Fx1, Real64 Fx2, InterpCoeffs const &c) +{ + return c.x1 * Fx1 + c.x2 * Fx2; +} + +// Disaggregated implementation of bilinear interpolation so that coefficients can be used with multiple variables +struct BilinearInterpCoeffs +{ + Real64 denom; + Real64 x1y1; + Real64 x1y2; + Real64 x2y1; + Real64 x2y2; +}; + +inline void GetBilinearInterpCoeffs( + Real64 const X, Real64 const Y, Real64 const X1, Real64 const X2, Real64 const Y1, Real64 const Y2, BilinearInterpCoeffs &coeffs) +{ + if (X1 == X2 && Y1 == Y2) { + coeffs.denom = coeffs.x1y1 = 1.0; + coeffs.x1y2 = coeffs.x2y1 = coeffs.x2y2 = 0.0; + } else if (X1 == X2) { + coeffs.denom = (Y2 - Y1); + coeffs.x1y1 = (Y2 - Y); + coeffs.x1y2 = (Y - Y1); + coeffs.x2y1 = coeffs.x2y2 = 0.0; + } else if (Y1 == Y2) { + coeffs.denom = (X2 - X1); + coeffs.x1y1 = (X2 - X); + coeffs.x2y1 = (X - X1); + coeffs.x1y2 = coeffs.x2y2 = 0.0; + } else { + coeffs.denom = (X2 - X1) * (Y2 - Y1); + coeffs.x1y1 = (X2 - X) * (Y2 - Y); + coeffs.x2y1 = (X - X1) * (Y2 - Y); + coeffs.x1y2 = (X2 - X) * (Y - Y1); + coeffs.x2y2 = (X - X1) * (Y - Y1); + } +} + +inline Real64 BilinearInterp(Real64 const Fx1y1, Real64 const Fx1y2, Real64 const Fx2y1, Real64 const Fx2y2, BilinearInterpCoeffs const &coeffs) +{ + return (coeffs.x1y1 * Fx1y1 + coeffs.x2y1 * Fx2y1 + coeffs.x1y2 * Fx1y2 + coeffs.x2y2 * Fx2y2) / coeffs.denom; +} + struct GeneralData : BaseGlobalStruct { bool GetReportInput = true; diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 8ccab39388d..6877343c4dd 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -266,7 +266,7 @@ void SimulateVRF(EnergyPlusData &state, if (state.dataHVACVarRefFlow->VRF(VRFCondenser).VRFAlgorithmType == AlgorithmType::FluidTCtrl) { // Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control - state.dataHVACVarRefFlow->VRF(VRFCondenser).CalcVRFCondenser_FluidTCtrl(state); + state.dataHVACVarRefFlow->VRF(VRFCondenser).CalcVRFCondenser_FluidTCtrl(state, FirstHVACIteration); } else { // Algorithm Type: VRF model based on system curve CalcVRFCondenser(state, VRFCondenser); @@ -11009,7 +11009,7 @@ void VRFTerminalUnitEquipment::CalcVRFIUVariableTeTc(EnergyPlusData &state, } } -void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state) +void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, const bool FirstHVACIteration) { // SUBROUTINE INFORMATION: @@ -11140,7 +11140,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state) Real64 Pipe_DeltP_h; // Piping Loss Algorithm Parameter: Pipe pressure drop (h) [Pa] Real64 Pipe_Q_c; // Piping Loss Algorithm Parameter: Heat loss (c) [W] Real64 Pipe_Q_h; // Piping Loss Algorithm Parameter: Heat loss (h) [W] - Real64 Q_c_TU_PL; // Cooling load to be met at heating mode, including the piping loss(W) + Real64 Q_c_TU_PL; // Cooling load to be met at cooling mode, including the piping loss(W) Real64 Q_h_TU_PL; // Heating load to be met at heating mode, including the piping loss (W) Real64 Q_h_OU; // outdoor unit condenser heat release (cooling mode) [W] Real64 Q_c_OU; // outdoor unit evaporator heat extract (heating mode) [W] @@ -11415,56 +11415,40 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state) C_cap_operation = this->VRFOU_CapModFactor( state, h_comp_in, h_IU_evap_in, max(min(Psuction, RefPHigh), RefPLow), Tsuction + SH_Comp, Tsuction + 8, CapMinTc - 5); - if (Q_c_TU_PL * C_cap_operation < CompEvaporatingCAPSpdMin) { - // Required cooling load is less than the min cooling capacity, on-off strategy - - this->VRFOperationSimPath = 11; - - CyclingRatio = Q_c_TU_PL * C_cap_operation / CompEvaporatingCAPSpdMin; - double CyclingRatioFrac = 0.85 + 0.15 * CyclingRatio; - double HPRTF = CyclingRatio / CyclingRatioFrac; - Ncomp = CompEvaporatingPWRSpdMin * HPRTF; // - CompSpdActual = this->CompressorSpeed(1); // - this->CondensingTemp = CapMinTc; // - - } else { - // Required cooling load is greater than or equal to the min cooling capacity + // Iteration_Ncomp: Perform iterations to calculate Ncomp (Label10) + Counter = 1; + Ncomp = TU_CoolingLoad / this->CoolingCOP; + Ncomp_new = Ncomp; + Label10:; + Q_h_OU = Q_c_TU_PL + Ncomp_new; // Ncomp_new may be updated during Iteration_Ncomp Label10 + + // *VRF OU TeTc calculations + m_air = this->OUAirFlowRate * RhoAir; + SC_OU = this->SC; + this->VRFOU_TeTc(state, HXOpMode::CondMode, Q_h_OU, SC_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->CondensingTemp); + this->CondensingTemp = min(CapMaxTc, this->CondensingTemp); + this->SC = SC_OU; + + // *VEF OU Compressor Simulation at cooling mode: Specify the compressor speed and power consumption + this->VRFOU_CalcCompC(state, + TU_CoolingLoad, + Tsuction, + this->CondensingTemp, + Psuction, + T_comp_in, + h_comp_in, + h_IU_evap_in, + Pipe_Q_c, + CapMaxTc, + Q_h_OU, + CompSpdActual, + Ncomp, + CyclingRatio); - // Iteration_Ncomp: Perform iterations to calculate Ncomp (Label10) - Counter = 1; - Ncomp = TU_CoolingLoad / this->CoolingCOP; + if ((std::abs(Ncomp - Ncomp_new) > (Tolerance * Ncomp_new)) && (Counter < 30)) { Ncomp_new = Ncomp; - Label10:; - Q_h_OU = Q_c_TU_PL + Ncomp_new; // Ncomp_new may be updated during Iteration_Ncomp Label10 - - // *VRF OU TeTc calculations - m_air = this->OUAirFlowRate * RhoAir; - SC_OU = this->SC; - this->VRFOU_TeTc( - state, HXOpMode::CondMode, Q_h_OU, SC_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->CondensingTemp); - this->CondensingTemp = min(CapMaxTc, this->CondensingTemp); - this->SC = SC_OU; - - // *VEF OU Compressor Simulation at cooling mode: Specify the compressor speed and power consumption - this->VRFOU_CalcCompC(state, - TU_CoolingLoad, - Tsuction, - this->CondensingTemp, - Psuction, - T_comp_in, - h_comp_in, - h_IU_evap_in, - Pipe_Q_c, - CapMaxTc, - Q_h_OU, - CompSpdActual, - Ncomp); - - if ((std::abs(Ncomp - Ncomp_new) > (Tolerance * Ncomp_new)) && (Counter < 30)) { - Ncomp_new = Ncomp; - Counter = Counter + 1; - goto Label10; - } + Counter = Counter + 1; + goto Label10; } // Update h_IU_evap_in in iterations Label12 @@ -11486,6 +11470,8 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state) } // Key outputs of this subroutine + Ncomp *= CyclingRatio; + Q_h_OU *= CyclingRatio; this->CompActSpeed = max(CompSpdActual, 0.0); this->Ncomp = max(Ncomp, 0.0) / this->EffCompInverter; // 0.95 is the efficiency of the compressor inverter, can come from IDF //@minor this->OUFanPower = this->RatedOUFanPower; //@ * pow_3( CondFlowRatio ) @@ -12344,6 +12330,25 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state) // Calculate the IU Te/Tc for the next time step this->CalcVRFIUTeTc_FluidTCtrl(state); + // update coil and IU evaporating temperature, also keep coil RTF updated with the condenser side cycling ratio, for the FluidTCtrl model + for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFTUNum) { + auto const &thisTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum); + auto &coolingCoil = state.dataDXCoils->DXCoil(thisTU.CoolCoilIndex); + if (this->adjustedTe && (!FirstHVACIteration)) { + coolingCoil.EvaporatingTemp = this->EvaporatingTemp; + this->IUEvaporatingTemp = this->EvaporatingTemp; + } + + int PLF; + if (coolingCoil.PLFFPLR(1) > 0 && this->VRFCondCyclingRatio < 1.0) { + PLF = Curve::CurveValue(state, coolingCoil.PLFFPLR(1), this->VRFCondCyclingRatio); // Calculate part-load factor + } else { + PLF = 1.0; + } + if (coolingCoil.TotalCoolingEnergyRate > 0.0) { + coolingCoil.CoolingCoilRuntimeFraction = this->VRFCondCyclingRatio / PLF; + } + } } void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, @@ -13845,7 +13850,8 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, Real64 MaxOutdoorUnitTc, // The maximum temperature that Tc can be at heating mode [C] Real64 &OUCondHeatRelease, // Condenser heat release (cooling mode) [W] Real64 &CompSpdActual, // Actual compressor running speed [rps] - Real64 &Ncomp // Compressor power [W] + Real64 &Ncomp, // Compressor power [W] + Real64 &CyclingRatio // Cycling Ratio [W] ) { @@ -13853,6 +13859,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, // AUTHOR Xiufeng Pang // DATE WRITTEN Feb 2014 // MODIFIED Rongpeng Zhang, Jan 2016 + // MODIFIED Yujie Xu, Sep 2023 // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: @@ -13908,7 +13915,8 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa] Real64 T_discharge_new; // Condensing temperature, for temporary use in iterations [C] Real64 Tfs; // Temperature of the air at the coil surface [C]] - Real64 Tolerance(0.05); // Tolerance for condensing temperature calculation [C} + Real64 constexpr Tolerance(0.05); // Tolerance for condensing temperature calculation [C] + Real64 constexpr TeTol(0.5); // Tolerance for the difference between Te and SmallLoadTe Array1D CompEvaporatingPWRSpd; // Array for the compressor power at certain speed [W] Array1D CompEvaporatingCAPSpd; // Array for the evaporating capacity at certain speed [W] @@ -13937,6 +13945,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, C_cap_operation = this->VRFOU_CapModFactor( state, Pipe_h_comp_in, Pipe_h_IU_in, max(min(P_suction, RefPHigh), RefPLow), T_suction + Modifi_SH, T_suction + 8, T_discharge - 5); + this->adjustedTe = false; for (CounterCompSpdTemp = 1; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) { // Iteration to find the VRF speed that can meet the required load, Iteration DoName1 @@ -13985,14 +13994,26 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, MinRefriPe = this->refrig->getSatPressure(state, -15, RoutineName); MinOutdoorUnitPe = max(P_discharge - this->CompMaxDeltaP, MinRefriPe); MinOutdoorUnitTe = this->refrig->getSatTemperature(state, max(min(MinOutdoorUnitPe, RefPHigh), RefPLow), RoutineName); + // Te can't be smaller than user input lower bound + MinOutdoorUnitTe = max(this->IUEvapTempLow, MinOutdoorUnitTe); auto f = [&state, T_discharge_new, CondHeat, CAPFT](Real64 const T_suc) { return CompResidual_FluidTCtrl(state, T_discharge_new, CondHeat, CAPFT, T_suc); }; General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, - T_suction); // SmallLoadTe is the updated Te' - if (SolFla < 0) SmallLoadTe = 6; // MinOutdoorUnitTe; //SmallLoadTe( Te'_new ) is constant during iterations + T_suction); // SmallLoadTe is the updated Te' + if (SolFla == -1) { + // show error not converging + ShowWarningMessage(state, format("{}: low load Te adjustment failed for {}", RoutineName, this->Name)); + ShowContinueErrorTimeStamp(state, ""); + ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating OU evaporating temperature", MaxIter)); + } else if (SolFla == -2) { + // demand < capacity at both endpoints of the Te range, assuming f(x) is roughly monotonic than this is the low load case + assert(f(T_suction) < 0); + // TeTol is added to prevent the final updated Te to go out of bounds + SmallLoadTe = 6 + TeTol; // MinOutdoorUnitTe; //SmallLoadTe( Te'_new ) is constant during iterations + } // Get an updated Te corresponding to the updated Te' // VRFOU_TeModification( VRFCond, this->EvaporatingTemp, SmallLoadTe, Pipe_h_IU_in, OutdoorDryBulb, Pipe_Te_assumed, @@ -14004,6 +14025,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, NumIteTe = 1; MaxNumIteTe = (this->EvaporatingTemp - SmallLoadTe) / 0.1 + 1; // upper bound and lower bound of Te iterations Pipe_Te_assumed = this->EvaporatingTemp - 0.1; + this->adjustedTe = true; Label11:; Pipe_m_ref = 0; // Total Ref Flow Rate( kg/s ) @@ -14070,14 +14092,14 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, T_suction = this->refrig->getSatTemperature(state, max(min(Pipe_Pe_assumed - Pipe_DeltP, RefPHigh), RefPLow), RoutineName); - if ((std::abs(T_suction - SmallLoadTe) > 0.5) && (Pipe_Te_assumed < this->EvaporatingTemp) && (Pipe_Te_assumed > SmallLoadTe) && + if ((std::abs(T_suction - SmallLoadTe) > TeTol) && (Pipe_Te_assumed < this->EvaporatingTemp) && (Pipe_Te_assumed > SmallLoadTe) && (NumIteTe < MaxNumIteTe)) { Pipe_Te_assumed = Pipe_Te_assumed - 0.1; NumIteTe = NumIteTe + 1; goto Label11; } - if (std::abs(T_suction - SmallLoadTe) > 0.5) { + if (std::abs(T_suction - SmallLoadTe) > TeTol) { NumIteTe = 999; T_suction = SmallLoadTe; Pipe_SH_merged = 3.0; @@ -14129,12 +14151,21 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, goto Label13; } - if (CapDiff > (Tolerance * Cap_Eva0)) NumIteCcap = 999; + // when it gets here, either NumIteCcap = 30 or CapDiff > (Tolerance * Cap_Eva0) + if (CapDiff > (Tolerance * Cap_Eva0) && (Cap_Eva1 - Cap_Eva0) >= 0.0) { + NumIteCcap = 999; + CyclingRatio = Cap_Eva0 / Cap_Eva1; + } else { + CyclingRatio = 1.0; + } Ncomp = this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction); + OUCondHeatRelease = Ncomp + Cap_Eva1; this->CondensingTemp = T_discharge; // OU Tc' is updated due to OUCondHeatRelease updates, which is caused by IU Te' updates // during low load conditions + this->EvaporatingTemp = T_suction; + this->IUEvaporatingTemp = T_suction; break; // EXIT DoName1 @@ -14210,7 +14241,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompH( Real64 RefTSat; // Saturated temperature of the refrigerant [C] Real64 RefPLow; // Low Pressure Value for Ps (>0.0) [Pa] Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa] - Real64 Tolerance(0.05); // Tolerance for condensing temperature calculation [C} + Real64 constexpr Tolerance(0.05); // Tolerance for condensing temperature calculation [C} Array1D CompEvaporatingPWRSpd; // Array for the compressor power at certain speed [W] Array1D CompEvaporatingCAPSpd; // Array for the evaporating capacity at certain speed [W] diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh index e63d6cab0a2..5035b5ad622 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh @@ -385,6 +385,7 @@ namespace HVACVariableRefrigerantFlow { Real64 VRFOperationSimPath; // simulation path indicating the VRF operation mode [--] bool checkPlantCondTypeOneTime; int CondenserCapErrIdx; // recurring condenser capacity error index + bool adjustedTe; // Default Constructor VRFCondenserEquipment() @@ -425,7 +426,7 @@ namespace HVACVariableRefrigerantFlow { RatedHeatCapacity(0.0), RatedCompPower(14000.0), RatedCompPowerPerCapcity(0.35), RatedOUFanPower(0.0), RatedOUFanPowerPerCapcity(0.0), RateBFOUEvap(0.45581), RateBFOUCond(0.21900), RefPipDiaSuc(0.0), RefPipDiaDis(0.0), RefPipLen(0.0), RefPipEquLen(0.0), RefPipHei(0.0), RefPipInsThi(0.0), RefPipInsCon(0.0), SH(0.0), SC(0.0), SCHE(0.0), SHLow(0.0), SCLow(0.0), SHHigh(0.0), SCHigh(0.0), - VRFOperationSimPath(0.0), checkPlantCondTypeOneTime(true), CondenserCapErrIdx(0) + VRFOperationSimPath(0.0), checkPlantCondTypeOneTime(true), CondenserCapErrIdx(0), adjustedTe(false) { } @@ -447,7 +448,7 @@ namespace HVACVariableRefrigerantFlow { void SizeVRFCondenser(EnergyPlusData &state); - void CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state); + void CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, const bool FirstHVACIteration); void CalcVRFIUTeTc_FluidTCtrl(EnergyPlusData &state); @@ -524,7 +525,8 @@ namespace HVACVariableRefrigerantFlow { Real64 MaxOutdoorUnitTc, // The maximum temperature that Tc can be at heating mode [C] Real64 &OUCondHeatRelease, // Condenser heat release (cooling mode) [W] Real64 &CompSpdActual, // Actual compressor running speed [rps] - Real64 &Ncomp // Compressor power [W] + Real64 &Ncomp, // Compressor power [W] + Real64 &CyclingRatio // Cycling Ratio [W] ); void diff --git a/src/EnergyPlus/HeatBalFiniteDiffManager.cc b/src/EnergyPlus/HeatBalFiniteDiffManager.cc index 950aa5c81e8..94d4b94b7c8 100644 --- a/src/EnergyPlus/HeatBalFiniteDiffManager.cc +++ b/src/EnergyPlus/HeatBalFiniteDiffManager.cc @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -134,149 +135,148 @@ namespace HeatBalFiniteDiffManager { // This subroutine is the main driver for initializations for the variable property CondFD part of the // MFD algorithm + static constexpr std::string_view routineName = "GetCondFDInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int IOStat; // IO Status when calling get input subroutine Array1D_string MaterialNames(3); // Number of Material Alpha names defined Array1D_string ConstructionName(3); // Name of Construction with CondFDsimplified - int MaterNum; // Counter to keep track of the material number int MaterialNumAlpha; // Number of material alpha names being passed int MaterialNumProp; // Number of material properties being passed Array1D MaterialProps; // Temporary array to transfer material properties (allocated based on user input) bool ErrorsFound(false); // If errors detected in input - int Loop; int propNum; int pcMat; int vcMat; int inegptr; bool nonInc; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + + auto &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_ipsc = state.dataIPShortCut; + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + auto &s_mat = state.dataMaterial; + // user settings for numerical parameters - cCurrentModuleObject = "HeatBalanceSettings:ConductionFiniteDifference"; + s_ipsc->cCurrentModuleObject = "HeatBalanceSettings:ConductionFiniteDifference"; - if (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject) > 0) { + if (s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject) > 0) { int NumAlphas; int NumNumbers; - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - 1, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - - if (!state.dataIPShortCut->lAlphaFieldBlanks(1)) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + 1, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNumbers, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + if (!s_ipsc->lAlphaFieldBlanks(1)) { { - state.dataHeatBalFiniteDiffMgr->CondFDSchemeType = - static_cast(getEnumValue(CondFDSchemeTypeNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(1)))); - if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::Invalid) { + s_hbfd->CondFDSchemeType = + static_cast(getEnumValue(CondFDSchemeTypeNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(1)))); + if (s_hbfd->CondFDSchemeType == CondFDScheme::Invalid) { ShowSevereError(state, format("{}: invalid {} entered={}, must match CrankNicholsonSecondOrder or FullyImplicitFirstOrder.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } } } - if (!state.dataIPShortCut->lNumericFieldBlanks(1)) { - state.dataHeatBalFiniteDiffMgr->SpaceDescritConstant = state.dataIPShortCut->rNumericArgs(1); + if (!s_ipsc->lNumericFieldBlanks(1)) { + s_hbfd->SpaceDescritConstant = s_ipsc->rNumericArgs(1); } - if (!state.dataIPShortCut->lNumericFieldBlanks(2)) { - state.dataHeatBal->CondFDRelaxFactorInput = state.dataIPShortCut->rNumericArgs(2); + if (!s_ipsc->lNumericFieldBlanks(2)) { + state.dataHeatBal->CondFDRelaxFactorInput = s_ipsc->rNumericArgs(2); state.dataHeatBal->CondFDRelaxFactor = state.dataHeatBal->CondFDRelaxFactorInput; } - if (!state.dataIPShortCut->lNumericFieldBlanks(3)) { - state.dataHeatBal->MaxAllowedDelTempCondFD = state.dataIPShortCut->rNumericArgs(3); + if (!s_ipsc->lNumericFieldBlanks(3)) { + state.dataHeatBal->MaxAllowedDelTempCondFD = s_ipsc->rNumericArgs(3); } } // settings object - pcMat = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "MaterialProperty:PhaseChange"); - vcMat = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "MaterialProperty:VariableThermalConductivity"); + pcMat = s_ip->getNumObjectsFound(state, "MaterialProperty:PhaseChange"); + vcMat = s_ip->getNumObjectsFound(state, "MaterialProperty:VariableThermalConductivity"); int numProps = setSizeMaxProperties(state); MaterialProps.allocate(numProps); - auto &MaterialFD = state.dataHeatBalFiniteDiffMgr->MaterialFD; - - MaterialFD.allocate(state.dataMaterial->TotMaterials); + s_hbfd->MaterialFD.allocate(s_mat->materials.size()); // Load the additional CondFD Material properties - cCurrentModuleObject = "MaterialProperty:PhaseChange"; // Phase Change Information First + s_ipsc->cCurrentModuleObject = "MaterialProperty:PhaseChange"; // Phase Change Information First if (pcMat != 0) { // Get Phase Change info // CondFDVariableProperties = .TRUE. - for (Loop = 1; Loop <= pcMat; ++Loop) { + for (int Loop = 1; Loop <= pcMat; ++Loop) { // Call Input Get routine to retrieve material data - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + MaterialNames, + MaterialNumAlpha, + MaterialProps, + MaterialNumProp, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // Load the material derived type from the input data. - MaterNum = Util::FindItemInPtrList(MaterialNames(1), state.dataMaterial->Material); - if (MaterNum == 0) { - ShowSevereError(state, - format("{}: invalid {} entered={}, must match to a valid Material name.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - MaterialNames(1))); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, MaterialNames(1)}; + int matNum = Material::GetMaterialNum(state, MaterialNames(1)); + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(1), MaterialNames(1)); ErrorsFound = true; continue; } - auto const *thisMaterial = state.dataMaterial->Material(MaterNum); + auto const *mat = state.dataMaterial->materials(matNum); - if (thisMaterial->group != Material::Group::Regular) { + if (mat->group != Material::Group::Regular) { ShowSevereError(state, format("{}: Reference Material is not appropriate type for CondFD properties, material={}, must have regular " "properties (L,Cp,K,D)", - cCurrentModuleObject, - thisMaterial->Name)); + s_ipsc->cCurrentModuleObject, + mat->Name)); ErrorsFound = true; } // Once the material derived type number is found then load the additional CondFD variable material properties // Some or all may be zero (default). They will be checked when calculating node temperatures - MaterialFD(MaterNum).tk1 = MaterialProps(1); - MaterialFD(MaterNum).numTempEnth = (MaterialNumProp - 1) / 2; - if (MaterialFD(MaterNum).numTempEnth * 2 != (MaterialNumProp - 1)) { - ShowSevereError(state, format("GetCondFDInput: {}=\"{}\", mismatched pairs", cCurrentModuleObject, MaterialNames(1))); - ShowContinueError( - state, format("...expected {} pairs, but only entered {} numbers.", MaterialFD(MaterNum).numTempEnth, MaterialNumProp - 1)); + auto &matFD = s_hbfd->MaterialFD(matNum); + matFD.tk1 = MaterialProps(1); + matFD.numTempEnth = (MaterialNumProp - 1) / 2; + if (matFD.numTempEnth * 2 != (MaterialNumProp - 1)) { + ShowSevereError(state, format("GetCondFDInput: {}=\"{}\", mismatched pairs", s_ipsc->cCurrentModuleObject, MaterialNames(1))); + ShowContinueError(state, format("...expected {} pairs, but only entered {} numbers.", matFD.numTempEnth, MaterialNumProp - 1)); ErrorsFound = true; } - MaterialFD(MaterNum).TempEnth.dimension(2, MaterialFD(MaterNum).numTempEnth, 0.0); + matFD.TempEnth.dimension(2, matFD.numTempEnth, 0.0); propNum = 2; // Temperature first - for (int pcount = 1, pcount_end = MaterialFD(MaterNum).numTempEnth; pcount <= pcount_end; ++pcount) { - MaterialFD(MaterNum).TempEnth(1, pcount) = MaterialProps(propNum); + for (int pcount = 1, pcount_end = matFD.numTempEnth; pcount <= pcount_end; ++pcount) { + matFD.TempEnth(1, pcount) = MaterialProps(propNum); propNum += 2; } propNum = 3; // Then Enthalpy - for (int pcount = 1, pcount_end = MaterialFD(MaterNum).numTempEnth; pcount <= pcount_end; ++pcount) { - MaterialFD(MaterNum).TempEnth(2, pcount) = MaterialProps(propNum); + for (int pcount = 1, pcount_end = matFD.numTempEnth; pcount <= pcount_end; ++pcount) { + matFD.TempEnth(2, pcount) = MaterialProps(propNum); propNum += 2; } nonInc = false; inegptr = 0; - for (int pcount = 1, pcount_end = MaterialFD(MaterNum).numTempEnth - 1; pcount <= pcount_end; ++pcount) { - if (MaterialFD(MaterNum).TempEnth(1, pcount) < MaterialFD(MaterNum).TempEnth(1, pcount + 1)) continue; + for (int pcount = 1, pcount_end = matFD.numTempEnth - 1; pcount <= pcount_end; ++pcount) { + if (matFD.TempEnth(1, pcount) < matFD.TempEnth(1, pcount + 1)) continue; nonInc = true; inegptr = pcount + 1; break; @@ -284,25 +284,24 @@ namespace HeatBalFiniteDiffManager { if (nonInc) { ShowSevereError(state, format("GetCondFDInput: {}=\"{}\", non increasing Temperatures. Temperatures must be strictly increasing.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, MaterialNames(1))); - ShowContinueError( - state, - format("...occurs first at item=[{}], value=[{:.2R}].", fmt::to_string(inegptr), MaterialFD(MaterNum).TempEnth(1, inegptr))); + ShowContinueError(state, + format("...occurs first at item=[{}], value=[{:.2R}].", fmt::to_string(inegptr), matFD.TempEnth(1, inegptr))); ErrorsFound = true; } nonInc = false; inegptr = 0; - for (int pcount = 1, pcount_end = MaterialFD(MaterNum).numTempEnth - 1; pcount <= pcount_end; ++pcount) { - if (MaterialFD(MaterNum).TempEnth(2, pcount) <= MaterialFD(MaterNum).TempEnth(2, pcount + 1)) continue; + for (int pcount = 1, pcount_end = matFD.numTempEnth - 1; pcount <= pcount_end; ++pcount) { + if (matFD.TempEnth(2, pcount) <= matFD.TempEnth(2, pcount + 1)) continue; nonInc = true; inegptr = pcount + 1; break; } if (nonInc) { - ShowSevereError(state, format("GetCondFDInput: {}=\"{}\", non increasing Enthalpy.", cCurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, - format("...occurs first at item=[{}], value=[{:.2R}].", inegptr, MaterialFD(MaterNum).TempEnth(2, inegptr))); + ShowSevereError(state, + format("GetCondFDInput: {}=\"{}\", non increasing Enthalpy.", s_ipsc->cCurrentModuleObject, MaterialNames(1))); + ShowContinueError(state, format("...occurs first at item=[{}], value=[{:.2R}].", inegptr, matFD.TempEnth(2, inegptr))); ShowContinueError(state, "...These values may be Cp (Specific Heat) rather than Enthalpy. Please correct."); ErrorsFound = true; } @@ -310,73 +309,72 @@ namespace HeatBalFiniteDiffManager { } // Get CondFD Variable Thermal Conductivity Input - cCurrentModuleObject = "MaterialProperty:VariableThermalConductivity"; // Variable Thermal Conductivity Info next - if (vcMat != 0) { // variable k info + s_ipsc->cCurrentModuleObject = "MaterialProperty:VariableThermalConductivity"; // Variable Thermal Conductivity Info next + if (vcMat != 0) { // variable k info // CondFDVariableProperties = .TRUE. - for (Loop = 1; Loop <= vcMat; ++Loop) { + for (int Loop = 1; Loop <= vcMat; ++Loop) { // Call Input Get routine to retrieve material data - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + MaterialNames, + MaterialNumAlpha, + MaterialProps, + MaterialNumProp, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, MaterialNames(1)}; // Load the material derived type from the input data. - MaterNum = Util::FindItemInPtrList(MaterialNames(1), state.dataMaterial->Material); - if (MaterNum == 0) { - ShowSevereError(state, - format("{}: invalid {} entered={}, must match to a valid Material name.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - MaterialNames(1))); + int matNum = Material::GetMaterialNum(state, MaterialNames(1)); + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(1), MaterialNames(1)); ErrorsFound = true; continue; } - auto const *thisMaterial = state.dataMaterial->Material(MaterNum); - if (thisMaterial->group != Material::Group::Regular) { + auto *mat = s_mat->materials(matNum); + + if (mat->group != Material::Group::Regular) { ShowSevereError(state, format("{}: Reference Material is not appropriate type for CondFD properties, material={}, must have regular " "properties (L,Cp,K,D)", - cCurrentModuleObject, - thisMaterial->Name)); + s_ipsc->cCurrentModuleObject, + mat->Name)); ErrorsFound = true; } // Once the material derived type number is found then load the additional CondFD variable material properties // Some or all may be zero (default). They will be checked when calculating node temperatures - MaterialFD(MaterNum).numTempCond = MaterialNumProp / 2; - if (MaterialFD(MaterNum).numTempCond * 2 != MaterialNumProp) { - ShowSevereError(state, format("GetCondFDInput: {}=\"{}\", mismatched pairs", cCurrentModuleObject, MaterialNames(1))); - ShowContinueError( - state, format("...expected {} pairs, but only entered {} numbers.", MaterialFD(MaterNum).numTempCond, MaterialNumProp)); + + auto &matFD = s_hbfd->MaterialFD(matNum); + matFD.numTempCond = MaterialNumProp / 2; + if (matFD.numTempCond * 2 != MaterialNumProp) { + ShowSevereError(state, format("GetCondFDInput: {}=\"{}\", mismatched pairs", s_ipsc->cCurrentModuleObject, MaterialNames(1))); + ShowContinueError(state, format("...expected {} pairs, but only entered {} numbers.", matFD.numTempCond, MaterialNumProp)); ErrorsFound = true; } - MaterialFD(MaterNum).TempCond.dimension(2, MaterialFD(MaterNum).numTempCond, 0.0); + matFD.TempCond.dimension(2, matFD.numTempCond, 0.0); propNum = 1; // Temperature first - for (int pcount = 1, pcount_end = MaterialFD(MaterNum).numTempCond; pcount <= pcount_end; ++pcount) { - MaterialFD(MaterNum).TempCond(1, pcount) = MaterialProps(propNum); + for (int pcount = 1, pcount_end = matFD.numTempCond; pcount <= pcount_end; ++pcount) { + matFD.TempCond(1, pcount) = MaterialProps(propNum); propNum += 2; } propNum = 2; // Then Conductivity - for (int pcount = 1, pcount_end = MaterialFD(MaterNum).numTempCond; pcount <= pcount_end; ++pcount) { - MaterialFD(MaterNum).TempCond(2, pcount) = MaterialProps(propNum); + for (int pcount = 1, pcount_end = matFD.numTempCond; pcount <= pcount_end; ++pcount) { + matFD.TempCond(2, pcount) = MaterialProps(propNum); propNum += 2; } nonInc = false; inegptr = 0; - for (int pcount = 1, pcount_end = MaterialFD(MaterNum).numTempCond - 1; pcount <= pcount_end; ++pcount) { - if (MaterialFD(MaterNum).TempCond(1, pcount) < MaterialFD(MaterNum).TempCond(1, pcount + 1)) continue; + for (int pcount = 1, pcount_end = matFD.numTempCond - 1; pcount <= pcount_end; ++pcount) { + if (matFD.TempCond(1, pcount) < matFD.TempCond(1, pcount + 1)) continue; nonInc = true; inegptr = pcount + 1; break; @@ -384,23 +382,22 @@ namespace HeatBalFiniteDiffManager { if (nonInc) { ShowSevereError(state, format("GetCondFDInput: {}=\"{}\", non increasing Temperatures. Temperatures must be strictly increasing.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, - format("...occurs first at item=[{}], value=[{:.2R}].", inegptr, MaterialFD(MaterNum).TempCond(1, inegptr))); + ShowContinueError(state, format("...occurs first at item=[{}], value=[{:.2R}].", inegptr, matFD.TempCond(1, inegptr))); ErrorsFound = true; } } } - for (MaterNum = 1; MaterNum <= state.dataMaterial->TotMaterials; ++MaterNum) { - if (MaterialFD(MaterNum).numTempEnth == 0) { - MaterialFD(MaterNum).numTempEnth = 3; - MaterialFD(MaterNum).TempEnth.dimension(2, 3, -100.0); + for (auto &matFD : s_hbfd->MaterialFD) { + if (matFD.numTempEnth == 0) { + matFD.numTempEnth = 3; + matFD.TempEnth.dimension(2, 3, -100.0); } - if (MaterialFD(MaterNum).numTempCond == 0) { - MaterialFD(MaterNum).numTempCond = 3; - MaterialFD(MaterNum).TempCond.dimension(2, 3, -100.0); + if (matFD.numTempCond == 0) { + matFD.numTempCond = 3; + matFD.TempCond.dimension(2, 3, -100.0); } } @@ -418,11 +415,12 @@ namespace HeatBalFiniteDiffManager { int numNumerics; int maxTotalProps = 0; - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "MaterialProperty:PhaseChange", numArgs, numAlphas, numNumerics); + auto &s_ip = state.dataInputProcessing->inputProcessor; + + s_ip->getObjectDefMaxArgs(state, "MaterialProperty:PhaseChange", numArgs, numAlphas, numNumerics); maxTotalProps = max(maxTotalProps, numNumerics); - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs( - state, "MaterialProperty:VariableThermalConductivity", numArgs, numAlphas, numNumerics); + s_ip->getObjectDefMaxArgs(state, "MaterialProperty:VariableThermalConductivity", numArgs, numAlphas, numNumerics); maxTotalProps = max(maxTotalProps, numNumerics); return maxTotalProps; @@ -443,17 +441,19 @@ namespace HeatBalFiniteDiffManager { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool ErrorsFound; - if (state.dataHeatBalFiniteDiffMgr->GetHBFiniteDiffInputFlag) { + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + + if (s_hbfd->GetHBFiniteDiffInputFlag) { // Obtains conduction FD related parameters from input file GetCondFDInput(state); - state.dataHeatBalFiniteDiffMgr->GetHBFiniteDiffInputFlag = false; + s_hbfd->GetHBFiniteDiffInputFlag = false; } - auto &SurfaceFD = state.dataHeatBalFiniteDiffMgr->SurfaceFD; + auto &SurfaceFD = s_hbfd->SurfaceFD; ErrorsFound = false; // now do begin environment inits. - if (state.dataGlobal->BeginEnvrnFlag && state.dataHeatBalFiniteDiffMgr->MyEnvrnFlag) { + if (state.dataGlobal->BeginEnvrnFlag && s_hbfd->MyEnvrnFlag) { for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { if (state.dataSurface->Surface(SurfNum).HeatTransferAlgorithm != DataSurfaces::HeatTransferModel::CondFD) continue; if (state.dataSurface->Surface(SurfNum).Construction <= 0) continue; // Shading surface, not really a heat transfer surface @@ -480,9 +480,12 @@ namespace HeatBalFiniteDiffManager { thisSurface.CpDelXRhoS1 = 0.0; thisSurface.CpDelXRhoS2 = 0.0; thisSurface.TDpriortimestep = 0.0; - thisSurface.PhaseChangeState = 0; - thisSurface.PhaseChangeStateOld = 0; - thisSurface.PhaseChangeStateOldOld = 0; + thisSurface.PhaseChangeState = Material::Phase::Transition; + thisSurface.PhaseChangeStateOld = Material::Phase::Transition; + thisSurface.PhaseChangeStateOldOld = Material::Phase::Transition; + thisSurface.PhaseChangeStateRep = Material::phaseInts[(int)Material::Phase::Transition]; + thisSurface.PhaseChangeStateOldRep = Material::phaseInts[(int)Material::Phase::Transition]; + thisSurface.PhaseChangeStateOldOldRep = Material::phaseInts[(int)Material::Phase::Transition]; thisSurface.PhaseChangeTemperatureReverse = 50; state.dataMstBal->TempOutsideAirFD(SurfNum) = 0.0; @@ -497,11 +500,11 @@ namespace HeatBalFiniteDiffManager { state.dataMstBal->HGrndFD(SurfNum) = 0.0; state.dataMstBal->HAirFD(SurfNum) = 0.0; } - state.dataHeatBalFiniteDiffMgr->WarmupSurfTemp = 0; - state.dataHeatBalFiniteDiffMgr->MyEnvrnFlag = false; + s_hbfd->WarmupSurfTemp = 0; + s_hbfd->MyEnvrnFlag = false; } if (!state.dataGlobal->BeginEnvrnFlag) { - state.dataHeatBalFiniteDiffMgr->MyEnvrnFlag = true; + s_hbfd->MyEnvrnFlag = true; } // now do every timestep inits @@ -547,10 +550,6 @@ namespace HeatBalFiniteDiffManager { Real64 mAlpha; Real64 StabilityTemp; Real64 StabilityMoist; - Real64 a; - Real64 b; - Real64 c; - Real64 d; Real64 kt; Real64 RhoS; Real64 Por; @@ -559,12 +558,13 @@ namespace HeatBalFiniteDiffManager { Real64 DeltaTimestep; // zone timestep in seconds, for local check of properties Real64 ThicknessThreshold; // min thickness consistent with other thermal properties, for local check - auto &ConstructFD = state.dataHeatBalFiniteDiffMgr->ConstructFD; - auto &SigmaR = state.dataHeatBalFiniteDiffMgr->SigmaR; - auto &SigmaC = state.dataHeatBalFiniteDiffMgr->SigmaC; - auto &SurfaceFD = state.dataHeatBalFiniteDiffMgr->SurfaceFD; - auto &QHeatInFlux = state.dataHeatBalFiniteDiffMgr->QHeatInFlux; - auto &QHeatOutFlux = state.dataHeatBalFiniteDiffMgr->QHeatOutFlux; + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + auto &ConstructFD = s_hbfd->ConstructFD; + auto &SigmaR = s_hbfd->SigmaR; + auto &SigmaC = s_hbfd->SigmaC; + auto &SurfaceFD = s_hbfd->SurfaceFD; + auto &QHeatInFlux = s_hbfd->QHeatInFlux; + auto &QHeatOutFlux = s_hbfd->QHeatOutFlux; ConstructFD.allocate(state.dataHeatBal->TotConstructs); SigmaR.allocate(state.dataHeatBal->TotConstructs); @@ -586,11 +586,10 @@ namespace HeatBalFiniteDiffManager { // set a Delt that fits the zone time step and keeps it below 200s. - state.dataHeatBalFiniteDiffMgr->fracTimeStepZone_Hour = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); + s_hbfd->fracTimeStepZone_Hour = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); for (int index = 1; index <= 20; ++index) { - Delt = (state.dataHeatBalFiniteDiffMgr->fracTimeStepZone_Hour * Constant::SecInHour) / - index; // TimeStepZone = Zone time step in fractional hours + Delt = (s_hbfd->fracTimeStepZone_Hour * Constant::SecInHour) / index; // TimeStepZone = Zone time step in fractional hours if (Delt <= 200) break; } @@ -632,36 +631,35 @@ namespace HeatBalFiniteDiffManager { // now there are special equations for R-only layers. int CurrentLayer = thisConstruct.LayerPoint(Layer); - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(CurrentLayer)); - assert(thisMaterial != nullptr); + auto *mat = state.dataMaterial->materials(CurrentLayer); - thisConstructFD.Name(Layer) = thisMaterial->Name; - thisConstructFD.Thickness(Layer) = thisMaterial->Thickness; + thisConstructFD.Name(Layer) = mat->Name; + thisConstructFD.Thickness(Layer) = mat->Thickness; // Do some quick error checks for this section. - if (thisMaterial->ROnly) { // Rlayer + if (mat->ROnly) { // Rlayer // These values are only needed temporarily and to calculate flux, // Layer will be handled // as a pure R in the temperature calc. // assign other properties based on resistance - thisMaterial->SpecHeat = 0.0001; - thisMaterial->Density = 1.0; - thisMaterial->Thickness = 0.1; // arbitrary thickness for R layer - thisMaterial->Conductivity = thisMaterial->Thickness / thisMaterial->Resistance; - kt = thisMaterial->Conductivity; - thisConstructFD.Thickness(Layer) = thisMaterial->Thickness; + mat->SpecHeat = 0.0001; + mat->Density = 1.0; + mat->Thickness = 0.1; // arbitrary thickness for R layer + mat->Conductivity = mat->Thickness / mat->Resistance; + kt = mat->Conductivity; + thisConstructFD.Thickness(Layer) = mat->Thickness; - SigmaR(ConstrNum) += thisMaterial->Resistance; // add resistance of R layer - SigmaC(ConstrNum) += 0.0; // no capacitance for R layer + SigmaR(ConstrNum) += mat->Resistance; // add resistance of R layer + SigmaC(ConstrNum) += 0.0; // no capacitance for R layer - Alpha = kt / (thisMaterial->Density * thisMaterial->SpecHeat); + Alpha = kt / (mat->Density * mat->SpecHeat); mAlpha = 0.0; - } else if (thisMaterial->group == Material::Group::Air) { // Group 1 = Air + } else if (mat->group == Material::Group::AirGap) { // Group 1 = Air // Again, these values are only needed temporarily and to calculate flux, // Air layer will be handled @@ -669,17 +667,17 @@ namespace HeatBalFiniteDiffManager { // assign // other properties based on resistance - thisMaterial->SpecHeat = 0.0001; - thisMaterial->Density = 1.0; - thisMaterial->Thickness = 0.1; // arbitrary thickness for R layer - thisMaterial->Conductivity = thisMaterial->Thickness / thisMaterial->Resistance; - kt = thisMaterial->Conductivity; - thisConstructFD.Thickness(Layer) = thisMaterial->Thickness; + mat->SpecHeat = 0.0001; + mat->Density = 1.0; + mat->Thickness = 0.1; // arbitrary thickness for R layer + mat->Conductivity = mat->Thickness / mat->Resistance; + kt = mat->Conductivity; + thisConstructFD.Thickness(Layer) = mat->Thickness; - SigmaR(ConstrNum) += thisMaterial->Resistance; // add resistance of R layer - SigmaC(ConstrNum) += 0.0; // no capacitance for R layer + SigmaR(ConstrNum) += mat->Resistance; // add resistance of R layer + SigmaC(ConstrNum) += 0.0; // no capacitance for R layer - Alpha = kt / (thisMaterial->Density * thisMaterial->SpecHeat); + Alpha = kt / (mat->Density * mat->SpecHeat); mAlpha = 0.0; } else if (thisConstruct.TypeIsIRT) { // make similar to air? (that didn't seem to work well) ShowSevereError(state, @@ -693,20 +691,18 @@ namespace HeatBalFiniteDiffManager { } continue; } else { + auto *matReg = mat; + assert(matReg != nullptr); // Regular material Properties - a = thisMaterial->MoistACoeff; - b = thisMaterial->MoistBCoeff; - c = thisMaterial->MoistCCoeff; - d = thisMaterial->MoistDCoeff; - kt = thisMaterial->Conductivity; - RhoS = thisMaterial->Density; - Por = thisMaterial->Porosity; - Cp = thisMaterial->SpecHeat; + kt = matReg->Conductivity; + RhoS = matReg->Density; + Por = matReg->Porosity; + Cp = matReg->SpecHeat; // Need Resistance for reg layer - thisMaterial->Resistance = thisMaterial->Thickness / thisMaterial->Conductivity; - Dv = thisMaterial->VaporDiffus; - SigmaR(ConstrNum) += thisMaterial->Resistance; // add resistance - SigmaC(ConstrNum) += thisMaterial->Density * thisMaterial->SpecHeat * thisMaterial->Thickness; + matReg->Resistance = matReg->Thickness / matReg->Conductivity; + Dv = matReg->VaporDiffus; + SigmaR(ConstrNum) += matReg->Resistance; // add resistance + SigmaC(ConstrNum) += matReg->Density * matReg->SpecHeat * matReg->Thickness; Alpha = kt / (RhoS * Cp); mAlpha = 0.0; @@ -714,22 +710,22 @@ namespace HeatBalFiniteDiffManager { if (Alpha > DataHeatBalance::HighDiffusivityThreshold) { DeltaTimestep = state.dataGlobal->TimeStepZoneSec; ThicknessThreshold = std::sqrt(Alpha * DeltaTimestep * 3.0); - if (thisMaterial->Thickness < ThicknessThreshold) { + if (mat->Thickness < ThicknessThreshold) { ShowSevereError( state, format( "InitialInitHeatBalFiniteDiff: Found Material that is too thin and/or too highly conductive, material name = {}", - thisMaterial->Name)); + mat->Name)); ShowContinueError(state, format("High conductivity Material layers are not well supported by Conduction Finite Difference, " "material conductivity = {:.3R} [W/m-K]", - thisMaterial->Conductivity)); + mat->Conductivity)); ShowContinueError(state, format("Material thermal diffusivity = {:.3R} [m2/s]", Alpha)); ShowContinueError( state, format("Material with this thermal diffusivity should have thickness > {:.5R} [m]", ThicknessThreshold)); - if (thisMaterial->Thickness < DataHeatBalance::ThinMaterialLayerThreshold) { - ShowContinueError( - state, format("Material may be too thin to be modeled well, thickness = {:.5R} [m]", thisMaterial->Thickness)); + if (mat->Thickness < DataHeatBalance::ThinMaterialLayerThreshold) { + ShowContinueError(state, + format("Material may be too thin to be modeled well, thickness = {:.5R} [m]", mat->Thickness)); ShowContinueError(state, format("Material with this thermal diffusivity should have thickness > {:.5R} [m]", DataHeatBalance::ThinMaterialLayerThreshold)); @@ -742,18 +738,18 @@ namespace HeatBalFiniteDiffManager { // Proceed with setting node sizes in layers - dxn = std::sqrt(Alpha * Delt * state.dataHeatBalFiniteDiffMgr->SpaceDescritConstant); // The Fourier number is set using user constant + dxn = std::sqrt(Alpha * Delt * s_hbfd->SpaceDescritConstant); // The Fourier number is set using user constant // number of nodes=thickness/spacing. This is number of full size node spaces across layer. - Ipts1 = int(thisMaterial->Thickness / dxn); + Ipts1 = int(mat->Thickness / dxn); // set high conductivity layers to a single full size node thickness. (two half nodes) if (Ipts1 <= 1) Ipts1 = 1; - if (thisMaterial->ROnly || thisMaterial->group == Material::Group::Air) { + if (mat->ROnly || mat->group == Material::Group::AirGap) { Ipts1 = 1; // single full node in R layers- surfaces of adjacent material or inside/outside layer } - dxn = thisMaterial->Thickness / double(Ipts1); // full node thickness + dxn = mat->Thickness / double(Ipts1); // full node thickness StabilityTemp = Alpha * Delt / pow_2(dxn); StabilityMoist = mAlpha * Delt / pow_2(dxn); @@ -835,6 +831,9 @@ namespace HeatBalFiniteDiffManager { SurfaceFD(Surf).PhaseChangeState.allocate(TotNodes + 1); SurfaceFD(Surf).PhaseChangeStateOld.allocate(TotNodes + 1); SurfaceFD(Surf).PhaseChangeStateOldOld.allocate(TotNodes + 1); + SurfaceFD(Surf).PhaseChangeStateRep.allocate(TotNodes + 1); + SurfaceFD(Surf).PhaseChangeStateOldRep.allocate(TotNodes + 1); + SurfaceFD(Surf).PhaseChangeStateOldOldRep.allocate(TotNodes + 1); SurfaceFD(Surf).PhaseChangeTemperatureReverse.allocate(TotNodes + 1); SurfaceFD(Surf).condMaterialActuators.allocate(TotLayers); SurfaceFD(Surf).specHeatMaterialActuators.allocate(TotLayers); @@ -867,9 +866,12 @@ namespace HeatBalFiniteDiffManager { SurfaceFD(Surf).CpDelXRhoS1 = 0.0; SurfaceFD(Surf).CpDelXRhoS2 = 0.0; SurfaceFD(Surf).TDpriortimestep = 0.0; - SurfaceFD(Surf).PhaseChangeState = 0; - SurfaceFD(Surf).PhaseChangeStateOld = 0; - SurfaceFD(Surf).PhaseChangeStateOldOld = 0; + SurfaceFD(Surf).PhaseChangeState = Material::Phase::Transition; + SurfaceFD(Surf).PhaseChangeStateOld = Material::Phase::Transition; + SurfaceFD(Surf).PhaseChangeStateOldOld = Material::Phase::Transition; + SurfaceFD(Surf).PhaseChangeStateRep = Material::phaseInts[(int)Material::Phase::Transition]; + SurfaceFD(Surf).PhaseChangeStateOldRep = Material::phaseInts[(int)Material::Phase::Transition]; + SurfaceFD(Surf).PhaseChangeStateOldOldRep = Material::phaseInts[(int)Material::Phase::Transition]; SurfaceFD(Surf).PhaseChangeTemperatureReverse = 50; SurfaceFD(Surf).condNodeReport = 0.0; SurfaceFD(Surf).specHeatNodeReport = 0.0; @@ -883,7 +885,7 @@ namespace HeatBalFiniteDiffManager { // Setup material layer names actuators int matLay = state.dataConstruction->Construct(ConstrNum).LayerPoint(lay); // Actuator name format: "{SurfName}:{MaterialLayerName}" - std::string actName = fmt::format("{}:{}", state.dataSurface->Surface(Surf).Name, state.dataMaterial->Material(matLay)->Name); + std::string actName = fmt::format("{}:{}", state.dataSurface->Surface(Surf).Name, state.dataMaterial->materials(matLay)->Name); SurfaceFD(Surf).condMaterialActuators(lay).actuatorName = actName; SurfaceFD(Surf).specHeatMaterialActuators(lay).actuatorName = actName; @@ -997,14 +999,14 @@ namespace HeatBalFiniteDiffManager { SetupOutputVariable(state, format("CondFD Phase Change State {}", node), Constant::Units::None, - SurfaceFD(SurfNum).PhaseChangeState(node), + (int &)SurfaceFD(SurfNum).PhaseChangeStateRep(node), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(SurfNum).Name); SetupOutputVariable(state, format("CondFD Phase Change Previous State {}", node), Constant::Units::None, - SurfaceFD(SurfNum).PhaseChangeStateOld(node), + (int &)SurfaceFD(SurfNum).PhaseChangeStateOldRep(node), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(SurfNum).Name); @@ -1054,13 +1056,14 @@ namespace HeatBalFiniteDiffManager { int numNodesInMaterialLayer(EnergyPlusData &state, std::string const &surfName, std::string const &matName) { + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; for (auto const &surface : state.dataSurface->Surface) { if (surface.Name == surfName) { int constrNum = surface.Construction; for (int lay = 1; lay <= state.dataConstruction->Construct(constrNum).TotLayers; ++lay) { int matLay = state.dataConstruction->Construct(constrNum).LayerPoint(lay); - if (state.dataMaterial->Material(matLay)->Name == matName) { - return state.dataHeatBalFiniteDiffMgr->ConstructFD(constrNum).NodeNumPoint(lay); + if (state.dataMaterial->materials(matLay)->Name == matName) { + return s_hbfd->ConstructFD(constrNum).NodeNumPoint(lay); } } } @@ -1116,7 +1119,9 @@ namespace HeatBalFiniteDiffManager { // all building surface constructs. int const ConstrNum = state.dataSurface->Surface(Surf).Construction; - auto &constructFD = state.dataHeatBalFiniteDiffMgr->ConstructFD(ConstrNum); + + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + auto &constructFD = s_hbfd->ConstructFD(ConstrNum); int const TotNodes = constructFD.TotNodes; int const TotLayers = state.dataConstruction->Construct(ConstrNum).TotLayers; @@ -1127,17 +1132,17 @@ namespace HeatBalFiniteDiffManager { int const Delt = constructFD.DeltaTime; // (seconds) // Aliases - auto &surfaceFD = state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf); + auto &surfaceFD = s_hbfd->SurfaceFD(Surf); Real64 HMovInsul = 0; if (state.dataSurface->AnyMovableInsulation) HMovInsul = state.dataHeatBalSurf->SurfMovInsulHExt(Surf); // Start stepping through the slab with time. for (int J = 1, J_end = nint(state.dataGlobal->TimeStepZoneSec / Delt); J <= J_end; ++J) { // PT testing higher time steps - int GSiter; // iteration counter for implicit repeat calculation - for (GSiter = 1; GSiter <= state.dataHeatBalFiniteDiffMgr->MaxGSiter; ++GSiter) { // Iterate implicit equations - surfaceFD.TDTLast = surfaceFD.TDT; // Save last iteration's TDT (New temperature) values - surfaceFD.EnthLast = surfaceFD.EnthNew; // Last iterations new enthalpy value + int GSiter; // iteration counter for implicit repeat calculation + for (GSiter = 1; GSiter <= s_hbfd->MaxGSiter; ++GSiter) { // Iterate implicit equations + surfaceFD.TDTLast = surfaceFD.TDT; // Save last iteration's TDT (New temperature) values + surfaceFD.EnthLast = surfaceFD.EnthNew; // Last iterations new enthalpy value // Original loop version int i(1); // Node counter @@ -1253,14 +1258,13 @@ namespace HeatBalFiniteDiffManager { // to either liquid or solid), the temperature at which it changes its direction is saved // in the variable PhaseChangeTemperatureReverse, and this variable will hold the value of the temperature until // the next reverse in the process takes place. - if (((surfaceFD.PhaseChangeStateOld(I) == HysteresisPhaseChange::PhaseChangeStates::FREEZING && - surfaceFD.PhaseChangeState(I) == HysteresisPhaseChange::PhaseChangeStates::TRANSITION) || - (surfaceFD.PhaseChangeStateOld(I) == HysteresisPhaseChange::PhaseChangeStates::TRANSITION && - surfaceFD.PhaseChangeState(I) == HysteresisPhaseChange::PhaseChangeStates::FREEZING)) || - ((surfaceFD.PhaseChangeStateOld(I) == HysteresisPhaseChange::PhaseChangeStates::MELTING && - surfaceFD.PhaseChangeState(I) == HysteresisPhaseChange::PhaseChangeStates::TRANSITION) || - (surfaceFD.PhaseChangeStateOld(I) == HysteresisPhaseChange::PhaseChangeStates::TRANSITION && - surfaceFD.PhaseChangeState(I) == HysteresisPhaseChange::PhaseChangeStates::MELTING))) { + if (((surfaceFD.PhaseChangeStateOld(I) == Material::Phase::Freezing && + surfaceFD.PhaseChangeState(I) == Material::Phase::Transition) || + (surfaceFD.PhaseChangeStateOld(I) == Material::Phase::Transition && + surfaceFD.PhaseChangeState(I) == Material::Phase::Freezing)) || + ((surfaceFD.PhaseChangeStateOld(I) == Material::Phase::Melting && surfaceFD.PhaseChangeState(I) == Material::Phase::Transition) || + (surfaceFD.PhaseChangeStateOld(I) == Material::Phase::Transition && + surfaceFD.PhaseChangeState(I) == Material::Phase::Melting))) { surfaceFD.PhaseChangeTemperatureReverse(I) = surfaceFD.TDT(I); } } @@ -1268,6 +1272,8 @@ namespace HeatBalFiniteDiffManager { surfaceFD.PhaseChangeStateOldOld = surfaceFD.PhaseChangeStateOld; surfaceFD.PhaseChangeStateOld = surfaceFD.PhaseChangeState; + surfaceFD.PhaseChangeStateOldOldRep = surfaceFD.PhaseChangeStateOldRep; + surfaceFD.PhaseChangeStateOldRep = surfaceFD.PhaseChangeStateRep; } // Time Loop //PT solving time steps TempSurfOutTmp = surfaceFD.TDT(1); @@ -1307,6 +1313,8 @@ namespace HeatBalFiniteDiffManager { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool DoReport; + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + // Formats static constexpr std::string_view Format_702(" ConductionFiniteDifference Node,{},{:.8R},{},{},{}\n"); @@ -1315,8 +1323,8 @@ namespace HeatBalFiniteDiffManager { "Temperature Convergence Criteria\n"); print(state.files.eio, " ConductionFiniteDifference HeatBalanceSettings,{},{:.2R},{:.2R},{:.4R}\n", - CondFDSchemeTypeNamesCC[static_cast(state.dataHeatBalFiniteDiffMgr->CondFDSchemeType)], - state.dataHeatBalFiniteDiffMgr->SpaceDescritConstant, + CondFDSchemeTypeNamesCC[static_cast(s_hbfd->CondFDSchemeType)], + s_hbfd->SpaceDescritConstant, state.dataHeatBal->CondFDRelaxFactorInput, state.dataHeatBal->MaxAllowedDelTempCondFD); @@ -1348,7 +1356,7 @@ namespace HeatBalFiniteDiffManager { if (!construct.IsUsed) continue; if (!findAnySurfacesUsingConstructionAndCondFD(state, ThisNum)) continue; - auto &constructFD = state.dataHeatBalFiniteDiffMgr->ConstructFD(ThisNum); + auto &constructFD = s_hbfd->ConstructFD(ThisNum); static constexpr std::string_view Format_700(" Construction CondFD,{},{},{},{},{:.6R}\n"); print(state.files.eio, Format_700, @@ -1510,9 +1518,7 @@ namespace HeatBalFiniteDiffManager { // November 2011 P. Tabares fixed problems PCM stability problems // RE-ENGINEERED Curtis Pedersen 2006 - auto &SurfaceFD = state.dataHeatBalFiniteDiffMgr->SurfaceFD; - auto &ConstructFD = state.dataHeatBalFiniteDiffMgr->ConstructFD; - + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; auto const &surface(state.dataSurface->Surface(Surf)); int const surface_ExtBoundCond(surface.ExtBoundCond); @@ -1532,20 +1538,20 @@ namespace HeatBalFiniteDiffManager { if (surface_ExtBoundCond == DataSurfaces::Ground || state.dataEnvrn->IsRain) { TDT(i) = TT(i) = state.dataMstBal->TempOutsideAirFD(Surf); RhoT(i) = state.dataMstBal->RhoVaporAirOut(Surf); - SurfaceFD(Surf).CpDelXRhoS1(i) = 0.0; // Outside face does not have an outer half node - SurfaceFD(Surf).CpDelXRhoS2(i) = -1.0; // Set this to -1 as a flag, then set to node 2's outer half node heat capacity + s_hbfd->SurfaceFD(Surf).CpDelXRhoS1(i) = 0.0; // Outside face does not have an outer half node + s_hbfd->SurfaceFD(Surf).CpDelXRhoS2(i) = -1.0; // Set this to -1 as a flag, then set to node 2's outer half node heat capacity } else if (surface_ExtBoundCond > 0) { // this is actually the inside face of another surface, or maybe this same surface if adiabatic // switch around arguments for the other surf and call routines as for interior side BC from opposite face int const ext_bound_construction(state.dataSurface->Surface(surface_ExtBoundCond).Construction); 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 NodeIn(s_hbfd->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)); + auto &surfaceFD = s_hbfd->SurfaceFD(Surf); InteriorBCEqns(state, Delt, NodeIn, @@ -1571,7 +1577,7 @@ namespace HeatBalFiniteDiffManager { } else { // potential-lkl-from old CALL InteriorBCEqns(Delt,nodeIn,LayIn,Surf,SurfaceFD(Surface(Surf)%ExtBoundCond)%T, & - auto &surfaceFDEBC(SurfaceFD(surface_ExtBoundCond)); + auto &surfaceFDEBC = s_hbfd->SurfaceFD(surface_ExtBoundCond); InteriorBCEqns(state, Delt, NodeIn, @@ -1592,14 +1598,14 @@ namespace HeatBalFiniteDiffManager { TT(i) = surfaceFDEBC.TT(TotNodesPlusOne); RhoT(i) = surfaceFDEBC.RhoT(TotNodesPlusOne); - SurfaceFD(Surf).CpDelXRhoS1(i) = 0.0; // Outside face does not have an outer half node - SurfaceFD(Surf).CpDelXRhoS2(i) = surfaceFDEBC.CpDelXRhoS1(TotNodesPlusOne); // Save this for computing node flux values + s_hbfd->SurfaceFD(Surf).CpDelXRhoS1(i) = 0.0; // Outside face does not have an outer half node + s_hbfd->SurfaceFD(Surf).CpDelXRhoS2(i) = surfaceFDEBC.CpDelXRhoS1(TotNodesPlusOne); // Save this for computing node flux values } Real64 const QNetSurfFromOutside(state.dataHeatBalSurf->SurfOpaqInsFaceCondFlux(surface_ExtBoundCond)); // filled in InteriorBCEqns // QFluxOutsideToOutSurf(Surf) = QnetSurfFromOutside state.dataHeatBalSurf->SurfOpaqOutFaceCondFlux(Surf) = -QNetSurfFromOutside; - state.dataHeatBalFiniteDiffMgr->QHeatOutFlux(Surf) = QNetSurfFromOutside; + s_hbfd->QHeatOutFlux(Surf) = QNetSurfFromOutside; } else { // regular outside conditions Real64 TDT_i(TDT(i)); @@ -1625,16 +1631,16 @@ namespace HeatBalFiniteDiffManager { int const ConstrNum(surface.Construction); int const MatLay(state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay)); - auto const *mat(dynamic_cast(state.dataMaterial->Material(MatLay))); - auto const &matFD(state.dataHeatBalFiniteDiffMgr->MaterialFD(MatLay)); - auto const &condActuator(SurfaceFD(Surf).condMaterialActuators(Lay)); - auto const &specHeatActuator(SurfaceFD(Surf).specHeatMaterialActuators(Lay)); + auto *mat = state.dataMaterial->materials(MatLay); + auto const &matFD(s_hbfd->MaterialFD(MatLay)); + auto const &condActuator = s_hbfd->SurfaceFD(Surf).condMaterialActuators(Lay); + auto const &specHeatActuator = s_hbfd->SurfaceFD(Surf).specHeatMaterialActuators(Lay); // regular outside conditions // Calculate the Dry Heat Conduction Equation - if (mat->ROnly || mat->group == Material::Group::Air) { // R Layer or Air Layer ********** + if (mat->ROnly || mat->group == Material::Group::AirGap) { // R Layer or Air Layer ********** // Use algebraic equation for TDT based on R Real64 const Rlayer(mat->Resistance); TDT_i = (TDT_p + (QRadSWOutFD + hgnd * Tgnd + (hconvo + hrad) * Toa + hsky * Tsky) * Rlayer) / @@ -1664,10 +1670,11 @@ namespace HeatBalFiniteDiffManager { assert(matFD_TempEnth.u2() >= 3); Real64 const lTE(matFD_TempEnth.index(2, 1)); Real64 RhoS(mat->Density); - if (mat->phaseChange) { - adjustPropertiesForPhaseChange(state, i, Surf, mat, TD_i, TDT_i, Cp, RhoS, kt); - SurfaceFD(Surf).EnthalpyF = mat->phaseChange->enthalpyF; - SurfaceFD(Surf).EnthalpyM = mat->phaseChange->enthalpyM; + if (mat->hasPCM) { + auto *matPC = dynamic_cast(mat); + adjustPropertiesForPhaseChange(state, i, Surf, matPC, TD_i, TDT_i, Cp, RhoS, kt); + s_hbfd->SurfaceFD(Surf).EnthalpyF = matPC->enthalpyF; + s_hbfd->SurfaceFD(Surf).EnthalpyM = matPC->enthalpyM; } else if (matFD_TempEnth[lTE] + matFD_TempEnth[lTE + 1] + matFD_TempEnth[lTE + 2] >= 0.0) { // Phase change material: Use TempEnth data to generate Cp // Enthalpy function used to get average specific heat. Updated by GS so enthalpy function is followed. @@ -1689,25 +1696,25 @@ namespace HeatBalFiniteDiffManager { } // Update EMS internal variables - SurfaceFD(Surf).condNodeReport(i) = kt; - SurfaceFD(Surf).specHeatNodeReport(i) = Cp; + s_hbfd->SurfaceFD(Surf).condNodeReport(i) = kt; + s_hbfd->SurfaceFD(Surf).specHeatNodeReport(i) = Cp; // Choose Regular or Transparent Insulation Case - Real64 const DelX(ConstructFD(ConstrNum).DelX(Lay)); + Real64 const DelX = s_hbfd->ConstructFD(ConstrNum).DelX(Lay); Real64 const Delt_DelX(Delt * DelX); - SurfaceFD(Surf).CpDelXRhoS1(i) = 0.0; // Outside face does not have an outer half node - SurfaceFD(Surf).CpDelXRhoS2(i) = (Cp * DelX * RhoS) / 2.0; // Save this for computing node flux values + s_hbfd->SurfaceFD(Surf).CpDelXRhoS1(i) = 0.0; // Outside face does not have an outer half node + s_hbfd->SurfaceFD(Surf).CpDelXRhoS2(i) = (Cp * DelX * RhoS) / 2.0; // Save this for computing node flux values if (HMovInsul <= 0.0) { // Regular case - if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { // Second Order equation + if (s_hbfd->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { // Second Order equation Real64 const Cp_DelX_RhoS_2Delt(Cp * DelX * RhoS / (2.0 * Delt)); Real64 const kt_2DelX(kt / (2.0 * DelX)); Real64 const hsum(0.5 * (hconvo + hgnd + hrad + hsky)); TDT_i = (QRadSWOutFD + Cp_DelX_RhoS_2Delt * TD_i + kt_2DelX * (TDT_p - TD_i + TD(i + 1)) + hgnd * Tgnd + (hconvo + hrad) * Toa + hsky * Tsky - hsum * TD_i) / (hsum + kt_2DelX + Cp_DelX_RhoS_2Delt); - } else if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { // First Order + } else if (s_hbfd->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { // First Order Real64 const Two_Delt_DelX(2.0 * Delt_DelX); Real64 const Cp_DelX2_RhoS(Cp * pow_2(DelX) * RhoS); Real64 const Two_Delt_kt(2.0 * Delt * kt); @@ -1728,10 +1735,10 @@ namespace HeatBalFiniteDiffManager { Real64 const Two_Delt_kt(2.0 * Delt * kt); // Wall first node temperature behind Movable insulation - if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { + if (s_hbfd->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { TDT_i = (Two_Delt_DelX * (QRadSWOutFD + HMovInsul * TInsulOut) + Cp_DelX2_RhoS * TD_i + Two_Delt_kt * TDT_p) / (Two_Delt_DelX * HMovInsul + Two_Delt_kt + Cp_DelX2_RhoS); - } else if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { + } else if (s_hbfd->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { // Currently same as Crank Nicholson, need fully implicit formulation TDT_i = (Two_Delt_DelX * (QRadSWOutFD + HMovInsul * TInsulOut) + Cp_DelX2_RhoS * TD_i + Two_Delt_kt * TDT_p) / (Two_Delt_DelX * HMovInsul + Two_Delt_kt + Cp_DelX2_RhoS); @@ -1791,11 +1798,13 @@ namespace HeatBalFiniteDiffManager { int const ConstrNum(state.dataSurface->Surface(Surf).Construction); + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + int const MatLay(state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay)); - auto const *mat(dynamic_cast(state.dataMaterial->Material(MatLay))); - auto const &matFD(state.dataHeatBalFiniteDiffMgr->MaterialFD(MatLay)); - auto const &condActuator(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).condMaterialActuators(Lay)); - auto const &specHeatActuator(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).specHeatMaterialActuators(Lay)); + auto *mat = state.dataMaterial->materials(MatLay); + auto const &matFD = s_hbfd->MaterialFD(MatLay); + auto const &condActuator = s_hbfd->SurfaceFD(Surf).condMaterialActuators(Lay); + auto const &specHeatActuator = s_hbfd->SurfaceFD(Surf).specHeatMaterialActuators(Lay); Real64 const TD_i(TD(i)); @@ -1830,10 +1839,11 @@ namespace HeatBalFiniteDiffManager { assert(matFD_TempEnth.u2() >= 3); Real64 const lTE(matFD_TempEnth.index(2, 1)); Real64 RhoS(mat->Density); - if (mat->phaseChange) { - adjustPropertiesForPhaseChange(state, i, Surf, mat, TD_i, TDT_i, Cp, RhoS, kt); - ktA1 = mat->phaseChange->getConductivity(TDT_ip); - ktA2 = mat->phaseChange->getConductivity(TDT_mi); + if (mat->hasPCM) { + auto *matPC = dynamic_cast(mat); + adjustPropertiesForPhaseChange(state, i, Surf, matPC, TD_i, TDT_i, Cp, RhoS, kt); + ktA1 = matPC->getConductivity(TDT_ip); + ktA2 = matPC->getConductivity(TDT_mi); } else if (matFD_TempEnth[lTE] + matFD_TempEnth[lTE + 1] + matFD_TempEnth[lTE + 2] >= 0.0) { // Phase change material: Use TempEnth data EnthOld(i) = terpld(matFD_TempEnth, TD_i, 1, 2); // 1: Temperature, 2: Enthalpy EnthNew(i) = terpld(matFD_TempEnth, TDT_i, 1, 2); // 1: Temperature, 2: Enthalpy @@ -1855,13 +1865,13 @@ namespace HeatBalFiniteDiffManager { } // Update EMS internal variables - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).condNodeReport(i) = kt; - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).specHeatNodeReport(i) = Cp; + s_hbfd->SurfaceFD(Surf).condNodeReport(i) = kt; + s_hbfd->SurfaceFD(Surf).specHeatNodeReport(i) = Cp; - Real64 const DelX(state.dataHeatBalFiniteDiffMgr->ConstructFD(ConstrNum).DelX(Lay)); + Real64 const DelX(s_hbfd->ConstructFD(ConstrNum).DelX(Lay)); Real64 const Cp_DelX_RhoS_Delt(Cp * DelX * RhoS / Delt); - switch (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType) { + switch (s_hbfd->CondFDSchemeType) { case CondFDScheme::CrankNicholsonSecondOrder: { // Adams-Moulton second order Real64 const inv2DelX(1.0 / (2.0 * DelX)); TDT_i = ((Cp_DelX_RhoS_Delt * TD_i) + ((ktA1 * (TD(i + 1) - TD_i + TDT_p) + ktA2 * (TD(i - 1) - TD_i + TDT_m)) * inv2DelX)) / @@ -1878,7 +1888,7 @@ namespace HeatBalFiniteDiffManager { CheckFDNodeTempLimits(state, Surf, i, TDT_i); TDT(i) = TDT_i; - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS1(i) = state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS2(i) = + s_hbfd->SurfaceFD(Surf).CpDelXRhoS1(i) = s_hbfd->SurfaceFD(Surf).CpDelXRhoS2(i) = (Cp * DelX * RhoS) / 2.0; // Save this for computing node flux values, half nodes are the same here } @@ -1886,7 +1896,7 @@ namespace HeatBalFiniteDiffManager { int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction - int const Surf, // Surface number + int const SurfNum, // Surface number [[maybe_unused]] Array1D const &T, // INSIDE SURFACE TEMPERATURE OF EACH HEAT TRANSFER SURF. [[maybe_unused]] Array1D &TT, // INSIDE SURFACE TEMPERATURE OF EACH HEAT TRANSFER SURF. [[maybe_unused]] Array1D const &Rhov, // INSIDE SURFACE TEMPERATURE OF EACH HEAT TRANSFER SURF. @@ -1909,7 +1919,9 @@ namespace HeatBalFiniteDiffManager { // PURPOSE OF THIS SUBROUTINE: // calculate finite difference heat transfer for nodes that interface two different material layers inside construction - auto const &surface(state.dataSurface->Surface(Surf)); + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + auto const &surface = state.dataSurface->Surface(SurfNum); + auto &surfFD = s_hbfd->SurfaceFD(SurfNum); if (surface.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::CondFD) { // HT Algo issue @@ -1917,24 +1929,24 @@ namespace HeatBalFiniteDiffManager { auto const &construct(state.dataConstruction->Construct(ConstrNum)); int const MatLay(construct.LayerPoint(Lay)); - auto const *mat(dynamic_cast(state.dataMaterial->Material(MatLay))); + auto *mat = state.dataMaterial->materials(MatLay); int const MatLay2(construct.LayerPoint(Lay + 1)); - auto const *mat2(dynamic_cast(state.dataMaterial->Material(MatLay2))); + auto *mat2 = state.dataMaterial->materials(MatLay2); - auto const &condActuator1(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).condMaterialActuators(Lay)); - auto const &condActuator2(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).condMaterialActuators(Lay + 1)); + auto const &condActuator1 = surfFD.condMaterialActuators(Lay); + auto const &condActuator2 = surfFD.condMaterialActuators(Lay + 1); - auto const &specHeatActuator1(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).specHeatMaterialActuators(Lay)); - auto const &specHeatActuator2(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).specHeatMaterialActuators(Lay + 1)); + auto const &specHeatActuator1 = surfFD.specHeatMaterialActuators(Lay); + auto const &specHeatActuator2 = surfFD.specHeatMaterialActuators(Lay + 1); - auto const &heatFluxActuator(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).heatSourceFluxMaterialActuators(Lay)); + auto const &heatFluxActuator = surfFD.heatSourceFluxMaterialActuators(Lay); Real64 const TDT_m(TDT(i - 1)); Real64 const TDT_p(TDT(i + 1)); - bool const RLayerPresent(mat->ROnly || mat->group == Material::Group::Air); - bool const RLayer2Present(mat2->ROnly || mat2->group == Material::Group::Air); + bool const RLayerPresent(mat->ROnly || mat->group == Material::Group::AirGap); + bool const RLayer2Present(mat2->ROnly || mat2->group == Material::Group::AirGap); Real64 const Rlayer(mat->Resistance); // Resistance value of R Layer Real64 const Rlayer2(mat2->Resistance); // Resistance value of next layer to inside @@ -1945,8 +1957,8 @@ namespace HeatBalFiniteDiffManager { } else { - auto const &matFD(state.dataHeatBalFiniteDiffMgr->MaterialFD(MatLay)); - auto const &matFD2(state.dataHeatBalFiniteDiffMgr->MaterialFD(MatLay2)); + auto const &matFD(s_hbfd->MaterialFD(MatLay)); + auto const &matFD2(s_hbfd->MaterialFD(MatLay2)); Real64 TDT_i(TDT(i)); // Set Thermal Conductivity. Can be constant, simple linear temp dep or multiple linear segment temp function dep. @@ -1982,12 +1994,12 @@ namespace HeatBalFiniteDiffManager { Real64 RhoS1(mat->Density); Real64 const Cpo1(mat->SpecHeat); // constant Cp from input file Real64 Cp1(Cpo1); // Will be reset if PCM - Real64 const Delx1(state.dataHeatBalFiniteDiffMgr->ConstructFD(ConstrNum).DelX(Lay)); + Real64 const Delx1(s_hbfd->ConstructFD(ConstrNum).DelX(Lay)); Real64 RhoS2(mat2->Density); Real64 const Cpo2(mat2->SpecHeat); Real64 Cp2(Cpo2); // will be reset if PCM - Real64 const Delx2(state.dataHeatBalFiniteDiffMgr->ConstructFD(ConstrNum).DelX(Lay + 1)); + Real64 const Delx2(s_hbfd->ConstructFD(ConstrNum).DelX(Lay + 1)); // Calculate the Dry Heat Conduction Equation @@ -1996,11 +2008,11 @@ namespace HeatBalFiniteDiffManager { Real64 QSSFlux = 0.0; if ((surface.Area > 0.0) && (construct.SourceSinkPresent && Lay == construct.SourceAfterLayer)) { // Source/Sink flux value at a layer interface // Includes QPV Source - QSSFlux = (state.dataHeatBalFanSys->QRadSysSource(Surf) + state.dataHeatBalFanSys->QPVSysSource(Surf)) / surface.Area; + QSSFlux = (state.dataHeatBalFanSys->QRadSysSource(SurfNum) + state.dataHeatBalFanSys->QPVSysSource(SurfNum)) / surface.Area; } // update report variables - auto &surfFD = state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf); + auto &surfFD = s_hbfd->SurfaceFD(SurfNum); // only includes internal heat source surfFD.heatSourceInternalFluxLayerReport(Lay) = QSSFlux * surface.Area; @@ -2041,8 +2053,10 @@ namespace HeatBalFiniteDiffManager { if (RLayerPresent && !RLayer2Present) { // R-layer first // Check for PCM second layer - if (mat2->phaseChange) { - adjustPropertiesForPhaseChange(state, i, Surf, mat2, TD_i, TDT_i, Cp2, RhoS2, kt2); + if (mat2->hasPCM) { + auto *matPC2 = dynamic_cast(mat); + assert(matPC2 != nullptr); + adjustPropertiesForPhaseChange(state, i, SurfNum, matPC2, TD_i, TDT_i, Cp2, RhoS2, kt2); } else if ((matFD_sum < 0.0) && (matFD2_sum > 0.0)) { // Phase change material Layer2, Use TempEnth Data Real64 const Enth2Old(terpld(matFD2_TempEnth, TD_i, 1, 2)); // 1: Temperature, 2: Thermal conductivity Real64 const Enth2New(terpld(matFD2_TempEnth, TDT_i, 1, 2)); // 1: Temperature, 2: Thermal conductivity @@ -2072,28 +2086,28 @@ namespace HeatBalFiniteDiffManager { Real64 const Delt_Delx2(Delt * Delx2); Real64 const Cp2_fac(Cp2 * pow_2(Delx2) * RhoS2 * Rlayer); Real64 const Delt_kt2_Rlayer(Delt * kt2 * Rlayer); - if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { + if (s_hbfd->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { TDT_i = (2.0 * Delt_Delx2 * QSSFlux * Rlayer + (Cp2_fac - Delt_Delx2 - Delt_kt2_Rlayer) * TD_i + Delt_Delx2 * (TD(i - 1) + TDT_m) + Delt_kt2_Rlayer * (TD(i + 1) + TDT_p)) / (Delt_Delx2 + Delt_kt2_Rlayer + Cp2_fac); - } else if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { + } else if (s_hbfd->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { Real64 const Two_Delt_Delx2(2.0 * Delt_Delx2); Real64 const Two_Delt_kt2_Rlayer(2.0 * Delt_kt2_Rlayer); TDT_i = (Two_Delt_Delx2 * (QSSFlux * Rlayer + TDT_m) + Cp2_fac * TD_i + Two_Delt_kt2_Rlayer * TDT_p) / (Two_Delt_Delx2 + Two_Delt_kt2_Rlayer + Cp2_fac); } - CheckFDNodeTempLimits(state, Surf, i, TDT_i); + CheckFDNodeTempLimits(state, SurfNum, i, TDT_i); - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS1(i) = 0.0; // - rlayer has no capacitance, so this is zero - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS2(i) = - (Cp2 * Delx2 * RhoS2) / 2.0; // Save this for computing node flux values + surfFD.CpDelXRhoS1(i) = 0.0; // - rlayer has no capacitance, so this is zero + surfFD.CpDelXRhoS2(i) = (Cp2 * Delx2 * RhoS2) / 2.0; // Save this for computing node flux values } else if (!RLayerPresent && RLayer2Present) { // R-layer second // Check for PCM layer before R layer - if (mat->phaseChange) { - adjustPropertiesForPhaseChange(state, i, Surf, mat, TD_i, TDT_i, Cp1, RhoS1, kt1); + if (mat->hasPCM) { + auto *matPC = dynamic_cast(mat); + adjustPropertiesForPhaseChange(state, i, SurfNum, matPC, TD_i, TDT_i, Cp1, RhoS1, kt1); } else if ((matFD_sum > 0.0) && (matFD2_sum < 0.0)) { // Phase change material Layer1, Use TempEnth Data Real64 const Enth1Old(terpld(matFD_TempEnth, TD_i, 1, 2)); // 1: Temperature, 2: Thermal conductivity Real64 const Enth1New(terpld(matFD_TempEnth, TDT_i, 1, 2)); // 1: Temperature, 2: Thermal conductivity @@ -2122,22 +2136,21 @@ namespace HeatBalFiniteDiffManager { Real64 const Delt_Delx1(Delt * Delx1); Real64 const Cp1_fac(Cp1 * pow_2(Delx1) * RhoS1 * Rlayer2); Real64 const Delt_kt1_Rlayer2(Delt * kt1 * Rlayer2); - if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { + if (s_hbfd->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { TDT_i = (2.0 * Delt_Delx1 * QSSFlux * Rlayer2 + (Cp1_fac - Delt_Delx1 - Delt_kt1_Rlayer2) * TD_i + Delt_Delx1 * (TD(i + 1) + TDT_p) + Delt_kt1_Rlayer2 * (TD(i - 1) + TDT_m)) / (Delt_Delx1 + Delt_kt1_Rlayer2 + Cp1_fac); - } else if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { + } else if (s_hbfd->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { Real64 const Two_Delt_Delx1(2.0 * Delt_Delx1); Real64 const Two_Delt_kt1_Rlayer2(2.0 * Delt_kt1_Rlayer2); TDT_i = (Two_Delt_Delx1 * (QSSFlux * Rlayer2 + TDT_p) + Cp1_fac * TD_i + Two_Delt_kt1_Rlayer2 * TDT_m) / (Two_Delt_Delx1 + Two_Delt_kt1_Rlayer2 + Cp1_fac); } - CheckFDNodeTempLimits(state, Surf, i, TDT_i); + CheckFDNodeTempLimits(state, SurfNum, i, TDT_i); - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS1(i) = - (Cp1 * Delx1 * RhoS1) / 2.0; // Save this for computing node flux values - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS2(i) = 0.0; // - rlayer has no capacitance, so this is zero + surfFD.CpDelXRhoS1(i) = (Cp1 * Delx1 * RhoS1) / 2.0; // Save this for computing node flux values + surfFD.CpDelXRhoS2(i) = 0.0; // - rlayer has no capacitance, so this is zero } else { // Regular or Phase Change on both sides of interface @@ -2183,11 +2196,13 @@ namespace HeatBalFiniteDiffManager { } // Phase change material check - if (mat->phaseChange) { - adjustPropertiesForPhaseChange(state, i, Surf, mat, TD_i, TDT_i, Cp1, RhoS1, kt1); + if (mat->hasPCM) { + auto *matPC = dynamic_cast(mat); + adjustPropertiesForPhaseChange(state, i, SurfNum, matPC, TD_i, TDT_i, Cp1, RhoS1, kt1); } - if (mat2->phaseChange) { - adjustPropertiesForPhaseChange(state, i, Surf, mat2, TD_i, TDT_i, Cp2, RhoS2, kt2); + if (mat2->hasPCM) { + auto *matPC2 = dynamic_cast(mat2); + adjustPropertiesForPhaseChange(state, i, SurfNum, matPC2, TD_i, TDT_i, Cp2, RhoS2, kt2); } // EMS Conductivity 1 Override @@ -2224,34 +2239,31 @@ namespace HeatBalFiniteDiffManager { Real64 const Cp1_fac(Cp1 * pow_2(Delx1) * Delx2 * RhoS1); Real64 const Cp2_fac(Cp2 * Delx1 * pow_2(Delx2) * RhoS2); Real64 const Cp_fac(Cp1_fac + Cp2_fac); - if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == + if (s_hbfd->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { // Regular Internal Interface Node with Source/sink using Adams Moulton second // order TDT_i = (2.0 * Delt_Delx1 * Delx2 * QSSFlux + (Cp_fac - Delt_sum) * TD_i + Delt_Delx1_kt2 * (TD(i + 1) + TDT_p) + Delt_Delx2_kt1 * (TD(i - 1) + TDT_m)) / (Delt_sum + Cp_fac); - } else if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == - CondFDScheme::FullyImplicitFirstOrder) { // First order adams moulton + } else if (s_hbfd->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { // First order adams moulton TDT_i = (2.0 * (Delt_Delx1 * Delx2 * QSSFlux + Delt_Delx2_kt1 * TDT_m + Delt_Delx1_kt2 * TDT_p) + Cp_fac * TD_i) / (2.0 * (Delt_Delx2_kt1 + Delt_Delx1_kt2) + Cp_fac); } - CheckFDNodeTempLimits(state, Surf, i, TDT_i); + CheckFDNodeTempLimits(state, SurfNum, i, TDT_i); - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS1(i) = - (Cp1 * Delx1 * RhoS1) / 2.0; // Save this for computing node flux values - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS2(i) = - (Cp2 * Delx2 * RhoS2) / 2.0; // Save this for computing node flux values + surfFD.CpDelXRhoS1(i) = (Cp1 * Delx1 * RhoS1) / 2.0; // Save this for computing node flux values + surfFD.CpDelXRhoS2(i) = (Cp2 * Delx2 * RhoS2) / 2.0; // Save this for computing node flux values if (construct.SourceSinkPresent && (Lay == construct.SourceAfterLayer)) { - state.dataHeatBalFanSys->TCondFDSourceNode(Surf) = TDT_i; // Transfer node temp to Radiant System - state.dataHeatBalSurf->SurfTempSource(Surf) = TDT_i; // Transfer node temp to DataHeatBalSurface module - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).QSource = QSSFlux; - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).SourceNodeNum = i; + state.dataHeatBalFanSys->TCondFDSourceNode(SurfNum) = TDT_i; // Transfer node temp to Radiant System + state.dataHeatBalSurf->SurfTempSource(SurfNum) = TDT_i; // Transfer node temp to DataHeatBalSurface module + surfFD.QSource = QSSFlux; + surfFD.SourceNodeNum = i; } if (construct.SourceSinkPresent && (Lay == construct.TempAfterLayer)) { - state.dataHeatBalSurf->SurfTempUserLoc(Surf) = TDT_i; // Transfer node temp to DataHeatBalSurface module + state.dataHeatBalSurf->SurfTempUserLoc(SurfNum) = TDT_i; // Transfer node temp to DataHeatBalSurface module } } // End of R-layer and Regular check @@ -2266,7 +2278,7 @@ namespace HeatBalFiniteDiffManager { int const Delt, // Time Increment int const i, // Node Index int const Lay, // Layer Number for Construction - int const Surf, // Surface number + int const SurfNum, // Surface number [[maybe_unused]] Array1D const &T, // INSIDE SURFACE TEMPERATURE OF EACH HEAT TRANSFER SURF (Old). [[maybe_unused]] Array1D &TT, // INSIDE SURFACE TEMPERATURE OF EACH HEAT TRANSFER SURF (New). [[maybe_unused]] Array1D const &Rhov, // INSIDE SURFACE TEMPERATURE OF EACH HEAT TRANSFER SURF. @@ -2290,20 +2302,22 @@ namespace HeatBalFiniteDiffManager { // PURPOSE OF THIS SUBROUTINE: // Calculate the heat transfer at the node on the surfaces inside face (facing zone) - auto const &surface(state.dataSurface->Surface(Surf)); + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + auto const &surface(state.dataSurface->Surface(SurfNum)); + auto &surfFD = s_hbfd->SurfaceFD(SurfNum); int const ConstrNum(surface.Construction); // Set the internal conditions to local variables Real64 const NetLWRadToSurfFD( - state.dataHeatBalSurf->SurfQdotRadNetLWInPerArea(Surf)); // Net interior long wavelength radiation to surface from other surfaces - Real64 const QRadSWInFD(state.dataHeatBalSurf->SurfOpaqQRadSWInAbs(Surf)); // Short wave radiation absorbed on inside of opaque surface + state.dataHeatBalSurf->SurfQdotRadNetLWInPerArea(SurfNum)); // Net interior long wavelength radiation to surface from other surfaces + Real64 const QRadSWInFD(state.dataHeatBalSurf->SurfOpaqQRadSWInAbs(SurfNum)); // Short wave radiation absorbed on inside of opaque surface Real64 const SurfQdotRadHVACInPerAreaFD( - state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(Surf)); // Total current radiant heat flux at a surface - Real64 const QRadThermInFD(state.dataHeatBal->SurfQdotRadIntGainsInPerArea(Surf)); // Thermal radiation absorbed on inside surfaces + state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(SurfNum)); // Total current radiant heat flux at a surface + Real64 const QRadThermInFD(state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum)); // Thermal radiation absorbed on inside surfaces // Boundary Conditions from Simulation for Interior - Real64 hconvi(state.dataMstBal->HConvInFD(Surf)); + Real64 hconvi(state.dataMstBal->HConvInFD(SurfNum)); Real64 const Tia(state.dataZoneTempPredictorCorrector->zoneHeatBalance(surface.Zone).MAT); @@ -2313,14 +2327,14 @@ namespace HeatBalFiniteDiffManager { Real64 const QFac(NetLWRadToSurfFD + QRadSWInFD + QRadThermInFD + SurfQdotRadHVACInPerAreaFD); if (surface.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::CondFD) { int const MatLay(state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay)); - auto const *mat(dynamic_cast(state.dataMaterial->Material(MatLay))); - auto const &matFD(state.dataHeatBalFiniteDiffMgr->MaterialFD(MatLay)); - auto const &condActuator(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).condMaterialActuators(Lay)); - auto const &specHeatActuator(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).specHeatMaterialActuators(Lay)); + auto *mat = state.dataMaterial->materials(MatLay); + auto const &matFD(s_hbfd->MaterialFD(MatLay)); + auto const &condActuator = surfFD.condMaterialActuators(Lay); + auto const &specHeatActuator = surfFD.specHeatMaterialActuators(Lay); // Calculate the Dry Heat Conduction Equation - if (mat->ROnly || mat->group == Material::Group::Air) { // R Layer or Air Layer + if (mat->ROnly || mat->group == Material::Group::AirGap) { // R Layer or Air Layer // Use algebraic equation for TDT based on R Real64 constexpr IterDampConst( 5.0); // Damping constant for inside surface temperature iterations. Only used for massless (R-value only) Walls @@ -2330,9 +2344,8 @@ namespace HeatBalFiniteDiffManager { } else { // regular wall TDT_i = (TDT(i - 1) + (QFac + hconvi * Tia + TDreport(i) * IterDampConst) * Rlayer) / (1.0 + (hconvi + IterDampConst) * Rlayer); } - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS1(i) = - 0.0; // Save this for computing node flux values - rlayer has no capacitance - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS2(i) = 0.0; // Inside face does not have an inner half node + surfFD.CpDelXRhoS1(i) = 0.0; // Save this for computing node flux values - rlayer has no capacitance + surfFD.CpDelXRhoS2(i) = 0.0; // Inside face does not have an inner half node } else { // Regular or PCM Real64 const TDT_m(TDT(i - 1)); @@ -2358,8 +2371,9 @@ namespace HeatBalFiniteDiffManager { auto const &matFD_TempEnth(matFD.TempEnth); assert(matFD_TempEnth.u2() >= 3); Real64 const lTE(matFD_TempEnth.index(2, 1)); - if (mat->phaseChange) { - adjustPropertiesForPhaseChange(state, i, Surf, mat, TD_i, TDT_i, Cp, RhoS, kt); + if (mat->hasPCM) { + auto *matPC = dynamic_cast(mat); + adjustPropertiesForPhaseChange(state, i, SurfNum, matPC, TD_i, TDT_i, Cp, RhoS, kt); } else if (matFD_TempEnth[lTE] + matFD_TempEnth[lTE + 1] + matFD_TempEnth[lTE + 2] >= 0.0) { // Phase change material: Use TempEnth data EnthOld(i) = terpld(matFD_TempEnth, TD_i, 1, 2); // 1: Temperature, 2: Enthalpy @@ -2380,42 +2394,41 @@ namespace HeatBalFiniteDiffManager { } // Update EMS internal variables - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).condNodeReport(i) = kt; - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).specHeatNodeReport(i) = Cp; + surfFD.condNodeReport(i) = kt; + surfFD.specHeatNodeReport(i) = Cp; - Real64 const DelX(state.dataHeatBalFiniteDiffMgr->ConstructFD(ConstrNum).DelX(Lay)); + Real64 const DelX(s_hbfd->ConstructFD(ConstrNum).DelX(Lay)); Real64 const Delt_DelX(Delt * DelX); Real64 const Two_Delt_DelX(2.0 * Delt_DelX); Real64 const Delt_kt(Delt * kt); Real64 const Cp_DelX2_RhoS(Cp * pow_2(DelX) * RhoS); - if ((surface.ExtBoundCond > 0) && (i == 1)) { // this is for an adiabatic or interzone partition - if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { // Adams-Moulton second order + if ((surface.ExtBoundCond > 0) && (i == 1)) { // this is for an adiabatic or interzone partition + if (s_hbfd->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { // Adams-Moulton second order TDT_i = (Two_Delt_DelX * (QFac + hconvi * Tia) + (Cp_DelX2_RhoS - Delt_DelX * hconvi - Delt_kt) * TD_i + Delt_kt * (TD(i + 1) + TDT(i + 1))) / (Delt_DelX * hconvi + Delt_kt + Cp_DelX2_RhoS); - } else if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == - CondFDScheme::FullyImplicitFirstOrder) { // Adams-Moulton First order + } else if (s_hbfd->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { // Adams-Moulton First order Real64 const Two_Delt_kt(2.0 * Delt_kt); TDT_i = (Two_Delt_DelX * (QFac + hconvi * Tia) + Cp_DelX2_RhoS * TD_i + Two_Delt_kt * TDT(i + 1)) / (Two_Delt_DelX * hconvi + Two_Delt_kt + Cp_DelX2_RhoS); } } else { // for regular or interzone walls - if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { + if (s_hbfd->CondFDSchemeType == CondFDScheme::CrankNicholsonSecondOrder) { TDT_i = (Two_Delt_DelX * (QFac + hconvi * Tia) + (Cp_DelX2_RhoS - Delt_DelX * hconvi - Delt_kt) * TD_i + Delt_kt * (TD(i - 1) + TDT_m)) / (Delt_DelX * hconvi + Delt_kt + Cp_DelX2_RhoS); - } else if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { + } else if (s_hbfd->CondFDSchemeType == CondFDScheme::FullyImplicitFirstOrder) { Real64 const Two_Delt_kt(2.0 * Delt_kt); TDT_i = (Two_Delt_DelX * (QFac + hconvi * Tia) + Cp_DelX2_RhoS * TD_i + Two_Delt_kt * TDT_m) / (Two_Delt_DelX * hconvi + Two_Delt_kt + Cp_DelX2_RhoS); } } - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS1(i) = (Cp * DelX * RhoS) / 2.0; // Save this for computing node flux values - state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf).CpDelXRhoS2(i) = 0.0; // Inside face does not have an inner half node + surfFD.CpDelXRhoS1(i) = (Cp * DelX * RhoS) / 2.0; // Save this for computing node flux values + surfFD.CpDelXRhoS2(i) = 0.0; // Inside face does not have an inner half node } // Regular or R layer - CheckFDNodeTempLimits(state, Surf, i, TDT_i); + CheckFDNodeTempLimits(state, SurfNum, i, TDT_i); TDT(i) = TDT_i; @@ -2423,7 +2436,7 @@ namespace HeatBalFiniteDiffManager { Real64 const QNetSurfInside(-(QFac + hconvi * (-TDT_i + Tia))); // Pass inside conduction Flux [W/m2] to DataHeatBalanceSurface array - state.dataHeatBalSurf->SurfOpaqInsFaceCondFlux(Surf) = QNetSurfInside; + state.dataHeatBalSurf->SurfOpaqInsFaceCondFlux(SurfNum) = QNetSurfInside; } // todo - function not used @@ -2443,11 +2456,12 @@ namespace HeatBalFiniteDiffManager { // METHODOLOGY EMPLOYED: // Use methodology similar to HBSurfaceManager + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; int ZoneNum = state.dataSurface->Surface(SurfNum).Zone; - if (state.dataGlobal->WarmupFlag) ++state.dataHeatBalFiniteDiffMgr->WarmupSurfTemp; - if (!state.dataGlobal->WarmupFlag || state.dataHeatBalFiniteDiffMgr->WarmupSurfTemp > 10 || state.dataGlobal->DisplayExtraWarnings) { + if (state.dataGlobal->WarmupFlag) ++s_hbfd->WarmupSurfTemp; + if (!state.dataGlobal->WarmupFlag || s_hbfd->WarmupSurfTemp > 10 || state.dataGlobal->DisplayExtraWarnings) { if (CheckTemperature < DataHeatBalSurface::MinSurfaceTempLimit) { if (state.dataSurface->SurfLowTempErrCount(SurfNum) == 0) { ShowSevereMessage(state, @@ -2564,28 +2578,24 @@ namespace HeatBalFiniteDiffManager { Real64 &nodeTemp // calculated temperature, not reset ) { - auto &surfaceFD(state.dataHeatBalFiniteDiffMgr->SurfaceFD(surfNum)); + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + + auto &surfFD = s_hbfd->SurfaceFD(surfNum); auto &surfName = state.dataSurface->Surface(surfNum).Name; auto &minTempLimit = DataHeatBalSurface::MinSurfaceTempLimit; auto &maxTempLimit = state.dataHeatBalSurf->MaxSurfaceTempLimit; if (nodeTemp < minTempLimit) { - if (surfaceFD.indexNodeMinTempLimit == 0) { + if (surfFD.indexNodeMinTempLimit == 0) { ShowSevereMessage(state, format("Node temperature (low) out of bounds [{:.2R}] for surface={}, node={}", nodeTemp, surfName, nodeNum)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, format("Value has been reset to the lower limit value of {:.2R}.", minTempLimit)); } - ShowRecurringSevereErrorAtEnd(state, - "Node temperature (low) out of bounds for surface=" + surfName, - surfaceFD.indexNodeMinTempLimit, - nodeTemp, - nodeTemp, - _, - "C", - "C"); + ShowRecurringSevereErrorAtEnd( + state, "Node temperature (low) out of bounds for surface=" + surfName, surfFD.indexNodeMinTempLimit, nodeTemp, nodeTemp, _, "C", "C"); nodeTemp = minTempLimit; } else if (nodeTemp > maxTempLimit) { - if (surfaceFD.indexNodeMaxTempLimit == 0) { + if (surfFD.indexNodeMaxTempLimit == 0) { ShowSevereMessage(state, format("Node temperature (high) out of bounds [{:.2R}] for surface={}, node={}", nodeTemp, surfName, nodeNum)); ShowContinueErrorTimeStamp(state, ""); @@ -2593,7 +2603,7 @@ namespace HeatBalFiniteDiffManager { } ShowRecurringSevereErrorAtEnd(state, "Node temperature (high) out of bounds for surface=" + surfName, - surfaceFD.indexNodeMaxTempLimit, + surfFD.indexNodeMaxTempLimit, nodeTemp, nodeTemp, _, @@ -2604,7 +2614,7 @@ namespace HeatBalFiniteDiffManager { } void CalcNodeHeatFlux(EnergyPlusData &state, - int const Surf, // surface number + int const SurfNum, // surface number int const TotNodes // number of nodes in surface ) { @@ -2615,7 +2625,8 @@ namespace HeatBalFiniteDiffManager { // PURPOSE OF THIS SUBROUTINE: // Calculate flux at each condFD node - auto &surfaceFD(state.dataHeatBalFiniteDiffMgr->SurfaceFD(Surf)); + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + auto &surfFD = s_hbfd->SurfaceFD(SurfNum); // SurfaceFD.QDreport( n ) is the flux at node n // When this is called TDT( NodeNum ) is the new node temp and TDpriortimestep( NodeNum ) holds the previous node temp @@ -2626,7 +2637,7 @@ namespace HeatBalFiniteDiffManager { // so the arrays are all allocated to Totodes+1 // Heat flux at the inside face node (TotNodes+1) - surfaceFD.QDreport(TotNodes + 1) = state.dataHeatBalSurf->SurfOpaqInsFaceCondFlux(Surf); + surfFD.QDreport(TotNodes + 1) = state.dataHeatBalSurf->SurfOpaqInsFaceCondFlux(SurfNum); // Heat flux for remaining nodes. for (int node = TotNodes; node >= 1; --node) { @@ -2634,41 +2645,42 @@ namespace HeatBalFiniteDiffManager { // CpDelXRhoS1 is outer half-node heat capacity, CpDelXRhoS2 is inner half node heat capacity Real64 interNodeFlux; // heat flux at the plane between node and node+1 [W/m2] Real64 sourceFlux; // Internal source flux [W/m2] - if (surfaceFD.SourceNodeNum == node) { - sourceFlux = surfaceFD.QSource; + if (surfFD.SourceNodeNum == node) { + sourceFlux = surfFD.QSource; } else { sourceFlux = 0.0; } - interNodeFlux = surfaceFD.QDreport(node + 1) + surfaceFD.CpDelXRhoS1(node + 1) * - (surfaceFD.TDT(node + 1) - surfaceFD.TDpriortimestep(node + 1)) / - state.dataGlobal->TimeStepZoneSec; - surfaceFD.QDreport(node) = - interNodeFlux - sourceFlux + - surfaceFD.CpDelXRhoS2(node) * (surfaceFD.TDT(node) - surfaceFD.TDpriortimestep(node)) / state.dataGlobal->TimeStepZoneSec; + interNodeFlux = surfFD.QDreport(node + 1) + surfFD.CpDelXRhoS1(node + 1) * (surfFD.TDT(node + 1) - surfFD.TDpriortimestep(node + 1)) / + state.dataGlobal->TimeStepZoneSec; + surfFD.QDreport(node) = interNodeFlux - sourceFlux + + surfFD.CpDelXRhoS2(node) * (surfFD.TDT(node) - surfFD.TDpriortimestep(node)) / state.dataGlobal->TimeStepZoneSec; } if (state.dataEnvrn->IsRain) - state.dataHeatBalSurf->SurfOpaqOutFaceCondFlux(Surf) = -surfaceFD.QDreport(1); // Update the outside flux if it is raining + state.dataHeatBalSurf->SurfOpaqOutFaceCondFlux(SurfNum) = -surfFD.QDreport(1); // Update the outside flux if it is raining } void adjustPropertiesForPhaseChange(EnergyPlusData &state, int finiteDifferenceLayerIndex, - int surfaceIndex, - const Material::MaterialBase *materialDefinitionBase, + int surfNum, + Material::MaterialPhaseChange *mat, Real64 temperaturePrevious, Real64 temperatureUpdated, Real64 &updatedSpecificHeat, Real64 &updatedDensity, Real64 &updatedThermalConductivity) { - auto const *materialDefinition = dynamic_cast(materialDefinitionBase); - updatedSpecificHeat = materialDefinition->phaseChange->getCurrentSpecificHeat( - temperaturePrevious, - temperatureUpdated, - state.dataHeatBalFiniteDiffMgr->SurfaceFD(surfaceIndex).PhaseChangeTemperatureReverse(finiteDifferenceLayerIndex), - state.dataHeatBalFiniteDiffMgr->SurfaceFD(surfaceIndex).PhaseChangeStateOld(finiteDifferenceLayerIndex), - state.dataHeatBalFiniteDiffMgr->SurfaceFD(surfaceIndex).PhaseChangeState(finiteDifferenceLayerIndex)); - updatedDensity = materialDefinition->phaseChange->getDensity(temperaturePrevious); - updatedThermalConductivity = materialDefinition->phaseChange->getConductivity(temperatureUpdated); + auto &s_hbfd = state.dataHeatBalFiniteDiffMgr; + auto &surfFD = s_hbfd->SurfaceFD(surfNum); + + updatedSpecificHeat = mat->getCurrentSpecificHeat(temperaturePrevious, + temperatureUpdated, + surfFD.PhaseChangeTemperatureReverse(finiteDifferenceLayerIndex), + surfFD.PhaseChangeStateOld(finiteDifferenceLayerIndex), + surfFD.PhaseChangeState(finiteDifferenceLayerIndex)); + + surfFD.PhaseChangeStateRep(finiteDifferenceLayerIndex) = Material::phaseInts[(int)surfFD.PhaseChangeState(finiteDifferenceLayerIndex)]; + updatedDensity = mat->getDensity(temperaturePrevious); + updatedThermalConductivity = mat->getConductivity(temperatureUpdated); } bool findAnySurfacesUsingConstructionAndCondFD(EnergyPlusData const &state, int const constructionNum) diff --git a/src/EnergyPlus/HeatBalFiniteDiffManager.hh b/src/EnergyPlus/HeatBalFiniteDiffManager.hh index 2d520079ef3..39d2a3eab68 100644 --- a/src/EnergyPlus/HeatBalFiniteDiffManager.hh +++ b/src/EnergyPlus/HeatBalFiniteDiffManager.hh @@ -58,6 +58,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -147,9 +148,12 @@ namespace HeatBalFiniteDiffManager { int indexNodeMinTempLimit = 0; // index for recurring error message if node temperature is below minimum node temperature for this surfac Real64 EnthalpyM; // Melting enthalpy at a particular temperature Real64 EnthalpyF; // Freezing enthalpy at a particular temperature - Array1D PhaseChangeState; - Array1D PhaseChangeStateOld; - Array1D PhaseChangeStateOldOld; + Array1D PhaseChangeState; + Array1D PhaseChangeStateOld; + Array1D PhaseChangeStateOldOld; + Array1D PhaseChangeStateRep; + Array1D PhaseChangeStateOldRep; + Array1D PhaseChangeStateOldOldRep; Array1D PhaseChangeTemperatureReverse; Array1D condMaterialActuators; Array1D specHeatMaterialActuators; @@ -310,7 +314,7 @@ namespace HeatBalFiniteDiffManager { void adjustPropertiesForPhaseChange(EnergyPlusData &state, int finiteDifferenceLayerIndex, int surfaceIndex, - const Material::MaterialBase *materialDefinition, + Material::MaterialPhaseChange *mat, Real64 temperaturePrevious, Real64 temperatureUpdated, Real64 &updatedSpecificHeat, diff --git a/src/EnergyPlus/HeatBalanceAirManager.cc b/src/EnergyPlus/HeatBalanceAirManager.cc index 8467d62d731..6daa9ff9e43 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.cc +++ b/src/EnergyPlus/HeatBalanceAirManager.cc @@ -104,29 +104,16 @@ namespace EnergyPlus::HeatBalanceAirManager { enum class AirflowSpec { Invalid = -1, - Flow, - FlowPerZone, - FlowPerArea, - FlowPerPerson, - AirChanges, - Num -}; -constexpr std::array(AirflowSpec::Num)> airflowNamesUC = { - "FLOW", "FLOW/ZONE", "FLOW/AREA", "FLOW/PERSON", "AIRCHANGES/HOUR"}; - -enum class AirflowSpecAlt -{ - Invalid = -1, - Flow, FlowPerZone, FlowPerArea, FlowPerExteriorArea, FlowPerExteriorWallArea, + FlowPerPerson, AirChanges, Num }; -constexpr std::array(AirflowSpecAlt::Num)> airflowAltNamesUC = { - "FLOW", "FLOW/ZONE", "FLOW/AREA", "FLOW/EXTERIORAREA", "FLOW/EXTERIORWALLAREA", "AIRCHANGES/HOUR"}; +constexpr std::array(AirflowSpec::Num)> airflowSpecNamesUC = { + "FLOW/ZONE", "FLOW/AREA", "FLOW/EXTERIORAREA", "FLOW/EXTERIORWALLAREA", "FLOW/PERSON", "AIRCHANGES/HOUR"}; constexpr std::array(DataHeatBalance::VentilationType::Num)> ventilationTypeNamesUC = { "NATURAL", "INTAKE", "EXHAUST", "BALANCED"}; @@ -536,7 +523,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err ErrorsFound = true; } - // Check whether this zone is also controleld by hybrid ventilation object with ventilation control option or not + // Check whether this zone is also controlled by hybrid ventilation object with ventilation control option or not bool ControlFlag = Avail::GetHybridVentilationControlStatus(state, thisZoneAirBalance.ZonePtr); if (ControlFlag && thisZoneAirBalance.BalanceMethod == DataHeatBalance::AirBalance::Quadrature) { thisZoneAirBalance.BalanceMethod = DataHeatBalance::AirBalance::None; @@ -746,10 +733,9 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err // Set space flow fractions // Infiltration equipment design level calculation method. - AirflowSpecAlt flow = static_cast(getEnumValue(airflowAltNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) + AirflowSpec flow = static_cast(getEnumValue(airflowSpecNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) switch (flow) { - case AirflowSpecAlt::Flow: - case AirflowSpecAlt::FlowPerZone: + case AirflowSpec::FlowPerZone: if (lNumericFieldBlanks(1)) { ShowWarningError(state, format("{}{}=\"{}\", {} specifies {}, but that field is blank. 0 Infiltration will result.", @@ -777,7 +763,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } break; - case AirflowSpecAlt::FlowPerArea: + case AirflowSpec::FlowPerArea: if (thisInfiltration.ZonePtr != 0) { if (rNumericArgs(2) >= 0.0) { thisInfiltration.DesignLevel = rNumericArgs(2) * thisSpace.FloorArea; @@ -813,7 +799,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } break; - case AirflowSpecAlt::FlowPerExteriorArea: + case AirflowSpec::FlowPerExteriorArea: if (thisInfiltration.ZonePtr != 0) { if (rNumericArgs(3) >= 0.0) { thisInfiltration.DesignLevel = rNumericArgs(3) * thisSpace.ExteriorTotalSurfArea; @@ -847,7 +833,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } break; - case AirflowSpecAlt::FlowPerExteriorWallArea: + case AirflowSpec::FlowPerExteriorWallArea: if (thisInfiltration.ZonePtr != 0) { if (rNumericArgs(3) >= 0.0) { thisInfiltration.DesignLevel = rNumericArgs(3) * thisSpace.ExtGrossWallArea; @@ -881,7 +867,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } break; - case AirflowSpecAlt::AirChanges: + case AirflowSpec::AirChanges: if (thisInfiltration.spaceIndex != 0) { if (rNumericArgs(4) >= 0.0) { thisInfiltration.DesignLevel = rNumericArgs(4) * thisSpace.Volume / Constant::SecInHour; @@ -1398,9 +1384,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } // Ventilation equipment design level calculation method - AirflowSpec flow = static_cast(getEnumValue(airflowNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) + AirflowSpec flow = static_cast(getEnumValue(airflowSpecNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) switch (flow) { - case AirflowSpec::Flow: case AirflowSpec::FlowPerZone: thisVentilation.DesignLevel = rNumericArgs(1); if (lNumericFieldBlanks(1)) { @@ -2575,9 +2560,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } // Mixing equipment design level calculation method - AirflowSpec flow = static_cast(getEnumValue(airflowNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) + AirflowSpec flow = static_cast(getEnumValue(airflowSpecNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) switch (flow) { - case AirflowSpec::Flow: case AirflowSpec::FlowPerZone: thisMixing.DesignLevel = rNumericArgs(1); if (lNumericFieldBlanks(1)) { @@ -3195,9 +3179,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } // Mixing equipment design level calculation method. - AirflowSpec flow = static_cast(getEnumValue(airflowNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) + AirflowSpec flow = static_cast(getEnumValue(airflowSpecNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) switch (flow) { - case AirflowSpec::Flow: case AirflowSpec::FlowPerZone: thisMixing.DesignLevel = rNumericArgs(1); if (lNumericFieldBlanks(1)) { diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.cc b/src/EnergyPlus/HeatBalanceHAMTManager.cc index 95a5a5e353f..ebdb33c004b 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.cc +++ b/src/EnergyPlus/HeatBalanceHAMTManager.cc @@ -152,6 +152,7 @@ namespace HeatBalanceHAMTManager { // PURPOSE OF THIS SUBROUTINE: // gets input for the HAMT model + static constexpr std::string_view routineName = "GetHeatBalHAMTInput"; // SUBROUTINE PARAMETER DEFINITIONS: static std::string const cHAMTObject1("MaterialProperty:HeatAndMoistureTransfer:Settings"); @@ -173,8 +174,6 @@ namespace HeatBalanceHAMTManager { Array1D NumArray; - Real64 dumrh; - Real64 dumdata; Real64 avdata; int MaxNums; @@ -183,24 +182,16 @@ namespace HeatBalanceHAMTManager { int NumNums; int NumAlphas; int status; - int matid; - int iso; int Numid; - int suc; - int red; - int mu; - int tc; int HAMTitems; - int item; - int ii; - int jj; int vtcsid; - bool avflag; - bool isoerrrise; bool ErrorsFound; + auto &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_mat = state.dataMaterial; + state.dataHeatBalHAMTMgr->watertot.allocate(state.dataSurface->TotSurfaces); state.dataHeatBalHAMTMgr->surfrh.allocate(state.dataSurface->TotSurfaces); state.dataHeatBalHAMTMgr->surfextrh.allocate(state.dataSurface->TotSurfaces); @@ -235,25 +226,25 @@ namespace HeatBalanceHAMTManager { MaxAlphas = 0; MaxNums = 0; - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cHAMTObject1, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, cHAMTObject1, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cHAMTObject2, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, cHAMTObject2, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cHAMTObject3, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, cHAMTObject3, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cHAMTObject4, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, cHAMTObject4, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cHAMTObject5, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, cHAMTObject5, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cHAMTObject6, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, cHAMTObject6, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cHAMTObject7, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, cHAMTObject7, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); @@ -266,347 +257,363 @@ namespace HeatBalanceHAMTManager { lAlphaBlanks.dimension(MaxAlphas, false); lNumericBlanks.dimension(MaxNums, false); - HAMTitems = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cHAMTObject1); // MaterialProperty:HeatAndMoistureTransfer:Settings - for (item = 1; item <= HAMTitems; ++item) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cHAMTObject1, - item, - AlphaArray, - NumAlphas, - NumArray, - NumNums, - status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFieldNames, - cNumericFieldNames); - - matid = Util::FindItemInPtrList(AlphaArray(1), state.dataMaterial->Material); - - if (matid == 0) { - ShowSevereError(state, format("{} {}=\"{}\" is invalid (undefined).", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject1); // MaterialProperty:HeatAndMoistureTransfer:Settings + for (int item = 1; item <= HAMTitems; ++item) { + s_ip->getObjectItem(state, + cHAMTObject1, + item, + AlphaArray, + NumAlphas, + NumArray, + NumNums, + status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFieldNames, + cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cHAMTObject1, AlphaArray(1)}; + int matNum = Material::GetMaterialNum(state, AlphaArray(1)); + + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); ErrorsFound = true; continue; } - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); - if (thisMaterial->ROnly) { + + auto *mat = s_mat->materials(matNum); + + if (mat->group != Material::Group::Regular) { + ShowSevereCustomMessage(state, eoh, format("{} = \"{}\" is not a regular material.", cAlphaFieldNames(1), AlphaArray(1))); + ErrorsFound = true; + continue; + } + + if (mat->ROnly) { ShowWarningError(state, format("{} {}=\"{}\" is defined as an R-only value material.", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); continue; } - thisMaterial->Porosity = NumArray(1); - thisMaterial->iwater = NumArray(2); + auto *matHAMT = new MaterialHAMT; + matHAMT->Material::MaterialBase::operator=(*mat); // deep copy + + delete mat; + s_mat->materials(matNum) = matHAMT; + + matHAMT->hasHAMT = true; + matHAMT->Porosity = NumArray(1); + matHAMT->iwater = NumArray(2); } - HAMTitems = state.dataInputProcessing->inputProcessor->getNumObjectsFound( - state, cHAMTObject2); // MaterialProperty:HeatAndMoistureTransfer:SorptionIsotherm - for (item = 1; item <= HAMTitems; ++item) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cHAMTObject2, - item, - AlphaArray, - NumAlphas, - NumArray, - NumNums, - status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFieldNames, - cNumericFieldNames); - - matid = Util::FindItemInPtrList(AlphaArray(1), state.dataMaterial->Material); - - if (matid == 0) { - ShowSevereError(state, format("{} {}=\"{}\" is invalid (undefined).", cHAMTObject2, cAlphaFieldNames(1), AlphaArray(1))); + HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject2); // MaterialProperty:HeatAndMoistureTransfer:SorptionIsotherm + for (int item = 1; item <= HAMTitems; ++item) { + s_ip->getObjectItem(state, + cHAMTObject2, + item, + AlphaArray, + NumAlphas, + NumArray, + NumNums, + status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFieldNames, + cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cHAMTObject2, AlphaArray(1)}; + int matNum = Material::GetMaterialNum(state, AlphaArray(1)); + + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); ErrorsFound = true; continue; } - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); - if (thisMaterial->ROnly) { - ShowWarningError(state, - format("{} {}=\"{}\" is defined as an R-only value material.", cHAMTObject2, cAlphaFieldNames(1), AlphaArray(1))); + + auto *mat = s_mat->materials(matNum); + if (!mat->hasHAMT) { + ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ErrorsFound = true; continue; } + auto *matHAMT = dynamic_cast(mat); + assert(matHAMT != nullptr); + Numid = 1; - thisMaterial->niso = int(NumArray(Numid)); + matHAMT->niso = int(NumArray(Numid)); - for (iso = 1; iso <= thisMaterial->niso; ++iso) { - ++Numid; - thisMaterial->isorh(iso) = NumArray(Numid); - ++Numid; - thisMaterial->isodata(iso) = NumArray(Numid); + for (int iso = 1; iso <= matHAMT->niso; ++iso) { + matHAMT->isorh(iso) = NumArray(++Numid); + matHAMT->isodata(iso) = NumArray(++Numid); } - ++thisMaterial->niso; - thisMaterial->isorh(thisMaterial->niso) = rhmax; - thisMaterial->isodata(thisMaterial->niso) = thisMaterial->Porosity * wdensity; + ++matHAMT->niso; + matHAMT->isorh(matHAMT->niso) = rhmax; + matHAMT->isodata(matHAMT->niso) = matHAMT->Porosity * wdensity; - ++thisMaterial->niso; - thisMaterial->isorh(thisMaterial->niso) = 0.0; - thisMaterial->isodata(thisMaterial->niso) = 0.0; - } + ++matHAMT->niso; + matHAMT->isorh(matHAMT->niso) = 0.0; + matHAMT->isodata(matHAMT->niso) = 0.0; - // check the isotherm - for (matid = 1; matid <= state.dataMaterial->TotMaterials; ++matid) { - auto *mat = state.dataMaterial->Material(matid); - if (mat->group != Material::Group::Regular) continue; - - auto *matReg = dynamic_cast(mat); - assert(matReg != nullptr); - - if (matReg->niso == 0) continue; + // check the isotherm // - First sort - for (jj = 1; jj <= matReg->niso - 1; ++jj) { - for (ii = jj + 1; ii <= matReg->niso; ++ii) { - if (matReg->isorh(jj) > matReg->isorh(ii)) { + for (int jj = 1; jj <= matHAMT->niso - 1; ++jj) { + for (int ii = jj + 1; ii <= matHAMT->niso; ++ii) { + if (matHAMT->isorh(jj) > matHAMT->isorh(ii)) { - dumrh = matReg->isorh(jj); - dumdata = matReg->isodata(jj); + Real64 dumrh = matHAMT->isorh(jj); + Real64 dumdata = matHAMT->isodata(jj); - matReg->isorh(jj) = matReg->isorh(ii); - matReg->isodata(jj) = matReg->isodata(ii); + matHAMT->isorh(jj) = matHAMT->isorh(ii); + matHAMT->isodata(jj) = matHAMT->isodata(ii); - matReg->isorh(ii) = dumrh; - matReg->isodata(ii) = dumdata; + matHAMT->isorh(ii) = dumrh; + matHAMT->isodata(ii) = dumdata; } } } + //- Now make sure the data rises - isoerrrise = false; - for (ii = 1; ii <= 100; ++ii) { - avflag = true; - for (jj = 1; jj <= matReg->niso - 1; ++jj) { - if (matReg->isodata(jj) > matReg->isodata(jj + 1)) { + bool isoerrrise = false; + for (int ii = 1; ii <= 100; ++ii) { + bool avflag = true; + for (int jj = 1; jj <= matHAMT->niso - 1; ++jj) { + if (matHAMT->isodata(jj) > matHAMT->isodata(jj + 1)) { isoerrrise = true; - avdata = (matReg->isodata(jj) + matReg->isodata(jj + 1)) / 2.0; - matReg->isodata(jj) = avdata; - matReg->isodata(jj + 1) = avdata; + avdata = (matHAMT->isodata(jj) + matHAMT->isodata(jj + 1)) / 2.0; + matHAMT->isodata(jj) = avdata; + matHAMT->isodata(jj + 1) = avdata; avflag = false; } } if (avflag) break; } if (isoerrrise) { - ShowWarningError(state, format("{} data not rising - Check material {}", cHAMTObject2, matReg->Name)); + ShowWarningError(state, format("{}: data not rising - Check material {}", cHAMTObject2, matHAMT->Name)); ShowContinueError(state, "Isotherm data has been fixed, and the simulation continues."); } - } // for (matid) - - HAMTitems = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cHAMTObject3); // MaterialProperty:HeatAndMoistureTransfer:Suction - for (item = 1; item <= HAMTitems; ++item) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cHAMTObject3, - item, - AlphaArray, - NumAlphas, - NumArray, - NumNums, - status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFieldNames, - cNumericFieldNames); - - matid = Util::FindItemInPtrList(AlphaArray(1), state.dataMaterial->Material); - - if (matid == 0) { - ShowSevereError(state, format("{} {}=\"{}\" is invalid (undefined).", cHAMTObject3, cAlphaFieldNames(1), AlphaArray(1))); + } + + HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject3); // MaterialProperty:HeatAndMoistureTransfer:Suction + for (int item = 1; item <= HAMTitems; ++item) { + s_ip->getObjectItem(state, + cHAMTObject3, + item, + AlphaArray, + NumAlphas, + NumArray, + NumNums, + status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFieldNames, + cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cHAMTObject3, AlphaArray(1)}; + int matNum = Material::GetMaterialNum(state, AlphaArray(1)); + + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); ErrorsFound = true; continue; } - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); - if (thisMaterial->ROnly) { - ShowWarningError(state, - format("{} {}=\"{}\" is defined as an R-only value material.", cHAMTObject3, cAlphaFieldNames(1), AlphaArray(1))); + + auto *mat = s_mat->materials(matNum); + if (!mat->hasHAMT) { + ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ErrorsFound = true; continue; } + auto *matHAMT = dynamic_cast(mat); + assert(matHAMT != nullptr); + Numid = 1; - thisMaterial->nsuc = NumArray(Numid); - for (suc = 1; suc <= thisMaterial->nsuc; ++suc) { - ++Numid; - thisMaterial->sucwater(suc) = NumArray(Numid); - ++Numid; - thisMaterial->sucdata(suc) = NumArray(Numid); + matHAMT->nsuc = NumArray(Numid); + for (int suc = 1; suc <= matHAMT->nsuc; ++suc) { + matHAMT->sucwater(suc) = NumArray(++Numid); + matHAMT->sucdata(suc) = NumArray(++Numid); } - ++thisMaterial->nsuc; - thisMaterial->sucwater(thisMaterial->nsuc) = thisMaterial->isodata(thisMaterial->niso); - thisMaterial->sucdata(thisMaterial->nsuc) = thisMaterial->sucdata(thisMaterial->nsuc - 1); + ++matHAMT->nsuc; + matHAMT->sucwater(matHAMT->nsuc) = matHAMT->isodata(matHAMT->niso); + matHAMT->sucdata(matHAMT->nsuc) = matHAMT->sucdata(matHAMT->nsuc - 1); } - HAMTitems = state.dataInputProcessing->inputProcessor->getNumObjectsFound( - state, cHAMTObject4); // MaterialProperty:HeatAndMoistureTransfer:Redistribution - for (item = 1; item <= HAMTitems; ++item) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cHAMTObject4, - item, - AlphaArray, - NumAlphas, - NumArray, - NumNums, - status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFieldNames, - cNumericFieldNames); - - matid = Util::FindItemInPtrList(AlphaArray(1), state.dataMaterial->Material); - if (matid == 0) { - ShowSevereError(state, format("{} {}=\"{}\" is invalid (undefined).", cHAMTObject4, cAlphaFieldNames(1), AlphaArray(1))); + HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject4); // MaterialProperty:HeatAndMoistureTransfer:Redistribution + for (int item = 1; item <= HAMTitems; ++item) { + s_ip->getObjectItem(state, + cHAMTObject4, + item, + AlphaArray, + NumAlphas, + NumArray, + NumNums, + status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFieldNames, + cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cHAMTObject4, AlphaArray(1)}; + int matNum = Material::GetMaterialNum(state, AlphaArray(1)); + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); ErrorsFound = true; continue; } - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); - if (thisMaterial->ROnly) { - ShowWarningError(state, - format("{} {}=\"{}\" is defined as an R-only value material.", cHAMTObject4, cAlphaFieldNames(1), AlphaArray(1))); + + auto *mat = s_mat->materials(matNum); + if (!mat->hasHAMT) { + ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ErrorsFound = true; continue; } + + auto *matHAMT = dynamic_cast(mat); + assert(matHAMT != nullptr); + Numid = 1; - thisMaterial->nred = NumArray(Numid); - for (red = 1; red <= thisMaterial->nred; ++red) { - ++Numid; - thisMaterial->redwater(red) = NumArray(Numid); - ++Numid; - thisMaterial->reddata(red) = NumArray(Numid); + matHAMT->nred = NumArray(Numid); + for (int red = 1; red <= matHAMT->nred; ++red) { + matHAMT->redwater(red) = NumArray(++Numid); + matHAMT->reddata(red) = NumArray(++Numid); } - ++thisMaterial->nred; - thisMaterial->redwater(thisMaterial->nred) = thisMaterial->isodata(thisMaterial->niso); - thisMaterial->reddata(thisMaterial->nred) = thisMaterial->reddata(thisMaterial->nred - 1); + ++matHAMT->nred; + matHAMT->redwater(matHAMT->nred) = matHAMT->isodata(matHAMT->niso); + matHAMT->reddata(matHAMT->nred) = matHAMT->reddata(matHAMT->nred - 1); } - HAMTitems = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cHAMTObject5); // MaterialProperty:HeatAndMoistureTransfer:Diffusion - for (item = 1; item <= HAMTitems; ++item) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cHAMTObject5, - item, - AlphaArray, - NumAlphas, - NumArray, - NumNums, - status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFieldNames, - cNumericFieldNames); - - matid = Util::FindItemInPtrList(AlphaArray(1), state.dataMaterial->Material); - if (matid == 0) { - ShowSevereError(state, format("{} {}=\"{}\" is invalid (undefined).", cHAMTObject5, cAlphaFieldNames(1), AlphaArray(1))); + HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject5); // MaterialProperty:HeatAndMoistureTransfer:Diffusion + for (int item = 1; item <= HAMTitems; ++item) { + s_ip->getObjectItem(state, + cHAMTObject5, + item, + AlphaArray, + NumAlphas, + NumArray, + NumNums, + status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFieldNames, + cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cHAMTObject5, AlphaArray(1)}; + int matNum = Material::GetMaterialNum(state, AlphaArray(1)); + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); ErrorsFound = true; continue; } - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); - if (thisMaterial->ROnly) { - ShowWarningError(state, - format("{} {}=\"{}\" is defined as an R-only value material.", cHAMTObject5, cAlphaFieldNames(1), AlphaArray(1))); + + auto *mat = s_mat->materials(matNum); + if (!mat->hasHAMT) { + ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ErrorsFound = true; continue; } + auto *matHAMT = dynamic_cast(mat); + assert(matHAMT != nullptr); + Numid = 1; - thisMaterial->nmu = NumArray(Numid); - if (thisMaterial->nmu > 0) { - for (mu = 1; mu <= thisMaterial->nmu; ++mu) { - ++Numid; - thisMaterial->murh(mu) = NumArray(Numid); - ++Numid; - thisMaterial->mudata(mu) = NumArray(Numid); + matHAMT->nmu = NumArray(Numid); + if (matHAMT->nmu > 0) { + for (int mu = 1; mu <= matHAMT->nmu; ++mu) { + matHAMT->murh(mu) = NumArray(++Numid); + matHAMT->mudata(mu) = NumArray(++Numid); } - ++thisMaterial->nmu; - thisMaterial->murh(thisMaterial->nmu) = thisMaterial->isorh(thisMaterial->niso); - thisMaterial->mudata(thisMaterial->nmu) = thisMaterial->mudata(thisMaterial->nmu - 1); + ++matHAMT->nmu; + matHAMT->murh(matHAMT->nmu) = matHAMT->isorh(matHAMT->niso); + matHAMT->mudata(matHAMT->nmu) = matHAMT->mudata(matHAMT->nmu - 1); } } - HAMTitems = state.dataInputProcessing->inputProcessor->getNumObjectsFound( - state, cHAMTObject6); // MaterialProperty:HeatAndMoistureTransfer:ThermalConductivity - for (item = 1; item <= HAMTitems; ++item) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cHAMTObject6, - item, - AlphaArray, - NumAlphas, - NumArray, - NumNums, - status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFieldNames, - cNumericFieldNames); - - matid = Util::FindItemInPtrList(AlphaArray(1), state.dataMaterial->Material); - if (matid == 0) { - ShowSevereError(state, format("{} {}=\"{}\" is invalid (undefined).", cHAMTObject6, cAlphaFieldNames(1), AlphaArray(1))); + HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject6); // MaterialProperty:HeatAndMoistureTransfer:ThermalConductivity + for (int item = 1; item <= HAMTitems; ++item) { + s_ip->getObjectItem(state, + cHAMTObject6, + item, + AlphaArray, + NumAlphas, + NumArray, + NumNums, + status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFieldNames, + cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cHAMTObject6, AlphaArray(1)}; + int matNum = Material::GetMaterialNum(state, AlphaArray(1)); + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); ErrorsFound = true; continue; } - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); - if (thisMaterial->ROnly) { - ShowWarningError(state, - format("{} {}=\"{}\" is defined as an R-only value material.", cHAMTObject6, cAlphaFieldNames(1), AlphaArray(1))); + + auto *mat = s_mat->materials(matNum); + if (!mat->hasHAMT) { + ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ErrorsFound = true; continue; } + + auto *matHAMT = dynamic_cast(mat); + assert(matHAMT != nullptr); + Numid = 1; - thisMaterial->ntc = NumArray(Numid); - if (thisMaterial->ntc > 0) { - for (tc = 1; tc <= thisMaterial->ntc; ++tc) { + matHAMT->ntc = NumArray(Numid); + if (matHAMT->ntc > 0) { + for (int tc = 1; tc <= matHAMT->ntc; ++tc) { ++Numid; - thisMaterial->tcwater(tc) = NumArray(Numid); + matHAMT->tcwater(tc) = NumArray(Numid); ++Numid; - thisMaterial->tcdata(tc) = NumArray(Numid); + matHAMT->tcdata(tc) = NumArray(Numid); } - ++thisMaterial->ntc; - thisMaterial->tcwater(thisMaterial->ntc) = thisMaterial->isodata(thisMaterial->niso); - thisMaterial->tcdata(thisMaterial->ntc) = thisMaterial->tcdata(thisMaterial->ntc - 1); + ++matHAMT->ntc; + matHAMT->tcwater(matHAMT->ntc) = matHAMT->isodata(matHAMT->niso); + matHAMT->tcdata(matHAMT->ntc) = matHAMT->tcdata(matHAMT->ntc - 1); } } // Vapor Transfer coefficients - HAMTitems = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cHAMTObject7); // SurfaceProperties:VaporCoefficients - for (item = 1; item <= HAMTitems; ++item) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cHAMTObject7, - item, - AlphaArray, - NumAlphas, - NumArray, - NumNums, - status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFieldNames, - cNumericFieldNames); - + HAMTitems = s_ip->getNumObjectsFound(state, cHAMTObject7); // SurfaceProperties:VaporCoefficients + for (int item = 1; item <= HAMTitems; ++item) { + s_ip->getObjectItem(state, + cHAMTObject7, + item, + AlphaArray, + NumAlphas, + NumArray, + NumNums, + status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFieldNames, + cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cHAMTObject7, AlphaArray(1)}; vtcsid = Util::FindItemInList(AlphaArray(1), state.dataSurface->Surface); if (vtcsid == 0) { - ShowSevereError(state, format("{} {}=\"{}\" is invalid (undefined).", cHAMTObject7, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(1), AlphaArray(1)); ShowContinueError(state, "The basic material must be defined in addition to specifying HeatAndMoistureTransfer properties."); ErrorsFound = true; continue; @@ -652,125 +659,113 @@ namespace HeatBalanceHAMTManager { static constexpr std::string_view RoutineName("InitCombinedHeatAndMoistureFiniteElement: "); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ii; - int cid; - int cid1; - int cid2; int sid; int conid; - int lid; - int matid; - int did; - int adj1; - int adj2; int errorCount; - int MaterNum; Real64 runor; - Real64 high1; - Real64 low2; Real64 testlen; Real64 waterd; // water density bool DoReport; - auto &cells(state.dataHeatBalHAMTMgr->cells); + auto &s_mat = state.dataMaterial; + auto &s_hbh = state.dataHeatBalHAMTMgr; - state.dataHeatBalHAMTMgr->deltat = state.dataGlobal->TimeStepZone * 3600.0; + s_hbh->deltat = state.dataGlobal->TimeStepZone * 3600.0; // Check the materials information and work out how many cells are required. errorCount = 0; - state.dataHeatBalHAMTMgr->TotCellsMax = 0; - for (sid = 1; sid <= state.dataSurface->TotSurfaces; ++sid) { - if (state.dataSurface->Surface(sid).Class == SurfaceClass::Window) continue; - if (state.dataSurface->Surface(sid).HeatTransferAlgorithm != DataSurfaces::HeatTransferModel::HAMT) continue; - conid = state.dataSurface->Surface(sid).Construction; - if (conid == 0) continue; - for (lid = 1; lid <= state.dataConstruction->Construct(conid).TotLayers; ++lid) { - matid = state.dataConstruction->Construct(conid).LayerPoint(lid); - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); - if (thisMaterial->ROnly) { - ShowSevereError(state, - format("{}Construction={} cannot contain R-only value materials.", - RoutineName, - state.dataConstruction->Construct(conid).Name)); - ShowContinueError(state, format("Reference Material=\"{}\".", thisMaterial->Name)); + s_hbh->TotCellsMax = 0; + for (int sid = 1; sid <= state.dataSurface->TotSurfaces; ++sid) { + auto const &surf = state.dataSurface->Surface(sid); + if (surf.Class == SurfaceClass::Window) continue; + if (surf.HeatTransferAlgorithm != DataSurfaces::HeatTransferModel::HAMT) continue; + + if (surf.Construction == 0) continue; + auto const &constr = state.dataConstruction->Construct(surf.Construction); + + for (int lid = 1; lid <= constr.TotLayers; ++lid) { + auto *mat = s_mat->materials(constr.LayerPoint(lid)); + if (mat->ROnly) { + ShowSevereError(state, format("{}Construction={} cannot contain R-only value materials.", RoutineName, constr.Name)); + ShowContinueError(state, format("Reference Material=\"{}\".", mat->Name)); ++errorCount; continue; } - if (thisMaterial->nmu < 0) { - ShowSevereError(state, format("{}Construction={}", RoutineName, state.dataConstruction->Construct(conid).Name)); - ShowContinueError(state, - format("Reference Material=\"{}\" does not have required Water Vapor Diffusion Resistance Factor (mu) data.", - thisMaterial->Name)); + auto *matHAMT = dynamic_cast(mat); + assert(matHAMT != nullptr); + + if (matHAMT->nmu < 0) { + ShowSevereError(state, format("{}Construction={}", RoutineName, constr.Name)); + ShowContinueError( + state, + format("Reference Material=\"{}\" does not have required Water Vapor Diffusion Resistance Factor (mu) data.", matHAMT->Name)); ++errorCount; } - if (thisMaterial->niso < 0) { - ShowSevereError(state, format("{}Construction={}", RoutineName, state.dataConstruction->Construct(conid).Name)); - ShowContinueError(state, format("Reference Material=\"{}\" does not have required isotherm data.", thisMaterial->Name)); + if (matHAMT->niso < 0) { + ShowSevereError(state, format("{}Construction={}", RoutineName, constr.Name)); + ShowContinueError(state, format("Reference Material=\"{}\" does not have required isotherm data.", matHAMT->Name)); ++errorCount; } - if (thisMaterial->nsuc < 0) { - ShowSevereError(state, format("{}Construction={}", RoutineName, state.dataConstruction->Construct(conid).Name)); + if (matHAMT->nsuc < 0) { + ShowSevereError(state, format("{}Construction={}", RoutineName, constr.Name)); ShowContinueError( - state, - format("Reference Material=\"{}\" does not have required liquid transport coefficient (suction) data.", thisMaterial->Name)); + state, format("Reference Material=\"{}\" does not have required liquid transport coefficient (suction) data.", mat->Name)); ++errorCount; } - if (thisMaterial->nred < 0) { - ShowSevereError(state, format("{}Construction={}", RoutineName, state.dataConstruction->Construct(conid).Name)); - ShowContinueError(state, - format("Reference Material=\"{}\" does not have required liquid transport coefficient (redistribution) data.", - thisMaterial->Name)); + if (matHAMT->nred < 0) { + ShowSevereError(state, format("{}Construction={}", RoutineName, constr.Name)); + ShowContinueError( + state, + format("Reference Material=\"{}\" does not have required liquid transport coefficient (redistribution) data.", mat->Name)); ++errorCount; } - if (thisMaterial->ntc < 0) { - if (thisMaterial->Conductivity > 0) { - ShowWarningError(state, format("{}Construction={}", RoutineName, state.dataConstruction->Construct(conid).Name)); + if (matHAMT->ntc < 0) { + if (mat->Conductivity > 0) { + ShowWarningError(state, format("{}Construction={}", RoutineName, constr.Name)); ShowContinueError( - state, - format("Reference Material=\"{}\" does not have thermal conductivity data. Using fixed value.", thisMaterial->Name)); - thisMaterial->ntc = 2; - thisMaterial->tcwater(1) = 0.0; - thisMaterial->tcdata(1) = thisMaterial->Conductivity; - thisMaterial->tcwater(2) = thisMaterial->isodata(thisMaterial->niso); - thisMaterial->tcdata(2) = thisMaterial->Conductivity; + state, format("Reference Material=\"{}\" does not have thermal conductivity data. Using fixed value.", matHAMT->Name)); + matHAMT->ntc = 2; + matHAMT->tcwater(1) = 0.0; + matHAMT->tcdata(1) = matHAMT->Conductivity; + matHAMT->tcwater(2) = matHAMT->isodata(matHAMT->niso); + matHAMT->tcdata(2) = matHAMT->Conductivity; } else { - ShowSevereError(state, format("{}Construction={}", RoutineName, state.dataConstruction->Construct(conid).Name)); + ShowSevereError(state, format("{}Construction={}", RoutineName, constr.Name)); ShowContinueError(state, - format("Reference Material=\"{}\" does not have required thermal conductivity data.", thisMaterial->Name)); + format("Reference Material=\"{}\" does not have required thermal conductivity data.", matHAMT->Name)); ++errorCount; } } // convert material water content to RH - waterd = thisMaterial->iwater * thisMaterial->Density; - interp(thisMaterial->niso, thisMaterial->isodata, thisMaterial->isorh, waterd, thisMaterial->irh); + waterd = matHAMT->iwater * matHAMT->Density; + interp(matHAMT->niso, matHAMT->isodata, matHAMT->isorh, waterd, matHAMT->irh); - thisMaterial->divs = int(thisMaterial->Thickness / thisMaterial->divsize) + thisMaterial->divmin; - if (thisMaterial->divs > thisMaterial->divmax) { - thisMaterial->divs = thisMaterial->divmax; + matHAMT->divs = int(matHAMT->Thickness / matHAMT->divsize) + matHAMT->divmin; + if (matHAMT->divs > matHAMT->divmax) { + matHAMT->divs = matHAMT->divmax; } // Check length of cell - reduce number of divisions if necessary Real64 const sin_negPIOvr2 = std::sin(-Constant::Pi / 2.0); while (true) { - testlen = thisMaterial->Thickness * - ((std::sin(Constant::Pi * (-1.0 / double(thisMaterial->divs)) - Constant::Pi / 2.0) / 2.0) - (sin_negPIOvr2 / 2.0)); + testlen = matHAMT->Thickness * + ((std::sin(Constant::Pi * (-1.0 / double(matHAMT->divs)) - Constant::Pi / 2.0) / 2.0) - (sin_negPIOvr2 / 2.0)); if (testlen > adjdist) break; - --thisMaterial->divs; - if (thisMaterial->divs < 1) { - ShowSevereError(state, format("{}Construction={}", RoutineName, state.dataConstruction->Construct(conid).Name)); - ShowContinueError(state, format("Reference Material=\"{}\" is too thin.", thisMaterial->Name)); + --matHAMT->divs; + if (matHAMT->divs < 1) { + ShowSevereError(state, format("{}Construction={}", RoutineName, constr.Name)); + ShowContinueError(state, format("Reference Material=\"{}\" is too thin.", matHAMT->Name)); ++errorCount; break; } } - state.dataHeatBalHAMTMgr->TotCellsMax += thisMaterial->divs; + s_hbh->TotCellsMax += matHAMT->divs; } - state.dataHeatBalHAMTMgr->TotCellsMax += 7; + s_hbh->TotCellsMax += 7; } if (errorCount > 0) { @@ -778,148 +773,161 @@ namespace HeatBalanceHAMTManager { } // Make the cells and initialize - cells.allocate(state.dataHeatBalHAMTMgr->TotCellsMax); - for (auto &e : cells) { + s_hbh->cells.allocate(s_hbh->TotCellsMax); + for (auto &e : s_hbh->cells) { e.adjs = -1; e.adjsl = -1; } - cid = 0; + int cid = 0; // Set up surface cell structure - for (sid = 1; sid <= state.dataSurface->TotSurfaces; ++sid) { - if (!state.dataSurface->Surface(sid).HeatTransSurf) continue; - if (state.dataSurface->Surface(sid).Class == SurfaceClass::Window) continue; - if (state.dataSurface->Surface(sid).HeatTransferAlgorithm != DataSurfaces::HeatTransferModel::HAMT) continue; + for (int sid = 1; sid <= state.dataSurface->TotSurfaces; ++sid) { + auto &surf = state.dataSurface->Surface(sid); + if (!surf.HeatTransSurf) continue; + if (surf.Class == SurfaceClass::Window) continue; + if (surf.HeatTransferAlgorithm != DataSurfaces::HeatTransferModel::HAMT) continue; // Boundary Cells runor = -0.02; // Air Convection Cell ++cid; - state.dataHeatBalHAMTMgr->firstcell(sid) = cid; - state.dataHeatBalHAMTMgr->ExtConcell(sid) = cid; - cells(cid).rh = 0.0; - cells(cid).sid = sid; - cells(cid).length(1) = 0.01; - cells(cid).origin(1) = cells(cid).length(1) / 2.0 + runor; + s_hbh->firstcell(sid) = cid; + s_hbh->ExtConcell(sid) = cid; + auto &airConvCell = s_hbh->cells(cid); + airConvCell.rh = 0.0; + airConvCell.sid = sid; + airConvCell.length(1) = 0.01; + airConvCell.origin(1) = airConvCell.length(1) / 2.0 + runor; // Air Radiation Cell ++cid; - state.dataHeatBalHAMTMgr->ExtRadcell(sid) = cid; - cells(cid).rh = 0.0; - cells(cid).sid = sid; - cells(cid).length(1) = 0.01; - cells(cid).origin(1) = cells(cid).length(1) / 2.0 + runor; + s_hbh->ExtRadcell(sid) = cid; + auto &airRadCell = s_hbh->cells(cid); + airRadCell.rh = 0.0; + airRadCell.sid = sid; + airRadCell.length(1) = 0.01; + airRadCell.origin(1) = airRadCell.length(1) / 2.0 + runor; // Sky Cell ++cid; - state.dataHeatBalHAMTMgr->ExtSkycell(sid) = cid; - cells(cid).rh = 0.0; - cells(cid).sid = sid; - cells(cid).length(1) = 0.01; - cells(cid).origin(1) = cells(cid).length(1) / 2.0 + runor; + s_hbh->ExtSkycell(sid) = cid; + auto &skyCell = s_hbh->cells(cid); + skyCell.rh = 0.0; + skyCell.sid = sid; + skyCell.length(1) = 0.01; + skyCell.origin(1) = skyCell.length(1) / 2.0 + runor; // Ground Cell ++cid; - state.dataHeatBalHAMTMgr->ExtGrncell(sid) = cid; - cells(cid).rh = 0.0; - cells(cid).sid = sid; - cells(cid).length(1) = 0.01; - cells(cid).origin(1) = cells(cid).length(1) / 2.0 + runor; - runor += cells(cid).length(1); + s_hbh->ExtGrncell(sid) = cid; + auto &groundCell = s_hbh->cells(cid); + groundCell.rh = 0.0; + groundCell.sid = sid; + groundCell.length(1) = 0.01; + groundCell.origin(1) = groundCell.length(1) / 2.0 + runor; + runor += groundCell.length(1); // External Virtual Cell ++cid; - state.dataHeatBalHAMTMgr->Extcell(sid) = cid; - cells(cid).rh = 0.0; - cells(cid).sid = sid; - cells(cid).length(1) = 0.01; - cells(cid).origin(1) = cells(cid).length(1) / 2.0 + runor; - runor += cells(cid).length(1); + s_hbh->Extcell(sid) = cid; + auto &extVirtCell = s_hbh->cells(cid); + extVirtCell.rh = 0.0; + extVirtCell.sid = sid; + extVirtCell.length(1) = 0.01; + extVirtCell.origin(1) = extVirtCell.length(1) / 2.0 + runor; + runor += extVirtCell.length(1); // Material Cells - conid = state.dataSurface->Surface(sid).Construction; - for (lid = 1; lid <= state.dataConstruction->Construct(conid).TotLayers; ++lid) { - matid = state.dataConstruction->Construct(conid).LayerPoint(lid); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); + auto const &constr = state.dataConstruction->Construct(surf.Construction); + for (int lid = 1; lid <= constr.TotLayers; ++lid) { + auto const *mat = dynamic_cast(s_mat->materials(constr.LayerPoint(lid))); + assert(mat != nullptr); - for (did = 1; did <= thisMaterial->divs; ++did) { + for (int did = 1; did <= mat->divs; ++did) { ++cid; - cells(cid).matid = matid; - cells(cid).sid = sid; + auto &matCell = s_hbh->cells(cid); + matCell.matid = mat->Num; + matCell.sid = sid; - cells(cid).temp = thisMaterial->itemp; - cells(cid).tempp1 = thisMaterial->itemp; - cells(cid).tempp2 = thisMaterial->itemp; + matCell.temp = mat->itemp; + matCell.tempp1 = mat->itemp; + matCell.tempp2 = mat->itemp; - cells(cid).rh = thisMaterial->irh; - cells(cid).rhp1 = thisMaterial->irh; - cells(cid).rhp2 = thisMaterial->irh; + matCell.rh = mat->irh; + matCell.rhp1 = mat->irh; + matCell.rhp2 = mat->irh; - cells(cid).density = thisMaterial->Density; - cells(cid).spech = thisMaterial->SpecHeat; + matCell.density = mat->Density; + matCell.spech = mat->SpecHeat; // Make cells smaller near the surface - cells(cid).length(1) = thisMaterial->Thickness * - ((std::sin(Constant::Pi * (-double(did) / double(thisMaterial->divs)) - Constant::Pi / 2.0) / 2.0) - - (std::sin(Constant::Pi * (-double(did - 1) / double(thisMaterial->divs)) - Constant::Pi / 2.0) / 2.0)); + matCell.length(1) = + mat->Thickness * ((std::sin(Constant::Pi * (-double(did) / double(mat->divs)) - Constant::Pi / 2.0) / 2.0) - + (std::sin(Constant::Pi * (-double(did - 1) / double(mat->divs)) - Constant::Pi / 2.0) / 2.0)); - cells(cid).origin(1) = runor + cells(cid).length(1) / 2.0; - runor += cells(cid).length(1); + matCell.origin(1) = runor + matCell.length(1) / 2.0; + runor += matCell.length(1); - cells(cid).volume = cells(cid).length(1) * state.dataSurface->Surface(sid).Area; + matCell.volume = matCell.length(1) * state.dataSurface->Surface(sid).Area; } } // Interior Virtual Cell ++cid; - state.dataHeatBalHAMTMgr->Intcell(sid) = cid; - cells(cid).sid = sid; - cells(cid).rh = 0.0; - cells(cid).length(1) = 0.01; - cells(cid).origin(1) = cells(cid).length(1) / 2.0 + runor; - runor += cells(cid).length(1); + s_hbh->Intcell(sid) = cid; + auto &intVirtCell = s_hbh->cells(cid); + intVirtCell.sid = sid; + intVirtCell.rh = 0.0; + intVirtCell.length(1) = 0.01; + intVirtCell.origin(1) = intVirtCell.length(1) / 2.0 + runor; + runor += intVirtCell.length(1); // Air Convection Cell ++cid; - state.dataHeatBalHAMTMgr->lastcell(sid) = cid; - state.dataHeatBalHAMTMgr->IntConcell(sid) = cid; - cells(cid).rh = 0.0; - cells(cid).sid = sid; - cells(cid).length(1) = 0.01; - cells(cid).origin(1) = cells(cid).length(1) / 2.0 + runor; + s_hbh->lastcell(sid) = cid; + s_hbh->IntConcell(sid) = cid; + auto &airConvCell2 = s_hbh->cells(cid); + airConvCell2.rh = 0.0; + airConvCell2.sid = sid; + airConvCell2.length(1) = 0.01; + airConvCell2.origin(1) = airConvCell2.length(1) / 2.0 + runor; } // Find adjacent cells. - for (cid1 = 1; cid1 <= state.dataHeatBalHAMTMgr->TotCellsMax; ++cid1) { - for (cid2 = 1; cid2 <= state.dataHeatBalHAMTMgr->TotCellsMax; ++cid2) { - if ((cid1 != cid2) && (cells(cid1).sid == cells(cid2).sid)) { - high1 = cells(cid1).origin(1) + cells(cid1).length(1) / 2.0; - low2 = cells(cid2).origin(1) - cells(cid2).length(1) / 2.0; - if (std::abs(low2 - high1) < adjdist) { - adj1 = 0; - for (ii = 1; ii <= adjmax; ++ii) { - ++adj1; - if (cells(cid1).adjs(adj1) == -1) break; - } - adj2 = 0; - for (ii = 1; ii <= adjmax; ++ii) { - ++adj2; - if (cells(cid2).adjs(adj2) == -1) break; - } - cells(cid1).adjs(adj1) = cid2; - cells(cid2).adjs(adj2) = cid1; + for (int cid1 = 1; cid1 <= s_hbh->TotCellsMax; ++cid1) { + for (int cid2 = 1; cid2 <= s_hbh->TotCellsMax; ++cid2) { + if (cid1 == cid2) continue; + + auto &cell1 = s_hbh->cells(cid1); + auto &cell2 = s_hbh->cells(cid2); + + if (cell1.sid != cell2.sid) continue; + + Real64 high1 = cell1.origin(1) + cell1.length(1) / 2.0; + Real64 low2 = cell2.origin(1) - cell2.length(1) / 2.0; + if (std::abs(low2 - high1) < adjdist) { + int adj1 = 0; + for (int ii = 1; ii <= adjmax; ++ii) { + ++adj1; + if (cell1.adjs(adj1) == -1) break; + } + int adj2 = 0; + for (int ii = 1; ii <= adjmax; ++ii) { + ++adj2; + if (cell2.adjs(adj2) == -1) break; + } + cell1.adjs(adj1) = cid2; + cell2.adjs(adj2) = cid1; - cells(cid1).adjsl(adj1) = adj2; - cells(cid2).adjsl(adj2) = adj1; + cell1.adjsl(adj1) = adj2; + cell2.adjsl(adj2) = adj1; - sid = cells(cid1).sid; - cells(cid1).overlap(adj1) = state.dataSurface->Surface(sid).Area; - cells(cid2).overlap(adj2) = state.dataSurface->Surface(sid).Area; - cells(cid1).dist(adj1) = cells(cid1).length(1) / 2.0; - cells(cid2).dist(adj2) = cells(cid2).length(1) / 2.0; - } + sid = cell1.sid; + cell1.overlap(adj1) = state.dataSurface->Surface(sid).Area; + cell2.overlap(adj2) = state.dataSurface->Surface(sid).Area; + cell1.dist(adj1) = cell1.length(1) / 2.0; + cell2.dist(adj2) = cell2.length(1) / 2.0; } } } @@ -930,59 +938,59 @@ namespace HeatBalanceHAMTManager { static constexpr std::string_view Format_1965("! , Surface Name, Construction Name, Cell origins (m) \n"); print(state.files.eio, Format_1965); // cCurrentModuleObject='MaterialProperty:HeatAndMoistureTransfer:*' - for (sid = 1; sid <= state.dataSurface->TotSurfaces; ++sid) { + for (int sid = 1; sid <= state.dataSurface->TotSurfaces; ++sid) { if (!state.dataSurface->Surface(sid).HeatTransSurf) continue; if (state.dataSurface->Surface(sid).Class == SurfaceClass::Window) continue; if (state.dataSurface->Surface(sid).HeatTransferAlgorithm != DataSurfaces::HeatTransferModel::HAMT) continue; - cells(state.dataHeatBalHAMTMgr->Extcell(sid)).origin(1) += cells(state.dataHeatBalHAMTMgr->Extcell(sid)).length(1) / 2.0; - cells(state.dataHeatBalHAMTMgr->Intcell(sid)).origin(1) -= cells(state.dataHeatBalHAMTMgr->Intcell(sid)).length(1) / 2.0; - cells(state.dataHeatBalHAMTMgr->Extcell(sid)).volume = 0.0; - cells(state.dataHeatBalHAMTMgr->Intcell(sid)).volume = 0.0; - state.dataHeatBalHAMTMgr->watertot(sid) = 0.0; - state.dataHeatBalHAMTMgr->surfrh(sid) = 0.0; - state.dataHeatBalHAMTMgr->surfextrh(sid) = 0.0; - state.dataHeatBalHAMTMgr->surftemp(sid) = 0.0; - state.dataHeatBalHAMTMgr->surfexttemp(sid) = 0.0; - state.dataHeatBalHAMTMgr->surfvp(sid) = 0.0; + s_hbh->cells(s_hbh->Extcell(sid)).origin(1) += s_hbh->cells(s_hbh->Extcell(sid)).length(1) / 2.0; + s_hbh->cells(s_hbh->Intcell(sid)).origin(1) -= s_hbh->cells(s_hbh->Intcell(sid)).length(1) / 2.0; + s_hbh->cells(s_hbh->Extcell(sid)).volume = 0.0; + s_hbh->cells(s_hbh->Intcell(sid)).volume = 0.0; + s_hbh->watertot(sid) = 0.0; + s_hbh->surfrh(sid) = 0.0; + s_hbh->surfextrh(sid) = 0.0; + s_hbh->surftemp(sid) = 0.0; + s_hbh->surfexttemp(sid) = 0.0; + s_hbh->surfvp(sid) = 0.0; SetupOutputVariable(state, "HAMT Surface Average Water Content Ratio", Constant::Units::kg_kg, - state.dataHeatBalHAMTMgr->watertot(sid), + s_hbh->watertot(sid), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(sid).Name); SetupOutputVariable(state, "HAMT Surface Inside Face Temperature", Constant::Units::C, - state.dataHeatBalHAMTMgr->surftemp(sid), + s_hbh->surftemp(sid), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(sid).Name); SetupOutputVariable(state, "HAMT Surface Inside Face Relative Humidity", Constant::Units::Perc, - state.dataHeatBalHAMTMgr->surfrh(sid), + s_hbh->surfrh(sid), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(sid).Name); SetupOutputVariable(state, "HAMT Surface Inside Face Vapor Pressure", Constant::Units::Pa, - state.dataHeatBalHAMTMgr->surfvp(sid), + s_hbh->surfvp(sid), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(sid).Name); SetupOutputVariable(state, "HAMT Surface Outside Face Temperature", Constant::Units::C, - state.dataHeatBalHAMTMgr->surfexttemp(sid), + s_hbh->surfexttemp(sid), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(sid).Name); SetupOutputVariable(state, "HAMT Surface Outside Face Relative Humidity", Constant::Units::Perc, - state.dataHeatBalHAMTMgr->surfextrh(sid), + s_hbh->surfextrh(sid), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(sid).Name); @@ -990,44 +998,39 @@ namespace HeatBalanceHAMTManager { // write cell origins to initialization output file conid = state.dataSurface->Surface(sid).Construction; print(state.files.eio, "HAMT cells, {},{}", state.dataSurface->Surface(sid).Name, state.dataConstruction->Construct(conid).Name); - for (int concell = 1, concell_end = state.dataHeatBalHAMTMgr->Intcell(sid) - state.dataHeatBalHAMTMgr->Extcell(sid) + 1; - concell <= concell_end; - ++concell) { + for (int concell = 1, concell_end = s_hbh->Intcell(sid) - s_hbh->Extcell(sid) + 1; concell <= concell_end; ++concell) { print(state.files.eio, ",{:4}", concell); } print(state.files.eio, "\n"); print(state.files.eio, "HAMT origins,{},{}", state.dataSurface->Surface(sid).Name, state.dataConstruction->Construct(conid).Name); - for (int cellid = state.dataHeatBalHAMTMgr->Extcell(sid); cellid <= state.dataHeatBalHAMTMgr->Intcell(sid); ++cellid) { - print(state.files.eio, ",{:10.7F}", cells(cellid).origin(1)); + for (int cellid = s_hbh->Extcell(sid); cellid <= s_hbh->Intcell(sid); ++cellid) { + print(state.files.eio, ",{:10.7F}", s_hbh->cells(cellid).origin(1)); } print(state.files.eio, "\n"); - for (int cellid = state.dataHeatBalHAMTMgr->Extcell(sid), concell = 1; cellid <= state.dataHeatBalHAMTMgr->Intcell(sid); - ++cellid, ++concell) { + for (int cellid = s_hbh->Extcell(sid), concell = 1; cellid <= s_hbh->Intcell(sid); ++cellid, ++concell) { SetupOutputVariable(state, format("HAMT Surface Temperature Cell {}", concell), Constant::Units::C, - cells(cellid).temp, + s_hbh->cells(cellid).temp, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(sid).Name); } - for (int cellid = state.dataHeatBalHAMTMgr->Extcell(sid), concell = 1; cellid <= state.dataHeatBalHAMTMgr->Intcell(sid); - ++cellid, ++concell) { + for (int cellid = s_hbh->Extcell(sid), concell = 1; cellid <= s_hbh->Intcell(sid); ++cellid, ++concell) { SetupOutputVariable(state, format("HAMT Surface Water Content Cell {}", concell), Constant::Units::kg_kg, - cells(cellid).wreport, + s_hbh->cells(cellid).wreport, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(sid).Name); } - for (int cellid = state.dataHeatBalHAMTMgr->Extcell(sid), concell = 1; cellid <= state.dataHeatBalHAMTMgr->Intcell(sid); - ++cellid, ++concell) { + for (int cellid = s_hbh->Extcell(sid), concell = 1; cellid <= s_hbh->Intcell(sid); ++cellid, ++concell) { SetupOutputVariable(state, format("HAMT Surface Relative Humidity Cell {}", concell), Constant::Units::Perc, - cells(cellid).rhp, + s_hbh->cells(cellid).rhp, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, state.dataSurface->Surface(sid).Name); @@ -1040,10 +1043,9 @@ namespace HeatBalanceHAMTManager { static constexpr std::string_view Format_108("! , Material Name, Nominal R\n"); print(state.files.eio, Format_108); - for (MaterNum = 1; MaterNum <= state.dataMaterial->TotMaterials; ++MaterNum) { - + for (auto const *mat : s_mat->materials) { static constexpr std::string_view Format_111("Material Nominal Resistance,{},{:.4R}\n"); - print(state.files.eio, Format_111, state.dataMaterial->Material(MaterNum)->Name, state.dataHeatBal->NominalR(MaterNum)); + print(state.files.eio, Format_111, mat->Name, mat->NominalR); } } } @@ -1093,146 +1095,144 @@ namespace HeatBalanceHAMTManager { Real64 tempmax; Real64 tempmin; - int ii; - int matid; int itter; - int cid; - int adj; - int adjl; Real64 denominator; - auto &cells(state.dataHeatBalHAMTMgr->cells); - auto &Extcell(state.dataHeatBalHAMTMgr->Extcell); - auto &Intcell(state.dataHeatBalHAMTMgr->Intcell); - - if (state.dataGlobal->BeginEnvrnFlag && state.dataHeatBalHAMTMgr->MyEnvrnFlag(sid)) { - cells(Extcell(sid)).rh = 0.0; - cells(Extcell(sid)).rhp1 = 0.0; - cells(Extcell(sid)).rhp2 = 0.0; - - cells(Extcell(sid)).temp = 10.0; - cells(Extcell(sid)).tempp1 = 10.0; - cells(Extcell(sid)).tempp2 = 10.0; - - cells(Intcell(sid)).rh = 0.0; - cells(Intcell(sid)).rhp1 = 0.0; - cells(Intcell(sid)).rhp2 = 0.0; - - cells(Intcell(sid)).temp = 10.0; - cells(Intcell(sid)).tempp1 = 10.0; - cells(Intcell(sid)).tempp2 = 10.0; - - for (cid = Extcell(sid) + 1; cid <= Intcell(sid) - 1; ++cid) { - matid = cells(cid).matid; - - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); - cells(cid).temp = thisMaterial->itemp; - cells(cid).tempp1 = thisMaterial->itemp; - cells(cid).tempp2 = thisMaterial->itemp; - - cells(cid).rh = thisMaterial->irh; - cells(cid).rhp1 = thisMaterial->irh; - cells(cid).rhp2 = thisMaterial->irh; + auto &s_mat = state.dataMaterial; + auto &s_hbh = state.dataHeatBalHAMTMgr; + + if (state.dataGlobal->BeginEnvrnFlag && s_hbh->MyEnvrnFlag(sid)) { + auto &extCell = s_hbh->cells(s_hbh->Extcell(sid)); + extCell.rh = 0.0; + extCell.rhp1 = 0.0; + extCell.rhp2 = 0.0; + + extCell.temp = 10.0; + extCell.tempp1 = 10.0; + extCell.tempp2 = 10.0; + + auto &intCell = s_hbh->cells(s_hbh->Intcell(sid)); + intCell.rh = 0.0; + intCell.rhp1 = 0.0; + intCell.rhp2 = 0.0; + + intCell.temp = 10.0; + intCell.tempp1 = 10.0; + intCell.tempp2 = 10.0; + + for (int cid = s_hbh->Extcell(sid) + 1; cid <= s_hbh->Intcell(sid) - 1; ++cid) { + auto &cell = s_hbh->cells(cid); + auto const *mat = dynamic_cast(s_mat->materials(cell.matid)); + assert(mat != nullptr); + cell.temp = mat->itemp; + cell.tempp1 = mat->itemp; + cell.tempp2 = mat->itemp; + + cell.rh = mat->irh; + cell.rhp1 = mat->irh; + cell.rhp2 = mat->irh; } - state.dataHeatBalHAMTMgr->MyEnvrnFlag(sid) = false; + s_hbh->MyEnvrnFlag(sid) = false; } if (!state.dataGlobal->BeginEnvrnFlag) { - state.dataHeatBalHAMTMgr->MyEnvrnFlag(sid) = true; + s_hbh->MyEnvrnFlag(sid) = true; } + auto &extCell = s_hbh->cells(s_hbh->Extcell(sid)); + auto &extRadCell = s_hbh->cells(s_hbh->ExtRadcell(sid)); + auto &extSkyCell = s_hbh->cells(s_hbh->ExtSkycell(sid)); + auto &extGrnCell = s_hbh->cells(s_hbh->ExtGrncell(sid)); + auto &extConCell = s_hbh->cells(s_hbh->ExtConcell(sid)); + // Set all the boundary values - cells(state.dataHeatBalHAMTMgr->ExtRadcell(sid)).temp = state.dataMstBal->TempOutsideAirFD(sid); - cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).temp = state.dataMstBal->TempOutsideAirFD(sid); + extRadCell.temp = state.dataMstBal->TempOutsideAirFD(sid); + extConCell.temp = state.dataMstBal->TempOutsideAirFD(sid); Real64 spaceMAT = state.dataZoneTempPredictorCorrector->spaceHeatBalance(state.dataSurface->Surface(sid).spaceNum).MAT; if (state.dataSurface->Surface(sid).ExtBoundCond == OtherSideCondModeledExt) { // CR8046 switch modeled rad temp for sky temp. - cells(state.dataHeatBalHAMTMgr->ExtSkycell(sid)).temp = state.dataSurface->OSCM(state.dataSurface->Surface(sid).OSCMPtr).TRad; - cells(Extcell(sid)).Qadds = 0.0; // eliminate incident shortwave on underlying surface + extSkyCell.temp = state.dataSurface->OSCM(state.dataSurface->Surface(sid).OSCMPtr).TRad; + extCell.Qadds = 0.0; // eliminate incident shortwave on underlying surface } else { - cells(state.dataHeatBalHAMTMgr->ExtSkycell(sid)).temp = state.dataEnvrn->SkyTemp; - - cells(Extcell(sid)).Qadds = state.dataSurface->Surface(sid).Area * state.dataHeatBalSurf->SurfOpaqQRadSWOutAbs(sid); + extSkyCell.temp = state.dataEnvrn->SkyTemp; + extCell.Qadds = state.dataSurface->Surface(sid).Area * state.dataHeatBalSurf->SurfOpaqQRadSWOutAbs(sid); } - cells(state.dataHeatBalHAMTMgr->ExtGrncell(sid)).temp = state.dataMstBal->TempOutsideAirFD(sid); + extGrnCell.temp = state.dataMstBal->TempOutsideAirFD(sid); RhoOut = state.dataMstBal->RhoVaporAirOut(sid); // Special case when the surface is an internal mass if (state.dataSurface->Surface(sid).ExtBoundCond == sid) { - cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).temp = spaceMAT; + extConCell.temp = spaceMAT; RhoOut = state.dataMstBal->RhoVaporAirIn(sid); } RhoIn = state.dataMstBal->RhoVaporAirIn(sid); - cells(state.dataHeatBalHAMTMgr->ExtRadcell(sid)).htc = state.dataMstBal->HAirFD(sid); - cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).htc = state.dataMstBal->HConvExtFD(sid); - cells(state.dataHeatBalHAMTMgr->ExtSkycell(sid)).htc = state.dataMstBal->HSkyFD(sid); - cells(state.dataHeatBalHAMTMgr->ExtGrncell(sid)).htc = state.dataMstBal->HGrndFD(sid); + extRadCell.htc = state.dataMstBal->HAirFD(sid); + extConCell.htc = state.dataMstBal->HConvExtFD(sid); + extSkyCell.htc = state.dataMstBal->HSkyFD(sid); + extGrnCell.htc = state.dataMstBal->HGrndFD(sid); - cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).temp = spaceMAT; + auto &intCell = s_hbh->cells(s_hbh->Intcell(sid)); + auto &intConCell = s_hbh->cells(s_hbh->IntConcell(sid)); - cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).htc = state.dataMstBal->HConvInFD(sid); + intConCell.temp = spaceMAT; + intConCell.htc = state.dataMstBal->HConvInFD(sid); - cells(Intcell(sid)).Qadds = state.dataSurface->Surface(sid).Area * - (state.dataHeatBalSurf->SurfOpaqQRadSWInAbs(sid) + state.dataHeatBalSurf->SurfQdotRadNetLWInPerArea(sid) + - state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(sid) + state.dataHeatBal->SurfQdotRadIntGainsInPerArea(sid) + - state.dataHeatBalSurf->SurfQAdditionalHeatSourceInside(sid)); + intCell.Qadds = state.dataSurface->Surface(sid).Area * + (state.dataHeatBalSurf->SurfOpaqQRadSWInAbs(sid) + state.dataHeatBalSurf->SurfQdotRadNetLWInPerArea(sid) + + state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(sid) + state.dataHeatBal->SurfQdotRadIntGainsInPerArea(sid) + + state.dataHeatBalSurf->SurfQAdditionalHeatSourceInside(sid)); - cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).rh = - PsyRhFnTdbRhov(state, cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).temp, RhoOut, HAMTExt); - cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).rh = - PsyRhFnTdbRhov(state, cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).temp, RhoIn, HAMTInt); + extConCell.rh = PsyRhFnTdbRhov(state, extConCell.temp, RhoOut, HAMTExt); + intConCell.rh = PsyRhFnTdbRhov(state, intConCell.temp, RhoIn, HAMTInt); - if (cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).rh > rhmax) { - cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).rh = rhmax; + if (extConCell.rh > rhmax) { + extConCell.rh = rhmax; } - if (cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).rh > rhmax) { - cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).rh = rhmax; + if (intConCell.rh > rhmax) { + intConCell.rh = rhmax; } // PDB August 2009 Start! Correction for when no vapour transfer coefficient have been defined. - if (state.dataHeatBalHAMTMgr->extvtcflag(sid)) { - cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).vtc = state.dataHeatBalHAMTMgr->extvtc(sid); + if (s_hbh->extvtcflag(sid)) { + extConCell.vtc = s_hbh->extvtc(sid); } else { - if (cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).rh > 0) { - cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).vtc = - state.dataMstBal->HMassConvExtFD(sid) * RhoOut / - (PsyPsatFnTemp(state, state.dataMstBal->TempOutsideAirFD(sid)) * cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).rh); + if (extConCell.rh > 0) { + extConCell.vtc = + state.dataMstBal->HMassConvExtFD(sid) * RhoOut / (PsyPsatFnTemp(state, state.dataMstBal->TempOutsideAirFD(sid)) * extConCell.rh); } else { - cells(state.dataHeatBalHAMTMgr->ExtConcell(sid)).vtc = 10000.0; + extConCell.vtc = 10000.0; } } - if (state.dataHeatBalHAMTMgr->intvtcflag(sid)) { - cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).vtc = state.dataHeatBalHAMTMgr->intvtc(sid); - state.dataMstBal->HMassConvInFD(sid) = cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).vtc * PsyPsatFnTemp(state, spaceMAT) * - cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).rh / RhoIn; + if (s_hbh->intvtcflag(sid)) { + intConCell.vtc = s_hbh->intvtc(sid); + state.dataMstBal->HMassConvInFD(sid) = intConCell.vtc * PsyPsatFnTemp(state, spaceMAT) * intConCell.rh / RhoIn; } else { - if (cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).rh > 0) { - cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).vtc = - state.dataMstBal->HMassConvInFD(sid) * RhoIn / - (PsyPsatFnTemp(state, spaceMAT) * cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).rh); + if (intConCell.rh > 0) { + intConCell.vtc = state.dataMstBal->HMassConvInFD(sid) * RhoIn / (PsyPsatFnTemp(state, spaceMAT) * intConCell.rh); } else { - cells(state.dataHeatBalHAMTMgr->IntConcell(sid)).vtc = 10000.0; + intConCell.vtc = 10000.0; } } // PDB August 2009 End // Initialise - for (cid = state.dataHeatBalHAMTMgr->firstcell(sid); cid <= Extcell(sid) - 1; ++cid) { - cells(cid).tempp1 = cells(cid).temp; - cells(cid).tempp2 = cells(cid).temp; - cells(cid).rhp1 = cells(cid).rh; - cells(cid).rhp2 = cells(cid).rh; + for (int cid = s_hbh->firstcell(sid); cid <= s_hbh->Extcell(sid) - 1; ++cid) { + auto &cell = s_hbh->cells(cid); + cell.tempp1 = cell.temp; + cell.tempp2 = cell.temp; + cell.rhp1 = cell.rh; + cell.rhp2 = cell.rh; } - for (cid = Intcell(sid) + 1; cid <= state.dataHeatBalHAMTMgr->lastcell(sid); ++cid) { - cells(cid).tempp1 = cells(cid).temp; - cells(cid).tempp2 = cells(cid).temp; - cells(cid).rhp1 = cells(cid).rh; - cells(cid).rhp2 = cells(cid).rh; + for (int cid = s_hbh->Intcell(sid) + 1; cid <= s_hbh->lastcell(sid); ++cid) { + auto &cell = s_hbh->cells(cid); + cell.tempp1 = cell.temp; + cell.tempp2 = cell.temp; + cell.rhp1 = cell.rh; + cell.rhp2 = cell.rh; } itter = 0; @@ -1240,108 +1240,106 @@ namespace HeatBalanceHAMTManager { ++itter; // Update Moisture values - for (cid = state.dataHeatBalHAMTMgr->firstcell(sid); cid <= state.dataHeatBalHAMTMgr->lastcell(sid); ++cid) { - matid = cells(cid).matid; - cells(cid).vp = RHtoVP(state, cells(cid).rh, cells(cid).temp); - cells(cid).vpp1 = RHtoVP(state, cells(cid).rhp1, cells(cid).tempp1); - cells(cid).vpsat = PsyPsatFnTemp(state, cells(cid).tempp1); - if (matid > 0) { - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(matid)); - assert(thisMaterial != nullptr); - interp(thisMaterial->niso, thisMaterial->isorh, thisMaterial->isodata, cells(cid).rhp1, cells(cid).water, cells(cid).dwdphi); - if (state.dataEnvrn->IsRain && state.dataHeatBalHAMTMgr->rainswitch) { - interp(thisMaterial->nsuc, thisMaterial->sucwater, thisMaterial->sucdata, cells(cid).water, cells(cid).dw); + for (int cid = s_hbh->firstcell(sid); cid <= s_hbh->lastcell(sid); ++cid) { + auto &cell = s_hbh->cells(cid); + cell.vp = RHtoVP(state, cell.rh, cell.temp); + cell.vpp1 = RHtoVP(state, cell.rhp1, cell.tempp1); + cell.vpsat = PsyPsatFnTemp(state, cell.tempp1); + if (cell.matid > 0) { + auto const *mat = dynamic_cast(s_mat->materials(cell.matid)); + assert(mat != nullptr); + interp(mat->niso, mat->isorh, mat->isodata, cell.rhp1, cell.water, cell.dwdphi); + if (state.dataEnvrn->IsRain && s_hbh->rainswitch) { + interp(mat->nsuc, mat->sucwater, mat->sucdata, cell.water, cell.dw); } else { - interp(thisMaterial->nred, thisMaterial->redwater, thisMaterial->reddata, cells(cid).water, cells(cid).dw); + interp(mat->nred, mat->redwater, mat->reddata, cell.water, cell.dw); } - interp(thisMaterial->nmu, thisMaterial->murh, thisMaterial->mudata, cells(cid).rhp1, cells(cid).mu); - interp(thisMaterial->ntc, thisMaterial->tcwater, thisMaterial->tcdata, cells(cid).water, cells(cid).wthermalc); + interp(mat->nmu, mat->murh, mat->mudata, cell.rhp1, cell.mu); + interp(mat->ntc, mat->tcwater, mat->tcdata, cell.water, cell.wthermalc); } } // Calculate Heat and Vapor resistances, - for (cid = Extcell(sid); cid <= Intcell(sid); ++cid) { + for (int cid = s_hbh->Extcell(sid); cid <= s_hbh->Intcell(sid); ++cid) { torsum = 0.0; oorsum = 0.0; vpdiff = 0.0; - for (ii = 1; ii <= adjmax; ++ii) { - adj = cells(cid).adjs(ii); - adjl = cells(cid).adjsl(ii); + auto &cell = s_hbh->cells(cid); + for (int ii = 1; ii <= adjmax; ++ii) { + int adj = cell.adjs(ii); + int adjl = cell.adjsl(ii); if (adj == -1) break; - if (cells(cid).htc > 0) { - thermr1 = 1.0 / (cells(cid).overlap(ii) * cells(cid).htc); - } else if (cells(cid).matid > 0) { - thermr1 = cells(cid).dist(ii) / (cells(cid).overlap(ii) * cells(cid).wthermalc); + if (cell.htc > 0) { + thermr1 = 1.0 / (cell.overlap(ii) * cell.htc); + } else if (cell.matid > 0) { + thermr1 = cell.dist(ii) / (cell.overlap(ii) * cell.wthermalc); } else { thermr1 = 0.0; } - if (cells(cid).vtc > 0) { - vaporr1 = 1.0 / (cells(cid).overlap(ii) * cells(cid).vtc); - } else if (cells(cid).matid > 0) { - vaporr1 = - (cells(cid).dist(ii) * cells(cid).mu) / (cells(cid).overlap(ii) * WVDC(cells(cid).tempp1, state.dataEnvrn->OutBaroPress)); + if (cell.vtc > 0) { + vaporr1 = 1.0 / (cell.overlap(ii) * cell.vtc); + } else if (cell.matid > 0) { + vaporr1 = (cell.dist(ii) * cell.mu) / (cell.overlap(ii) * WVDC(cell.tempp1, state.dataEnvrn->OutBaroPress)); } else { vaporr1 = 0.0; } - if (cells(adj).htc > 0) { - thermr2 = 1.0 / (cells(cid).overlap(ii) * cells(adj).htc); - } else if (cells(adj).matid > 0) { - thermr2 = cells(adj).dist(adjl) / (cells(cid).overlap(ii) * cells(adj).wthermalc); + auto &adjCell = s_hbh->cells(adj); + if (adjCell.htc > 0) { + thermr2 = 1.0 / (cell.overlap(ii) * adjCell.htc); + } else if (adjCell.matid > 0) { + thermr2 = adjCell.dist(adjl) / (cell.overlap(ii) * adjCell.wthermalc); } else { thermr2 = 0.0; } - if (cells(adj).vtc > 0) { - vaporr2 = 1.0 / (cells(cid).overlap(ii) * cells(adj).vtc); - } else if (cells(adj).matid > 0) { - vaporr2 = - cells(adj).mu * cells(adj).dist(adjl) / (WVDC(cells(adj).tempp1, state.dataEnvrn->OutBaroPress) * cells(cid).overlap(ii)); + if (adjCell.vtc > 0) { + vaporr2 = 1.0 / (cell.overlap(ii) * adjCell.vtc); + } else if (adjCell.matid > 0) { + vaporr2 = adjCell.mu * adjCell.dist(adjl) / (WVDC(adjCell.tempp1, state.dataEnvrn->OutBaroPress) * cell.overlap(ii)); } else { vaporr2 = 0.0; } if (thermr1 + thermr2 > 0) { oorsum += 1.0 / (thermr1 + thermr2); - torsum += cells(adj).tempp1 / (thermr1 + thermr2); + torsum += adjCell.tempp1 / (thermr1 + thermr2); } if (vaporr1 + vaporr2 > 0) { - vpdiff += (cells(adj).vp - cells(cid).vp) / (vaporr1 + vaporr2); + vpdiff += (adjCell.vp - cell.vp) / (vaporr1 + vaporr2); } } // Calculate Heat Capacitance - tcap = ((cells(cid).density * cells(cid).spech + cells(cid).water * wspech) * cells(cid).volume); + tcap = ((cell.density * cell.spech + cell.water * wspech) * cell.volume); // calculate the latent heat if wanted and check for divergence qvp = 0.0; - if ((cells(cid).matid > 0) && (state.dataHeatBalHAMTMgr->latswitch)) { + if ((cell.matid > 0) && (s_hbh->latswitch)) { qvp = vpdiff * whv; } if (std::abs(qvp) > qvplim) { if (!state.dataGlobal->WarmupFlag) { - ++state.dataHeatBalHAMTMgr->qvpErrCount; - if (state.dataHeatBalHAMTMgr->qvpErrCount < 16) { + ++s_hbh->qvpErrCount; + if (s_hbh->qvpErrCount < 16) { ShowWarningError( state, format("HeatAndMoistureTransfer: Large Latent Heat for Surface {}", state.dataSurface->Surface(sid).Name)); } else { - ShowRecurringWarningErrorAtEnd( - state, "HeatAndMoistureTransfer: Large Latent Heat Errors ", state.dataHeatBalHAMTMgr->qvpErrReport); + ShowRecurringWarningErrorAtEnd(state, "HeatAndMoistureTransfer: Large Latent Heat Errors ", s_hbh->qvpErrReport); } } qvp = 0.0; } // Calculate the temperature for the next time step - cells(cid).tempp1 = (torsum + qvp + cells(cid).Qadds + (tcap * cells(cid).temp / state.dataHeatBalHAMTMgr->deltat)) / - (oorsum + (tcap / state.dataHeatBalHAMTMgr->deltat)); + cell.tempp1 = (torsum + qvp + cell.Qadds + (tcap * cell.temp / s_hbh->deltat)) / (oorsum + (tcap / s_hbh->deltat)); } // Check for silly temperatures - tempmax = maxval(cells, &subcell::tempp1); - tempmin = minval(cells, &subcell::tempp1); + tempmax = maxval(s_hbh->cells, &subcell::tempp1); + tempmin = minval(s_hbh->cells, &subcell::tempp1); if (tempmax > state.dataHeatBalSurf->MaxSurfaceTempLimit) { if (!state.dataGlobal->WarmupFlag) { if (state.dataSurface->SurfHighTempErrCount(sid) == 0) { @@ -1402,46 +1400,46 @@ namespace HeatBalanceHAMTManager { } // Calculate the liquid and vapor resisitances - for (cid = Extcell(sid); cid <= Intcell(sid); ++cid) { + for (int cid = s_hbh->Extcell(sid); cid <= s_hbh->Intcell(sid); ++cid) { phioosum = 0.0; phiorsum = 0.0; vpoosum = 0.0; vporsum = 0.0; - for (ii = 1; ii <= adjmax; ++ii) { - adj = cells(cid).adjs(ii); - adjl = cells(cid).adjsl(ii); + auto &cell = s_hbh->cells(cid); + for (int ii = 1; ii <= adjmax; ++ii) { + int adj = cell.adjs(ii); + int adjl = cell.adjsl(ii); if (adj == -1) break; - if (cells(cid).vtc > 0) { - vaporr1 = 1.0 / (cells(cid).overlap(ii) * cells(cid).vtc); - } else if (cells(cid).matid > 0) { - vaporr1 = - (cells(cid).dist(ii) * cells(cid).mu) / (cells(cid).overlap(ii) * WVDC(cells(cid).tempp1, state.dataEnvrn->OutBaroPress)); + if (cell.vtc > 0) { + vaporr1 = 1.0 / (cell.overlap(ii) * cell.vtc); + } else if (cell.matid > 0) { + vaporr1 = (cell.dist(ii) * cell.mu) / (cell.overlap(ii) * WVDC(cell.tempp1, state.dataEnvrn->OutBaroPress)); } else { vaporr1 = 0.0; } - if (cells(adj).vtc > 0) { - vaporr2 = 1.0 / (cells(cid).overlap(ii) * cells(adj).vtc); - } else if (cells(adj).matid > 0) { - vaporr2 = (cells(adj).dist(adjl) * cells(adj).mu) / - (cells(cid).overlap(ii) * WVDC(cells(adj).tempp1, state.dataEnvrn->OutBaroPress)); + auto &adjCell = s_hbh->cells(adj); + if (adjCell.vtc > 0) { + vaporr2 = 1.0 / (cell.overlap(ii) * adjCell.vtc); + } else if (adjCell.matid > 0) { + vaporr2 = (adjCell.dist(adjl) * adjCell.mu) / (cell.overlap(ii) * WVDC(adjCell.tempp1, state.dataEnvrn->OutBaroPress)); } else { vaporr2 = 0.0; } if (vaporr1 + vaporr2 > 0) { vpoosum += 1.0 / (vaporr1 + vaporr2); - vporsum += (cells(adj).vpp1 / (vaporr1 + vaporr2)); + vporsum += (adjCell.vpp1 / (vaporr1 + vaporr2)); } - if ((cells(cid).dw > 0) && (cells(cid).dwdphi > 0)) { - rhr1 = cells(cid).dist(ii) / (cells(cid).overlap(ii) * cells(cid).dw * cells(cid).dwdphi); + if ((cell.dw > 0) && (cell.dwdphi > 0)) { + rhr1 = cell.dist(ii) / (cell.overlap(ii) * cell.dw * cell.dwdphi); } else { rhr1 = 0.0; } - if ((cells(adj).dw > 0) && (cells(adj).dwdphi > 0)) { - rhr2 = cells(adj).dist(adjl) / (cells(cid).overlap(ii) * cells(adj).dw * cells(adj).dwdphi); + if ((adjCell.dw > 0) && (adjCell.dwdphi > 0)) { + rhr2 = adjCell.dist(adjl) / (cell.overlap(ii) * adjCell.dw * adjCell.dwdphi); } else { rhr2 = 0.0; } @@ -1449,37 +1447,38 @@ namespace HeatBalanceHAMTManager { // IF(rhr1+rhr2>0)THEN if (rhr1 * rhr2 > 0) { phioosum += 1.0 / (rhr1 + rhr2); - phiorsum += (cells(adj).rhp1 / (rhr1 + rhr2)); + phiorsum += (adjCell.rhp1 / (rhr1 + rhr2)); } } // Moisture Capacitance - if (cells(cid).dwdphi > 0.0) { - wcap = cells(cid).dwdphi * cells(cid).volume; + if (cell.dwdphi > 0.0) { + wcap = cell.dwdphi * cell.volume; } else { wcap = 0.0; } // Calculate the RH for the next time step - denominator = (phioosum + vpoosum * cells(cid).vpsat + wcap / state.dataHeatBalHAMTMgr->deltat); + denominator = (phioosum + vpoosum * cell.vpsat + wcap / s_hbh->deltat); if (denominator != 0.0) { - cells(cid).rhp1 = (phiorsum + vporsum + (wcap * cells(cid).rh) / state.dataHeatBalHAMTMgr->deltat) / denominator; + cell.rhp1 = (phiorsum + vporsum + (wcap * cell.rh) / s_hbh->deltat) / denominator; } else { ShowSevereError(state, "CalcHeatBalHAMT: demoninator in calculating RH is zero. Check material properties for accuracy."); - ShowContinueError(state, format("...Problem occurs in Material=\"{}\".", state.dataMaterial->Material(cells(cid).matid)->Name)); + ShowContinueError(state, format("...Problem occurs in Material=\"{}\".", s_mat->materials(cell.matid)->Name)); ShowFatalError(state, "Program terminates due to preceding condition."); } - if (cells(cid).rhp1 > rhmax) { - cells(cid).rhp1 = rhmax; + if (cell.rhp1 > rhmax) { + cell.rhp1 = rhmax; } } // Check for convergence or too many itterations sumtp1 = 0.0; - for (cid = Extcell(sid); cid <= Intcell(sid); ++cid) { - if (sumtp1 < std::abs(cells(cid).tempp2 - cells(cid).tempp1)) { - sumtp1 = std::abs(cells(cid).tempp2 - cells(cid).tempp1); + for (int cid = s_hbh->Extcell(sid); cid <= s_hbh->Intcell(sid); ++cid) { + auto const &cell = s_hbh->cells(cid); + if (sumtp1 < std::abs(cell.tempp2 - cell.tempp1)) { + sumtp1 = std::abs(cell.tempp2 - cell.tempp1); } } if (sumtp1 < convt) { @@ -1488,17 +1487,18 @@ namespace HeatBalanceHAMTManager { if (itter > ittermax) { break; } - for (cid = state.dataHeatBalHAMTMgr->firstcell(sid); cid <= state.dataHeatBalHAMTMgr->lastcell(sid); ++cid) { - cells(cid).tempp2 = cells(cid).tempp1; - cells(cid).rhp2 = cells(cid).rhp1; + for (int cid = s_hbh->firstcell(sid); cid <= s_hbh->lastcell(sid); ++cid) { + auto &cell = s_hbh->cells(cid); + cell.tempp2 = cell.tempp1; + cell.rhp2 = cell.rhp1; } } // report back to CalcHeatBalanceInsideSurf - TempSurfOutTmp = cells(Extcell(sid)).tempp1; - SurfTempInTmp = cells(Intcell(sid)).tempp1; + TempSurfOutTmp = extCell.tempp1; + SurfTempInTmp = intCell.tempp1; - SurfTempInP = cells(Intcell(sid)).rhp1 * PsyPsatFnTemp(state, cells(Intcell(sid)).tempp1); + SurfTempInP = intCell.rhp1 * PsyPsatFnTemp(state, intCell.tempp1); state.dataMstBal->RhoVaporSurfIn(sid) = SurfTempInP / (461.52 * (spaceMAT + Constant::Kelvin)); } @@ -1517,38 +1517,37 @@ namespace HeatBalanceHAMTManager { // Fill all the report variables // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int cid; Real64 watermass; Real64 matmass; // unused1208 REAL(r64), SAVE :: InOld=0.0D0 // unused1208 REAL(r64), SAVE :: OutOld=0.0D0 + auto &s_hbh = state.dataHeatBalHAMTMgr; + // Update Temperatures and RHs. Calculate report variables matmass = 0.0; watermass = 0.0; - for (cid = state.dataHeatBalHAMTMgr->firstcell(sid); cid <= state.dataHeatBalHAMTMgr->lastcell(sid); ++cid) { + for (int cid = s_hbh->firstcell(sid); cid <= s_hbh->lastcell(sid); ++cid) { + auto &cell = s_hbh->cells(cid); // fix HAMT values for this surface - state.dataHeatBalHAMTMgr->cells(cid).temp = state.dataHeatBalHAMTMgr->cells(cid).tempp1; - state.dataHeatBalHAMTMgr->cells(cid).rh = state.dataHeatBalHAMTMgr->cells(cid).rhp1; - state.dataHeatBalHAMTMgr->cells(cid).rhp = state.dataHeatBalHAMTMgr->cells(cid).rh * 100.0; - if (state.dataHeatBalHAMTMgr->cells(cid).density > 0.0) { - state.dataHeatBalHAMTMgr->cells(cid).wreport = - state.dataHeatBalHAMTMgr->cells(cid).water / state.dataHeatBalHAMTMgr->cells(cid).density; - watermass += (state.dataHeatBalHAMTMgr->cells(cid).water * state.dataHeatBalHAMTMgr->cells(cid).volume); - matmass += (state.dataHeatBalHAMTMgr->cells(cid).density * state.dataHeatBalHAMTMgr->cells(cid).volume); + cell.temp = cell.tempp1; + cell.rh = cell.rhp1; + cell.rhp = cell.rh * 100.0; + if (cell.density > 0.0) { + cell.wreport = cell.water / cell.density; + watermass += (cell.water * cell.volume); + matmass += (cell.density * cell.volume); } } - state.dataHeatBalHAMTMgr->watertot(sid) = 0.0; - if (matmass > 0) state.dataHeatBalHAMTMgr->watertot(sid) = watermass / matmass; + s_hbh->watertot(sid) = 0.0; + if (matmass > 0) s_hbh->watertot(sid) = watermass / matmass; - state.dataHeatBalHAMTMgr->surfrh(sid) = 100.0 * state.dataHeatBalHAMTMgr->cells(state.dataHeatBalHAMTMgr->Intcell(sid)).rh; - state.dataHeatBalHAMTMgr->surfextrh(sid) = 100.0 * state.dataHeatBalHAMTMgr->cells(state.dataHeatBalHAMTMgr->Extcell(sid)).rh; - state.dataHeatBalHAMTMgr->surftemp(sid) = state.dataHeatBalHAMTMgr->cells(state.dataHeatBalHAMTMgr->Intcell(sid)).temp; - state.dataHeatBalHAMTMgr->surfexttemp(sid) = state.dataHeatBalHAMTMgr->cells(state.dataHeatBalHAMTMgr->Extcell(sid)).temp; - state.dataHeatBalHAMTMgr->surfvp(sid) = RHtoVP(state, - state.dataHeatBalHAMTMgr->cells(state.dataHeatBalHAMTMgr->Intcell(sid)).rh, - state.dataHeatBalHAMTMgr->cells(state.dataHeatBalHAMTMgr->Intcell(sid)).temp); + s_hbh->surfrh(sid) = 100.0 * s_hbh->cells(s_hbh->Intcell(sid)).rh; + s_hbh->surfextrh(sid) = 100.0 * s_hbh->cells(s_hbh->Extcell(sid)).rh; + s_hbh->surftemp(sid) = s_hbh->cells(s_hbh->Intcell(sid)).temp; + s_hbh->surfexttemp(sid) = s_hbh->cells(s_hbh->Extcell(sid)).temp; + s_hbh->surfvp(sid) = RHtoVP(state, s_hbh->cells(s_hbh->Intcell(sid)).rh, s_hbh->cells(s_hbh->Intcell(sid)).temp); } void interp(int const ndata, @@ -1581,7 +1580,6 @@ namespace HeatBalanceHAMTManager { Real64 yylow; Real64 yyhigh; Real64 mygrad; - int step; mygrad = 0.0; outvalue = 0.0; @@ -1589,7 +1587,7 @@ namespace HeatBalanceHAMTManager { if (ndata > 1) { xxlow = xx(1); yylow = yy(1); - for (step = 2; step <= ndata; ++step) { + for (int step = 2; step <= ndata; ++step) { xxhigh = xx(step); yyhigh = yy(step); if (invalue <= xxhigh) break; diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.hh b/src/EnergyPlus/HeatBalanceHAMTManager.hh index 1d240688ced..5fc7516378b 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.hh +++ b/src/EnergyPlus/HeatBalanceHAMTManager.hh @@ -54,6 +54,7 @@ // EnergyPlus Headers #include #include +#include namespace EnergyPlus { @@ -64,6 +65,38 @@ namespace HeatBalanceHAMTManager { // Data // MODULE PARAMETER DEFINITIONS: + struct MaterialHAMT : public Material::MaterialBase + { + // HAMT + int niso = -1; // Number of data points + Array1D isodata = Array1D(27, 0.0); // isotherm values + Array1D isorh = Array1D(27, 0.0); // isotherm RH values + int nsuc = -1; // Number of data points + Array1D sucdata = Array1D(27, 0.0); // suction values + Array1D sucwater = Array1D(27, 0.0); // suction water values + int nred = -1; // Number of data points + Array1D reddata = Array1D(27, 0.0); // redistribution values + Array1D redwater = Array1D(27, 0.0); // redistribution water values + int nmu = -1; // Number of data points + Array1D mudata = Array1D(27, 0.0); // mu values + Array1D murh = Array1D(27, 0.0); // mu rh values + int ntc = -1; // Number of data points + Array1D tcdata = Array1D(27, 0.0); // thermal conductivity values + Array1D tcwater = Array1D(27, 0.0); // thermal conductivity water values + Real64 itemp = 10.0; // initial Temperature + Real64 irh = 0.5; // Initial RH + Real64 iwater = 0.2; // Initial water content kg/kg + int divs = 3; // Number of divisions + Real64 divsize = 0.005; // Average Cell Size + int divmin = 3; // Minimum number of cells + int divmax = 10; // Maximum number of cells + + MaterialHAMT() : Material::MaterialBase() + { + group = Material::Group::Regular; + } + ~MaterialHAMT() = default; + }; constexpr int ittermax(150); // Maximum Number of itterations constexpr int adjmax(6); // Maximum Number of Adjacent Cells diff --git a/src/EnergyPlus/HeatBalanceIntRadExchange.cc b/src/EnergyPlus/HeatBalanceIntRadExchange.cc index 4302656ac7e..a62ea45dfc0 100644 --- a/src/EnergyPlus/HeatBalanceIntRadExchange.cc +++ b/src/EnergyPlus/HeatBalanceIntRadExchange.cc @@ -279,8 +279,9 @@ namespace HeatBalanceIntRadExchange { SurfaceTempRad[ZoneSurfNum] = state.dataSurface->SurfWinEffInsSurfTemp(SurfNum); SurfaceEmiss[ZoneSurfNum] = WindowEquivalentLayer::EQLWindowInsideEffectiveEmiss(state, constrNum); } else if (construct.WindowTypeBSDF && state.dataSurface->SurfWinShadingFlag(SurfNum) == DataSurfaces::WinShadingType::IntShade) { + auto &surfShade = state.dataSurface->surfShades(SurfNum); SurfaceTempRad[ZoneSurfNum] = state.dataSurface->SurfWinEffInsSurfTemp(SurfNum); - SurfaceEmiss[ZoneSurfNum] = surfWindow.EffShBlindEmiss[1] + surfWindow.EffGlassEmiss[1]; + SurfaceEmiss[ZoneSurfNum] = surfShade.effShadeEmi + surfShade.effGlassEmi; } else if (construct.WindowTypeBSDF) { SurfaceTempRad[ZoneSurfNum] = state.dataSurface->SurfWinEffInsSurfTemp(SurfNum); SurfaceEmiss[ZoneSurfNum] = construct.InsideAbsorpThermal; @@ -427,10 +428,8 @@ namespace HeatBalanceIntRadExchange { if (state.dataHeatBalSurf->SurfMovInsulIntPresent(SurfNum) != state.dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(SurfNum)) { auto const &thissurf = state.dataSurface->Surface(SurfNum); - Real64 AbsorpDiff = - std::abs(state.dataConstruction->Construct(thissurf.Construction).InsideAbsorpThermal - - dynamic_cast(state.dataMaterial->Material(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))) - ->AbsorpThermal); + Real64 AbsorpDiff = std::abs(state.dataConstruction->Construct(thissurf.Construction).InsideAbsorpThermal - + state.dataMaterial->materials(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->AbsorpThermal); if (AbsorpDiff > 0.01) { MovableInsulationChange = true; } diff --git a/src/EnergyPlus/HeatBalanceKivaManager.cc b/src/EnergyPlus/HeatBalanceKivaManager.cc index 8fbaeb91d5e..a3c6b3425bd 100644 --- a/src/EnergyPlus/HeatBalanceKivaManager.cc +++ b/src/EnergyPlus/HeatBalanceKivaManager.cc @@ -669,7 +669,7 @@ bool KivaManager::setupKivaInstances(EnergyPlusData &state) auto &Surfaces = state.dataSurface->Surface; auto &Constructs = state.dataConstruction->Construct; - auto &Materials = state.dataMaterial->Material; + auto &materials = state.dataMaterial->materials; int inst = 0; int surfNum = 1; @@ -901,7 +901,7 @@ bool KivaManager::setupKivaInstances(EnergyPlusData &state) // Push back construction's layers for (int layer = 1; layer <= c.TotLayers; layer++) { - auto const *mat = Materials(c.LayerPoint(layer)); + auto const *mat = materials(c.LayerPoint(layer)); if (mat->ROnly) { ErrorsFound = true; ShowSevereError(state, format("Construction=\"{}\", constructions referenced by surfaces with a", c.Name)); @@ -925,7 +925,7 @@ bool KivaManager::setupKivaInstances(EnergyPlusData &state) // Set slab construction for (int i = 0; i < Constructs(surface.Construction).TotLayers; ++i) { - auto const *mat = Materials(Constructs(surface.Construction).LayerPoint[i]); + auto const *mat = materials(Constructs(surface.Construction).LayerPoint[i]); if (mat->ROnly) { ErrorsFound = true; ShowSevereError( diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index ae7cb43067d..a4c2d6ceed3 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -62,7 +62,6 @@ #include #include #include -#include #include #include #include @@ -262,10 +261,12 @@ namespace HeatBalanceManager { GetSiteAtmosphereData(state, ErrorsFound); - GetWindowGlassSpectralData(state, ErrorsFound); + Material::GetWindowGlassSpectralData(state, ErrorsFound); Material::GetMaterialData(state, ErrorsFound); // Read materials from input file/transfer from legacy data structure + Material::GetHysteresisData(state, ErrorsFound); + GetFrameAndDividerData(state); GetConstructData(state, ErrorsFound); // Read constructs from input file/transfer from legacy data structure @@ -510,7 +511,7 @@ namespace HeatBalanceManager { auto &HVACSystemRootFinding = state.dataRootFinder->HVACSystemRootFinding; // SUBROUTINE PARAMETER DEFINITIONS: - constexpr const char *RoutineName("GetProjectControlData: "); + static constexpr std::string_view RoutineName("GetProjectControlData: "); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Array1D_string AlphaName(4); @@ -1317,154 +1318,6 @@ namespace HeatBalanceManager { print(state.files.eio, Format_720, state.dataEnvrn->SiteWindExp, state.dataEnvrn->SiteWindBLHeight, state.dataEnvrn->SiteTempGradient); } - void GetWindowGlassSpectralData(EnergyPlusData &state, bool &ErrorsFound) // set to true if errors found in input - { - - // SUBROUTINE INFORMATION: - // AUTHOR Fred Winkelmann - // DATE WRITTEN May 2000 - - // PURPOSE OF THIS SUBROUTINE: - // Gets spectral data (transmittance, front reflectance, and back - // reflectance at normal incidence vs. wavelength) for glass - - // SUBROUTINE PARAMETER DEFINITIONS: - constexpr const char *RoutineName("GetWindowGlassSpectralData: "); - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int IOStat; // IO Status when calling get input subroutine - Array1D_string SpecDataNames(1); // Spectral data alpha names - int SpecDataNumAlpha; // Number of spectral data alpha names being passed - int SpecDataNumProp; // Number of spectral data properties being passed - Array1D SpecDataProps; // Temporary array to transfer spectal data properties - int Loop; - int LamNum; // Wavelength number - Real64 Lam; // Wavelength (microns) - Real64 Tau; // Transmittance, front reflectance, back reflectance - Real64 RhoF; - Real64 RhoB; - - state.dataHeatBalMgr->CurrentModuleObject = "MaterialProperty:GlazingSpectralData"; - state.dataHeatBal->TotSpectralData = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataHeatBalMgr->CurrentModuleObject); - state.dataHeatBal->SpectralData.allocate(state.dataHeatBal->TotSpectralData); - if (state.dataHeatBal->TotSpectralData > 0) SpecDataProps.allocate(Construction::MaxSpectralDataElements * 4); - - for (Loop = 1; Loop <= state.dataHeatBal->TotSpectralData; ++Loop) { - - // Call Input Get routine to retrieve spectral data - // Name is followed by up to 450 sets of normal-incidence measured values of - // [wavelength (microns), transmittance, front reflectance, back reflectance] for - // wavelengths covering the short-wave solar spectrum (from about 0.25 to 2.5 microns) - state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - SpecDataNames, - SpecDataNumAlpha, - SpecDataProps, - SpecDataNumProp, - IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - - // Load the spectral data derived type from the input data. - state.dataHeatBal->SpectralData(Loop).Name = SpecDataNames(1); - int TotLam = SpecDataNumProp / 4; - if (mod(SpecDataNumProp, 4) != 0) { - ShowWarningError(state, format("{}{}=\"{}\" invalid set.", RoutineName, state.dataHeatBalMgr->CurrentModuleObject, SpecDataNames(1))); - ShowContinueError( - state, - format("... set not even multiple of 4 items (Wavelength,Trans,ReflFront,ReflBack), number of items in dataset = {}", - SpecDataNumProp)); - ShowContinueError(state, format("... remainder after div by 4 = {}, remainder items will be set to 0.0", mod(SpecDataNumProp, 4))); - SpecDataProps({SpecDataNumProp + 1, min(SpecDataNumProp + 4, Construction::MaxSpectralDataElements * 4)}) = 0.0; - } - if (TotLam > Construction::MaxSpectralDataElements) { - ErrorsFound = true; - ShowSevereError(state, format("{}{}=\"{}\" invalid set.", RoutineName, state.dataHeatBalMgr->CurrentModuleObject, SpecDataNames(1))); - ShowContinueError( - state, - format("... More than max [{}] (Wavelength,Trans,ReflFront,ReflBack) entries in set.", Construction::MaxSpectralDataElements)); - continue; - } - state.dataHeatBal->SpectralData(Loop).NumOfWavelengths = TotLam; - - state.dataHeatBal->SpectralData(Loop).WaveLength.allocate(TotLam); // Wavelength (microns) - state.dataHeatBal->SpectralData(Loop).Trans.allocate(TotLam); // Transmittance at normal incidence - state.dataHeatBal->SpectralData(Loop).ReflFront.allocate(TotLam); // Front reflectance at normal incidence - state.dataHeatBal->SpectralData(Loop).ReflBack.allocate(TotLam); // Back reflectance at normal incidence - - for (LamNum = 1; LamNum <= TotLam; ++LamNum) { - state.dataHeatBal->SpectralData(Loop).WaveLength(LamNum) = SpecDataProps(4 * LamNum - 3); - state.dataHeatBal->SpectralData(Loop).Trans(LamNum) = SpecDataProps(4 * LamNum - 2); - // Following is needed since angular calculation in subr TransAndReflAtPhi - // fails for Trans = 0.0 - if (state.dataHeatBal->SpectralData(Loop).Trans(LamNum) < 0.001) state.dataHeatBal->SpectralData(Loop).Trans(LamNum) = 0.001; - state.dataHeatBal->SpectralData(Loop).ReflFront(LamNum) = SpecDataProps(4 * LamNum - 1); - state.dataHeatBal->SpectralData(Loop).ReflBack(LamNum) = SpecDataProps(4 * LamNum); - } - - // Check integrity of the spectral data - for (LamNum = 1; LamNum <= TotLam; ++LamNum) { - Lam = state.dataHeatBal->SpectralData(Loop).WaveLength(LamNum); - Tau = state.dataHeatBal->SpectralData(Loop).Trans(LamNum); - RhoF = state.dataHeatBal->SpectralData(Loop).ReflFront(LamNum); - RhoB = state.dataHeatBal->SpectralData(Loop).ReflBack(LamNum); - if (LamNum < TotLam) { - if (state.dataHeatBal->SpectralData(Loop).WaveLength(LamNum + 1) <= Lam) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}\" invalid set.", RoutineName, state.dataHeatBalMgr->CurrentModuleObject, SpecDataNames(1))); - ShowContinueError(state, - format("... Wavelengths not in increasing order. at wavelength#={}, value=[{:.4T}], next is [{:.4T}].", - LamNum, - Lam, - state.dataHeatBal->SpectralData(Loop).WaveLength(LamNum + 1))); - } - } - - if (Lam < 0.1 || Lam > 4.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}\" invalid value.", RoutineName, state.dataHeatBalMgr->CurrentModuleObject, SpecDataNames(1))); - ShowContinueError( - state, format("... A wavelength is not in the range 0.1 to 4.0 microns; at wavelength#={}, value=[{:.4T}].", LamNum, Lam)); - } - - // TH 2/15/2011. CR 8343 - // IGDB (International Glazing Database) does not meet the above strict restrictions. - // Relax rules to allow directly use of spectral data from IGDB - if (Tau > 1.01) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}\" invalid value.", RoutineName, state.dataHeatBalMgr->CurrentModuleObject, SpecDataNames(1))); - ShowContinueError(state, format("... A transmittance is > 1.0; at wavelength#={}, value=[{:.4T}].", LamNum, Tau)); - } - - if (RhoF < 0.0 || RhoF > 1.02 || RhoB < 0.0 || RhoB > 1.02) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}\" invalid value.", RoutineName, state.dataHeatBalMgr->CurrentModuleObject, SpecDataNames(1))); - ShowContinueError(state, format("... A reflectance is < 0.0 or > 1.0; at wavelength#={}, RhoF value=[{:.4T}].", LamNum, RhoF)); - ShowContinueError(state, format("... A reflectance is < 0.0 or > 1.0; at wavelength#={}, RhoB value=[{:.4T}].", LamNum, RhoB)); - } - - if ((Tau + RhoF) > 1.03 || (Tau + RhoB) > 1.03) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}\" invalid value.", RoutineName, state.dataHeatBalMgr->CurrentModuleObject, SpecDataNames(1))); - ShowContinueError(state, - format("... Transmittance + reflectance) > 1.0 for an entry; at wavelength#={}", - format("{}, value(Tau+RhoF)=[{:.4T}], value(Tau+RhoB)=[{:.4T}].", LamNum, (Tau + RhoF), (Tau + RhoB)))); - } - } - } - - if (state.dataHeatBal->TotSpectralData > 0) SpecDataProps.deallocate(); - } - void GetConstructData(EnergyPlusData &state, bool &ErrorsFound) // If errors found in input { @@ -1485,6 +1338,8 @@ namespace HeatBalanceManager { // Using/Aliasing using namespace DataStringGlobals; + static constexpr std::string_view routineName = "GetConstructData"; + // If UniqueConstructionNames size, then input has already been gotten if (state.dataHeatBalMgr->UniqueConstructNames.size()) return; @@ -1502,12 +1357,13 @@ namespace HeatBalanceManager { int TotWindow5Constructs; // Number of constructions from Window5 data file bool ConstructionFound; // True if input window construction name is found in the // Window5 data file - bool EOFonW5File; // True if EOF encountered reading Window5 data file - Material::Group MaterialLayerGroup; // window construction layer material group index + bool EOFonW5File; // True if EOF encountered reading Window5 data file - int iMatGlass; // number of glass layers Array1D_string WConstructNames; + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; + // Get the Total number of Constructions from the input TotRegConstructs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Construction"); int totAirBoundaryConstructs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Construction:AirBoundary"); @@ -1565,22 +1421,25 @@ namespace HeatBalanceManager { int ConstrNum = 0; - state.dataHeatBalMgr->CurrentModuleObject = "Construction"; + s_ipsc->cCurrentModuleObject = "Construction"; for (int Loop = 1; Loop <= TotRegConstructs; ++Loop) { // Loop through all constructs in the input... // Get the object names for each construction from the input processor state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, ConstructAlphas, ConstructNumAlpha, DummyProps, DummyNumProp, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, ConstructAlphas(1)}; + if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataHeatBalMgr->UniqueConstructNames, ConstructAlphas(0), @@ -1590,9 +1449,6 @@ namespace HeatBalanceManager { continue; } - // Glass layer counter - iMatGlass = 0; - ++ConstrNum; auto &thisConstruct = state.dataConstruction->Construct(ConstrNum); // Assign Construction name to the Derived Type using the zeroth position of the array @@ -1603,63 +1459,50 @@ namespace HeatBalanceManager { // Loop through all of the layers of the construct to match the material names. // The loop index is the number minus 1 - for (int Layer = 1; Layer <= ConstructNumAlpha - 1; ++Layer) { - // Find the material in the list of materials + for (int GlassLayer = 0, Layer = 1; Layer <= ConstructNumAlpha - 1; ++Layer) { - thisConstruct.LayerPoint(Layer) = Util::FindItemInPtrList(ConstructAlphas(Layer), state.dataMaterial->Material); - - // count number of glass layers - if (thisConstruct.LayerPoint(Layer) > 0) { - if (state.dataMaterial->Material(thisConstruct.LayerPoint(Layer))->group == Material::Group::WindowGlass) ++iMatGlass; - MaterialLayerGroup = state.dataMaterial->Material(thisConstruct.LayerPoint(Layer))->group; - if ((MaterialLayerGroup == Material::Group::GlassEquivalentLayer) || - (MaterialLayerGroup == Material::Group::ShadeEquivalentLayer) || - (MaterialLayerGroup == Material::Group::DrapeEquivalentLayer) || - (MaterialLayerGroup == Material::Group::BlindEquivalentLayer) || - (MaterialLayerGroup == Material::Group::ScreenEquivalentLayer) || - (MaterialLayerGroup == Material::Group::GapEquivalentLayer)) { - ShowSevereError( - state, - format("Invalid material layer type in window {} = {}", state.dataHeatBalMgr->CurrentModuleObject, thisConstruct.Name)); - ShowContinueError( - state, - format("Equivalent Layer material type = {} is allowed only in Construction:WindowEquivalentLayer window object.", - ConstructAlphas(Layer))); - ErrorsFound = true; - } - } + // Find the material in the list of materials + thisConstruct.LayerPoint(Layer) = Material::GetMaterialNum(state, ConstructAlphas(Layer)); if (thisConstruct.LayerPoint(Layer) == 0) { - // This may be a TC GlazingGroup - thisConstruct.LayerPoint(Layer) = Util::FindItemInList(ConstructAlphas(Layer), state.dataHeatBal->TCGlazings); - - if (thisConstruct.LayerPoint(Layer) > 0) { - // reset layer pointer to the first glazing in the TC GlazingGroup - thisConstruct.LayerPoint(Layer) = state.dataHeatBal->TCGlazings(thisConstruct.LayerPoint(Layer)).LayerPoint(1); - thisConstruct.TCLayer = thisConstruct.LayerPoint(Layer); - if (state.dataMaterial->Material(thisConstruct.LayerPoint(Layer))->group == Material::Group::WindowGlass) ++iMatGlass; - thisConstruct.TCFlag = 1; - thisConstruct.TCMasterConst = ConstrNum; - thisConstruct.TCGlassID = iMatGlass; // the TC glass layer ID - thisConstruct.TCLayerID = Layer; - thisConstruct.TypeIsWindow = true; - } + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(Layer), ConstructAlphas(Layer)); + ErrorsFound = true; + continue; } - if (thisConstruct.LayerPoint(Layer) == 0) { - ShowSevereError(state, - format("Did not find matching material for {} {}, missing material = {}", - state.dataHeatBalMgr->CurrentModuleObject, - thisConstruct.Name, - ConstructAlphas(Layer))); + auto const *mat = s_mat->materials(thisConstruct.LayerPoint(Layer)); + if (mat->group == Material::Group::Glass) { + ++GlassLayer; + } else if (mat->group == Material::Group::GlassEQL || mat->group == Material::Group::ShadeEQL || + mat->group == Material::Group::DrapeEQL || mat->group == Material::Group::BlindEQL || + mat->group == Material::Group::ScreenEQL || mat->group == Material::Group::WindowGapEQL) { + ShowSevereError(state, format("Invalid material layer type in window {} = {}", s_ipsc->cCurrentModuleObject, thisConstruct.Name)); + ShowContinueError( + state, + format("Equivalent Layer material type = {} is allowed only in Construction:WindowEquivalentLayer window object.", + ConstructAlphas(Layer))); ErrorsFound = true; - } else { - state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum) += state.dataHeatBal->NominalR(thisConstruct.LayerPoint(Layer)); - if (state.dataMaterial->Material(thisConstruct.LayerPoint(Layer))->group == Material::Group::Regular && - !state.dataMaterial->Material(thisConstruct.LayerPoint(Layer))->ROnly) { - state.dataHeatBal->NoRegularMaterialsUsed = false; - } + continue; + } else if (mat->group == Material::Group::GlassTCParent) { + ++GlassLayer; + // reset layer pointer to the first glazing in the TC GlazingGroup + auto const *matGlassTC = dynamic_cast(mat); + assert(matGlassTC != nullptr); + + thisConstruct.LayerPoint(Layer) = matGlassTC->matRefs(1).matNum; + thisConstruct.isTCWindow = true; + thisConstruct.isTCMaster = true; + thisConstruct.TCMasterConstrNum = ConstrNum; + thisConstruct.TCMasterMatNum = matGlassTC->Num; + thisConstruct.TCGlassNum = GlassLayer; // the TC glass layer ID + thisConstruct.TCLayerNum = Layer; + thisConstruct.TypeIsWindow = true; + } + + state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum) += mat->NominalR; + if (mat->group == Material::Group::Regular && !mat->ROnly) { + state.dataHeatBal->NoRegularMaterialsUsed = false; } } // ...end of the Layer DO loop @@ -1825,7 +1668,7 @@ namespace HeatBalanceManager { // Find the material in the list of materials state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer) = - Util::FindItemInPtrList(ConstructAlphas(Layer), state.dataMaterial->Material); + Material::GetMaterialNum(state, ConstructAlphas(Layer)); if (state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer) == 0) { ShowSevereError(state, @@ -1835,14 +1678,10 @@ namespace HeatBalanceManager { ConstructAlphas(Layer))); ErrorsFound = true; } else { - MaterialLayerGroup = - state.dataMaterial->Material(state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer))->group; - if (!((MaterialLayerGroup == Material::Group::GlassEquivalentLayer) || - (MaterialLayerGroup == Material::Group::ShadeEquivalentLayer) || - (MaterialLayerGroup == Material::Group::DrapeEquivalentLayer) || - (MaterialLayerGroup == Material::Group::BlindEquivalentLayer) || - (MaterialLayerGroup == Material::Group::ScreenEquivalentLayer) || - (MaterialLayerGroup == Material::Group::GapEquivalentLayer))) { + auto const *mat = s_mat->materials(state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer)); + if (!((mat->group == Material::Group::GlassEQL) || (mat->group == Material::Group::ShadeEQL) || + (mat->group == Material::Group::DrapeEQL) || (mat->group == Material::Group::BlindEQL) || + (mat->group == Material::Group::ScreenEQL) || (mat->group == Material::Group::WindowGapEQL))) { ShowSevereError(state, format("Invalid material layer type in window {} = {}", state.dataHeatBalMgr->CurrentModuleObject, @@ -1857,8 +1696,8 @@ namespace HeatBalanceManager { if (ConstructNumAlpha <= 2) { } else { - state.dataHeatBal->NominalRforNominalUCalculation(TotRegConstructs + ConstrNum) += - state.dataHeatBal->NominalR(state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer)); + auto const *mat = s_mat->materials(state.dataConstruction->Construct(TotRegConstructs + ConstrNum).LayerPoint(Layer)); + state.dataHeatBal->NominalRforNominalUCalculation(TotRegConstructs + ConstrNum) += mat->NominalR; } } @@ -2238,6 +2077,7 @@ namespace HeatBalanceManager { void GetIncidentSolarMultiplier(EnergyPlusData &state, bool &ErrorsFound) { + auto &s_mat = state.dataMaterial; auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "SurfaceProperty:IncidentSolarMultiplier"; @@ -2299,13 +2139,12 @@ namespace HeatBalanceManager { } int ConstrNum = Surf.Construction; auto const &Constr = state.dataConstruction->Construct(ConstrNum); - int MaterNum = Constr.LayerPoint(Constr.TotLayers); - auto const *Mat = state.dataMaterial->Material(MaterNum); + auto const *mat = s_mat->materials(Constr.LayerPoint(Constr.TotLayers)); bool withNoncompatibleShades = - (Mat->group == Material::Group::Shade || Mat->group == Material::Group::WindowBlind || Mat->group == Material::Group::Screen || - Mat->group == Material::Group::GlassEquivalentLayer || Mat->group == Material::Group::GapEquivalentLayer || - Mat->group == Material::Group::ShadeEquivalentLayer || Mat->group == Material::Group::DrapeEquivalentLayer || - Mat->group == Material::Group::ScreenEquivalentLayer || Mat->group == Material::Group::BlindEquivalentLayer || Surf.HasShadeControl); + (mat->group == Material::Group::Shade || mat->group == Material::Group::Blind || mat->group == Material::Group::Screen || + mat->group == Material::Group::GlassEQL || mat->group == Material::Group::WindowGapEQL || mat->group == Material::Group::ShadeEQL || + mat->group == Material::Group::DrapeEQL || mat->group == Material::Group::ScreenEQL || mat->group == Material::Group::BlindEQL || + Surf.HasShadeControl); if (withNoncompatibleShades) { ShowSevereError(state, "Non-compatible shades defined alongside SurfaceProperty:IncidentSolarMultiplier for the same window"); ErrorsFound = true; @@ -3771,7 +3610,6 @@ namespace HeatBalanceManager { Array2D_int NumGases(4, 2); // Number of gases in each gap of a glazing system Array2D_int MaterNumSysGlass(5, 2); // Material numbers for glazing system / glass combinations Array2D_int MaterNumSysGap(4, 2); // Material numbers for glazing system / gap combinations - int TotMaterialsPrev; // Number of materials before adding ones from W5DataFile int TotFrameDividerPrev; // Number of FrameAndDivider objects before adding ones from W5DataFile Array1D_int NGaps(2); // Number of gaps in window construction int NGlSys; // Number of glazing systems (normally 1, but 2 for mullioned window @@ -3781,11 +3619,8 @@ namespace HeatBalanceManager { int ConstrNum; // Construction number int IGlass; // Glass layer counter int IGap; // Gap counter - int IGas; // Gas counter // INTEGER :: ICoeff ! Gas property coefficient counter - int IGlSys; // Glazing system counter - int MaterNum; // Material number - int MatNum; + int IGlSys; // Glazing system counter int FrDivNum; // FrameDivider number Array1D WinHeight(2); // Height, width for glazing system (m) Array1D WinWidth(2); @@ -3830,6 +3665,7 @@ namespace HeatBalanceManager { Array1D DividerEmis(2); std::string::size_type endcol; + auto &s_mat = state.dataMaterial; // Object Data // In the following four gas-related data sets, the first @@ -4167,66 +4003,57 @@ namespace HeatBalanceManager { "of above errors", DesiredConstructionName)); - TotMaterialsPrev = state.dataMaterial->TotMaterials; for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { NGaps(IGlSys) = NGlass(IGlSys) - 1; - state.dataMaterial->TotMaterials += NGlass(IGlSys) + NGaps(IGlSys); } - // Create Material objects - - // reallocate Material type - - state.dataHeatBal->NominalR.redimension(state.dataMaterial->TotMaterials, 0.0); - // Glass objects NextLine = W5DataFile.readLine(); if (NextLine.eof) goto Label1000; ++FileLineCount; for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { - auto *thisMaterial = new Material::MaterialChild; - state.dataMaterial->Material.push_back(thisMaterial); - // Material is an EPVector so this matters whether - // we are accessing it Fortran-style or C-style - MaterNumSysGlass(IGlass, IGlSys) = state.dataMaterial->Material.size(); + auto *mat = new Material::MaterialGlass; + mat->group = Material::Group::Glass; + mat->Name = (NGlSys == 1) ? format("W5:{}:GLASS{}", DesiredConstructionName, NumName(IGlass)) + : format("W5:{}:{}:GLASS{}", DesiredConstructionName, NumName(IGlSys), NumName(IGlass)); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + MaterNumSysGlass(IGlass, IGlSys) = mat->Num; - thisMaterial->group = Material::Group::WindowGlass; NextLine = W5DataFile.readLine(); ++FileLineCount; readList(NextLine.data.substr(25), - thisMaterial->Thickness, - thisMaterial->Conductivity, - thisMaterial->Trans, - thisMaterial->ReflectSolBeamFront, - thisMaterial->ReflectSolBeamBack, - thisMaterial->TransVis, - thisMaterial->ReflectVisBeamFront, - thisMaterial->ReflectVisBeamBack, - thisMaterial->TransThermal, - thisMaterial->AbsorpThermalFront, - thisMaterial->AbsorpThermalBack, + mat->Thickness, + mat->Conductivity, + mat->Trans, + mat->ReflectSolBeamFront, + mat->ReflectSolBeamBack, + mat->TransVis, + mat->ReflectVisBeamFront, + mat->ReflectVisBeamBack, + mat->TransThermal, + mat->AbsorpThermalFront, + mat->AbsorpThermalBack, LayerName); - thisMaterial->Thickness *= 0.001; - if (thisMaterial->Thickness <= 0.0) { - } - if (NGlSys == 1) { - thisMaterial->Name = format("W5:{}:GLASS{}", DesiredConstructionName, NumName(IGlass)); - } else { - thisMaterial->Name = format("W5:{}:{}:GLASS{}", DesiredConstructionName, NumName(IGlSys), NumName(IGlass)); + mat->Thickness *= 0.001; + if (mat->Thickness <= 0.0) { } - thisMaterial->Roughness = Material::SurfaceRoughness::VerySmooth; - thisMaterial->AbsorpThermal = thisMaterial->AbsorpThermalBack; - if (thisMaterial->Thickness <= 0.0) { + mat->Roughness = Material::SurfaceRoughness::VerySmooth; + mat->AbsorpThermal = mat->AbsorpThermalBack; + if (mat->Thickness <= 0.0) { ShowSevereError(state, format("SearchWindow5DataFile: Material=\"{}\" has thickness of 0.0. Will be set to thickness = .001 but " "inaccuracies may result.", - thisMaterial->Name)); + mat->Name)); ShowContinueError(state, format("Line being read={}", NextLine.data)); ShowContinueError(state, format("Thickness field starts at column 26={}", NextLine.data.substr(25))); - thisMaterial->Thickness = 0.001; + mat->Thickness = 0.001; } } } @@ -4238,17 +4065,16 @@ namespace HeatBalanceManager { for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { for (IGap = 1; IGap <= NGaps(IGlSys); ++IGap) { auto *matGas = new Material::MaterialGasMix; - state.dataMaterial->Material.push_back(matGas); - // Material is an EP-vector - MaterNumSysGap(IGap, IGlSys) = state.dataMaterial->Material.size(); + matGas->Name = (NGlSys == 1) ? format("W5:{}:GAP{}", DesiredConstructionName, NumName(IGap)) + : format("W5:{}:{}:GAP{}", DesiredConstructionName, NumName(IGlSys), NumName(IGap)); + s_mat->materials.push_back(matGas); + matGas->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(matGas->Name, matGas->Num); + + MaterNumSysGap(IGap, IGlSys) = matGas->Num; NextLine = W5DataFile.readLine(); ++FileLineCount; readList(NextLine.data.substr(23), matGas->Thickness, NumGases(IGap, IGlSys)); - if (NGlSys == 1) { - matGas->Name = format("W5:{}:GAP{}", DesiredConstructionName, NumName(IGap)); - } else { - matGas->Name = format("W5:{}:{}:GAP{}", DesiredConstructionName, NumName(IGlSys), NumName(IGap)); - } matGas->Thickness *= 0.001; matGas->Roughness = Material::SurfaceRoughness::MediumRough; // Unused } @@ -4260,8 +4086,8 @@ namespace HeatBalanceManager { ++FileLineCount; for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { for (IGap = 1; IGap <= NGaps(IGlSys); ++IGap) { - int MatNum = MaterNumSysGap(IGap, IGlSys); - auto *matGas = dynamic_cast(state.dataMaterial->Material(MatNum)); + int matNum = MaterNumSysGap(IGap, IGlSys); + auto *matGas = dynamic_cast(s_mat->materials(matNum)); assert(matGas != nullptr); matGas->numGases = NumGases(IGap, IGlSys); for (int IGas = 0; IGas < matGas->numGases; ++IGas) { @@ -4284,7 +4110,7 @@ namespace HeatBalanceManager { } // Nominal resistance of gap at room temperature (based on first gas in mixture) auto const &gas0 = matGas->gases[0]; - state.dataHeatBal->NominalR(MatNum) = matGas->Thickness / (gas0.con.c0 + gas0.con.c1 * 300.0 + gas0.con.c2 * 90000.0); + matGas->NominalR = matGas->Thickness / (gas0.con.c0 + gas0.con.c1 * 300.0 + gas0.con.c2 * 90000.0); } } @@ -4391,20 +4217,16 @@ namespace HeatBalanceManager { } thisConstruct.OutsideRoughness = Material::SurfaceRoughness::VerySmooth; - thisConstruct.InsideAbsorpThermal = - dynamic_cast(state.dataMaterial->Material(TotMaterialsPrev + NGlass(IGlSys)))->AbsorpThermalBack; - thisConstruct.OutsideAbsorpThermal = - dynamic_cast(state.dataMaterial->Material(TotMaterialsPrev + 1))->AbsorpThermalFront; + thisConstruct.InsideAbsorpThermal = s_mat->materials(thisConstruct.LayerPoint(thisConstruct.TotLayers))->AbsorpThermalBack; + thisConstruct.OutsideAbsorpThermal = s_mat->materials(thisConstruct.LayerPoint(1))->AbsorpThermalFront; thisConstruct.TypeIsWindow = true; thisConstruct.FromWindow5DataFile = true; thisConstruct.W5FileGlazingSysHeight = WinHeight(IGlSys); thisConstruct.W5FileGlazingSysWidth = WinWidth(IGlSys); - if (Util::SameString(MullionOrientation, "Vertical")) { - thisConstruct.W5FileMullionOrientation = DataWindowEquivalentLayer::Orientation::Vertical; - } else if (Util::SameString(MullionOrientation, "Horizontal")) { - thisConstruct.W5FileMullionOrientation = DataWindowEquivalentLayer::Orientation::Horizontal; - } else { - } + + thisConstruct.W5FileMullionOrientation = static_cast( + getEnumValue(DataWindowEquivalentLayer::orientationNamesUC, MullionOrientation)); + thisConstruct.W5FileMullionWidth = MullionWidth; // Fill Construct with system transmission, reflection and absorption properties @@ -4538,12 +4360,12 @@ namespace HeatBalanceManager { // conductivity here ignores convective effects in gap.) state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum) = 0.0; for (loop = 1; loop <= NGlass(IGlSys) + NGaps(IGlSys); ++loop) { - MatNum = thisConstruct.LayerPoint(loop); - auto const *matBase = state.dataMaterial->Material(MatNum); + int matNum = thisConstruct.LayerPoint(loop); + auto const *matBase = s_mat->materials(matNum); assert(matBase != nullptr); - if (matBase->group == Material::Group::WindowGlass) { + if (matBase->group == Material::Group::Glass) { state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum) += matBase->Thickness / matBase->Conductivity; - } else if (matBase->group == Material::Group::WindowGas || matBase->group == Material::Group::WindowGasMixture) { + } else if (matBase->group == Material::Group::Gas || matBase->group == Material::Group::GasMixture) { auto const *matGas = dynamic_cast(matBase); assert(matGas != nullptr); @@ -4582,11 +4404,10 @@ namespace HeatBalanceManager { state.dataSurface->FrameDivider(FrDivNum).FrameVisAbsorp = FrameVisAbsorp; state.dataSurface->FrameDivider(FrDivNum).FrameEmis = FrameEmis; state.dataSurface->FrameDivider(FrDivNum).FrameEdgeWidth = 0.06355; // 2.5 in - if (Util::SameString(MullionOrientation, "Vertical")) { - state.dataSurface->FrameDivider(FrDivNum).MullionOrientation = DataWindowEquivalentLayer::Orientation::Vertical; - } else if (Util::SameString(MullionOrientation, "Horizontal")) { - state.dataSurface->FrameDivider(FrDivNum).MullionOrientation = DataWindowEquivalentLayer::Orientation::Horizontal; - } + + state.dataSurface->FrameDivider(FrDivNum).MullionOrientation = static_cast( + getEnumValue(DataWindowEquivalentLayer::orientationNamesUC, MullionOrientation)); + if (Util::SameString(DividerType(IGlSys), "DividedLite")) { state.dataSurface->FrameDivider(FrDivNum).DividerType = DataSurfaces::FrameDividerType::DividedLite; } else if (Util::SameString(DividerType(IGlSys), "Suspended")) { @@ -4714,13 +4535,13 @@ namespace HeatBalanceManager { Real64 Reff; // Effective thermal resistance, m2.K/W Real64 Rcon; // Concrete layer thermal resistance, m2.K/W Real64 Rfic; // Thermal resistance of the fictitious material, m2.K/W - int MaterNum; // Material index Real64 Rsoilequ; // Effective R-value of soil for underground walls int iFCConcreteLayer; // Layer pointer to the materials array + auto &s_mat = state.dataMaterial; // First get the concrete layer - iFCConcreteLayer = Util::FindItemInPtrList("~FC_Concrete", state.dataMaterial->Material); - Rcon = state.dataMaterial->Material(iFCConcreteLayer)->Resistance; + iFCConcreteLayer = Material::GetMaterialNum(state, "~FC_CONCRETE"); + Rcon = s_mat->materials(iFCConcreteLayer)->Resistance; // Count number of constructions defined with Ffactor or Cfactor method TotFfactorConstructs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Construction:FfactorGroundFloor"); @@ -4813,8 +4634,7 @@ namespace HeatBalanceManager { thisConstruct.LayerPoint(2) = iFCConcreteLayer; // The fictitious insulation is the outside layer - MaterNum = Util::FindItemInPtrList(format("~FC_Insulation_{}", Loop), state.dataMaterial->Material); - thisConstruct.LayerPoint(1) = MaterNum; + thisConstruct.LayerPoint(1) = Material::GetMaterialNum(state, format("~FC_INSULATION_{}", Loop)); // Calculate the thermal resistance of the fictitious insulation layer // effective thermal resistance excludes inside and outside air films @@ -4833,8 +4653,8 @@ namespace HeatBalanceManager { ErrorsFound = true; } - state.dataMaterial->Material(MaterNum)->Resistance = Rfic; - state.dataHeatBal->NominalR(MaterNum) = Rfic; + auto *mat = s_mat->materials(thisConstruct.LayerPoint(1)); + mat->Resistance = mat->NominalR = Rfic; // excluding thermal resistance of inside or outside air film // 1/Reff gets reported as the "U-Factor no Film" in the summary report Envelope Summary | Opaque Exterior @@ -4907,8 +4727,7 @@ namespace HeatBalanceManager { thisConstruct.LayerPoint(2) = iFCConcreteLayer; // The fictitious insulation is the outside layer - MaterNum = Util::FindItemInPtrList("~FC_Insulation_" + fmt::to_string(Loop + TotFfactorConstructs), state.dataMaterial->Material); - thisConstruct.LayerPoint(1) = MaterNum; + thisConstruct.LayerPoint(1) = Material::GetMaterialNum(state, format("~FC_INSULATION_{}", Loop + TotFfactorConstructs)); // CR 8886 Rsoil should be in SI unit. From ASHRAE 90.1-2010 SI if (Height <= 0.25) { @@ -4931,8 +4750,8 @@ namespace HeatBalanceManager { ErrorsFound = true; } - state.dataMaterial->Material(MaterNum)->Resistance = Rfic; - state.dataHeatBal->NominalR(MaterNum) = Rfic; + auto *mat = s_mat->materials(thisConstruct.LayerPoint(1)); + mat->Resistance = mat->NominalR = Rfic; // Reff includes the wall itself and soil, but excluding thermal resistance of inside or outside air film // 1/Reff gets reported as the "U-Factor no Film" in the summary report Envelope Summary | Opaque Exterior @@ -5351,20 +5170,17 @@ namespace HeatBalanceManager { // of the slave thermochromic constructions. // This subroutine only gets called once in the GetHeatBalanceInput subroutine // after materials, constructions and building geometry data are read. + auto &s_mat = state.dataMaterial; int NumNewConst = 0; for (int Loop = 1; Loop <= state.dataHeatBal->TotConstructs; ++Loop) { - if (state.dataConstruction->Construct(Loop).TCFlag == 1) { - auto const *thisMaterial = - dynamic_cast(state.dataMaterial->Material(state.dataConstruction->Construct(Loop).TCLayer)); - assert(thisMaterial != nullptr); - int iTCG = thisMaterial->TCParent; - if (iTCG == 0) continue; // hope this was caught already - int iMat = state.dataHeatBal->TCGlazings(iTCG).NumGlzMat; - for (int iTC = 1; iTC <= iMat; ++iTC) { - ++NumNewConst; - } - } + auto &constr = state.dataConstruction->Construct(Loop); + + if (!constr.isTCMaster) continue; + + auto const *matGlassTC = dynamic_cast(s_mat->materials(constr.TCMasterMatNum)); + assert(matGlassTC != nullptr); + NumNewConst += matGlassTC->numMatRefs; } if (NumNewConst == 0) return; // no need to go further @@ -5378,1045 +5194,214 @@ namespace HeatBalanceManager { NumNewConst = state.dataHeatBal->TotConstructs; for (int Loop = 1; Loop <= state.dataHeatBal->TotConstructs; ++Loop) { - if (state.dataConstruction->Construct(Loop).TCFlag == 1) { - auto const *thisMaterial = - dynamic_cast(state.dataMaterial->Material(state.dataConstruction->Construct(Loop).TCLayer)); - assert(thisMaterial != nullptr); - int iTCG = thisMaterial->TCParent; - if (iTCG == 0) continue; // hope this was caught already - int iMat = state.dataHeatBal->TCGlazings(iTCG).NumGlzMat; - for (int iTC = 1; iTC <= iMat; ++iTC) { - ++NumNewConst; - state.dataConstruction->Construct(NumNewConst) = state.dataConstruction->Construct(Loop); // copy data - state.dataConstruction->Construct(NumNewConst).Name = - format("{}_TC_{:.0R}", state.dataConstruction->Construct(Loop).Name, state.dataHeatBal->TCGlazings(iTCG).SpecTemp(iTC)); - state.dataConstruction->Construct(NumNewConst).TCLayer = state.dataHeatBal->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; - } + auto &constr = state.dataConstruction->Construct(Loop); + if (!constr.isTCMaster) continue; + + auto const *matGlassTC = dynamic_cast(s_mat->materials(constr.TCMasterMatNum)); + assert(matGlassTC != nullptr); + + constr.numTCChildConstrs = matGlassTC->numMatRefs; + constr.TCChildConstrs.allocate(constr.numTCChildConstrs); + + // The master thermochromic construction uses the first (i.e., lowest temp) glazing + constr.LayerPoint(constr.TCLayerNum) = matGlassTC->matRefs(1).matNum; + constr.specTemp = matGlassTC->matRefs(1).specTemp; + + for (int iTC = 1; iTC <= constr.numTCChildConstrs; ++iTC) { + ++NumNewConst; + auto &constrNew = state.dataConstruction->Construct(NumNewConst); + + constrNew = constr; // This should be a deep copy + constrNew.Name = format("{}_TC_{:.0R}", constr.Name, matGlassTC->matRefs(iTC).specTemp); + constrNew.LayerPoint(constrNew.TCLayerNum) = matGlassTC->matRefs(iTC).matNum; + constrNew.specTemp = matGlassTC->matRefs(iTC).specTemp; + + constrNew.isTCWindow = true; + constrNew.isTCMaster = false; + constrNew.TCMasterConstrNum = Loop; + + constr.TCChildConstrs(iTC).specTemp = matGlassTC->matRefs(iTC).specTemp; + constr.TCChildConstrs(iTC).constrNum = NumNewConst; } } state.dataHeatBal->TotConstructs = NumNewConst; } - void SetupSimpleWindowGlazingSystem(EnergyPlusData &state, int &MaterNum) + void SetupComplexFenestrationStateInput(EnergyPlusData &state, + int &ConstrNum, // num of construction items thus far + bool &ErrorsFound) { // SUBROUTINE INFORMATION: // AUTHOR B. Griffith - // DATE WRITTEN January 2009 + // DATE WRITTEN June 2010 + // MODIFIED January 2012 (Simon Vidanovic) + // MODIFIED May 2012 (Simon Vidanovic) // PURPOSE OF THIS SUBROUTINE: - // Convert simple window performance indices into all the properties needed to - // describe a single, equivalent glass layer + // get input for complex fenestration construction // METHODOLOGY EMPLOYED: - // The simple window indices are converted to a single materal layer using a "block model" + // usual GetInput processing. Matrix input from MatrixDataManager - // REFERENCES: - // draft paper by Arasteh, Kohler, and Griffith + // SUBROUTINE PARAMETER DEFINITIONS: + static constexpr std::string_view routineName = "SetupComlexFenestrationStateInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 Riw(0.0); // thermal resistance of interior film coefficient under winter conditions (m2-K/W) - Real64 Row(0.0); // theraml resistance of exterior film coefficient under winter conditions (m2-K/W) - Real64 Rlw(0.0); // thermal resistance of block model layer (m2-K/W) - Real64 Ris(0.0); // thermal resistance of interior film coefficient under summer conditions (m2-K/W) - Real64 Ros(0.0); // theraml resistance of exterior film coefficient under summer conditions (m2-K/W) - Real64 InflowFraction(0.0); // inward flowing fraction for SHGC, intermediate value non dimensional - Real64 SolarAbsorb(0.0); // solar aborptance - bool ErrorsFound(false); - Real64 TsolLowSide(0.0); // intermediate solar transmission for interpolating - Real64 TsolHiSide(0.0); // intermediate solar transmission for interpolating - Real64 DeltaSHGCandTsol(0.0); // intermediate difference - Real64 RLowSide(0.0); - Real64 RHiSide(0.0); - - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(MaterNum)); - assert(thisMaterial != nullptr); - // first fill out defaults - thisMaterial->GlassSpectralDataPtr = 0; - thisMaterial->SolarDiffusing = false; - thisMaterial->Roughness = Material::SurfaceRoughness::VerySmooth; - thisMaterial->TransThermal = 0.0; - thisMaterial->AbsorpThermalBack = 0.84; - thisMaterial->AbsorpThermalFront = 0.84; - thisMaterial->AbsorpThermal = thisMaterial->AbsorpThermalBack; - - // step 1. Determine U-factor without film coefficients - // Simple window model has its own correlation for film coefficients (m2-K/W) under Winter conditions as function of U-factor - if (thisMaterial->SimpleWindowUfactor < 5.85) { - Riw = 1.0 / (0.359073 * std::log(thisMaterial->SimpleWindowUfactor) + 6.949915); - } else { - Riw = 1.0 / (1.788041 * thisMaterial->SimpleWindowUfactor - 2.886625); - } - Row = 1.0 / (0.025342 * thisMaterial->SimpleWindowUfactor + 29.163853); - - // determine 1/U without film coefficients - Rlw = (1.0 / thisMaterial->SimpleWindowUfactor) - Riw - Row; - if (Rlw <= 0.0) { // U factor of film coefficients is better than user input. - Rlw = max(Rlw, 0.001); - ShowWarningError(state, - format("WindowMaterial:SimpleGlazingSystem: {} has U-factor higher than that provided by surface film resistances, " - "Check value of U-factor", - thisMaterial->Name)); - } - - // Step 2. determine layer thickness. - - if ((1.0 / Rlw) > 7.0) { - thisMaterial->Thickness = 0.002; - } else { - thisMaterial->Thickness = 0.05914 - (0.00714 / Rlw); - } + int NumAlphas; // Number of Alphas for each GetObjectItem call + int NumNumbers; // Number of Numbers for each GetObjectItem call + int TotalArgs; // Number of fields for each GetObjectItem call + int IOStatus; // Used in GetObjectItem + int NumRows; // temporary size of matrix + int NumCols; // temporary size of matrix + int NBasis; // temporary number of elements in basis + int AlphaIndex; + int NumOfTotalLayers; // total number of layers in the construction + int NumOfOpticalLayers; // number of optical layers in the construction (excluding gasses and gas mixtures) + int currentOpticalLayer; // current optical layer number. This is important since optical structures should + // be loaded only with optical layers - // Step 3. determine effective conductivity + // When reading Construction:ComplexFenestrationState, there is a call of GetMatrix2D which also uses same + // variables from DataIPShortCuts. Since this can cause some errors in reading, it is important + // to declare local variables for reading Construction:ComplexFenestrationState object(s) + Array1D_string locAlphaFieldNames; + Array1D_string locNumericFieldNames; + Array1D_bool locNumericFieldBlanks; + Array1D_bool locAlphaFieldBlanks; + Array1D_string locAlphaArgs; + Array1D locNumericArgs; + std::string locCurrentModuleObject; - thisMaterial->Conductivity = thisMaterial->Thickness / Rlw; - if (thisMaterial->Conductivity > 0.0) { - state.dataHeatBal->NominalR(MaterNum) = Rlw; - thisMaterial->Resistance = Rlw; - } else { - ErrorsFound = true; - ShowSevereError( - state, - format("WindowMaterial:SimpleGlazingSystem: {} has Conductivity <= 0.0, must be >0.0, Check value of U-factor", thisMaterial->Name)); - } + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; - // step 4. determine solar transmission (revised to 10-1-2009 version from LBNL.) + // Reading WindowThermalModel:Params + s_ipsc->cCurrentModuleObject = "WindowThermalModel:Params"; + state.dataBSDFWindow->TotThermalModels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + s_mat->WindowThermalModel.allocate(state.dataBSDFWindow->TotThermalModels); - if (thisMaterial->SimpleWindowUfactor > 4.5) { + for (int Loop = 1; Loop <= state.dataBSDFWindow->TotThermalModels; ++Loop) { + state.dataInputProcessing->inputProcessor->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNumbers, + IOStatus, + s_ipsc->lNumericFieldBlanks, + _, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - if (thisMaterial->SimpleWindowSHGC < 0.7206) { + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; - thisMaterial->Trans = 0.939998 * pow_2(thisMaterial->SimpleWindowSHGC) + 0.20332 * thisMaterial->SimpleWindowSHGC; - } else { // >= 0.7206 + auto &windowThermalModel = s_mat->WindowThermalModel(Loop); + windowThermalModel.Name = s_ipsc->cAlphaArgs(1); - thisMaterial->Trans = 1.30415 * thisMaterial->SimpleWindowSHGC - 0.30515; + windowThermalModel.SDScalar = s_ipsc->rNumericArgs(1); + if ((s_ipsc->rNumericArgs(1) < 0.0) || (s_ipsc->rNumericArgs(1) > 1.0)) { + ShowSevereCustomMessage( + state, + eoh, + format("{} should be >= 0.0 and <= 1.0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); + ErrorsFound = true; } - } else if (thisMaterial->SimpleWindowUfactor < 3.4) { + windowThermalModel.CalculationStandard = + static_cast(getEnumValue(TARCOGGassesParams::stdrdNamesUC, s_ipsc->cAlphaArgs(2))); + windowThermalModel.ThermalModel = + static_cast(getEnumValue(TARCOGParams::thermalModelNamesUC, s_ipsc->cAlphaArgs(3))); + windowThermalModel.DeflectionModel = + static_cast(getEnumValue(TARCOGParams::deflectionCalculationNamesUC, s_ipsc->cAlphaArgs(4))); - if (thisMaterial->SimpleWindowSHGC <= 0.15) { - thisMaterial->Trans = 0.41040 * thisMaterial->SimpleWindowSHGC; - } else { // > 0.15 - thisMaterial->Trans = 0.085775 * pow_2(thisMaterial->SimpleWindowSHGC) + 0.963954 * thisMaterial->SimpleWindowSHGC - 0.084958; - } - } else { // interpolate. 3.4 <= Ufactor <= 4.5 + if (windowThermalModel.DeflectionModel == TARCOGParams::DeflectionCalculation::TEMPERATURE) { + windowThermalModel.VacuumPressureLimit = s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(2) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); + } - if (thisMaterial->SimpleWindowSHGC < 0.7206) { - TsolHiSide = 0.939998 * pow_2(thisMaterial->SimpleWindowSHGC) + 0.20332 * thisMaterial->SimpleWindowSHGC; - } else { // >= 0.7206 - TsolHiSide = 1.30415 * thisMaterial->SimpleWindowSHGC - 0.30515; - } + windowThermalModel.InitialTemperature = s_ipsc->rNumericArgs(3); + if (s_ipsc->rNumericArgs(3) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(3), s_ipsc->rNumericArgs(3))); + } - if (thisMaterial->SimpleWindowSHGC <= 0.15) { - TsolLowSide = 0.41040 * thisMaterial->SimpleWindowSHGC; - } else { // > 0.15 - TsolLowSide = 0.085775 * pow_2(thisMaterial->SimpleWindowSHGC) + 0.963954 * thisMaterial->SimpleWindowSHGC - 0.084958; + windowThermalModel.InitialPressure = s_ipsc->rNumericArgs(4); + if (s_ipsc->rNumericArgs(4) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(4), s_ipsc->rNumericArgs(4))); + } } - thisMaterial->Trans = ((thisMaterial->SimpleWindowUfactor - 3.4) / (4.5 - 3.4)) * (TsolHiSide - TsolLowSide) + TsolLowSide; - } - if (thisMaterial->Trans < 0.0) thisMaterial->Trans = 0.0; - - // step 5. determine solar reflectances - - DeltaSHGCandTsol = thisMaterial->SimpleWindowSHGC - thisMaterial->Trans; - - if (thisMaterial->SimpleWindowUfactor > 4.5) { - - Ris = 1.0 / (29.436546 * pow_3(DeltaSHGCandTsol) - 21.943415 * pow_2(DeltaSHGCandTsol) + 9.945872 * DeltaSHGCandTsol + 7.426151); - Ros = 1.0 / (2.225824 * DeltaSHGCandTsol + 20.577080); - } else if (thisMaterial->SimpleWindowUfactor < 3.4) { + } // DO Loop = 1, TotThermalModels - Ris = 1.0 / (199.8208128 * pow_3(DeltaSHGCandTsol) - 90.639733 * pow_2(DeltaSHGCandTsol) + 19.737055 * DeltaSHGCandTsol + 6.766575); - Ros = 1.0 / (5.763355 * DeltaSHGCandTsol + 20.541528); - } else { // interpolate. 3.4 <= Ufactor <= 4.5 - // inside first - RLowSide = 1.0 / (199.8208128 * pow_3(DeltaSHGCandTsol) - 90.639733 * pow_2(DeltaSHGCandTsol) + 19.737055 * DeltaSHGCandTsol + 6.766575); - RHiSide = 1.0 / (29.436546 * pow_3(DeltaSHGCandTsol) - 21.943415 * pow_2(DeltaSHGCandTsol) + 9.945872 * DeltaSHGCandTsol + 7.426151); - Ris = ((thisMaterial->SimpleWindowUfactor - 3.4) / (4.5 - 3.4)) * (RLowSide - RHiSide) + RLowSide; - // then outside - RLowSide = 1.0 / (5.763355 * DeltaSHGCandTsol + 20.541528); - RHiSide = 1.0 / (2.225824 * DeltaSHGCandTsol + 20.577080); - Ros = ((thisMaterial->SimpleWindowUfactor - 3.4) / (4.5 - 3.4)) * (RLowSide - RHiSide) + RLowSide; - } + // Reading Construction:ComplexFenestrationState + locCurrentModuleObject = "Construction:ComplexFenestrationState"; + state.dataBSDFWindow->TotComplexFenStates = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, locCurrentModuleObject); - InflowFraction = (Ros + 0.5 * Rlw) / (Ros + Rlw + Ris); + state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, locCurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + if (!allocated(locAlphaFieldNames)) locAlphaFieldNames.allocate(NumAlphas); + if (!allocated(locNumericFieldNames)) locNumericFieldNames.allocate(NumNumbers); + if (!allocated(locNumericFieldBlanks)) locNumericFieldBlanks.allocate(NumNumbers); + if (!allocated(locAlphaFieldBlanks)) locAlphaFieldBlanks.allocate(NumAlphas); + if (!allocated(locAlphaArgs)) locAlphaArgs.allocate(NumAlphas); + if (!allocated(locNumericArgs)) locNumericArgs.allocate(NumNumbers); - SolarAbsorb = (thisMaterial->SimpleWindowSHGC - thisMaterial->Trans) / InflowFraction; - thisMaterial->ReflectSolBeamBack = 1.0 - thisMaterial->Trans - SolarAbsorb; - thisMaterial->ReflectSolBeamFront = thisMaterial->ReflectSolBeamBack; + state.dataBSDFWindow->FirstBSDF = ConstrNum + 1; // Location of first BSDF construction input (They will be consecutive) + for (int Loop = 1; Loop <= state.dataBSDFWindow->TotComplexFenStates; ++Loop) { + state.dataInputProcessing->inputProcessor->getObjectItem(state, + locCurrentModuleObject, + Loop, + locAlphaArgs, + NumAlphas, + locNumericArgs, + NumNumbers, + IOStatus, + locNumericFieldBlanks, + _, + locAlphaFieldNames, + locNumericFieldNames); - // step 6. determine visible properties. - if (thisMaterial->SimpleWindowVTinputByUser) { - thisMaterial->TransVis = thisMaterial->SimpleWindowVisTran; - thisMaterial->ReflectVisBeamBack = - -0.7409 * pow_3(thisMaterial->TransVis) + 1.6531 * pow_2(thisMaterial->TransVis) - 1.2299 * thisMaterial->TransVis + 0.4545; - if (thisMaterial->TransVis + thisMaterial->ReflectVisBeamBack >= 1.0) { - thisMaterial->ReflectVisBeamBack = 0.999 - thisMaterial->TransVis; - } + ErrorObjectHeader eoh{routineName, locCurrentModuleObject, locAlphaArgs(1)}; - thisMaterial->ReflectVisBeamFront = - -0.0622 * pow_3(thisMaterial->TransVis) + 0.4277 * pow_2(thisMaterial->TransVis) - 0.4169 * thisMaterial->TransVis + 0.2399; - if (thisMaterial->TransVis + thisMaterial->ReflectVisBeamFront >= 1.0) { - thisMaterial->ReflectVisBeamFront = 0.999 - thisMaterial->TransVis; + if (GlobalNames::VerifyUniqueInterObjectName(state, + state.dataHeatBalMgr->UniqueConstructNames, + locAlphaArgs(1), + state.dataHeatBalMgr->CurrentModuleObject, + locAlphaFieldNames(1), + ErrorsFound)) { + continue; } - } else { - thisMaterial->TransVis = thisMaterial->Trans; - thisMaterial->ReflectVisBeamBack = thisMaterial->ReflectSolBeamBack; - thisMaterial->ReflectVisBeamFront = thisMaterial->ReflectSolBeamFront; - } + ++ConstrNum; + auto &thisConstruct = state.dataConstruction->Construct(ConstrNum); + // Simon TODO: This is to be confirmed. If this is just initial value, then we might want to make better guess + state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum) = 0.1; + // Simon TODO: If I do not put this, then it is considered that surface is NOT window + thisConstruct.TransDiff = 0.1; // This is a place holder to flag + // the construction as a window until + // the correct value is entered in WindowComplexManager - // step 7. The dependence on incident angle is in subroutine TransAndReflAtPhi + // Now override the deraults as appropriate + thisConstruct.Name = locAlphaArgs(1); - // step 8. Hemispherical terms are averaged using standard method + // ALLOCATE(Construct(ConstrNum)%BSDFInput) - if (ErrorsFound) { - ShowFatalError(state, "Program halted because of input problem(s) in WindowMaterial:SimpleGlazingSystem"); - } - } + // Construct(ConstrNum)%BSDFInput%ThermalConstruction = ThConstNum - void SetupComplexFenestrationMaterialInput(EnergyPlusData &state, - int &MaterNum, // num of material items thus far - bool &ErrorsFound) - { + thisConstruct.BSDFInput.BasisType = static_cast(getEnumValue(DataBSDFWindow::basisNamesUC, locAlphaArgs(2))); + thisConstruct.BSDFInput.BasisSymmetryType = + static_cast(getEnumValue(DataBSDFWindow::basisSymmetryNamesUC, locAlphaArgs(3))); - // SUBROUTINE INFORMATION: - // AUTHOR Simon Vidanovic - // DATE WRITTEN March 2012 - // MODIFIED May 2013 (Simon Vidanovic) - - // PURPOSE OF THIS SUBROUTINE: - // get input for complex fenestration materials - - // METHODOLOGY EMPLOYED: - // usual GetInput processing. - - // SUBROUTINE PARAMETER DEFINITIONS - constexpr const char *RoutineName("SetupComplexFenestrationMaterialInput: "); - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Array1D_string MaterialNames(5); // Number of Material Alpha names defined - Array1D MaterialProps(27); // Temporary array to transfer material properties - int NumAlphas; // Number of Alphas for each GetObjectItem call - int NumNumbers; // Number of Numbers for each GetObjectItem call - int IOStatus; // Used in GetObjectItem - - // Reading WindowGap:SupportPillar - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "WindowGap:SupportPillar"; - state.dataHeatBal->W7SupportPillars = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - state.dataHeatBal->SupportPillar.allocate(state.dataHeatBal->W7SupportPillars); - for (int Loop = 1; Loop <= state.dataHeatBal->W7SupportPillars; ++Loop) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Loop, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - - state.dataHeatBal->SupportPillar(Loop).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataHeatBal->SupportPillar(Loop).Spacing = state.dataIPShortCut->rNumericArgs(1); - state.dataHeatBal->SupportPillar(Loop).Radius = state.dataIPShortCut->rNumericArgs(2); - - if (state.dataIPShortCut->rNumericArgs(1) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(1))); - ShowContinueError(state, - format("{} must be > 0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(1), - state.dataIPShortCut->rNumericArgs(1))); - } - - if (state.dataIPShortCut->rNumericArgs(2) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(2))); - ShowContinueError(state, - format("{} must be > 0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(2), - state.dataIPShortCut->rNumericArgs(2))); - } - } - - // Reading WindowGap:DeflectionState - cCurrentModuleObject = "WindowGap:DeflectionState"; - state.dataHeatBal->W7DeflectionStates = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - state.dataHeatBal->DeflectionState.allocate(state.dataHeatBal->W7DeflectionStates); - for (int Loop = 1; Loop <= state.dataHeatBal->W7DeflectionStates; ++Loop) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Loop, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - - state.dataHeatBal->DeflectionState(Loop).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataHeatBal->DeflectionState(Loop).DeflectedThickness = state.dataIPShortCut->rNumericArgs(1); - if (state.dataIPShortCut->rNumericArgs(1) < 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(1))); - ShowContinueError(state, - format("{} must be >= 0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(1), - state.dataIPShortCut->rNumericArgs(1))); - } - } - - // Reading WindowMaterial:Gap - - cCurrentModuleObject = "WindowMaterial:Gap"; - state.dataHeatBal->W7MaterialGaps = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - // ALLOCATE(DeflectionState(W7DeflectionStates)) - for (int Loop = 1; Loop <= state.dataHeatBal->W7MaterialGaps; ++Loop) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Loop, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - state.dataIPShortCut->cAlphaArgs(1), - state.dataHeatBalMgr->CurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); - continue; - } - - ++MaterNum; - auto *thisMaterial = new Material::MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Material::Group::ComplexWindowGap; - thisMaterial->Roughness = Material::SurfaceRoughness::Rough; - thisMaterial->ROnly = true; - - thisMaterial->Name = state.dataIPShortCut->cAlphaArgs(1); - - thisMaterial->Thickness = state.dataIPShortCut->rNumericArgs(1); - if (state.dataIPShortCut->rNumericArgs(1) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(1))); - ShowContinueError( - state, - format("{} must be > 0, entered {:.2R}", state.dataIPShortCut->cNumericFieldNames(1), state.dataIPShortCut->rNumericArgs(1))); - } - - thisMaterial->Pressure = state.dataIPShortCut->rNumericArgs(2); - if (state.dataIPShortCut->rNumericArgs(2) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(2))); - ShowContinueError( - state, - format("{} must be > 0, entered {:.2R}", state.dataIPShortCut->cNumericFieldNames(2), state.dataIPShortCut->rNumericArgs(2))); - } - - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisMaterial->GasPointer = Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(2), state.dataMaterial->Material); - } else { - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(1))); - ShowContinueError(state, format("{} does not have assigned WindowMaterial:Gas or WindowMaterial:GasMixutre.", cCurrentModuleObject)); - } - if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { - thisMaterial->DeflectionStatePtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataHeatBal->DeflectionState); - } - if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - thisMaterial->SupportPillarPtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataHeatBal->SupportPillar); - } - } - - // Reading WindowMaterial:ComplexShade - cCurrentModuleObject = "WindowMaterial:ComplexShade"; - state.dataMaterial->TotComplexShades = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - if (state.dataMaterial->TotComplexShades > 0) { - state.dataMaterial->ComplexShade.allocate( - state.dataMaterial->TotComplexShades); // Allocate the array Size to the number of complex shades - } - - for (int Loop = 1; Loop <= state.dataMaterial->TotComplexShades; ++Loop) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Loop, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - - ++MaterNum; - auto *thisMaterial = new Material::MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Material::Group::ComplexWindowShade; - thisMaterial->Roughness = Material::SurfaceRoughness::Rough; - thisMaterial->ROnly = true; - - // Assign pointer to ComplexShade - thisMaterial->ComplexShadePtr = Loop; - - thisMaterial->Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataMaterial->ComplexShade(Loop).Name = state.dataIPShortCut->cAlphaArgs(1); - - { - std::string const &SELECT_CASE_var = state.dataIPShortCut->cAlphaArgs(2); - - if (SELECT_CASE_var == "OTHERSHADINGTYPE") { - state.dataMaterial->ComplexShade(Loop).LayerType = TARCOGParams::TARCOGLayerType::DIFFSHADE; - } else if (SELECT_CASE_var == "VENETIANHORIZONTAL") { - state.dataMaterial->ComplexShade(Loop).LayerType = TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ; - } else if (SELECT_CASE_var == "VENETIANVERTICAL") { - state.dataMaterial->ComplexShade(Loop).LayerType = TARCOGParams::TARCOGLayerType::VENETBLIND_VERT; - } else if (SELECT_CASE_var == "WOVEN") { - state.dataMaterial->ComplexShade(Loop).LayerType = TARCOGParams::TARCOGLayerType::WOVSHADE; - } else if (SELECT_CASE_var == "PERFORATED") { - state.dataMaterial->ComplexShade(Loop).LayerType = TARCOGParams::TARCOGLayerType::PERFORATED; - } else if (SELECT_CASE_var == "BSDF") { - state.dataMaterial->ComplexShade(Loop).LayerType = TARCOGParams::TARCOGLayerType::BSDF; - } else { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2))); - ShowContinueError(state, - format("{} entered value = \"{}\" should be OtherShadingType, Venetian, Woven, Perforated or BSDF.", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - } - } - - state.dataMaterial->ComplexShade(Loop).Thickness = state.dataIPShortCut->rNumericArgs(1); - thisMaterial->Thickness = state.dataIPShortCut->rNumericArgs(1); - state.dataMaterial->ComplexShade(Loop).Conductivity = state.dataIPShortCut->rNumericArgs(2); - thisMaterial->Conductivity = state.dataIPShortCut->rNumericArgs(2); - state.dataMaterial->ComplexShade(Loop).IRTransmittance = state.dataIPShortCut->rNumericArgs(3); - state.dataMaterial->ComplexShade(Loop).FrontEmissivity = state.dataIPShortCut->rNumericArgs(4); - state.dataMaterial->ComplexShade(Loop).BackEmissivity = state.dataIPShortCut->rNumericArgs(5); - - // Simon: in heat balance radiation exchange routines AbsorpThermal is used - // and program will crash if value is not assigned. Not sure if this is correct - // or some additional calculation is necessary. Simon TODO - thisMaterial->AbsorpThermal = state.dataIPShortCut->rNumericArgs(5); - thisMaterial->AbsorpThermalFront = state.dataIPShortCut->rNumericArgs(4); - thisMaterial->AbsorpThermalBack = state.dataIPShortCut->rNumericArgs(5); - - state.dataMaterial->ComplexShade(Loop).TopOpeningMultiplier = state.dataIPShortCut->rNumericArgs(6); - state.dataMaterial->ComplexShade(Loop).BottomOpeningMultiplier = state.dataIPShortCut->rNumericArgs(7); - state.dataMaterial->ComplexShade(Loop).LeftOpeningMultiplier = state.dataIPShortCut->rNumericArgs(8); - state.dataMaterial->ComplexShade(Loop).RightOpeningMultiplier = state.dataIPShortCut->rNumericArgs(9); - state.dataMaterial->ComplexShade(Loop).FrontOpeningMultiplier = state.dataIPShortCut->rNumericArgs(10); - - state.dataMaterial->ComplexShade(Loop).SlatWidth = state.dataIPShortCut->rNumericArgs(11); - state.dataMaterial->ComplexShade(Loop).SlatSpacing = state.dataIPShortCut->rNumericArgs(12); - state.dataMaterial->ComplexShade(Loop).SlatThickness = state.dataIPShortCut->rNumericArgs(13); - state.dataMaterial->ComplexShade(Loop).SlatAngle = state.dataIPShortCut->rNumericArgs(14); - state.dataMaterial->ComplexShade(Loop).SlatConductivity = state.dataIPShortCut->rNumericArgs(15); - state.dataMaterial->ComplexShade(Loop).SlatCurve = state.dataIPShortCut->rNumericArgs(16); - - if (state.dataIPShortCut->rNumericArgs(1) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(1))); - ShowContinueError(state, - format("{} must be > 0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(1), - state.dataIPShortCut->rNumericArgs(1))); - } - - if (state.dataIPShortCut->rNumericArgs(2) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(2))); - ShowContinueError(state, - format("{} must be > 0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(2), - state.dataIPShortCut->rNumericArgs(2))); - } - - if ((state.dataIPShortCut->rNumericArgs(3) < 0.0) || (state.dataIPShortCut->rNumericArgs(3) > 1.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(3))); - ShowContinueError(state, - format("{} value must be >= 0 and <= 1, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(3), - state.dataIPShortCut->rNumericArgs(3))); - } - - if ((state.dataIPShortCut->rNumericArgs(4) <= 0.0) || (state.dataIPShortCut->rNumericArgs(4) > 1.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(4))); - ShowContinueError(state, - format("{} value must be >= 0 and <= 1, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(4), - state.dataIPShortCut->rNumericArgs(4))); - } - - if ((state.dataIPShortCut->rNumericArgs(5) <= 0.0) || (state.dataIPShortCut->rNumericArgs(5) > 1.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(5))); - ShowContinueError(state, - format("{} value must be >= 0 and <= 1, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(5), - state.dataIPShortCut->rNumericArgs(5))); - } - - if ((state.dataIPShortCut->rNumericArgs(6) < 0.0) || (state.dataIPShortCut->rNumericArgs(6) > 1.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(6))); - ShowContinueError(state, - format("{} must be >= 0 or <= 1, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(6), - state.dataIPShortCut->rNumericArgs(6))); - } - - if ((state.dataIPShortCut->rNumericArgs(7) < 0.0) || (state.dataIPShortCut->rNumericArgs(7) > 1.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(7))); - ShowContinueError(state, - format("{} must be >=0 or <=1, entered {:.2R}", - state.dataIPShortCut->cNumericFieldNames(7), - state.dataIPShortCut->rNumericArgs(7))); - } - - if ((state.dataIPShortCut->rNumericArgs(8) < 0.0) || (state.dataIPShortCut->rNumericArgs(8) > 1.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(8))); - ShowContinueError(state, - format("{} must be >=0 or <=1, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(8), - state.dataIPShortCut->rNumericArgs(8))); - } - - if ((state.dataIPShortCut->rNumericArgs(9) < 0.0) || (state.dataIPShortCut->rNumericArgs(9) > 1.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(9))); - ShowContinueError(state, - format("{} must be >=0 or <=1, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(9), - state.dataIPShortCut->rNumericArgs(9))); - } - - if ((state.dataIPShortCut->rNumericArgs(10) < 0.0) || (state.dataIPShortCut->rNumericArgs(10) > 1.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(10))); - ShowContinueError(state, - format("{} must be >=0 or <=1, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(10), - state.dataIPShortCut->rNumericArgs(10))); - } - - if ((state.dataMaterial->ComplexShade(Loop).LayerType == TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ) || - (state.dataMaterial->ComplexShade(Loop).LayerType == TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ)) { - if (state.dataIPShortCut->rNumericArgs(11) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(11))); - ShowContinueError(state, - format("{} must be >0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(11), - state.dataIPShortCut->rNumericArgs(11))); - } - - if (state.dataIPShortCut->rNumericArgs(12) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(12))); - ShowContinueError(state, - format("{} must be >0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(12), - state.dataIPShortCut->rNumericArgs(12))); - } - - if (state.dataIPShortCut->rNumericArgs(13) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(13))); - ShowContinueError(state, - format("{} must be >0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(13), - state.dataIPShortCut->rNumericArgs(13))); - } - - if ((state.dataIPShortCut->rNumericArgs(14) < -90.0) || (state.dataIPShortCut->rNumericArgs(14) > 90.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(14))); - ShowContinueError(state, - format("{} must be >=-90 and <=90, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(14), - state.dataIPShortCut->rNumericArgs(14))); - } - - if (state.dataIPShortCut->rNumericArgs(15) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(15))); - ShowContinueError(state, - format("{} must be >0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(15), - state.dataIPShortCut->rNumericArgs(15))); - } - - if ((state.dataIPShortCut->rNumericArgs(16) < 0.0) || - ((state.dataIPShortCut->rNumericArgs(16) > 0.0) && - (state.dataIPShortCut->rNumericArgs(16) < (state.dataIPShortCut->rNumericArgs(11) / 2)))) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(16))); - ShowContinueError(state, - format("{} must be =0 or greater than SlatWidth/2, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(16), - state.dataIPShortCut->rNumericArgs(16))); - } - } - - if (ErrorsFound) ShowFatalError(state, "Error in complex fenestration material input."); - } - } - - void SetupComplexFenestrationStateInput(EnergyPlusData &state, - int &ConstrNum, // num of construction items thus far - bool &ErrorsFound) - { - - // SUBROUTINE INFORMATION: - // AUTHOR B. Griffith - // DATE WRITTEN June 2010 - // MODIFIED January 2012 (Simon Vidanovic) - // MODIFIED May 2012 (Simon Vidanovic) - - // PURPOSE OF THIS SUBROUTINE: - // get input for complex fenestration construction - - // METHODOLOGY EMPLOYED: - // usual GetInput processing. Matrix input from MatrixDataManager - - // SUBROUTINE PARAMETER DEFINITIONS: - constexpr const char *RoutineName("SetupComlexFenestrationStateInput: "); - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NumAlphas; // Number of Alphas for each GetObjectItem call - int NumNumbers; // Number of Numbers for each GetObjectItem call - int TotalArgs; // Number of fields for each GetObjectItem call - int IOStatus; // Used in GetObjectItem - int NumRows; // temporary size of matrix - int NumCols; // temporary size of matrix - int NBasis; // temporary number of elements in basis - int AlphaIndex; - int ThermalModelNum; // number of thermal model parameters object - int NumOfTotalLayers; // total number of layers in the construction - int NumOfOpticalLayers; // number of optical layers in the construction (excluding gasses and gas mixtures) - int currentOpticalLayer; // current optical layer number. This is important since optical structures should - // be loaded only with optical layers - - // When reading Construction:ComplexFenestrationState, there is a call of GetMatrix2D which also uses same - // variables from DataIPShortCuts. Since this can cause some errors in reading, it is important - // to declare local variables for reading Construction:ComplexFenestrationState object(s) - Array1D_string locAlphaFieldNames; - Array1D_string locNumericFieldNames; - Array1D_bool locNumericFieldBlanks; - Array1D_bool locAlphaFieldBlanks; - Array1D_string locAlphaArgs; - Array1D locNumericArgs; - std::string locCurrentModuleObject; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - // Reading WindowThermalModel:Params - cCurrentModuleObject = "WindowThermalModel:Params"; - state.dataBSDFWindow->TotThermalModels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - state.dataMaterial->WindowThermalModel.allocate(state.dataBSDFWindow->TotThermalModels); - - for (int Loop = 1; Loop <= state.dataBSDFWindow->TotThermalModels; ++Loop) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Loop, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - - state.dataMaterial->WindowThermalModel(Loop).Name = state.dataIPShortCut->cAlphaArgs(1); - - state.dataMaterial->WindowThermalModel(Loop).SDScalar = state.dataIPShortCut->rNumericArgs(1); - if ((state.dataIPShortCut->rNumericArgs(1) < 0.0) || (state.dataIPShortCut->rNumericArgs(1) > 1.0)) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(1))); - ShowContinueError(state, - format("{} should be >= 0.0 and <= 1.0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(1), - state.dataIPShortCut->rNumericArgs(1))); - } - - { - std::string const &SELECT_CASE_var = state.dataIPShortCut->cAlphaArgs(2); - if (SELECT_CASE_var == "ISO15099") { - state.dataMaterial->WindowThermalModel(Loop).CalculationStandard = TARCOGGassesParams::Stdrd::ISO15099; - } else if (SELECT_CASE_var == "EN673DECLARED") { - state.dataMaterial->WindowThermalModel(Loop).CalculationStandard = TARCOGGassesParams::Stdrd::EN673; - } else if (SELECT_CASE_var == "EN673DESIGN") { - state.dataMaterial->WindowThermalModel(Loop).CalculationStandard = TARCOGGassesParams::Stdrd::EN673Design; - } else { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2))); - ShowContinueError(state, - format("{} entered value = \"{}\" should be ISO15099, EN673Declared or EN673Design.", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - } - } - - { - std::string const &SELECT_CASE_var = state.dataIPShortCut->cAlphaArgs(3); - if (SELECT_CASE_var == "ISO15099") { - state.dataMaterial->WindowThermalModel(Loop).ThermalModel = TARCOGParams::TARCOGThermalModel::ISO15099; - } else if (SELECT_CASE_var == "SCALEDCAVITYWIDTH") { - state.dataMaterial->WindowThermalModel(Loop).ThermalModel = TARCOGParams::TARCOGThermalModel::SCW; - } else if (SELECT_CASE_var == "CONVECTIVESCALARMODEL_NOSDTHICKNESS") { - state.dataMaterial->WindowThermalModel(Loop).ThermalModel = TARCOGParams::TARCOGThermalModel::CSM; - } else if (SELECT_CASE_var == "CONVECTIVESCALARMODEL_WITHSDTHICKNESS") { - state.dataMaterial->WindowThermalModel(Loop).ThermalModel = TARCOGParams::TARCOGThermalModel::CSM_WithSDThickness; - } else { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError( - state, - format("{} entered value = \"{}\" should be ISO15099, ScaledCavityWidth, ConvectiveScalarModel_NoSDThickness or " - "ConvectiveScalarModel_WithSDThickness.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); - } - } - - { - std::string const &SELECT_CASE_var = state.dataIPShortCut->cAlphaArgs(4); - if (SELECT_CASE_var == "NODEFLECTION") { - state.dataMaterial->WindowThermalModel(Loop).DeflectionModel = TARCOGParams::DeflectionCalculation::NONE; - } else if (SELECT_CASE_var == "TEMPERATUREANDPRESSUREINPUT") { - state.dataMaterial->WindowThermalModel(Loop).DeflectionModel = TARCOGParams::DeflectionCalculation::TEMPERATURE; - } else if (SELECT_CASE_var == "MEASUREDDEFLECTION") { - state.dataMaterial->WindowThermalModel(Loop).DeflectionModel = TARCOGParams::DeflectionCalculation::GAP_WIDTHS; - } else { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4))); - ShowContinueError(state, - format("{} entered value = \"{}\" should be NoDeflection, TemperatureAndPressureInput or MeasuredDeflection.", - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); - } - } - - if (state.dataMaterial->WindowThermalModel(Loop).DeflectionModel == TARCOGParams::DeflectionCalculation::TEMPERATURE) { - state.dataMaterial->WindowThermalModel(Loop).VacuumPressureLimit = state.dataIPShortCut->rNumericArgs(2); - if (state.dataIPShortCut->rNumericArgs(2) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(2))); - ShowContinueError(state, - format("{} must be > 0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(2), - state.dataIPShortCut->rNumericArgs(2))); - } - - state.dataMaterial->WindowThermalModel(Loop).InitialTemperature = state.dataIPShortCut->rNumericArgs(3); - if (state.dataIPShortCut->rNumericArgs(3) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(3))); - ShowContinueError(state, - format("{} must be > 0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(3), - state.dataIPShortCut->rNumericArgs(3))); - } - - state.dataMaterial->WindowThermalModel(Loop).InitialPressure = state.dataIPShortCut->rNumericArgs(4); - if (state.dataIPShortCut->rNumericArgs(4) <= 0.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(4))); - ShowContinueError(state, - format("{} must be > 0, entered value = {:.2R}", - state.dataIPShortCut->cNumericFieldNames(4), - state.dataIPShortCut->rNumericArgs(4))); - } - } - - } // DO Loop = 1, TotThermalModels - - // Reading Construction:ComplexFenestrationState - locCurrentModuleObject = "Construction:ComplexFenestrationState"; - state.dataBSDFWindow->TotComplexFenStates = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, locCurrentModuleObject); - - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, locCurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); - if (!allocated(locAlphaFieldNames)) locAlphaFieldNames.allocate(NumAlphas); - if (!allocated(locNumericFieldNames)) locNumericFieldNames.allocate(NumNumbers); - if (!allocated(locNumericFieldBlanks)) locNumericFieldBlanks.allocate(NumNumbers); - if (!allocated(locAlphaFieldBlanks)) locAlphaFieldBlanks.allocate(NumAlphas); - if (!allocated(locAlphaArgs)) locAlphaArgs.allocate(NumAlphas); - if (!allocated(locNumericArgs)) locNumericArgs.allocate(NumNumbers); - - state.dataBSDFWindow->FirstBSDF = ConstrNum + 1; // Location of first BSDF construction input (They will be consecutive) - for (int Loop = 1; Loop <= state.dataBSDFWindow->TotComplexFenStates; ++Loop) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - locCurrentModuleObject, - Loop, - locAlphaArgs, - NumAlphas, - locNumericArgs, - NumNumbers, - IOStatus, - locNumericFieldBlanks, - _, - locAlphaFieldNames, - locNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueConstructNames, - locAlphaArgs(1), - state.dataHeatBalMgr->CurrentModuleObject, - locAlphaFieldNames(1), - ErrorsFound)) { - continue; - } - ++ConstrNum; - auto &thisConstruct = state.dataConstruction->Construct(ConstrNum); - // Simon TODO: This is to be confirmed. If this is just initial value, then we might want to make better guess - state.dataHeatBal->NominalRforNominalUCalculation(ConstrNum) = 0.1; - // Simon TODO: If I do not put this, then it is considered that surface is NOT window - thisConstruct.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 - thisConstruct.Name = locAlphaArgs(1); - - // ALLOCATE(Construct(ConstrNum)%BSDFInput) - - // Construct(ConstrNum)%BSDFInput%ThermalConstruction = ThConstNum - - { - std::string const &SELECT_CASE_var = locAlphaArgs(2); // Basis Type Keyword - if (SELECT_CASE_var == "LBNLWINDOW") { - thisConstruct.BSDFInput.BasisType = DataBSDFWindow::Basis::WINDOW; - } else if (SELECT_CASE_var == "USERDEFINED") { - thisConstruct.BSDFInput.BasisType = DataBSDFWindow::Basis::Custom; - } else { - // throw error - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - locAlphaArgs(1), - locAlphaFieldNames(2))); - ShowContinueError(state, - format("{} entered value=\"{}\" should be LBNLWindow or UserDefined.", locAlphaFieldNames(2), locAlphaArgs(2))); - } - } - - { - std::string const &SELECT_CASE_var = locAlphaArgs(3); // Basis Symmetry Keyword - if (SELECT_CASE_var == "AXISYMMETRIC") { - thisConstruct.BSDFInput.BasisSymmetryType = DataBSDFWindow::BasisSymmetry::Axisymmetric; - } else if (SELECT_CASE_var == "NONE") { - thisConstruct.BSDFInput.BasisSymmetryType = DataBSDFWindow::BasisSymmetry::None; - } else { - // throw error - ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - locAlphaArgs(1), - locAlphaFieldNames(3))); - ShowContinueError(state, - format("{} entered value = \"{}\" should be Axisymmetric or None.", locAlphaFieldNames(3), locAlphaArgs(3))); - } - } - - // Simon: Assign thermal model number - ThermalModelNum = Util::FindItemInList(locAlphaArgs(4), state.dataMaterial->WindowThermalModel); - if (ThermalModelNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - locAlphaArgs(1), - locAlphaFieldNames(4))); - ShowContinueError( - state, - format("{} entered value = \"{}\" no corresponding thermal model (WindowThermalModel:Params) found in the input file.", - locAlphaFieldNames(4), - locAlphaArgs(4))); - } else { - thisConstruct.BSDFInput.ThermalModel = ThermalModelNum; - } + // Simon: Assign thermal model number + thisConstruct.BSDFInput.ThermalModel = Util::FindItemInList(locAlphaArgs(4), s_mat->WindowThermalModel); + if (thisConstruct.BSDFInput.ThermalModel == 0) { + ShowSevereItemNotFound(state, eoh, locAlphaFieldNames(4), locAlphaArgs(4)); + } // *************************************************************************************** // Basis matrix @@ -6428,16 +5413,11 @@ namespace HeatBalanceManager { if (NumCols != 2 && NumCols != 1) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - locAlphaArgs(1), - locAlphaFieldNames(5))); - ShowContinueError(state, - format("{} entered value=\"{}\" invalid matrix dimensions. Basis matrix dimension can only be 2 x 1.", - locAlphaFieldNames(5), - locAlphaArgs(5))); + ShowSevereCustomMessage(state, + eoh, + format("{} entered value=\"{}\" invalid matrix dimensions. Basis matrix dimension can only be 2 x 1.", + locAlphaFieldNames(5), + locAlphaArgs(5))); } thisConstruct.BSDFInput.BasisMat.allocate(NumCols, NumRows); MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.BasisMatIndex, thisConstruct.BSDFInput.BasisMat); @@ -6457,9 +5437,7 @@ namespace HeatBalanceManager { if (mod((NumAlphas - 9), 3) != 0) { // throw warning if incomplete field set ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Incomplete field set found.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, format("{} is missing some of the layers or/and gaps.", locAlphaArgs(1))); + ShowSevereCustomMessage(state, eoh, format("{} is missing some of the layers or/and gaps.", locAlphaArgs(1))); } if (thisConstruct.BSDFInput.BasisSymmetryType == DataBSDFWindow::BasisSymmetry::None) { @@ -6477,11 +5455,9 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{}=\"{}, object. Illegal matrix size has been found.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( + ShowSevereCustomMessage( state, + eoh, format("Solar front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " "size is defined by Matrix:TwoDimension = \"{}\".", locAlphaArgs(6), @@ -6490,10 +5466,10 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereError( - state, format("{}{}=\"{}\", object. Invalid BSDF matrix dimensions.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( - state, format("Solar front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(6))); + ShowSevereCustomMessage( + state, + eoh, + format("Solar front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(6))); } if (thisConstruct.BSDFInput.BasisType == DataBSDFWindow::Basis::Custom) { @@ -6504,13 +5480,10 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.SolFrtTrans.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.SolFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError( - state, format("Solar front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(6))); + ShowSevereCustomMessage( + state, + eoh, + format("Solar front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(6))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.SolFrtTransIndex, thisConstruct.BSDFInput.SolFrtTrans); } @@ -6525,11 +5498,9 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{}=\"{}, object. Illegal matrix size has been found.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( + ShowSevereCustomMessage( state, + eoh, format("Solar back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis size " "is defined by Matrix:TwoDimension = \"{}\".", locAlphaArgs(7), @@ -6538,22 +5509,15 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereError( - state, format("{}{}=\"{}\", object. Invalid BSDF matrix dimensions.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Solar bakc reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(7))); + ShowSevereCustomMessage( + state, eoh, format("Solar back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(7))); } thisConstruct.BSDFInput.SolBkRefl.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.SolBkReflIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError(state, - format("Solar back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(7))); + ShowSevereCustomMessage( + state, eoh, format("Solar back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(7))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.SolBkReflIndex, thisConstruct.BSDFInput.SolBkRefl); } @@ -6568,11 +5532,9 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{}=\"{}, object. Illegal matrix size has been found.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( + ShowSevereCustomMessage( state, + eoh, format("Visible front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " "size is defined by Matrix:TwoDimension = \"{}\".", locAlphaArgs(8), @@ -6581,22 +5543,19 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereError( - state, format("{}{}=\"{}\", object. Invalid BSDF matrix dimensions.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( - state, format("Visible front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(8))); + ShowSevereCustomMessage( + state, + eoh, + format("Visible front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(8))); } thisConstruct.BSDFInput.VisFrtTrans.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.VisFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - cCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError( - state, format("Visible front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(8))); + ShowSevereCustomMessage( + state, + eoh, + format("Visible front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(8))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.VisFrtTransIndex, thisConstruct.BSDFInput.VisFrtTrans); } @@ -6611,11 +5570,9 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{}=\"{}, object. Illegal matrix size has been found.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( + ShowSevereCustomMessage( state, + eoh, format("Visible back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " "size is defined by Matrix:TwoDimension = \"{}\".", locAlphaArgs(9), @@ -6624,22 +5581,15 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereError( - state, format("{}{}=\"{}\", object. Invalid BSDF matrix dimensions.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Visible back reflectance \"{}\" must have the same number of rows and columns.", locAlphaArgs(9))); + ShowSevereCustomMessage( + state, eoh, format("Visible back reflectance \"{}\" must have the same number of rows and columns.", locAlphaArgs(9))); } thisConstruct.BSDFInput.VisBkRefl.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.VisBkReflIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError( - state, format("Visble back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(9))); + ShowSevereCustomMessage( + state, eoh, format("Visble back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(9))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.VisBkReflIndex, thisConstruct.BSDFInput.VisBkRefl); } @@ -6649,7 +5599,7 @@ namespace HeatBalanceManager { AlphaIndex = 9 + (Layer * 3) - 2; currentOpticalLayer = int(Layer / 2) + 1; // Material info is contained in the thermal construct - thisConstruct.LayerPoint(Layer) = Util::FindItemInPtrList(locAlphaArgs(AlphaIndex), state.dataMaterial->Material); + thisConstruct.LayerPoint(Layer) = Material::GetMaterialNum(state, locAlphaArgs(AlphaIndex)); // Simon: Load only if optical layer if (mod(Layer, 2) != 0) { @@ -6666,43 +5616,37 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{} = \"{}\", object. Incorrect matrix dimension.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustomMessage(state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{} = \"{}\", object. Incorrect matrix dimension.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " - "as it is defined by basis matrix.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); - ShowContinueError( + ShowSevereCustomMessage( state, - format("Matrix has {} number of columns, while basis definition specifies {} number of columns.", NumCols, NBasis)); + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " + "as it is defined by basis matrix." + "Matrix has {} number of columns, while basis definition specifies {} number of columns.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer, + NumCols, + NBasis)); } thisConstruct.BSDFInput.Layer(currentOpticalLayer).AbsNcols = NumCols; thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbs.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError(state, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustomMessage( + state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, @@ -6720,42 +5664,36 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{} = \"{}\", object. Incorrect matrix dimension.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustomMessage(state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{} = \"{}\", object. Incorrect matrix dimension.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " - "it is defined by basis matrix.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); - ShowContinueError( + ShowSevereCustomMessage( state, - format("Matrix has {} number of columns, while basis definition specifies {} number of columns.", NumCols, NBasis)); + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " + "it is defined by basis matrix." + "Matrix has {} number of columns, while basis definition specifies {} number of columns.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer, + NumCols, + NBasis)); } thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbs.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError(state, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustomMessage( + state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, @@ -6778,11 +5716,9 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{}=\"{}, object. Illegal matrix size has been found.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( + ShowSevereCustomMessage( state, + eoh, format("Solar front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " "size is defined by Matrix:TwoDimension = \"{}\".", locAlphaArgs(6), @@ -6791,22 +5727,19 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereError( - state, format("{}{}=\"{}\", object. Invalid BSDF matrix dimensions.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( - state, format("Solar front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(6))); + ShowSevereCustomMessage( + state, + eoh, + format("Solar front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(6))); } thisConstruct.BSDFInput.SolFrtTrans.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.SolFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError( - state, format("Solar front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(6))); + ShowSevereCustomMessage( + state, + eoh, + format("Solar front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(6))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.SolFrtTransIndex, state.dataBSDFWindow->BSDFTempMtrx); @@ -6826,11 +5759,9 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{}=\"{}, object. Illegal matrix size has been found.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( + ShowSevereCustomMessage( state, + eoh, format("Solar back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis size " "is defined by Matrix:TwoDimension = \"{}\".", locAlphaArgs(7), @@ -6839,22 +5770,15 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereError( - state, format("{}{}=\"{}\", object. Invalid BSDF matrix dimensions.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Solar back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(7))); + ShowSevereCustomMessage( + state, eoh, format("Solar back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(7))); } thisConstruct.BSDFInput.SolBkRefl.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.SolBkReflIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError(state, - format("Solar back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(7))); + ShowSevereCustomMessage( + state, eoh, format("Solar back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(7))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.SolBkReflIndex, state.dataBSDFWindow->BSDFTempMtrx); thisConstruct.BSDFInput.SolBkRefl = 0.0; @@ -6873,11 +5797,9 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{}=\"{}, object. Illegal matrix size has been found.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( + ShowSevereCustomMessage( state, + eoh, format("Visible front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " "size is defined by Matrix:TwoDimension = \"{}\".", locAlphaArgs(8), @@ -6886,22 +5808,19 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereError( - state, format("{}{}=\"{}\", object. Invalid BSDF matrix dimensions.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( - state, format("Visible front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(8))); + ShowSevereCustomMessage( + state, + eoh, + format("Visible front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(8))); } thisConstruct.BSDFInput.VisFrtTrans.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.VisFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError( - state, format("Visible front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(8))); + ShowSevereCustomMessage( + state, + eoh, + format("Visible front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(8))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.VisFrtTransIndex, state.dataBSDFWindow->BSDFTempMtrx); thisConstruct.BSDFInput.VisFrtTrans = 0.0; @@ -6920,11 +5839,9 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{}=\"{}, object. Illegal matrix size has been found.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( + ShowSevereCustomMessage( state, + eoh, format("Visible back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " "size is defined by Matrix:TwoDimension = \"{}\".", locAlphaArgs(9), @@ -6933,22 +5850,15 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereError( - state, format("{}{}=\"{}\", object. Invalid BSDF matrix dimensions.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError( - state, format("Visible back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(9))); + ShowSevereCustomMessage( + state, eoh, format("Visible back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(9))); } thisConstruct.BSDFInput.VisBkRefl.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.VisBkReflIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError( - state, format("Visible back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(9))); + ShowSevereCustomMessage( + state, eoh, format("Visible back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(9))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.VisBkReflIndex, state.dataBSDFWindow->BSDFTempMtrx); thisConstruct.BSDFInput.VisBkRefl = 0.0; @@ -6984,28 +5894,25 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{} = \"{}\", object. Incorrect matrix dimension.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustomMessage(state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{} = \"{}\", object. Incorrect matrix dimension.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " - "as it is defined by basis matrix.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); - ShowContinueError( + ShowSevereCustomMessage( state, - format("Matrix has {} number of columns, while basis definition specifies {} number of columns.", NumCols, NBasis)); + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " + "as it is defined by basis matrix." + "Matrix has {} number of columns, while basis definition specifies {} number of columns.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer, + NumCols, + NBasis)); } thisConstruct.BSDFInput.Layer(currentOpticalLayer).AbsNcols = NumCols; @@ -7013,15 +5920,12 @@ namespace HeatBalanceManager { if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError(state, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustomMessage( + state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, @@ -7039,43 +5943,37 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{} = \"{}\", object. Incorrect matrix dimension.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustomMessage(state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereError( - state, - format("{}{} = \"{}\", object. Incorrect matrix dimension.", RoutineName, locCurrentModuleObject, locAlphaArgs(1))); - ShowContinueError(state, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " - "it is defined by basis matrix.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); - ShowContinueError( + ShowSevereCustomMessage( state, - format("Matrix has {} number of columns, while basis definition specifies {} number of columns.", NumCols, NBasis)); + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " + "it is defined by basis matrix." + "Matrix has {} number of columns, while basis definition specifies {} number of columns.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer, + NumCols, + NBasis)); } thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbs.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { ErrorsFound = true; - ShowSevereError(state, - format("{}{}=\"{}, object. Referenced Matrix:TwoDimension is missing from the input file.", - RoutineName, - locCurrentModuleObject, - locAlphaArgs(1))); - ShowContinueError(state, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustomMessage( + state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, diff --git a/src/EnergyPlus/HeatBalanceManager.hh b/src/EnergyPlus/HeatBalanceManager.hh index a7faf3679ab..7b415723c7b 100644 --- a/src/EnergyPlus/HeatBalanceManager.hh +++ b/src/EnergyPlus/HeatBalanceManager.hh @@ -99,8 +99,6 @@ namespace HeatBalanceManager { void GetSiteAtmosphereData(EnergyPlusData &state, bool &ErrorsFound); - void GetWindowGlassSpectralData(EnergyPlusData &state, bool &ErrorsFound); // set to true if errors found in input - void GetConstructData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input void GetBuildingData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input @@ -175,12 +173,6 @@ namespace HeatBalanceManager { void CreateTCConstructions(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input - void SetupSimpleWindowGlazingSystem(EnergyPlusData &state, int &MaterNum); - - void SetupComplexFenestrationMaterialInput(EnergyPlusData &state, - int &MaterNum, // num of material items thus far - bool &ErrorsFound); - void SetupComplexFenestrationStateInput(EnergyPlusData &state, int &ConstrNum, // num of construction items thus far bool &ErrorsFound); @@ -201,7 +193,6 @@ struct HeatBalanceMgrData : BaseGlobalStruct bool ReportWarmupConvergenceFirstWarmupWrite = true; std::string CurrentModuleObject; // to assist in getting input - std::unordered_map UniqueMaterialNames; std::unordered_map UniqueConstructNames; // Real Variables for the Heat Balance Simulation @@ -244,7 +235,6 @@ struct HeatBalanceMgrData : BaseGlobalStruct { ManageHeatBalanceGetInputFlag = true; - UniqueMaterialNames.clear(); UniqueConstructNames.clear(); DoReport = false; ChangeSet = true; diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 10e2ed3df8a..3faf6e3dda9 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -87,6 +87,7 @@ #include #include #include +#include #include #include #include @@ -218,9 +219,10 @@ void ManageSurfaceHeatBalance(EnergyPlusData &state) void UpdateVariableAbsorptances(EnergyPlusData &state) { + auto &s_mat = state.dataMaterial; for (int surfNum : state.dataSurface->AllVaryAbsOpaqSurfaceList) { auto const &thisConstruct = state.dataConstruction->Construct(state.dataSurface->Surface(surfNum).Construction); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(1))); + auto const *thisMaterial = s_mat->materials(thisConstruct.LayerPoint(1)); assert(thisMaterial != nullptr); if (thisMaterial->absorpVarCtrlSignal == Material::VariableAbsCtrlSignal::Scheduled) { if (thisMaterial->absorpThermalVarSchedIdx > 0) { @@ -355,7 +357,7 @@ void InitSurfaceHeatBalance(EnergyPlusData &state) } } - // yujie: variable thermal solar absorptance overrides + // variable thermal solar absorptance overrides UpdateVariableAbsorptances(state); // Do the Begin Environment initializations @@ -1987,6 +1989,7 @@ void AllocateSurfaceHeatBalArrays(EnergyPlusData &state) } if (surface.Class == DataSurfaces::SurfaceClass::Window) { // CurrentModuleObject='Windows' + auto &surfShade = state.dataSurface->surfShades(loop); SetupOutputVariable(state, "Surface Shading Device Is On Time Fraction", Constant::Units::None, @@ -2004,7 +2007,7 @@ void AllocateSurfaceHeatBalArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Blind Slat Angle", Constant::Units::deg, - state.dataSurface->SurfWinSlatAngThisTSDeg(loop), + surfShade.blind.slatAngDeg, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surface.Name); @@ -2115,7 +2118,6 @@ void InitThermalAndFluxHistories(EnergyPlusData &state) // First do the "bulk" initializations of arrays sized to NumOfZones for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { - // TODO: Reinitializing this entire struct may cause diffs new (&state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum)) ZoneTempPredictorCorrector::ZoneHeatBalanceData(); // Initialize the Zone Humidity Ratio here so that it is available for EMPD implementations auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); @@ -2334,37 +2336,37 @@ void InitThermalAndFluxHistories(EnergyPlusData &state) void EvalOutsideMovableInsulation(EnergyPlusData &state) { // This subroutine determines whether or not outside movable insulation on opaque surfaces is present at the current time. + auto &s_mat = state.dataMaterial; for (int SurfNum : state.dataHeatBalSurf->SurfMovInsulIndexList) { Real64 MovInsulSchedVal = ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->SurfSchedMovInsulExt(SurfNum)); if (MovInsulSchedVal <= 0) { // Movable insulation not present at current time state.dataHeatBalSurf->SurfMovInsulExtPresent(SurfNum) = false; int ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); - auto const *thisMaterial = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))); - assert(thisMaterial != nullptr); + auto const *thisMaterial = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)); state.dataHeatBalSurf->SurfAbsSolarExt(SurfNum) = thisMaterial->AbsorpSolar; state.dataHeatBalSurf->SurfAbsThermalExt(SurfNum) = thisMaterial->AbsorpThermal; state.dataHeatBalSurf->SurfRoughnessExt(SurfNum) = thisMaterial->Roughness; continue; } - int const MaterialIndex(state.dataSurface->SurfMaterialMovInsulExt(SurfNum)); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(MaterialIndex)); - assert(thisMaterial != nullptr); - Material::Group const MaterialGroupNum(state.dataMaterial->Material(MaterialIndex)->group); + int const matNum = state.dataSurface->SurfMaterialMovInsulExt(SurfNum); + auto const *mat = s_mat->materials(matNum); state.dataHeatBalSurf->SurfMovInsulExtPresent(SurfNum) = true; - state.dataHeatBalSurf->SurfMovInsulHExt(SurfNum) = 1.0 / (MovInsulSchedVal * thisMaterial->Resistance); - if (MaterialGroupNum == Material::Group::WindowGlass || MaterialGroupNum == Material::Group::GlassEquivalentLayer) { - state.dataHeatBalSurf->SurfAbsSolarExt(SurfNum) = max(0.0, 1.0 - thisMaterial->Trans - thisMaterial->ReflectSolBeamFront); + state.dataHeatBalSurf->SurfMovInsulHExt(SurfNum) = 1.0 / (MovInsulSchedVal * mat->Resistance); + if (mat->group == Material::Group::Glass || mat->group == Material::Group::GlassEQL) { + auto const *matGlass = dynamic_cast(mat); + assert(matGlass != nullptr); + state.dataHeatBalSurf->SurfAbsSolarExt(SurfNum) = max(0.0, 1.0 - matGlass->Trans - matGlass->ReflectSolBeamFront); } else { - state.dataHeatBalSurf->SurfAbsSolarExt(SurfNum) = thisMaterial->AbsorpSolar; + state.dataHeatBalSurf->SurfAbsSolarExt(SurfNum) = mat->AbsorpSolar; } - state.dataHeatBalSurf->SurfAbsThermalExt(SurfNum) = thisMaterial->AbsorpThermal; - state.dataHeatBalSurf->SurfRoughnessExt(SurfNum) = thisMaterial->Roughness; + state.dataHeatBalSurf->SurfAbsThermalExt(SurfNum) = mat->AbsorpThermal; + state.dataHeatBalSurf->SurfRoughnessExt(SurfNum) = mat->Roughness; } } void EvalInsideMovableInsulation(EnergyPlusData &state) { + auto &s_mat = state.dataMaterial; // This subroutine determines whether or not inside movable insulation is present at the current time. for (int SurfNum : state.dataHeatBalSurf->SurfMovInsulIndexList) { Real64 MovInsulSchedVal = ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->SurfSchedMovInsulInt(SurfNum)); @@ -2376,18 +2378,20 @@ void EvalInsideMovableInsulation(EnergyPlusData &state) state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) = thisConstruct.InsideAbsorpThermal; continue; } - int const MaterialIndex(state.dataSurface->SurfMaterialMovInsulInt(SurfNum)); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(MaterialIndex)); - assert(thisMaterial != nullptr); - Material::Group const MaterialGroupNum(thisMaterial->group); + + int const matNum = state.dataSurface->SurfMaterialMovInsulInt(SurfNum); + auto const *mat = s_mat->materials(matNum); + state.dataHeatBalSurf->SurfMovInsulIntPresent(SurfNum) = true; - state.dataHeatBalSurf->SurfMovInsulHInt(SurfNum) = 1.0 / (MovInsulSchedVal * thisMaterial->Resistance); - if (MaterialGroupNum == Material::Group::WindowGlass || MaterialGroupNum == Material::Group::GlassEquivalentLayer) { - state.dataHeatBalSurf->SurfAbsSolarInt(SurfNum) = max(0.0, 1.0 - thisMaterial->Trans - thisMaterial->ReflectSolBeamFront); + state.dataHeatBalSurf->SurfMovInsulHInt(SurfNum) = 1.0 / (MovInsulSchedVal * mat->Resistance); + if (mat->group == Material::Group::Glass || mat->group == Material::Group::GlassEQL) { // Glass is insulating? + auto const *matGlass = dynamic_cast(mat); + assert(matGlass != nullptr); + state.dataHeatBalSurf->SurfAbsSolarInt(SurfNum) = max(0.0, 1.0 - matGlass->Trans - matGlass->ReflectSolBeamFront); } else { - state.dataHeatBalSurf->SurfAbsSolarInt(SurfNum) = thisMaterial->AbsorpSolar; + state.dataHeatBalSurf->SurfAbsSolarInt(SurfNum) = mat->AbsorpSolar; } - state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) = thisMaterial->AbsorpThermal; + state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) = mat->AbsorpThermal; } } @@ -2419,6 +2423,7 @@ void InitSolarHeatGains(EnergyPlusData &state) // REFERENCES: // (I)BLAST legacy routine QSUN + auto &s_mat = state.dataMaterial; auto &Surface = state.dataSurface->Surface; // Using/Aliasing @@ -2429,6 +2434,7 @@ void InitSolarHeatGains(EnergyPlusData &state) using SolarShading::SurfaceScheduledSolarInc; using SolarShading::WindowScheduledSolarAbs; + // Why are these globals? auto &AbsDiffWin = state.dataHeatBalSurfMgr->AbsDiffWin; auto &AbsDiffWinGnd = state.dataHeatBalSurfMgr->AbsDiffWinGnd; auto &AbsDiffWinSky = state.dataHeatBalSurfMgr->AbsDiffWinSky; @@ -3074,57 +3080,38 @@ void InitSolarHeatGains(EnergyPlusData &state) state.dataHeatBalSurfMgr->AbsDiffWin(Lay) = constructionSh.AbsDiff(Lay); } state.dataSurface->SurfWinExtDiffAbsByShade(SurfNum) = constructionSh.AbsDiffShade * (SkySolarInc + GndSolarInc); + } else if (ANY_BLIND(ShadeFlag)) { // Blind on - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(SurfNum); - Real64 SurfWinSlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum); + auto &surfShade = state.dataSurface->surfShades(SurfNum); + int slatIdxLo = surfShade.blind.slatAngIdxLo; + int slatIdxHi = surfShade.blind.slatAngIdxHi; + Real64 interpFac = surfShade.blind.slatAngInterpFac; Real64 AbsDiffBlind; - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - for (int Lay = 1; Lay <= TotGlassLay; ++Lay) { - AbsDiffWin(Lay) = General::Interp( - constructionSh.BlAbsDiff(SurfWinSlatsAngIndex, Lay), - constructionSh.BlAbsDiff(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1), Lay), - SurfWinSlatsAngInterpFac); - AbsDiffWinGnd(Lay) = General::Interp( - constructionSh.BlAbsDiffGnd(SurfWinSlatsAngIndex, Lay), - constructionSh.BlAbsDiffGnd(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1), Lay), - SurfWinSlatsAngInterpFac); - AbsDiffWinSky(Lay) = General::Interp( - constructionSh.BlAbsDiffSky(SurfWinSlatsAngIndex, Lay), - constructionSh.BlAbsDiffSky(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1), Lay), - SurfWinSlatsAngInterpFac); - } - AbsDiffBlind = - General::Interp(constructionSh.AbsDiffBlind(SurfWinSlatsAngIndex), - constructionSh.AbsDiffBlind(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - for (int Lay = 1; Lay <= TotGlassLay; ++Lay) { - state.dataHeatBalSurfMgr->AbsDiffWin(Lay) = constructionSh.BlAbsDiff(1, Lay); - state.dataHeatBalSurfMgr->AbsDiffWinGnd(Lay) = constructionSh.BlAbsDiffGnd(1, Lay); - state.dataHeatBalSurfMgr->AbsDiffWinSky(Lay) = constructionSh.BlAbsDiffSky(1, Lay); - } - AbsDiffBlind = constructionSh.AbsDiffBlind(1); + + // For constructions, have to do interpolation wheather we have movable slats or not + for (int Lay = 1; Lay <= TotGlassLay; ++Lay) { + auto const &dfAbsSlatLo = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxLo]; + auto const &dfAbsSlatHi = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxHi]; + + AbsDiffWin(Lay) = Interp(dfAbsSlatLo.Sol.Ft.Df.Abs, dfAbsSlatHi.Sol.Ft.Df.Abs, interpFac); + AbsDiffWinGnd(Lay) = Interp(dfAbsSlatLo.Sol.Ft.Df.AbsGnd, dfAbsSlatHi.Sol.Ft.Df.AbsGnd, interpFac); + AbsDiffWinSky(Lay) = Interp(dfAbsSlatLo.Sol.Ft.Df.AbsSky, dfAbsSlatHi.Sol.Ft.Df.AbsSky, interpFac); } + + auto const &tarSlatLo = constructionSh.blindTARs[slatIdxLo]; + auto const &tarSlatHi = constructionSh.blindTARs[slatIdxHi]; + AbsDiffBlind = Interp(tarSlatLo.Sol.Ft.Df.Abs, tarSlatHi.Sol.Ft.Df.Abs, interpFac); + state.dataSurface->SurfWinExtDiffAbsByShade(SurfNum) = AbsDiffBlind * (SkySolarInc + GndSolarInc); - if (state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).SlatOrientation == - DataWindowEquivalentLayer::Orientation::Horizontal) { + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + if (matBlind->SlatOrientation == DataWindowEquivalentLayer::Orientation::Horizontal) { Real64 ACosTlt = std::abs(Surface(SurfNum).CosTilt); - Real64 AbsDiffBlindGnd; - Real64 AbsDiffBlindSky; - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - AbsDiffBlindGnd = General::Interp( - constructionSh.AbsDiffBlindGnd(SurfWinSlatsAngIndex), - constructionSh.AbsDiffBlindGnd(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - AbsDiffBlindSky = General::Interp( - constructionSh.AbsDiffBlindSky(SurfWinSlatsAngIndex), - constructionSh.AbsDiffBlindSky(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - AbsDiffBlindGnd = constructionSh.AbsDiffBlindGnd(1); - AbsDiffBlindSky = constructionSh.AbsDiffBlindSky(1); - } + + // Need to do these interpolations unless we want to cache this in surfShade.blind. + Real64 AbsDiffBlindGnd = Interp(tarSlatLo.Sol.Ft.Df.AbsGnd, tarSlatHi.Sol.Ft.Df.AbsGnd, interpFac); + Real64 AbsDiffBlindSky = Interp(tarSlatLo.Sol.Ft.Df.AbsSky, tarSlatHi.Sol.Ft.Df.AbsSky, interpFac); + state.dataSurface->SurfWinExtDiffAbsByShade(SurfNum) = SkySolarInc * (0.5 * ACosTlt * AbsDiffBlindGnd + (1.0 - 0.5 * ACosTlt) * AbsDiffBlindSky) + GndSolarInc * ((1.0 - 0.5 * ACosTlt) * AbsDiffBlindGnd + 0.5 * ACosTlt * AbsDiffBlindSky); @@ -3156,26 +3143,21 @@ void InitSolarHeatGains(EnergyPlusData &state) if (ANY_BLIND(ShadeFlag)) { int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - if (state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).SlatOrientation == - DataWindowEquivalentLayer::Orientation::Horizontal) { + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + if (matBlind->SlatOrientation == DataWindowEquivalentLayer::Orientation::Horizontal) { + Real64 ACosTlt = std::abs(Surface(SurfNum).CosTilt); // Absolute value of cosine of surface tilt angle - Real64 AbsDiffGlassLayGnd; // System glass layer ground diffuse solar absorptance with blind on - Real64 AbsDiffGlassLaySky; // System glass layer sky diffuse solar absorptance with blind on - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - AbsDiffGlassLayGnd = General::Interp( - constructionSh.BlAbsDiffGnd(state.dataSurface->SurfWinSlatsAngIndex(SurfNum), Lay), - constructionSh.BlAbsDiffGnd( - std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1), Lay), - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - AbsDiffGlassLaySky = General::Interp( - constructionSh.BlAbsDiffSky(state.dataSurface->SurfWinSlatsAngIndex(SurfNum), Lay), - constructionSh.BlAbsDiffSky( - std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1), Lay), - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - } else { - AbsDiffGlassLayGnd = constructionSh.BlAbsDiffGnd(1, Lay); - AbsDiffGlassLaySky = constructionSh.BlAbsDiffSky(1, Lay); - } + + int slatIdxLo = surfShade.blind.slatAngIdxLo; + int slatIdxHi = surfShade.blind.slatAngIdxLo; + Real64 interpFac = surfShade.blind.slatAngInterpFac; + auto const &dfAbsSlatLo = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxLo]; + auto const &dfAbsSlatHi = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxHi]; + + Real64 AbsDiffGlassLayGnd = Interp(dfAbsSlatLo.Sol.Ft.Df.AbsGnd, dfAbsSlatHi.Sol.Ft.Df.AbsGnd, interpFac); + Real64 AbsDiffGlassLaySky = Interp(dfAbsSlatLo.Sol.Ft.Df.AbsSky, dfAbsSlatHi.Sol.Ft.Df.AbsSky, interpFac); + state.dataHeatBal->SurfWinQRadSWwinAbs(SurfNum, Lay) = SkySolarInc * (0.5 * ACosTlt * AbsDiffGlassLayGnd + (1.0 - 0.5 * ACosTlt) * AbsDiffGlassLaySky) + GndSolarInc * ((1.0 - 0.5 * ACosTlt) * AbsDiffGlassLayGnd + 0.5 * ACosTlt * AbsDiffGlassLaySky) + @@ -3403,7 +3385,7 @@ void InitSolarHeatGains(EnergyPlusData &state) // 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 = thisConstruct.LayerPoint(1); // Outer glass layer material number - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(MatNumGl)); + auto const *thisMaterial = dynamic_cast(s_mat->materials(MatNumGl)); assert(thisMaterial != nullptr); Real64 TransGl = thisMaterial->Trans; // Outer glass layer material number, switched construction Real64 ReflGl = thisMaterial->ReflectSolBeamFront; @@ -3413,8 +3395,7 @@ void InitSolarHeatGains(EnergyPlusData &state) if (ShadeFlag == DataSurfaces::WinShadingType::SwitchableGlazing) { // Switchable glazing auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); Real64 MatNumGlSh = constructionSh.LayerPoint(1); - auto const *thisMaterialSh = - dynamic_cast(state.dataMaterial->Material(MatNumGlSh)); + auto const *thisMaterialSh = dynamic_cast(s_mat->materials(MatNumGlSh)); assert(thisMaterialSh != nullptr); Real64 TransGlSh = thisMaterialSh->Trans; Real64 ReflGlSh = thisMaterialSh->ReflectSolBeamFront; @@ -3488,48 +3469,28 @@ void InitSolarHeatGains(EnergyPlusData &state) DivIncSolarInBm = BeamFaceInc * state.dataSurface->SurfWinProjCorrDivIn(SurfNum) * thisConstruct.TransDiff; DivIncSolarInDif = DifSolarFaceInc * state.dataSurface->SurfWinProjCorrDivIn(SurfNum) * thisConstruct.TransDiff; } + if (!ANY_EXTERIOR_SHADE_BLIND_SCREEN(ShadeFlag) && !ANY_BETWEENGLASS_SHADE_BLIND(ShadeFlag)) { // No exterior or between-glass shade, screen or blind state.dataSurface->SurfWinDividerQRadOutAbs(SurfNum) = DividerAbs * (DivIncSolarOutBm + DivIncSolarOutDif); state.dataSurface->SurfWinDividerQRadInAbs(SurfNum) = DividerAbs * (DivIncSolarInBm + DivIncSolarInDif); // Exterior shade, screen or blind + } else if (ShadeFlag == DataSurfaces::WinShadingType::ExtBlind) { // Exterior blind - int BlNum = state.dataSurface->SurfWinBlindNumber(SurfNum); - int SlatsAngIndexLower = state.dataSurface->SurfWinSlatsAngIndex(SurfNum); - int SlatsAngIndexUpper = std::min(Material::MaxProfAngs, SlatsAngIndexLower + 1); - Real64 SlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum); - - Real64 FrontDiffTrans; - Real64 TBlBmDif; // Blind diffuse-diffuse solar transmittance - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - FrontDiffTrans = General::Interp(state.dataMaterial->Blind(BlNum).SolFrontDiffDiffTrans(SlatsAngIndexLower), - state.dataMaterial->Blind(BlNum).SolFrontDiffDiffTrans(SlatsAngIndexUpper), - SlatsAngInterpFac); - TBlBmDif = Window::InterpProfSlat( - state.dataMaterial->Blind(BlNum).SolFrontBeamDiffTrans(SlatsAngIndexLower, - state.dataSurface->SurfWinProfAngIndex(SurfNum)), - state.dataMaterial->Blind(BlNum).SolFrontBeamDiffTrans(SlatsAngIndexUpper, - state.dataSurface->SurfWinProfAngIndex(SurfNum)), - state.dataMaterial->Blind(BlNum).SolFrontBeamDiffTrans( - SlatsAngIndexLower, - std::min(Material::MaxProfAngs, state.dataSurface->SurfWinProfAngIndex(SurfNum) + 1)), - state.dataMaterial->Blind(BlNum).SolFrontBeamDiffTrans( - SlatsAngIndexUpper, - std::min(Material::MaxProfAngs, state.dataSurface->SurfWinProfAngIndex(SurfNum) + 1)), - SlatsAngInterpFac, - state.dataSurface->SurfWinProfAngInterpFac(SurfNum)); - } else { - FrontDiffTrans = state.dataMaterial->Blind(BlNum).SolFrontDiffDiffTrans(1); - TBlBmDif = General::Interp( - state.dataMaterial->Blind(BlNum).SolFrontBeamDiffTrans(1, - state.dataSurface->SurfWinProfAngIndex(SurfNum)), - state.dataMaterial->Blind(BlNum).SolFrontBeamDiffTrans( - 1, std::min(Material::MaxProfAngs, state.dataSurface->SurfWinProfAngIndex(SurfNum) + 1)), - SlatsAngInterpFac); - } + auto &surfShade = state.dataSurface->surfShades(SurfNum); + + int profIdxLo = surfShade.blind.profAngIdxLo; + int profIdxHi = surfShade.blind.profAngIdxHi; + Real64 profInterpFac = surfShade.blind.profAngInterpFac; + + auto const &btarLo = surfShade.blind.TAR.Sol.Ft.Bm[profIdxLo]; + auto const &btarHi = surfShade.blind.TAR.Sol.Ft.Bm[profIdxHi]; + + Real64 FrontDiffTrans = surfShade.blind.TAR.Sol.Ft.Df.Tra; + Real64 TBlBmDif = Interp(btarLo.DfTra, btarHi.DfTra, profInterpFac); // TBlBmBm - Blind beam-beam solar transmittance - Real64 TBlBmBm = state.dataSurface->SurfWinBlindBmBmTrans(SurfNum); + Real64 TBlBmBm = surfShade.blind.bmBmTrans; state.dataSurface->SurfWinDividerQRadOutAbs(SurfNum) = DividerAbs * (DivIncSolarOutBm * (TBlBmBm + TBlBmDif) + DivIncSolarOutDif * FrontDiffTrans); state.dataSurface->SurfWinDividerQRadInAbs(SurfNum) = @@ -3538,18 +3499,16 @@ void InitSolarHeatGains(EnergyPlusData &state) } else if (ShadeFlag == DataSurfaces::WinShadingType::ExtShade) { // Exterior shade int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - - auto const *thisMaterial = - dynamic_cast(state.dataMaterial->Material(constructionSh.LayerPoint(1))); - assert(thisMaterial != nullptr); + auto const *matFen = dynamic_cast(s_mat->materials(constructionSh.LayerPoint(1))); + assert(matFen != nullptr); state.dataSurface->SurfWinDividerQRadOutAbs(SurfNum) = - DividerAbs * thisMaterial->Trans * (DivIncSolarOutBm + DivIncSolarOutDif); + DividerAbs * matFen->Trans * (DivIncSolarOutBm + DivIncSolarOutDif); state.dataSurface->SurfWinDividerQRadInAbs(SurfNum) = - DividerAbs * thisMaterial->Trans * (DivIncSolarInBm + DivIncSolarInDif); + DividerAbs * matFen->Trans * (DivIncSolarInBm + DivIncSolarInDif); } else if (ShadeFlag == DataSurfaces::WinShadingType::ExtScreen) { // Exterior screen int screenNum = surfWin.screenNum; - auto const *screen = dynamic_cast(state.dataMaterial->Material(screenNum)); + auto const *screen = dynamic_cast(s_mat->materials(screenNum)); assert(screen != nullptr); auto &surf = state.dataSurface->Surface(SurfNum); @@ -3558,7 +3517,7 @@ void InitSolarHeatGains(EnergyPlusData &state) surf.Tilt * Constant::DegToRad, surf.Azimuth * Constant::DegToRad, state.dataEnvrn->SOLCOS, phi, theta); #ifdef PRECALC_INTERP_SCREEN int ip1, ip2, it1, it2; // hi/lo phi and theta map indices - General::BilinearInterpCoeffs coeffs; + BilinearInterpCoeffs coeffs; Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); GetBilinearInterpCoeffs( phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); @@ -3723,6 +3682,7 @@ void InitIntSolarDistribution(EnergyPlusData &state) using Dayltg::DistributeTDDAbsorbedSolar; using namespace DataWindowEquivalentLayer; + auto &s_mat = state.dataMaterial; // COMPUTE TOTAL SHORT-WAVE RADIATION ORIGINATING IN ZONE. // Note: If sun is not up, QS is only internal gains for (int enclosureNum = 1; enclosureNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclosureNum) { @@ -3818,20 +3778,19 @@ void InitIntSolarDistribution(EnergyPlusData &state) if (state.dataSurface->AnyMovableInsulation && state.dataHeatBalSurf->SurfMovInsulExtPresent(SurfNum)) { // Movable outside insulation in place Real64 AbsExt = state.dataHeatBalSurf->SurfAbsSolarExt(SurfNum); - auto const *thisMaterial = - dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(1))); - assert(thisMaterial != nullptr); + auto const *thisMaterial = s_mat->materials(thisConstruct.LayerPoint(1)); state.dataHeatBalSurf->SurfQRadSWOutMvIns(SurfNum) = state.dataHeatBalSurf->SurfOpaqQRadSWOutAbs(SurfNum) * AbsExt / thisMaterial->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. - state.dataHeatBalSurf->SurfOpaqQRadSWOutAbs(SurfNum) = - dynamic_cast( - state.dataMaterial->Material(state.dataSurface->SurfMaterialMovInsulExt(SurfNum))) - ->Trans * - state.dataHeatBalSurf->SurfQRadSWOutMvIns(SurfNum) * ((thisMaterial->AbsorpSolar / AbsExt) + (1 - thisMaterial->AbsorpSolar)); + auto const *matMovInsul = s_mat->materials(state.dataSurface->SurfMaterialMovInsulExt(SurfNum)); + auto const *matFenMovInsul = dynamic_cast(matMovInsul); + Real64 transMovInsul = (matFenMovInsul != nullptr) ? matFenMovInsul->Trans : 0.0; + + state.dataHeatBalSurf->SurfOpaqQRadSWOutAbs(SurfNum) = transMovInsul * state.dataHeatBalSurf->SurfQRadSWOutMvIns(SurfNum) * + ((thisMaterial->AbsorpSolar / AbsExt) + (1 - thisMaterial->AbsorpSolar)); } // RJH 08/30/07 - Add SurfWinInitialDifSolInAbs, SurfWinInitialDifSolwinAbs, and SurfWinInitialDifSolAbsByShade // calced in CalcWinTransDifSolInitialDistribution to SurfOpaqQRadSWInAbs, SurfWinQRadSWwinAbs, and SurfWinIntSWAbsByShade here @@ -3881,58 +3840,45 @@ void InitIntSolarDistribution(EnergyPlusData &state) } } else if (ConstrNumSh != 0 && ShadeFlag != DataSurfaces::WinShadingType::SwitchableGlazing) { // Interior, exterior or between-glass shade, screen or blind in place - auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - for (int IGlass = 1; IGlass <= constructionSh.TotGlassLayers; ++IGlass) { + auto const &constrSh = state.dataConstruction->Construct(ConstrNumSh); + for (int IGlass = 1; IGlass <= constrSh.TotGlassLayers; ++IGlass) { if (DataSurfaces::ANY_SHADE_SCREEN(ShadeFlag)) { state.dataHeatBal->SurfWinQRadSWwinAbs(SurfNum, IGlass) += - state.dataHeatBal->EnclSolQSWRad(solEnclosureNum) * constructionSh.AbsDiffBack(IGlass); + state.dataHeatBal->EnclSolQSWRad(solEnclosureNum) * constrSh.AbsDiffBack(IGlass); } else if (ShadeFlag == DataSurfaces::WinShadingType::IntBlind || ShadeFlag == DataSurfaces::WinShadingType::ExtBlind) { - Real64 BlAbsDiffBk; // Glass layer back diffuse solar absorptance when blind in place - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - BlAbsDiffBk = General::Interp( - constructionSh.BlAbsDiffBack(state.dataSurface->SurfWinSlatsAngIndex(SurfNum), IGlass), - constructionSh.BlAbsDiffBack( - std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1), IGlass), - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - } else { - BlAbsDiffBk = constructionSh.BlAbsDiffBack(1, IGlass); - } + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + Real64 interpFac = surfShade.blind.slatAngInterpFac; + auto const &dfAbsSlatLo = constrSh.layerSlatBlindDfAbs(IGlass)[surfShade.blind.slatAngIdxLo]; + auto const &dfAbsSlatHi = constrSh.layerSlatBlindDfAbs(IGlass)[surfShade.blind.slatAngIdxHi]; + // Glass layer back diffuse solar absorptance when blind in place + Real64 BlAbsDiffBk = Interp(dfAbsSlatLo.Sol.Bk.Df.Abs, dfAbsSlatHi.Sol.Bk.Df.Abs, interpFac); + state.dataHeatBal->SurfWinQRadSWwinAbs(SurfNum, IGlass) += state.dataHeatBal->EnclSolQSWRad(solEnclosureNum) * BlAbsDiffBk; } } if (ShadeFlag == DataSurfaces::WinShadingType::IntShade) { state.dataSurface->SurfWinIntLWAbsByShade(SurfNum) = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad * - constructionSh.ShadeAbsorpThermal * + constrSh.ShadeAbsorpThermal * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult; } else if (ShadeFlag == DataSurfaces::WinShadingType::IntBlind) { - Real64 EffBlEmiss; // Blind emissivity (thermal absorptance) as part of glazing system - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - EffBlEmiss = General::Interp( - state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[state.dataSurface->SurfWinSlatsAngIndex(SurfNum)], - state.dataSurface->SurfaceWindow(SurfNum) - .EffShBlindEmiss[std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1)], - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - } else { - EffBlEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[1]; - } + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + Real64 EffBlEmiss = surfShade.effShadeEmi; // Blind emissivity (thermal absorptance) as part of glazing system state.dataSurface->SurfWinIntLWAbsByShade(SurfNum) = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad * EffBlEmiss * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult; } + if (DataSurfaces::ANY_SHADE_SCREEN(ShadeFlag)) { state.dataSurface->SurfWinIntSWAbsByShade(SurfNum) = - state.dataHeatBal->EnclSolQSWRad(solEnclosureNum) * constructionSh.AbsDiffBackShade; + state.dataHeatBal->EnclSolQSWRad(solEnclosureNum) * constrSh.AbsDiffBackShade; } else if (DataSurfaces::ANY_BLIND(ShadeFlag)) { - Real64 AbsDiffBkBl; - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - AbsDiffBkBl = General::Interp(constructionSh.AbsDiffBackBlind(state.dataSurface->SurfWinSlatsAngIndex(SurfNum)), - constructionSh.AbsDiffBackBlind(std::min( - Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1)), - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - } else { - AbsDiffBkBl = constructionSh.AbsDiffBackBlind(1); - } + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + auto const &btarLo = constrSh.blindTARs[surfShade.blind.slatAngIdxLo]; + auto const &btarHi = constrSh.blindTARs[surfShade.blind.slatAngIdxHi]; + Real64 interpFac = surfShade.blind.slatAngInterpFac; + Real64 AbsDiffBkBl = Interp(btarLo.Sol.Bk.Df.Abs, btarHi.Sol.Bk.Df.Abs, interpFac); + state.dataSurface->SurfWinIntSWAbsByShade(SurfNum) = state.dataHeatBal->EnclSolQSWRad(solEnclosureNum) * AbsDiffBkBl; } // Correct for divider shadowing @@ -3968,7 +3914,7 @@ void InitIntSolarDistribution(EnergyPlusData &state) if (state.dataSurface->SurfWinDividerType(SurfNum) == DataSurfaces::FrameDividerType::Suspended) { // Suspended divider; account for inside glass Real64 MatNumGl = thisConstruct.LayerPoint(thisConstruct.TotLayers); // Glass layer material number - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(MatNumGl)); + auto const *thisMaterial = dynamic_cast(s_mat->materials(MatNumGl)); assert(thisMaterial != nullptr); Real64 TransGl = thisMaterial->Trans; // Glass layer solar transmittance, reflectance, absorptance Real64 ReflGl = thisMaterial->ReflectSolBeamBack; @@ -3981,28 +3927,16 @@ void InitIntSolarDistribution(EnergyPlusData &state) if (ShadeFlag == DataSurfaces::WinShadingType::IntShade) { auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); int MatNumSh = constructionSh.LayerPoint(constructionSh.TotLayers); // Shade layer material number - auto const *thisMaterialSh = dynamic_cast(state.dataMaterial->Material(MatNumSh)); - DividerSolAbs *= thisMaterialSh->Trans; - DividerThermAbs *= thisMaterialSh->TransThermal; + auto const *matSh = dynamic_cast(s_mat->materials(MatNumSh)); + assert(matSh != nullptr); + DividerSolAbs *= matSh->Trans; + DividerThermAbs *= matSh->TransThermal; + } else if (ShadeFlag == DataSurfaces::WinShadingType::IntBlind) { - int BlNum = state.dataSurface->SurfWinBlindNumber(SurfNum); - Real64 SolBackDiffDiffTrans; - Real64 IRBackTrans; - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(SurfNum); - Real64 SurfWinSlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum); - SolBackDiffDiffTrans = General::Interp( - state.dataMaterial->Blind(BlNum).SolBackDiffDiffTrans(SurfWinSlatsAngIndex), - state.dataMaterial->Blind(BlNum).SolBackDiffDiffTrans(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - IRBackTrans = General::Interp( - state.dataMaterial->Blind(BlNum).IRBackTrans(SurfWinSlatsAngIndex), - state.dataMaterial->Blind(BlNum).IRBackTrans(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - SolBackDiffDiffTrans = state.dataMaterial->Blind(BlNum).SolBackDiffDiffTrans(1); - IRBackTrans = state.dataMaterial->Blind(BlNum).IRBackTrans(1); - } + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + Real64 SolBackDiffDiffTrans = surfShade.blind.TAR.Sol.Bk.Df.Tra; + Real64 IRBackTrans = surfShade.blind.TAR.IR.Bk.Tra; + DividerSolAbs *= SolBackDiffDiffTrans; DividerThermAbs *= IRBackTrans; } @@ -4132,6 +4066,7 @@ void ComputeIntThermalAbsorpFactors(EnergyPlusData &state) // REFERENCES: // BLAST Routine: CITAF - Compute Interior Thermal Absorption Factors + auto &s_mat = state.dataMaterial; for (auto const &thisEnclosure : state.dataViewFactor->EnclRadInfo) { if (!thisEnclosure.radReCalc) continue; @@ -4142,9 +4077,8 @@ void ComputeIntThermalAbsorpFactors(EnergyPlusData &state) for (int SurfNum = firstSurfWin; SurfNum <= lastSurfWin; ++SurfNum) { DataSurfaces::WinShadingType ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); if (DataSurfaces::ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) { - Real64 BlindEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[1]; - Real64 GlassEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[1]; - state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) = BlindEmiss + GlassEmiss; + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) = surfShade.effShadeEmi + surfShade.effGlassEmi; } else { int ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) = state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal; @@ -4156,22 +4090,10 @@ void ComputeIntThermalAbsorpFactors(EnergyPlusData &state) for (int SurfNum : state.dataHeatBalSurf->SurfMovSlatsIndexList) { // For window with an interior shade or blind, emissivity is a combination of glass and shade/blind emissivity DataSurfaces::WinShadingType ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); + // Not sure we need to do this anymore if (DataSurfaces::ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) { - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - Real64 BlindEmiss; - Real64 GlassEmiss; - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(SurfNum); - Real64 SurfWinSlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum); - BlindEmiss = General::Interp( - state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[SurfWinSlatsAngIndex], - state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)], - SurfWinSlatsAngInterpFac); - GlassEmiss = General::Interp( - state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[SurfWinSlatsAngIndex], - state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)], - SurfWinSlatsAngInterpFac); - state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) = BlindEmiss + GlassEmiss; - } + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) = surfShade.effShadeEmi + surfShade.effGlassEmi; } } } @@ -4180,16 +4102,16 @@ void ComputeIntThermalAbsorpFactors(EnergyPlusData &state) if (!thisRadEnclosure.radReCalc) continue; Real64 SUM1 = 0.0; for (int const SurfNum : thisRadEnclosure.SurfacePtr) { - auto &thisSurf = state.dataSurface->Surface(SurfNum); - int const ConstrNum = thisSurf.Construction; + auto &surf = state.dataSurface->Surface(SurfNum); + int const ConstrNum = surf.Construction; auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); DataSurfaces::WinShadingType ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); if (ShadeFlag != DataSurfaces::WinShadingType::SwitchableGlazing) { - SUM1 += thisSurf.Area * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); + SUM1 += surf.Area * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } else { // Switchable glazing - SUM1 += thisSurf.Area * Window::InterpSw(state.dataSurface->SurfWinSwitchingFactor(SurfNum), - thisConstruct.InsideAbsorpThermal, - state.dataConstruction->Construct(thisSurf.activeShadedConstruction).InsideAbsorpThermal); + SUM1 += surf.Area * Window::InterpSw(state.dataSurface->SurfWinSwitchingFactor(SurfNum), + thisConstruct.InsideAbsorpThermal, + state.dataConstruction->Construct(surf.activeShadedConstruction).InsideAbsorpThermal); } // Window frame and divider effects @@ -4203,31 +4125,22 @@ void ComputeIntThermalAbsorpFactors(EnergyPlusData &state) DividerThermAbs = thisConstruct.InsideAbsorpThermal; if (DataSurfaces::ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) { // Interior shade or blind in place - int const ConstrNumSh = thisSurf.activeShadedConstruction; + int const ConstrNumSh = surf.activeShadedConstruction; auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); if (state.dataSurface->SurfWinHasShadeOrBlindLayer(SurfNum)) { + auto const &surfShade = state.dataSurface->surfShades(SurfNum); // Shade layer material number int MatNumSh = constructionSh.LayerPoint(constructionSh.TotLayers); + auto const *matSh = dynamic_cast(s_mat->materials(MatNumSh)); + assert(matSh != nullptr); // Shade or blind IR transmittance - Real64 TauShIR = dynamic_cast(state.dataMaterial->Material(MatNumSh))->TransThermal; + Real64 TauShIR = matSh->TransThermal; // Effective emissivity of shade or blind - Real64 EffShDevEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[1]; + Real64 EffShDevEmiss = surfShade.effShadeEmi; + if (ShadeFlag == DataSurfaces::WinShadingType::IntBlind) { - TauShIR = state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).IRBackTrans(1); - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(SurfNum); - Real64 SurfWinSlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum); - TauShIR = General::Interp( - state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).IRBackTrans(SurfWinSlatsAngIndex), - state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)) - .IRBackTrans(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - EffShDevEmiss = General::Interp(state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[SurfWinSlatsAngIndex], - state.dataSurface->SurfaceWindow(SurfNum) - .EffShBlindEmiss[std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)], - SurfWinSlatsAngInterpFac); - } + TauShIR = surfShade.blind.TAR.IR.Bk.Tra; } SUM1 += state.dataSurface->SurfWinDividerArea(SurfNum) * (EffShDevEmiss + DividerThermAbs * TauShIR); } else { @@ -4278,6 +4191,8 @@ void ComputeIntSWAbsorpFactors(EnergyPlusData &state) // Avoid a division by zero of the user has entered a bunch of surfaces with zero absorptivity on the inside Real64 constexpr SmallestAreaAbsProductAllowed(0.01); + auto &s_mat = state.dataMaterial; + for (auto &thisSolEnclosure : state.dataViewFactor->EnclSolInfo) { if (!thisSolEnclosure.radReCalc) continue; Real64 SUM1 = 0.0; // Intermediate calculation value for solar absorbed and transmitted @@ -4306,27 +4221,23 @@ void ComputeIntSWAbsorpFactors(EnergyPlusData &state) // Window with shade, screen or blind if (ConstrNumSh != 0) { - auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); + auto const &constrSh = state.dataConstruction->Construct(ConstrNumSh); if (DataSurfaces::ANY_SHADE_SCREEN(ShadeFlag)) { - AbsDiffLayWin = constructionSh.AbsDiffBack(Lay); + AbsDiffLayWin = constrSh.AbsDiffBack(Lay); } else if (DataSurfaces::ANY_BLIND(ShadeFlag)) { - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - AbsDiffLayWin = General::Interp( - constructionSh.BlAbsDiffBack(state.dataSurface->SurfWinSlatsAngIndex(SurfNum), Lay), - constructionSh.BlAbsDiffBack( - std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1), Lay), - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - } else { - AbsDiffLayWin = constructionSh.BlAbsDiffBack(1, Lay); - } + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + auto const &dfAbsSlatLo = constrSh.layerSlatBlindDfAbs(Lay)[surfShade.blind.slatAngIdxLo]; + auto const &dfAbsSlatHi = constrSh.layerSlatBlindDfAbs(Lay)[surfShade.blind.slatAngIdxHi]; + Real64 interpFac = surfShade.blind.slatAngInterpFac; + AbsDiffLayWin = Interp(dfAbsSlatLo.Sol.Bk.Df.Abs, dfAbsSlatHi.Sol.Bk.Df.Abs, interpFac); } } // Switchable glazing if (ShadeFlag == DataSurfaces::WinShadingType::SwitchableGlazing) { assert(ConstrNumSh > 0); // Should this be included in the if above - auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - AbsDiffLayWin = Window::InterpSw(SwitchFac, AbsDiffLayWin, constructionSh.AbsDiffBack(Lay)); + auto const &constrSh = state.dataConstruction->Construct(ConstrNumSh); + AbsDiffLayWin = Window::InterpSw(SwitchFac, AbsDiffLayWin, constrSh.AbsDiffBack(Lay)); } AbsDiffTotWin += AbsDiffLayWin; } @@ -4337,25 +4248,17 @@ void ComputeIntSWAbsorpFactors(EnergyPlusData &state) // Window with shade, screen or blind if (ConstrNumSh != 0) { - auto &constructionSh = state.dataConstruction->Construct(ConstrNumSh); + auto &constrSh = state.dataConstruction->Construct(ConstrNumSh); if (ANY_SHADE_SCREEN(ShadeFlag)) { - TransDiffWin = constructionSh.TransDiff; - DiffAbsShade = constructionSh.AbsDiffBackShade; + TransDiffWin = constrSh.TransDiff; + DiffAbsShade = constrSh.AbsDiffBackShade; } else if (ANY_BLIND(ShadeFlag)) { - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(SurfNum); - Real64 SurfWinSlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum); - TransDiffWin = General::Interp(constructionSh.BlTransDiff(SurfWinSlatsAngIndex), - constructionSh.BlTransDiff(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - DiffAbsShade = - General::Interp(constructionSh.AbsDiffBackBlind(SurfWinSlatsAngIndex), - constructionSh.AbsDiffBackBlind(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - TransDiffWin = constructionSh.BlTransDiff(1); - DiffAbsShade = constructionSh.AbsDiffBackBlind(1); - } + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + auto const &btarSlatLo = constrSh.blindTARs[surfShade.blind.slatAngIdxLo]; + auto const &btarSlatHi = constrSh.blindTARs[surfShade.blind.slatAngIdxHi]; + Real64 interpFac = surfShade.blind.slatAngInterpFac; + TransDiffWin = Interp(btarSlatLo.Sol.Ft.Df.Tra, btarSlatHi.Sol.Ft.Df.Tra, interpFac); + DiffAbsShade = Interp(btarSlatLo.Sol.Bk.Df.Abs, btarSlatHi.Sol.Bk.Df.Abs, interpFac); } } @@ -4379,7 +4282,7 @@ void ComputeIntSWAbsorpFactors(EnergyPlusData &state) if (state.dataSurface->SurfWinDividerType(SurfNum) == DataSurfaces::FrameDividerType::Suspended) { // Suspended (between-glass) divider: account for glass on inside of divider Real64 MatNumGl = thisConstruct.LayerPoint(thisConstruct.TotLayers); // Glass material number - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(MatNumGl)); + auto const *thisMaterial = dynamic_cast(s_mat->materials(MatNumGl)); assert(thisMaterial != nullptr); Real64 TransGl = thisMaterial->Trans; // Glass layer short-wave transmittance, reflectance, absorptance Real64 ReflGl = thisMaterial->ReflectSolBeamBack; @@ -4563,19 +4466,16 @@ void InitEMSControlledSurfaceProperties(EnergyPlusData &state) // update solar, thermal and visible absorptance values when actuated by EMS // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int MaterNum; // do loop counter over materials - int ConstrNum; // do loop counter over constructions int TotLayers; // count of material layers in a construction int InsideMaterNum; // integer pointer for inside face's material layer int OutsideMaterNum; // integer pointer for outside face's material layer + auto &s_mat = state.dataMaterial; + state.dataGlobal->AnySurfPropOverridesInModel = false; // first determine if anything needs to be done, once yes, then always init - for (auto const *matBase : state.dataMaterial->Material) { - if (matBase->group != Material::Group::Regular) continue; - - auto const *mat = dynamic_cast(matBase); - assert(mat != nullptr); + for (auto const *mat : s_mat->materials) { + if (mat->group != Material::Group::Regular) continue; if ((mat->AbsorpSolarEMSOverrideOn) || (mat->AbsorpThermalEMSOverrideOn) || (mat->AbsorpVisibleEMSOverrideOn)) { state.dataGlobal->AnySurfPropOverridesInModel = true; @@ -4586,11 +4486,9 @@ void InitEMSControlledSurfaceProperties(EnergyPlusData &state) if (!state.dataGlobal->AnySurfPropOverridesInModel) return; // quick return if nothing has ever needed to be done // first, loop over materials - for (auto *matBase : state.dataMaterial->Material) { - if (matBase->group != Material::Group::Regular) continue; - - auto *mat = dynamic_cast(matBase); - assert(mat != nullptr); + // why is this a second loop? + for (auto *mat : s_mat->materials) { + if (mat->group != Material::Group::Regular) continue; mat->AbsorpSolar = mat->AbsorpSolarEMSOverrideOn ? max(min(mat->AbsorpSolarEMSOverride, 0.9999), 0.0001) : mat->AbsorpSolarInput; mat->AbsorpThermal = mat->AbsorpThermalEMSOverrideOn ? max(min(mat->AbsorpThermalEMSOverride, 0.9999), 0.0001) : mat->AbsorpThermalInput; @@ -4604,7 +4502,7 @@ void InitEMSControlledSurfaceProperties(EnergyPlusData &state) if (TotLayers == 0) continue; // error condition InsideMaterNum = thisConstruct.LayerPoint(TotLayers); if (InsideMaterNum != 0) { - auto const *mat = state.dataMaterial->Material(InsideMaterNum); + auto const *mat = s_mat->materials(InsideMaterNum); thisConstruct.InsideAbsorpVis = mat->AbsorpVisible; thisConstruct.InsideAbsorpSolar = mat->AbsorpSolar; thisConstruct.InsideAbsorpThermal = mat->AbsorpThermal; @@ -4612,7 +4510,7 @@ void InitEMSControlledSurfaceProperties(EnergyPlusData &state) OutsideMaterNum = thisConstruct.LayerPoint(1); if (OutsideMaterNum != 0) { - auto const *mat = state.dataMaterial->Material(OutsideMaterNum); + auto const *mat = s_mat->materials(OutsideMaterNum); thisConstruct.OutsideAbsorpVis = mat->AbsorpVisible; thisConstruct.OutsideAbsorpSolar = mat->AbsorpSolar; thisConstruct.OutsideAbsorpThermal = mat->AbsorpThermal; @@ -5619,36 +5517,13 @@ void CalcThermalResilience(EnergyPlusData &state) // The heat index equation set is fit to Fahrenheit units, so the zone air temperature values are first convert to F, // then heat index is calculated and converted back to C. if (state.dataHeatBalSurfMgr->reportVarHeatIndex || state.dataOutRptTab->displayThermalResilienceSummary) { - // Constance for heat index regression equation of Rothfusz. - Real64 constexpr c1 = -42.379; - Real64 constexpr c2 = 2.04901523; - Real64 constexpr c3 = 10.14333127; - Real64 constexpr c4 = -.22475541; - Real64 constexpr c5 = -.00683783; - Real64 constexpr c6 = -.05481717; - Real64 constexpr c7 = .00122874; - Real64 constexpr c8 = .00085282; - Real64 constexpr c9 = -.00000199; for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { Real64 const ZoneT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZTAV; Real64 const ZoneW = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRatAvg; - Real64 const ZoneRH = Psychrometrics::PsyRhFnTdbWPb(state, ZoneT, ZoneW, state.dataEnvrn->OutBaroPress) * 100.0; + Real64 const ZoneRH = Psychrometrics::PsyRhFnTdbWPb(state, ZoneT, ZoneW, state.dataEnvrn->OutBaroPress); Real64 const ZoneTF = ZoneT * (9.0 / 5.0) + 32.0; - Real64 HI; - - if (ZoneTF < 80) { - HI = 0.5 * (ZoneTF + 61.0 + (ZoneTF - 68.0) * 1.2 + (ZoneRH * 0.094)); - } else { - HI = c1 + c2 * ZoneTF + c3 * ZoneRH + c4 * ZoneTF * ZoneRH + c5 * ZoneTF * ZoneTF + c6 * ZoneRH * ZoneRH + - c7 * ZoneTF * ZoneTF * ZoneRH + c8 * ZoneTF * ZoneRH * ZoneRH + c9 * ZoneTF * ZoneTF * ZoneRH * ZoneRH; - if (ZoneRH < 13 && ZoneTF < 112) { - HI -= (13 - ZoneRH) / 4 * std::sqrt((17 - abs(ZoneTF - 95)) / 17); - } else if (ZoneRH > 85 && ZoneTF < 87) { - HI += (ZoneRH - 85) / 10 * (87 - ZoneTF) / 5; - } - } - HI = (HI - 32.0) * (5.0 / 9.0); - state.dataHeatBal->Resilience(ZoneNum).ZoneHeatIndex = HI; + // calculate extended heat index + state.dataHeatBal->Resilience(ZoneNum).ZoneHeatIndex = ExtendedHI::heatindex(state, ZoneT + Constant::Kelvin, ZoneRH) - Constant::Kelvin; } } if (state.dataHeatBalSurfMgr->reportVarHumidex || state.dataOutRptTab->displayThermalResilienceSummary) { @@ -6843,20 +6718,22 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, // //>>>>>>> origin/develop // SUBROUTINE PARAMETER DEFINITIONS: - constexpr const char *RoutineNameGroundTemp("CalcHeatBalanceOutsideSurf:GroundTemp"); - constexpr const char *RoutineNameGroundTempFC("CalcHeatBalanceOutsideSurf:GroundTempFC"); - constexpr const char *RoutineNameOtherSideCoefNoCalcExt("CalcHeatBalanceOutsideSurf:OtherSideCoefNoCalcExt"); - constexpr const char *RoutineNameOtherSideCoefCalcExt("CalcHeatBalanceOutsideSurf:OtherSideCoefCalcExt"); - constexpr const char *RoutineNameOSCM("CalcHeatBalanceOutsideSurf:OSCM"); - constexpr const char *RoutineNameExtEnvWetSurf("CalcHeatBalanceOutsideSurf:extEnvWetSurf"); - constexpr const char *RoutineNameExtEnvDrySurf("CalcHeatBalanceOutsideSurf:extEnvDrySurf"); - constexpr const char *RoutineNameNoWind("CalcHeatBalanceOutsideSurf:nowind"); - constexpr const char *RoutineNameOther("CalcHeatBalanceOutsideSurf:interior/other"); - constexpr const char *RoutineNameIZPart("CalcHeatBalanceOutsideSurf:IZPart"); - constexpr const char *HBSurfManGroundHAMT("HBSurfMan:Ground:HAMT"); - constexpr const char *HBSurfManRainHAMT("HBSurfMan:Rain:HAMT"); - constexpr const char *HBSurfManDrySurfCondFD("HBSurfMan:DrySurf:CondFD"); - constexpr const char *Outside("Outside"); + constexpr std::string_view RoutineNameGroundTemp("CalcHeatBalanceOutsideSurf:GroundTemp"); + constexpr std::string_view RoutineNameGroundTempFC("CalcHeatBalanceOutsideSurf:GroundTempFC"); + constexpr std::string_view RoutineNameOtherSideCoefNoCalcExt("CalcHeatBalanceOutsideSurf:OtherSideCoefNoCalcExt"); + constexpr std::string_view RoutineNameOtherSideCoefCalcExt("CalcHeatBalanceOutsideSurf:OtherSideCoefCalcExt"); + constexpr std::string_view RoutineNameOSCM("CalcHeatBalanceOutsideSurf:OSCM"); + constexpr std::string_view RoutineNameExtEnvWetSurf("CalcHeatBalanceOutsideSurf:extEnvWetSurf"); + constexpr std::string_view RoutineNameExtEnvDrySurf("CalcHeatBalanceOutsideSurf:extEnvDrySurf"); + constexpr std::string_view RoutineNameNoWind("CalcHeatBalanceOutsideSurf:nowind"); + constexpr std::string_view RoutineNameOther("CalcHeatBalanceOutsideSurf:interior/other"); + constexpr std::string_view RoutineNameIZPart("CalcHeatBalanceOutsideSurf:IZPart"); + constexpr std::string_view HBSurfManGroundHAMT("HBSurfMan:Ground:HAMT"); + constexpr std::string_view HBSurfManRainHAMT("HBSurfMan:Rain:HAMT"); + constexpr std::string_view HBSurfManDrySurfCondFD("HBSurfMan:DrySurf:CondFD"); + constexpr std::string_view Outside("Outside"); + + auto &s_mat = state.dataMaterial; bool MovInsulErrorFlag = false; // Movable Insulation error flag @@ -7451,10 +7328,9 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, if (MovInsulErrorFlag) ShowFatalError(state, "CalcOutsideSurfTemp: Program terminates due to preceding conditions."); } } break; + case DataSurfaces::KivaFoundation: { - auto const *thisMaterial = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))); - assert(thisMaterial != nullptr); + auto const *thisMaterial = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)); Material::SurfaceRoughness RoughSurf = thisMaterial->Roughness; Real64 AbsThermSurf = thisMaterial->AbsorpThermal; @@ -7471,6 +7347,7 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, state.dataHeatBalSurf->SurfHAirExt(SurfNum), state.dataHeatBalSurf->SurfHSrdSurfExt(SurfNum)); } break; + default: { // for interior or other zone surfaces if (Surface(SurfNum).ExtBoundCond == SurfNum) { // Regular partition/internal mass @@ -7670,10 +7547,10 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, // REFERENCES: // (I)BLAST legacy routine HBSRF - constexpr const char *rhoAirZone("RhoAirZone"); - constexpr const char *wsurf("Wsurf"); - constexpr const char *HBSurfManInsideSurf("HB,SurfMan:InsideSurf"); - constexpr const char *Inside("Inside"); + constexpr std::string_view rhoAirZone("RhoAirZone"); + constexpr std::string_view wsurf("Wsurf"); + constexpr std::string_view HBSurfManInsideSurf("HB,SurfMan:InsideSurf"); + constexpr std::string_view Inside("Inside"); Real64 TempSurfOutTmp; // Local Temporary Surface temperature for the outside surface face Real64 SurfTempInSat; // Local temporary surface dew point temperature @@ -7682,6 +7559,7 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, Real64 RhoAirZone; // Zone moisture density for HAMT int OtherSideZoneNum; // Zone Number index for other side of an interzone partition HAMT + auto &s_mat = state.dataMaterial; // determine reference air temperatures for (int SurfNum : HTSurfs) { @@ -8083,7 +7961,7 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, ShowContinueError(state, format("Construction {} contains an internal source or sink but also uses", construct.Name)); ShowContinueError(state, format("interior movable insulation {} for a surface with that construction.", - state.dataMaterial->Material(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->Name)); + s_mat->materials(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->Name)); ShowContinueError(state, "This is not currently allowed because the heat balance equations do not currently accommodate " "this combination."); @@ -8178,8 +8056,7 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, // (HeatBalanceSurfaceManager USEing and WindowManager and // WindowManager USEing HeatBalanceSurfaceManager) if (surface.ExtBoundCond == DataSurfaces::ExternalEnvironment) { - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(construct.LayerPoint(1))); - assert(thisMaterial != nullptr); + auto const *thisMaterial = s_mat->materials(construct.LayerPoint(1)); Material::SurfaceRoughness RoughSurf = thisMaterial->Roughness; // Outside surface roughness Real64 EmisOut = thisMaterial->AbsorpThermalFront; // Glass outside surface emissivity DataSurfaces::WinShadingType const shading_flag(state.dataSurface->SurfWinShadingFlag(SurfNum)); @@ -8188,8 +8065,7 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, int const ConstrNumSh = surface.activeShadedConstruction; if (ConstrNumSh != 0) { auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - auto const *thisMaterial2 = - dynamic_cast(state.dataMaterial->Material(constructionSh.LayerPoint(1))); + auto const *thisMaterial2 = s_mat->materials(constructionSh.LayerPoint(1)); assert(thisMaterial2 != nullptr); RoughSurf = thisMaterial2->Roughness; EmisOut = thisMaterial2->AbsorpThermal; @@ -8467,7 +8343,9 @@ void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, // REFERENCES: // (I)BLAST legacy routine HBSRF - auto const &Surface = state.dataSurface->Surface; + + auto &s_mat = state.dataMaterial; + auto &Surface = state.dataSurface->Surface; constexpr std::string_view Inside("Inside"); @@ -8866,7 +8744,7 @@ void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, // (HeatBalanceSurfaceManager USEing and WindowManager and // WindowManager USEing HeatBalanceSurfaceManager) if (surface.ExtBoundCond == DataSurfaces::ExternalEnvironment) { - auto const *thisMaterial = state.dataMaterial->Material(construct.LayerPoint(1)); + auto const *thisMaterial = s_mat->materials(construct.LayerPoint(1)); assert(thisMaterial != nullptr); Material::SurfaceRoughness RoughSurf = thisMaterial->Roughness; // Outside surface roughness Real64 EmisOut = thisMaterial->AbsorpThermalFront; // Glass outside surface emissivity @@ -8876,7 +8754,7 @@ void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, int const ConstrNumSh = Surface(surfNum).activeShadedConstruction; if (ConstrNumSh != 0) { auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - auto const *thisMaterial2 = state.dataMaterial->Material(constructionSh.LayerPoint(1)); + auto const *thisMaterial2 = s_mat->materials(constructionSh.LayerPoint(1)); RoughSurf = thisMaterial2->Roughness; EmisOut = thisMaterial2->AbsorpThermal; } @@ -9282,6 +9160,8 @@ void CalcOutsideSurfTemp(EnergyPlusData &state, // 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 &s_mat = state.dataMaterial; + auto &surface = state.dataSurface->Surface(SurfNum); auto const &construct = state.dataConstruction->Construct(ConstrNum); if (construct.CTFCross[0] > 0.01) { @@ -9503,7 +9383,7 @@ void CalcOutsideSurfTemp(EnergyPlusData &state, ShowContinueError(state, format("Construction {} contains an internal source or sink but also uses", construct.Name)); ShowContinueError(state, format("exterior movable insulation {} for a surface with that construction.", - state.dataMaterial->Material(state.dataSurface->SurfMaterialMovInsulExt(SurfNum))->Name)); + s_mat->materials(state.dataSurface->SurfMaterialMovInsulExt(SurfNum))->Name)); ShowContinueError(state, "This is not currently allowed because the heat balance equations do not currently accommodate this combination."); ErrorFlag = true; diff --git a/src/EnergyPlus/HeatRecovery.cc b/src/EnergyPlus/HeatRecovery.cc index a870a72b73b..7fcd2cf1432 100644 --- a/src/EnergyPlus/HeatRecovery.cc +++ b/src/EnergyPlus/HeatRecovery.cc @@ -194,15 +194,15 @@ namespace HeatRecovery { // call the correct heat exchanger calculation routine switch (state.dataHeatRecovery->ExchCond(HeatExchNum).type) { - case HVAC::HXType::AirToAir_FlatPlate: + case HVAC::HXType::AirToAir_FlatPlate: { thisExch.CalcAirToAirPlateHeatExch(state, HXUnitOn, EconomizerFlag, HighHumCtrlFlag); - break; + } break; - case HVAC::HXType::AirToAir_Generic: + case HVAC::HXType::AirToAir_Generic: { thisExch.CalcAirToAirGenericHeatExch(state, HXUnitOn, FirstHVACIteration, fanOp, EconomizerFlag, HighHumCtrlFlag, HXPartLoadRatio); - break; + } break; - case HVAC::HXType::Desiccant_Balanced: + case HVAC::HXType::Desiccant_Balanced: { Real64 PartLoadRatio = present(HXPartLoadRatio) ? Real64(HXPartLoadRatio) : 1.0; // Part load ratio requested of DX compressor bool RegInIsOANode = present(RegenInletIsOANode) && bool(RegenInletIsOANode); thisExch.CalcDesiccantBalancedHeatExch(state, @@ -215,7 +215,11 @@ namespace HeatRecovery { RegInIsOANode, EconomizerFlag, HighHumCtrlFlag); - break; + } break; + + default: { + assert(false); + } break; } thisExch.UpdateHeatRecovery(state); @@ -513,7 +517,7 @@ namespace HeatRecovery { thisExchanger.EconoLockOut = static_cast(toggle); } - // yujie: read new curves here + // read new curves here thisExchanger.HeatEffectSensibleCurveIndex = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(11)); // convert curve name to number thisExchanger.HeatEffectLatentCurveIndex = diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.cc b/src/EnergyPlus/InputProcessing/InputProcessor.cc index cbbc4776a7c..e3f84d37aad 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.cc +++ b/src/EnergyPlus/InputProcessing/InputProcessor.cc @@ -1153,6 +1153,52 @@ int InputProcessor::getIDFObjNum(EnergyPlusData &state, std::string_view Object, return idfOrderNumber; } +std::vector InputProcessor::getIDFOrderedKeys(EnergyPlusData &state, std::string_view const Object) +{ + // Given the number (index) of an object in JSON order, return it's number in original idf order + std::vector keys; + std::vector nums; + + json *obj; + auto obj_iter = epJSON.find(std::string(Object)); + if (obj_iter == epJSON.end()) { + auto tmp_umit = caseInsensitiveObjectMap.find(convertToUpper(Object)); + if (tmp_umit == caseInsensitiveObjectMap.end()) { + return keys; + } + obj = &epJSON[tmp_umit->second]; + } else { + obj = &(obj_iter.value()); + } + + // Return names in JSON order + if (state.dataGlobal->isEpJSON || !state.dataGlobal->preserveIDFOrder) { + for (auto it = obj->begin(); it != obj->end(); ++it) + keys.emplace_back(it.key()); + + return keys; + } + + // Now, the real work begins + + for (auto it = obj->begin(); it != obj->end(); ++it) + nums.push_back(it.value()["idf_order"].get()); + std::sort(nums.begin(), nums.end()); + + // Reserve doesn't seem to work :( + for (int i = 0; i < (int)nums.size(); ++i) + keys.push_back(""); + + // get list of saved object numbers from idf processing + for (auto it = obj->begin(); it != obj->end(); ++it) { + int objNum = it.value()["idf_order"].get(); + int objIdx = std::find(nums.begin(), nums.end(), objNum) - nums.begin(); + keys[objIdx] = it.key(); + } + + return keys; +} + int InputProcessor::getJSONObjNum(EnergyPlusData &state, std::string const &Object, int const Number) { // Given the number (index) of an object in original idf order, return it's number in JSON order diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.hh b/src/EnergyPlus/InputProcessing/InputProcessor.hh index 3e63b53e4b3..548672f99c3 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.hh +++ b/src/EnergyPlus/InputProcessing/InputProcessor.hh @@ -154,6 +154,8 @@ public: int getIDFObjNum(EnergyPlusData &state, std::string_view Object, int const Number); + std::vector getIDFOrderedKeys(EnergyPlusData &state, std::string_view Object); + int getJSONObjNum(EnergyPlusData &state, std::string const &Object, int const Number); int getObjectItemNum(EnergyPlusData &state, diff --git a/src/EnergyPlus/IntegratedHeatPump.cc b/src/EnergyPlus/IntegratedHeatPump.cc index d96201cfbee..801d5d6707a 100644 --- a/src/EnergyPlus/IntegratedHeatPump.cc +++ b/src/EnergyPlus/IntegratedHeatPump.cc @@ -1605,8 +1605,6 @@ void ClearCoils(EnergyPlusData &state, int const DXCoilNum) { using VariableSpeedCoils::SimVariableSpeedCoils; - HVAC::FanOp fanOp = HVAC::FanOp::Cycling; // fan cycl manner place holder - // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered GetIHPInput(state); diff --git a/src/EnergyPlus/Material.cc b/src/EnergyPlus/Material.cc index 3ef174f1191..812ec2f07d9 100644 --- a/src/EnergyPlus/Material.cc +++ b/src/EnergyPlus/Material.cc @@ -52,16 +52,14 @@ #include #include #include -#include #include #include #include -#include -#include #include #include #include #include +#include namespace EnergyPlus::Material { @@ -84,6 +82,22 @@ constexpr std::array gases = { Gas() // Empty }; +constexpr std::array ecoRoofCalcMethodNamesUC = {"SIMPLE", "ADVANCED"}; + +int GetMaterialNum(EnergyPlusData &state, std::string const &matName) +{ + auto &s_mat = state.dataMaterial; + auto found = s_mat->materialMap.find(Util::makeUPPER(matName)); + return (found != s_mat->materialMap.end()) ? found->second : 0; +} + +MaterialBase *GetMaterial(EnergyPlusData &state, std::string const &matName) +{ + auto &s_mat = state.dataMaterial; + int matNum = GetMaterialNum(state, matName); + return (matNum > 0) ? s_mat->materials(matNum) : nullptr; +} + void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if errors found in input { @@ -117,29 +131,15 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if using General::ScanForReports; - // if this has a size, then input has already been gotten - if (state.dataHeatBalMgr->UniqueMaterialNames.size()) { - return; - } + int IOStat; // IO Status when calling get input subroutine + int NumAlphas; // Number of material alpha names being passed + int NumNums; // Number of material properties being passed - int IOStat; // IO Status when calling get input subroutine - Array1D_string MaterialNames(7); // Number of Material Alpha names defined - int MaterNum; // Counter to keep track of the material number - int MaterialNumAlpha; // Number of material alpha names being passed - int MaterialNumProp; // Number of material properties being passed - Array1D MaterialProps(27); // Temporary array to transfer material properties - int RegMat; // Regular Materials -- full property definition - int RegRMat; // Regular Materials -- R only property definition - int AirMat; // Air space materials in opaque constructions - int IRTMat; // Infrared Transmitting Materials -- R only property definition - - int EcoRoofMat; // Materials for ecoRoof int NumGas; // Index for loop over gap gases in a mixture int NumGases; // Number of gasses in a mixture GasType gasType = GasType::Invalid; // Gas type index: 1=air, 2=argon, 3=krypton, 4=xenon - int Loop; - int ICoeff; // Gas property coefficient index - Real64 MinSlatAngGeom; // Minimum and maximum slat angle allowed by slat geometry (deg) + int ICoeff; // Gas property coefficient index + Real64 MinSlatAngGeom; // Minimum and maximum slat angle allowed by slat geometry (deg) Real64 MaxSlatAngGeom; Real64 ReflectivitySol; // Glass reflectivity, solar Real64 ReflectivityVis; // Glass reflectivity, visible @@ -153,763 +153,616 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if Real64 maxLamValue; // maximum value of wavelength // Added TH 1/9/2009 to read the thermochromic glazings - int iTC(0); - int iMat(0); // Added TH 7/27/2009 for constructions defined with F or C factor method int TotFfactorConstructs; // Number of slabs-on-grade or underground floor constructions defined with F factors int TotCfactorConstructs; // Number of underground wall constructions defined with C factors - static constexpr std::string_view RoutineName("GetMaterialData: "); - - auto &ip = state.dataInputProcessing->inputProcessor; - auto &ipsc = state.dataIPShortCut; - - RegMat = ip->getNumObjectsFound(state, "Material"); - RegRMat = ip->getNumObjectsFound(state, "Material:NoMass"); - IRTMat = ip->getNumObjectsFound(state, "Material:InfraredTransparent"); - AirMat = ip->getNumObjectsFound(state, "Material:AirGap"); - state.dataHeatBal->W5GlsMat = ip->getNumObjectsFound(state, "WindowMaterial:Glazing"); - state.dataHeatBal->W5GlsMatAlt = ip->getNumObjectsFound(state, "WindowMaterial:Glazing:RefractionExtinctionMethod"); - state.dataHeatBal->W5GasMat = ip->getNumObjectsFound(state, "WindowMaterial:Gas"); - state.dataHeatBal->W5GasMatMixture = ip->getNumObjectsFound(state, "WindowMaterial:GasMixture"); - state.dataHeatBal->TotShades = ip->getNumObjectsFound(state, "WindowMaterial:Shade"); - state.dataMaterial->TotComplexShades = ip->getNumObjectsFound(state, "WindowMaterial:ComplexShade"); - state.dataHeatBal->TotComplexGaps = ip->getNumObjectsFound(state, "WindowMaterial:Gap"); - state.dataHeatBal->TotScreens = ip->getNumObjectsFound(state, "WindowMaterial:Screen"); - state.dataHeatBal->TotBlinds = ip->getNumObjectsFound(state, "WindowMaterial:Blind"); - EcoRoofMat = ip->getNumObjectsFound(state, "Material:RoofVegetation"); - state.dataHeatBal->TotSimpleWindow = ip->getNumObjectsFound(state, "WindowMaterial:SimpleGlazingSystem"); - - state.dataHeatBal->W5GlsMatEQL = ip->getNumObjectsFound(state, "WindowMaterial:Glazing:EquivalentLayer"); - state.dataHeatBal->TotShadesEQL = ip->getNumObjectsFound(state, "WindowMaterial:Shade:EquivalentLayer"); - state.dataHeatBal->TotDrapesEQL = ip->getNumObjectsFound(state, "WindowMaterial:Drape:EquivalentLayer"); - state.dataHeatBal->TotBlindsEQL = ip->getNumObjectsFound(state, "WindowMaterial:Blind:EquivalentLayer"); - state.dataHeatBal->TotScreensEQL = ip->getNumObjectsFound(state, "WindowMaterial:Screen:EquivalentLayer"); - state.dataHeatBal->W5GapMatEQL = ip->getNumObjectsFound(state, "WindowMaterial:Gap:EquivalentLayer"); - - state.dataMaterial->TotMaterials = RegMat + RegRMat + AirMat + state.dataHeatBal->W5GlsMat + state.dataHeatBal->W5GlsMatAlt + - state.dataHeatBal->W5GasMat + state.dataHeatBal->W5GasMatMixture + state.dataHeatBal->TotShades + - state.dataHeatBal->TotScreens + state.dataHeatBal->TotBlinds + EcoRoofMat + IRTMat + - state.dataHeatBal->TotSimpleWindow + state.dataMaterial->TotComplexShades + state.dataHeatBal->TotComplexGaps + - state.dataHeatBal->W5GlsMatEQL + state.dataHeatBal->TotShadesEQL + state.dataHeatBal->TotDrapesEQL + - state.dataHeatBal->TotBlindsEQL + state.dataHeatBal->TotScreensEQL + state.dataHeatBal->W5GapMatEQL; - - TotFfactorConstructs = ip->getNumObjectsFound(state, "Construction:FfactorGroundFloor"); - TotCfactorConstructs = ip->getNumObjectsFound(state, "Construction:CfactorUndergroundWall"); - - if (TotFfactorConstructs > 0) { - state.dataHeatBal->NoFfactorConstructionsUsed = false; - } + static constexpr std::string_view routineName = "GetMaterialData"; - if (TotCfactorConstructs > 0) { - state.dataHeatBal->NoCfactorConstructionsUsed = false; - } + auto &s_mat = state.dataMaterial; + auto &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_ipsc = state.dataIPShortCut; - if (TotFfactorConstructs + TotCfactorConstructs >= 1) { - // Add a new fictitious insulation layer and a thermal mass layer for each F or C factor defined construction - state.dataMaterial->TotMaterials += 1 + TotFfactorConstructs + TotCfactorConstructs; - } + s_mat->NumNoMasses = s_ip->getNumObjectsFound(state, "Material:NoMass"); + s_mat->NumIRTs = s_ip->getNumObjectsFound(state, "Material:InfraredTransparent"); + s_mat->NumAirGaps = s_ip->getNumObjectsFound(state, "Material:AirGap"); - // yujie: This looks kind of silly, but we need it to keep the Materials array in IDF order. - for (int i = 1; i <= state.dataMaterial->TotMaterials; i++) { - MaterialBase *p = new MaterialBase; - state.dataMaterial->Material.push_back(p); - } - state.dataHeatBalMgr->UniqueMaterialNames.reserve(static_cast(state.dataMaterial->TotMaterials)); - - state.dataHeatBal->NominalR.dimension(state.dataMaterial->TotMaterials, 0.0); - - MaterNum = 0; + TotFfactorConstructs = s_ip->getNumObjectsFound(state, "Construction:FfactorGroundFloor"); + TotCfactorConstructs = s_ip->getNumObjectsFound(state, "Construction:CfactorUndergroundWall"); // Regular Materials - state.dataHeatBalMgr->CurrentModuleObject = "Material"; - auto const instances = ip->epJSON.find(state.dataHeatBalMgr->CurrentModuleObject); - if (instances != ip->epJSON.end()) { - auto const &objectSchemaProps = ip->getObjectSchemaProps(state, state.dataHeatBalMgr->CurrentModuleObject); + s_ipsc->cCurrentModuleObject = "Material"; + auto const instances = s_ip->epJSON.find(s_ipsc->cCurrentModuleObject); + if (instances != s_ip->epJSON.end()) { + auto const &objectSchemaProps = s_ip->getObjectSchemaProps(state, s_ipsc->cCurrentModuleObject); - int counter = 0; auto &instancesValue = instances.value(); - for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { + + std::vector idfSortedKeys = s_ip->getIDFOrderedKeys(state, s_ipsc->cCurrentModuleObject); + for (std::string const &key : idfSortedKeys) { + + auto instance = instancesValue.find(key); + assert(instance != instancesValue.end()); + auto const &objectFields = instance.value(); - std::string const &thisObjectName = Util::makeUPPER(instance.key()); - ip->markObjectAsUsed(state.dataHeatBalMgr->CurrentModuleObject, instance.key()); - std::string materialName = thisObjectName; - - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - materialName, - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { + std::string matNameUC = Util::makeUPPER(key); + s_ip->markObjectAsUsed(s_ipsc->cCurrentModuleObject, key); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, key}; + + if (s_mat->materialMap.find(matNameUC) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - // For incoming idf, maintain object order - ++counter; - MaterNum = ip->getIDFObjNum(state, state.dataHeatBalMgr->CurrentModuleObject, counter); // Load the material derived type from the input data. - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::Regular; - thisMaterial->Name = materialName; - - std::string roughness = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "roughness"); - thisMaterial->Roughness = static_cast(getEnumValue(surfaceRoughnessNamesUC, Util::makeUPPER(roughness))); - thisMaterial->Thickness = ip->getRealFieldValue(objectFields, objectSchemaProps, "thickness"); - thisMaterial->Conductivity = ip->getRealFieldValue(objectFields, objectSchemaProps, "conductivity"); - thisMaterial->Density = ip->getRealFieldValue(objectFields, objectSchemaProps, "density"); - thisMaterial->SpecHeat = ip->getRealFieldValue(objectFields, objectSchemaProps, "specific_heat"); - thisMaterial->AbsorpThermal = ip->getRealFieldValue(objectFields, objectSchemaProps, "thermal_absorptance"); - thisMaterial->AbsorpThermalInput = thisMaterial->AbsorpThermal; - thisMaterial->AbsorpSolar = ip->getRealFieldValue(objectFields, objectSchemaProps, "solar_absorptance"); - thisMaterial->AbsorpSolarInput = thisMaterial->AbsorpSolar; - thisMaterial->AbsorpVisible = ip->getRealFieldValue(objectFields, objectSchemaProps, "visible_absorptance"); - thisMaterial->AbsorpVisibleInput = thisMaterial->AbsorpVisible; - - if (thisMaterial->Conductivity > 0.0) { - state.dataHeatBal->NominalR(MaterNum) = thisMaterial->Thickness / thisMaterial->Conductivity; - thisMaterial->Resistance = state.dataHeatBal->NominalR(MaterNum); + auto *mat = new MaterialBase; + mat->group = Group::Regular; + mat->Name = key; + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(matNameUC, mat->Num); + + std::string roughness = s_ip->getAlphaFieldValue(objectFields, objectSchemaProps, "roughness"); + mat->Roughness = static_cast(getEnumValue(surfaceRoughnessNamesUC, Util::makeUPPER(roughness))); + mat->Thickness = s_ip->getRealFieldValue(objectFields, objectSchemaProps, "thickness"); + mat->Conductivity = s_ip->getRealFieldValue(objectFields, objectSchemaProps, "conductivity"); + mat->Density = s_ip->getRealFieldValue(objectFields, objectSchemaProps, "density"); + mat->SpecHeat = s_ip->getRealFieldValue(objectFields, objectSchemaProps, "specific_heat"); + mat->AbsorpThermal = s_ip->getRealFieldValue(objectFields, objectSchemaProps, "thermal_absorptance"); + mat->AbsorpThermalInput = mat->AbsorpThermal; + mat->AbsorpSolar = s_ip->getRealFieldValue(objectFields, objectSchemaProps, "solar_absorptance"); + mat->AbsorpSolarInput = mat->AbsorpSolar; + mat->AbsorpVisible = s_ip->getRealFieldValue(objectFields, objectSchemaProps, "visible_absorptance"); + mat->AbsorpVisibleInput = mat->AbsorpVisible; + + if (mat->Conductivity > 0.0) { + mat->Resistance = mat->NominalR = mat->Thickness / mat->Conductivity; } else { - ShowSevereError(state, format("Positive thermal conductivity required for material {}", thisMaterial->Name)); + ShowSevereError(state, format("Positive thermal conductivity required for material {}", mat->Name)); ErrorsFound = true; } } - MaterNum = counter; // This works here, because this is the first material type processed } + // Add the 6" heavy concrete for constructions defined with F or C factor method if (TotFfactorConstructs + TotCfactorConstructs >= 1) { - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::Regular; - thisMaterial->Name = "~FC_Concrete"; - thisMaterial->Thickness = 0.15; // m, 0.15m = 6 inches - thisMaterial->Conductivity = 1.95; // W/mK - thisMaterial->Density = 2240.0; // kg/m3 - thisMaterial->SpecHeat = 900.0; // J/kgK - thisMaterial->Roughness = SurfaceRoughness::MediumRough; - thisMaterial->AbsorpSolar = 0.7; - thisMaterial->AbsorpThermal = 0.9; - thisMaterial->AbsorpVisible = 0.7; - state.dataHeatBal->NominalR(MaterNum) = thisMaterial->Thickness / thisMaterial->Conductivity; - thisMaterial->Resistance = state.dataHeatBal->NominalR(MaterNum); - - ++RegMat; + auto *mat = new MaterialBase; + mat->group = Group::Regular; + mat->Name = "~FC_Concrete"; + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(Util::makeUPPER(mat->Name), mat->Num); + + mat->Thickness = 0.15; // m, 0.15m = 6 inches + mat->Conductivity = 1.95; // W/mK + mat->Density = 2240.0; // kg/m3 + mat->SpecHeat = 900.0; // J/kgK + mat->Roughness = SurfaceRoughness::MediumRough; + mat->AbsorpSolar = 0.7; + mat->AbsorpThermal = 0.9; + mat->AbsorpVisible = 0.7; + mat->Resistance = mat->NominalR = mat->Thickness / mat->Conductivity; } - state.dataHeatBalMgr->CurrentModuleObject = "Material:NoMass"; - for (Loop = 1; Loop <= RegRMat; ++Loop) { + s_ipsc->cCurrentModuleObject = "Material:NoMass"; + for (int Loop = 1; Loop <= s_mat->NumNoMasses; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - // Load the material derived type from the input data. - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::Regular; - thisMaterial->Name = MaterialNames(1); - - thisMaterial->Roughness = static_cast(getEnumValue(surfaceRoughnessNamesUC, Util::makeUPPER(MaterialNames(2)))); - - thisMaterial->Resistance = MaterialProps(1); - thisMaterial->ROnly = true; - if (MaterialNumProp >= 2) { - thisMaterial->AbsorpThermal = MaterialProps(2); - thisMaterial->AbsorpThermalInput = MaterialProps(2); + auto *mat = new MaterialBase; + mat->group = Group::Regular; + mat->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + mat->Roughness = static_cast(getEnumValue(surfaceRoughnessNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(2)))); + + mat->Resistance = s_ipsc->rNumericArgs(1); + mat->ROnly = true; + if (NumNums >= 2) { + mat->AbsorpThermal = s_ipsc->rNumericArgs(2); + mat->AbsorpThermalInput = s_ipsc->rNumericArgs(2); } else { - thisMaterial->AbsorpThermal = 0.9; - thisMaterial->AbsorpThermalInput = 0.9; + mat->AbsorpThermal = 0.9; + mat->AbsorpThermalInput = 0.9; } - if (MaterialNumProp >= 3) { - thisMaterial->AbsorpSolar = MaterialProps(3); - thisMaterial->AbsorpSolarInput = MaterialProps(3); + if (NumNums >= 3) { + mat->AbsorpSolar = s_ipsc->rNumericArgs(3); + mat->AbsorpSolarInput = s_ipsc->rNumericArgs(3); } else { - thisMaterial->AbsorpSolar = 0.7; - thisMaterial->AbsorpSolarInput = 0.7; + mat->AbsorpSolar = 0.7; + mat->AbsorpSolarInput = 0.7; } - if (MaterialNumProp >= 4) { - thisMaterial->AbsorpVisible = MaterialProps(4); - thisMaterial->AbsorpVisibleInput = MaterialProps(4); + if (NumNums >= 4) { + mat->AbsorpVisible = s_ipsc->rNumericArgs(4); + mat->AbsorpVisibleInput = s_ipsc->rNumericArgs(4); } else { - thisMaterial->AbsorpVisible = 0.7; - thisMaterial->AbsorpVisibleInput = 0.7; + mat->AbsorpVisible = 0.7; + mat->AbsorpVisibleInput = 0.7; } - state.dataHeatBal->NominalR(MaterNum) = thisMaterial->Resistance; + mat->NominalR = mat->Resistance; } // Add a fictitious insulation layer for each construction defined with F or C factor method if (TotFfactorConstructs + TotCfactorConstructs >= 1) { - for (Loop = 1; Loop <= TotFfactorConstructs + TotCfactorConstructs; ++Loop) { - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::Regular; - thisMaterial->Name = format("~FC_Insulation_{}", Loop); - thisMaterial->ROnly = true; - thisMaterial->Roughness = SurfaceRoughness::MediumRough; - thisMaterial->AbsorpSolar = 0.0; - thisMaterial->AbsorpThermal = 0.0; - thisMaterial->AbsorpVisible = 0.0; - } - RegRMat += TotFfactorConstructs + TotCfactorConstructs; + for (int Loop = 1; Loop <= TotFfactorConstructs + TotCfactorConstructs; ++Loop) { + auto *mat = new MaterialBase; + mat->group = Group::Regular; + mat->Name = format("~FC_Insulation_{}", Loop); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(Util::makeUPPER(mat->Name), mat->Num); + + mat->ROnly = true; + mat->Roughness = SurfaceRoughness::MediumRough; + mat->AbsorpSolar = 0.0; + mat->AbsorpThermal = 0.0; + mat->AbsorpVisible = 0.0; + } } // Air Materials (for air spaces in opaque constructions) - state.dataHeatBalMgr->CurrentModuleObject = "Material:AirGap"; - for (Loop = 1; Loop <= AirMat; ++Loop) { + s_ipsc->cCurrentModuleObject = "Material:AirGap"; + for (int Loop = 1; Loop <= s_mat->NumAirGaps; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } // Load the material derived type from the input data. - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::Air; - thisMaterial->Name = MaterialNames(1); + auto *mat = new MaterialBase; + mat->group = Group::AirGap; + mat->Name = s_ipsc->cAlphaArgs(1); - thisMaterial->Roughness = SurfaceRoughness::MediumRough; + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); - thisMaterial->Resistance = MaterialProps(1); - thisMaterial->ROnly = true; + mat->Roughness = SurfaceRoughness::MediumRough; - state.dataHeatBal->NominalR(MaterNum) = thisMaterial->Resistance; + mat->NominalR = mat->Resistance = s_ipsc->rNumericArgs(1); + mat->ROnly = true; } - state.dataHeatBalMgr->CurrentModuleObject = "Material:InfraredTransparent"; - for (Loop = 1; Loop <= IRTMat; ++Loop) { + s_ipsc->cCurrentModuleObject = "Material:InfraredTransparent"; + for (int Loop = 1; Loop <= s_mat->NumIRTs; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::IRTransparent; + auto *mat = new MaterialBase; + mat->group = Group::IRTransparent; + mat->Name = s_ipsc->cAlphaArgs(1); - // Load the material derived type from the input data. - thisMaterial->Name = MaterialNames(1); + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); // Load data for other properties that need defaults - thisMaterial->ROnly = true; - thisMaterial->Resistance = 0.01; - thisMaterial->AbsorpThermal = 0.9999; - thisMaterial->AbsorpThermalInput = 0.9999; - thisMaterial->AbsorpSolar = 1.0; - thisMaterial->AbsorpSolarInput = 1.0; - thisMaterial->AbsorpVisible = 1.0; - thisMaterial->AbsorpVisibleInput = 1.0; - - state.dataHeatBal->NominalR(MaterNum) = thisMaterial->Resistance; + mat->ROnly = true; + mat->NominalR = mat->Resistance = 0.01; + mat->AbsorpThermal = 0.9999; + mat->AbsorpThermalInput = 0.9999; + mat->AbsorpSolar = 1.0; + mat->AbsorpSolarInput = 1.0; + mat->AbsorpVisible = 1.0; + mat->AbsorpVisibleInput = 1.0; } // Glass materials, regular input: transmittance and front/back reflectance - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Glazing"; - for (Loop = 1; Loop <= state.dataHeatBal->W5GlsMat; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Glazing"; + s_mat->NumW5Glazings = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumW5Glazings; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::WindowGlass; - - // Load the material derived type from the input data. - - thisMaterial->Name = MaterialNames(1); - thisMaterial->Roughness = SurfaceRoughness::VerySmooth; - thisMaterial->ROnly = true; - thisMaterial->Thickness = MaterialProps(1); - if (!Util::SameString(MaterialNames(2), "SpectralAndAngle")) { - thisMaterial->Trans = MaterialProps(2); - thisMaterial->ReflectSolBeamFront = MaterialProps(3); - thisMaterial->ReflectSolBeamBack = MaterialProps(4); - thisMaterial->TransVis = MaterialProps(5); - thisMaterial->ReflectVisBeamFront = MaterialProps(6); - thisMaterial->ReflectVisBeamBack = MaterialProps(7); - thisMaterial->TransThermal = MaterialProps(8); - } - thisMaterial->AbsorpThermalFront = MaterialProps(9); - thisMaterial->AbsorpThermalBack = MaterialProps(10); - thisMaterial->Conductivity = MaterialProps(11); - thisMaterial->GlassTransDirtFactor = MaterialProps(12); - thisMaterial->YoungModulus = MaterialProps(13); - thisMaterial->PoissonsRatio = MaterialProps(14); - if (MaterialProps(12) == 0.0) thisMaterial->GlassTransDirtFactor = 1.0; - thisMaterial->AbsorpThermal = thisMaterial->AbsorpThermalBack; - - if (thisMaterial->Conductivity > 0.0) { - state.dataHeatBal->NominalR(MaterNum) = thisMaterial->Thickness / thisMaterial->Conductivity; - thisMaterial->Resistance = state.dataHeatBal->NominalR(MaterNum); + auto *mat = new MaterialGlass; + mat->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + mat->Roughness = SurfaceRoughness::VerySmooth; + mat->ROnly = true; + mat->Thickness = s_ipsc->rNumericArgs(1); + + mat->windowOpticalData = static_cast(getEnumValue(Window::opticalDataModelNamesUC, s_ipsc->cAlphaArgs(2))); + if (mat->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { + mat->Trans = s_ipsc->rNumericArgs(2); + mat->ReflectSolBeamFront = s_ipsc->rNumericArgs(3); + mat->ReflectSolBeamBack = s_ipsc->rNumericArgs(4); + mat->TransVis = s_ipsc->rNumericArgs(5); + mat->ReflectVisBeamFront = s_ipsc->rNumericArgs(6); + mat->ReflectVisBeamBack = s_ipsc->rNumericArgs(7); + mat->TransThermal = s_ipsc->rNumericArgs(8); + } + mat->AbsorpThermalFront = s_ipsc->rNumericArgs(9); + mat->AbsorpThermalBack = s_ipsc->rNumericArgs(10); + mat->Conductivity = s_ipsc->rNumericArgs(11); + mat->GlassTransDirtFactor = s_ipsc->rNumericArgs(12); + mat->YoungModulus = s_ipsc->rNumericArgs(13); + mat->PoissonsRatio = s_ipsc->rNumericArgs(14); + if (s_ipsc->rNumericArgs(12) == 0.0) mat->GlassTransDirtFactor = 1.0; + mat->AbsorpThermal = mat->AbsorpThermalBack; + + if (mat->Conductivity > 0.0) { + mat->Resistance = mat->NominalR = mat->Thickness / mat->Conductivity; } else { ErrorsFound = true; - ShowSevereError(state, format("Window glass material {} has Conductivity = 0.0, must be >0.0, default = .9", thisMaterial->Name)); + ShowSevereError(state, format("Window glass material {} has Conductivity = 0.0, must be >0.0, default = .9", mat->Name)); } - thisMaterial->GlassSpectralDataPtr = 0; - if (state.dataHeatBal->TotSpectralData > 0 && !ipsc->lAlphaFieldBlanks(3)) { - thisMaterial->GlassSpectralDataPtr = Util::FindItemInList(MaterialNames(3), state.dataHeatBal->SpectralData); - } - if (Util::SameString(MaterialNames(2), "SpectralAverage")) thisMaterial->GlassSpectralDataPtr = 0; - // No need for spectral data for BSDF either - if (Util::SameString(MaterialNames(2), "BSDF")) thisMaterial->GlassSpectralDataPtr = 0; - if (Util::SameString(MaterialNames(2), "SpectralAndAngle")) thisMaterial->GlassSpectralAndAngle = true; + mat->windowOpticalData = static_cast(getEnumValue(Window::opticalDataModelNamesUC, s_ipsc->cAlphaArgs(2))); - if (thisMaterial->GlassSpectralDataPtr == 0 && Util::SameString(MaterialNames(2), "Spectral")) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\" has {} = Spectral but has no matching MaterialProperty:GlazingSpectralData set", - state.dataHeatBalMgr->CurrentModuleObject, - thisMaterial->Name, - ipsc->cAlphaFieldNames(2))); - if (ipsc->lAlphaFieldBlanks(3)) { - ShowContinueError(state, format("...{} is blank.", ipsc->cAlphaFieldNames(3))); - } else { - ShowContinueError(state, - format("...{}=\"{}\" not found as item in MaterialProperty:GlazingSpectralData objects.", - ipsc->cAlphaFieldNames(3), - MaterialNames(3))); + if (mat->windowOpticalData == Window::OpticalDataModel::Spectral) { + if (s_ipsc->lAlphaFieldBlanks(3)) { + ShowSevereCustomMessage( + state, eoh, format("{} = Spectral but {} is blank.", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaFieldNames(3))); + ErrorsFound = true; + } else if ((mat->GlassSpectralDataPtr = Util::FindItemInList(s_ipsc->cAlphaArgs(3), s_mat->SpectralData)) == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; } - } - if (!Util::SameString(MaterialNames(2), "SpectralAverage") && !Util::SameString(MaterialNames(2), "Spectral") && - !Util::SameString(MaterialNames(2), "BSDF") && !Util::SameString(MaterialNames(2), "SpectralAndAngle")) { - ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", invalid specification.", state.dataHeatBalMgr->CurrentModuleObject, thisMaterial->Name)); - ShowContinueError( - state, - format("{} must be SpectralAverage, Spectral, BSDF or SpectralAndAngle, value={}", ipsc->cAlphaFieldNames(2), MaterialNames(2))); - } - - // TH 8/24/2011, allow glazing properties MaterialProps(2 to 10) to equal 0 or 1: 0.0 =< Prop <= 1.0 - // Fixed CR 8413 - modeling spandrel panels as glazing systems - if (Util::SameString(MaterialNames(2), "SpectralAverage")) { + // TH 8/24/2011, allow glazing properties s_ipsc->rNumericArgs(2 to 10) to equal 0 or 1: 0.0 =< Prop <= 1.0 + // Fixed CR 8413 - modeling spandrel panels as glazing systems + } else if (mat->windowOpticalData == Window::OpticalDataModel::SpectralAverage) { - if (MaterialProps(2) + MaterialProps(3) > 1.0) { + if (s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(3) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not <= 1.0", ipsc->cNumericFieldNames(2), ipsc->cNumericFieldNames(3))); + ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(3))); } - if (MaterialProps(2) + MaterialProps(4) > 1.0) { + if (s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(4) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not <= 1.0", ipsc->cNumericFieldNames(2), ipsc->cNumericFieldNames(4))); + ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(4))); } - if (MaterialProps(5) + MaterialProps(6) > 1.0) { + if (s_ipsc->rNumericArgs(5) + s_ipsc->rNumericArgs(6) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not <= 1.0", ipsc->cNumericFieldNames(5), ipsc->cNumericFieldNames(6))); + ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(6))); } - if (MaterialProps(5) + MaterialProps(7) > 1.0) { + if (s_ipsc->rNumericArgs(5) + s_ipsc->rNumericArgs(7) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not <= 1.0", ipsc->cNumericFieldNames(5), ipsc->cNumericFieldNames(7))); + ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(7))); } - if (MaterialProps(8) + MaterialProps(9) > 1.0) { + if (s_ipsc->rNumericArgs(8) + s_ipsc->rNumericArgs(9) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not <= 1.0", ipsc->cNumericFieldNames(8), ipsc->cNumericFieldNames(9))); + ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(9))); } - if (MaterialProps(8) + MaterialProps(10) > 1.0) { + if (s_ipsc->rNumericArgs(8) + s_ipsc->rNumericArgs(10) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not <= 1.0", ipsc->cNumericFieldNames(8), ipsc->cNumericFieldNames(10))); + ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(10))); } - if (MaterialProps(2) < 0.0) { - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not >= 0.0", ipsc->cNumericFieldNames(2))); + if (s_ipsc->rNumericArgs(2) < 0.0) { + ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0", s_ipsc->cNumericFieldNames(2))); ErrorsFound = true; } - if (MaterialProps(2) > 1.0) { + if (s_ipsc->rNumericArgs(2) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not <= 1.0", ipsc->cNumericFieldNames(2))); + ShowSevereCustomMessage(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(2))); } - if (MaterialProps(3) < 0.0 || MaterialProps(3) > 1.0) { + if (s_ipsc->rNumericArgs(3) < 0.0 || s_ipsc->rNumericArgs(3) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not >= 0.0 and <= 1.0", ipsc->cNumericFieldNames(3))); + ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(3))); } - if (MaterialProps(4) < 0.0 || MaterialProps(4) > 1.0) { + if (s_ipsc->rNumericArgs(4) < 0.0 || s_ipsc->rNumericArgs(4) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not >= 0.0 and <= 1.0", ipsc->cNumericFieldNames(4))); + ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(4))); } - if (MaterialProps(5) < 0.0) { - ShowWarningError(state, format("{}=\"{}\", minimal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowWarningError(state, format("{} not >= 0.0", ipsc->cNumericFieldNames(5))); + if (s_ipsc->rNumericArgs(5) < 0.0) { + ShowWarningCustomMessage(state, eoh, format("{} not >= 0.0", s_ipsc->cNumericFieldNames(5))); } - if (MaterialProps(5) > 1.0) { + if (s_ipsc->rNumericArgs(5) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not <= 1.0", ipsc->cNumericFieldNames(5))); + ShowSevereCustomMessage(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(5))); } - if (MaterialProps(6) < 0.0 || MaterialProps(6) > 1.0) { + if (s_ipsc->rNumericArgs(6) < 0.0 || s_ipsc->rNumericArgs(6) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not >= 0.0 and <= 1.0", ipsc->cNumericFieldNames(6))); + ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(6))); } - if (MaterialProps(7) < 0.0 || MaterialProps(7) > 1.0) { + if (s_ipsc->rNumericArgs(7) < 0.0 || s_ipsc->rNumericArgs(7) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not >= 0.0 and <= 1.0", ipsc->cNumericFieldNames(7))); + ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(7))); } } - if (MaterialProps(8) > 1.0) { + if (s_ipsc->rNumericArgs(8) > 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not <= 1.0", ipsc->cNumericFieldNames(8))); + ShowSevereCustomMessage(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(8))); } - if (MaterialProps(9) <= 0.0 || MaterialProps(9) >= 1.0) { + if (s_ipsc->rNumericArgs(9) <= 0.0 || s_ipsc->rNumericArgs(9) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not > 0.0 and < 1.0", ipsc->cNumericFieldNames(9))); + ShowSevereCustomMessage(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(9))); } - if (MaterialProps(10) <= 0.0 || MaterialProps(10) >= 1.0) { + if (s_ipsc->rNumericArgs(10) <= 0.0 || s_ipsc->rNumericArgs(10) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not > 0.0 and < 1.0", ipsc->cNumericFieldNames(10))); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(10))); } - if (MaterialProps(11) <= 0.0) { + if (s_ipsc->rNumericArgs(11) <= 0.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not > 0.0", ipsc->cNumericFieldNames(11))); + ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(11))); } - if (MaterialProps(13) < 0.0) { + if (s_ipsc->rNumericArgs(13) < 0.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not > 0.0", ipsc->cNumericFieldNames(13))); + ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(13))); } - if (MaterialProps(14) < 0.0 || MaterialProps(14) >= 1.0) { + if (s_ipsc->rNumericArgs(14) < 0.0 || s_ipsc->rNumericArgs(14) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not > 0.0 and < 1.0", ipsc->cNumericFieldNames(14))); + ShowSevereCustomMessage(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(14))); } - if (MaterialNames(4) == "") { - thisMaterial->SolarDiffusing = false; + if (s_ipsc->cAlphaArgs(4) == "") { + mat->SolarDiffusing = false; } else { - BooleanSwitch answer = getYesNoValue(MaterialNames(4)); + BooleanSwitch answer = getYesNoValue(s_ipsc->cAlphaArgs(4)); if (answer == BooleanSwitch::Invalid) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} must be Yes or No, entered value={}", ipsc->cNumericFieldNames(4), MaterialNames(4))); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} must be Yes or No, entered value={}", s_ipsc->cNumericFieldNames(4), s_ipsc->cAlphaArgs(4))); } else { - thisMaterial->SolarDiffusing = (answer == BooleanSwitch::Yes); + mat->SolarDiffusing = (answer == BooleanSwitch::Yes); } } + // Get SpectralAndAngle table names - if (thisMaterial->GlassSpectralAndAngle) { - if (ipsc->lAlphaFieldBlanks(5)) { + if (mat->windowOpticalData == Window::OpticalDataModel::SpectralAndAngle) { + if (s_ipsc->lAlphaFieldBlanks(5)) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", blank field.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, " Table name must be entered when the key SpectralAndAngle is selected as Optical Data Type."); + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaFieldNames(2), "SpectralAndAngle"); + } else if ((mat->GlassSpecAngTransDataPtr = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(5))) == 0) { + ErrorsFound = true; + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5)); } else { - thisMaterial->GlassSpecAngTransDataPtr = Curve::GetCurveIndex(state, MaterialNames(5)); - if (thisMaterial->GlassSpecAngTransDataPtr == 0) { + ErrorsFound |= Curve::CheckCurveDims(state, + mat->GlassSpecAngTransDataPtr, // Curve index + {2}, // Valid dimensions + routineName, // Routine name + s_ipsc->cCurrentModuleObject, // Object Type + mat->Name, // Object Name + s_ipsc->cAlphaFieldNames(5)); // Field Name + + GetCurveMinMaxValues(state, mat->GlassSpecAngTransDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); + if (minAngValue > 1.0e-6) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} requires the minumum value = 0.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); + } + + if (std::abs(maxAngValue - 90.0) > 1.0e-6) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} requires the maximum value = 90.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); + } + + if (minLamValue < 0.1) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Invalid name.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, - format("{} requires a valid table object name, entered input={}", ipsc->cAlphaFieldNames(5), MaterialNames(5))); - } else { - ErrorsFound |= Curve::CheckCurveDims(state, - thisMaterial->GlassSpecAngTransDataPtr, // Curve index - {2}, // Valid dimensions - RoutineName, // Routine name - state.dataHeatBalMgr->CurrentModuleObject, // Object Type - thisMaterial->Name, // Object Name - ipsc->cAlphaFieldNames(5)); // Field Name - - GetCurveMinMaxValues(state, thisMaterial->GlassSpecAngTransDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); - if (minAngValue > 1.0e-6) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid minimum value of angle = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - minAngValue)); - ShowContinueError( - state, - format("{} requires the minumum value = 0.0 in the entered table name={}", ipsc->cAlphaFieldNames(5), MaterialNames(5))); - } - if (std::abs(maxAngValue - 90.0) > 1.0e-6) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid maximum value of angle = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - maxAngValue)); - ShowContinueError( - state, - format("{} requires the maximum value = 90.0 in the entered table name={}", ipsc->cAlphaFieldNames(5), MaterialNames(5))); - } - if (minLamValue < 0.1) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid minimum value of wavelength = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - minLamValue)); - ShowContinueError(state, - format("{} requires the minumum value = 0.1 micron in the entered table name={}", - ipsc->cAlphaFieldNames(5), - MaterialNames(5))); - } - if (maxLamValue > 4.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid maximum value of wavelength = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - maxLamValue)); - ShowContinueError(state, - format("{} requires the maximum value = 4.0 microns in the entered table name={}", - ipsc->cAlphaFieldNames(5), - MaterialNames(5))); - } + ShowSevereCustomMessage(state, + eoh, + format("{} requires the minumum value = 0.1 micron in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); + } + + if (maxLamValue > 4.0) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} requires the maximum value = 4.0 microns in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } } - if (ipsc->lAlphaFieldBlanks(6)) { + + if (s_ipsc->lAlphaFieldBlanks(6)) { + ErrorsFound = true; + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaFieldNames(2), "SpectralAndAngle"); + } else if ((mat->GlassSpecAngFRefleDataPtr = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(6))) == 0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", blank field.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, " Table name must be entered when the key SpectralAndAngle is selected as Optical Data Type."); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); } else { - thisMaterial->GlassSpecAngFRefleDataPtr = Curve::GetCurveIndex(state, MaterialNames(6)); - if (thisMaterial->GlassSpecAngFRefleDataPtr == 0) { + ErrorsFound |= Curve::CheckCurveDims(state, + mat->GlassSpecAngFRefleDataPtr, // Curve index + {2}, // Valid dimensions + routineName, // Routine name + s_ipsc->cCurrentModuleObject, // Object Type + mat->Name, // Object Name + s_ipsc->cAlphaFieldNames(6)); // Field Name + + GetCurveMinMaxValues(state, mat->GlassSpecAngFRefleDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); + if (minAngValue > 1.0e-6) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Invalid name.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, - format("{} requires a valid table object name, entered input={}", ipsc->cAlphaFieldNames(6), MaterialNames(6))); - } else { - ErrorsFound |= Curve::CheckCurveDims(state, - thisMaterial->GlassSpecAngFRefleDataPtr, // Curve index - {2}, // Valid dimensions - RoutineName, // Routine name - state.dataHeatBalMgr->CurrentModuleObject, // Object Type - thisMaterial->Name, // Object Name - ipsc->cAlphaFieldNames(6)); // Field Name - - GetCurveMinMaxValues(state, thisMaterial->GlassSpecAngFRefleDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); - if (minAngValue > 1.0e-6) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid minimum value of angle = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - minAngValue)); - ShowContinueError( - state, - format("{} requires the minumum value = 0.0 in the entered table name={}", ipsc->cAlphaFieldNames(5), MaterialNames(5))); - } - if (std::abs(maxAngValue - 90.0) > 1.0e-6) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid maximum value of angle = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - maxAngValue)); - ShowContinueError( - state, - format("{} requires the maximum value = 90.0 in the entered table name={}", ipsc->cAlphaFieldNames(5), MaterialNames(5))); - } - if (minLamValue < 0.1) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid minimum value of wavelength = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - minLamValue)); - ShowContinueError(state, - format("{} requires the minumum value = 0.1 micron in the entered table name={}", - ipsc->cAlphaFieldNames(5), - MaterialNames(5))); - } - if (maxLamValue > 4.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid maximum value of wavelength = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - maxLamValue)); - ShowContinueError(state, - format("{} requires the maximum value = 4.0 microns in the entered table name={}", - ipsc->cAlphaFieldNames(5), - MaterialNames(5))); - } + ShowSevereCustomMessage(state, + eoh, + format("{} requires the minumum value = 0.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); + } + if (std::abs(maxAngValue - 90.0) > 1.0e-6) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} requires the maximum value = 90.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); + } + if (minLamValue < 0.1) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} requires the minumum value = 0.1 micron in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); + } + if (maxLamValue > 4.0) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} requires the maximum value = 4.0 microns in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } } - if (ipsc->lAlphaFieldBlanks(7)) { + + if (s_ipsc->lAlphaFieldBlanks(7)) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", blank field.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, " Table name must be entered when the key SpectralAndAngle is selected as Optical Data Type."); + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaFieldNames(2), "SpectralAndAngle"); + } else if ((mat->GlassSpecAngBRefleDataPtr = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(7))) == 0) { + ErrorsFound = true; + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7)); } else { - thisMaterial->GlassSpecAngBRefleDataPtr = Curve::GetCurveIndex(state, MaterialNames(7)); - if (thisMaterial->GlassSpecAngBRefleDataPtr == 0) { + ErrorsFound |= Curve::CheckCurveDims(state, + mat->GlassSpecAngBRefleDataPtr, // Curve index + {2}, // Valid dimensions + routineName, // Routine name + s_ipsc->cCurrentModuleObject, // Object Type + mat->Name, // Object Name + s_ipsc->cAlphaFieldNames(7)); // Field Name + + GetCurveMinMaxValues(state, mat->GlassSpecAngBRefleDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); + if (minAngValue > 1.0e-6) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} requires the minumum value = 0.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); + } + if (std::abs(maxAngValue - 90.0) > 1.0e-6) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Invalid name.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, - format("{} requires a valid table object name, entered input={}", ipsc->cAlphaFieldNames(7), MaterialNames(7))); - } else { - ErrorsFound |= Curve::CheckCurveDims(state, - thisMaterial->GlassSpecAngBRefleDataPtr, // Curve index - {2}, // Valid dimensions - RoutineName, // Routine name - state.dataHeatBalMgr->CurrentModuleObject, // Object Type - thisMaterial->Name, // Object Name - ipsc->cAlphaFieldNames(7)); // Field Name - - GetCurveMinMaxValues(state, thisMaterial->GlassSpecAngBRefleDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); - if (minAngValue > 1.0e-6) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid minimum value of angle = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - minAngValue)); - ShowContinueError( - state, - format("{} requires the minumum value = 0.0 in the entered table name={}", ipsc->cAlphaFieldNames(5), MaterialNames(5))); - } - if (std::abs(maxAngValue - 90.0) > 1.0e-6) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid maximum value of angle = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - maxAngValue)); - ShowContinueError( - state, - format("{} requires the maximum value = 90.0 in the entered table name={}", ipsc->cAlphaFieldNames(5), MaterialNames(5))); - } - if (minLamValue < 0.1) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid minimum value of wavelength = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - minLamValue)); - ShowContinueError(state, - format("{} requires the minumum value = 0.1 micron in the entered table name={}", - ipsc->cAlphaFieldNames(5), - MaterialNames(5))); - } - if (maxLamValue > 4.0) { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", Invalid maximum value of wavelength = {:.2R}.", - state.dataHeatBalMgr->CurrentModuleObject, - MaterialNames(1), - maxLamValue)); - ShowContinueError(state, - format("{} requires the maximum value = 4.0 microns in the entered table name={}", - ipsc->cAlphaFieldNames(5), - MaterialNames(5))); - } + ShowSevereCustomMessage(state, + eoh, + format("{} requires the maximum value = 90.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); + } + if (minLamValue < 0.1) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} requires the minumum value = 0.1 micron in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); + } + if (maxLamValue > 4.0) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} requires the maximum value = 4.0 microns in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } } } @@ -917,228 +770,229 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // Glass materials, alternative input: index of refraction and extinction coefficient - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Glazing:RefractionExtinctionMethod"; - for (Loop = 1; Loop <= state.dataHeatBal->W5GlsMatAlt; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Glazing:RefractionExtinctionMethod"; + s_mat->NumW5AltGlazings = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumW5AltGlazings; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::WindowGlass; + auto *mat = new MaterialGlass; + mat->group = Group::Glass; + mat->Name = s_ipsc->cAlphaArgs(1); - // Load the material derived type from the input data. + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); - thisMaterial->Name = MaterialNames(1); - thisMaterial->Roughness = SurfaceRoughness::VerySmooth; - thisMaterial->Thickness = MaterialProps(1); - thisMaterial->ROnly = true; + mat->Roughness = SurfaceRoughness::VerySmooth; + mat->Thickness = s_ipsc->rNumericArgs(1); + mat->ROnly = true; // Calculate solar and visible transmittance and reflectance at normal incidence from thickness, // index of refraction and extinction coefficient. With the alternative input the front and back // properties are assumed to be the same. - ReflectivitySol = pow_2((MaterialProps(2) - 1.0) / (MaterialProps(2) + 1.0)); - ReflectivityVis = pow_2((MaterialProps(4) - 1.0) / (MaterialProps(4) + 1.0)); - TransmittivitySol = std::exp(-MaterialProps(3) * MaterialProps(1)); - TransmittivityVis = std::exp(-MaterialProps(5) * MaterialProps(1)); - thisMaterial->Trans = TransmittivitySol * pow_2(1.0 - ReflectivitySol) / (1.0 - pow_2(ReflectivitySol * TransmittivitySol)); - thisMaterial->ReflectSolBeamFront = + ReflectivitySol = pow_2((s_ipsc->rNumericArgs(2) - 1.0) / (s_ipsc->rNumericArgs(2) + 1.0)); + ReflectivityVis = pow_2((s_ipsc->rNumericArgs(4) - 1.0) / (s_ipsc->rNumericArgs(4) + 1.0)); + TransmittivitySol = std::exp(-s_ipsc->rNumericArgs(3) * s_ipsc->rNumericArgs(1)); + TransmittivityVis = std::exp(-s_ipsc->rNumericArgs(5) * s_ipsc->rNumericArgs(1)); + mat->Trans = TransmittivitySol * pow_2(1.0 - ReflectivitySol) / (1.0 - pow_2(ReflectivitySol * TransmittivitySol)); + mat->ReflectSolBeamFront = ReflectivitySol * (1.0 + pow_2(1.0 - ReflectivitySol) * pow_2(TransmittivitySol) / (1.0 - pow_2(ReflectivitySol * TransmittivitySol))); - thisMaterial->ReflectSolBeamBack = thisMaterial->ReflectSolBeamFront; - thisMaterial->TransVis = TransmittivityVis * pow_2(1.0 - ReflectivityVis) / (1.0 - pow_2(ReflectivityVis * TransmittivityVis)); + mat->ReflectSolBeamBack = mat->ReflectSolBeamFront; + mat->TransVis = TransmittivityVis * pow_2(1.0 - ReflectivityVis) / (1.0 - pow_2(ReflectivityVis * TransmittivityVis)); - thisMaterial->ReflectVisBeamFront = + mat->ReflectVisBeamFront = ReflectivityVis * (1.0 + pow_2(1.0 - ReflectivityVis) * pow_2(TransmittivityVis) / (1.0 - pow_2(ReflectivityVis * TransmittivityVis))); - thisMaterial->ReflectVisBeamBack = thisMaterial->ReflectSolBeamFront; - thisMaterial->TransThermal = MaterialProps(6); - thisMaterial->AbsorpThermalFront = MaterialProps(7); - thisMaterial->AbsorpThermalBack = MaterialProps(7); - thisMaterial->Conductivity = MaterialProps(8); - thisMaterial->GlassTransDirtFactor = MaterialProps(9); - if (MaterialProps(9) == 0.0) thisMaterial->GlassTransDirtFactor = 1.0; - thisMaterial->AbsorpThermal = thisMaterial->AbsorpThermalBack; + mat->ReflectVisBeamBack = mat->ReflectSolBeamFront; + mat->TransThermal = s_ipsc->rNumericArgs(6); + mat->AbsorpThermalFront = s_ipsc->rNumericArgs(7); + mat->AbsorpThermalBack = s_ipsc->rNumericArgs(7); + mat->Conductivity = s_ipsc->rNumericArgs(8); + mat->GlassTransDirtFactor = s_ipsc->rNumericArgs(9); + if (s_ipsc->rNumericArgs(9) == 0.0) mat->GlassTransDirtFactor = 1.0; + mat->AbsorpThermal = mat->AbsorpThermalBack; - if (thisMaterial->Conductivity > 0.0) { - state.dataHeatBal->NominalR(MaterNum) = thisMaterial->Thickness / thisMaterial->Conductivity; - thisMaterial->Resistance = state.dataHeatBal->NominalR(MaterNum); + if (mat->Conductivity > 0.0) { + mat->Resistance = mat->NominalR = mat->Thickness / mat->Conductivity; } - thisMaterial->GlassSpectralDataPtr = 0; + mat->GlassSpectralDataPtr = 0; - if (MaterialProps(6) + MaterialProps(7) >= 1.0) { + if (s_ipsc->rNumericArgs(6) + s_ipsc->rNumericArgs(7) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not < 1.0", ipsc->cNumericFieldNames(6), ipsc->cNumericFieldNames(7))); + ShowSevereCustomMessage(state, eoh, format("{} + {} not < 1.0", s_ipsc->cNumericFieldNames(6), s_ipsc->cNumericFieldNames(7))); } - if (MaterialNames(2) == "") { - thisMaterial->SolarDiffusing = false; - } else if (MaterialNames(2) == "YES") { - thisMaterial->SolarDiffusing = true; - } else if (MaterialNames(2) == "NO") { - thisMaterial->SolarDiffusing = false; + if (s_ipsc->cAlphaArgs(2) == "") { + mat->SolarDiffusing = false; + } else if (s_ipsc->cAlphaArgs(2) == "YES") { + mat->SolarDiffusing = true; + } else if (s_ipsc->cAlphaArgs(2) == "NO") { + mat->SolarDiffusing = false; } else { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} must be Yes or No, entered value={}", ipsc->cNumericFieldNames(2), MaterialNames(4))); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} must be Yes or No, entered value={}", s_ipsc->cNumericFieldNames(2), s_ipsc->cAlphaArgs(4))); } } // Glass materials, equivalent layer (ASHWAT) method - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Glazing:EquivalentLayer"; - for (Loop = 1; Loop <= state.dataHeatBal->W5GlsMatEQL; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Glazing:EquivalentLayer"; + s_mat->NumEQLGlazings = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumEQLGlazings; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::GlassEquivalentLayer; - - // Load the material derived type from the input data. - thisMaterial->Name = MaterialNames(1); - thisMaterial->Roughness = SurfaceRoughness::VerySmooth; - thisMaterial->ROnly = true; - - thisMaterial->TausFrontBeamBeam = MaterialProps(1); - thisMaterial->TausBackBeamBeam = MaterialProps(2); - thisMaterial->ReflFrontBeamBeam = MaterialProps(3); - thisMaterial->ReflBackBeamBeam = MaterialProps(4); - thisMaterial->TausFrontBeamBeamVis = MaterialProps(5); - thisMaterial->TausBackBeamBeamVis = MaterialProps(6); - thisMaterial->ReflFrontBeamBeamVis = MaterialProps(7); - thisMaterial->ReflBackBeamBeamVis = MaterialProps(8); - thisMaterial->TausFrontBeamDiff = MaterialProps(9); - thisMaterial->TausBackBeamDiff = MaterialProps(10); - thisMaterial->ReflFrontBeamDiff = MaterialProps(11); - thisMaterial->ReflBackBeamDiff = MaterialProps(12); - thisMaterial->TausFrontBeamDiffVis = MaterialProps(13); - thisMaterial->TausBackBeamDiffVis = MaterialProps(14); - thisMaterial->ReflFrontBeamDiffVis = MaterialProps(15); - thisMaterial->ReflBackBeamDiffVis = MaterialProps(16); - thisMaterial->TausDiffDiff = MaterialProps(17); - thisMaterial->ReflFrontDiffDiff = MaterialProps(18); - thisMaterial->ReflBackDiffDiff = MaterialProps(19); - thisMaterial->TausDiffDiffVis = MaterialProps(20); - thisMaterial->ReflFrontDiffDiffVis = MaterialProps(21); - thisMaterial->ReflBackDiffDiffVis = MaterialProps(22); - thisMaterial->TausThermal = MaterialProps(23); - thisMaterial->EmissThermalFront = MaterialProps(24); - thisMaterial->EmissThermalBack = MaterialProps(25); - thisMaterial->Resistance = MaterialProps(26); - if (thisMaterial->Resistance <= 0.0) thisMaterial->Resistance = 0.158; // equivalent to single pane of 1/4" inch standard glass + auto *mat = new MaterialGlassEQL; + mat->group = Group::GlassEQL; + mat->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + mat->Roughness = SurfaceRoughness::VerySmooth; + mat->ROnly = true; + + mat->TAR.Sol.Ft.Bm[0].BmTra = s_ipsc->rNumericArgs(1); + mat->TAR.Sol.Bk.Bm[0].BmTra = s_ipsc->rNumericArgs(2); + mat->TAR.Sol.Ft.Bm[0].BmRef = s_ipsc->rNumericArgs(3); + mat->TAR.Sol.Bk.Bm[0].BmRef = s_ipsc->rNumericArgs(4); + mat->TAR.Vis.Ft.Bm[0].BmTra = s_ipsc->rNumericArgs(5); + mat->TAR.Vis.Bk.Bm[0].BmTra = s_ipsc->rNumericArgs(6); + mat->TAR.Vis.Ft.Bm[0].BmRef = s_ipsc->rNumericArgs(7); + mat->TAR.Vis.Bk.Bm[0].BmRef = s_ipsc->rNumericArgs(8); + mat->TAR.Sol.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(9); + mat->TAR.Sol.Bk.Bm[0].DfTra = s_ipsc->rNumericArgs(10); + mat->TAR.Sol.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(11); + mat->TAR.Sol.Bk.Bm[0].DfRef = s_ipsc->rNumericArgs(12); + mat->TAR.Vis.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(13); + mat->TAR.Vis.Bk.Bm[0].DfTra = s_ipsc->rNumericArgs(14); + mat->TAR.Vis.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(15); + mat->TAR.Vis.Bk.Bm[0].DfRef = s_ipsc->rNumericArgs(16); + mat->TAR.Sol.Ft.Df.Tra = mat->TAR.Sol.Bk.Df.Tra = s_ipsc->rNumericArgs(17); + mat->TAR.Sol.Ft.Df.Ref = s_ipsc->rNumericArgs(18); + mat->TAR.Sol.Bk.Df.Ref = s_ipsc->rNumericArgs(19); + mat->TAR.Vis.Ft.Df.Tra = mat->TAR.Vis.Bk.Df.Tra = s_ipsc->rNumericArgs(20); + mat->TAR.Vis.Ft.Df.Ref = s_ipsc->rNumericArgs(21); + mat->TAR.Vis.Bk.Df.Ref = s_ipsc->rNumericArgs(22); + mat->TAR.IR.Ft.Tra = mat->TAR.IR.Bk.Tra = s_ipsc->rNumericArgs(23); + mat->TAR.IR.Ft.Emi = s_ipsc->rNumericArgs(24); + mat->TAR.IR.Bk.Emi = s_ipsc->rNumericArgs(25); + mat->Resistance = s_ipsc->rNumericArgs(26); + if (mat->Resistance <= 0.0) mat->Resistance = 0.158; // equivalent to single pane of 1/4" inch standard glass // Assumes thermal emissivity is the same as thermal absorptance - thisMaterial->AbsorpThermalFront = thisMaterial->EmissThermalFront; - thisMaterial->AbsorpThermalBack = thisMaterial->EmissThermalBack; - thisMaterial->TransThermal = thisMaterial->TausThermal; + mat->AbsorpThermalFront = mat->TAR.IR.Ft.Tra; + mat->AbsorpThermalBack = mat->TAR.IR.Bk.Tra; + mat->TransThermal = mat->TAR.IR.Ft.Tra; - if (Util::SameString(MaterialNames(2), "SpectralAverage")) thisMaterial->GlassSpectralDataPtr = 0; + mat->windowOpticalData = static_cast(getEnumValue(Window::opticalDataModelNamesUC, s_ipsc->cAlphaArgs(2))); - // IF(dataMaterial.Material(MaterNum)%GlassSpectralDataPtr == 0 .AND. Util::SameString(MaterialNames(2),'Spectral')) THEN + // IF(dataMaterial.Material(MaterNum)%GlassSpectralDataPtr == 0 .AND. Util::SameString(s_ipsc->cAlphaArgs(2),'Spectral')) THEN // ErrorsFound = .TRUE. - // CALL ShowSevereError(state, TRIM(state.dataHeatBalMgr->CurrentModuleObject)//'="'//Trim(dataMaterial.Material(MaterNum)%Name)// & + // CALL ShowSevereError(state, TRIM(s_ipsc->cCurrentModuleObject)//'="'//Trim(dataMaterial.Material(MaterNum)%Name)// & // '" has '//TRIM(cAlphaFieldNames(2))//' = Spectral but has no matching MaterialProperty:GlazingSpectralData set') - // if (ipsc->lAlphaFieldBlanks(3)) THEN + // if (s_ipsc->lAlphaFieldBlanks(3)) THEN // CALL ShowContinueError(state, '...'//TRIM(cAlphaFieldNames(3))//' is blank.') // ELSE - // CALL ShowContinueError(state, '...'//TRIM(cAlphaFieldNames(3))//'="'//TRIM(MaterialNames(3))// & + // CALL ShowContinueError(state, '...'//TRIM(cAlphaFieldNames(3))//'="'//TRIM(s_ipsc->cAlphaArgs(3))// & // '" not found as item in MaterialProperty:GlazingSpectralData objects.') // END IF // END IF - if (!Util::SameString(MaterialNames(2), "SpectralAverage")) { + if (mat->windowOpticalData != Window::OpticalDataModel::SpectralAverage) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + thisMaterial->Name + "\", invalid specification."); - ShowContinueError(state, ipsc->cAlphaFieldNames(2) + " must be SpectralAverage, value=" + MaterialNames(2)); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2), "Must be \"SpectralAverage\"."); } } // W5GlsMatEQL loop // Window gas materials (for gaps with a single gas) - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Gas"; - for (Loop = 1; Loop <= state.dataHeatBal->W5GasMat; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Gas"; + s_mat->NumW5Gases = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumW5Gases; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; auto *matGas = new MaterialGasMix; - state.dataMaterial->Material(MaterNum) = matGas; - matGas->group = Group::WindowGas; + matGas->group = Group::Gas; + matGas->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(matGas); + matGas->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(matGas->Name, matGas->Num); + matGas->numGases = 1; matGas->gasFracts[0] = 1.0; // Load the material derived type from the input data. - matGas->Name = MaterialNames(1); - matGas->gases[0].type = static_cast(getEnumValue(gasTypeNamesUC, Util::makeUPPER(MaterialNames(2)))); + matGas->gases[0].type = static_cast(getEnumValue(gasTypeNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(2)))); matGas->Roughness = SurfaceRoughness::MediumRough; - matGas->Thickness = MaterialProps(1); + matGas->Thickness = s_ipsc->rNumericArgs(1); matGas->ROnly = true; gasType = matGas->gases[0].type; @@ -1149,39 +1003,37 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // Custom gas if (gasType == GasType::Custom) { - matGas->gases[0].con.c0 = MaterialProps(2); - matGas->gases[0].con.c1 = MaterialProps(3); - matGas->gases[0].con.c2 = MaterialProps(4); - matGas->gases[0].vis.c0 = MaterialProps(5); - matGas->gases[0].vis.c1 = MaterialProps(6); - matGas->gases[0].vis.c2 = MaterialProps(7); - matGas->gases[0].cp.c0 = MaterialProps(8); - matGas->gases[0].cp.c1 = MaterialProps(9); - matGas->gases[0].cp.c2 = MaterialProps(10); - matGas->gases[0].wght = MaterialProps(11); - matGas->gases[0].specHeatRatio = MaterialProps(12); + matGas->gases[0].con.c0 = s_ipsc->rNumericArgs(2); + matGas->gases[0].con.c1 = s_ipsc->rNumericArgs(3); + matGas->gases[0].con.c2 = s_ipsc->rNumericArgs(4); + matGas->gases[0].vis.c0 = s_ipsc->rNumericArgs(5); + matGas->gases[0].vis.c1 = s_ipsc->rNumericArgs(6); + matGas->gases[0].vis.c2 = s_ipsc->rNumericArgs(7); + matGas->gases[0].cp.c0 = s_ipsc->rNumericArgs(8); + matGas->gases[0].cp.c1 = s_ipsc->rNumericArgs(9); + matGas->gases[0].cp.c2 = s_ipsc->rNumericArgs(10); + matGas->gases[0].wght = s_ipsc->rNumericArgs(11); + matGas->gases[0].specHeatRatio = s_ipsc->rNumericArgs(12); // Check for errors in custom gas properties // IF(dataMaterial.Material(MaterNum)%GasCon(1,1) <= 0.0) THEN // ErrorsFound = .TRUE. // CALL ShowSevereError(state, 'Conductivity Coefficient A for custom window gas='& - // //TRIM(MaterialNames(1))//' should be > 0.') + // //TRIM(s_ipsc->cAlphaArgs(1))//' should be > 0.') // END IF if (matGas->gases[0].vis.c0 <= 0.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(5) + " not > 0.0"); + ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(5))); } if (matGas->gases[0].cp.c0 <= 0.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(8) + " not > 0.0"); + ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(8))); } if (matGas->gases[0].wght <= 0.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(11) + " not > 0.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(11) + " not > 0.0"); } } @@ -1189,9 +1041,9 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (!ErrorsFound) { DenomRGas = (matGas->gases[0].con.c0 + matGas->gases[0].con.c1 * 300.0 + matGas->gases[0].con.c2 * 90000.0); if (DenomRGas > 0.0) { - state.dataHeatBal->NominalR(MaterNum) = matGas->Thickness / DenomRGas; + matGas->NominalR = matGas->Thickness / DenomRGas; } else { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); ShowContinueError(state, format("Nominal resistance of gap at room temperature calculated at a negative Conductivity=[{:.3R}].", DenomRGas)); ErrorsFound = true; @@ -1201,47 +1053,50 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // Window gap materials (for gaps with a single gas for EquivalentLayer) - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Gap:EquivalentLayer"; - for (Loop = 1; Loop <= state.dataHeatBal->W5GapMatEQL; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Gap:EquivalentLayer"; + s_mat->NumEQLGaps = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumEQLGaps; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; auto *matGas = new MaterialGasMix; - state.dataMaterial->Material(MaterNum) = matGas; - matGas->group = Group::GapEquivalentLayer; + matGas->group = Group::WindowGapEQL; + matGas->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(matGas); + matGas->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(matGas->Name, matGas->Num); + matGas->numGases = 1; matGas->gasFracts[0] = 1.0; // Load the material derived type from the input data. - matGas->Name = MaterialNames(1); - matGas->gases[0].type = static_cast(getEnumValue(gasTypeNamesUC, Util::makeUPPER(MaterialNames(2)))); // Error check? + matGas->gases[0].type = static_cast(getEnumValue(gasTypeNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(2)))); // Error check? matGas->Roughness = SurfaceRoughness::MediumRough; - matGas->Thickness = MaterialProps(1); + matGas->Thickness = s_ipsc->rNumericArgs(1); matGas->ROnly = true; gasType = matGas->gases[0].type; @@ -1249,40 +1104,40 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if matGas->gases[0] = gases[(int)gasType]; } - if (!ipsc->lAlphaFieldBlanks(2)) { + if (!s_ipsc->lAlphaFieldBlanks(2)) { // Get gap vent type - matGas->gapVentType = static_cast(getEnumValue(gapVentTypeNamesUC, Util::makeUPPER(MaterialNames(3)))); + matGas->gapVentType = static_cast(getEnumValue(gapVentTypeNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(3)))); } if (gasType == GasType::Custom) { for (ICoeff = 1; ICoeff <= 3; ++ICoeff) { - matGas->gases[0].con.c0 = MaterialProps(2); - matGas->gases[0].con.c1 = MaterialProps(3); - matGas->gases[0].con.c2 = MaterialProps(4); - matGas->gases[0].vis.c0 = MaterialProps(5); - matGas->gases[0].vis.c1 = MaterialProps(6); - matGas->gases[0].vis.c2 = MaterialProps(7); - matGas->gases[0].cp.c0 = MaterialProps(8); - matGas->gases[0].cp.c1 = MaterialProps(9); - matGas->gases[0].cp.c2 = MaterialProps(10); + matGas->gases[0].con.c0 = s_ipsc->rNumericArgs(2); + matGas->gases[0].con.c1 = s_ipsc->rNumericArgs(3); + matGas->gases[0].con.c2 = s_ipsc->rNumericArgs(4); + matGas->gases[0].vis.c0 = s_ipsc->rNumericArgs(5); + matGas->gases[0].vis.c1 = s_ipsc->rNumericArgs(6); + matGas->gases[0].vis.c2 = s_ipsc->rNumericArgs(7); + matGas->gases[0].cp.c0 = s_ipsc->rNumericArgs(8); + matGas->gases[0].cp.c1 = s_ipsc->rNumericArgs(9); + matGas->gases[0].cp.c2 = s_ipsc->rNumericArgs(10); } - matGas->gases[0].wght = MaterialProps(11); - matGas->gases[0].specHeatRatio = MaterialProps(12); + matGas->gases[0].wght = s_ipsc->rNumericArgs(11); + matGas->gases[0].specHeatRatio = s_ipsc->rNumericArgs(12); if (matGas->gases[0].vis.c0 <= 0.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not > 0.0", ipsc->cNumericFieldNames(5))); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} not > 0.0", s_ipsc->cNumericFieldNames(5))); } if (matGas->gases[0].cp.c0 <= 0.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not > 0.0", ipsc->cNumericFieldNames(8))); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} not > 0.0", s_ipsc->cNumericFieldNames(8))); } if (matGas->gases[0].wght <= 0.0) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} not > 0.0", ipsc->cNumericFieldNames(11))); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} not > 0.0", s_ipsc->cNumericFieldNames(11))); } } @@ -1290,9 +1145,9 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (!ErrorsFound) { DenomRGas = (matGas->gases[0].con.c0 + matGas->gases[0].con.c1 * 300.0 + matGas->gases[0].con.c2 * 90000.0); if (DenomRGas > 0.0) { - state.dataHeatBal->NominalR(MaterNum) = matGas->Thickness / DenomRGas; + matGas->NominalR = matGas->Thickness / DenomRGas; } else { - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Nominal resistance of gap at room temperature calculated at a negative Conductivity=[{:.3R}].", DenomRGas)); ErrorsFound = true; @@ -1302,48 +1157,50 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // Window gas mixtures (for gaps with two or more gases) - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:GasMixture"; - for (Loop = 1; Loop <= state.dataHeatBal->W5GasMatMixture; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:GasMixture"; + s_mat->NumW5GasMixtures = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumW5GasMixtures; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - ipsc->cAlphaArgs, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - ipsc->cAlphaArgs(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; auto *matGas = new MaterialGasMix; - state.dataMaterial->Material(MaterNum) = matGas; - matGas->group = Group::WindowGasMixture; + matGas->group = Group::GasMixture; + matGas->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(matGas); + matGas->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(matGas->Name, matGas->Num); + matGas->gases[0].type = matGas->gases[1].type = matGas->gases[2].type = matGas->gases[3].type = matGas->gases[4].type = GasType::Invalid; // Load the material derived type from the input data. - matGas->Name = ipsc->cAlphaArgs(1); - NumGases = MaterialProps(2); + NumGases = s_ipsc->rNumericArgs(2); matGas->numGases = NumGases; for (NumGas = 0; NumGas < NumGases; ++NumGas) { auto &gas = matGas->gases[NumGas]; - gas.type = static_cast(getEnumValue(gasTypeNamesUC, Util::makeUPPER(ipsc->cAlphaArgs(2 + NumGas)))); + gas.type = static_cast(getEnumValue(gasTypeNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(2 + NumGas)))); if (gas.type == GasType::Invalid) { - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, ipsc->cAlphaArgs(1 + NumGas))); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1 + NumGas))); // Error check? ErrorsFound = true; } @@ -1351,412 +1208,417 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if matGas->Roughness = SurfaceRoughness::MediumRough; // Unused - matGas->Thickness = MaterialProps(1); + matGas->Thickness = s_ipsc->rNumericArgs(1); if (matGas->Thickness <= 0.0) { - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, ipsc->cNumericFieldNames(1) + " must be greater than 0."); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, s_ipsc->cNumericFieldNames(1) + " must be greater than 0."); } matGas->ROnly = true; for (NumGas = 0; NumGas < NumGases; ++NumGas) { GasType gasType = matGas->gases[NumGas].type; if (gasType != GasType::Custom) { - matGas->gasFracts[NumGas] = MaterialProps(3 + NumGas); + matGas->gasFracts[NumGas] = s_ipsc->rNumericArgs(3 + NumGas); matGas->gases[NumGas] = gases[(int)gasType]; } } // Nominal resistance of gap at room temperature (based on first gas in mixture) - state.dataHeatBal->NominalR(MaterNum) = - matGas->Thickness / (matGas->gases[0].con.c0 + matGas->gases[0].con.c1 * 300.0 + matGas->gases[0].con.c2 * 90000.0); + matGas->NominalR = matGas->Thickness / (matGas->gases[0].con.c0 + matGas->gases[0].con.c1 * 300.0 + matGas->gases[0].con.c2 * 90000.0); } // Window Shade Materials - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Shade"; - for (Loop = 1; Loop <= state.dataHeatBal->TotShades; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Shade"; + s_mat->NumShades = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumShades; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::Shade; - - // Load the material derived type from the input data. - - thisMaterial->Name = MaterialNames(1); - thisMaterial->Roughness = SurfaceRoughness::MediumRough; - thisMaterial->Trans = MaterialProps(1); - thisMaterial->ReflectShade = MaterialProps(2); - thisMaterial->TransVis = MaterialProps(3); - thisMaterial->ReflectShadeVis = MaterialProps(4); - thisMaterial->AbsorpThermal = MaterialProps(5); - thisMaterial->AbsorpThermalInput = MaterialProps(5); - thisMaterial->TransThermal = MaterialProps(6); - thisMaterial->Thickness = MaterialProps(7); - thisMaterial->Conductivity = MaterialProps(8); - thisMaterial->AbsorpSolar = max(0.0, 1.0 - thisMaterial->Trans - thisMaterial->ReflectShade); - thisMaterial->AbsorpSolarInput = thisMaterial->AbsorpSolar; - thisMaterial->WinShadeToGlassDist = MaterialProps(9); - thisMaterial->WinShadeTopOpeningMult = MaterialProps(10); - thisMaterial->WinShadeBottomOpeningMult = MaterialProps(11); - thisMaterial->WinShadeLeftOpeningMult = MaterialProps(12); - thisMaterial->WinShadeRightOpeningMult = MaterialProps(13); - thisMaterial->WinShadeAirFlowPermeability = MaterialProps(14); - thisMaterial->ROnly = true; - - if (thisMaterial->Conductivity > 0.0) { - state.dataHeatBal->NominalR(MaterNum) = thisMaterial->Thickness / thisMaterial->Conductivity; + auto *mat = new MaterialShade; + mat->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + mat->Roughness = SurfaceRoughness::MediumRough; + mat->Trans = s_ipsc->rNumericArgs(1); + mat->ReflectShade = s_ipsc->rNumericArgs(2); + mat->TransVis = s_ipsc->rNumericArgs(3); + mat->ReflectShadeVis = s_ipsc->rNumericArgs(4); + mat->AbsorpThermal = s_ipsc->rNumericArgs(5); + mat->AbsorpThermalInput = s_ipsc->rNumericArgs(5); + mat->TransThermal = s_ipsc->rNumericArgs(6); + mat->Thickness = s_ipsc->rNumericArgs(7); + mat->Conductivity = s_ipsc->rNumericArgs(8); + mat->AbsorpSolar = max(0.0, 1.0 - mat->Trans - mat->ReflectShade); + mat->AbsorpSolarInput = mat->AbsorpSolar; + mat->toGlassDist = s_ipsc->rNumericArgs(9); + mat->topOpeningMult = s_ipsc->rNumericArgs(10); + mat->bottomOpeningMult = s_ipsc->rNumericArgs(11); + mat->leftOpeningMult = s_ipsc->rNumericArgs(12); + mat->rightOpeningMult = s_ipsc->rNumericArgs(13); + mat->airFlowPermeability = s_ipsc->rNumericArgs(14); + mat->ROnly = true; + + if (mat->Conductivity > 0.0) { + mat->NominalR = mat->Thickness / mat->Conductivity; } else { - state.dataHeatBal->NominalR(MaterNum) = 1.0; + mat->NominalR = 1.0; } - if (MaterialProps(1) + MaterialProps(2) >= 1.0) { + if (s_ipsc->rNumericArgs(1) + s_ipsc->rNumericArgs(2) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(1) + " + " + ipsc->cNumericFieldNames(2) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(1) + " + " + s_ipsc->cNumericFieldNames(2) + " not < 1.0"); } - if (MaterialProps(3) + MaterialProps(4) >= 1.0) { + if (s_ipsc->rNumericArgs(3) + s_ipsc->rNumericArgs(4) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(3) + " + " + ipsc->cNumericFieldNames(4) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(3) + " + " + s_ipsc->cNumericFieldNames(4) + " not < 1.0"); } - if (MaterialProps(5) + MaterialProps(6) >= 1.0) { + if (s_ipsc->rNumericArgs(5) + s_ipsc->rNumericArgs(6) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(5) + " + " + ipsc->cNumericFieldNames(6) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(5) + " + " + s_ipsc->cNumericFieldNames(6) + " not < 1.0"); } } // Window Shade Materials - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Shade:EquivalentLayer"; - for (Loop = 1; Loop <= state.dataHeatBal->TotShadesEQL; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Shade:EquivalentLayer"; + s_mat->NumEQLShades = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumEQLShades; ++Loop) { - MaterialProps = 0; + s_ipsc->rNumericArgs = 0; // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::ShadeEquivalentLayer; + auto *mat = new MaterialShadeEQL; + mat->group = Group::ShadeEQL; + mat->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); - thisMaterial->Name = MaterialNames(1); - thisMaterial->Roughness = SurfaceRoughness::MediumRough; - thisMaterial->ROnly = true; + mat->Roughness = SurfaceRoughness::MediumRough; + mat->ROnly = true; // Front side and back side have the same beam-Beam Transmittance - thisMaterial->TausFrontBeamBeam = MaterialProps(1); - thisMaterial->TausBackBeamBeam = MaterialProps(1); - thisMaterial->TausFrontBeamDiff = MaterialProps(2); - thisMaterial->TausBackBeamDiff = MaterialProps(3); - thisMaterial->ReflFrontBeamDiff = MaterialProps(4); - thisMaterial->ReflBackBeamDiff = MaterialProps(5); - thisMaterial->TausFrontBeamBeamVis = MaterialProps(6); - thisMaterial->TausFrontBeamDiffVis = MaterialProps(7); - thisMaterial->ReflFrontBeamDiffVis = MaterialProps(8); - thisMaterial->TausThermal = MaterialProps(9); - thisMaterial->EmissThermalFront = MaterialProps(10); - thisMaterial->EmissThermalBack = MaterialProps(11); + mat->TAR.Sol.Ft.Bm[0].BmTra = s_ipsc->rNumericArgs(1); + mat->TAR.Sol.Bk.Bm[0].BmTra = s_ipsc->rNumericArgs(1); + mat->TAR.Sol.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(2); + mat->TAR.Sol.Bk.Bm[0].DfTra = s_ipsc->rNumericArgs(3); + mat->TAR.Sol.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(4); + mat->TAR.Sol.Bk.Bm[0].DfRef = s_ipsc->rNumericArgs(5); + mat->TAR.Vis.Ft.Bm[0].BmTra = s_ipsc->rNumericArgs(6); + mat->TAR.Vis.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(7); + mat->TAR.Vis.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(8); + mat->TAR.IR.Ft.Tra = mat->TAR.IR.Bk.Tra = s_ipsc->rNumericArgs(9); + mat->TAR.IR.Ft.Emi = s_ipsc->rNumericArgs(10); + mat->TAR.IR.Bk.Emi = s_ipsc->rNumericArgs(11); // Assumes thermal emissivity is the same as thermal absorptance - thisMaterial->AbsorpThermalFront = thisMaterial->EmissThermalFront; - thisMaterial->AbsorpThermalBack = thisMaterial->EmissThermalBack; - thisMaterial->TransThermal = thisMaterial->TausThermal; + mat->AbsorpThermalFront = mat->TAR.IR.Ft.Emi; + mat->AbsorpThermalBack = mat->TAR.IR.Bk.Emi; + mat->TransThermal = mat->TAR.IR.Ft.Tra; - if (MaterialProps(1) + MaterialProps(2) + MaterialProps(4) >= 1.0) { + if (s_ipsc->rNumericArgs(1) + s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(4) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, - ipsc->cNumericFieldNames(1) + " + " + ipsc->cNumericFieldNames(2) + " + " + ipsc->cNumericFieldNames(4) + "not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError( + state, s_ipsc->cNumericFieldNames(1) + " + " + s_ipsc->cNumericFieldNames(2) + " + " + s_ipsc->cNumericFieldNames(4) + "not < 1.0"); } - if (MaterialProps(1) + MaterialProps(3) + MaterialProps(5) >= 1.0) { + if (s_ipsc->rNumericArgs(1) + s_ipsc->rNumericArgs(3) + s_ipsc->rNumericArgs(5) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, - ipsc->cNumericFieldNames(1) + " + " + ipsc->cNumericFieldNames(3) + " + " + ipsc->cNumericFieldNames(5) + "not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError( + state, s_ipsc->cNumericFieldNames(1) + " + " + s_ipsc->cNumericFieldNames(3) + " + " + s_ipsc->cNumericFieldNames(5) + "not < 1.0"); } - if (MaterialProps(6) + MaterialProps(7) + MaterialProps(8) >= 1.0) { + if (s_ipsc->rNumericArgs(6) + s_ipsc->rNumericArgs(7) + s_ipsc->rNumericArgs(8) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, - ipsc->cNumericFieldNames(6) + " + " + ipsc->cNumericFieldNames(7) + " + " + ipsc->cNumericFieldNames(8) + "not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError( + state, s_ipsc->cNumericFieldNames(6) + " + " + s_ipsc->cNumericFieldNames(7) + " + " + s_ipsc->cNumericFieldNames(8) + "not < 1.0"); } - if (MaterialProps(9) + MaterialProps(10) >= 1.0) { + if (s_ipsc->rNumericArgs(9) + s_ipsc->rNumericArgs(10) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(9) + " + " + ipsc->cNumericFieldNames(10) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(9) + " + " + s_ipsc->cNumericFieldNames(10) + " not < 1.0"); } - if (MaterialProps(9) + MaterialProps(11) >= 1.0) { + if (s_ipsc->rNumericArgs(9) + s_ipsc->rNumericArgs(11) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(9) + " + " + ipsc->cNumericFieldNames(11) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(9) + " + " + s_ipsc->cNumericFieldNames(11) + " not < 1.0"); } } // TotShadesEQL loop // Window drape materials - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Drape:EquivalentLayer"; - for (Loop = 1; Loop <= state.dataHeatBal->TotDrapesEQL; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Drape:EquivalentLayer"; + s_mat->NumEQLDrapes = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumEQLDrapes; ++Loop) { - MaterialProps = 0; + s_ipsc->rNumericArgs = 0; // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::DrapeEquivalentLayer; + auto *mat = new MaterialDrapeEQL; + mat->group = Group::DrapeEQL; + mat->Name = s_ipsc->cAlphaArgs(1); - thisMaterial->Name = MaterialNames(1); - thisMaterial->Roughness = SurfaceRoughness::MediumRough; - thisMaterial->ROnly = true; + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + mat->Roughness = SurfaceRoughness::MediumRough; + mat->ROnly = true; // Front side and back side have the same properties - thisMaterial->TausFrontBeamBeam = MaterialProps(1); - thisMaterial->TausBackBeamBeam = MaterialProps(1); - - thisMaterial->TausFrontBeamDiff = MaterialProps(2); - thisMaterial->TausBackBeamDiff = MaterialProps(3); - - thisMaterial->ReflFrontBeamDiff = MaterialProps(4); - thisMaterial->ReflBackBeamDiff = MaterialProps(5); - thisMaterial->TausFrontBeamBeamVis = MaterialProps(6); - thisMaterial->TausFrontBeamDiffVis = MaterialProps(7); - thisMaterial->ReflFrontBeamDiffVis = MaterialProps(8); - thisMaterial->TausThermal = MaterialProps(9); - thisMaterial->EmissThermalFront = MaterialProps(10); - thisMaterial->EmissThermalBack = MaterialProps(11); + mat->TAR.Sol.Ft.Bm[0].BmTra = s_ipsc->rNumericArgs(1); + mat->TAR.Sol.Bk.Bm[0].BmTra = s_ipsc->rNumericArgs(1); + + mat->TAR.Sol.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(2); + mat->TAR.Sol.Bk.Bm[0].DfTra = s_ipsc->rNumericArgs(3); + + mat->TAR.Sol.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(4); + mat->TAR.Sol.Bk.Bm[0].DfRef = s_ipsc->rNumericArgs(5); + mat->TAR.Vis.Ft.Bm[0].BmTra = s_ipsc->rNumericArgs(6); + mat->TAR.Vis.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(7); + mat->TAR.Vis.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(8); + mat->TAR.IR.Ft.Tra = mat->TAR.IR.Bk.Tra = s_ipsc->rNumericArgs(9); + mat->TAR.IR.Ft.Emi = s_ipsc->rNumericArgs(10); + mat->TAR.IR.Bk.Emi = s_ipsc->rNumericArgs(11); // Assumes thermal emissivity is the same as thermal absorptance - thisMaterial->AbsorpThermalFront = thisMaterial->EmissThermalFront; - thisMaterial->AbsorpThermalBack = thisMaterial->EmissThermalBack; - thisMaterial->TransThermal = thisMaterial->TausThermal; - - if (!ipsc->lNumericFieldBlanks(12) && !ipsc->lNumericFieldBlanks(13)) { - if (MaterialProps(12) != 0.0 && MaterialProps(13) != 0.0) { - thisMaterial->PleatedDrapeWidth = MaterialProps(12); - thisMaterial->PleatedDrapeLength = MaterialProps(13); - thisMaterial->ISPleatedDrape = true; + mat->AbsorpThermalFront = mat->TAR.IR.Ft.Emi; + mat->AbsorpThermalBack = mat->TAR.IR.Bk.Emi; + mat->TransThermal = mat->TAR.IR.Ft.Tra; + + if (!s_ipsc->lNumericFieldBlanks(12) && !s_ipsc->lNumericFieldBlanks(13)) { + if (s_ipsc->rNumericArgs(12) != 0.0 && s_ipsc->rNumericArgs(13) != 0.0) { + mat->pleatedWidth = s_ipsc->rNumericArgs(12); + mat->pleatedLength = s_ipsc->rNumericArgs(13); + mat->isPleated = true; } } else { - thisMaterial->ISPleatedDrape = false; + mat->isPleated = false; } - if (MaterialProps(1) + MaterialProps(2) + MaterialProps(4) >= 1.0) { + if (s_ipsc->rNumericArgs(1) + s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(4) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, - ipsc->cNumericFieldNames(1) + " + " + ipsc->cNumericFieldNames(2) + " + " + ipsc->cNumericFieldNames(4) + "not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError( + state, s_ipsc->cNumericFieldNames(1) + " + " + s_ipsc->cNumericFieldNames(2) + " + " + s_ipsc->cNumericFieldNames(4) + "not < 1.0"); } - if (MaterialProps(6) + MaterialProps(7) + MaterialProps(8) >= 1.0) { + if (s_ipsc->rNumericArgs(6) + s_ipsc->rNumericArgs(7) + s_ipsc->rNumericArgs(8) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, - ipsc->cNumericFieldNames(4) + " + " + ipsc->cNumericFieldNames(5) + " + " + ipsc->cNumericFieldNames(6) + "not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError( + state, s_ipsc->cNumericFieldNames(4) + " + " + s_ipsc->cNumericFieldNames(5) + " + " + s_ipsc->cNumericFieldNames(6) + "not < 1.0"); } - if (MaterialProps(9) + MaterialProps(10) > 1.0) { + if (s_ipsc->rNumericArgs(9) + s_ipsc->rNumericArgs(10) > 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(9) + " + " + ipsc->cNumericFieldNames(10) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(9) + " + " + s_ipsc->cNumericFieldNames(10) + " not < 1.0"); } } // TotDrapesEQL loop // Window Screen Materials - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Screen"; - for (Loop = 1; Loop <= state.dataHeatBal->TotScreens; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Screen"; + s_mat->NumScreens = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumScreens; ++Loop) { // Call GetObjectItem routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; auto *matScreen = new MaterialScreen; - state.dataMaterial->Material(MaterNum) = matScreen; + matScreen->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(matScreen); + matScreen->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(matScreen->Name, matScreen->Num); // Load the material derived type from the input data. - matScreen->Name = MaterialNames(1); matScreen->bmRefModel = - static_cast(getEnumValue(screenBeamReflectanceModelNamesUC, Util::makeUPPER(MaterialNames(2)))); + static_cast(getEnumValue(screenBeamReflectanceModelNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(2)))); if (matScreen->bmRefModel == ScreenBeamReflectanceModel::Invalid) { - ShowSevereError(state, format("{}=\"{}\", Illegal value.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError( - state, - format("{}=\"{}\", must be one of DoNotModel, ModelAsDirectBeam or ModelAsDiffuse.", ipsc->cAlphaFieldNames(2), MaterialNames(2))); + ShowSevereError(state, format("{}=\"{}\", Illegal value.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, + format("{}=\"{}\", must be one of DoNotModel, ModelAsDirectBeam or ModelAsDiffuse.", + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } matScreen->Roughness = SurfaceRoughness::MediumRough; - matScreen->ShadeRef = MaterialProps(1); + matScreen->ShadeRef = s_ipsc->rNumericArgs(1); if (matScreen->ShadeRef < 0.0 || matScreen->ShadeRef > 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(1) + " must be >= 0 and <= 1"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(1) + " must be >= 0 and <= 1"); } - matScreen->ShadeRefVis = MaterialProps(2); + matScreen->ShadeRefVis = s_ipsc->rNumericArgs(2); if (matScreen->ShadeRefVis < 0.0 || matScreen->ShadeRefVis > 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(2) + " must be >= 0 and <= 1 for material " + matScreen->Name + '.'); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(2) + " must be >= 0 and <= 1 for material " + matScreen->Name + '.'); } - matScreen->AbsorpThermal = MaterialProps(3); - matScreen->AbsorpThermalInput = MaterialProps(3); + matScreen->AbsorpThermal = s_ipsc->rNumericArgs(3); + matScreen->AbsorpThermalInput = s_ipsc->rNumericArgs(3); if (matScreen->AbsorpThermal < 0.0 || matScreen->AbsorpThermal > 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(3) + " must be >= 0 and <= 1"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(3) + " must be >= 0 and <= 1"); } - matScreen->Conductivity = MaterialProps(4); - matScreen->Thickness = MaterialProps(6); // thickness = diameter + matScreen->Conductivity = s_ipsc->rNumericArgs(4); + matScreen->Thickness = s_ipsc->rNumericArgs(6); // thickness = diameter - if (MaterialProps(5) > 0.0) { - // Screens(ScNum)%ScreenDiameterToSpacingRatio = MaterialProps(6)/MaterialProps(5) or + if (s_ipsc->rNumericArgs(5) > 0.0) { + // Screens(ScNum)%ScreenDiameterToSpacingRatio = s_ipsc->rNumericArgs(6)/s_ipsc->rNumericArgs(5) or // 1-SQRT(dataMaterial.Material(MaterNum)%Trans - if (MaterialProps(6) / MaterialProps(5) >= 1.0) { + if (s_ipsc->rNumericArgs(6) / s_ipsc->rNumericArgs(5) >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(6) + " must be less than " + ipsc->cNumericFieldNames(5)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(6) + " must be less than " + s_ipsc->cNumericFieldNames(5)); } else { // Calculate direct normal transmittance (open area fraction) - matScreen->Trans = pow_2(1.0 - MaterialProps(6) / MaterialProps(5)); + matScreen->Trans = pow_2(1.0 - s_ipsc->rNumericArgs(6) / s_ipsc->rNumericArgs(5)); } } else { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(5) + " must be > 0."); - MaterialProps(5) = 0.000000001; + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(5) + " must be > 0."); + s_ipsc->rNumericArgs(5) = 0.000000001; } - if (MaterialProps(6) <= 0.0) { + if (s_ipsc->rNumericArgs(6) <= 0.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(6) + " must be > 0."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(6) + " must be > 0."); } // Modify reflectance to account for the open area in the screen assembly matScreen->ShadeRef *= (1.0 - matScreen->Trans); matScreen->ShadeRefVis *= (1.0 - matScreen->Trans); - matScreen->toGlassDist = MaterialProps(7); + matScreen->toGlassDist = s_ipsc->rNumericArgs(7); if (matScreen->toGlassDist < 0.001 || matScreen->toGlassDist > 1.0) { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(7) + " must be greater than or equal to 0.001 and less than or equal to 1."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(7) + " must be greater than or equal to 0.001 and less than or equal to 1."); } - matScreen->topOpeningMult = MaterialProps(8); + matScreen->topOpeningMult = s_ipsc->rNumericArgs(8); if (matScreen->topOpeningMult < 0.0 || matScreen->topOpeningMult > 1.0) { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(8) + " must be greater than or equal to 0 and less than or equal to 1."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(8) + " must be greater than or equal to 0 and less than or equal to 1."); } - matScreen->bottomOpeningMult = MaterialProps(9); + matScreen->bottomOpeningMult = s_ipsc->rNumericArgs(9); if (matScreen->bottomOpeningMult < 0.0 || matScreen->bottomOpeningMult > 1.0) { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(9) + " must be greater than or equal to 0 and less than or equal to 1."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(9) + " must be greater than or equal to 0 and less than or equal to 1."); } - matScreen->leftOpeningMult = MaterialProps(10); + matScreen->leftOpeningMult = s_ipsc->rNumericArgs(10); if (matScreen->leftOpeningMult < 0.0 || matScreen->leftOpeningMult > 1.0) { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(10) + " must be greater than or equal to 0 and less than or equal to 1."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(10) + " must be greater than or equal to 0 and less than or equal to 1."); } - matScreen->rightOpeningMult = MaterialProps(11); + matScreen->rightOpeningMult = s_ipsc->rNumericArgs(11); if (matScreen->rightOpeningMult < 0.0 || matScreen->rightOpeningMult > 1.0) { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(11) + " must be greater than or equal to 0 and less than or equal to 1."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(11) + " must be greater than or equal to 0 and less than or equal to 1."); } - matScreen->mapDegResolution = MaterialProps(12); + matScreen->mapDegResolution = s_ipsc->rNumericArgs(12); if (matScreen->mapDegResolution < 0 || matScreen->mapDegResolution > 5 || matScreen->mapDegResolution == 4) { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(12) + " must be 0, 1, 2, 3, or 5."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(12) + " must be 0, 1, 2, 3, or 5."); ErrorsFound = true; } @@ -1776,9 +1638,9 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if matScreen->AbsorpThermalInput = matScreen->AbsorpThermal; if (matScreen->Conductivity > 0.0) { - state.dataHeatBal->NominalR(MaterNum) = (1.0 - matScreen->Trans) * matScreen->Thickness / matScreen->Conductivity; + matScreen->NominalR = (1.0 - matScreen->Trans) * matScreen->Thickness / matScreen->Conductivity; } else { - state.dataHeatBal->NominalR(MaterNum) = 1.0; + matScreen->NominalR = 1.0; ShowWarningError( state, "Conductivity for material=\"" + matScreen->Name + @@ -1787,394 +1649,373 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (matScreen->Trans + matScreen->ShadeRef >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); ShowContinueError(state, "Calculated solar transmittance + solar reflectance not < 1.0"); ShowContinueError(state, "See Engineering Reference for calculation procedure for solar transmittance."); } if (matScreen->TransVis + matScreen->ShadeRefVis >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); ShowContinueError(state, "Calculated visible transmittance + visible reflectance not < 1.0"); ShowContinueError(state, "See Engineering Reference for calculation procedure for visible solar transmittance."); } if (matScreen->TransThermal + matScreen->AbsorpThermal >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, "Thermal hemispherical emissivity plus open area fraction (1-diameter/spacing)**2 not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowSevereError(state, "Thermal hemispherical emissivity plus open area fraction (1-diameter/spacing)**2 not < 1.0"); } } - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Screen:EquivalentLayer"; - for (Loop = 1; Loop <= state.dataHeatBal->TotScreensEQL; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Screen:EquivalentLayer"; + s_mat->NumEQLScreens = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumEQLScreens; ++Loop) { - MaterialProps = 0; + s_ipsc->rNumericArgs = 0; // Call GetObjectItem routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *matScreen = new MaterialChild; - state.dataMaterial->Material(MaterNum) = matScreen; - matScreen->group = Group::ScreenEquivalentLayer; + auto *matScreen = new MaterialScreenEQL; + matScreen->group = Group::ScreenEQL; + matScreen->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(matScreen); + matScreen->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(matScreen->Name, matScreen->Num); // Load the material derived type from the input data. // WindowMaterial:Screen:EquivalentLayer, - matScreen->Name = MaterialNames(1); matScreen->Roughness = SurfaceRoughness::MediumRough; matScreen->ROnly = true; - matScreen->TausFrontBeamBeam = MaterialProps(1); - matScreen->TausBackBeamBeam = MaterialProps(1); - matScreen->TausFrontBeamDiff = MaterialProps(2); - matScreen->TausBackBeamDiff = MaterialProps(2); - matScreen->ReflFrontBeamDiff = MaterialProps(3); - matScreen->ReflBackBeamDiff = MaterialProps(3); - matScreen->TausFrontBeamBeamVis = MaterialProps(4); - matScreen->TausFrontBeamDiffVis = MaterialProps(5); - matScreen->ReflFrontDiffDiffVis = MaterialProps(6); - matScreen->TausThermal = MaterialProps(7); - matScreen->EmissThermalFront = MaterialProps(8); - matScreen->EmissThermalBack = MaterialProps(8); + matScreen->TAR.Sol.Ft.Bm[0].BmTra = s_ipsc->rNumericArgs(1); + matScreen->TAR.Sol.Bk.Bm[0].BmTra = s_ipsc->rNumericArgs(1); + matScreen->TAR.Sol.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(2); + matScreen->TAR.Sol.Bk.Bm[0].DfTra = s_ipsc->rNumericArgs(2); + matScreen->TAR.Sol.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(3); + matScreen->TAR.Sol.Bk.Bm[0].DfRef = s_ipsc->rNumericArgs(3); + matScreen->TAR.Vis.Ft.Bm[0].BmTra = s_ipsc->rNumericArgs(4); + matScreen->TAR.Vis.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(5); + matScreen->TAR.Vis.Ft.Df.Ref = s_ipsc->rNumericArgs(6); + matScreen->TAR.IR.Ft.Tra = matScreen->TAR.IR.Bk.Tra = s_ipsc->rNumericArgs(7); + matScreen->TAR.IR.Ft.Emi = s_ipsc->rNumericArgs(8); + matScreen->TAR.IR.Bk.Emi = s_ipsc->rNumericArgs(8); // Assumes thermal emissivity is the same as thermal absorptance - matScreen->AbsorpThermalFront = matScreen->EmissThermalFront; - matScreen->AbsorpThermalBack = matScreen->EmissThermalBack; - matScreen->TransThermal = matScreen->TausThermal; + matScreen->AbsorpThermalFront = matScreen->TAR.IR.Ft.Emi; + matScreen->AbsorpThermalBack = matScreen->TAR.IR.Bk.Emi; + matScreen->TransThermal = matScreen->TAR.IR.Ft.Tra; - if (MaterialProps(3) < 0.0 || MaterialProps(3) > 1.0) { + if (s_ipsc->rNumericArgs(3) < 0.0 || s_ipsc->rNumericArgs(3) > 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(3) + " must be >= 0 and <= 1"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(3) + " must be >= 0 and <= 1"); } - if (MaterialProps(6) < 0.0 || MaterialProps(6) > 1.0) { + if (s_ipsc->rNumericArgs(6) < 0.0 || s_ipsc->rNumericArgs(6) > 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(6) + " must be >= 0 and <= 1 for material " + matScreen->Name + '.'); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(6) + " must be >= 0 and <= 1 for material " + matScreen->Name + '.'); } - if (!ipsc->lNumericFieldBlanks(9)) { - if (MaterialProps(9) > 0.00001) { - matScreen->ScreenWireSpacing = MaterialProps(9); // screen wire spacing + if (!s_ipsc->lNumericFieldBlanks(9)) { + if (s_ipsc->rNumericArgs(9) > 0.00001) { + matScreen->wireSpacing = s_ipsc->rNumericArgs(9); // screen wire spacing } else { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(9) + " must be > 0."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(9) + " must be > 0."); ShowContinueError(state, "...Setting screen wire spacing to a default value of 0.025m and simulation continues."); - matScreen->ScreenWireSpacing = 0.025; + matScreen->wireSpacing = 0.025; } } - if (!ipsc->lNumericFieldBlanks(10)) { - if (MaterialProps(10) > 0.00001 && MaterialProps(10) < matScreen->ScreenWireSpacing) { - matScreen->ScreenWireDiameter = MaterialProps(10); // screen wire spacing + if (!s_ipsc->lNumericFieldBlanks(10)) { + if (s_ipsc->rNumericArgs(10) > 0.00001 && s_ipsc->rNumericArgs(10) < matScreen->wireSpacing) { + matScreen->wireDiameter = s_ipsc->rNumericArgs(10); // screen wire spacing } else { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value."); - ShowContinueError(state, ipsc->cNumericFieldNames(10) + " must be > 0."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(10) + " must be > 0."); ShowContinueError(state, "...Setting screen wire diameter to a default value of 0.005m and simulation continues."); - matScreen->ScreenWireDiameter = 0.005; + matScreen->wireDiameter = 0.005; } } - if (matScreen->ScreenWireSpacing > 0.0) { - if (matScreen->ScreenWireDiameter / matScreen->ScreenWireSpacing >= 1.0) { + if (matScreen->wireSpacing > 0.0) { + if (matScreen->wireDiameter / matScreen->wireSpacing >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(10) + " must be less than " + ipsc->cNumericFieldNames(9)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(10) + " must be less than " + s_ipsc->cNumericFieldNames(9)); } else { // Calculate direct normal transmittance (open area fraction) - Openness = pow_2(1.0 - matScreen->ScreenWireDiameter / matScreen->ScreenWireSpacing); - if ((matScreen->TausFrontBeamBeam - Openness) / Openness > 0.01) { - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", screen openness specified."); - ShowContinueError(state, ipsc->cNumericFieldNames(1) + " is > 1.0% of the value calculated from input fields:"); - ShowContinueError(state, ipsc->cNumericFieldNames(9) + " and " + (ipsc->cNumericFieldNames(10))); + Openness = pow_2(1.0 - matScreen->wireDiameter / matScreen->wireSpacing); + if ((matScreen->TAR.Sol.Ft.Bm[0].BmTra - Openness) / Openness > 0.01) { + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", screen openness specified."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(1) + " is > 1.0% of the value calculated from input fields:"); + ShowContinueError(state, s_ipsc->cNumericFieldNames(9) + " and " + (s_ipsc->cNumericFieldNames(10))); ShowContinueError(state, " using the formula (1-diameter/spacing)**2"); ShowContinueError(state, " ...the screen diameter is recalculated from the material openness specified "); ShowContinueError(state, " ...and wire spacing using the formula = wire spacing * (1.0 - SQRT(Opennes))"); - matScreen->ScreenWireDiameter = matScreen->ScreenWireSpacing * (1.0 - std::sqrt(matScreen->TausFrontBeamBeam)); - ShowContinueError(state, format(" ...Recalculated {}={:.4R} m", ipsc->cNumericFieldNames(10), matScreen->ScreenWireDiameter)); + matScreen->wireDiameter = matScreen->wireSpacing * (1.0 - std::sqrt(matScreen->TAR.Sol.Ft.Bm[0].BmTra)); + ShowContinueError(state, format(" ...Recalculated {}={:.4R} m", s_ipsc->cNumericFieldNames(10), matScreen->wireDiameter)); } } } - if (matScreen->TausFrontBeamBeam + matScreen->ReflFrontBeamDiff >= 1.0) { + if (matScreen->TAR.Sol.Ft.Bm[0].BmTra + matScreen->TAR.Sol.Ft.Bm[0].DfRef >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); ShowContinueError(state, "Calculated solar transmittance + solar reflectance not < 1.0"); ShowContinueError(state, "See Engineering Reference for calculation procedure for solar transmittance."); } - if (matScreen->TausFrontBeamBeamVis + matScreen->ReflFrontDiffDiffVis >= 1.0) { + if (matScreen->TAR.Vis.Ft.Bm[0].BmTra + matScreen->TAR.Vis.Ft.Df.Ref >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); ShowContinueError(state, "Calculated visible transmittance + visible reflectance not < 1.0"); ShowContinueError(state, "See Engineering Reference for calculation procedure for visible solar transmittance."); } if (matScreen->TransThermal + matScreen->AbsorpThermal >= 1.0) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, "Thermal hemispherical emissivity plus open area fraction (1-diameter/spacing)**2 not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowSevereError(state, "Thermal hemispherical emissivity plus open area fraction (1-diameter/spacing)**2 not < 1.0"); } } // TotScreensEQL loop - // Window Blind Materials - if ((state.dataHeatBal->TotBlindsEQL == 0) && (state.dataHeatBal->TotBlinds == 0)) { - state.dataSurface->actualMaxSlatAngs = 1; // first slot is used for shades - } - - if (state.dataHeatBal->TotBlinds > 0) { - state.dataMaterial->Blind.allocate(state.dataHeatBal->TotBlinds); // Allocate the array Size to the number of blinds - } - - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Blind"; - for (Loop = 1; Loop <= state.dataHeatBal->TotBlinds; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Blind"; + s_mat->NumBlinds = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumBlinds; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::WindowBlind; - - // Load the material derived type from the input data. - - thisMaterial->Name = MaterialNames(1); - state.dataMaterial->Blind(Loop).Name = MaterialNames(1); - thisMaterial->Roughness = SurfaceRoughness::Rough; - thisMaterial->BlindDataPtr = Loop; - thisMaterial->ROnly = true; - - state.dataMaterial->Blind(Loop).MaterialNumber = MaterNum; - if (Util::SameString(MaterialNames(2), "Horizontal")) { - state.dataMaterial->Blind(Loop).SlatOrientation = DataWindowEquivalentLayer::Orientation::Horizontal; - } else if (Util::SameString(MaterialNames(2), "Vertical")) { - state.dataMaterial->Blind(Loop).SlatOrientation = DataWindowEquivalentLayer::Orientation::Vertical; - } - state.dataMaterial->Blind(Loop).SlatWidth = MaterialProps(1); - state.dataMaterial->Blind(Loop).SlatSeparation = MaterialProps(2); - state.dataMaterial->Blind(Loop).SlatThickness = MaterialProps(3); - state.dataMaterial->Blind(Loop).SlatAngle = MaterialProps(4); - state.dataMaterial->Blind(Loop).SlatConductivity = MaterialProps(5); - state.dataMaterial->Blind(Loop).SlatTransSolBeamDiff = MaterialProps(6); - state.dataMaterial->Blind(Loop).SlatFrontReflSolBeamDiff = MaterialProps(7); - state.dataMaterial->Blind(Loop).SlatBackReflSolBeamDiff = MaterialProps(8); - state.dataMaterial->Blind(Loop).SlatTransSolDiffDiff = MaterialProps(9); - state.dataMaterial->Blind(Loop).SlatFrontReflSolDiffDiff = MaterialProps(10); - state.dataMaterial->Blind(Loop).SlatBackReflSolDiffDiff = MaterialProps(11); - state.dataMaterial->Blind(Loop).SlatTransVisBeamDiff = MaterialProps(12); - state.dataMaterial->Blind(Loop).SlatFrontReflVisBeamDiff = MaterialProps(13); - state.dataMaterial->Blind(Loop).SlatBackReflVisBeamDiff = MaterialProps(14); - state.dataMaterial->Blind(Loop).SlatTransVisDiffDiff = MaterialProps(15); - state.dataMaterial->Blind(Loop).SlatFrontReflVisDiffDiff = MaterialProps(16); - state.dataMaterial->Blind(Loop).SlatBackReflVisDiffDiff = MaterialProps(17); - state.dataMaterial->Blind(Loop).SlatTransIR = MaterialProps(18); - state.dataMaterial->Blind(Loop).SlatFrontEmissIR = MaterialProps(19); - state.dataMaterial->Blind(Loop).SlatBackEmissIR = MaterialProps(20); - state.dataMaterial->Blind(Loop).BlindToGlassDist = MaterialProps(21); - state.dataMaterial->Blind(Loop).BlindTopOpeningMult = MaterialProps(22); - state.dataMaterial->Blind(Loop).BlindBottomOpeningMult = MaterialProps(23); - state.dataMaterial->Blind(Loop).BlindLeftOpeningMult = MaterialProps(24); - state.dataMaterial->Blind(Loop).BlindRightOpeningMult = MaterialProps(25); - state.dataMaterial->Blind(Loop).MinSlatAngle = MaterialProps(26); - state.dataMaterial->Blind(Loop).MaxSlatAngle = MaterialProps(27); + auto *matBlind = new MaterialBlind; + matBlind->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(matBlind); + matBlind->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(matBlind->Name, matBlind->Num); + + matBlind->Roughness = SurfaceRoughness::Rough; + matBlind->ROnly = true; + + matBlind->SlatOrientation = + static_cast(getEnumValue(DataWindowEquivalentLayer::orientationNamesUC, s_ipsc->cAlphaArgs(2))); + + matBlind->SlatWidth = s_ipsc->rNumericArgs(1); + matBlind->SlatSeparation = s_ipsc->rNumericArgs(2); + matBlind->SlatThickness = s_ipsc->rNumericArgs(3); + matBlind->SlatAngle = s_ipsc->rNumericArgs(4); + matBlind->SlatConductivity = s_ipsc->rNumericArgs(5); + + matBlind->slatTAR.Sol.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(6); + matBlind->slatTAR.Sol.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(7); + matBlind->slatTAR.Sol.Bk.Bm[0].DfRef = s_ipsc->rNumericArgs(8); + matBlind->slatTAR.Sol.Ft.Df.Tra = s_ipsc->rNumericArgs(9); + matBlind->slatTAR.Sol.Ft.Df.Ref = s_ipsc->rNumericArgs(10); + matBlind->slatTAR.Sol.Bk.Df.Ref = s_ipsc->rNumericArgs(11); + matBlind->slatTAR.Vis.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(12); + matBlind->slatTAR.Vis.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(13); + matBlind->slatTAR.Vis.Bk.Bm[0].DfRef = s_ipsc->rNumericArgs(14); + matBlind->slatTAR.Vis.Ft.Df.Tra = s_ipsc->rNumericArgs(15); + matBlind->slatTAR.Vis.Ft.Df.Ref = s_ipsc->rNumericArgs(16); + matBlind->slatTAR.Vis.Bk.Df.Ref = s_ipsc->rNumericArgs(17); + matBlind->slatTAR.IR.Ft.Tra = matBlind->slatTAR.IR.Bk.Tra = s_ipsc->rNumericArgs(18); + matBlind->slatTAR.IR.Ft.Emi = s_ipsc->rNumericArgs(19); + matBlind->slatTAR.IR.Bk.Emi = s_ipsc->rNumericArgs(20); + matBlind->toGlassDist = s_ipsc->rNumericArgs(21); + matBlind->topOpeningMult = s_ipsc->rNumericArgs(22); + matBlind->bottomOpeningMult = s_ipsc->rNumericArgs(23); + matBlind->leftOpeningMult = s_ipsc->rNumericArgs(24); + matBlind->rightOpeningMult = s_ipsc->rNumericArgs(25); + matBlind->MinSlatAngle = s_ipsc->rNumericArgs(26); + matBlind->MaxSlatAngle = s_ipsc->rNumericArgs(27); // TH 2/11/2010. For CR 8010 // By default all blinds have fixed slat angle, new blinds with variable slat angle are created if // they are used with window shading controls that adjust slat angles like ScheduledSlatAngle or BlockBeamSolar - state.dataMaterial->Blind(Loop).SlatAngleType = DataWindowEquivalentLayer::AngleType::Fixed; + matBlind->SlatAngleType = DataWindowEquivalentLayer::AngleType::Fixed; - if (state.dataMaterial->Blind(Loop).SlatWidth < state.dataMaterial->Blind(Loop).SlatSeparation) { - ShowWarningError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Slat Angles/Widths"); + if (matBlind->SlatWidth < matBlind->SlatSeparation) { + ShowWarningError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Slat Angles/Widths"); ShowContinueError(state, format("{} [{:.2R}] is less than {} [{:.2R}].", - ipsc->cNumericFieldNames(1), - state.dataMaterial->Blind(Loop).SlatWidth, - ipsc->cNumericFieldNames(2), - state.dataMaterial->Blind(Loop).SlatSeparation)); + s_ipsc->cNumericFieldNames(1), + matBlind->SlatWidth, + s_ipsc->cNumericFieldNames(2), + matBlind->SlatSeparation)); ShowContinueError(state, "This will allow direct beam to be transmitted when Slat angle = 0."); } - if (!Util::SameString(MaterialNames(2), "Horizontal") && !Util::SameString(MaterialNames(2), "Vertical")) { + if ((s_ipsc->rNumericArgs(6) + s_ipsc->rNumericArgs(7) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value"); - ShowContinueError(state, ipsc->cAlphaFieldNames(2) + "=\"" + MaterialNames(2) + "\", must be Horizontal or Vertical."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(6) + " + " + s_ipsc->cNumericFieldNames(7) + " not < 1.0"); } - - if ((MaterialProps(6) + MaterialProps(7) >= 1.0)) { + if ((s_ipsc->rNumericArgs(6) + s_ipsc->rNumericArgs(8) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(6) + " + " + ipsc->cNumericFieldNames(7) + " not < 1.0"); - } - if ((MaterialProps(6) + MaterialProps(8) >= 1.0)) { - ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(6) + " + " + ipsc->cNumericFieldNames(8) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(6) + " + " + s_ipsc->cNumericFieldNames(8) + " not < 1.0"); } - if ((MaterialProps(9) + MaterialProps(10) >= 1.0)) { + if ((s_ipsc->rNumericArgs(9) + s_ipsc->rNumericArgs(10) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(9) + " + " + ipsc->cNumericFieldNames(10) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(9) + " + " + s_ipsc->cNumericFieldNames(10) + " not < 1.0"); } - if ((MaterialProps(9) + MaterialProps(11) >= 1.0)) { + if ((s_ipsc->rNumericArgs(9) + s_ipsc->rNumericArgs(11) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(9) + " + " + ipsc->cNumericFieldNames(11) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(9) + " + " + s_ipsc->cNumericFieldNames(11) + " not < 1.0"); } - if ((MaterialProps(12) + MaterialProps(13) >= 1.0) || (MaterialProps(12) + MaterialProps(14) >= 1.0)) { + if ((s_ipsc->rNumericArgs(12) + s_ipsc->rNumericArgs(13) >= 1.0) || (s_ipsc->rNumericArgs(12) + s_ipsc->rNumericArgs(14) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(12) + " + " + ipsc->cNumericFieldNames(13) + " not < 1.0 OR"); - ShowContinueError(state, ipsc->cNumericFieldNames(12) + " + " + ipsc->cNumericFieldNames(14) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(12) + " + " + s_ipsc->cNumericFieldNames(13) + " not < 1.0 OR"); + ShowContinueError(state, s_ipsc->cNumericFieldNames(12) + " + " + s_ipsc->cNumericFieldNames(14) + " not < 1.0"); } - if ((MaterialProps(12) + MaterialProps(13) >= 1.0)) { + if ((s_ipsc->rNumericArgs(12) + s_ipsc->rNumericArgs(13) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(12) + " + " + ipsc->cNumericFieldNames(13) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(12) + " + " + s_ipsc->cNumericFieldNames(13) + " not < 1.0"); } - if ((MaterialProps(12) + MaterialProps(14) >= 1.0)) { + if ((s_ipsc->rNumericArgs(12) + s_ipsc->rNumericArgs(14) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(12) + " + " + ipsc->cNumericFieldNames(14) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(12) + " + " + s_ipsc->cNumericFieldNames(14) + " not < 1.0"); } - if ((MaterialProps(15) + MaterialProps(16) >= 1.0)) { + if ((s_ipsc->rNumericArgs(15) + s_ipsc->rNumericArgs(16) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(15) + " + " + ipsc->cNumericFieldNames(16) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(15) + " + " + s_ipsc->cNumericFieldNames(16) + " not < 1.0"); } - if ((MaterialProps(15) + MaterialProps(17) >= 1.0)) { + if ((s_ipsc->rNumericArgs(15) + s_ipsc->rNumericArgs(17) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(15) + " + " + ipsc->cNumericFieldNames(17) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(15) + " + " + s_ipsc->cNumericFieldNames(17) + " not < 1.0"); } // Require that beam and diffuse properties be the same - if (std::abs(MaterialProps(9) - MaterialProps(6)) > 1.e-5) { + if (std::abs(s_ipsc->rNumericArgs(9) - s_ipsc->rNumericArgs(6)) > 1.e-5) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(6) + " must equal " + ipsc->cNumericFieldNames(9)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(6) + " must equal " + s_ipsc->cNumericFieldNames(9)); } - if (std::abs(MaterialProps(10) - MaterialProps(7)) > 1.e-5) { + if (std::abs(s_ipsc->rNumericArgs(10) - s_ipsc->rNumericArgs(7)) > 1.e-5) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(7) + " must equal " + ipsc->cNumericFieldNames(10)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(7) + " must equal " + s_ipsc->cNumericFieldNames(10)); } - if (std::abs(MaterialProps(11) - MaterialProps(8)) > 1.e-5) { + if (std::abs(s_ipsc->rNumericArgs(11) - s_ipsc->rNumericArgs(8)) > 1.e-5) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(8) + " must equal " + ipsc->cNumericFieldNames(11)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(8) + " must equal " + s_ipsc->cNumericFieldNames(11)); } - if (std::abs(MaterialProps(15) - MaterialProps(12)) > 1.e-5) { + if (std::abs(s_ipsc->rNumericArgs(15) - s_ipsc->rNumericArgs(12)) > 1.e-5) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(12) + " must equal " + ipsc->cNumericFieldNames(15)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(12) + " must equal " + s_ipsc->cNumericFieldNames(15)); } - if (std::abs(MaterialProps(16) - MaterialProps(13)) > 1.e-5) { + if (std::abs(s_ipsc->rNumericArgs(16) - s_ipsc->rNumericArgs(13)) > 1.e-5) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(13) + " must equal " + ipsc->cNumericFieldNames(16)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(13) + " must equal " + s_ipsc->cNumericFieldNames(16)); } - if (std::abs(MaterialProps(17) - MaterialProps(14)) > 1.e-5) { + if (std::abs(s_ipsc->rNumericArgs(17) - s_ipsc->rNumericArgs(14)) > 1.e-5) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(14) + " must equal " + ipsc->cNumericFieldNames(17)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(14) + " must equal " + s_ipsc->cNumericFieldNames(17)); } - if ((MaterialProps(18) + MaterialProps(19) >= 1.0)) { + if ((s_ipsc->rNumericArgs(18) + s_ipsc->rNumericArgs(19) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(18) + " + " + ipsc->cNumericFieldNames(19) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(18) + " + " + s_ipsc->cNumericFieldNames(19) + " not < 1.0"); } - if ((MaterialProps(18) + MaterialProps(20) >= 1.0)) { + if ((s_ipsc->rNumericArgs(18) + s_ipsc->rNumericArgs(20) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(18) + " + " + ipsc->cNumericFieldNames(20) + " not < 1.0"); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(18) + " + " + s_ipsc->cNumericFieldNames(20) + " not < 1.0"); } - if (state.dataMaterial->Blind(Loop).BlindToGlassDist < 0.5 * state.dataMaterial->Blind(Loop).SlatWidth) { + if (matBlind->toGlassDist < 0.5 * matBlind->SlatWidth) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); - ShowContinueError(state, ipsc->cNumericFieldNames(21) + " is less than half of the " + ipsc->cNumericFieldNames(1)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); + ShowContinueError(state, s_ipsc->cNumericFieldNames(21) + " is less than half of the " + s_ipsc->cNumericFieldNames(1)); } // Minimum and maximum slat angles allowed by slat geometry - if (state.dataMaterial->Blind(Loop).SlatWidth > state.dataMaterial->Blind(Loop).SlatSeparation) { - MinSlatAngGeom = std::asin(state.dataMaterial->Blind(Loop).SlatThickness / - (state.dataMaterial->Blind(Loop).SlatThickness + state.dataMaterial->Blind(Loop).SlatSeparation)) / - Constant::DegToRadians; + if (matBlind->SlatWidth > matBlind->SlatSeparation) { + MinSlatAngGeom = std::asin(matBlind->SlatThickness / (matBlind->SlatThickness + matBlind->SlatSeparation)) / Constant::DegToRadians; } else { MinSlatAngGeom = 0.0; } MaxSlatAngGeom = 180.0 - MinSlatAngGeom; // Error if input slat angle not in range allowed by slat geometry - if ((state.dataMaterial->Blind(Loop).SlatSeparation + state.dataMaterial->Blind(Loop).SlatThickness) < - state.dataMaterial->Blind(Loop).SlatWidth) { - if (state.dataMaterial->Blind(Loop).SlatAngle < MinSlatAngGeom) { + if ((matBlind->SlatSeparation + matBlind->SlatThickness) < matBlind->SlatWidth) { + if (matBlind->SlatAngle < MinSlatAngGeom) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); ShowContinueError(state, format("{}=[{:.1R}], is less than smallest allowed by slat dimensions and spacing, [{:.1R}] deg.", - ipsc->cNumericFieldNames(4), - state.dataMaterial->Blind(Loop).SlatAngle, + s_ipsc->cNumericFieldNames(4), + matBlind->SlatAngle, MinSlatAngGeom)); - } else if (state.dataMaterial->Blind(Loop).SlatAngle > MaxSlatAngGeom) { + } else if (matBlind->SlatAngle > MaxSlatAngGeom) { ErrorsFound = true; - ShowSevereError(state, state.dataHeatBalMgr->CurrentModuleObject + "=\"" + MaterialNames(1) + "\", Illegal value combination."); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Illegal value combination."); ShowContinueError(state, format("{}=[{:.1R}], is greater than largest allowed by slat dimensions and spacing, [{:.1R}] deg.", - ipsc->cNumericFieldNames(4), - state.dataMaterial->Blind(Loop).SlatAngle, + s_ipsc->cNumericFieldNames(4), + matBlind->SlatAngle, MinSlatAngGeom)); } } @@ -2186,7 +2027,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // ! Error if maximum slat angle less than minimum // IF(Blind(Loop)%MaxSlatAngle < Blind(Loop)%MinSlatAngle) THEN // ErrorsFound = .TRUE. - // CALL ShowSevereError(state, TRIM(state.dataHeatBalMgr->CurrentModuleObject)//'="'//TRIM(MaterialNames(1))//'", Illegal value + // CALL ShowSevereError(state, TRIM(s_ipsc->cCurrentModuleObject)//'="'//TRIM(s_ipsc->cAlphaArgs(1))//'", Illegal value // combination.') CALL ShowContinueError(state, // TRIM(cNumericFieldNames(26))//'=['//TRIM(RoundSigDigits(Blind(Loop)%MinSlatAngle,1))// & // '], is greater than '//TRIM(cNumericFieldNames(27))//'=['// & @@ -2196,7 +2037,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // IF(Blind(Loop)%MaxSlatAngle > Blind(Loop)%MinSlatAngle .AND. (Blind(Loop)%SlatAngle < Blind(Loop)%MinSlatAngle & // .OR. Blind(Loop)%SlatAngle > Blind(Loop)%MaxSlatAngle)) THEN // ErrorsFound = .TRUE. - // CALL ShowSevereError(state, TRIM(state.dataHeatBalMgr->CurrentModuleObject)//'="'//TRIM(MaterialNames(1))//'", Illegal value + // CALL ShowSevereError(state, TRIM(s_ipsc->cCurrentModuleObject)//'="'//TRIM(s_ipsc->cAlphaArgs(1))//'", Illegal value // combination.') CALL ShowContinueError(state, TRIM(cNumericFieldNames(4))//'=['//TRIM(RoundSigDigits(Blind(Loop)%SlatAngle,1))// // & // '] is outside of the input min/max range, min=['//TRIM(RoundSigDigits(Blind(Loop)%MinSlatAngle,1))// & @@ -2204,7 +2045,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // END IF // ! Error if input minimum slat angle is less than that allowed by slat geometry // IF(Blind(Loop)%MinSlatAngle < MinSlatAngGeom) THEN - // CALL ShowSevereError(state, TRIM(state.dataHeatBalMgr->CurrentModuleObject)//'="'//TRIM(MaterialNames(1))//'", Illegal value + // CALL ShowSevereError(state, TRIM(s_ipsc->cCurrentModuleObject)//'="'//TRIM(s_ipsc->cAlphaArgs(1))//'", Illegal value // combination.') CALL ShowContinueError(state, // TRIM(cNumericFieldNames(26))//'=['//TRIM(RoundSigDigits(Blind(Loop)%MinSlatAngle,1))// & // '] is less than the smallest allowed by slat dimensions and spacing, min=['// & @@ -2214,7 +2055,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // END IF // ! Error if input maximum slat angle is greater than that allowed by slat geometry // IF(Blind(Loop)%MaxSlatAngle > MaxSlatAngGeom) THEN - // CALL ShowWarningError(state, TRIM(state.dataHeatBalMgr->CurrentModuleObject)//'="'//TRIM(MaterialNames(1))//'", Illegal value + // CALL ShowWarningError(state, TRIM(s_ipsc->cCurrentModuleObject)//'="'//TRIM(s_ipsc->cAlphaArgs(1))//'", Illegal value // combination.') CALL ShowContinueError(state, // TRIM(cNumericFieldNames(27))//'=['//TRIM(RoundSigDigits(Blind(Loop)%MaxSlatAngle,1))// & // '] is greater than the largest allowed by slat dimensions and spacing, ['// & @@ -2227,382 +2068,658 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // Window Blind Materials for EquivalentLayer Model - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:Blind:EquivalentLayer"; - for (Loop = 1; Loop <= state.dataHeatBal->TotBlindsEQL; ++Loop) { + s_ipsc->cCurrentModuleObject = "WindowMaterial:Blind:EquivalentLayer"; + s_mat->NumEQLBlinds = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumEQLBlinds; ++Loop) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::BlindEquivalentLayer; + auto *mat = new MaterialBlindEQL; + mat->group = Group::BlindEQL; + mat->Name = s_ipsc->cAlphaArgs(1); - thisMaterial->Name = MaterialNames(1); - thisMaterial->Roughness = SurfaceRoughness::Rough; - thisMaterial->ROnly = true; + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); - if (Util::SameString(MaterialNames(2), "Horizontal")) { - thisMaterial->SlatOrientation = DataWindowEquivalentLayer::Orientation::Horizontal; - } else if (Util::SameString(MaterialNames(2), "Vertical")) { - thisMaterial->SlatOrientation = DataWindowEquivalentLayer::Orientation::Vertical; - } - thisMaterial->SlatWidth = MaterialProps(1); - thisMaterial->SlatSeparation = MaterialProps(2); - thisMaterial->SlatCrown = MaterialProps(3); - thisMaterial->SlatAngle = MaterialProps(4); + mat->Roughness = SurfaceRoughness::Rough; + mat->ROnly = true; + + mat->SlatOrientation = + static_cast(getEnumValue(DataWindowEquivalentLayer::orientationNamesUC, s_ipsc->cAlphaArgs(2))); + + mat->SlatWidth = s_ipsc->rNumericArgs(1); + mat->SlatSeparation = s_ipsc->rNumericArgs(2); + mat->SlatCrown = s_ipsc->rNumericArgs(3); + mat->SlatAngle = s_ipsc->rNumericArgs(4); - thisMaterial->TausFrontBeamDiff = MaterialProps(5); - thisMaterial->TausBackBeamDiff = MaterialProps(6); - thisMaterial->ReflFrontBeamDiff = MaterialProps(7); - thisMaterial->ReflBackBeamDiff = MaterialProps(8); + mat->TAR.Sol.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(5); + mat->TAR.Sol.Bk.Bm[0].DfTra = s_ipsc->rNumericArgs(6); + mat->TAR.Sol.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(7); + mat->TAR.Sol.Bk.Bm[0].DfRef = s_ipsc->rNumericArgs(8); - if (!ipsc->lNumericFieldBlanks(9) && !ipsc->lNumericFieldBlanks(10) && !ipsc->lNumericFieldBlanks(11) && !ipsc->lNumericFieldBlanks(12)) { - thisMaterial->TausFrontBeamDiffVis = MaterialProps(9); - thisMaterial->TausBackBeamDiffVis = MaterialProps(10); - thisMaterial->ReflFrontBeamDiffVis = MaterialProps(11); - thisMaterial->ReflBackBeamDiffVis = MaterialProps(12); + if (!s_ipsc->lNumericFieldBlanks(9) && !s_ipsc->lNumericFieldBlanks(10) && !s_ipsc->lNumericFieldBlanks(11) && + !s_ipsc->lNumericFieldBlanks(12)) { + mat->TAR.Vis.Ft.Bm[0].DfTra = s_ipsc->rNumericArgs(9); + mat->TAR.Vis.Bk.Bm[0].DfTra = s_ipsc->rNumericArgs(10); + mat->TAR.Vis.Ft.Bm[0].DfRef = s_ipsc->rNumericArgs(11); + mat->TAR.Vis.Bk.Bm[0].DfRef = s_ipsc->rNumericArgs(12); } - if (!ipsc->lNumericFieldBlanks(13) && !ipsc->lNumericFieldBlanks(14) && !ipsc->lNumericFieldBlanks(15)) { - thisMaterial->TausDiffDiff = MaterialProps(13); - thisMaterial->ReflFrontDiffDiff = MaterialProps(14); - thisMaterial->ReflBackDiffDiff = MaterialProps(15); + if (!s_ipsc->lNumericFieldBlanks(13) && !s_ipsc->lNumericFieldBlanks(14) && !s_ipsc->lNumericFieldBlanks(15)) { + mat->TAR.Sol.Ft.Df.Tra = s_ipsc->rNumericArgs(13); + mat->TAR.Sol.Ft.Df.Ref = s_ipsc->rNumericArgs(14); + mat->TAR.Sol.Bk.Df.Ref = s_ipsc->rNumericArgs(15); } - if (!ipsc->lNumericFieldBlanks(16) && !ipsc->lNumericFieldBlanks(17) && !ipsc->lNumericFieldBlanks(18)) { - thisMaterial->TausDiffDiffVis = MaterialProps(13); - thisMaterial->ReflFrontDiffDiffVis = MaterialProps(14); - thisMaterial->ReflBackDiffDiffVis = MaterialProps(15); + if (!s_ipsc->lNumericFieldBlanks(16) && !s_ipsc->lNumericFieldBlanks(17) && !s_ipsc->lNumericFieldBlanks(18)) { + mat->TAR.Vis.Ft.Df.Tra = s_ipsc->rNumericArgs(13); + mat->TAR.Vis.Ft.Df.Ref = s_ipsc->rNumericArgs(14); + mat->TAR.Vis.Bk.Df.Ref = s_ipsc->rNumericArgs(15); } - if (!ipsc->lNumericFieldBlanks(19)) { - thisMaterial->TausThermal = MaterialProps(19); + if (!s_ipsc->lNumericFieldBlanks(19)) { + mat->TAR.IR.Ft.Tra = mat->TAR.IR.Bk.Tra = s_ipsc->rNumericArgs(19); } - if (!ipsc->lNumericFieldBlanks(20)) { - thisMaterial->EmissThermalFront = MaterialProps(20); + if (!s_ipsc->lNumericFieldBlanks(20)) { + mat->TAR.IR.Ft.Emi = s_ipsc->rNumericArgs(20); } - if (!ipsc->lNumericFieldBlanks(21)) { - thisMaterial->EmissThermalBack = MaterialProps(21); + if (!s_ipsc->lNumericFieldBlanks(21)) { + mat->TAR.IR.Bk.Emi = s_ipsc->rNumericArgs(21); } // Assumes thermal emissivity is the same as thermal absorptance - thisMaterial->AbsorpThermalFront = thisMaterial->EmissThermalFront; - thisMaterial->AbsorpThermalBack = thisMaterial->EmissThermalBack; - thisMaterial->TransThermal = thisMaterial->TausThermal; + mat->AbsorpThermalFront = mat->TAR.IR.Ft.Emi; + mat->AbsorpThermalBack = mat->TAR.IR.Bk.Emi; + mat->TransThermal = mat->TAR.IR.Ft.Tra; // By default all blinds have fixed slat angle, // they are used with window shading controls that adjust slat angles like // MaximizeSolar or BlockBeamSolar - thisMaterial->slatAngleType = SlatAngleType::FixedSlatAngle; - if (!ipsc->lAlphaFieldBlanks(3)) { - thisMaterial->slatAngleType = static_cast(getEnumValue(slatAngleTypeNamesUC, Util::makeUPPER(MaterialNames(3)))); + mat->slatAngleType = SlatAngleType::FixedSlatAngle; + if (!s_ipsc->lAlphaFieldBlanks(3)) { + mat->slatAngleType = static_cast(getEnumValue(slatAngleTypeNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(3)))); } - if (thisMaterial->SlatWidth < thisMaterial->SlatSeparation) { - ShowWarningError(state, format("{}=\"{}\", Slat Seperation/Width", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); + if (mat->SlatWidth < mat->SlatSeparation) { + ShowWarningError(state, format("{}=\"{}\", Slat Seperation/Width", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("{} [{:.2R}] is less than {} [{:.2R}].", - ipsc->cNumericFieldNames(1), - thisMaterial->SlatWidth, - ipsc->cNumericFieldNames(2), - thisMaterial->SlatSeparation)); + s_ipsc->cNumericFieldNames(1), + mat->SlatWidth, + s_ipsc->cNumericFieldNames(2), + mat->SlatSeparation)); ShowContinueError(state, "This will allow direct beam to be transmitted when Slat angle = 0."); } - if (thisMaterial->SlatSeparation < 0.001) { - ShowWarningError(state, format("{}=\"{}\", Slat Seperation", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} [{:.2R}]. Slate spacing must be > 0.0", ipsc->cNumericFieldNames(2), thisMaterial->SlatSeparation)); + if (mat->SlatSeparation < 0.001) { + ShowWarningError(state, format("{}=\"{}\", Slat Seperation", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} [{:.2R}]. Slate spacing must be > 0.0", s_ipsc->cNumericFieldNames(2), mat->SlatSeparation)); ShowContinueError(state, "...Setting slate spacing to default value of 0.025 m and " "simulation continues."); - thisMaterial->SlatSeparation = 0.025; + mat->SlatSeparation = 0.025; } - if (thisMaterial->SlatWidth < 0.001 || thisMaterial->SlatWidth >= 2.0 * thisMaterial->SlatSeparation) { - ShowWarningError(state, format("{}=\"{}\", Slat Width", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError( - state, format("{} [{:.2R}]. Slat width range is 0 < Width <= 2*Spacing", ipsc->cNumericFieldNames(1), thisMaterial->SlatWidth)); + if (mat->SlatWidth < 0.001 || mat->SlatWidth >= 2.0 * mat->SlatSeparation) { + ShowWarningError(state, format("{}=\"{}\", Slat Width", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, + format("{} [{:.2R}]. Slat width range is 0 < Width <= 2*Spacing", s_ipsc->cNumericFieldNames(1), mat->SlatWidth)); ShowContinueError(state, "...Setting slate width equal to slate spacing and simulation continues."); - thisMaterial->SlatWidth = thisMaterial->SlatSeparation; + mat->SlatWidth = mat->SlatSeparation; } - if (thisMaterial->SlatCrown < 0.0 || thisMaterial->SlatCrown >= 0.5 * thisMaterial->SlatWidth) { - ShowWarningError(state, format("{}=\"{}\", Slat Crown", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError( - state, format("{} [{:.2R}]. Slat crwon range is 0 <= crown < 0.5*Width", ipsc->cNumericFieldNames(3), thisMaterial->SlatCrown)); + if (mat->SlatCrown < 0.0 || mat->SlatCrown >= 0.5 * mat->SlatWidth) { + ShowWarningError(state, format("{}=\"{}\", Slat Crown", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, + format("{} [{:.2R}]. Slat crwon range is 0 <= crown < 0.5*Width", s_ipsc->cNumericFieldNames(3), mat->SlatCrown)); ShowContinueError(state, "...Setting slate crown to 0.0 and simulation continues."); - thisMaterial->SlatCrown = 0.0; + mat->SlatCrown = 0.0; } - if (thisMaterial->SlatAngle < -90.0 || thisMaterial->SlatAngle > 90.0) { - ShowWarningError(state, format("{}=\"{}\", Slat Angle", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, - format("{} [{:.2R}]. Slat angle range is -90.0 <= Angle < 90.0", ipsc->cNumericFieldNames(4), thisMaterial->SlatAngle)); + if (mat->SlatAngle < -90.0 || mat->SlatAngle > 90.0) { + ShowWarningError(state, format("{}=\"{}\", Slat Angle", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} [{:.2R}]. Slat angle range is -90.0 <= Angle < 90.0", s_ipsc->cNumericFieldNames(4), mat->SlatAngle)); ShowContinueError(state, "...Setting slate angle to 0.0 and simulation continues."); - thisMaterial->SlatAngle = 0.0; - } - - if (!Util::SameString(MaterialNames(2), "Horizontal") && !Util::SameString(MaterialNames(2), "Vertical")) { - ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{}=\"{}\", must be Horizontal or Vertical.", ipsc->cAlphaFieldNames(2), MaterialNames(2))); + mat->SlatAngle = 0.0; } - if ((MaterialProps(5) + MaterialProps(7) >= 1.0)) { + if ((s_ipsc->rNumericArgs(5) + s_ipsc->rNumericArgs(7) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not < 1.0", ipsc->cNumericFieldNames(5), ipsc->cNumericFieldNames(7))); + ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} + {} not < 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(7))); } - if ((MaterialProps(6) + MaterialProps(8) >= 1.0)) { + if ((s_ipsc->rNumericArgs(6) + s_ipsc->rNumericArgs(8) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not < 1.0", ipsc->cNumericFieldNames(6), ipsc->cNumericFieldNames(8))); + ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} + {} not < 1.0", s_ipsc->cNumericFieldNames(6), s_ipsc->cNumericFieldNames(8))); } - if ((MaterialProps(9) + MaterialProps(11) >= 1.0)) { + if ((s_ipsc->rNumericArgs(9) + s_ipsc->rNumericArgs(11) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not < 1.0", ipsc->cNumericFieldNames(9), ipsc->cNumericFieldNames(11))); + ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} + {} not < 1.0", s_ipsc->cNumericFieldNames(9), s_ipsc->cNumericFieldNames(11))); } - if ((MaterialProps(10) + MaterialProps(12) >= 1.0)) { + if ((s_ipsc->rNumericArgs(10) + s_ipsc->rNumericArgs(12) >= 1.0)) { ErrorsFound = true; - ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{} + {} not < 1.0", ipsc->cNumericFieldNames(10), ipsc->cNumericFieldNames(12))); + ShowSevereError(state, format("{}=\"{}\", Illegal value combination.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} + {} not < 1.0", s_ipsc->cNumericFieldNames(10), s_ipsc->cNumericFieldNames(12))); } } // TotBlindsEQL loop // EcoRoof Materials // PSU 2006 - state.dataHeatBalMgr->CurrentModuleObject = "Material:RoofVegetation"; - for (Loop = 1; Loop <= EcoRoofMat; ++Loop) { + s_ipsc->cCurrentModuleObject = "Material:RoofVegetation"; + s_mat->NumEcoRoofs = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumEcoRoofs; ++Loop) { // Call Input Get Routine to retrieve material data from ecoroof - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - MaterialNames, - MaterialNumAlpha, - MaterialProps, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - MaterialNames(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } // this part is similar to the regular material // Load the material derived type from the input data. - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::EcoRoof; - - // this part is new for Ecoroof properties, - // especially for the Plant Layer of the ecoroof - thisMaterial->HeightOfPlants = MaterialProps(1); - thisMaterial->LAI = MaterialProps(2); - thisMaterial->Lreflectivity = MaterialProps(3); // Albedo - thisMaterial->LEmissitivity = MaterialProps(4); - thisMaterial->RStomata = MaterialProps(5); - - thisMaterial->Name = MaterialNames(1); + auto *mat = new MaterialEcoRoof; + mat->group = Group::EcoRoof; + mat->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + mat->HeightOfPlants = s_ipsc->rNumericArgs(1); + mat->LAI = s_ipsc->rNumericArgs(2); + mat->Lreflectivity = s_ipsc->rNumericArgs(3); // Albedo + mat->LEmissitivity = s_ipsc->rNumericArgs(4); + mat->RStomata = s_ipsc->rNumericArgs(5); + // need to treat the A2 with is just the name of the soil(it is // not important) - thisMaterial->Roughness = static_cast(getEnumValue(surfaceRoughnessNamesUC, Util::makeUPPER(MaterialNames(3)))); - if (Util::SameString(MaterialNames(4), "Simple")) { - thisMaterial->EcoRoofCalculationMethod = 1; - } else if (Util::SameString(MaterialNames(4), "Advanced") || ipsc->lAlphaFieldBlanks(4)) { - thisMaterial->EcoRoofCalculationMethod = 2; + mat->Roughness = static_cast(getEnumValue(surfaceRoughnessNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(3)))); + + if (s_ipsc->lAlphaFieldBlanks(4)) { + mat->calcMethod = EcoRoofCalcMethod::SchaapGenuchten; } else { - ShowSevereError(state, format("{}=\"{}\", Illegal value", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, format("{}=\"{}\".", ipsc->cAlphaFieldNames(4), MaterialNames(4))); - ShowContinueError(state, "...Valid values are \"Simple\" or \"Advanced\"."); - ErrorsFound = true; - } - - thisMaterial->Thickness = MaterialProps(6); - thisMaterial->Conductivity = MaterialProps(7); - thisMaterial->Density = MaterialProps(8); - thisMaterial->SpecHeat = MaterialProps(9); - thisMaterial->AbsorpThermal = MaterialProps(10); // emissivity - thisMaterial->AbsorpSolar = MaterialProps(11); // (1 - Albedo) - thisMaterial->AbsorpVisible = MaterialProps(12); - thisMaterial->Porosity = MaterialProps(13); - thisMaterial->MinMoisture = MaterialProps(14); - thisMaterial->InitMoisture = MaterialProps(15); - - if (thisMaterial->Conductivity > 0.0) { - state.dataHeatBal->NominalR(MaterNum) = thisMaterial->Thickness / thisMaterial->Conductivity; - thisMaterial->Resistance = state.dataHeatBal->NominalR(MaterNum); + mat->calcMethod = static_cast(getEnumValue(ecoRoofCalcMethodNamesUC, s_ipsc->cAlphaArgs(4))); + } + + mat->Thickness = s_ipsc->rNumericArgs(6); + mat->Conductivity = s_ipsc->rNumericArgs(7); + mat->Density = s_ipsc->rNumericArgs(8); + mat->SpecHeat = s_ipsc->rNumericArgs(9); + mat->AbsorpThermal = s_ipsc->rNumericArgs(10); // emissivity + mat->AbsorpSolar = s_ipsc->rNumericArgs(11); // (1 - Albedo) + mat->AbsorpVisible = s_ipsc->rNumericArgs(12); + mat->Porosity = s_ipsc->rNumericArgs(13); + mat->MinMoisture = s_ipsc->rNumericArgs(14); + mat->InitMoisture = s_ipsc->rNumericArgs(15); + + if (mat->Conductivity > 0.0) { + mat->Resistance = mat->NominalR = mat->Thickness / mat->Conductivity; } else { - ShowSevereError(state, format("{}=\"{}\" is not defined correctly.", state.dataHeatBalMgr->CurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("{} is <=0.", ipsc->cNumericFieldNames(7))); + ShowSevereError(state, format("{}=\"{}\" is not defined correctly.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} is <=0.", s_ipsc->cNumericFieldNames(7))); ErrorsFound = true; } - if (thisMaterial->InitMoisture > thisMaterial->Porosity) { - ShowWarningError(state, format("{}=\"{}\", Illegal value combination.", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); - ShowContinueError(state, - format("{} is greater than {}. It must be less or equal.", ipsc->cNumericFieldNames(15), ipsc->cNumericFieldNames(13))); - ShowContinueError(state, format("{} = {:.3T}.", ipsc->cNumericFieldNames(13), thisMaterial->Porosity)); - ShowContinueError(state, format("{} = {:.3T}.", ipsc->cNumericFieldNames(15), thisMaterial->InitMoisture)); + if (mat->InitMoisture > mat->Porosity) { + ShowWarningError(state, format("{}=\"{}\", Illegal value combination.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError( - state, format("{} is reset to the maximum (saturation) value = {:.3T}.", ipsc->cNumericFieldNames(15), thisMaterial->Porosity)); + state, format("{} is greater than {}. It must be less or equal.", s_ipsc->cNumericFieldNames(15), s_ipsc->cNumericFieldNames(13))); + ShowContinueError(state, format("{} = {:.3T}.", s_ipsc->cNumericFieldNames(13), mat->Porosity)); + ShowContinueError(state, format("{} = {:.3T}.", s_ipsc->cNumericFieldNames(15), mat->InitMoisture)); + ShowContinueError(state, + format("{} is reset to the maximum (saturation) value = {:.3T}.", s_ipsc->cNumericFieldNames(15), mat->Porosity)); ShowContinueError(state, "Simulation continues."); - thisMaterial->InitMoisture = thisMaterial->Porosity; + mat->InitMoisture = mat->Porosity; } } // Thermochromic glazing group // get the number of WindowMaterial:GlazingGroup:Thermochromic objects in the idf file - state.dataHeatBalMgr->CurrentModuleObject = "WindowMaterial:GlazingGroup:Thermochromic"; - state.dataHeatBal->TotTCGlazings = ip->getNumObjectsFound(state, state.dataHeatBalMgr->CurrentModuleObject); - if (state.dataHeatBal->TotTCGlazings >= 1) { - // Read TC glazings - state.dataHeatBal->TCGlazings.allocate(state.dataHeatBal->TotTCGlazings); - - for (Loop = 1; Loop <= state.dataHeatBal->TotTCGlazings; ++Loop) { - // Get each TCGlazings from the input processor - ip->getObjectItem(state, - state.dataHeatBalMgr->CurrentModuleObject, - Loop, - ipsc->cAlphaArgs, - MaterialNumAlpha, - ipsc->rNumericArgs, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - - if (Util::IsNameEmpty(state, ipsc->cAlphaArgs(1), state.dataHeatBalMgr->CurrentModuleObject, ErrorsFound)) { - ShowContinueError(state, "...All Thermochromic Glazing names must be unique regardless of subtype."); + s_ipsc->cCurrentModuleObject = "WindowMaterial:GlazingGroup:Thermochromic"; + s_mat->NumTCGlazings = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + + for (int Loop = 1; Loop <= s_mat->NumTCGlazings; ++Loop) { + // Get each TCGlazings from the input processor + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + std::string nameUC = Util::makeUPPER(s_ipsc->cAlphaArgs(1)); + + if (s_mat->materialMap.find(nameUC) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *mat = new MaterialGlassTC; + mat->Name = s_ipsc->cAlphaArgs(1); + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(nameUC, mat->Num); + + if (NumNums + 1 != NumAlphas) { + ShowSevereCustomMessage( + state, eoh, format("Check number of {} compared to number of {}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cNumericFieldNames(1))); + ErrorsFound = true; + continue; + } + + // Allocate arrays + mat->numMatRefs = NumNums; + mat->matRefs.allocate(mat->numMatRefs); + + for (int iMatRef = 1; iMatRef <= mat->numMatRefs; ++iMatRef) { + auto &matRef = mat->matRefs(iMatRef); + matRef.specTemp = s_ipsc->rNumericArgs(iMatRef); + // Find this glass definition + matRef.matNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(1 + iMatRef)); + if (matRef.matNum == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(1 + iMatRef), s_ipsc->cAlphaArgs(1 + iMatRef)); + ErrorsFound = true; continue; } - if (MaterialNumProp + 1 != MaterialNumAlpha) { - ShowSevereError(state, format("{}=\"{}\" is not defined correctly.", state.dataHeatBalMgr->CurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, - format("Check number of {} compared to number of {}", ipsc->cAlphaFieldNames(2), ipsc->cNumericFieldNames(1))); + // TC glazing + auto *matGlass = s_mat->materials(matRef.matNum); + // test that named material is of the right type + if (matGlass->group != Group::Glass) { + ShowSevereCustomMessage( + state, + eoh, + format("{} = {}, Material is not a window glazing ", s_ipsc->cAlphaFieldNames(1 + iMatRef), s_ipsc->cAlphaArgs(1 + iMatRef))); ErrorsFound = true; continue; } - // Allocate arrays - state.dataHeatBal->TCGlazings(Loop).SpecTemp.allocate(MaterialNumProp); - state.dataHeatBal->TCGlazings(Loop).LayerName.allocate(MaterialNumProp); - state.dataHeatBal->TCGlazings(Loop).LayerPoint.allocate(MaterialNumProp); - state.dataHeatBal->TCGlazings(Loop).SpecTemp = 0.0; - state.dataHeatBal->TCGlazings(Loop).LayerName = ""; - state.dataHeatBal->TCGlazings(Loop).LayerPoint = 0; - - state.dataHeatBal->TCGlazings(Loop).Name = ipsc->cAlphaArgs(1); - state.dataHeatBal->TCGlazings(Loop).NumGlzMat = MaterialNumProp; - - for (iTC = 1; iTC <= MaterialNumProp; ++iTC) { - state.dataHeatBal->TCGlazings(Loop).SpecTemp(iTC) = ipsc->rNumericArgs(iTC); - state.dataHeatBal->TCGlazings(Loop).LayerName(iTC) = ipsc->cAlphaArgs(1 + iTC); - - // Find this glazing material in the material list - iMat = Util::FindItemInPtrList(ipsc->cAlphaArgs(1 + iTC), state.dataMaterial->Material); - if (iMat != 0) { - // TC glazing - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(iMat)); - assert(thisMaterial != nullptr); - thisMaterial->SpecTemp = ipsc->rNumericArgs(iTC); - thisMaterial->TCParent = Loop; - state.dataHeatBal->TCGlazings(Loop).LayerPoint(iTC) = iMat; - - // test that named material is of the right type - if (thisMaterial->group != Group::WindowGlass) { - ShowSevereError( - state, format("{}=\"{}\" is not defined correctly.", state.dataHeatBalMgr->CurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("Material named: {} is not a window glazing ", ipsc->cAlphaArgs(1 + iTC))); - ErrorsFound = true; - } - - } else { // thow error because not found - ShowSevereError(state, - format("{}=\"{}\" is not defined correctly.", state.dataHeatBalMgr->CurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("Material named: {} was not found ", ipsc->cAlphaArgs(1 + iTC))); - ErrorsFound = true; - } - } + dynamic_cast(matGlass)->TCParentMatNum = mat->Num; } } - auto &cCurrentModuleObject = ipsc->cCurrentModuleObject; - cCurrentModuleObject = "WindowMaterial:SimpleGlazingSystem"; - for (Loop = 1; Loop <= state.dataHeatBal->TotSimpleWindow; ++Loop) { - - ip->getObjectItem(state, - cCurrentModuleObject, - Loop, - ipsc->cAlphaArgs, - MaterialNumAlpha, - ipsc->rNumericArgs, - MaterialNumProp, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (GlobalNames::VerifyUniqueInterObjectName(state, - state.dataHeatBalMgr->UniqueMaterialNames, - ipsc->cAlphaArgs(1), - state.dataHeatBalMgr->CurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ErrorsFound)) { - ShowContinueError(state, "...All Material names must be unique regardless of subtype."); + + s_ipsc->cCurrentModuleObject = "WindowMaterial:SimpleGlazingSystem"; + s_mat->NumSimpleWindows = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= s_mat->NumSimpleWindows; ++Loop) { + + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; continue; } - ++MaterNum; - auto *thisMaterial = new MaterialChild; - state.dataMaterial->Material(MaterNum) = thisMaterial; - thisMaterial->group = Group::WindowSimpleGlazing; - thisMaterial->Name = ipsc->cAlphaArgs(1); - thisMaterial->SimpleWindowUfactor = ipsc->rNumericArgs(1); - thisMaterial->SimpleWindowSHGC = ipsc->rNumericArgs(2); - if (!ipsc->lNumericFieldBlanks(3)) { - thisMaterial->SimpleWindowVisTran = ipsc->rNumericArgs(3); - thisMaterial->SimpleWindowVTinputByUser = true; + auto *mat = new MaterialGlass; + mat->group = Group::GlassSimple; + mat->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + mat->SimpleWindowUfactor = s_ipsc->rNumericArgs(1); + mat->SimpleWindowSHGC = s_ipsc->rNumericArgs(2); + if (!s_ipsc->lNumericFieldBlanks(3)) { + mat->SimpleWindowVisTran = s_ipsc->rNumericArgs(3); + mat->SimpleWindowVTinputByUser = true; } - HeatBalanceManager::SetupSimpleWindowGlazingSystem(state, MaterNum); + mat->SetupSimpleWindowGlazingSystem(state); } - // Simon: Place to load materials for complex fenestrations - if ((state.dataMaterial->TotComplexShades > 0) || (state.dataHeatBal->TotComplexGaps > 0)) { - HeatBalanceManager::SetupComplexFenestrationMaterialInput(state, MaterNum, ErrorsFound); - if (ErrorsFound) { - ShowSevereError(state, "Errors found in processing complex fenestration material input"); + // Reading WindowMaterial:Gap, this will also read the + // WindowMaterial:DeflectionState and WindowMaterial:SupportPillar + // objects if necessary + s_ipsc->cCurrentModuleObject = "WindowMaterial:Gap"; + s_mat->NumW7Gaps = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + // ALLOCATE(DeflectionState(W7DeflectionStates)) + for (int Loop = 1; Loop <= s_mat->NumW7Gaps; ++Loop) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; } + + auto *mat = new Material::MaterialComplexWindowGap; + mat->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + mat->group = Material::Group::ComplexWindowGap; + mat->Roughness = Material::SurfaceRoughness::Rough; + mat->ROnly = true; + + mat->Thickness = s_ipsc->rNumericArgs(1); + if (s_ipsc->rNumericArgs(1) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); + } + + mat->Pressure = s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(2) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); + } + + if (!s_ipsc->lAlphaFieldBlanks(2)) { + int matGasNum = GetMaterialNum(state, s_ipsc->cAlphaArgs(2)); + if (matGasNum == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + continue; + } + + // Copy all relevant fields from referenced gas mixture + auto const *matGasMix = dynamic_cast(s_mat->materials(matGasNum)); + mat->numGases = matGasMix->numGases; + mat->gasFracts = matGasMix->gasFracts; + mat->gases = matGasMix->gases; + mat->gapVentType = matGasMix->gapVentType; + } + + // Find referenced DeflectionState object and copy field from it + if (!s_ipsc->lAlphaFieldBlanks(3)) { + auto const itInstances = s_ip->epJSON.find("WindowGap:DeflectionState"); + if (itInstances == s_ip->epJSON.end()) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + continue; + } + + auto const &instances = itInstances.value(); + auto itObj = instances.begin(); + // Can't use find here because epJSON keys are not upper-cased + for (; itObj != instances.end(); ++itObj) { + if (Util::makeUPPER(itObj.key()) == s_ipsc->cAlphaArgs(3)) break; + } + + if (itObj == instances.end()) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + continue; + } + + auto const &obj = itObj.value(); + auto const &objSchemaProps = s_ip->getObjectSchemaProps(state, "WindowGap:DeflectionState"); + mat->deflectedThickness = s_ip->getRealFieldValue(obj, objSchemaProps, "deflected_thickness"); + } + + // Find referenced + if (!s_ipsc->lAlphaFieldBlanks(4)) { + auto const itInstances = s_ip->epJSON.find("WindowGap:SupportPillar"); + if (itInstances == s_ip->epJSON.end()) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); + ErrorsFound = true; + continue; + } + + auto const &instances = itInstances.value(); + + auto itObj = instances.begin(); + // Can't use find here because epJSON keys are not upper-cased + for (; itObj != instances.end(); ++itObj) { + if (Util::makeUPPER(itObj.key()) == s_ipsc->cAlphaArgs(4)) break; + } + + if (itObj == instances.end()) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); + ErrorsFound = true; + continue; + } + + auto const &obj = itObj.value(); + auto const &objSchemaProps = s_ip->getObjectSchemaProps(state, "WindowGap:SupportPillar"); + mat->pillarSpacing = s_ip->getRealFieldValue(obj, objSchemaProps, "spacing"); + mat->pillarRadius = s_ip->getRealFieldValue(obj, objSchemaProps, "radius"); + } + } + + // Reading WindowMaterial:ComplexShade + s_ipsc->cCurrentModuleObject = "WindowMaterial:ComplexShade"; + int TotComplexShades = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= TotComplexShades; ++Loop) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + if (s_mat->materialMap.find(s_ipsc->cAlphaArgs(1)) != s_mat->materialMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *mat = new Material::MaterialComplexShade; + mat->Name = s_ipsc->cAlphaArgs(1); + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + mat->Roughness = Material::SurfaceRoughness::Rough; + mat->ROnly = true; + + mat->LayerType = static_cast(getEnumValue(TARCOGParams::layerTypeNamesUC, s_ipsc->cAlphaArgs(2))); + + mat->Thickness = s_ipsc->rNumericArgs(1); + mat->Conductivity = s_ipsc->rNumericArgs(2); + mat->TransThermal = s_ipsc->rNumericArgs(3); + mat->FrontEmissivity = s_ipsc->rNumericArgs(4); + mat->BackEmissivity = s_ipsc->rNumericArgs(5); + + // Simon: in heat balance radiation exchange routines AbsorpThermal is used + // and program will crash if value is not assigned. Not sure if this is correct + // or some additional calculation is necessary. Simon TODO + mat->AbsorpThermal = s_ipsc->rNumericArgs(5); + mat->AbsorpThermalFront = s_ipsc->rNumericArgs(4); + mat->AbsorpThermalBack = s_ipsc->rNumericArgs(5); + + mat->topOpeningMult = s_ipsc->rNumericArgs(6); + mat->bottomOpeningMult = s_ipsc->rNumericArgs(7); + mat->leftOpeningMult = s_ipsc->rNumericArgs(8); + mat->rightOpeningMult = s_ipsc->rNumericArgs(9); + mat->frontOpeningMult = s_ipsc->rNumericArgs(10); + + mat->SlatWidth = s_ipsc->rNumericArgs(11); + mat->SlatSpacing = s_ipsc->rNumericArgs(12); + mat->SlatThickness = s_ipsc->rNumericArgs(13); + mat->SlatAngle = s_ipsc->rNumericArgs(14); + mat->SlatConductivity = s_ipsc->rNumericArgs(15); + mat->SlatCurve = s_ipsc->rNumericArgs(16); + + if (s_ipsc->rNumericArgs(1) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); + } + + if (s_ipsc->rNumericArgs(2) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); + } + + if ((s_ipsc->rNumericArgs(3) < 0.0) || (s_ipsc->rNumericArgs(3) > 1.0)) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} value must be >= 0 and <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(3), s_ipsc->rNumericArgs(3))); + } + + if ((s_ipsc->rNumericArgs(4) <= 0.0) || (s_ipsc->rNumericArgs(4) > 1.0)) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} value must be >= 0 and <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(4), s_ipsc->rNumericArgs(4))); + } + + if ((s_ipsc->rNumericArgs(5) <= 0.0) || (s_ipsc->rNumericArgs(5) > 1.0)) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} value must be >= 0 and <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(5), s_ipsc->rNumericArgs(5))); + } + + if ((s_ipsc->rNumericArgs(6) < 0.0) || (s_ipsc->rNumericArgs(6) > 1.0)) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be >= 0 or <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(6), s_ipsc->rNumericArgs(6))); + } + + if ((s_ipsc->rNumericArgs(7) < 0.0) || (s_ipsc->rNumericArgs(7) > 1.0)) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be >=0 or <=1, entered {:.2R}", s_ipsc->cNumericFieldNames(7), s_ipsc->rNumericArgs(7))); + } + + if ((s_ipsc->rNumericArgs(8) < 0.0) || (s_ipsc->rNumericArgs(8) > 1.0)) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be >=0 or <=1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(8), s_ipsc->rNumericArgs(8))); + } + + if ((s_ipsc->rNumericArgs(9) < 0.0) || (s_ipsc->rNumericArgs(9) > 1.0)) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be >=0 or <=1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(9), s_ipsc->rNumericArgs(9))); + } + + if ((s_ipsc->rNumericArgs(10) < 0.0) || (s_ipsc->rNumericArgs(10) > 1.0)) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be >=0 or <=1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(10), s_ipsc->rNumericArgs(10))); + } + + if ((mat->LayerType == TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ) || + (mat->LayerType == TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ)) { + if (s_ipsc->rNumericArgs(11) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be >0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(11), s_ipsc->rNumericArgs(11))); + } + + if (s_ipsc->rNumericArgs(12) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be >0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(12), s_ipsc->rNumericArgs(12))); + } + + if (s_ipsc->rNumericArgs(13) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be >0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(13), s_ipsc->rNumericArgs(13))); + } + + if ((s_ipsc->rNumericArgs(14) < -90.0) || (s_ipsc->rNumericArgs(14) > 90.0)) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, + eoh, + format("{} must be >=-90 and <=90, entered value = {:.2R}", s_ipsc->cNumericFieldNames(14), s_ipsc->rNumericArgs(14))); + } + + if (s_ipsc->rNumericArgs(15) <= 0.0) { + ErrorsFound = true; + ShowSevereCustomMessage( + state, eoh, format("{} must be >0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(15), s_ipsc->rNumericArgs(15))); + } + + if ((s_ipsc->rNumericArgs(16) < 0.0) || + ((s_ipsc->rNumericArgs(16) > 0.0) && (s_ipsc->rNumericArgs(16) < (s_ipsc->rNumericArgs(11) / 2)))) { + ErrorsFound = true; + ShowSevereCustomMessage(state, + eoh, + format("{} must be =0 or greater than SlatWidth/2, entered value = {:.2R}", + s_ipsc->cNumericFieldNames(16), + s_ipsc->rNumericArgs(16))); + } + } + + if (ErrorsFound) ShowFatalError(state, "Error in complex fenestration material input."); } - ScanForReports(state, "Constructions", state.dataHeatBalMgr->DoReport, "Materials"); - if (state.dataHeatBalMgr->DoReport) { + bool DoReport = false; + + ScanForReports(state, "Constructions", DoReport, "Materials"); + + if (DoReport) { print(state.files.eio, "! ,Material Name,ThermalResistance {{m2-K/w}},Roughness,Thickness {{m}},Conductivity " @@ -2615,10 +2732,10 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if constexpr std::string_view Format_701(" Material Details,{},{:.4R},{},{:.4R},{:.3R},{:.3R},{:.3R},{:.4R},{:.4R},{:.4R}\n"); constexpr std::string_view Format_702(" Material:Air,{},{:.4R}\n"); - for (auto const *mat : state.dataMaterial->Material) { + for (auto const *mat : s_mat->materials) { switch (mat->group) { - case Group::Air: { + case Group::AirGap: { print(state.files.eio, Format_702, mat->Name, mat->Resistance); } break; default: { @@ -2643,153 +2760,452 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (state.dataGlobal->AnyEnergyManagementSystemInModel) { // setup surface property EMS actuators - for (auto *mat : state.dataMaterial->Material) { + for (auto *mat : s_mat->materials) { if (mat->group != Group::Regular) continue; - auto *matReg = dynamic_cast(mat); - assert(matReg != nullptr); SetupEMSActuator(state, "Material", - matReg->Name, + mat->Name, "Surface Property Solar Absorptance", "[ ]", - matReg->AbsorpSolarEMSOverrideOn, - matReg->AbsorpSolarEMSOverride); + mat->AbsorpSolarEMSOverrideOn, + mat->AbsorpSolarEMSOverride); SetupEMSActuator(state, "Material", - matReg->Name, + mat->Name, "Surface Property Thermal Absorptance", "[ ]", - matReg->AbsorpThermalEMSOverrideOn, - matReg->AbsorpThermalEMSOverride); + mat->AbsorpThermalEMSOverrideOn, + mat->AbsorpThermalEMSOverride); SetupEMSActuator(state, "Material", - matReg->Name, + mat->Name, "Surface Property Visible Absorptance", "[ ]", - matReg->AbsorpVisibleEMSOverrideOn, - matReg->AbsorpVisibleEMSOverride); + mat->AbsorpVisibleEMSOverrideOn, + mat->AbsorpVisibleEMSOverride); } } - // try assigning phase change material properties for each material, won't do anything for non pcm surfaces - for (auto *mBase : state.dataMaterial->Material) { - if (mBase->group == Material::Group::Screen || mBase->group == Material::Group::WindowGas || - mBase->group == Material::Group::WindowGasMixture || mBase->group == Material::Group::GapEquivalentLayer) - continue; - - auto *m = dynamic_cast(mBase); - assert(m != nullptr); - m->phaseChange = HysteresisPhaseChange::HysteresisPhaseChange::factory(state, m->Name); - } - GetVariableAbsorptanceInput(state, ErrorsFound); // Read variable thermal and solar absorptance add-on data } void GetVariableAbsorptanceInput(EnergyPlusData &state, bool &errorsFound) { + constexpr std::string_view routineName = "GetVariableAbsorptanceInput"; + int IOStat; // IO Status when calling get input subroutine int numAlphas; int numNumbers; - Array1D_string alphas(7); // character string data - Array1D numbers(1); // numeric data - std::string_view cCurrentModuleObject{"MaterialProperty:VariableAbsorptance"}; - auto &ip = state.dataInputProcessing->inputProcessor; - auto &ipsc = state.dataIPShortCut; + auto &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; - int numVariAbs = ip->getNumObjectsFound(state, cCurrentModuleObject); - state.dataHeatBal->AnyVariableAbsorptance = (numVariAbs > 0); + s_ipsc->cCurrentModuleObject = "MaterialProperty:VariableAbsorptance"; + int numVariAbs = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + s_mat->AnyVariableAbsorptance = (numVariAbs > 0); for (int i = 1; i <= numVariAbs; ++i) { // Call Input Get routine to retrieve material data - ip->getObjectItem(state, - cCurrentModuleObject, - i, - alphas, - numAlphas, - numbers, - numNumbers, - IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + i, + s_ipsc->cAlphaArgs, + numAlphas, + s_ipsc->rNumericArgs, + numNumbers, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; // Load the material derived type from the input data. - int MaterNum = Util::FindItemInPtrList(alphas(2), state.dataMaterial->Material); - if (MaterNum == 0) { - ShowSevereError( - state, - format( - "{}: invalid {} entered={}, must match to a valid Material name.", cCurrentModuleObject, ipsc->cAlphaFieldNames(2), alphas(2))); + int matNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(2)); + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); errorsFound = true; return; } - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(MaterNum)); - assert(thisMaterial != nullptr); - if (thisMaterial->group != Group::Regular) { + auto *mat = s_mat->materials(matNum); + + if (mat->group != Group::Regular) { ShowSevereError( state, format("{}: Reference Material is not appropriate type for Thermal/Solar Absorptance properties, material={}, must have regular " "properties (Thermal/Solar Absorptance)", - cCurrentModuleObject, - thisMaterial->Name)); + s_ipsc->cCurrentModuleObject, + mat->Name)); errorsFound = true; - return; + continue; } - thisMaterial->absorpVarCtrlSignal = VariableAbsCtrlSignal::SurfaceTemperature; // default value - thisMaterial->absorpVarCtrlSignal = - static_cast(getEnumValue(variableAbsCtrlSignalNamesUC, Util::makeUPPER(alphas(3)))); + mat->absorpVarCtrlSignal = VariableAbsCtrlSignal::SurfaceTemperature; // default value + mat->absorpVarCtrlSignal = static_cast(getEnumValue(variableAbsCtrlSignalNamesUC, s_ipsc->cAlphaArgs(3))); // init to 0 as GetScheduleIndex returns 0 for not-found schedule - thisMaterial->absorpThermalVarFuncIdx = Curve::GetCurveIndex(state, alphas(4)); - thisMaterial->absorpThermalVarSchedIdx = ScheduleManager::GetScheduleIndex(state, alphas(5)); - thisMaterial->absorpSolarVarFuncIdx = Curve::GetCurveIndex(state, alphas(6)); - thisMaterial->absorpSolarVarSchedIdx = ScheduleManager::GetScheduleIndex(state, alphas(7)); - if (thisMaterial->absorpVarCtrlSignal == VariableAbsCtrlSignal::Scheduled) { - if ((thisMaterial->absorpThermalVarSchedIdx == 0) && (thisMaterial->absorpSolarVarSchedIdx == 0)) { + mat->absorpThermalVarFuncIdx = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(4)); + mat->absorpThermalVarSchedIdx = ScheduleManager::GetScheduleIndex(state, s_ipsc->cAlphaArgs(5)); + mat->absorpSolarVarFuncIdx = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(6)); + mat->absorpSolarVarSchedIdx = ScheduleManager::GetScheduleIndex(state, s_ipsc->cAlphaArgs(7)); + if (mat->absorpVarCtrlSignal == VariableAbsCtrlSignal::Scheduled) { + if ((mat->absorpThermalVarSchedIdx == 0) && (mat->absorpSolarVarSchedIdx == 0)) { ShowSevereError( state, format("{}: Control signal \"Scheduled\" is chosen but both thermal and solar absorptance schedules are undefined, for object {}", - cCurrentModuleObject, - alphas(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); errorsFound = true; return; } - if ((thisMaterial->absorpThermalVarFuncIdx > 0) || (thisMaterial->absorpSolarVarFuncIdx > 0)) { + if ((mat->absorpThermalVarFuncIdx > 0) || (mat->absorpSolarVarFuncIdx > 0)) { ShowWarningError(state, format("{}: Control signal \"Scheduled\" is chosen. Thermal or solar absorptance function name is going to be " "ignored, for object {}", - cCurrentModuleObject, - alphas(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); errorsFound = true; return; } } else { // controlled by performance table or curve - if ((thisMaterial->absorpThermalVarFuncIdx == 0) && (thisMaterial->absorpSolarVarFuncIdx == 0)) { + if ((mat->absorpThermalVarFuncIdx == 0) && (mat->absorpSolarVarFuncIdx == 0)) { ShowSevereError(state, format("{}: Non-schedule control signal is chosen but both thermal and solar absorptance table or curve are " "undefined, for object {}", - cCurrentModuleObject, - alphas(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); errorsFound = true; return; } - if ((thisMaterial->absorpThermalVarSchedIdx > 0) || (thisMaterial->absorpSolarVarSchedIdx > 0)) { + if ((mat->absorpThermalVarSchedIdx > 0) || (mat->absorpSolarVarSchedIdx > 0)) { ShowWarningError(state, format("{}: Non-schedule control signal is chosen. Thermal or solar absorptance schedule name is going to be " "ignored, for object {}", - cCurrentModuleObject, - alphas(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); errorsFound = true; return; } } } -} +} // GetVariableAbsorptanceInput() + +void GetWindowGlassSpectralData(EnergyPlusData &state, bool &ErrorsFound) // set to true if errors found in input +{ + + // SUBROUTINE INFORMATION: + // AUTHOR Fred Winkelmann + // DATE WRITTEN May 2000 + + // PURPOSE OF THIS SUBROUTINE: + // Gets spectral data (transmittance, front reflectance, and back + // reflectance at normal incidence vs. wavelength) for glass + + // SUBROUTINE PARAMETER DEFINITIONS: + constexpr std::string_view routineName = "GetWindowGlassSpectralData"; + + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + int IOStat; // IO Status when calling get input subroutine + int NumAlphas; // Number of spectral data alpha names being passed + int NumNums; // Number of spectral data properties being passed + Real64 Lam; // Wavelength (microns) + Real64 Tau; // Transmittance, front reflectance, back reflectance + Real64 RhoF; + Real64 RhoB; + + auto &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; + + constexpr int MaxSpectralDataElements = 800; // Maximum number in Spectral Data arrays. + + s_ipsc->cCurrentModuleObject = "MaterialProperty:GlazingSpectralData"; + s_mat->NumSpectralData = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + + if (s_mat->NumSpectralData == 0) return; + + s_mat->SpectralData.allocate(s_mat->NumSpectralData); + + for (int Loop = 1; Loop <= s_mat->NumSpectralData; ++Loop) { + + // Call Input Get routine to retrieve spectral data + // Name is followed by up to 450 sets of normal-incidence measured values of + // [wavelength (microns), transmittance, front reflectance, back reflectance] for + // wavelengths covering the short-wave solar spectrum (from about 0.25 to 2.5 microns) + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Loop, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + auto &specData = s_mat->SpectralData(Loop); + // Load the spectral data derived type from the input data. + specData.Name = s_ipsc->cAlphaArgs(1); + int TotLam = NumNums / 4; + if (mod(NumNums, 4) != 0) { + ShowWarningCustomMessage( + state, + eoh, + format("{} of items in data set is not a multiple of 4 (Wavelength,Trans,ReflFront,ReflBack), remainder items set to 0.0", NumNums)); + ErrorsFound = true; + continue; + } + + if (TotLam > MaxSpectralDataElements) { + ShowSevereCustomMessage(state, eoh, format("More than {} entries in set ({})", MaxSpectralDataElements, NumNums)); + ErrorsFound = true; + continue; + } + + specData.NumOfWavelengths = TotLam; + specData.WaveLength.allocate(TotLam); // Wavelength (microns) + specData.Trans.allocate(TotLam); // Transmittance at normal incidence + specData.ReflFront.allocate(TotLam); // Front reflectance at normal incidence + specData.ReflBack.allocate(TotLam); // Back reflectance at normal incidence + + for (int LamNum = 1; LamNum <= TotLam; ++LamNum) { + specData.WaveLength(LamNum) = s_ipsc->rNumericArgs(4 * LamNum - 3); + specData.Trans(LamNum) = s_ipsc->rNumericArgs(4 * LamNum - 2); + // Following is needed since angular calculation in subr TransAndReflAtPhi + // fails for Trans = 0.0 + if (specData.Trans(LamNum) < 0.001) specData.Trans(LamNum) = 0.001; + specData.ReflFront(LamNum) = s_ipsc->rNumericArgs(4 * LamNum - 1); + specData.ReflBack(LamNum) = s_ipsc->rNumericArgs(4 * LamNum); + } + + // Check integrity of the spectral data + for (int LamNum = 1; LamNum <= TotLam; ++LamNum) { + Lam = specData.WaveLength(LamNum); + Tau = specData.Trans(LamNum); + RhoF = specData.ReflFront(LamNum); + RhoB = specData.ReflBack(LamNum); + if (LamNum < TotLam && specData.WaveLength(LamNum + 1) <= Lam) { + ErrorsFound = true; + ShowSevereError(state, format("{}{}=\"{}\" invalid set.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, + format("... Wavelengths not in increasing order. at wavelength#={}, value=[{:.4T}], next is [{:.4T}].", + LamNum, + Lam, + specData.WaveLength(LamNum + 1))); + } + + if (Lam < 0.1 || Lam > 4.0) { + ErrorsFound = true; + ShowSevereError(state, format("{}{}=\"{}\" invalid value.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, + format("... A wavelength is not in the range 0.1 to 4.0 microns; at wavelength#={}, value=[{:.4T}].", LamNum, Lam)); + } + + // TH 2/15/2011. CR 8343 + // IGDB (International Glazing Database) does not meet the above strict restrictions. + // Relax rules to allow directly use of spectral data from IGDB + if (Tau > 1.01) { + ErrorsFound = true; + ShowSevereError(state, format("{}: {}=\"{}\" invalid value.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("... A transmittance is > 1.0; at wavelength#={}, value=[{:.4T}].", LamNum, Tau)); + } + + if (RhoF < 0.0 || RhoF > 1.02 || RhoB < 0.0 || RhoB > 1.02) { + ErrorsFound = true; + ShowSevereError(state, format("{}: {}=\"{}\" invalid value.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("... A reflectance is < 0.0 or > 1.0; at wavelength#={}, RhoF value=[{:.4T}].", LamNum, RhoF)); + ShowContinueError(state, format("... A reflectance is < 0.0 or > 1.0; at wavelength#={}, RhoB value=[{:.4T}].", LamNum, RhoB)); + } + + if ((Tau + RhoF) > 1.03 || (Tau + RhoB) > 1.03) { + ErrorsFound = true; + ShowSevereError(state, format("{}: {}=\"{}\" invalid value.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, + format("... Transmittance + reflectance) > 1.0 for an entry; at wavelength#={}", + format("{}, value(Tau+RhoF)=[{:.4T}], value(Tau+RhoB)=[{:.4T}].", LamNum, (Tau + RhoF), (Tau + RhoB)))); + } + } + } +} // GetWindowGlassSpectralData() + +void MaterialGlass::SetupSimpleWindowGlazingSystem(EnergyPlusData &state) +{ + + // SUBROUTINE INFORMATION: + // AUTHOR B. Griffith + // DATE WRITTEN January 2009 + + // PURPOSE OF THIS SUBROUTINE: + // Convert simple window performance indices into all the properties needed to + // describe a single, equivalent glass layer + + // METHODOLOGY EMPLOYED: + // The simple window indices are converted to a single materal layer using a "block model" + + // REFERENCES: + // draft paper by Arasteh, Kohler, and Griffith + + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 Riw(0.0); // thermal resistance of interior film coefficient under winter conditions (m2-K/W) + Real64 Row(0.0); // theraml resistance of exterior film coefficient under winter conditions (m2-K/W) + Real64 Rlw(0.0); // thermal resistance of block model layer (m2-K/W) + Real64 Ris(0.0); // thermal resistance of interior film coefficient under summer conditions (m2-K/W) + Real64 Ros(0.0); // theraml resistance of exterior film coefficient under summer conditions (m2-K/W) + Real64 InflowFraction(0.0); // inward flowing fraction for SHGC, intermediate value non dimensional + Real64 SolarAbsorb(0.0); // solar aborptance + bool ErrorsFound(false); + Real64 TsolLowSide(0.0); // intermediate solar transmission for interpolating + Real64 TsolHiSide(0.0); // intermediate solar transmission for interpolating + Real64 DeltaSHGCandTsol(0.0); // intermediate difference + Real64 RLowSide(0.0); + Real64 RHiSide(0.0); + + // first fill out defaults + this->GlassSpectralDataPtr = 0; + this->SolarDiffusing = false; + this->Roughness = Material::SurfaceRoughness::VerySmooth; + this->TransThermal = 0.0; + this->AbsorpThermalBack = 0.84; + this->AbsorpThermalFront = 0.84; + this->AbsorpThermal = this->AbsorpThermalBack; + + // step 1. Determine U-factor without film coefficients + // Simple window model has its own correlation for film coefficients (m2-K/W) under Winter conditions as function of U-factor + if (this->SimpleWindowUfactor < 5.85) { + Riw = 1.0 / (0.359073 * std::log(this->SimpleWindowUfactor) + 6.949915); + } else { + Riw = 1.0 / (1.788041 * this->SimpleWindowUfactor - 2.886625); + } + Row = 1.0 / (0.025342 * this->SimpleWindowUfactor + 29.163853); + + // determine 1/U without film coefficients + Rlw = (1.0 / this->SimpleWindowUfactor) - Riw - Row; + if (Rlw <= 0.0) { // U factor of film coefficients is better than user input. + Rlw = max(Rlw, 0.001); + ShowWarningError(state, + format("WindowMaterial:SimpleGlazingSystem: {} has U-factor higher than that provided by surface film resistances, " + "Check value of U-factor", + this->Name)); + } + + // Step 2. determine layer thickness. + + if ((1.0 / Rlw) > 7.0) { + this->Thickness = 0.002; + } else { + this->Thickness = 0.05914 - (0.00714 / Rlw); + } + + // Step 3. determine effective conductivity + + this->Conductivity = this->Thickness / Rlw; + if (this->Conductivity > 0.0) { + this->NominalR = this->Resistance = Rlw; + } else { + ErrorsFound = true; + ShowSevereError(state, + format("WindowMaterial:SimpleGlazingSystem: {} has Conductivity <= 0.0, must be >0.0, Check value of U-factor", this->Name)); + } + + // step 4. determine solar transmission (revised to 10-1-2009 version from LBNL.) + + if (this->SimpleWindowUfactor > 4.5) { -void CalcScreenTransmittance(EnergyPlusData &state, + if (this->SimpleWindowSHGC < 0.7206) { + + this->Trans = 0.939998 * pow_2(this->SimpleWindowSHGC) + 0.20332 * this->SimpleWindowSHGC; + } else { // >= 0.7206 + this->Trans = 1.30415 * this->SimpleWindowSHGC - 0.30515; + } + + } else if (this->SimpleWindowUfactor < 3.4) { + + if (this->SimpleWindowSHGC <= 0.15) { + this->Trans = 0.41040 * this->SimpleWindowSHGC; + } else { // > 0.15 + this->Trans = 0.085775 * pow_2(this->SimpleWindowSHGC) + 0.963954 * this->SimpleWindowSHGC - 0.084958; + } + } else { // interpolate. 3.4 <= Ufactor <= 4.5 + + if (this->SimpleWindowSHGC < 0.7206) { + TsolHiSide = 0.939998 * pow_2(this->SimpleWindowSHGC) + 0.20332 * this->SimpleWindowSHGC; + } else { // >= 0.7206 + TsolHiSide = 1.30415 * this->SimpleWindowSHGC - 0.30515; + } + + if (this->SimpleWindowSHGC <= 0.15) { + TsolLowSide = 0.41040 * this->SimpleWindowSHGC; + } else { // > 0.15 + TsolLowSide = 0.085775 * pow_2(this->SimpleWindowSHGC) + 0.963954 * this->SimpleWindowSHGC - 0.084958; + } + + this->Trans = ((this->SimpleWindowUfactor - 3.4) / (4.5 - 3.4)) * (TsolHiSide - TsolLowSide) + TsolLowSide; + } + if (this->Trans < 0.0) this->Trans = 0.0; + + // step 5. determine solar reflectances + + DeltaSHGCandTsol = this->SimpleWindowSHGC - this->Trans; + + if (this->SimpleWindowUfactor > 4.5) { + + Ris = 1.0 / (29.436546 * pow_3(DeltaSHGCandTsol) - 21.943415 * pow_2(DeltaSHGCandTsol) + 9.945872 * DeltaSHGCandTsol + 7.426151); + Ros = 1.0 / (2.225824 * DeltaSHGCandTsol + 20.577080); + } else if (this->SimpleWindowUfactor < 3.4) { + + Ris = 1.0 / (199.8208128 * pow_3(DeltaSHGCandTsol) - 90.639733 * pow_2(DeltaSHGCandTsol) + 19.737055 * DeltaSHGCandTsol + 6.766575); + Ros = 1.0 / (5.763355 * DeltaSHGCandTsol + 20.541528); + } else { // interpolate. 3.4 <= Ufactor <= 4.5 + // inside first + RLowSide = 1.0 / (199.8208128 * pow_3(DeltaSHGCandTsol) - 90.639733 * pow_2(DeltaSHGCandTsol) + 19.737055 * DeltaSHGCandTsol + 6.766575); + RHiSide = 1.0 / (29.436546 * pow_3(DeltaSHGCandTsol) - 21.943415 * pow_2(DeltaSHGCandTsol) + 9.945872 * DeltaSHGCandTsol + 7.426151); + Ris = ((this->SimpleWindowUfactor - 3.4) / (4.5 - 3.4)) * (RLowSide - RHiSide) + RLowSide; + // then outside + RLowSide = 1.0 / (5.763355 * DeltaSHGCandTsol + 20.541528); + RHiSide = 1.0 / (2.225824 * DeltaSHGCandTsol + 20.577080); + Ros = ((this->SimpleWindowUfactor - 3.4) / (4.5 - 3.4)) * (RLowSide - RHiSide) + RLowSide; + } + + InflowFraction = (Ros + 0.5 * Rlw) / (Ros + Rlw + Ris); + + SolarAbsorb = (this->SimpleWindowSHGC - this->Trans) / InflowFraction; + this->ReflectSolBeamBack = 1.0 - this->Trans - SolarAbsorb; + this->ReflectSolBeamFront = this->ReflectSolBeamBack; + + // step 6. determine visible properties. + if (this->SimpleWindowVTinputByUser) { + this->TransVis = this->SimpleWindowVisTran; + this->ReflectVisBeamBack = -0.7409 * pow_3(this->TransVis) + 1.6531 * pow_2(this->TransVis) - 1.2299 * this->TransVis + 0.4545; + if (this->TransVis + this->ReflectVisBeamBack >= 1.0) { + this->ReflectVisBeamBack = 0.999 - this->TransVis; + } + + this->ReflectVisBeamFront = -0.0622 * pow_3(this->TransVis) + 0.4277 * pow_2(this->TransVis) - 0.4169 * this->TransVis + 0.2399; + if (this->TransVis + this->ReflectVisBeamFront >= 1.0) { + this->ReflectVisBeamFront = 0.999 - this->TransVis; + } + } else { + this->TransVis = this->Trans; + this->ReflectVisBeamBack = this->ReflectSolBeamBack; + this->ReflectVisBeamFront = this->ReflectSolBeamFront; + } + + // step 7. The dependence on incident angle is in subroutine TransAndReflAtPhi + + // step 8. Hemispherical terms are averaged using standard method + + if (ErrorsFound) { + ShowFatalError(state, "Program halted because of input problem(s) in WindowMaterial:SimpleGlazingSystem"); + } +} // MaterialGlass::SetupSimpleWindowGlazingSystem() + +void CalcScreenTransmittance([[maybe_unused]] EnergyPlusData &state, MaterialScreen const *screen, Real64 phi, // Sun altitude relative to surface outward normal (radians, 0 to Pi) Real64 theta, // Optional sun azimuth relative to surface outward normal (radians, 0 to Pi) @@ -2815,15 +3231,9 @@ void CalcScreenTransmittance(EnergyPlusData &state, Real64 constexpr Small(1.E-9); // Small Number used to approximate zero - Real64 Tdirect; // Beam solar transmitted through screen (dependent on sun angle) - Real64 Tscattered; // Beam solar reflected through screen (dependent on sun angle) - Real64 TscatteredVis; // Visible beam solar reflected through screen (dependent on sun angle) - Real64 Tscattermax; // Maximum solar beam scattered transmittance - Real64 TscattermaxVis; // Maximum visible beam scattered transmittance - Real64 ExponentInterior; // Exponent used in scattered transmittance calculation - // when Delta < DeltaMax (0,0 to peak) - Real64 ExponentExterior; // Exponent used in scattered transmittance calculation - // when Delta > DeltaMax (peak to max) + Real64 Tdirect; // Beam solar transmitted through screen (dependent on sun angle) + Real64 Tscattered; // Beam solar reflected through screen (dependent on sun angle) + Real64 TscatteredVis; // Visible beam solar reflected through screen (dependent on sun angle) assert(phi >= 0.0 && phi <= Constant::Pi); assert(theta >= 0.0 && theta <= Constant::Pi); @@ -2831,9 +3241,7 @@ void CalcScreenTransmittance(EnergyPlusData &state, Real64 sinPhi = std::sin(phi); Real64 cosPhi = std::cos(phi); Real64 tanPhi = sinPhi / cosPhi; - Real64 sinTheta = std::sin(theta); Real64 cosTheta = std::cos(theta); - Real64 tanTheta = sinTheta / cosTheta; bool sunInFront = (phi < Constant::PiOvr2) && (theta < Constant::PiOvr2); // Sun is in front of screen @@ -3010,4 +3418,62 @@ void GetPhiThetaIndices(Real64 phi, Real64 theta, Real64 dPhi, Real64 dTheta, in iTheta2 = (iTheta1 == maxITheta - 1) ? iTheta1 : iTheta1 + 1; } // GetPhiThetaIndices() +Real64 MaterialBlind::BeamBeamTrans(Real64 const ProfAng, // Solar profile angle (rad) + Real64 const SlatAng // Slat angle (rad) +) const +{ + + // FUNCTION INFORMATION: + // AUTHOR Fred Winkelmann + // DATE WRITTEN Jan 2002 + // MODIFIED na + // RE-ENGINEERED na + + // PURPOSE OF THIS SUBROUTINE: + // Calculates beam-to-beam transmittance of a window blind + + // METHODOLOGY EMPLOYED: + // Based on solar profile angle and slat geometry + + Real64 CosProfAng = std::cos(ProfAng); // Cosine of profile angle + Real64 gamma = SlatAng - ProfAng; + Real64 wbar = this->SlatSeparation; + if (CosProfAng != 0.0) wbar = this->SlatWidth * std::cos(gamma) / CosProfAng; + Real64 BeamBeamTrans = max(0.0, 1.0 - std::abs(wbar / this->SlatSeparation)); + + if (BeamBeamTrans > 0.0) { + + // Correction factor that accounts for finite thickness of slats. It is used to modify the + // blind transmittance to account for reflection and absorption by the slat edges. + // fEdge is ratio of area subtended by edge of slat to area between tops of adjacent slats. + + Real64 fEdge = 0.0; // Slat edge correction factor + Real64 fEdge1 = 0.0; + if (std::abs(std::sin(gamma)) > 0.01) { + if ((SlatAng > 0.0 && SlatAng <= Constant::PiOvr2 && ProfAng <= SlatAng) || + (SlatAng > Constant::PiOvr2 && SlatAng <= Constant::Pi && ProfAng > -(Constant::Pi - SlatAng))) + fEdge1 = this->SlatThickness * std::abs(std::sin(gamma)) / + ((this->SlatSeparation + this->SlatThickness / std::abs(std::sin(SlatAng))) * CosProfAng); + fEdge = min(1.0, std::abs(fEdge1)); + } + BeamBeamTrans *= (1.0 - fEdge); + } + + return BeamBeamTrans; + +} // MaterialBlind::BeamBeamTrans() + +void GetProfIndices(Real64 profAng, int &idxLo, int &idxHi) +{ + idxLo = int((profAng + Constant::PiOvr2) / dProfAng) + 1; + idxHi = std::min(MaxProfAngs, idxLo + 1); +} + +void GetSlatIndicesInterpFac(Real64 slatAng, int &idxLo, int &idxHi, Real64 &interpFac) +{ + idxLo = int(slatAng / dSlatAng); + idxHi = std::min(MaxSlatAngs, idxLo + 1); + interpFac = (slatAng - (idxLo * dSlatAng)) / dSlatAng; +} + } // namespace EnergyPlus::Material diff --git a/src/EnergyPlus/Material.hh b/src/EnergyPlus/Material.hh index 54db2988aef..051dbd0cb20 100644 --- a/src/EnergyPlus/Material.hh +++ b/src/EnergyPlus/Material.hh @@ -51,43 +51,43 @@ // EnergyPlus Headers #include #include -#include #include -#include +#include #include #include +#include namespace EnergyPlus { namespace Material { - constexpr int MaxSlatAngs(181); // 1 degree increments for slat angles (We'll see what the performance implications are) - constexpr int MaxProfAngs(37); - // Parameters to indicate material group type for use with the Material // derived type (see below): + + // Don't change these numbers because they are printed out by number in SQLite (shouldn't print out internal enums by number) enum class Group { Invalid = -1, Regular, - Air, + AirGap, Shade, - WindowGlass, - WindowGas, - WindowBlind, - WindowGasMixture, + Glass, + Gas, + Blind, + GasMixture, Screen, EcoRoof, IRTransparent, - WindowSimpleGlazing, - ComplexWindowShade, + GlassSimple, + ComplexShade, ComplexWindowGap, - GlassEquivalentLayer, - ShadeEquivalentLayer, - DrapeEquivalentLayer, - BlindEquivalentLayer, - ScreenEquivalentLayer, - GapEquivalentLayer, + GlassEQL, + ShadeEQL, + DrapeEQL, + BlindEQL, + ScreenEQL, + WindowGapEQL, + GlassTCParent, Num }; @@ -102,18 +102,6 @@ namespace Material { Num }; -#ifdef GET_OUT - // Air Argon Krypton Xenon - // Gas conductivity coefficients for gases in a mixture - extern const std::array, 3> GasCoeffsCon; - // Gas viscosity coefficients for gases in a mixture - extern const std::array, 3> GasCoeffsVis; - // Gas specific heat coefficients for gases in a mixture - extern const std::array, 3> GasCoeffsCp; - extern const std::array GasWght; - extern const std::array GasSpecificHeatRatio; -#endif // GET_OUT - enum class GapVentType { Invalid = -1, @@ -184,11 +172,52 @@ namespace Material { extern const std::array surfaceRoughnessNames; + // Class Hierarchy + // + // MaterialBase: Material, Material:AirGap, Material:NoMass, Material:InfraredTransparent + // | + // | MaterialGasMix: WindowMaterial:Gas, WindowMaterial:GasMixture + // | | MaterialComplexGap: WindowMaterial:Gap (includes WindowGap:DeflectionState and WindowGap:SupportPillar) + // | + // | MaterialFen: abstract + // | | MaterialGlass: WindowMaterial:Glazing, WindowMaterial:Glazing:RefractionExtinctionMethod + // | | | MaterialGlassEQL: WindowMaterial:Glazing:EquivalentLayer + // | | | MaterialGlassTCParent: WindowMaterial:GlazingGroup:Thermochromic + // | | + // | | MaterialShadingDevice: abstract + // | | | MaterialShade: WindowMaterial:Shade + // | | | MaterialBlind: WindowMaterial:Blind + // | | | MaterialScreen: WindowMaterial:Screen + // | | | MaterialComplexShade: WindowMaterial:ComplexShade + // | | | | MaterialShadeEQL: WindowMaterial:Shade:EquivalentLayer + // | | | | MaterialBlindEQL: WindowMaterial:Blind:EquivalentLayer + // | | | | MaterialDrapeEQL: WindowMaterial:Drape:EquivalentLayer + // | | | | MaterialScreenEQL: WindowMaterial:Screen:EquivalentLayer + // | + // | MaterialEcoRoof: Material:RoofVegeration + // | + // | MaterialEMPD: holder of EMPD MaterialProperties. + // | + // | MaterialHAMT: holder of HAMT MaterialProperties. + // | + // | MaterialPhaseChange: holder of PhaseChange MaterialProperties. + + // This class is used for Material:AirGap, Material, + // Material:NoMass, and Material:InfraredTransparent. It is also + // the base class for all other materials. Material:AirGap, + // Material:NoMass, and Material:IRT could be a much smaller + // parent class of this, but Material:Regular is by far the most + // common material so it makes sense to have it as the base class + // to avoid an excess of dynamic casting. struct MaterialBase { // Members std::string Name = ""; // Name of material layer + int Num = 0; // Index in material array, comes in handy sometimes Group group = Group::Invalid; // Material group type (see Material Parameters above. Currently + + bool isUsed = false; + // active: RegularMaterial, Shade, Air, WindowGlass, // WindowGas, WindowBlind, WindowGasMixture, Screen, EcoRoof, // IRTMaterial, WindowSimpleGlazing, ComplexWindowShade, ComplexWindowGap) @@ -200,7 +229,8 @@ namespace Material { Real64 Density = 0.0; // Layer density (kg/m3) Real64 Resistance = 0.0; // Layer thermal resistance (alternative to Density, // Conductivity, Thickness, and Specific Heat; K/W) - bool ROnly = false; // Material defined with "R" only + bool ROnly = false; // Material defined with "R" only + Real64 NominalR = 0.0; Real64 SpecHeat = 0.0; // Layer specific heat (J/kgK) Real64 Thickness = 0.0; // Layer thickness (m) @@ -215,6 +245,43 @@ namespace Material { Real64 AbsorpVisible = 0.0; // Layer Visible Absorptance Real64 AbsorpVisibleInput = 0.0; // Layer Visible Absorptance input by user + // Radiation parameters // Are these for windows or for opaque materials also? + bool AbsorpSolarEMSOverrideOn = false; // if true, then EMS calling to override value for solar absorptance + Real64 AbsorpSolarEMSOverride = false; // value to use when EMS calling to override value for solar absorptance + bool AbsorpThermalEMSOverrideOn = false; // if true, then EMS calling to override value for thermal absorptance + Real64 AbsorpThermalEMSOverride = 0.0; // value to use when EMS calling to override value for thermal absorptance + bool AbsorpVisibleEMSOverrideOn = false; // if true, then EMS calling to override value for visible absorptance + Real64 AbsorpVisibleEMSOverride = 0.0; // value to use when EMS calling to override value for visible absorptance + + // dynamic thermal and solar absorptance coating parameters + VariableAbsCtrlSignal absorpVarCtrlSignal = VariableAbsCtrlSignal::Invalid; + int absorpThermalVarSchedIdx = 0; + int absorpThermalVarFuncIdx = 0; + int absorpSolarVarSchedIdx = 0; + int absorpSolarVarFuncIdx = 0; + + bool hasEMPD = false; + bool hasHAMT = false; + bool hasPCM = false; + + // Moved these into the base class for SQLite purposes + Real64 Porosity = 0.0; // Layer porosity + // Real64 IsoMoistCap = 0.0; // Isothermal moisture capacity on water vapor density (m3/kg) + // Real64 ThermGradCoef = 0.0; // Thermal-gradient coefficient for moisture capacity based on the water vapor density (kg/kgK) + Real64 VaporDiffus = 0.0; // Layer vapor diffusivity + + bool WarnedForHighDiffusivity = false; // used to limit error messaging to just the first instance + + MaterialBase() + { + group = Group::AirGap; + } + virtual ~MaterialBase() = default; + }; + + struct MaterialFen : public MaterialBase + { + // Are these just for windows? Real64 Trans = 0.0; // Transmittance of layer (glass, shade) Real64 TransVis = 0.0; // Visible transmittance (at normal incidence) Real64 TransThermal = 0.0; // Infrared radiation transmittance @@ -222,188 +289,219 @@ namespace Material { Real64 ReflectSolBeamBack = 0.0; // Solar back reflectance (beam to everything) Real64 ReflectSolBeamFront = 0.0; // Solar front reflectance (beam to everything) - // TODO: these and others need to be moved to a child class - // Simple Glazing System - Real64 SimpleWindowUfactor = 0.0; // user input for simple window U-factor with film coeffs (W/m2-k) - Real64 SimpleWindowSHGC = 0.0; // user input for simple window Solar Heat Gain Coefficient (non-dimensional) - Real64 SimpleWindowVisTran = 0.0; // (optional) user input for simple window Visual Transmittance (non-dimensional) - bool SimpleWindowVTinputByUser = false; // false means not input, true means user provide VT input - bool WarnedForHighDiffusivity = false; // used to limit error messaging to just the first instance + MaterialFen() : MaterialBase() + { + group = Group::Invalid; + } + ~MaterialFen() = default; + virtual bool can_instantiate() = 0; + }; - bool isUsed = false; + // Abstract parent class for all WindowMaterial:X shading device materials (including Equivalent Layer). + struct MaterialShadingDevice : public MaterialFen + { + // Some characteristics for blind thermal calculation + Real64 toGlassDist = 0.0; // Distance between window shade and adjacent glass (m) + Real64 topOpeningMult = 0.0; // Area of air-flow opening at top of blind, expressed as a fraction + // of the blind-to-glass opening area at the top of the blind + Real64 bottomOpeningMult = 0.0; // Area of air-flow opening at bottom of blind, expressed as a fraction + // of the blind-to-glass opening area at the bottom of the blind + Real64 leftOpeningMult = 0.0; // Area of air-flow opening at left side of blind, expressed as a fraction + // of the blind-to-glass opening area at the left side of the blind + Real64 rightOpeningMult = 0.0; // Area of air-flow opening at right side of blind, expressed as a fraction + // of the blind-to-glass opening area at the right side of the blind + // Calculated blind properties - // Moved these into the base class for SQLite purposes - Real64 Porosity = 0.0; // Layer porosity - Real64 IsoMoistCap = 0.0; // Isothermal moisture capacity on water vapor density (m3/kg) - Real64 ThermGradCoef = 0.0; // Thermal-gradient coefficient for moisture capacity based on the water vapor density (kg/kgK) - Real64 VaporDiffus = 0.0; // Layer vapor diffusivity + Real64 airFlowPermeability = 0.0; // The effective area of openings in the shade itself, expressed as a + // fraction of the shade area + MaterialShadingDevice() : MaterialFen() + { + group = Group::Invalid; + } + ~MaterialShadingDevice() = default; + virtual bool can_instantiate() = 0; // Prevents this class from being instantiated + }; - virtual bool dummy() + // Class for WindowMaterial:Shade + struct MaterialShade : public MaterialShadingDevice + { + Real64 ReflectShade = 0.0; // Shade or screen reflectance (interior shade only) + Real64 ReflectShadeVis = 0.0; // Shade reflectance for visible radiation + + MaterialShade() : MaterialShadingDevice() + { + group = Group::Shade; + } + ~MaterialShade() = default; + bool can_instantiate() override { return true; - } // Need at least one virtual function (vtable) for dynamic casting to work (duh) - virtual ~MaterialBase() = default; + } // Allows this class to be instantiated }; - struct MaterialChild : public MaterialBase + // This may seem like an overly complicated way to handle a set of + // multi-dimensional variables, but I think that it is actually + // cleaner than either a multi-dimensional array (and certaily + // faster) and also better than just a long list of variables. + + // Blind-properties essentially have four dimensions: property + // type (transmittance, reflectance, absorptance), beam or + // diffuse, front or back, solar or visible (maybe solar or + // visible or thermal/IR). Rather than coming up with and + // enforcing a consistent namming scheme for these variables, + // arranging them into nested structres keeps the ordering (as + // well as the naming) of the dimensions consistent, and also + // inserts periods between the dimensions to help with + // readability. In this case, I chose the struct nesting to be + // SolVis.Front.Back.BmDf.Prop. So variables are always going to + // be called Sol.Front.Df.Abs and Vis.Back.Df.Ref. + + // For the record, accessing variables in nested structs is as + // fast as accessing plain scalar variables. The reason is that + // the compiler knows the position of every variable at every + // level of a nested struct at compile time and can load it with a + // single offset like it loads every other variable in an object. + // This is another downside of references in C++. Accessing + // variables in structures (even nested structures) is fast. + // Acessing variables through pointer indirection is slow. + // W->X->Y->Z is slower than W.X.Y.Z. References are pointers, + // but they use the . notation rather than -> for accessing + // fields. So if W.X.Y.Z is implemented using nested structures + // then it is fast, but if it is implemented using references to + // structures then it is slow. But without context there is no + // way to tell which is which. + + struct BlindBmTAR { - int GlassSpectralDataPtr = 0; // Number of a spectral data set associated with a window glass material - // Radiation parameters - bool AbsorpSolarEMSOverrideOn = false; // if true, then EMS calling to override value for solar absorptance - Real64 AbsorpSolarEMSOverride = false; // value to use when EMS calling to override value for solar absorptance - bool AbsorpThermalEMSOverrideOn = false; // if true, then EMS calling to override value for thermal absorptance - Real64 AbsorpThermalEMSOverride = 0.0; // value to use when EMS calling to override value for thermal absorptance - // dynamic thermal and solar absorptance coating parameters - VariableAbsCtrlSignal absorpVarCtrlSignal = VariableAbsCtrlSignal::Invalid; - int absorpThermalVarSchedIdx = 0; - int absorpThermalVarFuncIdx = 0; - int absorpSolarVarSchedIdx = 0; - int absorpSolarVarFuncIdx = 0; - bool AbsorpVisibleEMSOverrideOn = false; // if true, then EMS calling to override value for visible absorptance - Real64 AbsorpVisibleEMSOverride = 0.0; // value to use when EMS calling to override value for visible absorptance + Real64 BmTra = 0.0; // Beam-beam transmittance + Real64 DfTra = 0.0; // Beam-diff transmittance + Real64 BmRef = 0.0; // Beam-beam reflectance + Real64 DfRef = 0.0; // Beam-diff reflectance + Real64 Abs = 0.0; // Absorptance - // Window-related radiation parameters - Real64 GlassTransDirtFactor = 1.0; // Multiplier on glass transmittance due to dirt - bool SolarDiffusing = false; // True if glass diffuses beam solar radiation - Real64 ReflectShade = 0.0; // Shade or screen reflectance (interior shade only) - Real64 ReflectShadeVis = 0.0; // Shade reflectance for visible radiation - Real64 ReflectSolDiffBack = 0.0; // Solar back diffuse reflectance - Real64 ReflectSolDiffFront = 0.0; // Solar front diffuse reflectance - Real64 ReflectVisBeamBack = 0.0; // Visible back reflectance (beam to everything) - Real64 ReflectVisBeamFront = 0.0; // Visible front reflectance (beam to everything) - Real64 ReflectVisDiffBack = 0.0; // Visible back diffuse reflectance - Real64 ReflectVisDiffFront = 0.0; // Visible front diffuse reflectance - Real64 TransSolBeam = 0.0; // Solar transmittance (beam to everything) - Real64 TransVisBeam = 0.0; // Visible transmittance (beam to everything) - int BlindDataPtr = 0; // Pointer to window blind data - // Complex fenestration parameters - Real64 YoungModulus = 0.0; // Young's modulus (Pa) - used in window deflection calculations - Real64 PoissonsRatio = 0.0; // Poisson's ratio - used in window deflection calculations - Real64 DeflectedThickness = 0.0; // Minimum gap thickness in deflected state (m). Used with measured deflection - Real64 Pressure = 0.0; // Window Gap pressure (Pa) - int SupportPillarPtr = 0; // Pointer to support pillar data - int DeflectionStatePtr = 0; // Pointer to deflection state - int ComplexShadePtr = 0; // Pointer to complex shade data - int GasPointer = 0; // Pointer to gas or gas mixture used in the gap - // Window-shade thermal model parameters - Real64 WinShadeToGlassDist = 0.0; // Distance between window shade and adjacent glass (m) - Real64 WinShadeTopOpeningMult = 0.0; // Area of air-flow opening at top of shade, expressed as a fraction - // of the shade-to-glass opening area at the top of the shade - Real64 WinShadeBottomOpeningMult = 0.0; // Area of air-flow opening at bottom of shade, expressed as a fraction - // of the shade-to-glass opening area at the bottom of the shade - Real64 WinShadeLeftOpeningMult = 0.0; // Area of air-flow opening at left side of shade, expressed as a fraction - // of the shade-to-glass opening area at the left side of the shade - Real64 WinShadeRightOpeningMult = 0.0; // Area of air-flow opening at right side of shade, expressed as a fraction - // of the shade-to-glass opening area at the right side of the shade - Real64 WinShadeAirFlowPermeability = 0.0; // The effective area of openings in the shade itself, expressed as a - // fraction of the shade area - bool EMPDMaterialProps = false; // True if EMPD properties have been assigned - Real64 EMPDmu = 0.0; // Water Vapor Diffusion Resistance Factor (dimensionless) - Real64 MoistACoeff = 0.0; // Moisture Equation Coefficient a - Real64 MoistBCoeff = 0.0; // Moisture Equation Coefficient b - Real64 MoistCCoeff = 0.0; // Moisture Equation Coefficient c - Real64 MoistDCoeff = 0.0; // Moisture Equation Coefficient d - Real64 EMPDSurfaceDepth = 0.0; // Surface-layer penetration depth (m) - Real64 EMPDDeepDepth = 0.0; // Deep-layer penetration depth (m) - Real64 EMPDCoatingThickness = 0.0; // Coating Layer Thickness (m) - Real64 EMPDmuCoating = 0.0; // Coating Layer water vapor diffusion resistance factor (dimensionless) - // EcoRoof-Related properties, essentially for the plant layer, - // the soil layer uses the same resource as a regular material - int EcoRoofCalculationMethod = 0; // 1-Simple, 2-SchaapGenuchten - Real64 HeightOfPlants = 0.0; // plants' height - Real64 LAI = 0.0; // LeafAreaIndex (Dimensionless???) - Real64 Lreflectivity = 0.0; // LeafReflectivity - Real64 LEmissitivity = 0.0; // LeafEmissivity - Real64 InitMoisture = 0.0; // Initial soil moisture DJS - Real64 MinMoisture = 0.0; // Minimum moisture allowed DJS - Real64 RStomata = 0.0; // Minimum stomatal resistance DJS - // HAMT - int niso = -1; // Number of data points - Array1D isodata = Array1D(27, 0.0); // isotherm values - Array1D isorh = Array1D(27, 0.0); // isotherm RH values - int nsuc = -1; // Number of data points - Array1D sucdata = Array1D(27, 0.0); // suction values - Array1D sucwater = Array1D(27, 0.0); // suction water values - int nred = -1; // Number of data points - Array1D reddata = Array1D(27, 0.0); // redistribution values - Array1D redwater = Array1D(27, 0.0); // redistribution water values - int nmu = -1; // Number of data points - Array1D mudata = Array1D(27, 0.0); // mu values - Array1D murh = Array1D(27, 0.0); // mu rh values - int ntc = -1; // Number of data points - Array1D tcdata = Array1D(27, 0.0); // thermal conductivity values - Array1D tcwater = Array1D(27, 0.0); // thermal conductivity water values - Real64 itemp = 10.0; // initial Temperature - Real64 irh = 0.5; // Initial RH - Real64 iwater = 0.2; // Initial water content kg/kg - int divs = 3; // Number of divisions - Real64 divsize = 0.005; // Average Cell Size - int divmin = 3; // Minimum number of cells - int divmax = 10; // Maximum number of cells - // Added 12/22/2008 for thermochromic window glazing material - Real64 SpecTemp = 0.0; // Temperature corresponding to the specified material properties - int TCParent = 0; // Reference to the parent object WindowMaterial:Glazing:Thermochromic - // Equivalent Layer (ASHWAT) Model - Real64 ScreenWireSpacing = 0.0; // insect screen wire spacing - Real64 ScreenWireDiameter = 0.0; // insect screen wire diameter - - Real64 ReflFrontBeamBeam = 0.0; // Beam-Beam solar reflectance front at zero incident - Real64 ReflBackBeamBeam = 0.0; // Beam-Beam solar reflectance back at zero incident - Real64 TausFrontBeamBeam = 0.0; // Beam-Beam solar transmittance front at zero incident - Real64 TausBackBeamBeam = 0.0; // Beam-Beam solar transmittance back at zero incident - Real64 ReflFrontBeamBeamVis = 0.0; // Beam-Beam visible reflectance front at zero incident - Real64 ReflBackBeamBeamVis = 0.0; // Beam-Beam visible reflectance back at zero incident - Real64 TausFrontBeamBeamVis = 0.0; // Beam-Beam visible transmittance front at zero incident - Real64 TausBackBeamBeamVis = 0.0; // Beam-Beam visible transmittance back at zero incident - Real64 ReflFrontBeamDiff = 0.0; // Beam-Diffuse solar reflectance front at zero incident - Real64 ReflBackBeamDiff = 0.0; // Beam-Diffuse solar reflectance back at zero incident - Real64 TausFrontBeamDiff = 0.0; // Beam-Diffuse solar transmittance front at zero incident - Real64 TausBackBeamDiff = 0.0; // Beam-Diffuse solar transmittance back at zero incident - Real64 ReflFrontBeamDiffVis = 0.0; // Beam-Diffuse visible reflectance front at zero incident - Real64 ReflBackBeamDiffVis = 0.0; // Beam-Diffuse visible reflectance back at zero incident - Real64 TausFrontBeamDiffVis = 0.0; // Beam-Diffuse visible transmittance front at zero incident - Real64 TausBackBeamDiffVis = 0.0; // Beam-Diffuse visible transmittance back at zero incident - - Real64 ReflFrontDiffDiff = 0.0; // Diffuse-Diffuse solar reflectance front - Real64 ReflBackDiffDiff = 0.0; // Diffuse-Diffuse solar reflectance back - Real64 TausDiffDiff = 0.0; // Diffuse-Diffuse solar transmittance (front and back) - Real64 ReflFrontDiffDiffVis = 0.0; // Diffuse-Diffuse visible reflectance front - Real64 ReflBackDiffDiffVis = 0.0; // Diffuse-Diffuse visible reflectance back - Real64 TausDiffDiffVis = 0.0; // Diffuse-Diffuse visible transmittance (front and back) - Real64 EmissThermalFront = 0.0; // Front side thermal or infrared Emissivity - Real64 EmissThermalBack = 0.0; // Back side thermal or infrared Emissivity - Real64 TausThermal = 0.0; // Thermal transmittance (front and back) - - bool ISPleatedDrape = false; // if pleated drape= true, if nonpleated drape = false - Real64 PleatedDrapeWidth = 0.0; // width of the pleated drape fabric section - Real64 PleatedDrapeLength = 0.0; // length of the pleated drape fabric section - Real64 SlatWidth = 0.0; // slat width - Real64 SlatSeparation = 0.0; // slat separation - Real64 SlatCrown = 0.0; // slat crown - Real64 SlatAngle = 0.0; // slat angle - SlatAngleType slatAngleType = SlatAngleType::FixedSlatAngle; // slat angle control type, 0=fixed, 1=maximize solar, 2=block beam - DataWindowEquivalentLayer::Orientation SlatOrientation = DataWindowEquivalentLayer::Orientation::Invalid; // horizontal or vertical - HysteresisPhaseChange::HysteresisPhaseChange *phaseChange = nullptr; - bool GlassSpectralAndAngle = false; // if SpectralAndAngle is an entered choice - int GlassSpecAngTransDataPtr = - 0; // Data set index of transmittance as a function of spectral and angle associated with a window glass material - int GlassSpecAngFRefleDataPtr = 0; // Data set index of front reflectance as a function of spectral and angle associated with a window glass - // material - int GlassSpecAngBRefleDataPtr = 0; // Data set index of back reflectance as a function of spectral and angle associated with a window glass - // material + void interpSlatAng(BlindBmTAR const &t1, BlindBmTAR const &t2, Real64 interpFac) + { + BmTra = Interp(t1.BmTra, t2.BmTra, interpFac); + DfTra = Interp(t1.DfTra, t2.DfTra, interpFac); + BmRef = Interp(t1.BmRef, t2.BmRef, interpFac); + DfRef = Interp(t1.DfRef, t2.DfRef, interpFac); + Abs = Interp(t1.Abs, t2.Abs, interpFac); + } + }; - virtual bool dummy() + struct BlindDfTAR + { + Real64 Tra = 0.0; + Real64 Abs = 0.0; + Real64 Ref = 0.0; + + void interpSlatAng(BlindDfTAR const &t1, BlindDfTAR const &t2, Real64 interpFac) { - return true; + Tra = Interp(t1.Tra, t2.Tra, interpFac); + Ref = Interp(t1.Ref, t2.Ref, interpFac); + Abs = Interp(t1.Abs, t2.Abs, interpFac); } - virtual ~MaterialChild() = default; }; - struct WindowBlindProperties + struct BlindDfTARGS + { + Real64 Tra = 0.0; + Real64 TraGnd = 0.0; + Real64 TraSky = 0.0; + Real64 Ref = 0.0; + Real64 RefGnd = 0.0; + Real64 RefSky = 0.0; + Real64 Abs = 0.0; + Real64 AbsGnd = 0.0; + Real64 AbsSky = 0.0; + + void interpSlatAng(BlindDfTARGS const &t1, BlindDfTARGS const &t2, Real64 interpFac) + { + Tra = Interp(t1.Tra, t2.Tra, interpFac); + TraGnd = Interp(t1.TraGnd, t2.TraGnd, interpFac); + TraSky = Interp(t1.TraSky, t2.TraSky, interpFac); + Ref = Interp(t1.Ref, t2.Ref, interpFac); + RefGnd = Interp(t1.RefGnd, t2.RefGnd, interpFac); + RefSky = Interp(t1.RefSky, t2.RefSky, interpFac); + Abs = Interp(t1.Abs, t2.Abs, interpFac); + AbsGnd = Interp(t1.AbsGnd, t2.AbsGnd, interpFac); + AbsSky = Interp(t1.AbsSky, t2.AbsSky, interpFac); + } + }; + + template struct BlindBmDf + { + std::array Bm; + BlindDfTARGS Df; + + void interpSlatAng(BlindBmDf const &t1, BlindBmDf const &t2, Real64 interpFac) + { + for (int i = 0; i < ProfAngs; ++i) + Bm[i].interpSlatAng(t1.Bm[i], t2.Bm[i], interpFac); + Df.interpSlatAng(t1.Df, t2.Df, interpFac); + } + }; + + template struct BlindFtBk + { + BlindBmDf Ft; + BlindBmDf Bk; + + void interpSlatAng(BlindFtBk const &t1, BlindFtBk const &t2, Real64 interpFac) + { + Ft.interpSlatAng(t1.Ft, t2.Ft, interpFac); + Bk.interpSlatAng(t1.Bk, t2.Bk, interpFac); + } + }; + + struct BlindTraEmi + { + Real64 Tra = 0.0; + Real64 Emi = 0.0; + + void interpSlatAng(BlindTraEmi const &t1, BlindTraEmi const &t2, Real64 interpFac) + { + Tra = Interp(t1.Tra, t2.Tra, interpFac); + Emi = Interp(t1.Emi, t2.Emi, interpFac); + } + }; + + struct BlindFtBkIR + { + BlindTraEmi Ft; + BlindTraEmi Bk; + + void interpSlatAng(BlindFtBkIR const &t1, BlindFtBkIR const &t2, Real64 interpFac) + { + Ft.interpSlatAng(t1.Ft, t2.Ft, interpFac); + Bk.interpSlatAng(t1.Bk, t2.Bk, interpFac); + } + }; + + template struct BlindTraAbsRef + { + BlindFtBk Sol; + BlindFtBk Vis; + BlindFtBkIR IR; + + void interpSlatAng(BlindTraAbsRef const &t1, BlindTraAbsRef const &t2, Real64 interpFac) + { + Sol.interpSlatAng(t1.Sol, t2.Sol, interpFac); + Vis.interpSlatAng(t1.Vis, t2.Vis, interpFac); + IR.interpSlatAng(t1.IR, t2.IR, interpFac); + } + }; + + // Blind + constexpr int MaxSlatAngs = 181; + constexpr int MaxProfAngs = 37; + + constexpr Real64 dProfAng = Constant::Pi / (MaxProfAngs - 1); + constexpr Real64 dSlatAng = Constant::Pi / (MaxSlatAngs - 1); + + // WindowMaterial:Blind class + struct MaterialBlind : public MaterialShadingDevice { - // Members - std::string Name; - int MaterialNumber = 0; // Material pointer for the blind // Input properties DataWindowEquivalentLayer::Orientation SlatOrientation = DataWindowEquivalentLayer::Orientation::Invalid; // HORIZONTAL or VERTICAL DataWindowEquivalentLayer::AngleType SlatAngleType = DataWindowEquivalentLayer::AngleType::Fixed; // FIXED or VARIABLE @@ -415,161 +513,51 @@ namespace Material { Real64 MinSlatAngle = 0.0; // Minimum slat angle for variable-angle slats (deg) (user input) Real64 MaxSlatAngle = 0.0; // Maximum slat angle for variable-angle slats (deg) (user input) Real64 SlatConductivity = 0.0; // Slat conductivity (W/m-K) - // Solar slat properties - Real64 SlatTransSolBeamDiff = 0.0; // Slat solar beam-diffuse transmittance - Real64 SlatFrontReflSolBeamDiff = 0.0; // Slat front solar beam-diffuse reflectance - Real64 SlatBackReflSolBeamDiff = 0.0; // Slat back solar beam-diffuse reflectance - Real64 SlatTransSolDiffDiff = 0.0; // Slat solar diffuse-diffuse transmittance - Real64 SlatFrontReflSolDiffDiff = 0.0; // Slat front solar diffuse-diffuse reflectance - Real64 SlatBackReflSolDiffDiff = 0.0; // Slat back solar diffuse-diffuse reflectance - // Visible slat properties - Real64 SlatTransVisBeamDiff = 0.0; // Slat visible beam-diffuse transmittance - Real64 SlatFrontReflVisBeamDiff = 0.0; // Slat front visible beam-diffuse reflectance - Real64 SlatBackReflVisBeamDiff = 0.0; // Slat back visible beam-diffuse reflectance - Real64 SlatTransVisDiffDiff = 0.0; // Slat visible diffuse-diffuse transmittance - Real64 SlatFrontReflVisDiffDiff = 0.0; // Slat front visible diffuse-diffuse reflectance - Real64 SlatBackReflVisDiffDiff = 0.0; // Slat back visible diffuse-diffuse reflectance - // Long-wave (IR) slat properties - Real64 SlatTransIR = 0.0; // Slat IR transmittance - Real64 SlatFrontEmissIR = 0.0; // Slat front emissivity - Real64 SlatBackEmissIR = 0.0; // Slat back emissivity - // Some characteristics for blind thermal calculation - Real64 BlindToGlassDist = 0.0; // Distance between window shade and adjacent glass (m) - Real64 BlindTopOpeningMult = 0.0; // Area of air-flow opening at top of blind, expressed as a fraction - // of the blind-to-glass opening area at the top of the blind - Real64 BlindBottomOpeningMult = 0.0; // Area of air-flow opening at bottom of blind, expressed as a fraction - // of the blind-to-glass opening area at the bottom of the blind - Real64 BlindLeftOpeningMult = 0.0; // Area of air-flow opening at left side of blind, expressed as a fraction - // of the blind-to-glass opening area at the left side of the blind - Real64 BlindRightOpeningMult = 0.0; // Area of air-flow opening at right side of blind, expressed as a fraction - // of the blind-to-glass opening area at the right side of the blind - // Calculated blind properties - // Blind solar properties - Array2D SolFrontBeamBeamTrans; // Blind solar front beam-beam transmittance vs. - // profile angle, slat angle - Array2D SolFrontBeamBeamRefl; // Blind solar front beam-beam reflectance vs. profile angle, - // slat angle (zero) - Array2D SolBackBeamBeamTrans; // Blind solar back beam-beam transmittance vs. profile angle, - // slat angle - Array2D SolBackBeamBeamRefl; // Blind solar back beam-beam reflectance vs. profile angle, - // slat angle (zero) - Array2D SolFrontBeamDiffTrans; // Blind solar front beam-diffuse transmittance - // vs. profile angle, slat angle - Array2D SolFrontBeamDiffRefl; // Blind solar front beam-diffuse reflectance - // vs. profile angle, slat angle - Array2D SolBackBeamDiffTrans; // Blind solar back beam-diffuse transmittance - // vs. profile angle, slat angle - Array2D SolBackBeamDiffRefl; // Blind solar back beam-diffuse reflectance - // vs. profile angle, slat angle - Array1D SolFrontDiffDiffTrans; // Blind solar front diffuse-diffuse transmittance - // vs. slat angle - Array1D SolFrontDiffDiffTransGnd; // Blind ground solar front diffuse-diffuse transmittance - // vs. slat angle - Array1D SolFrontDiffDiffTransSky; // Blind sky solar front diffuse-diffuse transmittance - // vs. slat angle - Array1D SolFrontDiffDiffRefl; // Blind solar front diffuse-diffuse reflectance - // vs. slat angle - Array1D SolFrontDiffDiffReflGnd; // Blind ground solar front diffuse-diffuse reflectance - // vs. slat angle - Array1D SolFrontDiffDiffReflSky; // Blind sky solar front diffuse-diffuse reflectance - // vs. slat angle - Array1D SolBackDiffDiffTrans; // Blind solar back diffuse-diffuse transmittance - // vs. slat angle - Array1D SolBackDiffDiffRefl; // Blind solar back diffuse-diffuse reflectance - // vs. slat angle - Array2D SolFrontBeamAbs; // Blind solar front beam absorptance vs. slat angle - Array2D SolBackBeamAbs; // Blind solar back beam absorptance vs. slat angle - Array1D SolFrontDiffAbs; // Blind solar front diffuse absorptance vs. slat angle - Array1D SolFrontDiffAbsGnd; // Blind ground solar front diffuse absorptance vs. slat angle - Array1D SolFrontDiffAbsSky; // Blind sky solar front diffuse absorptance vs. slat angle - Array1D SolBackDiffAbs; // Blind solar back diffuse absorptance vs. slat angle - // Blind visible properties - Array2D VisFrontBeamBeamTrans; // Blind visible front beam-beam transmittance - // vs. profile angle, slat angle - Array2D VisFrontBeamBeamRefl; // Blind visible front beam-beam reflectance - // vs. profile angle, slat angle (zero) - Array2D VisBackBeamBeamTrans; // Blind visible back beam-beam transmittance - // vs. profile angle, slat angle - Array2D VisBackBeamBeamRefl; // Blind visible back beam-beam reflectance - // vs. profile angle, slat angle (zero) - Array2D VisFrontBeamDiffTrans; // Blind visible front beam-diffuse transmittance - // vs. profile angle, slat angle - Array2D VisFrontBeamDiffRefl; // Blind visible front beam-diffuse reflectance - // vs. profile angle, slat angle - Array2D VisBackBeamDiffTrans; // Blind visible back beam-diffuse transmittance - // vs. profile angle, slat angle - Array2D VisBackBeamDiffRefl; // Blind visible back beam-diffuse reflectance - // vs. profile angle, slat angle - Array1D VisFrontDiffDiffTrans; // Blind visible front diffuse-diffuse transmittance - // vs. slat angle - Array1D VisFrontDiffDiffRefl; // Blind visible front diffuse-diffuse reflectance - // vs. slat angle - Array1D VisBackDiffDiffTrans; // Blind visible back diffuse-diffuse transmittance - // vs. slat angle - Array1D VisBackDiffDiffRefl; // Blind visible back diffuse-diffuse reflectance - // vs. slat angle - // Long-wave (IR) blind properties - Array1D IRFrontTrans; // Blind IR front transmittance vs. slat angle - Array1D IRFrontEmiss; // Blind IR front emissivity vs. slat angle - Array1D IRBackTrans; // Blind IR back transmittance vs. slat angle - Array1D IRBackEmiss; // Blind IR back emissivity vs. slat angle + + BlindTraAbsRef<1> slatTAR; // Beam properties for slats are not profile-angle dependent + + // Beam properties for blinds are profile angle dependent, so template must be instantiated with MaxProfAngs+1 + std::array, MaxSlatAngs> TARs; // Default Constructor - WindowBlindProperties() - : SolFrontBeamBeamTrans(MaxSlatAngs, MaxProfAngs, 0.0), SolFrontBeamBeamRefl(MaxSlatAngs, MaxProfAngs, 0.0), - SolBackBeamBeamTrans(MaxSlatAngs, MaxProfAngs, 0.0), SolBackBeamBeamRefl(MaxSlatAngs, MaxProfAngs, 0.0), - SolFrontBeamDiffTrans(MaxSlatAngs, MaxProfAngs, 0.0), SolFrontBeamDiffRefl(MaxSlatAngs, MaxProfAngs, 0.0), - SolBackBeamDiffTrans(MaxSlatAngs, MaxProfAngs, 0.0), SolBackBeamDiffRefl(MaxSlatAngs, MaxProfAngs, 0.0), - SolFrontDiffDiffTrans(MaxSlatAngs, 0.0), SolFrontDiffDiffTransGnd(MaxSlatAngs, 0.0), SolFrontDiffDiffTransSky(MaxSlatAngs, 0.0), - SolFrontDiffDiffRefl(MaxSlatAngs, 0.0), SolFrontDiffDiffReflGnd(MaxSlatAngs, 0.0), SolFrontDiffDiffReflSky(MaxSlatAngs, 0.0), - SolBackDiffDiffTrans(MaxSlatAngs, 0.0), SolBackDiffDiffRefl(MaxSlatAngs, 0.0), SolFrontBeamAbs(MaxSlatAngs, MaxProfAngs, 0.0), - SolBackBeamAbs(MaxSlatAngs, MaxProfAngs, 0.0), SolFrontDiffAbs(MaxSlatAngs, 0.0), SolFrontDiffAbsGnd(MaxSlatAngs, 0.0), - SolFrontDiffAbsSky(MaxSlatAngs, 0.0), SolBackDiffAbs(MaxSlatAngs, 0.0), VisFrontBeamBeamTrans(MaxSlatAngs, MaxProfAngs, 0.0), - VisFrontBeamBeamRefl(MaxSlatAngs, MaxProfAngs, 0.0), VisBackBeamBeamTrans(MaxSlatAngs, MaxProfAngs, 0.0), - VisBackBeamBeamRefl(MaxSlatAngs, MaxProfAngs, 0.0), VisFrontBeamDiffTrans(MaxSlatAngs, MaxProfAngs, 0.0), - VisFrontBeamDiffRefl(MaxSlatAngs, MaxProfAngs, 0.0), VisBackBeamDiffTrans(MaxSlatAngs, MaxProfAngs, 0.0), - VisBackBeamDiffRefl(MaxSlatAngs, MaxProfAngs, 0.0), VisFrontDiffDiffTrans(MaxSlatAngs, 0.0), VisFrontDiffDiffRefl(MaxSlatAngs, 0.0), - VisBackDiffDiffTrans(MaxSlatAngs, 0.0), VisBackDiffDiffRefl(MaxSlatAngs, 0.0), IRFrontTrans(MaxSlatAngs, 0.0), - IRFrontEmiss(MaxSlatAngs, 0.0), IRBackTrans(MaxSlatAngs, 0.0), IRBackEmiss(MaxSlatAngs, 0.0) + MaterialBlind() : MaterialShadingDevice() { + group = Group::Blind; } - }; + ~MaterialBlind() = default; + bool can_instantiate() + { + return true; + } // This function allows this class to be instantiated - struct WindowComplexShade - { - // Members - std::string Name; // Name for complex shade - TARCOGParams::TARCOGLayerType LayerType = - TARCOGParams::TARCOGLayerType::Invalid; // Layer type (OtherShadingType, Venetian, Woven, Perforated) - Real64 Thickness = 0.0; // Layer thickness (m) - Real64 Conductivity = 0.0; // Layer conductivity (W/m2K) - Real64 IRTransmittance = 0.0; // IR Transmittance - Real64 FrontEmissivity = 0.0; // Emissivity of front surface - Real64 BackEmissivity = 0.0; // Emissivity of back surface - Real64 TopOpeningMultiplier = 0.0; // Coverage percent for top opening (%) - Real64 BottomOpeningMultiplier = 0.0; // Coverage percent for bottom opening (%) - Real64 LeftOpeningMultiplier = 0.0; // Coverage percent for left opening (%) - Real64 RightOpeningMultiplier = 0.0; // Coverage percent for right opening (%) - Real64 FrontOpeningMultiplier = 0.0; // Coverage percent for front opening (%) - Real64 SlatWidth = 0.0; // Slat width (m) - Real64 SlatSpacing = 0.0; // Slat spacing (m) - Real64 SlatThickness = 0.0; // Slat thickness (m) - Real64 SlatAngle = 0.0; // Slat angle (deg) - Real64 SlatConductivity = 0.0; // Slat conductivity (W/m2K) - Real64 SlatCurve = 0.0; // Curvature radius of slat (if =0 then flat) (m) + Real64 BeamBeamTrans(Real64 profAng, Real64 slatAng) const; }; - struct WindowThermalModelParams + // WindowMaterial:ComplexShade class + struct MaterialComplexShade : public MaterialShadingDevice { - // Members - std::string Name; // Window thermal model name - TARCOGGassesParams::Stdrd CalculationStandard = TARCOGGassesParams::Stdrd::Invalid; // Tarcog calculation standard - TARCOGParams::TARCOGThermalModel ThermalModel = TARCOGParams::TARCOGThermalModel::Invalid; // Tarcog thermal model - Real64 SDScalar = 0.0; // SDScalar coefficient - TARCOGParams::DeflectionCalculation DeflectionModel = TARCOGParams::DeflectionCalculation::Invalid; // Deflection model - Real64 VacuumPressureLimit = 0.0; // Pressure limit at which it will be considered vacuum gas state - Real64 InitialTemperature = 0.0; // Window(s) temperature in time of fabrication - Real64 InitialPressure = 0.0; // Window(s) pressure in time of fabrication + // Layer type (OtherShadingType, Venetian, Woven, Perforated) + TARCOGParams::TARCOGLayerType LayerType = TARCOGParams::TARCOGLayerType::Invalid; + Real64 FrontEmissivity = 0.0; // Emissivity of front surface + Real64 BackEmissivity = 0.0; // Emissivity of back surface + Real64 SlatWidth = 0.0; // Slat width (m) + Real64 SlatSpacing = 0.0; // Slat spacing (m) + Real64 SlatThickness = 0.0; // Slat thickness (m) + Real64 SlatAngle = 0.0; // Slat angle (deg) + Real64 SlatConductivity = 0.0; // Slat conductivity (W/m2K) + Real64 SlatCurve = 0.0; // Curvature radius of slat (if =0 then flat) (m) + + Real64 frontOpeningMult = 0.0; + + MaterialComplexShade() : MaterialShadingDevice() + { + group = Group::ComplexShade; + } + ~MaterialComplexShade() = default; + bool can_instantiate() + { + return true; + } // This function allows this class to be instantiated }; int constexpr maxMixGases = 5; @@ -593,6 +581,7 @@ namespace Material { extern const std::array gases; + // Class for WindowMaterial:Gas and WindowMaterial:GasMixture. Parent class for Material:ComplexWindowGap struct MaterialGasMix : public MaterialBase { // up to 5 gases in a mixture [Window gas only]. It is defined as parameter (GasCoefs) @@ -603,17 +592,55 @@ namespace Material { GapVentType gapVentType = GapVentType::Sealed; // Gap Ven type for equivalent Layer window model - virtual bool dummy() + MaterialGasMix() : MaterialBase() { - return true; + group = Group::Gas; } + ~MaterialGasMix() = default; + }; - MaterialGasMix() : MaterialBase() + // Class for Material:ComplexWindowGap + struct MaterialComplexWindowGap : public MaterialGasMix + { + Real64 Pressure = 0.0; + Real64 pillarSpacing = 0.0; // Spacing between centers of support pillars (m) + Real64 pillarRadius = 0.0; // Support pillar radius (m) + Real64 deflectedThickness = 0.0; + + MaterialComplexWindowGap() : MaterialGasMix() { - group = Group::WindowGas; + group = Group::ComplexWindowGap; } + ~MaterialComplexWindowGap() = default; + }; + + struct ScreenBmTraAbsRef + { + struct + { + Real64 Tra = 0.0; + } Bm; + struct + { + Real64 Tra = 0.0; + } Df; + Real64 Abs = 0.0; + Real64 Ref = 0.0; }; + struct ScreenBmTAR + { + struct + { + ScreenBmTraAbsRef Ft, Bk; + } Sol; + struct + { + ScreenBmTraAbsRef Ft, Bk; + } Vis; + }; + + // Screen Beam Transmittance, Absorptance, Reflectance (TAR) properties struct ScreenBmTransAbsRef { Real64 BmTrans = 0.0; // Beam solar transmittance (dependent on sun angle) @@ -641,7 +668,8 @@ namespace Material { constexpr int maxIPhi = (Constant::Pi * Constant::RadToDeg / minDegResolution) + 1; constexpr int maxITheta = (Constant::Pi * Constant::RadToDeg / minDegResolution) + 1; - struct MaterialScreen : public MaterialBase + // Class for Material:Screen + struct MaterialScreen : public MaterialShadingDevice { Real64 diameterToSpacingRatio = 0.0; // ratio of screen material diameter to screen material spacing @@ -664,32 +692,225 @@ namespace Material { std::array, maxIPhi> btars; - // These are shared with window shade and blind - Real64 toGlassDist = 0.0; // Distance between window shade and adjacent glass (m) - Real64 topOpeningMult = 0.0; // Area of air-flow opening at top of shade, expressed as a fraction - // of the shade-to-glass opening area at the top of the shade - Real64 bottomOpeningMult = 0.0; // Area of air-flow opening at bottom of shade, expressed as a fraction - // of the shade-to-glass opening area at the bottom of the shade - Real64 leftOpeningMult = 0.0; // Area of air-flow opening at left side of shade, expressed as a fraction - // of the shade-to-glass opening area at the left side of the shade - Real64 rightOpeningMult = 0.0; // Area of air-flow opening at right side of shade, expressed as a fraction - // of the shade-to-glass opening area at the right side of the shade - Real64 airFlowPermeability = 0.0; // The effective area of openings in the shade itself, expressed as a - // fraction of the shade area + MaterialScreen() : MaterialShadingDevice() + { + group = Group::Screen; + } + ~MaterialScreen() = default; + bool can_instantiate() override + { + return true; + } // Allows this class to be instantiated + }; + + // Class for Material:Shade:EquivalentLayer and parent class for + // Material:Blind:EquivalentLayer, Material:Drape:EquivalentLayer + // and MaterialScreen:EquivalentLayer + struct MaterialShadeEQL : public MaterialShadingDevice + { + // Shading properties are profile-angle independent in EQL model + BlindTraAbsRef<1> TAR; - virtual bool dummy() + MaterialShadeEQL() : MaterialShadingDevice() + { + group = Group::ShadeEQL; + } + virtual ~MaterialShadeEQL() = default; + bool can_instantiate() override { return true; + } // Allows this class to be instantiated + }; + + // Class for Material:Screen:EquivalentLayer + struct MaterialScreenEQL : public MaterialShadeEQL + { + Real64 wireSpacing = 0.0; // insect screen wire spacing + Real64 wireDiameter = 0.0; // insect screen wire diameter + + MaterialScreenEQL() : MaterialShadeEQL() + { + group = Group::ScreenEQL; } + virtual ~MaterialScreenEQL() = default; + }; + + struct MaterialDrapeEQL : public MaterialShadeEQL + { + bool isPleated = false; // if pleated drape= true, if nonpleated drape = false + Real64 pleatedWidth = 0.0; // width of the pleated drape fabric section + Real64 pleatedLength = 0.0; // length of the pleated drape fabric section - MaterialScreen() : MaterialBase() + MaterialDrapeEQL() : MaterialShadeEQL() { - group = Group::Screen; + group = Group::DrapeEQL; + } // Can be any number of 'group' types, so don't set it here + virtual ~MaterialDrapeEQL() = default; + }; + + struct MaterialBlindEQL : public MaterialShadeEQL + { + Real64 SlatWidth = 0.0; // slat width + Real64 SlatSeparation = 0.0; // slat separation + Real64 SlatCrown = 0.0; // slat crown + Real64 SlatAngle = 0.0; // slat angle + SlatAngleType slatAngleType = SlatAngleType::FixedSlatAngle; // slat angle control type, 0=fixed, 1=maximize solar, 2=block beam + DataWindowEquivalentLayer::Orientation SlatOrientation = DataWindowEquivalentLayer::Orientation::Invalid; // horizontal or vertical + + MaterialBlindEQL() : MaterialShadeEQL() + { + group = Group::BlindEQL; + } // Can be any number of 'group' types, so don't set it here + virtual ~MaterialBlindEQL() = default; + }; + + // EcoRoof + enum EcoRoofCalcMethod + { + Invalid = -1, + Simple, + SchaapGenuchten, + Num + }; + + extern const std::array ecoRoofCalcMethodNamesUC; + + // Class for Material:RoofVegetation + struct MaterialEcoRoof : public MaterialBase + { + // EcoRoof-Related properties, essentially for the plant layer, + // the soil layer uses the same resource as a regular material + EcoRoofCalcMethod calcMethod = EcoRoofCalcMethod::Invalid; // 1-Simple, 2-SchaapGenuchten + Real64 HeightOfPlants = 0.0; // plants' height + Real64 LAI = 0.0; // LeafAreaIndex (Dimensionless???) + Real64 Lreflectivity = 0.0; // LeafReflectivity + Real64 LEmissitivity = 0.0; // LeafEmissivity + Real64 InitMoisture = 0.0; // Initial soil moisture DJS + Real64 MinMoisture = 0.0; // Minimum moisture allowed DJS + Real64 RStomata = 0.0; // Minimum stomatal resistance DJS + + MaterialEcoRoof() : MaterialBase() + { + group = Group::EcoRoof; + } + ~MaterialEcoRoof() = default; + }; + + struct WindowThermalModelParams + { + // Members + std::string Name; // Window thermal model name + TARCOGGassesParams::Stdrd CalculationStandard = TARCOGGassesParams::Stdrd::Invalid; // Tarcog calculation standard + TARCOGParams::TARCOGThermalModel ThermalModel = TARCOGParams::TARCOGThermalModel::Invalid; // Tarcog thermal model + Real64 SDScalar = 0.0; // SDScalar coefficient + TARCOGParams::DeflectionCalculation DeflectionModel = TARCOGParams::DeflectionCalculation::Invalid; // Deflection model + Real64 VacuumPressureLimit = 0.0; // Pressure limit at which it will be considered vacuum gas state + Real64 InitialTemperature = 0.0; // Window(s) temperature in time of fabrication + Real64 InitialPressure = 0.0; // Window(s) pressure in time of fabrication + }; + + struct SpectralDataProperties + { + // Members + std::string Name; // Name of spectral data set + int NumOfWavelengths = 0; // Number of wavelengths in the data set + Array1D WaveLength; // Wavelength (microns) + Array1D Trans; // Transmittance at normal incidence + Array1D ReflFront; // Front reflectance at normal incidence + Array1D ReflBack; // Back reflectance at normal incidence + }; + + struct MaterialGlass : public MaterialFen + { + // Window-related radiation parameters + Real64 GlassTransDirtFactor = 1.0; // Multiplier on glass transmittance due to dirt + bool SolarDiffusing = false; // True if glass diffuses beam solar radiation + Real64 ReflectSolDiffBack = 0.0; // Solar back diffuse reflectance + Real64 ReflectSolDiffFront = 0.0; // Solar front diffuse reflectance + Real64 ReflectVisBeamBack = 0.0; // Visible back reflectance (beam to everything) + Real64 ReflectVisBeamFront = 0.0; // Visible front reflectance (beam to everything) + Real64 ReflectVisDiffBack = 0.0; // Visible back diffuse reflectance + Real64 ReflectVisDiffFront = 0.0; // Visible front diffuse reflectance + Real64 TransSolBeam = 0.0; // Solar transmittance (beam to everything) + Real64 TransVisBeam = 0.0; // Visible transmittance (beam to everything) + // Complex fenestration parameters + Real64 YoungModulus = 0.0; // Young's modulus (Pa) - used in window deflection calculations + Real64 PoissonsRatio = 0.0; // Poisson's ratio - used in window deflection calculations + + // Added 12/22/2008 for thermochromic window glazing material + Real64 SpecTemp = 0.0; // Temperature corresponding to the specified material properties + int TCParentMatNum = 0; // Reference to the parent object WindowMaterial:Glazing:Thermochromic + int GlassSpectralDataPtr = 0; // Number of a spectral data set associated with a window glass material + int GlassSpecAngTransDataPtr = + 0; // Data set index of transmittance as a function of spectral and angle associated with a window glass material + int GlassSpecAngFRefleDataPtr = 0; // Data set index of front reflectance as a function of spectral and angle associated with a window glass + // material + int GlassSpecAngBRefleDataPtr = 0; // Data set index of back reflectance as a function of spectral and angle associated with a window glass + // material + + // TODO: these and others need to be moved to a child class + // Simple Glazing System + Real64 SimpleWindowUfactor = 0.0; // user input for simple window U-factor with film coeffs (W/m2-k) + Real64 SimpleWindowSHGC = 0.0; // user input for simple window Solar Heat Gain Coefficient (non-dimensional) + Real64 SimpleWindowVisTran = 0.0; // (optional) user input for simple window Visual Transmittance (non-dimensional) + bool SimpleWindowVTinputByUser = false; // false means not input, true means user provide VT input + + Window::OpticalDataModel windowOpticalData = Window::OpticalDataModel::SpectralAverage; + + MaterialGlass() : MaterialFen() + { + group = Group::Glass; + } + ~MaterialGlass() = default; + bool can_instantiate() + { + return true; } + + void SetupSimpleWindowGlazingSystem(EnergyPlusData &state); }; + struct MaterialGlassEQL : public MaterialFen + { + BlindTraAbsRef<1> TAR; + Window::OpticalDataModel windowOpticalData = Window::OpticalDataModel::SpectralAverage; + + MaterialGlassEQL() : MaterialFen() + { + group = Group::GlassEQL; + } + ~MaterialGlassEQL() = default; + bool can_instantiate() + { + return true; + } + }; + + struct MaterialRefSpecTemp + { + int matNum = 0; + Real64 specTemp = 0.0; + }; + + struct MaterialGlassTC : public MaterialBase + { + // Members + int numMatRefs = 0; // Number of TC glazing materials + Array1D matRefs; + + MaterialGlassTC() : MaterialBase() + { + group = Group::GlassTCParent; + } + ~MaterialGlassTC() = default; + }; + + int GetMaterialNum(EnergyPlusData &state, std::string const &matName); + MaterialBase *GetMaterial(EnergyPlusData &state, std::string const &matName); + void GetMaterialData(EnergyPlusData &state, bool &errorsFound); // set to true if errors found in input void GetVariableAbsorptanceInput(EnergyPlusData &state, bool &errorsFound); + void GetWindowGlassSpectralData(EnergyPlusData &state, bool &errorsFound); // Angles must be in radians void GetRelativePhiTheta(Real64 phiWin, Real64 thetaWin, Vector3 const &solcos, Real64 &phi, Real64 &theta); @@ -702,17 +923,46 @@ namespace Material { Real64 theta, // Sun azimuth relative to surface outward normal (rad) ScreenBmTransAbsRef &tar); + void NormalizeProfSlat(Real64 &profAng, Real64 &slatAng); + void GetProfIndices(Real64 profAng, int &iProf1, int &iProf2); + void GetSlatIndicesInterpFac(Real64 slatAng, int &iSlat1, int &iSlat2, Real64 &interpFac); } // namespace Material struct MaterialData : BaseGlobalStruct { - EPVector Material; - int TotMaterials = 0; // Total number of unique materials (layers) in this simulation - int TotComplexShades = 0; // Total number of shading materials for complex fenestrations - - EPVector Blind; - EPVector ComplexShade; - EPVector WindowThermalModel; + Array1D materials; + std::map materialMap; + + int NumRegulars = 0; + int NumNoMasses = 0; + int NumIRTs = 0; + int NumAirGaps = 0; + int NumW5Glazings = 0; // Window5 Glass Materials, specified by transmittance and front and back reflectance + int NumW5AltGlazings = 0; // Window5 Glass Materials, specified by index of refraction and extinction coeff + int NumW5Gases = 0; // Window5 Single-Gas Materials + int NumW5GasMixtures = 0; // Window5 Gas Mixtures + int NumW7SupportPillars = 0; // Complex fenestration support pillars + int NumW7DeflectionStates = 0; // Complex fenestration deflection states + int NumW7Gaps = 0; // Complex fenestration material gaps + int NumBlinds = 0; // Total number of blind materials + int NumScreens = 0; // Total number of exterior window screen materials + int NumTCGlazings = 0; // Number of TC glazing object - WindowMaterial:Glazing:Thermochromic found in the idf file + int NumShades = 0; // Total number of shade materials + int NumComplexGaps = 0; // Total number of window gaps for complex fenestrations + int NumSimpleWindows = 0; // number of simple window systems. + int NumEQLGlazings = 0; // Window5 Single-Gas Materials for Equivalent Layer window model + int NumEQLShades = 0; // Total number of shade materials for Equivalent Layer window model + int NumEQLDrapes = 0; // Total number of drape materials for Equivalent Layer window model + int NumEQLBlinds = 0; // Total number of blind materials for Equivalent Layer window model + int NumEQLScreens = 0; // Total number of exterior window screen materials for Equivalent Layer window model + int NumEQLGaps = 0; // Window5 Equivalent Layer Single-Gas Materials + int NumEcoRoofs = 0; + + bool AnyVariableAbsorptance = false; + int NumSpectralData = 0; + + Array1D WindowThermalModel; + Array1D SpectralData; void init_state([[maybe_unused]] EnergyPlusData &state) override { @@ -720,10 +970,11 @@ struct MaterialData : BaseGlobalStruct void clear_state() override { - for (int i = 0; i < TotMaterials; ++i) { - delete Material[i]; // + for (int i = 0; i < materials.isize(); ++i) { + delete materials[i]; } - Material.deallocate(); + materials.clear(); + materialMap.clear(); } }; diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.cc b/src/EnergyPlus/MoistureBalanceEMPDManager.cc index 7599fb9c328..92a145ce920 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.cc +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.cc @@ -107,12 +107,10 @@ namespace EnergyPlus::MoistureBalanceEMPDManager { using namespace DataHeatBalance; using namespace DataMoistureBalanceEMPD; -Real64 CalcDepthFromPeriod(EnergyPlusData &state, - Real64 const period, // in seconds - Material::MaterialBase const *matBase // material +Real64 MaterialEMPD::calcDepthFromPeriod(EnergyPlusData &state, + Real64 const period // in seconds ) { - // Assume T, RH, P Real64 constexpr T = 24.0; // C Real64 constexpr RH = 0.45; @@ -121,22 +119,18 @@ Real64 CalcDepthFromPeriod(EnergyPlusData &state, // Calculate saturation vapor pressure at assumed temperature Real64 const PV_sat = Psychrometrics::PsyPsatFnTemp(state, T, "CalcDepthFromPeriod"); - auto const *mat = dynamic_cast(matBase); - assert(mat != nullptr); // Calculate slope of moisture sorption curve - Real64 const slope_MC = mat->MoistACoeff * mat->MoistBCoeff * std::pow(RH, mat->MoistBCoeff - 1) + - mat->MoistCCoeff * mat->MoistDCoeff * std::pow(RH, mat->MoistDCoeff - 1); + Real64 const slope_MC = this->moistACoeff * this->moistBCoeff * std::pow(RH, this->moistBCoeff - 1) + + this->moistCCoeff * this->moistDCoeff * std::pow(RH, this->moistDCoeff - 1); // Equation for the diffusivity of water vapor in air Real64 const diffusivity_air = 2.0e-7 * std::pow(T + 273.15, 0.81) / P_amb; // Convert mu to diffusivity [kg/m^2-s-Pa] - Real64 const EMPDdiffusivity = diffusivity_air / mat->EMPDmu; + Real64 const EMPDdiffusivity = diffusivity_air / this->mu; // Calculate penetration depth - Real64 const PenetrationDepth = std::sqrt(EMPDdiffusivity * PV_sat * period / (mat->Density * slope_MC * Constant::Pi)); - - return PenetrationDepth; + return std::sqrt(EMPDdiffusivity * PV_sat * period / (this->Density * slope_MC * Constant::Pi)); } void GetMoistureBalanceEMPDInput(EnergyPlusData &state) @@ -152,7 +146,7 @@ void GetMoistureBalanceEMPDInput(EnergyPlusData &state) // This subroutine is the main driver for initializations within the // heat balance using the EMPD model. - // Using/Aliasing + static constexpr std::string_view routineName = "GetMoistureBalanceEMPDInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int IOStat; // IO Status when calling get input subroutine @@ -162,119 +156,103 @@ void GetMoistureBalanceEMPDInput(EnergyPlusData &state) Array1D MaterialProps(9); // Temporary array to transfer material properties bool ErrorsFound(false); // If errors detected in input - int EMPDMat; // EMPD Moisture Material additional properties for each base material - int Loop; - int Layer; - int SurfNum; // Surface number - int MatNum; // Material number at interior layer - int ConstrNum; // Construction number + int EMPDMat; // EMPD Moisture Material additional properties for each base material Array1D_bool EMPDzone; // EMPD property check for each zone - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + auto &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; // Load the additional EMPD Material properties - cCurrentModuleObject = "MaterialProperty:MoisturePenetrationDepth:Settings"; - EMPDMat = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "MaterialProperty:MoisturePenetrationDepth:Settings"; + EMPDMat = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (EMPDMat == 0) { - ShowSevereError(state, format("EMPD Solution requested, but no \"{}\" objects were found.", cCurrentModuleObject)); + ShowSevereError(state, format("EMPD Solution requested, but no \"{}\" objects were found.", s_ipsc->cCurrentModuleObject)); ErrorsFound = true; } - for (Loop = 1; Loop <= EMPDMat; ++Loop) { + for (int Loop = 1; Loop <= EMPDMat; ++Loop) { // Call Input Get routine to retrieve material data state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, MaterialNames, MaterialNumAlpha, MaterialProps, MaterialNumProp, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, MaterialNames(1)}; // Load the material derived type from the input data. - int MaterNum = Util::FindItemInPtrList(MaterialNames(1), state.dataMaterial->Material); - if (MaterNum == 0) { - ShowSevereError(state, - format("{}: invalid {} entered={}, must match to a valid Material name.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - MaterialNames(1))); + int matNum = Material::GetMaterialNum(state, MaterialNames(1)); + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(1), MaterialNames(1)); ErrorsFound = true; continue; } - auto *material(dynamic_cast(state.dataMaterial->Material(MaterNum))); - assert(material != nullptr); - // See if Material was defined with R only. (No density is defined then and not applicable for EMPD). - // What about materials other than "regular materials" (e.g. Glass, Air, etc) - if (material->group == Material::Group::Regular && MaterialProps(1) > 0.0) { - if (material->ROnly) { - // CALL ShowSevereError('EMPD base material = "'//TRIM(dataMaterial.Material(MaterNum)%Name)// & - // '" was Material:NoMass. It cannot be used for EMPD calculations.') - ShowSevereError(state, "..Only Material base materials are allowed to have EMPD properties."); - ShowContinueError( - state, - format("{}: Reference Material is not appropriate type for EMPD properties, material={}, must have regular properties (L,Cp,K,D)", - cCurrentModuleObject, - material->Name)); - ErrorsFound = true; - } - } - if (material->group != Material::Group::Regular) { - // CALL ShowSevereError('GetMoistureBalanceEMPDInput: Only Material:Regular base materials are allowed '// & - // 'to have EMPD properties, material = '// TRIM(dataMaterial.Material(MaterNum)%Name)) - ShowSevereError( - state, - format("{}: Reference Material is not appropriate type for EMPD properties, material={}, must have regular properties (L,Cp,K,D)", - cCurrentModuleObject, - material->Name)); + auto *mat = s_mat->materials(matNum); + if (mat->group != Material::Group::Regular || mat->ROnly) { + ShowSevereCustomMessage( + state, eoh, "Reference Material is not appropriate type for EMPD properties, must have regular properties (L,Cp,K,D)"); ErrorsFound = true; + continue; } + // This is a regular material and we need to replace/upgrade it with an opaque material (subclass) + auto *matEMPD = new MaterialEMPD; + matEMPD->MaterialBase::operator=(*mat); // deep copy parent object (explicitly call operator=) + + delete mat; + s_mat->materials(matNum) = matEMPD; // This should work, material name remains the same + + matEMPD->hasEMPD = true; + // Once the material derived type number is found then load the additional moisture material properties - material->EMPDmu = MaterialProps(1); - material->MoistACoeff = MaterialProps(2); - material->MoistBCoeff = MaterialProps(3); - material->MoistCCoeff = MaterialProps(4); - material->MoistDCoeff = MaterialProps(5); - if (state.dataIPShortCut->lNumericFieldBlanks(6) || MaterialProps(6) == Constant::AutoCalculate) { - material->EMPDSurfaceDepth = CalcDepthFromPeriod(state, 24 * 3600, material); // 1 day + matEMPD->mu = MaterialProps(1); + matEMPD->moistACoeff = MaterialProps(2); + matEMPD->moistBCoeff = MaterialProps(3); + matEMPD->moistCCoeff = MaterialProps(4); + matEMPD->moistDCoeff = MaterialProps(5); + if (s_ipsc->lNumericFieldBlanks(6) || MaterialProps(6) == Constant::AutoCalculate) { + matEMPD->surfaceDepth = matEMPD->calcDepthFromPeriod(state, 24 * 3600); // 1 day } else { - material->EMPDSurfaceDepth = MaterialProps(6); + matEMPD->surfaceDepth = MaterialProps(6); } - if (state.dataIPShortCut->lNumericFieldBlanks(7) || MaterialProps(7) == Constant::AutoCalculate) { - material->EMPDDeepDepth = CalcDepthFromPeriod(state, 21 * 24 * 3600, material); // 3 weeks + if (s_ipsc->lNumericFieldBlanks(7) || MaterialProps(7) == Constant::AutoCalculate) { + matEMPD->deepDepth = matEMPD->calcDepthFromPeriod(state, 21 * 24 * 3600); // 3 weeks } else { - material->EMPDDeepDepth = MaterialProps(7); + matEMPD->deepDepth = MaterialProps(7); } - material->EMPDCoatingThickness = MaterialProps(8); - material->EMPDmuCoating = MaterialProps(9); + matEMPD->coatingThickness = MaterialProps(8); + matEMPD->muCoating = MaterialProps(9); - if (material->EMPDDeepDepth <= material->EMPDSurfaceDepth && material->EMPDDeepDepth != 0.0) { - ShowWarningError(state, format("{}: material=\"{}\"", cCurrentModuleObject, material->Name)); + if (matEMPD->deepDepth <= matEMPD->surfaceDepth && matEMPD->deepDepth != 0.0) { + ShowWarningError(state, format("{}: material=\"{}\"", s_ipsc->cCurrentModuleObject, matEMPD->Name)); ShowContinueError(state, "Deep-layer penetration depth should be zero or greater than the surface-layer penetration depth."); } } // Ensure at least one interior EMPD surface for each zone EMPDzone.dimension(state.dataGlobal->NumOfZones, false); - for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (!state.dataSurface->Surface(SurfNum).HeatTransSurf || state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::Window) - continue; // Heat transfer surface only and not a window - if (state.dataSurface->Surface(SurfNum).HeatTransferAlgorithm != DataSurfaces::HeatTransferModel::EMPD) continue; - ConstrNum = state.dataSurface->Surface(SurfNum).Construction; - auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); - MatNum = thisConstruct.LayerPoint(state.dataConstruction->Construct(ConstrNum).TotLayers); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(MatNum)); - assert(thisMaterial != nullptr); - if (thisMaterial->EMPDmu > 0.0 && state.dataSurface->Surface(SurfNum).Zone > 0) { - EMPDzone(state.dataSurface->Surface(SurfNum).Zone) = true; + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + auto const &surf = state.dataSurface->Surface(SurfNum); + if (!surf.HeatTransSurf || surf.Class == DataSurfaces::SurfaceClass::Window) continue; // Heat transfer surface only and not a window + if (surf.HeatTransferAlgorithm != DataSurfaces::HeatTransferModel::EMPD) continue; + + auto const &constr = state.dataConstruction->Construct(surf.Construction); + auto const *mat = dynamic_cast(s_mat->materials(constr.LayerPoint(constr.TotLayers))); + assert(mat != nullptr); + + if (mat->mu > 0.0 && surf.Zone > 0) { + EMPDzone(surf.Zone) = true; } else { ++state.dataMoistureBalEMPD->ErrCount; if (state.dataMoistureBalEMPD->ErrCount == 1 && !state.dataGlobal->DisplayExtraWarnings) { @@ -283,41 +261,39 @@ void GetMoistureBalanceEMPDInput(EnergyPlusData &state) } if (state.dataGlobal->DisplayExtraWarnings) { ShowMessage(state, - format("GetMoistureBalanceEMPDInput: EMPD properties are not assigned to the inside layer in Surface={}", - state.dataSurface->Surface(SurfNum).Name)); - ShowContinueError(state, format("with Construction={}", thisConstruct.Name)); + format("GetMoistureBalanceEMPDInput: EMPD properties are not assigned to the inside layer in Surface={}", surf.Name)); + ShowContinueError(state, format("with Construction={}", constr.Name)); } } - if (thisConstruct.TotLayers == 1) { // One layer construction + + if (constr.TotLayers == 1) continue; // One layer construction + + // Multiple layer construction + auto const *mat1 = s_mat->materials(constr.LayerPoint(1)); + if (mat1->hasEMPD && surf.ExtBoundCond <= 0) { // The external layer is not exposed to zone + ShowSevereError(state, format("{}: EMPD properties are assigned to the outside layer in Construction = {}", routineName, constr.Name)); + ShowContinueError(state, format("..Outside layer material with EMPD properties = {}", mat1->Name)); + ShowContinueError(state, "..A material with EMPD properties must be assigned to the inside layer of a construction."); + ErrorsFound = true; continue; - } else { // Multiple layer construction - if (dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(1)))->EMPDMaterialProps && - state.dataSurface->Surface(SurfNum).ExtBoundCond <= 0) { // The external layer is not exposed to zone - ShowSevereError( - state, "GetMoistureBalanceEMPDInput: EMPD properties are assigned to the outside layer in Construction=" + thisConstruct.Name); - ShowContinueError( - state, "..Outside layer material with EMPD properties = " + state.dataMaterial->Material(thisConstruct.LayerPoint(1))->Name); + } + + for (int Layer = 2; Layer <= constr.TotLayers - 1; ++Layer) { + auto const *matL = s_mat->materials(constr.LayerPoint(Layer)); + if (matL->hasEMPD) { + ShowSevereError(state, format("{}: EMPD properties are assigned to a middle layer in Construction = {}", routineName, constr.Name)); + ShowContinueError(state, format("..Middle layer material with EMPD properties = {}", matL->Name)); ShowContinueError(state, "..A material with EMPD properties must be assigned to the inside layer of a construction."); ErrorsFound = true; } - for (Layer = 2; Layer <= thisConstruct.TotLayers - 1; ++Layer) { - if (dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(Layer)))->EMPDMaterialProps) { - ShowSevereError( - state, "GetMoistureBalanceEMPDInput: EMPD properties are assigned to a middle layer in Construction=" + thisConstruct.Name); - ShowContinueError(state, - "..Middle layer material with EMPD properties = " + - state.dataMaterial->Material(thisConstruct.LayerPoint(Layer))->Name); - ShowContinueError(state, "..A material with EMPD properties must be assigned to the inside layer of a construction."); - ErrorsFound = true; - } - } } } - for (Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) { + for (int Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) { if (!EMPDzone(Loop)) { ShowSevereError(state, - format("GetMoistureBalanceEMPDInput: None of the constructions for zone = {} has an inside layer with EMPD properties", + format("{}: None of the constructions for zone = {} has an inside layer with EMPD properties", + routineName, state.dataHeatBal->Zone(Loop).Name)); ShowContinueError(state, "..For each zone, the inside layer of at least one construction must have EMPD properties"); ErrorsFound = true; @@ -485,11 +461,9 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, using Psychrometrics::PsyRhovFnTdbWPb_fast; using Psychrometrics::PsyWFnTdbRhPb; - static constexpr std::string_view RoutineName("CalcMoistureEMPD"); + static constexpr std::string_view routineName = "CalcMoistureEMPD"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int MatNum; // Material number at interior layer - int ConstrNum; // Construction number Real64 hm_deep_layer; // Overall deep-layer transfer coefficient Real64 RSurfaceLayer; // Mass transfer resistance between actual surface and surface layer node Real64 Taver; // Average zone temperature between current time and previous time @@ -509,6 +483,8 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, Real64 RH_surf_layer_tmp; Real64 RH_deep_layer; + auto &s_mat = state.dataMaterial; + if (state.dataGlobal->BeginEnvrnFlag && state.dataMoistureBalEMPD->OneTimeFlag) { InitMoistureBalanceEMPD(state); state.dataMoistureBalEMPD->OneTimeFlag = false; @@ -542,13 +518,11 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, if (!surface.HeatTransSurf) { return; } - ConstrNum = surface.Construction; - MatNum = state.dataConstruction->Construct(ConstrNum).LayerPoint( - state.dataConstruction->Construct(ConstrNum).TotLayers); // Then find the material pointer - auto const *material(dynamic_cast(state.dataMaterial->Material(MatNum))); - assert(material != nullptr); - if (material->EMPDmu <= 0.0) { + auto const &constr = state.dataConstruction->Construct(surface.Construction); + auto const *mat = dynamic_cast(s_mat->materials(constr.LayerPoint(constr.TotLayers))); + assert(mat != nullptr); + if (mat->mu <= 0.0) { rv_surface = PsyRhovFnTdbWPb(TempZone, state.dataZoneTempPredictorCorrector->zoneHeatBalance(surface.Zone).airHumRat, state.dataEnvrn->OutBaroPress); return; @@ -560,7 +534,7 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, RHaver = RVaver * 461.52 * (Taver + Constant::Kelvin) * std::exp(-23.7093 + 4111.0 / (Taver + 237.7)); // Calculate the saturated vapor pressure, surface vapor pressure and dewpoint. Used to check for condensation in HeatBalanceSurfaceManager - PVsat = PsyPsatFnTemp(state, Taver, RoutineName); + PVsat = PsyPsatFnTemp(state, Taver, routineName); PVsurf = RHaver * std::exp(23.7093 - 4111.0 / (Taver + 237.7)); TempSat = 4111.0 / (23.7093 - std::log(PVsurf)) + 35.45 - Constant::Kelvin; @@ -568,12 +542,11 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, // 2e-7*T^0.81/P = vapor diffusivity in air. [kg/m-s-Pa] // 461.52 = universal gas constant for water [J/kg-K] // EMPDdiffusivity = [m^2/s] - EMPDdiffusivity = - (2.0e-7 * pow(Taver + Constant::Kelvin, 0.81) / state.dataEnvrn->OutBaroPress) / material->EMPDmu * 461.52 * (Taver + Constant::Kelvin); + EMPDdiffusivity = (2.0e-7 * pow(Taver + Constant::Kelvin, 0.81) / state.dataEnvrn->OutBaroPress) / mat->mu * 461.52 * (Taver + Constant::Kelvin); // Calculate slope of moisture sorption curve at current RH. [kg/kg-RH] - dU_dRH = material->MoistACoeff * material->MoistBCoeff * pow(RHaver, material->MoistBCoeff - 1) + - material->MoistCCoeff * material->MoistDCoeff * pow(RHaver, material->MoistDCoeff - 1); + dU_dRH = mat->moistACoeff * mat->moistBCoeff * pow(RHaver, mat->moistBCoeff - 1) + + mat->moistCCoeff * mat->moistDCoeff * pow(RHaver, mat->moistDCoeff - 1); // Convert vapor density and temperature of zone air to RH RHZone = rho_vapor_air_in * 461.52 * (TempZone + Constant::Kelvin) * std::exp(-23.7093 + 4111.0 / ((TempZone + Constant::Kelvin) - 35.45)); @@ -584,21 +557,21 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, // If coating vapor resistance factor equals 0, coating resistance is zero (avoid divide by zero). // Otherwise, calculate coating resistance with coating vapor resistance factor and thickness. [s/m] - if (material->EMPDmuCoating <= 0.0) { + if (mat->muCoating <= 0.0) { Rcoating = 0; } else { - Rcoating = material->EMPDCoatingThickness * material->EMPDmuCoating * state.dataEnvrn->OutBaroPress / + Rcoating = mat->coatingThickness * mat->muCoating * state.dataEnvrn->OutBaroPress / (2.0e-7 * pow(Taver + Constant::Kelvin, 0.81) * 461.52 * (Taver + Constant::Kelvin)); } // Calculate mass-transfer coefficient between zone air and center of surface layer. [m/s] - hm_surf_layer = 1.0 / (0.5 * material->EMPDSurfaceDepth / EMPDdiffusivity + 1.0 / h_mass_conv_in_fd + Rcoating); + hm_surf_layer = 1.0 / (0.5 * mat->surfaceDepth / EMPDdiffusivity + 1.0 / h_mass_conv_in_fd + Rcoating); // Calculate mass-transfer coefficient between center of surface layer and center of deep layer. [m/s] // If deep layer depth = 0, set mass-transfer coefficient to zero (simulates with no deep layer). - if (material->EMPDDeepDepth <= 0.0) { + if (mat->deepDepth <= 0.0) { hm_deep_layer = 0; } else { - hm_deep_layer = 2.0 * EMPDdiffusivity / (material->EMPDDeepDepth + material->EMPDSurfaceDepth); + hm_deep_layer = 2.0 * EMPDdiffusivity / (mat->deepDepth + mat->surfaceDepth); } // Calculate resistance between surface-layer/air interface and center of surface layer. [s/m] // This is the physical surface of the material. @@ -606,14 +579,13 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, // Calculate vapor flux leaving surface layer, entering deep layer, and entering zone. mass_flux_surf_deep_max = - material->EMPDDeepDepth * material->Density * dU_dRH * (RH_surf_layer_old - RH_deep_layer_old) / (state.dataGlobal->TimeStepZone * 3600.0); + mat->deepDepth * mat->Density * dU_dRH * (RH_surf_layer_old - RH_deep_layer_old) / (state.dataGlobal->TimeStepZone * 3600.0); mass_flux_surf_deep = hm_deep_layer * (rv_surf_layer_old - rv_deep_old); if (std::abs(mass_flux_surf_deep_max) < std::abs(mass_flux_surf_deep)) { mass_flux_surf_deep = mass_flux_surf_deep_max; } - mass_flux_zone_surf_max = - material->EMPDSurfaceDepth * material->Density * dU_dRH * (RHZone - RH_surf_layer_old) / (state.dataGlobal->TimeStepZone * 3600.0); + mass_flux_zone_surf_max = mat->surfaceDepth * mat->Density * dU_dRH * (RHZone - RH_surf_layer_old) / (state.dataGlobal->TimeStepZone * 3600.0); mass_flux_zone_surf = hm_surf_layer * (rho_vapor_air_in - rv_surf_layer_old); if (std::abs(mass_flux_zone_surf_max) < std::abs(mass_flux_zone_surf)) { mass_flux_zone_surf = mass_flux_zone_surf_max; @@ -628,8 +600,8 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, mass_flux_zone = hm_surf_layer * (rv_surf_layer_old - rho_vapor_air_in); // Calculate new surface layer RH using mass balance on surface layer - RH_surf_layer_tmp = RH_surf_layer_old + - state.dataGlobal->TimeStepZone * 3600.0 * (-mass_flux_surf_layer / (material->Density * material->EMPDSurfaceDepth * dU_dRH)); + RH_surf_layer_tmp = + RH_surf_layer_old + state.dataGlobal->TimeStepZone * 3600.0 * (-mass_flux_surf_layer / (mat->Density * mat->surfaceDepth * dU_dRH)); // RH_surf_layer = RH_surf_layer_tmp; @@ -674,11 +646,10 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, } // Calculate new deep layer RH using mass balance on deep layer (unless depth <= 0). - if (material->EMPDDeepDepth <= 0.0) { + if (mat->deepDepth <= 0.0) { RH_deep_layer = RH_deep_layer_old; } else { - RH_deep_layer = RH_deep_layer_old + - state.dataGlobal->TimeStepZone * 3600.0 * mass_flux_deep_layer / (material->Density * material->EMPDDeepDepth * dU_dRH); + RH_deep_layer = RH_deep_layer_old + state.dataGlobal->TimeStepZone * 3600.0 * mass_flux_deep_layer / (mat->Density * mat->deepDepth * dU_dRH); } // Convert calculated RH back to vapor density of surface and deep layers. rv_surf_layer = PsyRhovFnTdbRh(state, Taver, RH_surf_layer); @@ -706,10 +677,8 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, rvd.w_deep_layer = 0.622 * PV_deep_layer / (state.dataEnvrn->OutBaroPress - PV_deep_layer); rvd.mass_flux_zone = mass_flux_zone; rvd.mass_flux_deep = mass_flux_deep_layer; - rvd.u_surface_layer = - material->MoistACoeff * pow(RH_surf_layer, material->MoistBCoeff) + material->MoistCCoeff * pow(RH_surf_layer, material->MoistDCoeff); - rvd.u_deep_layer = - material->MoistACoeff * pow(RH_deep_layer, material->MoistBCoeff) + material->MoistCCoeff * pow(RH_deep_layer, material->MoistDCoeff); + rvd.u_surface_layer = mat->moistACoeff * pow(RH_surf_layer, mat->moistBCoeff) + mat->moistCCoeff * pow(RH_surf_layer, mat->moistDCoeff); + rvd.u_deep_layer = mat->moistACoeff * pow(RH_deep_layer, mat->moistBCoeff) + mat->moistCCoeff * pow(RH_deep_layer, mat->moistDCoeff); } void UpdateMoistureBalanceEMPD(EnergyPlusData &state, int const SurfNum) // Surface number @@ -748,8 +717,7 @@ void ReportMoistureBalanceEMPD(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool DoReport; - int ConstrNum; - int MatNum; + auto &s_mat = state.dataMaterial; ScanForReports(state, "Constructions", DoReport, "Constructions"); @@ -761,29 +729,32 @@ void ReportMoistureBalanceEMPD(EnergyPlusData &state) "c, d, Surface Penetration Depth {m}, Deep Penetration Depth {m}, Coating Vapor Resistance Factor, " "Coating Thickness {m}\n"); - for (ConstrNum = 1; ConstrNum <= state.dataHeatBal->TotConstructs; ++ConstrNum) { - if (state.dataConstruction->Construct(ConstrNum).TypeIsWindow) continue; - MatNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataConstruction->Construct(ConstrNum).TotLayers); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(MatNum)); - assert(thisMaterial != nullptr); - if (thisMaterial->EMPDMaterialProps) { - static constexpr std::string_view 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, - state.dataConstruction->Construct(ConstrNum).Name, - thisMaterial->Name, - thisMaterial->EMPDmu, - thisMaterial->MoistACoeff, - thisMaterial->MoistBCoeff, - thisMaterial->MoistCCoeff, - thisMaterial->MoistDCoeff, - thisMaterial->EMPDSurfaceDepth, - thisMaterial->EMPDDeepDepth, - thisMaterial->EMPDmuCoating, - thisMaterial->EMPDCoatingThickness); - } + for (int ConstrNum = 1; ConstrNum <= state.dataHeatBal->TotConstructs; ++ConstrNum) { + auto const &constr = state.dataConstruction->Construct(ConstrNum); + if (constr.TypeIsWindow) continue; + + auto const *mat = s_mat->materials(constr.LayerPoint(constr.TotLayers)); + if (!mat->hasEMPD) continue; + + auto const *matEMPD = dynamic_cast(mat); + assert(matEMPD != nullptr); + + static constexpr std::string_view 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, + constr.Name, + matEMPD->Name, + matEMPD->mu, + matEMPD->moistACoeff, + matEMPD->moistBCoeff, + matEMPD->moistCCoeff, + matEMPD->moistDCoeff, + matEMPD->surfaceDepth, + matEMPD->deepDepth, + matEMPD->muCoating, + matEMPD->coatingThickness); } -} +} // ReportMoistureBalanceEMPD() } // namespace EnergyPlus::MoistureBalanceEMPDManager diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.hh b/src/EnergyPlus/MoistureBalanceEMPDManager.hh index 57999a5d2d4..ba1b728b9d4 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.hh +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.hh @@ -64,6 +64,28 @@ struct EnergyPlusData; namespace MoistureBalanceEMPDManager { + struct MaterialEMPD : public Material::MaterialBase + { + // EMPD + Real64 mu = 0.0; // Water Vapor Diffusion Resistance Factor (dimensionless) + Real64 moistACoeff = 0.0; // Moisture Equation Coefficient a + Real64 moistBCoeff = 0.0; // Moisture Equation Coefficient b + Real64 moistCCoeff = 0.0; // Moisture Equation Coefficient c + Real64 moistDCoeff = 0.0; // Moisture Equation Coefficient d + Real64 surfaceDepth = 0.0; // Surface-layer penetration depth (m) + Real64 deepDepth = 0.0; // Deep-layer penetration depth (m) + Real64 coatingThickness = 0.0; // Coating Layer Thickness (m) + Real64 muCoating = 0.0; // Coating Layer water vapor diffusion resistance factor (dimensionless) + + MaterialEMPD() : MaterialBase() + { + group = Material::Group::Regular; + } // Change this to group EMPD? + ~MaterialEMPD() = default; + + Real64 calcDepthFromPeriod(EnergyPlusData &state, Real64 period); // in seconds + }; + struct EMPDReportVarsData { Real64 rv_surface; @@ -84,12 +106,6 @@ namespace MoistureBalanceEMPDManager { } }; - // Functions - Real64 CalcDepthFromPeriod(EnergyPlusData &state, - Real64 period, // in seconds - Material::MaterialBase const *mat // material - ); - void GetMoistureBalanceEMPDInput(EnergyPlusData &state); void InitMoistureBalanceEMPD(EnergyPlusData &state); diff --git a/src/EnergyPlus/OutputProcessor.cc b/src/EnergyPlus/OutputProcessor.cc index da1bc6c090a..926a1d947b1 100644 --- a/src/EnergyPlus/OutputProcessor.cc +++ b/src/EnergyPlus/OutputProcessor.cc @@ -3058,7 +3058,7 @@ void SetupOutputVariable(EnergyPlusData &state, OutputProcessor::TimeStepType timeStepType, // Zone, HeatBalance=1, HVAC, System, Plant=2 OutputProcessor::StoreType storeType, // State, Average=1, NonState, Sum=2 std::string const &key, // Associated Key for this variable - int const indexGroupKey, // Group identifier for SQL output + [[maybe_unused]] int const indexGroupKey, // Group identifier for SQL output OutputProcessor::ReportFreq freq // Internal use -- causes reporting at this freqency ) { diff --git a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc index 10d8cd3072f..222beab8b28 100644 --- a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc +++ b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc @@ -57,26 +57,9 @@ namespace EnergyPlus { -namespace HysteresisPhaseChange { +namespace Material { - HysteresisPhaseChange *HysteresisPhaseChange::factory(EnergyPlusData &state, const std::string &objectName) - { - if (state.dataHysteresisPhaseChange->getHysteresisModels) { - readAllHysteresisModels(state); - state.dataHysteresisPhaseChange->getHysteresisModels = false; - } - for (auto &hm : state.dataHysteresisPhaseChange->hysteresisPhaseChangeModels) { - if (hm.name == objectName) { - return &hm; - } - } - // because of the passive linking between materials and material property objects, - // we don't know ahead of time for sure whether we will have a material property - // so we can't return fatal here if it isn't found, just leave it null - return nullptr; - } - - Real64 HysteresisPhaseChange::getEnthalpy(Real64 T, Real64 Tc, Real64 tau1, Real64 tau2) + Real64 MaterialPhaseChange::getEnthalpy(Real64 T, Real64 Tc, Real64 tau1, Real64 tau2) const { // Looks up the enthalpy on the characteristic curve defined by the parameters Tc, tau1, and tau2, // and the position on that curve defined by T. @@ -89,8 +72,8 @@ namespace HysteresisPhaseChange { } } - Real64 HysteresisPhaseChange::getCurrentSpecificHeat( - Real64 prevTempTD, Real64 updatedTempTDT, Real64 phaseChangeTempReverse, int prevPhaseChangeState, int &phaseChangeState) + Real64 MaterialPhaseChange::getCurrentSpecificHeat( + Real64 prevTempTD, Real64 updatedTempTDT, Real64 phaseChangeTempReverse, Phase prevPhaseChangeState, Phase &phaseChangeState) { // Main public facing function; returns the current specific heat based on input properties, and current and previous conditions. // In a future version, this could be compartmentalized to track all states and histories, but it would require some further modification to @@ -111,40 +94,41 @@ namespace HysteresisPhaseChange { Tau1 = this->deltaTempMeltingLow; Tau2 = this->deltaTempMeltingHigh; if (updatedTempTDT < TempLowPCM) { - phaseChangeState = PhaseChangeStates::CRYSTALLIZED; + phaseChangeState = Phase::Crystallized; } else if (updatedTempTDT >= TempLowPCM && updatedTempTDT <= TempHighPCM) { - phaseChangeState = PhaseChangeStates::MELTING; - if (prevPhaseChangeState == PhaseChangeStates::FREEZING || prevPhaseChangeState == PhaseChangeStates::TRANSITION) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Melting; + if (prevPhaseChangeState == Phase::Freezing || prevPhaseChangeState == Phase::Transition) { + phaseChangeState = Phase::Transition; } } else if (updatedTempTDT > TempHighPCM) { - phaseChangeState = PhaseChangeStates::LIQUID; + phaseChangeState = Phase::Liquid; } } else { // phaseChangeDeltaT > 0 Tc = this->peakTempFreezing; Tau1 = this->deltaTempFreezingLow; Tau2 = this->deltaTempFreezingHigh; if (updatedTempTDT < TempLowPCF) { - phaseChangeState = PhaseChangeStates::CRYSTALLIZED; + phaseChangeState = Phase::Crystallized; } else if (updatedTempTDT >= TempLowPCF && updatedTempTDT <= TempHighPCF) { - phaseChangeState = PhaseChangeStates::FREEZING; - if (prevPhaseChangeState == PhaseChangeStates::MELTING || prevPhaseChangeState == PhaseChangeStates::TRANSITION) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Freezing; + if (prevPhaseChangeState == Phase::Melting || prevPhaseChangeState == Phase::Transition) { + phaseChangeState = Phase::Transition; } } else if (updatedTempTDT > TempHighPCF) { - phaseChangeState = PhaseChangeStates::LIQUID; + phaseChangeState = Phase::Liquid; } } + // Why is phaseChangeTransition a state variable of the material and not the surface? // determine if we are transitioning or not - if (prevPhaseChangeState == PhaseChangeStates::TRANSITION && phaseChangeState == PhaseChangeStates::CRYSTALLIZED) { + if (prevPhaseChangeState == Phase::Transition && phaseChangeState == Phase::Crystallized) { this->phaseChangeTransition = true; - } else if (prevPhaseChangeState == PhaseChangeStates::TRANSITION && phaseChangeState == PhaseChangeStates::FREEZING) { + } else if (prevPhaseChangeState == Phase::Transition && phaseChangeState == Phase::Freezing) { this->phaseChangeTransition = true; // this->phaseChangeState = 0; ????? - } else if (prevPhaseChangeState == PhaseChangeStates::FREEZING && phaseChangeState == PhaseChangeStates::TRANSITION) { + } else if (prevPhaseChangeState == Phase::Freezing && phaseChangeState == Phase::Transition) { this->phaseChangeTransition = true; - } else if (prevPhaseChangeState == PhaseChangeStates::CRYSTALLIZED && phaseChangeState == PhaseChangeStates::TRANSITION) { + } else if (prevPhaseChangeState == Phase::Crystallized && phaseChangeState == Phase::Transition) { this->phaseChangeTransition = true; } else { this->phaseChangeTransition = false; @@ -155,29 +139,29 @@ namespace HysteresisPhaseChange { this->enthOld = this->getEnthalpy(prevTempTD, Tc, Tau1, Tau2); this->enthNew = this->getEnthalpy(updatedTempTDT, Tc, Tau1, Tau2); } else { - if (prevPhaseChangeState == PhaseChangeStates::FREEZING && phaseChangeState == PhaseChangeStates::TRANSITION) { + if (prevPhaseChangeState == Phase::Freezing && phaseChangeState == Phase::Transition) { this->enthRev = this->getEnthalpy(phaseChangeTempReverse, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); if (this->enthNew < this->enthRev && this->enthNew >= this->enthalpyF && updatedTempTDT <= prevTempTD) { - phaseChangeState = PhaseChangeStates::FREEZING; + phaseChangeState = Phase::Freezing; this->enthNew = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); } else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM)) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Transition; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); } else if ((this->enthNew < this->enthalpyF) && (updatedTempTDT > phaseChangeTempReverse)) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Transition; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); } else if ((this->enthNew <= this->enthalpyM) && (updatedTempTDT <= phaseChangeTempReverse)) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Transition; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); } - } else if (prevPhaseChangeState == PhaseChangeStates::TRANSITION && phaseChangeState == PhaseChangeStates::TRANSITION) { + } else if (prevPhaseChangeState == Phase::Transition && phaseChangeState == Phase::Transition) { if (updatedTempTDT < phaseChangeTempReverse) { Tc = this->peakTempMelting; Tau1 = this->deltaTempMeltingLow; @@ -192,50 +176,50 @@ namespace HysteresisPhaseChange { this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); if ((updatedTempTDT < phaseChangeTempReverse) && (this->enthNew > this->enthalpyF)) { - phaseChangeState = PhaseChangeStates::FREEZING; + phaseChangeState = Phase::Freezing; this->enthNew = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); } else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM) && (updatedTempTDT < prevTempTD || updatedTempTDT > prevTempTD)) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Transition; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); } else if (this->enthNew <= this->enthalpyM && updatedTempTDT >= prevTempTD && this->enthNew > this->enthOld) { - phaseChangeState = PhaseChangeStates::MELTING; + phaseChangeState = Phase::Melting; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); } - } else if (prevPhaseChangeState == PhaseChangeStates::TRANSITION && phaseChangeState == PhaseChangeStates::CRYSTALLIZED) { + } else if (prevPhaseChangeState == Phase::Transition && phaseChangeState == Phase::Crystallized) { this->enthRev = this->getEnthalpy(phaseChangeTempReverse, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM)) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Transition; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); } else if (this->enthNew <= this->enthalpyM && updatedTempTDT >= prevTempTD) { - phaseChangeState = PhaseChangeStates::MELTING; + phaseChangeState = Phase::Melting; this->enthNew = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); } - } else if (prevPhaseChangeState == PhaseChangeStates::MELTING && phaseChangeState == PhaseChangeStates::TRANSITION) { + } else if (prevPhaseChangeState == Phase::Melting && phaseChangeState == Phase::Transition) { this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); if ((this->enthNew < this->enthOld) && (updatedTempTDT < prevTempTD)) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Transition; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); } else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM) && (updatedTempTDT < prevTempTD)) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Transition; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); } else if ((this->enthNew >= this->enthalpyF) && (updatedTempTDT <= phaseChangeTempReverse)) { - phaseChangeState = PhaseChangeStates::TRANSITION; + phaseChangeState = Phase::Transition; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); } - } else if (prevPhaseChangeState == PhaseChangeStates::TRANSITION && phaseChangeState == PhaseChangeStates::FREEZING) { + } else if (prevPhaseChangeState == Phase::Transition && phaseChangeState == Phase::Freezing) { this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); this->enthRev = @@ -258,13 +242,13 @@ namespace HysteresisPhaseChange { return Cp; } - Real64 HysteresisPhaseChange::specHeat(Real64 temperaturePrev, - Real64 temperatureCurrent, - Real64 criticalTemperature, - Real64 tau1, - Real64 tau2, - Real64 EnthalpyOld, - Real64 EnthalpyNew) + Real64 MaterialPhaseChange::specHeat(Real64 temperaturePrev, + Real64 temperatureCurrent, + Real64 criticalTemperature, + Real64 tau1, + Real64 tau2, + Real64 EnthalpyOld, + Real64 EnthalpyNew) const { // Tc ! Critical (Melting/Freezing) Temperature of PCM @@ -292,7 +276,7 @@ namespace HysteresisPhaseChange { } } - Real64 HysteresisPhaseChange::getConductivity(Real64 T) + Real64 MaterialPhaseChange::getConductivity(Real64 T) const { if (T < this->peakTempMelting) { return this->fullySolidThermalConductivity; @@ -303,7 +287,7 @@ namespace HysteresisPhaseChange { } } - Real64 HysteresisPhaseChange::getDensity(Real64 T) + Real64 MaterialPhaseChange::getDensity(Real64 T) const { if (T < this->peakTempMelting) { return this->fullySolidDensity; @@ -314,16 +298,20 @@ namespace HysteresisPhaseChange { } } - void readAllHysteresisModels(EnergyPlusData &state) + void GetHysteresisData(EnergyPlusData &state, bool &ErrorsFound) { + static constexpr std::string_view routineName = "GetHysteresisData"; + + auto &s_ipsc = state.dataIPShortCut; + auto &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_mat = state.dataMaterial; // convenience variables - state.dataIPShortCut->cCurrentModuleObject = "MaterialProperty:PhaseChangeHysteresis"; - state.dataHysteresisPhaseChange->numHysteresisModels = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "MaterialProperty:PhaseChangeHysteresis"; + int numPhaseChangeModels = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); // loop over all hysteresis input instances, if zero, this will simply not do anything - for (int hmNum = 1; hmNum <= state.dataHysteresisPhaseChange->numHysteresisModels; ++hmNum) { + for (int hmNum = 1; hmNum <= numPhaseChangeModels; ++hmNum) { // just a few vars to pass in and out to GetObjectItem int ioStatus; @@ -331,57 +319,90 @@ namespace HysteresisPhaseChange { int numNumbers; // get the input data and store it in the Shortcuts structures - state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, - hmNum, - state.dataIPShortCut->cAlphaArgs, - numAlphas, - state.dataIPShortCut->rNumericArgs, - numNumbers, - ioStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + hmNum, + s_ipsc->cAlphaArgs, + numAlphas, + s_ipsc->rNumericArgs, + numNumbers, + ioStatus, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; // the input processor validates the numeric inputs based on the IDD definition // still validate the name to make sure there aren't any duplicates or blanks // blanks are easy: fatal if blank - if (state.dataIPShortCut->lAlphaFieldBlanks[0]) { - ShowFatalError(state, "Invalid input for " + state.dataIPShortCut->cCurrentModuleObject + " object: Name cannot be blank"); + + if (s_ipsc->lAlphaFieldBlanks(1)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1)); + ErrorsFound = true; + continue; } - // we just need to loop over the existing vector elements to check for duplicates since we haven't add this one yet - for (auto &existingHysteresisModel : state.dataHysteresisPhaseChange->hysteresisPhaseChangeModels) { - if (state.dataIPShortCut->cAlphaArgs(1) == existingHysteresisModel.name) { - ShowFatalError(state, - "Invalid input for " + state.dataIPShortCut->cCurrentModuleObject + - " object: Duplicate name found: " + existingHysteresisModel.name); - } + int matNum = GetMaterialNum(state, s_ipsc->cAlphaArgs(1)); + if (matNum == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1)); + ErrorsFound = true; + continue; } + auto *mat = s_mat->materials(matNum); + if (mat->group != Group::Regular) { + ShowSevereCustomMessage(state, eoh, format("Material {} is not a Regular material.", mat->Name)); + ErrorsFound = true; + continue; + } + + if (mat->hasPCM) { + ShowSevereCustomMessage( + state, eoh, format("Material {} already has {} properties defined.", mat->Name, s_ipsc->cCurrentModuleObject)); + ErrorsFound = true; + continue; + } + + if (mat->hasEMPD) { + ShowSevereCustomMessage(state, eoh, format("Material {} already has EMPD properties defined.", mat->Name)); + ErrorsFound = true; + continue; + } + + if (mat->hasHAMT) { + ShowSevereCustomMessage(state, eoh, format("Material {} already has HAMT properties defined.", mat->Name)); + ErrorsFound = true; + continue; + } + + // Need to upgrade this object to MaterialPhaseChange + auto *matPC = new MaterialPhaseChange; + matPC->MaterialBase::operator=(*mat); // Deep copy the parent object + + delete mat; + s_mat->materials(matNum) = matPC; + // now build out a new hysteresis instance and add it to the vector - HysteresisPhaseChange thisHM; - thisHM.name = state.dataIPShortCut->cAlphaArgs(1); - thisHM.totalLatentHeat = state.dataIPShortCut->rNumericArgs(1); - thisHM.fullyLiquidThermalConductivity = state.dataIPShortCut->rNumericArgs(2); - thisHM.fullyLiquidDensity = state.dataIPShortCut->rNumericArgs(3); - thisHM.specificHeatLiquid = state.dataIPShortCut->rNumericArgs(4); - thisHM.deltaTempMeltingHigh = state.dataIPShortCut->rNumericArgs(5); - thisHM.peakTempMelting = state.dataIPShortCut->rNumericArgs(6); - thisHM.deltaTempMeltingLow = state.dataIPShortCut->rNumericArgs(7); - thisHM.fullySolidThermalConductivity = state.dataIPShortCut->rNumericArgs(8); - thisHM.fullySolidDensity = state.dataIPShortCut->rNumericArgs(9); - thisHM.specificHeatSolid = state.dataIPShortCut->rNumericArgs(10); - thisHM.deltaTempFreezingHigh = state.dataIPShortCut->rNumericArgs(11); - thisHM.peakTempFreezing = state.dataIPShortCut->rNumericArgs(12); - thisHM.deltaTempFreezingLow = state.dataIPShortCut->rNumericArgs(13); - thisHM.specHeatTransition = (thisHM.specificHeatSolid + thisHM.specificHeatLiquid) / 2.0; - thisHM.CpOld = thisHM.specificHeatSolid; - state.dataHysteresisPhaseChange->hysteresisPhaseChangeModels.push_back(thisHM); + matPC->totalLatentHeat = s_ipsc->rNumericArgs(1); + matPC->fullyLiquidThermalConductivity = s_ipsc->rNumericArgs(2); + matPC->fullyLiquidDensity = s_ipsc->rNumericArgs(3); + matPC->specificHeatLiquid = s_ipsc->rNumericArgs(4); + matPC->deltaTempMeltingHigh = s_ipsc->rNumericArgs(5); + matPC->peakTempMelting = s_ipsc->rNumericArgs(6); + matPC->deltaTempMeltingLow = s_ipsc->rNumericArgs(7); + matPC->fullySolidThermalConductivity = s_ipsc->rNumericArgs(8); + matPC->fullySolidDensity = s_ipsc->rNumericArgs(9); + matPC->specificHeatSolid = s_ipsc->rNumericArgs(10); + matPC->deltaTempFreezingHigh = s_ipsc->rNumericArgs(11); + matPC->peakTempFreezing = s_ipsc->rNumericArgs(12); + matPC->deltaTempFreezingLow = s_ipsc->rNumericArgs(13); + matPC->specHeatTransition = (matPC->specificHeatSolid + matPC->specificHeatLiquid) / 2.0; + matPC->CpOld = matPC->specificHeatSolid; + matPC->hasPCM = true; } } -} // namespace HysteresisPhaseChange +} // namespace Material } // namespace EnergyPlus diff --git a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.hh b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.hh index 5e110781d80..d0e87ddef26 100644 --- a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.hh +++ b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.hh @@ -53,28 +53,60 @@ #include #include +#include namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace HysteresisPhaseChange { +namespace Material { - struct PhaseChangeStates + enum class Phase { - // keeping these as ints to allow output variable reporting; could refine later into enum class - static const int LIQUID = -2; - static const int MELTING = -1; - static const int TRANSITION = 0; - static const int FREEZING = 1; - static const int CRYSTALLIZED = 2; + Invalid = -1, + Liquid, + Melting, + Transition, + Freezing, + Crystallized, + Num }; - class HysteresisPhaseChange + static constexpr std::array phaseInts = {-2, -1, 0, 1, 2}; + + struct MaterialPhaseChange : public MaterialBase { + // members are pretty much all accessed outside of the class in one way or another (by the static factory, etc.) + Real64 enthalpyM = 0.0; + Real64 enthalpyF = 0.0; + + // input parameters + Real64 totalLatentHeat = 0.0; + Real64 specificHeatLiquid = 0.0; + Real64 deltaTempMeltingHigh = 0.0; + Real64 peakTempMelting = 0.0; + Real64 deltaTempMeltingLow = 0.0; + Real64 specificHeatSolid = 0.0; + Real64 deltaTempFreezingHigh = 0.0; + Real64 peakTempFreezing = 0.0; + Real64 deltaTempFreezingLow = 0.0; + + // additional thermal propreties + Real64 fullySolidThermalConductivity = 0.0; + Real64 fullyLiquidThermalConductivity = 0.0; + Real64 fullySolidDensity = 0.0; + Real64 fullyLiquidDensity = 0.0; + + // history and state terms // Why are these here and not in surface? + bool phaseChangeTransition = false; + Real64 enthOld = 0.0; + Real64 enthNew = 0.0; + Real64 enthRev = 0.0; + Real64 CpOld = 0.0; + Real64 specHeatTransition = 0.0; - Real64 getEnthalpy(Real64 T, Real64 Tc, Real64 tau1, Real64 tau2); + Real64 getEnthalpy(Real64 T, Real64 Tc, Real64 tau1, Real64 tau2) const; Real64 specHeat(Real64 temperaturePrev, Real64 temperatureCurrent, @@ -82,68 +114,34 @@ namespace HysteresisPhaseChange { Real64 tau1, Real64 tau2, Real64 EnthalpyOld, - Real64 EnthalpyNew); - - public: - // members are pretty much all accessed outside of the class in one way or another (by the static factory, etc.) - std::string name; - Real64 enthalpyM; - Real64 enthalpyF; - - // input parameters - Real64 totalLatentHeat; - Real64 specificHeatLiquid; - Real64 deltaTempMeltingHigh; - Real64 peakTempMelting; - Real64 deltaTempMeltingLow; - Real64 specificHeatSolid; - Real64 deltaTempFreezingHigh; - Real64 peakTempFreezing; - Real64 deltaTempFreezingLow; - - // additional thermal propreties - Real64 fullySolidThermalConductivity; - Real64 fullyLiquidThermalConductivity; - Real64 fullySolidDensity; - Real64 fullyLiquidDensity; - - // history and state terms - bool phaseChangeTransition; - Real64 enthOld; - Real64 enthNew; - Real64 enthRev; - Real64 CpOld; - Real64 specHeatTransition; - - // the factory for this class - static HysteresisPhaseChange *factory(EnergyPlusData &state, const std::string &objectName); + Real64 EnthalpyNew) const; + // This function modifies some state variables that look like they should belong to surface rather than material // the Cp calculation function for this class Real64 getCurrentSpecificHeat( - Real64 prevTempTD, Real64 updatedTempTDT, Real64 phaseChangeTempReverse, int prevPhaseChangeState, int &phaseChangeState); + Real64 prevTempTD, Real64 updatedTempTDT, Real64 phaseChangeTempReverse, Phase prevPhaseChangeState, Phase &phaseChangeState); // the conductivity calculation function for this class - Real64 getConductivity(Real64 T); + Real64 getConductivity(Real64 T) const; // the density calculation function for this class - Real64 getDensity(Real64 T); + Real64 getDensity(Real64 T) const; - // and the destructor - virtual ~HysteresisPhaseChange() + MaterialPhaseChange() : MaterialBase() { + group = Material::Group::Regular; } + ~MaterialPhaseChange() = default; }; - void readAllHysteresisModels(EnergyPlusData &state); + void GetHysteresisData(EnergyPlusData &state, bool &ErrorsFound); -} // namespace HysteresisPhaseChange +} // namespace Material struct HysteresisPhaseChangeData : BaseGlobalStruct { bool getHysteresisModels = true; - int numHysteresisModels = 0; - std::vector hysteresisPhaseChangeModels; void init_state([[maybe_unused]] EnergyPlusData &state) override { @@ -151,9 +149,7 @@ struct HysteresisPhaseChangeData : BaseGlobalStruct void clear_state() override { - numHysteresisModels = 0; getHysteresisModels = true; - hysteresisPhaseChangeModels.clear(); } }; diff --git a/src/EnergyPlus/PipeHeatTransfer.cc b/src/EnergyPlus/PipeHeatTransfer.cc index cca0c3a5284..b894207c80e 100644 --- a/src/EnergyPlus/PipeHeatTransfer.cc +++ b/src/EnergyPlus/PipeHeatTransfer.cc @@ -209,6 +209,8 @@ void GetPipesHeatTransfer(EnergyPlusData &state) using OutAirNodeManager::CheckOutAirNodeNumber; using ScheduleManager::GetScheduleIndex; + static constexpr std::string_view routineName = "GetPipeHeatTransfer"; + // SUBROUTINE PARAMETER DEFINITIONS: int constexpr NumPipeSections(20); int constexpr NumberOfDepthNodes(8); // Number of nodes in the cartesian grid-Should be an even # for now @@ -224,14 +226,17 @@ void GetPipesHeatTransfer(EnergyPlusData &state) int NumOfPipeHTInt; // Number of Pipe Heat Transfer objects int NumOfPipeHTExt; // Number of Pipe Heat Transfer objects int NumOfPipeHTUG; // Number of Pipe Heat Transfer objects - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + int NumSections; // total number of sections in pipe + + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; // Initializations and allocations - cCurrentModuleObject = "Pipe:Indoor"; - NumOfPipeHTInt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - cCurrentModuleObject = "Pipe:Outdoor"; - NumOfPipeHTExt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - cCurrentModuleObject = "Pipe:Underground"; - NumOfPipeHTUG = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "Pipe:Indoor"; + NumOfPipeHTInt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "Pipe:Outdoor"; + NumOfPipeHTExt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "Pipe:Underground"; + NumOfPipeHTUG = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataPipeHT->nsvNumOfPipeHT = NumOfPipeHTInt + NumOfPipeHTExt + NumOfPipeHTUG; // allocate data structures @@ -241,425 +246,398 @@ void GetPipesHeatTransfer(EnergyPlusData &state) state.dataPipeHT->PipeHTUniqueNames.reserve(static_cast(state.dataPipeHT->nsvNumOfPipeHT)); int Item = 0; - cCurrentModuleObject = "Pipe:Indoor"; + s_ipsc->cCurrentModuleObject = "Pipe:Indoor"; for (int PipeItem = 1; PipeItem <= NumOfPipeHTInt; ++PipeItem) { ++Item; // get the object name state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, PipeItem, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); GlobalNames::VerifyUniqueInterObjectName(state, state.dataPipeHT->PipeHTUniqueNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound); - state.dataPipeHT->PipeHT(Item).Name = state.dataIPShortCut->cAlphaArgs(1); + state.dataPipeHT->PipeHT(Item).Name = s_ipsc->cAlphaArgs(1); state.dataPipeHT->PipeHT(Item).Type = DataPlant::PlantEquipmentType::PipeInterior; // General user input data - state.dataPipeHT->PipeHT(Item).Construction = state.dataIPShortCut->cAlphaArgs(2); - state.dataPipeHT->PipeHT(Item).ConstructionNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataConstruction->Construct); + state.dataPipeHT->PipeHT(Item).Construction = s_ipsc->cAlphaArgs(2); + state.dataPipeHT->PipeHT(Item).ConstructionNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct); if (state.dataPipeHT->PipeHT(Item).ConstructionNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // get inlet node data - state.dataPipeHT->PipeHT(Item).InletNode = state.dataIPShortCut->cAlphaArgs(3); + state.dataPipeHT->PipeHT(Item).InletNode = s_ipsc->cAlphaArgs(3); state.dataPipeHT->PipeHT(Item).InletNodeNum = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(3), + s_ipsc->cAlphaArgs(3), ErrorsFound, DataLoopNode::ConnectionObjectType::PipeIndoor, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); if (state.dataPipeHT->PipeHT(Item).InletNodeNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // get outlet node data - state.dataPipeHT->PipeHT(Item).OutletNode = state.dataIPShortCut->cAlphaArgs(4); + state.dataPipeHT->PipeHT(Item).OutletNode = s_ipsc->cAlphaArgs(4); state.dataPipeHT->PipeHT(Item).OutletNodeNum = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(4), + s_ipsc->cAlphaArgs(4), ErrorsFound, DataLoopNode::ConnectionObjectType::PipeIndoor, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); if (state.dataPipeHT->PipeHT(Item).OutletNodeNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } - TestCompSet(state, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(3), - state.dataIPShortCut->cAlphaArgs(4), - "Pipe Nodes"); + TestCompSet(state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(3), s_ipsc->cAlphaArgs(4), "Pipe Nodes"); // get environmental boundary condition type - if (state.dataIPShortCut->lAlphaFieldBlanks(5)) state.dataIPShortCut->cAlphaArgs(5) = "ZONE"; + if (s_ipsc->lAlphaFieldBlanks(5)) s_ipsc->cAlphaArgs(5) = "ZONE"; - PipeIndoorBoundaryType indoorType = - static_cast(getEnumValue(pipeIndoorBoundaryTypeNamesUC, state.dataIPShortCut->cAlphaArgs(5))); + PipeIndoorBoundaryType indoorType = static_cast(getEnumValue(pipeIndoorBoundaryTypeNamesUC, s_ipsc->cAlphaArgs(5))); switch (indoorType) { case PipeIndoorBoundaryType::Zone: state.dataPipeHT->PipeHT(Item).EnvironmentPtr = EnvrnPtr::ZoneEnv; - state.dataPipeHT->PipeHT(Item).EnvrZonePtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(6), state.dataHeatBal->Zone); + state.dataPipeHT->PipeHT(Item).EnvrZonePtr = Util::FindItemInList(s_ipsc->cAlphaArgs(6), state.dataHeatBal->Zone); if (state.dataPipeHT->PipeHT(Item).EnvrZonePtr == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } break; case PipeIndoorBoundaryType::Schedule: state.dataPipeHT->PipeHT(Item).EnvironmentPtr = EnvrnPtr::ScheduleEnv; - state.dataPipeHT->PipeHT(Item).EnvrSchedule = state.dataIPShortCut->cAlphaArgs(7); + state.dataPipeHT->PipeHT(Item).EnvrSchedule = s_ipsc->cAlphaArgs(7); state.dataPipeHT->PipeHT(Item).EnvrSchedPtr = GetScheduleIndex(state, state.dataPipeHT->PipeHT(Item).EnvrSchedule); - state.dataPipeHT->PipeHT(Item).EnvrVelSchedule = state.dataIPShortCut->cAlphaArgs(8); + state.dataPipeHT->PipeHT(Item).EnvrVelSchedule = s_ipsc->cAlphaArgs(8); state.dataPipeHT->PipeHT(Item).EnvrVelSchedPtr = GetScheduleIndex(state, state.dataPipeHT->PipeHT(Item).EnvrVelSchedule); if (state.dataPipeHT->PipeHT(Item).EnvrSchedPtr == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } if (state.dataPipeHT->PipeHT(Item).EnvrVelSchedPtr == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(8), s_ipsc->cAlphaArgs(8))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } break; default: - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, R"(Should be "ZONE" or "SCHEDULE")"); // TODO rename point ErrorsFound = true; } // dimensions - state.dataPipeHT->PipeHT(Item).PipeID = state.dataIPShortCut->rNumericArgs(1); - if (state.dataIPShortCut->rNumericArgs(1) <= 0.0) { // not really necessary because idd field has "minimum> 0" - ShowSevereError(state, - format("GetPipesHeatTransfer: invalid {} of {:.4R}", - state.dataIPShortCut->cNumericFieldNames(1), - state.dataIPShortCut->rNumericArgs(1))); - ShowContinueError(state, format("{} must be > 0.0", state.dataIPShortCut->cNumericFieldNames(1))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + state.dataPipeHT->PipeHT(Item).PipeID = s_ipsc->rNumericArgs(1); + if (s_ipsc->rNumericArgs(1) <= 0.0) { // not really necessary because idd field has "minimum> 0" + ShowSevereError(state, format("GetPipesHeatTransfer: invalid {} of {:.4R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); + ShowContinueError(state, format("{} must be > 0.0", s_ipsc->cNumericFieldNames(1))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } - state.dataPipeHT->PipeHT(Item).Length = state.dataIPShortCut->rNumericArgs(2); - if (state.dataIPShortCut->rNumericArgs(2) <= 0.0) { // not really necessary because idd field has "minimum> 0" - ShowSevereError(state, - format("GetPipesHeatTransfer: invalid {} of {:.4R}", - state.dataIPShortCut->cNumericFieldNames(2), - state.dataIPShortCut->rNumericArgs(2))); - ShowContinueError(state, format("{} must be > 0.0", state.dataIPShortCut->cNumericFieldNames(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + state.dataPipeHT->PipeHT(Item).Length = s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(2) <= 0.0) { // not really necessary because idd field has "minimum> 0" + ShowSevereError(state, format("GetPipesHeatTransfer: invalid {} of {:.4R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); + ShowContinueError(state, format("{} must be > 0.0", s_ipsc->cNumericFieldNames(2))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } if (state.dataPipeHT->PipeHT(Item).ConstructionNum != 0) { state.dataPipeHT->PipeHT(Item).ValidatePipeConstruction(state, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(2), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(2), + s_ipsc->cAlphaFieldNames(2), state.dataPipeHT->PipeHT(Item).ConstructionNum, ErrorsFound); } } // end of input loop - cCurrentModuleObject = "Pipe:Outdoor"; + s_ipsc->cCurrentModuleObject = "Pipe:Outdoor"; for (int PipeItem = 1; PipeItem <= NumOfPipeHTExt; ++PipeItem) { ++Item; // get the object name state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, PipeItem, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); GlobalNames::VerifyUniqueInterObjectName(state, state.dataPipeHT->PipeHTUniqueNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound); - state.dataPipeHT->PipeHT(Item).Name = state.dataIPShortCut->cAlphaArgs(1); + state.dataPipeHT->PipeHT(Item).Name = s_ipsc->cAlphaArgs(1); state.dataPipeHT->PipeHT(Item).Type = DataPlant::PlantEquipmentType::PipeExterior; // General user input data - state.dataPipeHT->PipeHT(Item).Construction = state.dataIPShortCut->cAlphaArgs(2); - state.dataPipeHT->PipeHT(Item).ConstructionNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataConstruction->Construct); + state.dataPipeHT->PipeHT(Item).Construction = s_ipsc->cAlphaArgs(2); + state.dataPipeHT->PipeHT(Item).ConstructionNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct); if (state.dataPipeHT->PipeHT(Item).ConstructionNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // get inlet node data - state.dataPipeHT->PipeHT(Item).InletNode = state.dataIPShortCut->cAlphaArgs(3); + state.dataPipeHT->PipeHT(Item).InletNode = s_ipsc->cAlphaArgs(3); state.dataPipeHT->PipeHT(Item).InletNodeNum = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(3), + s_ipsc->cAlphaArgs(3), ErrorsFound, DataLoopNode::ConnectionObjectType::PipeOutdoor, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); if (state.dataPipeHT->PipeHT(Item).InletNodeNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // get outlet node data - state.dataPipeHT->PipeHT(Item).OutletNode = state.dataIPShortCut->cAlphaArgs(4); + state.dataPipeHT->PipeHT(Item).OutletNode = s_ipsc->cAlphaArgs(4); state.dataPipeHT->PipeHT(Item).OutletNodeNum = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(4), + s_ipsc->cAlphaArgs(4), ErrorsFound, DataLoopNode::ConnectionObjectType::PipeOutdoor, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); if (state.dataPipeHT->PipeHT(Item).OutletNodeNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } - TestCompSet(state, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(3), - state.dataIPShortCut->cAlphaArgs(4), - "Pipe Nodes"); + TestCompSet(state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(3), s_ipsc->cAlphaArgs(4), "Pipe Nodes"); // get environmental boundary condition type // PipeHT(Item)%Environment = 'OutdoorAir' state.dataPipeHT->PipeHT(Item).EnvironmentPtr = EnvrnPtr::OutsideAirEnv; - state.dataPipeHT->PipeHT(Item).EnvrAirNode = state.dataIPShortCut->cAlphaArgs(5); + state.dataPipeHT->PipeHT(Item).EnvrAirNode = s_ipsc->cAlphaArgs(5); state.dataPipeHT->PipeHT(Item).EnvrAirNodeNum = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(5), + s_ipsc->cAlphaArgs(5), ErrorsFound, DataLoopNode::ConnectionObjectType::PipeOutdoor, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::OutsideAirReference, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); - if (!state.dataIPShortCut->lAlphaFieldBlanks(5)) { + if (!s_ipsc->lAlphaFieldBlanks(5)) { if (!CheckOutAirNodeNumber(state, state.dataPipeHT->PipeHT(Item).EnvrAirNodeNum)) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Outdoor Air Node not on OutdoorAir:NodeList or OutdoorAir:Node"); ErrorsFound = true; } } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("An {} must be used ", state.dataIPShortCut->cAlphaFieldNames(5))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("An {} must be used ", s_ipsc->cAlphaFieldNames(5))); ErrorsFound = true; } // dimensions - state.dataPipeHT->PipeHT(Item).PipeID = state.dataIPShortCut->rNumericArgs(1); - if (state.dataIPShortCut->rNumericArgs(1) <= 0.0) { // not really necessary because idd field has "minimum> 0" - ShowSevereError(state, - format("Invalid {} of {:.4R}", state.dataIPShortCut->cNumericFieldNames(1), state.dataIPShortCut->rNumericArgs(1))); - ShowContinueError(state, format("{} must be > 0.0", state.dataIPShortCut->cNumericFieldNames(1))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + state.dataPipeHT->PipeHT(Item).PipeID = s_ipsc->rNumericArgs(1); + if (s_ipsc->rNumericArgs(1) <= 0.0) { // not really necessary because idd field has "minimum> 0" + ShowSevereError(state, format("Invalid {} of {:.4R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); + ShowContinueError(state, format("{} must be > 0.0", s_ipsc->cNumericFieldNames(1))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } - state.dataPipeHT->PipeHT(Item).Length = state.dataIPShortCut->rNumericArgs(2); - if (state.dataIPShortCut->rNumericArgs(2) <= 0.0) { // not really necessary because idd field has "minimum> 0" - ShowSevereError(state, - format("Invalid {} of {:.4R}", state.dataIPShortCut->cNumericFieldNames(2), state.dataIPShortCut->rNumericArgs(2))); - ShowContinueError(state, format("{} must be > 0.0", state.dataIPShortCut->cNumericFieldNames(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + state.dataPipeHT->PipeHT(Item).Length = s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(2) <= 0.0) { // not really necessary because idd field has "minimum> 0" + ShowSevereError(state, format("Invalid {} of {:.4R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); + ShowContinueError(state, format("{} must be > 0.0", s_ipsc->cNumericFieldNames(2))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } if (state.dataPipeHT->PipeHT(Item).ConstructionNum != 0) { state.dataPipeHT->PipeHT(Item).ValidatePipeConstruction(state, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(2), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(2), + s_ipsc->cAlphaFieldNames(2), state.dataPipeHT->PipeHT(Item).ConstructionNum, ErrorsFound); } } // end of input loop - cCurrentModuleObject = "Pipe:Underground"; + s_ipsc->cCurrentModuleObject = "Pipe:Underground"; for (int PipeItem = 1; PipeItem <= NumOfPipeHTUG; ++PipeItem) { - ++Item; // get the object name state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, PipeItem, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; GlobalNames::VerifyUniqueInterObjectName(state, state.dataPipeHT->PipeHTUniqueNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound); - state.dataPipeHT->PipeHT(Item).Name = state.dataIPShortCut->cAlphaArgs(1); + state.dataPipeHT->PipeHT(Item).Name = s_ipsc->cAlphaArgs(1); state.dataPipeHT->PipeHT(Item).Type = DataPlant::PlantEquipmentType::PipeUnderground; // General user input data - state.dataPipeHT->PipeHT(Item).Construction = state.dataIPShortCut->cAlphaArgs(2); - state.dataPipeHT->PipeHT(Item).ConstructionNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataConstruction->Construct); + state.dataPipeHT->PipeHT(Item).Construction = s_ipsc->cAlphaArgs(2); + state.dataPipeHT->PipeHT(Item).ConstructionNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct); if (state.dataPipeHT->PipeHT(Item).ConstructionNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // get inlet node data - state.dataPipeHT->PipeHT(Item).InletNode = state.dataIPShortCut->cAlphaArgs(3); + state.dataPipeHT->PipeHT(Item).InletNode = s_ipsc->cAlphaArgs(3); state.dataPipeHT->PipeHT(Item).InletNodeNum = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(3), + s_ipsc->cAlphaArgs(3), ErrorsFound, DataLoopNode::ConnectionObjectType::PipeUnderground, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); if (state.dataPipeHT->PipeHT(Item).InletNodeNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // get outlet node data - state.dataPipeHT->PipeHT(Item).OutletNode = state.dataIPShortCut->cAlphaArgs(4); + state.dataPipeHT->PipeHT(Item).OutletNode = s_ipsc->cAlphaArgs(4); state.dataPipeHT->PipeHT(Item).OutletNodeNum = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(4), + s_ipsc->cAlphaArgs(4), ErrorsFound, DataLoopNode::ConnectionObjectType::PipeUnderground, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); if (state.dataPipeHT->PipeHT(Item).OutletNodeNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } - TestCompSet(state, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(3), - state.dataIPShortCut->cAlphaArgs(4), - "Pipe Nodes"); + TestCompSet(state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(3), s_ipsc->cAlphaArgs(4), "Pipe Nodes"); state.dataPipeHT->PipeHT(Item).EnvironmentPtr = EnvrnPtr::GroundEnv; // Solar inclusion flag // A6, \field Sun Exposure - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "SUNEXPOSED")) { + if (Util::SameString(s_ipsc->cAlphaArgs(5), "SUNEXPOSED")) { state.dataPipeHT->PipeHT(Item).SolarExposed = true; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "NOSUN")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(5), "NOSUN")) { state.dataPipeHT->PipeHT(Item).SolarExposed = false; } else { - ShowSevereError(state, format("GetPipesHeatTransfer: invalid key for sun exposure flag for {}", state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Key should be either SunExposed or NoSun. Entered Key: {}", state.dataIPShortCut->cAlphaArgs(5))); + ShowSevereError(state, format("GetPipesHeatTransfer: invalid key for sun exposure flag for {}", s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Key should be either SunExposed or NoSun. Entered Key: {}", s_ipsc->cAlphaArgs(5))); ErrorsFound = true; } // dimensions - state.dataPipeHT->PipeHT(Item).PipeID = state.dataIPShortCut->rNumericArgs(1); - if (state.dataIPShortCut->rNumericArgs(1) <= 0.0) { // not really necessary because idd field has "minimum> 0" - ShowSevereError(state, - format("Invalid {} of {:.4R}", state.dataIPShortCut->cNumericFieldNames(1), state.dataIPShortCut->rNumericArgs(1))); - ShowContinueError(state, format("{} must be > 0.0", state.dataIPShortCut->cNumericFieldNames(1))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + state.dataPipeHT->PipeHT(Item).PipeID = s_ipsc->rNumericArgs(1); + if (s_ipsc->rNumericArgs(1) <= 0.0) { // not really necessary because idd field has "minimum> 0" + ShowSevereError(state, format("Invalid {} of {:.4R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); + ShowContinueError(state, format("{} must be > 0.0", s_ipsc->cNumericFieldNames(1))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } - state.dataPipeHT->PipeHT(Item).Length = state.dataIPShortCut->rNumericArgs(2); - if (state.dataIPShortCut->rNumericArgs(2) <= 0.0) { // not really necessary because idd field has "minimum> 0" - ShowSevereError(state, - format("Invalid {} of {:.4R}", state.dataIPShortCut->cNumericFieldNames(2), state.dataIPShortCut->rNumericArgs(2))); - ShowContinueError(state, format("{} must be > 0.0", state.dataIPShortCut->cNumericFieldNames(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + state.dataPipeHT->PipeHT(Item).Length = s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(2) <= 0.0) { // not really necessary because idd field has "minimum> 0" + ShowSevereError(state, format("Invalid {} of {:.4R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); + ShowContinueError(state, format("{} must be > 0.0", s_ipsc->cNumericFieldNames(2))); + ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // Also get the soil material name // A7, \field Soil Material - state.dataPipeHT->PipeHT(Item).SoilMaterial = state.dataIPShortCut->cAlphaArgs(6); - state.dataPipeHT->PipeHT(Item).SoilMaterialNum = Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(6), state.dataMaterial->Material); + state.dataPipeHT->PipeHT(Item).SoilMaterial = s_ipsc->cAlphaArgs(6); + state.dataPipeHT->PipeHT(Item).SoilMaterialNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(6)); if (state.dataPipeHT->PipeHT(Item).SoilMaterialNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataPipeHT->PipeHT(Item).SoilMaterial)); - ShowContinueError(state, format("Found in {}={}", cCurrentModuleObject, state.dataPipeHT->PipeHT(Item).Name)); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); ErrorsFound = true; } else { - auto const *thisMaterialSoil = - dynamic_cast(state.dataMaterial->Material(state.dataPipeHT->PipeHT(Item).SoilMaterialNum)); - assert(thisMaterialSoil != nullptr); - state.dataPipeHT->PipeHT(Item).SoilDensity = thisMaterialSoil->Density; - state.dataPipeHT->PipeHT(Item).SoilDepth = thisMaterialSoil->Thickness; - state.dataPipeHT->PipeHT(Item).SoilCp = thisMaterialSoil->SpecHeat; - state.dataPipeHT->PipeHT(Item).SoilConductivity = thisMaterialSoil->Conductivity; - state.dataPipeHT->PipeHT(Item).SoilThermAbs = thisMaterialSoil->AbsorpThermal; - state.dataPipeHT->PipeHT(Item).SoilSolarAbs = thisMaterialSoil->AbsorpSolar; - state.dataPipeHT->PipeHT(Item).SoilRoughness = thisMaterialSoil->Roughness; + auto const *matSoil = s_mat->materials(state.dataPipeHT->PipeHT(Item).SoilMaterialNum); + + state.dataPipeHT->PipeHT(Item).SoilDensity = matSoil->Density; + state.dataPipeHT->PipeHT(Item).SoilDepth = matSoil->Thickness; + state.dataPipeHT->PipeHT(Item).SoilCp = matSoil->SpecHeat; + state.dataPipeHT->PipeHT(Item).SoilConductivity = matSoil->Conductivity; + state.dataPipeHT->PipeHT(Item).SoilThermAbs = matSoil->AbsorpThermal; + state.dataPipeHT->PipeHT(Item).SoilSolarAbs = matSoil->AbsorpSolar; + state.dataPipeHT->PipeHT(Item).SoilRoughness = matSoil->Roughness; state.dataPipeHT->PipeHT(Item).PipeDepth = state.dataPipeHT->PipeHT(Item).SoilDepth + state.dataPipeHT->PipeHT(Item).PipeID / 2.0; state.dataPipeHT->PipeHT(Item).DomainDepth = state.dataPipeHT->PipeHT(Item).PipeDepth * 2.0; state.dataPipeHT->PipeHT(Item).SoilDiffusivity = state.dataPipeHT->PipeHT(Item).SoilConductivity / @@ -678,16 +656,15 @@ void GetPipesHeatTransfer(EnergyPlusData &state) if (state.dataPipeHT->PipeHT(Item).ConstructionNum != 0) { state.dataPipeHT->PipeHT(Item).ValidatePipeConstruction(state, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(2), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(2), + s_ipsc->cAlphaFieldNames(2), state.dataPipeHT->PipeHT(Item).ConstructionNum, ErrorsFound); } // Get ground temperature model - state.dataPipeHT->PipeHT(Item).groundTempModel = - GetGroundTempModelAndInit(state, state.dataIPShortCut->cAlphaArgs(7), state.dataIPShortCut->cAlphaArgs(8)); + state.dataPipeHT->PipeHT(Item).groundTempModel = GetGroundTempModelAndInit(state, s_ipsc->cAlphaArgs(7), s_ipsc->cAlphaArgs(8)); // Select number of pipe sections. Hanby's optimal number of 20 section is selected. state.dataPipeHT->PipeHT(Item).NumSections = NumPipeSections; @@ -858,33 +835,31 @@ void PipeHTData::ValidatePipeConstruction(EnergyPlusData &state, Real64 Resistance = 0.0; Real64 TotThickness = 0.0; + auto &s_mat = state.dataMaterial; + // CTF stuff int TotalLayers = state.dataConstruction->Construct(ConstructionNum).TotLayers; // get pipe properties if (TotalLayers == 1) { // no insulation layer + auto const *mat = s_mat->materials(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1)); - this->PipeConductivity = state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1))->Conductivity; - this->PipeDensity = state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1))->Density; - this->PipeCp = state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1))->SpecHeat; - this->PipeOD = this->PipeID + 2.0 * state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1))->Thickness; + this->PipeConductivity = mat->Conductivity; + this->PipeDensity = mat->Density; + this->PipeCp = mat->SpecHeat; + this->PipeOD = this->PipeID + 2.0 * mat->Thickness; this->InsulationOD = this->PipeOD; - this->SumTK = state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1))->Thickness / - state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(1))->Conductivity; + this->SumTK = mat->Thickness / mat->Conductivity; } else if (TotalLayers >= 2) { // first layers are insulation, last layer is pipe for (int LayerNum = 1; LayerNum <= TotalLayers - 1; ++LayerNum) { - Resistance += state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->Thickness / - state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->Conductivity; - Density = state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->Density * - state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->Thickness; - TotThickness += state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->Thickness; - SpHeat = state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->SpecHeat * - state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->Thickness; - this->InsulationThickness = - state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->Thickness; - this->SumTK += state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->Thickness / - state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum))->Conductivity; + auto const *mat = state.dataMaterial->materials(state.dataConstruction->Construct(ConstructionNum).LayerPoint(LayerNum)); + Resistance += mat->Thickness / mat->Conductivity; + Density = mat->Density * mat->Thickness; + TotThickness += mat->Thickness; + SpHeat = mat->SpecHeat * mat->Thickness; + this->InsulationThickness = mat->Thickness; + this->SumTK += mat->Thickness / mat->Conductivity; } this->InsulationResistance = Resistance; @@ -893,13 +868,12 @@ void PipeHTData::ValidatePipeConstruction(EnergyPlusData &state, this->InsulationCp = SpHeat / TotThickness; this->InsulationThickness = TotThickness; - this->PipeConductivity = - state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(TotalLayers))->Conductivity; - this->PipeDensity = state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(TotalLayers))->Density; - this->PipeCp = state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(TotalLayers))->SpecHeat; + auto const *mat = state.dataMaterial->materials(state.dataConstruction->Construct(ConstructionNum).LayerPoint(TotalLayers)); + this->PipeConductivity = mat->Conductivity; + this->PipeDensity = mat->Density; + this->PipeCp = mat->SpecHeat; - this->PipeOD = - this->PipeID + 2.0 * state.dataMaterial->Material(state.dataConstruction->Construct(ConstructionNum).LayerPoint(TotalLayers))->Thickness; + this->PipeOD = this->PipeID + 2.0 * mat->Thickness; this->InsulationOD = this->PipeOD + 2.0 * this->InsulationThickness; } else { diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index aab4c3c8bec..fe4308a50fc 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -2097,7 +2097,6 @@ void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData // Report for first branch auto &thisBranch = thisLoopSide.Branch(1); - constexpr std::string_view branch = "Branch"; for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) { auto const &thisComp = thisBranch.Comp(compNum); @@ -2123,7 +2122,6 @@ void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData // mixer if (thisLoopSide.Mixer.Exists) { rowCounter -= 1; - constexpr std::string_view mixer = "Mixer"; fillPlantToplogyMixerRow2(state, loopType, thisLoop.Name, loopSide, thisLoopSide.Mixer.Name, rowCounter); rowCounter += 1; } diff --git a/src/EnergyPlus/PlantPipingSystemsManager.cc b/src/EnergyPlus/PlantPipingSystemsManager.cc index fbd751e8dcf..b52c9540d17 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.cc +++ b/src/EnergyPlus/PlantPipingSystemsManager.cc @@ -808,7 +808,7 @@ namespace PlantPipingSystemsManager { // RE-ENGINEERED na // SUBROUTINE PARAMETER DEFINITIONS: - static constexpr std::string_view RoutineName("ReadZoneCoupledDomainInputs"); + static constexpr std::string_view routineName = "ReadZoneCoupledDomainInputs"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of Alphas for each GetObjectItem call @@ -821,6 +821,9 @@ namespace PlantPipingSystemsManager { // For each domain, we need to process the inputs into a local array of derived type, then resolve each one, creating definitions for a zone // coupled domain. This way, the outer get input routines can handle it as though they were generalized routines + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; + for (int ZoneCoupledDomainCtr = 1; ZoneCoupledDomainCtr <= NumZoneCoupledDomains; ++ZoneCoupledDomainCtr) { // Increment the domain counters here @@ -830,76 +833,77 @@ namespace PlantPipingSystemsManager { state.dataInputProcessing->inputProcessor->getObjectItem(state, ObjName_ZoneCoupled_Slab, ZoneCoupledDomainCtr, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, ObjName_ZoneCoupled_Slab, s_ipsc->cAlphaArgs(1)}; auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainCtr - 1]; // Get the name, validate // Domain name - thisDomain.Name = state.dataIPShortCut->cAlphaArgs(1); + thisDomain.Name = s_ipsc->cAlphaArgs(1); GlobalNames::VerifyUniqueInterObjectName(state, state.dataPlantPipingSysMgr->GroundDomainUniqueNames, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), ObjName_ZoneCoupled_Slab, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaFieldNames(1), ErrorsFound); // Read in the rest of the inputs into the local type for clarity during transition - thisDomain.Extents.yMax = state.dataIPShortCut->rNumericArgs(1); - thisDomain.PerimeterOffset = state.dataIPShortCut->rNumericArgs(3); - thisDomain.GroundProperties.Conductivity = state.dataIPShortCut->rNumericArgs(4); - thisDomain.GroundProperties.Density = state.dataIPShortCut->rNumericArgs(5); - thisDomain.GroundProperties.SpecificHeat = state.dataIPShortCut->rNumericArgs(6); - thisDomain.Moisture.Theta_liq = state.dataIPShortCut->rNumericArgs(7) / 100.0; - thisDomain.Moisture.Theta_sat = state.dataIPShortCut->rNumericArgs(8) / 100.0; - thisDomain.Moisture.GroundCoverCoefficient = state.dataIPShortCut->rNumericArgs(9); - thisDomain.HorizInsWidth = state.dataIPShortCut->rNumericArgs(10); - thisDomain.VertInsDepth = state.dataIPShortCut->rNumericArgs(11); + thisDomain.Extents.yMax = s_ipsc->rNumericArgs(1); + thisDomain.PerimeterOffset = s_ipsc->rNumericArgs(3); + thisDomain.GroundProperties.Conductivity = s_ipsc->rNumericArgs(4); + thisDomain.GroundProperties.Density = s_ipsc->rNumericArgs(5); + thisDomain.GroundProperties.SpecificHeat = s_ipsc->rNumericArgs(6); + thisDomain.Moisture.Theta_liq = s_ipsc->rNumericArgs(7) / 100.0; + thisDomain.Moisture.Theta_sat = s_ipsc->rNumericArgs(8) / 100.0; + thisDomain.Moisture.GroundCoverCoefficient = s_ipsc->rNumericArgs(9); + thisDomain.HorizInsWidth = s_ipsc->rNumericArgs(10); + thisDomain.VertInsDepth = s_ipsc->rNumericArgs(11); // Set flag for slab in-grade or slab on-grade - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "INGRADE")) { + if (Util::SameString(s_ipsc->cAlphaArgs(5), "INGRADE")) { thisDomain.SlabInGradeFlag = true; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "ONGRADE")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(5), "ONGRADE")) { thisDomain.SlabInGradeFlag = false; } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } // Get slab material properties if (thisDomain.SlabInGradeFlag) { - thisDomain.SlabMaterialNum = - Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(6), state.dataMaterial->Material, state.dataMaterial->TotMaterials); + thisDomain.SlabMaterialNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(6)); if (thisDomain.SlabMaterialNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); - ShowContinueError(state, format("Found in: {}", thisDomain.Name)); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); ErrorsFound = true; } else { - thisDomain.SlabThickness = state.dataMaterial->Material(thisDomain.SlabMaterialNum)->Thickness; - thisDomain.SlabProperties.Density = state.dataMaterial->Material(thisDomain.SlabMaterialNum)->Density; - thisDomain.SlabProperties.SpecificHeat = state.dataMaterial->Material(thisDomain.SlabMaterialNum)->SpecHeat; - thisDomain.SlabProperties.Conductivity = state.dataMaterial->Material(thisDomain.SlabMaterialNum)->Conductivity; + auto const *mat = s_mat->materials(thisDomain.SlabMaterialNum); + thisDomain.SlabThickness = mat->Thickness; + thisDomain.SlabProperties.Density = mat->Density; + thisDomain.SlabProperties.SpecificHeat = mat->SpecHeat; + thisDomain.SlabProperties.Conductivity = mat->Conductivity; } } // set flag for horizontal insulation if (thisDomain.SlabInGradeFlag) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "NO")) { + if (Util::SameString(s_ipsc->cAlphaArgs(7), "NO")) { thisDomain.HorizInsPresentFlag = false; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "YES")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(7), "YES")) { thisDomain.HorizInsPresentFlag = true; } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } @@ -907,88 +911,84 @@ namespace PlantPipingSystemsManager { // Get horizontal insulation material properties if (thisDomain.HorizInsPresentFlag) { - thisDomain.HorizInsMaterialNum = - Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(8), state.dataMaterial->Material, state.dataMaterial->TotMaterials); + thisDomain.HorizInsMaterialNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(8)); if (thisDomain.HorizInsMaterialNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8))); - ShowContinueError(state, format("Found in: {}", thisDomain.Name)); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(8), s_ipsc->cAlphaArgs(8)); ErrorsFound = true; } else { - thisDomain.HorizInsThickness = state.dataMaterial->Material(thisDomain.HorizInsMaterialNum)->Thickness; - thisDomain.HorizInsProperties.Density = state.dataMaterial->Material(thisDomain.HorizInsMaterialNum)->Density; - thisDomain.HorizInsProperties.SpecificHeat = state.dataMaterial->Material(thisDomain.HorizInsMaterialNum)->SpecHeat; - thisDomain.HorizInsProperties.Conductivity = state.dataMaterial->Material(thisDomain.HorizInsMaterialNum)->Conductivity; + auto const *mat = s_mat->materials(thisDomain.HorizInsMaterialNum); + thisDomain.HorizInsThickness = mat->Thickness; + thisDomain.HorizInsProperties.Density = mat->Density; + thisDomain.HorizInsProperties.SpecificHeat = mat->SpecHeat; + thisDomain.HorizInsProperties.Conductivity = mat->Conductivity; if (SiteGroundDomainUsingNoMassMat(state, thisDomain.HorizInsThickness, thisDomain.HorizInsMaterialNum)) { ErrorsFound = true; - SiteGroundDomainNoMassMatError( - state, state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8), thisDomain.Name); + SiteGroundDomainNoMassMatError(state, s_ipsc->cAlphaFieldNames(8), s_ipsc->cAlphaArgs(8), thisDomain.Name); } } // Set flag for horizontal insulation extents - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "PERIMETER")) { + if (Util::SameString(s_ipsc->cAlphaArgs(9), "PERIMETER")) { thisDomain.FullHorizInsPresent = false; // Horizontal insulation perimeter width if (thisDomain.HorizInsWidth <= 0.0) { - ShowSevereError(state, format("Invalid {}", state.dataIPShortCut->cNumericFieldNames(10))); + ShowSevereError(state, format("Invalid {}", s_ipsc->cNumericFieldNames(10))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "FULL")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(9), "FULL")) { thisDomain.FullHorizInsPresent = true; } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(9), s_ipsc->cAlphaArgs(9))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } } // set flag for vertical insulation - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(10), "NO")) { + if (Util::SameString(s_ipsc->cAlphaArgs(10), "NO")) { thisDomain.VertInsPresentFlag = false; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(10), "YES")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(10), "YES")) { thisDomain.VertInsPresentFlag = true; } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(10), state.dataIPShortCut->cAlphaArgs(10))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } // Get vertical insulation material properties if (thisDomain.VertInsPresentFlag) { - thisDomain.VertInsMaterialNum = - Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(11), state.dataMaterial->Material, state.dataMaterial->TotMaterials); + thisDomain.VertInsMaterialNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(11)); if (thisDomain.VertInsMaterialNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(11), state.dataIPShortCut->cAlphaArgs(11))); - ShowContinueError(state, format("Found in: {}", thisDomain.Name)); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(11), s_ipsc->cAlphaArgs(11)); ErrorsFound = true; } else { - thisDomain.VertInsThickness = state.dataMaterial->Material(thisDomain.VertInsMaterialNum)->Thickness; - thisDomain.VertInsProperties.Density = state.dataMaterial->Material(thisDomain.VertInsMaterialNum)->Density; - thisDomain.VertInsProperties.SpecificHeat = state.dataMaterial->Material(thisDomain.VertInsMaterialNum)->SpecHeat; - thisDomain.VertInsProperties.Conductivity = state.dataMaterial->Material(thisDomain.VertInsMaterialNum)->Conductivity; + auto const *mat = s_mat->materials(thisDomain.VertInsMaterialNum); + thisDomain.VertInsThickness = mat->Thickness; + thisDomain.VertInsProperties.Density = mat->Density; + thisDomain.VertInsProperties.SpecificHeat = mat->SpecHeat; + thisDomain.VertInsProperties.Conductivity = mat->Conductivity; if (SiteGroundDomainUsingNoMassMat(state, thisDomain.VertInsThickness, thisDomain.VertInsMaterialNum)) { ErrorsFound = true; - SiteGroundDomainNoMassMatError( - state, state.dataIPShortCut->cAlphaFieldNames(11), state.dataIPShortCut->cAlphaArgs(11), thisDomain.Name); + SiteGroundDomainNoMassMatError(state, s_ipsc->cAlphaFieldNames(11), s_ipsc->cAlphaArgs(11), thisDomain.Name); } } // vertical insulation depth if (thisDomain.VertInsDepth > thisDomain.Extents.yMax || thisDomain.VertInsDepth <= 0.0) { - ShowSevereError(state, format("Invalid {}", state.dataIPShortCut->cNumericFieldNames(11))); + ShowSevereError(state, format("Invalid {}", s_ipsc->cNumericFieldNames(11))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } } // Set simulation interval flag - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(12), "TIMESTEP")) { + if (Util::SameString(s_ipsc->cAlphaArgs(12), "TIMESTEP")) { thisDomain.SimTimeStepFlag = true; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(12), "HOURLY")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(12), "HOURLY")) { thisDomain.SimHourlyFlag = true; } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(12), state.dataIPShortCut->cAlphaArgs(12))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(12), s_ipsc->cAlphaArgs(12))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } @@ -999,14 +999,14 @@ namespace PlantPipingSystemsManager { thisDomain.HasZoneCoupledSlab = true; // get boundary condition model names and indices -- error check - thisDomain.ZoneCoupledOSCMIndex = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataSurface->OSCM); + thisDomain.ZoneCoupledOSCMIndex = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataSurface->OSCM); if (thisDomain.ZoneCoupledOSCMIndex <= 0) { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ZoneCoupled_Slab, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4), "Could not match with an Other Side Conditions Model input object.", ErrorsFound); ErrorsFound = true; @@ -1015,11 +1015,11 @@ namespace PlantPipingSystemsManager { if (NumSurfacesWithThisOSCM <= 0) { IssueSevereInputFieldError( state, - RoutineName, + routineName, ObjName_ZoneCoupled_Slab, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4), "Entry matched an Other Side Conditions Model, but no surfaces were found to be using this Other Side Conditions Model.", ErrorsFound); ErrorsFound = true; @@ -1035,7 +1035,7 @@ namespace PlantPipingSystemsManager { thisDomain.SlabArea = ThisArea / 4; // We are only interested in 1/4 of total area due to symmetry // Surface dimensions - Real64 thisAspectRatio = state.dataIPShortCut->rNumericArgs(2); + Real64 thisAspectRatio = s_ipsc->rNumericArgs(2); thisDomain.SlabWidth = std::sqrt(ThisArea / thisAspectRatio); thisDomain.SlabLength = thisDomain.SlabWidth * thisAspectRatio; @@ -1044,7 +1044,7 @@ namespace PlantPipingSystemsManager { if (!thisDomain.FullHorizInsPresent && ThisArea > 0.0) { if (2 * (thisDomain.HorizInsWidth + thisDomain.VertInsThickness) > thisDomain.SlabWidth || 2 * (thisDomain.HorizInsWidth + thisDomain.VertInsThickness) > thisDomain.SlabLength) { - ShowContinueError(state, format("{}: Perimeter insulation width is too large.", RoutineName)); + ShowContinueError(state, format("{}: Perimeter insulation width is too large.", routineName)); ShowContinueError(state, "This would cause overlapping insulation. Check inputs."); ShowContinueError(state, "Defaulting to full horizontal insulation."); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); @@ -1064,13 +1064,13 @@ namespace PlantPipingSystemsManager { thisDomain.Mesh.Y.thisMeshDistribution = MeshDistribution::SymmetricGeometric; thisDomain.Mesh.Z.thisMeshDistribution = MeshDistribution::SymmetricGeometric; - Real64 MeshCoefficient = state.dataIPShortCut->rNumericArgs(12); + Real64 MeshCoefficient = s_ipsc->rNumericArgs(12); if (MeshCoefficient == 0.0) MeshCoefficient = 1.6; thisDomain.Mesh.X.GeometricSeriesCoefficient = MeshCoefficient; thisDomain.Mesh.Y.GeometricSeriesCoefficient = MeshCoefficient; thisDomain.Mesh.Z.GeometricSeriesCoefficient = MeshCoefficient; - int MeshCount = static_cast(state.dataIPShortCut->rNumericArgs(13)); + int MeshCount = static_cast(s_ipsc->rNumericArgs(13)); if (MeshCount == 0.0) MeshCount = 6; thisDomain.Mesh.X.RegionMeshCount = MeshCount; thisDomain.Mesh.Y.RegionMeshCount = MeshCount; @@ -1079,7 +1079,7 @@ namespace PlantPipingSystemsManager { thisDomain.NumSlabCells = thisDomain.Mesh.Y.RegionMeshCount; // Need to clean this out at some point // Farfield model - thisDomain.groundTempModel = GetGroundTempModelAndInit(state, state.dataIPShortCut->cAlphaArgs(2), state.dataIPShortCut->cAlphaArgs(3)); + thisDomain.groundTempModel = GetGroundTempModelAndInit(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(3)); // Other parameters thisDomain.SimControls.Convergence_CurrentToPrevIteration = 0.001; @@ -1100,7 +1100,7 @@ namespace PlantPipingSystemsManager { // RE-ENGINEERED na // SUBROUTINE PARAMETER DEFINITIONS: - static constexpr std::string_view RoutineName("ReadBasementInputs"); + static constexpr std::string_view routineName = "ReadBasementInputs"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of Alphas for each GetObjectItem call @@ -1112,6 +1112,8 @@ namespace PlantPipingSystemsManager { // For each domain, we need to process the inputs into a local array of derived type, then resolve each one, creating definitions for a zone // coupled domain. This way, the outer get input routines can handle it as though they were generalized routines + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; for (int BasementCtr = 1; BasementCtr <= NumBasements; ++BasementCtr) { @@ -1122,76 +1124,75 @@ namespace PlantPipingSystemsManager { state.dataInputProcessing->inputProcessor->getObjectItem(state, ObjName_ZoneCoupled_Basement, BasementCtr, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, ObjName_ZoneCoupled_Basement, s_ipsc->cAlphaArgs(1)}; auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainNum - 1]; // Get the name, validate - thisDomain.Name = state.dataIPShortCut->cAlphaArgs(1); + thisDomain.Name = s_ipsc->cAlphaArgs(1); GlobalNames::VerifyUniqueInterObjectName(state, state.dataPlantPipingSysMgr->GroundDomainUniqueNames, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), ObjName_ZoneCoupled_Basement, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaFieldNames(1), ErrorsFound); // Read in the some of the inputs into the local type for clarity during transition - thisDomain.Extents.yMax = state.dataIPShortCut->rNumericArgs(1); - Real64 const thisAspectRatio = state.dataIPShortCut->rNumericArgs(2); - thisDomain.PerimeterOffset = state.dataIPShortCut->rNumericArgs(3); - thisDomain.HorizInsWidth = state.dataIPShortCut->rNumericArgs(10); - thisDomain.VertInsDepth = state.dataIPShortCut->rNumericArgs(12); + thisDomain.Extents.yMax = s_ipsc->rNumericArgs(1); + Real64 const thisAspectRatio = s_ipsc->rNumericArgs(2); + thisDomain.PerimeterOffset = s_ipsc->rNumericArgs(3); + thisDomain.HorizInsWidth = s_ipsc->rNumericArgs(10); + thisDomain.VertInsDepth = s_ipsc->rNumericArgs(12); // Other inputs - thisDomain.Name = state.dataIPShortCut->cAlphaArgs(1); + thisDomain.Name = s_ipsc->cAlphaArgs(1); // Soil properties, validated min/max by IP - thisDomain.GroundProperties.Conductivity = state.dataIPShortCut->rNumericArgs(4); - thisDomain.GroundProperties.Density = state.dataIPShortCut->rNumericArgs(5); - thisDomain.GroundProperties.SpecificHeat = state.dataIPShortCut->rNumericArgs(6); + thisDomain.GroundProperties.Conductivity = s_ipsc->rNumericArgs(4); + thisDomain.GroundProperties.Density = s_ipsc->rNumericArgs(5); + thisDomain.GroundProperties.SpecificHeat = s_ipsc->rNumericArgs(6); // Moisture properties, validated min/max by IP, and converted to a fraction for computation here - thisDomain.Moisture.Theta_liq = state.dataIPShortCut->rNumericArgs(7) / 100.0; - thisDomain.Moisture.Theta_sat = state.dataIPShortCut->rNumericArgs(8) / 100.0; + thisDomain.Moisture.Theta_liq = s_ipsc->rNumericArgs(7) / 100.0; + thisDomain.Moisture.Theta_sat = s_ipsc->rNumericArgs(8) / 100.0; // check if there are blank inputs related to the basement, - if (state.dataIPShortCut->lNumericFieldBlanks(11) || state.dataIPShortCut->lAlphaFieldBlanks(5) || - state.dataIPShortCut->lAlphaFieldBlanks(10)) { - ShowSevereError(state, - format("Erroneous basement inputs for {}={}", ObjName_ZoneCoupled_Basement, state.dataIPShortCut->cAlphaArgs(1))); + if (s_ipsc->lNumericFieldBlanks(11) || s_ipsc->lAlphaFieldBlanks(5) || s_ipsc->lAlphaFieldBlanks(10)) { + ShowSevereError(state, format("Erroneous basement inputs for {}={}", ObjName_ZoneCoupled_Basement, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "At least one basement input was left blank."); ErrorsFound = true; } // Basement zone depth int CurIndex = 11; - thisDomain.BasementZone.Depth = state.dataIPShortCut->rNumericArgs(CurIndex); + thisDomain.BasementZone.Depth = s_ipsc->rNumericArgs(CurIndex); if (thisDomain.BasementZone.Depth >= thisDomain.Extents.yMax || thisDomain.BasementZone.Depth <= 0.0) { - ShowSevereError(state, format("Invalid {}", state.dataIPShortCut->cNumericFieldNames(CurIndex))); + ShowSevereError(state, format("Invalid {}", s_ipsc->cNumericFieldNames(CurIndex))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } // get boundary condition model names and indices --error check CurIndex = 4; - thisDomain.BasementZone.FloorBoundaryOSCMName = state.dataIPShortCut->cAlphaArgs(CurIndex); + thisDomain.BasementZone.FloorBoundaryOSCMName = s_ipsc->cAlphaArgs(CurIndex); thisDomain.BasementZone.FloorBoundaryOSCMIndex = Util::FindItemInList(thisDomain.BasementZone.FloorBoundaryOSCMName, state.dataSurface->OSCM); if (thisDomain.BasementZone.FloorBoundaryOSCMIndex <= 0) { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ZoneCoupled_Basement, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(CurIndex), - state.dataIPShortCut->cAlphaArgs(CurIndex), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(CurIndex), + s_ipsc->cAlphaArgs(CurIndex), "Could not match with an Other Side Conditions Model input object.", ErrorsFound); } else { @@ -1199,11 +1200,11 @@ namespace PlantPipingSystemsManager { if (floorIndexes.empty()) { IssueSevereInputFieldError( state, - RoutineName, + routineName, ObjName_ZoneCoupled_Basement, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(CurIndex), - state.dataIPShortCut->cAlphaArgs(CurIndex), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(CurIndex), + s_ipsc->cAlphaArgs(CurIndex), "Entry matched an Other Side Conditions Model, but no surfaces were found to be using this Other Side Conditions Model.", ErrorsFound); } else { @@ -1214,16 +1215,16 @@ namespace PlantPipingSystemsManager { } CurIndex = 8; - thisDomain.BasementZone.WallBoundaryOSCMName = state.dataIPShortCut->cAlphaArgs(CurIndex); + thisDomain.BasementZone.WallBoundaryOSCMName = s_ipsc->cAlphaArgs(CurIndex); thisDomain.BasementZone.WallBoundaryOSCMIndex = Util::FindItemInList(thisDomain.BasementZone.WallBoundaryOSCMName, state.dataSurface->OSCM); if (thisDomain.BasementZone.WallBoundaryOSCMIndex <= 0) { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ZoneCoupled_Basement, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(CurIndex), - state.dataIPShortCut->cAlphaArgs(CurIndex), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(CurIndex), + s_ipsc->cAlphaArgs(CurIndex), "Could not match with an Other Side Conditions Model input object.", ErrorsFound); ErrorsFound = true; @@ -1232,11 +1233,11 @@ namespace PlantPipingSystemsManager { if (wallIndexes.empty()) { IssueSevereInputFieldError( state, - RoutineName, + routineName, ObjName_ZoneCoupled_Basement, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(CurIndex), - state.dataIPShortCut->cAlphaArgs(CurIndex), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(CurIndex), + s_ipsc->cAlphaArgs(CurIndex), "Entry matched an Other Side Conditions Model, but no surfaces were found to be using this Other Side Conditions Model.", ErrorsFound); ErrorsFound = true; @@ -1250,14 +1251,14 @@ namespace PlantPipingSystemsManager { thisDomain.SimControls.MaxIterationsPerTS = 250; // additional evapotranspiration parameter, min/max validated by IP - thisDomain.Moisture.GroundCoverCoefficient = state.dataIPShortCut->rNumericArgs(9); + thisDomain.Moisture.GroundCoverCoefficient = s_ipsc->rNumericArgs(9); // assign the mesh count int meshCount; - if (state.dataIPShortCut->lNumericFieldBlanks(13)) { + if (s_ipsc->lNumericFieldBlanks(13)) { meshCount = 4; } else { - meshCount = static_cast(state.dataIPShortCut->rNumericArgs(13)); + meshCount = static_cast(s_ipsc->rNumericArgs(13)); } thisDomain.Mesh.X.RegionMeshCount = meshCount; thisDomain.Mesh.Y.RegionMeshCount = meshCount; @@ -1273,62 +1274,60 @@ namespace PlantPipingSystemsManager { thisDomain.BasementInterfaceProperties.Density = 1.0; // set flag for horizontal insulation - // Check state.dataIPShortCut->cAlphaArgs value - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "NO")) { + // Check s_ipsc->cAlphaArgs value + if (Util::SameString(s_ipsc->cAlphaArgs(5), "NO")) { thisDomain.HorizInsPresentFlag = false; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "YES")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(5), "YES")) { thisDomain.HorizInsPresentFlag = true; } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } // Get horizontal insulation material properties if (thisDomain.HorizInsPresentFlag) { - thisDomain.HorizInsMaterialNum = - Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(6), state.dataMaterial->Material, state.dataMaterial->TotMaterials); + thisDomain.HorizInsMaterialNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(6)); if (thisDomain.HorizInsMaterialNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); - ShowContinueError(state, format("Found in: {}", thisDomain.Name)); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); ErrorsFound = true; } else { - thisDomain.HorizInsThickness = state.dataMaterial->Material(thisDomain.HorizInsMaterialNum)->Thickness; - thisDomain.HorizInsProperties.Density = state.dataMaterial->Material(thisDomain.HorizInsMaterialNum)->Density; - thisDomain.HorizInsProperties.SpecificHeat = state.dataMaterial->Material(thisDomain.HorizInsMaterialNum)->SpecHeat; - thisDomain.HorizInsProperties.Conductivity = state.dataMaterial->Material(thisDomain.HorizInsMaterialNum)->Conductivity; + auto const *mat = s_mat->materials(thisDomain.HorizInsMaterialNum); + thisDomain.HorizInsThickness = mat->Thickness; + thisDomain.HorizInsProperties.Density = mat->Density; + thisDomain.HorizInsProperties.SpecificHeat = mat->SpecHeat; + thisDomain.HorizInsProperties.Conductivity = mat->Conductivity; if (SiteGroundDomainUsingNoMassMat(state, thisDomain.HorizInsThickness, thisDomain.HorizInsMaterialNum)) { ErrorsFound = true; - SiteGroundDomainNoMassMatError( - state, state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6), thisDomain.Name); + SiteGroundDomainNoMassMatError(state, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6), thisDomain.Name); } } // Set flag for horizontal insulation extents - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "PERIMETER")) { + if (Util::SameString(s_ipsc->cAlphaArgs(7), "PERIMETER")) { thisDomain.FullHorizInsPresent = false; // Horizontal insulation perimeter width if (thisDomain.HorizInsWidth <= 0.0) { - ShowSevereError(state, format("Invalid {}", state.dataIPShortCut->cNumericFieldNames(10))); + ShowSevereError(state, format("Invalid {}", s_ipsc->cNumericFieldNames(10))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "FULL")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(7), "FULL")) { thisDomain.FullHorizInsPresent = true; } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } } // set flag for vertical insulation - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "NO")) { + if (Util::SameString(s_ipsc->cAlphaArgs(9), "NO")) { thisDomain.VertInsPresentFlag = false; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "YES")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(9), "YES")) { thisDomain.VertInsPresentFlag = true; } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(9), s_ipsc->cAlphaArgs(9))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } @@ -1337,43 +1336,41 @@ namespace PlantPipingSystemsManager { if (thisDomain.VertInsPresentFlag) { // Check if vertical insulation is in domain if (thisDomain.VertInsDepth >= thisDomain.Extents.yMax || thisDomain.VertInsDepth <= 0.0) { - ShowSevereError(state, format("Invalid {}", state.dataIPShortCut->cNumericFieldNames(12))); + ShowSevereError(state, format("Invalid {}", s_ipsc->cNumericFieldNames(12))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } - thisDomain.VertInsMaterialNum = - Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(10), state.dataMaterial->Material, state.dataMaterial->TotMaterials); + thisDomain.VertInsMaterialNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(10)); if (thisDomain.VertInsMaterialNum == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(10), state.dataIPShortCut->cAlphaArgs(10))); - ShowContinueError(state, format("Found in: {}", thisDomain.Name)); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); ErrorsFound = true; } else { - thisDomain.VertInsThickness = state.dataMaterial->Material(thisDomain.VertInsMaterialNum)->Thickness; - thisDomain.VertInsProperties.Density = state.dataMaterial->Material(thisDomain.VertInsMaterialNum)->Density; - thisDomain.VertInsProperties.SpecificHeat = state.dataMaterial->Material(thisDomain.VertInsMaterialNum)->SpecHeat; - thisDomain.VertInsProperties.Conductivity = state.dataMaterial->Material(thisDomain.VertInsMaterialNum)->Conductivity; + auto const *mat = s_mat->materials(thisDomain.VertInsMaterialNum); + thisDomain.VertInsThickness = mat->Thickness; + thisDomain.VertInsProperties.Density = mat->Density; + thisDomain.VertInsProperties.SpecificHeat = mat->SpecHeat; + thisDomain.VertInsProperties.Conductivity = mat->Conductivity; if (SiteGroundDomainUsingNoMassMat(state, thisDomain.VertInsThickness, thisDomain.VertInsMaterialNum)) { ErrorsFound = true; - SiteGroundDomainNoMassMatError( - state, state.dataIPShortCut->cAlphaFieldNames(10), state.dataIPShortCut->cAlphaArgs(10), thisDomain.Name); + SiteGroundDomainNoMassMatError(state, s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10), thisDomain.Name); } } } // Set simulation interval flag - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(11), "TIMESTEP")) { + if (Util::SameString(s_ipsc->cAlphaArgs(11), "TIMESTEP")) { thisDomain.SimTimeStepFlag = true; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(11), "HOURLY")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(11), "HOURLY")) { thisDomain.SimHourlyFlag = true; } else { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(11), state.dataIPShortCut->cAlphaArgs(11))); + ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(11), s_ipsc->cAlphaArgs(11))); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); ErrorsFound = true; } // Farfield ground temperature model -- note this will overwrite the DataIPShortCuts variables // so any other processing below this line won't have access to the cAlphaArgs, etc., here - thisDomain.groundTempModel = GetGroundTempModelAndInit(state, state.dataIPShortCut->cAlphaArgs(2), state.dataIPShortCut->cAlphaArgs(3)); + thisDomain.groundTempModel = GetGroundTempModelAndInit(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(3)); // Total surface area Real64 ThisArea = 0.0; @@ -1395,7 +1392,7 @@ namespace PlantPipingSystemsManager { if (!thisDomain.FullHorizInsPresent && ThisArea > 0.0) { if ((thisDomain.HorizInsWidth + thisDomain.VertInsThickness) > thisDomain.BasementZone.Width / 2.0 || (thisDomain.HorizInsWidth + thisDomain.VertInsThickness) > thisDomain.BasementZone.Length / 2.0) { - ShowContinueError(state, format("{}: Perimeter insulation width is too large.", RoutineName)); + ShowContinueError(state, format("{}: Perimeter insulation width is too large.", routineName)); ShowContinueError(state, "This would cause overlapping insulation. Check inputs."); ShowContinueError(state, "Defaulting to full horizontal insulation."); ShowContinueError(state, format("Found in: {}", thisDomain.Name)); @@ -1418,7 +1415,7 @@ namespace PlantPipingSystemsManager { bool SiteGroundDomainUsingNoMassMat([[maybe_unused]] EnergyPlusData &state, Real64 const MaterialThickness, int const MaterialNum) { - if ((MaterialThickness <= 0.0) || (state.dataMaterial->Material(MaterialNum)->ROnly)) { + if ((MaterialThickness <= 0.0) || (state.dataMaterial->materials(MaterialNum)->ROnly)) { return true; } else { return false; @@ -1449,7 +1446,7 @@ namespace PlantPipingSystemsManager { // RE-ENGINEERED na // SUBROUTINE PARAMETER DEFINITIONS: - static constexpr std::string_view RoutineName("ReadPipeCircuitInputs"); + static constexpr std::string_view routineName = "ReadPipeCircuitInputs"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; @@ -1457,6 +1454,7 @@ namespace PlantPipingSystemsManager { int IOStatus; int CurIndex; + auto &s_ipsc = state.dataIPShortCut; // get all of the actual generalized pipe circuit objects int NumPipeCircuits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ObjName_Circuit); @@ -1466,52 +1464,52 @@ namespace PlantPipingSystemsManager { state.dataInputProcessing->inputProcessor->getObjectItem(state, ObjName_Circuit, PipeCircuitCounter, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); Circuit thisCircuit = Circuit(); // Get the name, validate - thisCircuit.Name = state.dataIPShortCut->cAlphaArgs(1); - Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); + thisCircuit.Name = s_ipsc->cAlphaArgs(1); + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); // Read pipe thermal properties, validated by IP - thisCircuit.PipeProperties.Conductivity = state.dataIPShortCut->rNumericArgs(1); - thisCircuit.PipeProperties.Density = state.dataIPShortCut->rNumericArgs(2); - thisCircuit.PipeProperties.SpecificHeat = state.dataIPShortCut->rNumericArgs(3); + thisCircuit.PipeProperties.Conductivity = s_ipsc->rNumericArgs(1); + thisCircuit.PipeProperties.Density = s_ipsc->rNumericArgs(2); + thisCircuit.PipeProperties.SpecificHeat = s_ipsc->rNumericArgs(3); // Read pipe sizing, validated individually by IP, validated comparison here - thisCircuit.PipeSize.InnerDia = state.dataIPShortCut->rNumericArgs(4); - thisCircuit.PipeSize.OuterDia = state.dataIPShortCut->rNumericArgs(5); + thisCircuit.PipeSize.InnerDia = s_ipsc->rNumericArgs(4); + thisCircuit.PipeSize.OuterDia = s_ipsc->rNumericArgs(5); if (thisCircuit.PipeSize.InnerDia >= thisCircuit.PipeSize.OuterDia) { CurIndex = 5; IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_Circuit, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(CurIndex), - state.dataIPShortCut->rNumericArgs(CurIndex), + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(CurIndex), + s_ipsc->rNumericArgs(CurIndex), "Outer diameter must be greater than inner diameter.", ErrorsFound); } // Read design flow rate, validated positive by IP - thisCircuit.DesignVolumeFlowRate = state.dataIPShortCut->rNumericArgs(6); + thisCircuit.DesignVolumeFlowRate = s_ipsc->rNumericArgs(6); // Read inlet and outlet node names and validate them - thisCircuit.InletNodeName = state.dataIPShortCut->cAlphaArgs(2); + thisCircuit.InletNodeName = s_ipsc->cAlphaArgs(2); thisCircuit.InletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(2), + s_ipsc->cAlphaArgs(2), ErrorsFound, DataLoopNode::ConnectionObjectType::PipingSystemUndergroundPipeCircuit, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, @@ -1519,20 +1517,20 @@ namespace PlantPipingSystemsManager { if (thisCircuit.InletNodeNum == 0) { CurIndex = 2; IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_Circuit, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(CurIndex), - state.dataIPShortCut->cAlphaArgs(CurIndex), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(CurIndex), + s_ipsc->cAlphaArgs(CurIndex), "Bad node name.", ErrorsFound); } - thisCircuit.OutletNodeName = state.dataIPShortCut->cAlphaArgs(3); + thisCircuit.OutletNodeName = s_ipsc->cAlphaArgs(3); thisCircuit.OutletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(3), + s_ipsc->cAlphaArgs(3), ErrorsFound, DataLoopNode::ConnectionObjectType::PipingSystemUndergroundPipeCircuit, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, @@ -1540,49 +1538,45 @@ namespace PlantPipingSystemsManager { if (thisCircuit.OutletNodeNum == 0) { CurIndex = 3; IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_Circuit, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(CurIndex), - state.dataIPShortCut->cAlphaArgs(CurIndex), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(CurIndex), + s_ipsc->cAlphaArgs(CurIndex), "Bad node name.", ErrorsFound); } - BranchNodeConnections::TestCompSet(state, - ObjName_Circuit, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaArgs(3), - "Piping System Circuit Nodes"); + BranchNodeConnections::TestCompSet( + state, ObjName_Circuit, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(3), "Piping System Circuit Nodes"); // Convergence tolerance values, validated by IP - thisCircuit.Convergence_CurrentToPrevIteration = state.dataIPShortCut->rNumericArgs(7); - thisCircuit.MaxIterationsPerTS = static_cast(state.dataIPShortCut->rNumericArgs(8)); + thisCircuit.Convergence_CurrentToPrevIteration = s_ipsc->rNumericArgs(7); + thisCircuit.MaxIterationsPerTS = static_cast(s_ipsc->rNumericArgs(8)); // Radial mesh inputs, validated by IP // -- mesh thickness should be considered slightly dangerous until mesh dev engine can trap erroneous values - thisCircuit.NumRadialCells = static_cast(state.dataIPShortCut->rNumericArgs(9)); - thisCircuit.RadialMeshThickness = state.dataIPShortCut->rNumericArgs(10); + thisCircuit.NumRadialCells = static_cast(s_ipsc->rNumericArgs(9)); + thisCircuit.RadialMeshThickness = s_ipsc->rNumericArgs(10); // Read number of pipe segments for this circuit, allocate arrays - int const NumPipeSegments = static_cast(state.dataIPShortCut->rNumericArgs(11)); + int const NumPipeSegments = static_cast(s_ipsc->rNumericArgs(11)); // Need to loop once to store the names ahead of time because calling the segment factory will override cAlphaArgs std::vector segmentNamesToFind; int constexpr NumAlphasBeforeSegmentOne = 3; for (int ThisCircuitPipeSegmentCounter = 1; ThisCircuitPipeSegmentCounter <= NumPipeSegments; ++ThisCircuitPipeSegmentCounter) { CurIndex = ThisCircuitPipeSegmentCounter + NumAlphasBeforeSegmentOne; - if (state.dataIPShortCut->lAlphaFieldBlanks(CurIndex)) { + if (s_ipsc->lAlphaFieldBlanks(CurIndex)) { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_Circuit, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(CurIndex), - state.dataIPShortCut->cAlphaArgs(CurIndex), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(CurIndex), + s_ipsc->cAlphaArgs(CurIndex), "Expected a pipe segment name, check pipe segment count input field.", ErrorsFound); } - segmentNamesToFind.push_back(state.dataIPShortCut->cAlphaArgs(CurIndex)); + segmentNamesToFind.push_back(s_ipsc->cAlphaArgs(CurIndex)); } // then we can loop through and allow the factory to be called and carry on for (auto &segmentNameToFind : segmentNamesToFind) { @@ -1604,35 +1598,33 @@ namespace PlantPipingSystemsManager { state.dataInputProcessing->inputProcessor->getObjectItem(state, ObjName_HorizTrench, HorizontalGHXCtr, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - std::string thisTrenchName = state.dataIPShortCut->cAlphaArgs(1); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + std::string thisTrenchName = s_ipsc->cAlphaArgs(1); Circuit thisCircuit; thisCircuit.IsActuallyPartOfAHorizontalTrench = true; thisCircuit.Name = thisTrenchName; // Read pipe thermal properties - thisCircuit.PipeProperties.Conductivity = state.dataIPShortCut->rNumericArgs(11); - thisCircuit.PipeProperties.Density = state.dataIPShortCut->rNumericArgs(12); - thisCircuit.PipeProperties.SpecificHeat = state.dataIPShortCut->rNumericArgs(13); + thisCircuit.PipeProperties.Conductivity = s_ipsc->rNumericArgs(11); + thisCircuit.PipeProperties.Density = s_ipsc->rNumericArgs(12); + thisCircuit.PipeProperties.SpecificHeat = s_ipsc->rNumericArgs(13); // Pipe sizing - thisCircuit.PipeSize.InnerDia = state.dataIPShortCut->rNumericArgs(5); - thisCircuit.PipeSize.OuterDia = state.dataIPShortCut->rNumericArgs(6); + thisCircuit.PipeSize.InnerDia = s_ipsc->rNumericArgs(5); + thisCircuit.PipeSize.OuterDia = s_ipsc->rNumericArgs(6); // Issue a severe if Inner >= Outer diameter if (thisCircuit.PipeSize.InnerDia >= thisCircuit.PipeSize.OuterDia) { - ShowSevereError( - state, - format("{}: {}=\"{}\" has invalid pipe diameters.", RoutineName, ObjName_HorizTrench, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}: {}=\"{}\" has invalid pipe diameters.", routineName, ObjName_HorizTrench, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Outer diameter [{:.3T}] must be greater than inner diameter [{:.3T}].", thisCircuit.PipeSize.OuterDia, @@ -1641,10 +1633,10 @@ namespace PlantPipingSystemsManager { } // Read design flow rate, validated positive by IP - thisCircuit.DesignVolumeFlowRate = state.dataIPShortCut->rNumericArgs(1); + thisCircuit.DesignVolumeFlowRate = s_ipsc->rNumericArgs(1); // Read inlet and outlet node names and validate them - thisCircuit.InletNodeName = state.dataIPShortCut->cAlphaArgs(2); + thisCircuit.InletNodeName = s_ipsc->cAlphaArgs(2); thisCircuit.InletNodeNum = NodeInputManager::GetOnlySingleNode(state, thisCircuit.InletNodeName, ErrorsFound, @@ -1654,7 +1646,7 @@ namespace PlantPipingSystemsManager { DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - thisCircuit.OutletNodeName = state.dataIPShortCut->cAlphaArgs(3); + thisCircuit.OutletNodeName = s_ipsc->cAlphaArgs(3); thisCircuit.OutletNodeNum = NodeInputManager::GetOnlySingleNode(state, thisCircuit.OutletNodeName, ErrorsFound, @@ -1736,6 +1728,8 @@ namespace PlantPipingSystemsManager { int IOStatus; // Used in GetObjectItem int CurIndex; + auto &s_ipsc = state.dataIPShortCut; + // Read in all pipe segments int NumPipeSegmentsInInput = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ObjName_Segment); for (int SegmentCtr = 1; SegmentCtr <= NumPipeSegmentsInInput; ++SegmentCtr) { @@ -1744,37 +1738,37 @@ namespace PlantPipingSystemsManager { state.dataInputProcessing->inputProcessor->getObjectItem(state, ObjName_Segment, SegmentCtr, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); Segment thisSegment; // Get the name, validate - thisSegment.Name = state.dataIPShortCut->cAlphaArgs(1); - Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); + thisSegment.Name = s_ipsc->cAlphaArgs(1); + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); // Read in the pipe location, validated as positive by IP // -- note that these values will be altered by the main GetInput routine in two ways: // 1) shift for basement wall if selected // 2) invert y direction to be measured from domain bottom surface for calculations - thisSegment.PipeLocation = PointF(state.dataIPShortCut->rNumericArgs(1), state.dataIPShortCut->rNumericArgs(2)); + thisSegment.PipeLocation = PointF(s_ipsc->rNumericArgs(1), s_ipsc->rNumericArgs(2)); // Read in the flow direction - thisSegment.FlowDirection = static_cast(getEnumValue(flowDirectionNamesUC, stripped(state.dataIPShortCut->cAlphaArgs(2)))); + thisSegment.FlowDirection = static_cast(getEnumValue(flowDirectionNamesUC, stripped(s_ipsc->cAlphaArgs(2)))); if (thisSegment.FlowDirection == SegmentFlow::Invalid) { CurIndex = 2; IssueSevereInputFieldError(state, RoutineName, ObjName_Segment, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(CurIndex), - state.dataIPShortCut->cAlphaArgs(CurIndex), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(CurIndex), + s_ipsc->cAlphaArgs(CurIndex), "Invalid flow direction, use one of the available keys.", ErrorsFound); } @@ -1800,6 +1794,8 @@ namespace PlantPipingSystemsManager { int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem + auto &s_ipsc = state.dataIPShortCut; + // initialize these counters properly so they can be incremented within the DO loop int DomainCtr = StartingDomainNumForHorizontal - 1; int CircuitCtr = StartingCircuitNumForHorizontal - 1; @@ -1821,25 +1817,25 @@ namespace PlantPipingSystemsManager { state.dataInputProcessing->inputProcessor->getObjectItem(state, ObjName_HorizTrench, HorizontalGHXCtr, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainCtr - 1]; // Get the name, validate - std::string thisTrenchName = state.dataIPShortCut->cAlphaArgs(1); - Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); + std::string thisTrenchName = s_ipsc->cAlphaArgs(1); + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); - int const NumPipeSegments = static_cast(state.dataIPShortCut->rNumericArgs(3)); - Real64 const thisInterPipeSpacing = state.dataIPShortCut->rNumericArgs(4); - Real64 const thisBurialDepth = state.dataIPShortCut->rNumericArgs(7); + int const NumPipeSegments = static_cast(s_ipsc->rNumericArgs(3)); + Real64 const thisInterPipeSpacing = s_ipsc->rNumericArgs(4); + Real64 const thisBurialDepth = s_ipsc->rNumericArgs(7); //******* We'll first set up the domain ******** // the extents will be: zMax = axial length; yMax = burial depth*2; xMax = ( NumPipes+1 )*HorizontalPipeSpacing @@ -1847,7 +1843,7 @@ namespace PlantPipingSystemsManager { thisDomain.Name = format("HorizontalTrenchDomain{:4}", HorizontalGHXCtr); thisDomain.Extents.xMax = (double(NumPipeSegments) + 1.0) * thisInterPipeSpacing; thisDomain.Extents.yMax = 2.0 * thisBurialDepth; - thisDomain.Extents.zMax = state.dataIPShortCut->rNumericArgs(2); + thisDomain.Extents.zMax = s_ipsc->rNumericArgs(2); // set up the mesh with some default parameters thisDomain.Mesh.X.RegionMeshCount = 4; @@ -1858,20 +1854,20 @@ namespace PlantPipingSystemsManager { thisDomain.Mesh.Z.thisMeshDistribution = MeshDistribution::Uniform; // Soil properties - thisDomain.GroundProperties.Conductivity = state.dataIPShortCut->rNumericArgs(8); - thisDomain.GroundProperties.Density = state.dataIPShortCut->rNumericArgs(9); - thisDomain.GroundProperties.SpecificHeat = state.dataIPShortCut->rNumericArgs(10); + thisDomain.GroundProperties.Conductivity = s_ipsc->rNumericArgs(8); + thisDomain.GroundProperties.Density = s_ipsc->rNumericArgs(9); + thisDomain.GroundProperties.SpecificHeat = s_ipsc->rNumericArgs(10); // Moisture properties - thisDomain.Moisture.Theta_liq = state.dataIPShortCut->rNumericArgs(14) / 100.0; - thisDomain.Moisture.Theta_sat = state.dataIPShortCut->rNumericArgs(15) / 100.0; + thisDomain.Moisture.Theta_liq = s_ipsc->rNumericArgs(14) / 100.0; + thisDomain.Moisture.Theta_sat = s_ipsc->rNumericArgs(15) / 100.0; // Other parameters thisDomain.SimControls.Convergence_CurrentToPrevIteration = 0.001; thisDomain.SimControls.MaxIterationsPerTS = 250; // additional evapotranspiration parameter, min/max validated by IP - thisDomain.Moisture.GroundCoverCoefficient = state.dataIPShortCut->rNumericArgs(16); + thisDomain.Moisture.GroundCoverCoefficient = s_ipsc->rNumericArgs(16); //******* We'll next set up the circuit ******** // then we can loop through and allow the factory to be called and carry on @@ -1879,7 +1875,7 @@ namespace PlantPipingSystemsManager { // Farfield model parameters -- this is pushed down pretty low because it internally calls GetObjectItem // using DataIPShortCuts, so it will overwrite the cAlphaArgs and rNumericArgs values - thisDomain.groundTempModel = GetGroundTempModelAndInit(state, state.dataIPShortCut->cAlphaArgs(4), state.dataIPShortCut->cAlphaArgs(5)); + thisDomain.groundTempModel = GetGroundTempModelAndInit(state, s_ipsc->cAlphaArgs(4), s_ipsc->cAlphaArgs(5)); //******* Then we'll do the segments *******! for (int ThisCircuitPipeSegmentCounter = 1; ThisCircuitPipeSegmentCounter <= NumPipeSegments; ++ThisCircuitPipeSegmentCounter) { diff --git a/src/EnergyPlus/ReportCoilSelection.cc b/src/EnergyPlus/ReportCoilSelection.cc index 6e4939172b0..defc4a2b2d2 100644 --- a/src/EnergyPlus/ReportCoilSelection.cc +++ b/src/EnergyPlus/ReportCoilSelection.cc @@ -757,7 +757,6 @@ void ReportCoilSelection::doFinalProcessingOfCoilData(EnergyPlusData &state) } // fill out some fan information HVAC::FanType locFanType = HVAC::FanType::Invalid; - bool errorsFound(false); if (c->supFanNum == 0) { c->supFanNum = Fans::GetFanIndex(state, c->fanAssociatedWithCoilName); } @@ -919,7 +918,6 @@ void ReportCoilSelection::associateZoneCoilWithParent(EnergyPlusData &state, std auto &thisSubEq = zoneEquipList.EquipData(equipLoop).SubEquipData; // search for coil and fan SubEquipData and return parent type/name and fan type/name for coil reports. - auto const &coilIterator = std::find_if(thisSubEq.begin(), thisSubEq.end(), thisSubCoilLambda); if (std::find_if(thisSubEq.begin(), thisSubEq.end(), thisSubCoilLambda) != thisSubEq.end()) { c->typeHVACname = zoneEquipList.EquipTypeName(equipLoop); c->userNameforHVACsystem = zoneEquipList.EquipName(equipLoop); diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 8c890593867..4d4057c42af 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -2707,12 +2707,9 @@ namespace RoomAir { // number.If incorrect name is given, errorsfound is returned as true and value is returned // as zero. - static constexpr std::string_view routineName = "CheckEquipName"; - // Return value bool EquipFind = false; // if true, equip is found - bool errorfound; int SupplyNodeNum = 0; int ReturnNodeNum = 0; @@ -2837,7 +2834,8 @@ namespace RoomAir { // SupplyNodeName = ""; // ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? May not use } break; - case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater: { // WaterHeater : HeatPump + case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeaterPumpedCondenser: + case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeaterWrappedCondenser: { // WaterHeater : HeatPump EquipIndex = WaterThermalTanks::getHeatPumpWaterHeaterIndex(state, EquipName); if (EquipIndex == 0) return EquipFind; ReturnNodeNum = state.dataWaterThermalTanks->HPWaterHeater(EquipIndex).HeatPumpAirInletNode; diff --git a/src/EnergyPlus/SQLiteProcedures.cc b/src/EnergyPlus/SQLiteProcedures.cc index 5cd1aa4d2b1..731e3ece0d8 100644 --- a/src/EnergyPlus/SQLiteProcedures.cc +++ b/src/EnergyPlus/SQLiteProcedures.cc @@ -196,8 +196,8 @@ void CreateSQLiteZoneExtendedOutput(EnergyPlusData &state) auto const &surface = state.dataSurface->Surface(surfaceNumber); state.dataSQLiteProcedures->sqlite->addSurfaceData(surfaceNumber, surface, DataSurfaces::cSurfaceClass(surface.Class)); } - for (int materialNum = 1; materialNum <= state.dataMaterial->TotMaterials; ++materialNum) { - state.dataSQLiteProcedures->sqlite->addMaterialData(materialNum, state.dataMaterial->Material(materialNum)); + for (int materialNum = 1; materialNum <= state.dataMaterial->materials.isize(); ++materialNum) { + state.dataSQLiteProcedures->sqlite->addMaterialData(materialNum, state.dataMaterial->materials(materialNum)); } for (int constructNum = 1; constructNum <= state.dataHeatBal->TotConstructs; ++constructNum) { auto const &construction = state.dataConstruction->Construct(constructNum); @@ -2224,6 +2224,8 @@ bool SQLite::ZoneGroup::insertIntoSQLite(sqlite3_stmt *insertStmt) } bool SQLite::Material::insertIntoSQLite(sqlite3_stmt *insertStmt) { + double isoMoistCap = 0.0; + double thermGradCoef = 0.0; sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindInteger(insertStmt, 3, static_cast(group)); diff --git a/src/EnergyPlus/SQLiteProcedures.hh b/src/EnergyPlus/SQLiteProcedures.hh index 3b57932ce61..db4a46761c1 100644 --- a/src/EnergyPlus/SQLiteProcedures.hh +++ b/src/EnergyPlus/SQLiteProcedures.hh @@ -569,8 +569,9 @@ private: EnergyPlus::Material::MaterialBase const *materialData) : SQLiteData(errorStream, db), number(materialNumber), name(materialData->Name), group(materialData->group), roughness(materialData->Roughness), conductivity(materialData->Conductivity), density(materialData->Density), - isoMoistCap(materialData->IsoMoistCap), porosity(materialData->Porosity), resistance(materialData->Resistance), - rOnly(materialData->ROnly), specHeat(materialData->SpecHeat), thermGradCoef(materialData->ThermGradCoef), + // isoMoistCap(materialData->IsoMoistCap), + porosity(materialData->Porosity), resistance(materialData->Resistance), rOnly(materialData->ROnly), specHeat(materialData->SpecHeat), + // thermGradCoef(materialData->ThermGradCoef), thickness(materialData->Thickness), vaporDiffus(materialData->VaporDiffus) { } @@ -584,12 +585,12 @@ private: EnergyPlus::Material::SurfaceRoughness const &roughness; double const &conductivity; double const &density; - double const &isoMoistCap; + // double const &isoMoistCap; double const &porosity; double const &resistance; bool const &rOnly; double const &specHeat; - double const &thermGradCoef; + // double const &thermGradCoef; double const &thickness; double const &vaporDiffus; }; diff --git a/src/EnergyPlus/SetPointManager.cc b/src/EnergyPlus/SetPointManager.cc index 80d0dfaaf40..3a186e22279 100644 --- a/src/EnergyPlus/SetPointManager.cc +++ b/src/EnergyPlus/SetPointManager.cc @@ -1497,14 +1497,14 @@ void VerifySetPointManagers(EnergyPlusData &state, [[maybe_unused]] bool &Errors // 3) For SET POINT MANAGER:RETURN AIR BYPASS FLOW // check for duplicate air loop names. - for (int iSPM = 1; iSPM <= (int)state.dataSetPointManager->spms.size(); ++iSPM) { + for (int iSPM = 1; iSPM <= state.dataSetPointManager->spms.isize(); ++iSPM) { auto const *spm = state.dataSetPointManager->spms(iSPM); // check for duplicate nodes in each setpoint managers control node list (node lists of size 1 do not need verification) // issue warning only since duplicate node names within a setpoint manager does not cause a conflict (i.e., same // value written to node) but may indicate an error in the node name. for (int iNode = 0; iNode < (int)spm->ctrlNodeNums.size() - 1; ++iNode) { - for (int jNode = iNode + 1; (int)jNode < spm->ctrlNodeNums.size(); ++jNode) { + for (int jNode = iNode + 1; jNode < (int)spm->ctrlNodeNums.size(); ++jNode) { if (spm->ctrlNodeNums[iNode] != spm->ctrlNodeNums[jNode]) continue; ShowWarningError(state, format("{} =\"{}\"", spmTypeNames[(int)spm->type], spm->Name)); ShowContinueError(state, format("...duplicate node specified = {}", state.dataLoopNodes->NodeID(spm->ctrlNodeNums[iNode]))); @@ -4539,7 +4539,7 @@ int GetMixedAirNumWithCoilFreezingCheck(EnergyPlusData &state, int const MixedAi state.dataSetPointManager->GetInputFlag = false; } - for (int iSPM = 1; iSPM <= state.dataSetPointManager->spms.size(); ++iSPM) { + for (int iSPM = 1; iSPM <= state.dataSetPointManager->spms.isize(); ++iSPM) { auto *const spm = state.dataSetPointManager->spms(iSPM); if (spm->type != SPMType::MixedAir) continue; diff --git a/src/EnergyPlus/SingleDuct.cc b/src/EnergyPlus/SingleDuct.cc index f00564541db..69f03474ac6 100644 --- a/src/EnergyPlus/SingleDuct.cc +++ b/src/EnergyPlus/SingleDuct.cc @@ -5275,14 +5275,14 @@ void SingleDuctAirTerminal::SimConstVolNoReheat(EnergyPlusData &state) } void SingleDuctAirTerminal::CalcVAVVS(EnergyPlusData &state, - bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step - int const ZoneNode, // zone node number - Real64 const HWFlow, // hot water flow (kg/s) - Real64 const HCoilReq, // gas or elec coil demand requested - HVAC::FanType fanType, // type of fan - Real64 const AirFlow, // air flow rate (kg/s) - int const FanOn, // 1 means fan is on - Real64 &LoadMet // load met by unit (watts) + bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step + int const ZoneNode, // zone node number + Real64 const HWFlow, // hot water flow (kg/s) + Real64 const HCoilReq, // gas or elec coil demand requested + [[maybe_unused]] HVAC::FanType fanType, // type of fan + Real64 const AirFlow, // air flow rate (kg/s) + int const FanOn, // 1 means fan is on + Real64 &LoadMet // load met by unit (watts) ) { diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 7458b06f22c..9aa58438b76 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -179,6 +179,7 @@ void InitSolarCalculations(EnergyPlusData &state) // All shadowing calculations have been grouped under this routine to // allow segmentation separating it from the hourly loads calculation. + auto &s_surf = state.dataSurface; #ifdef EP_Count_Calls ++state.dataTimingsData->NumInitSolar_Calls; #endif @@ -199,7 +200,7 @@ void InitSolarCalculations(EnergyPlusData &state) processShadowingInput(state); state.dataSolarShading->GetInputFlag = false; state.dataSolarShading->MaxHCV = - (((max(15, state.dataSurface->MaxVerticesPerSurface) + 16) / 16) * 16) - 1; // Assure MaxHCV+1 is multiple of 16 for 128 B alignment + (((max(15, s_surf->MaxVerticesPerSurface) + 16) / 16) * 16) - 1; // Assure MaxHCV+1 is multiple of 16 for 128 B alignment assert((state.dataSolarShading->MaxHCV + 1) % 16 == 0); } @@ -218,7 +219,7 @@ void InitSolarCalculations(EnergyPlusData &state) if (state.dataSolarShading->firstTime) DisplayString(state, "Computing Window Shade Absorption Factors"); ComputeWinShadeAbsorpFactors(state); - if (state.dataSurface->CalcSolRefl) { + if (s_surf->CalcSolRefl) { DisplayString(state, "Initializing Solar Reflection Factors"); InitSolReflRecSurf(state); } @@ -229,8 +230,8 @@ void InitSolarCalculations(EnergyPlusData &state) if (state.dataGlobal->BeginEnvrnFlag) { state.dataSolarShading->SurfSunCosTheta = 0.0; state.dataSolarShading->SurfSunlitArea = 0.0; - state.dataSurface->SurfSunlitArea = 0.0; - state.dataSurface->SurfSunlitFrac = 0.0; + s_surf->SurfSunlitArea = 0.0; + s_surf->SurfSunlitFrac = 0.0; state.dataHeatBal->SurfSunlitFracHR = 0.0; state.dataHeatBal->SurfSunlitFrac = 0.0; state.dataHeatBal->SurfSunlitFracWithoutReveal = 0.0; @@ -275,7 +276,7 @@ void InitSolarCalculations(EnergyPlusData &state) state.dataHeatBal->ZoneDifSolFrExtWinsRepEnergy(enclNum) = 0.0; state.dataHeatBal->ZoneDifSolFrIntWinsRepEnergy(enclNum) = 0.0; } - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { state.dataHeatBal->SurfQRadSWOutIncident(SurfNum) = 0.0; state.dataHeatBal->SurfQRadSWOutIncidentBeam(SurfNum) = 0.0; state.dataHeatBal->SurfBmIncInsSurfIntensRep(SurfNum) = 0.0; @@ -302,50 +303,50 @@ void InitSolarCalculations(EnergyPlusData &state) int const lastSurfWin = thisSpace.WindowSurfaceLast; for (int SurfNum = firstSurfWin; SurfNum <= lastSurfWin; ++SurfNum) { - state.dataSurface->SurfWinTransSolar(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolar(SurfNum) = 0.0; - state.dataSurface->SurfWinBmBmSolar(SurfNum) = 0.0; - state.dataSurface->SurfWinBmDifSolar(SurfNum) = 0.0; - state.dataSurface->SurfWinDifSolar(SurfNum) = 0.0; + s_surf->SurfWinTransSolar(SurfNum) = 0.0; + s_surf->SurfWinBmSolar(SurfNum) = 0.0; + s_surf->SurfWinBmBmSolar(SurfNum) = 0.0; + s_surf->SurfWinBmDifSolar(SurfNum) = 0.0; + s_surf->SurfWinDifSolar(SurfNum) = 0.0; - state.dataSurface->SurfWinTransSolarEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolarEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinBmBmSolarEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinBmDifSolarEnergy(SurfNum) = 0.0; + s_surf->SurfWinTransSolarEnergy(SurfNum) = 0.0; + s_surf->SurfWinBmSolarEnergy(SurfNum) = 0.0; + s_surf->SurfWinBmBmSolarEnergy(SurfNum) = 0.0; + s_surf->SurfWinBmDifSolarEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinHeatGain(SurfNum) = 0.0; - state.dataSurface->SurfWinHeatGainRep(SurfNum) = 0.0; - state.dataSurface->SurfWinHeatLossRep(SurfNum) = 0.0; + s_surf->SurfWinHeatGain(SurfNum) = 0.0; + s_surf->SurfWinHeatGainRep(SurfNum) = 0.0; + s_surf->SurfWinHeatLossRep(SurfNum) = 0.0; } for (int SurfNum = firstSurfWin; SurfNum <= lastSurfWin; ++SurfNum) { - state.dataSurface->SurfWinGainConvGlazToZoneRep(SurfNum) = 0.0; - state.dataSurface->SurfWinGainIRGlazToZoneRep(SurfNum) = 0.0; - state.dataSurface->SurfWinLossSWZoneToOutWinRep(SurfNum) = 0.0; - state.dataSurface->SurfWinGainFrameDividerToZoneRep(SurfNum) = 0.0; - state.dataSurface->SurfWinGainConvShadeToZoneRep(SurfNum) = 0.0; - state.dataSurface->SurfWinGainIRShadeToZoneRep(SurfNum) = 0.0; - state.dataSurface->SurfWinGapConvHtFlowRep(SurfNum) = 0.0; - state.dataSurface->SurfWinShadingAbsorbedSolar(SurfNum) = 0.0; - - state.dataSurface->SurfWinSysSolTransmittance(SurfNum) = 0.0; - state.dataSurface->SurfWinSysSolReflectance(SurfNum) = 0.0; - state.dataSurface->SurfWinSysSolAbsorptance(SurfNum) = 0.0; + s_surf->SurfWinGainConvGlazToZoneRep(SurfNum) = 0.0; + s_surf->SurfWinGainIRGlazToZoneRep(SurfNum) = 0.0; + s_surf->SurfWinLossSWZoneToOutWinRep(SurfNum) = 0.0; + s_surf->SurfWinGainFrameDividerToZoneRep(SurfNum) = 0.0; + s_surf->SurfWinGainConvShadeToZoneRep(SurfNum) = 0.0; + s_surf->SurfWinGainIRShadeToZoneRep(SurfNum) = 0.0; + s_surf->SurfWinGapConvHtFlowRep(SurfNum) = 0.0; + s_surf->SurfWinShadingAbsorbedSolar(SurfNum) = 0.0; + + s_surf->SurfWinSysSolTransmittance(SurfNum) = 0.0; + s_surf->SurfWinSysSolReflectance(SurfNum) = 0.0; + s_surf->SurfWinSysSolAbsorptance(SurfNum) = 0.0; } for (int SurfNum = firstSurfWin; SurfNum <= lastSurfWin; ++SurfNum) { - state.dataSurface->SurfWinDifSolarEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinHeatGainRepEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinHeatLossRepEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinGapConvHtFlowRepEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinShadingAbsorbedSolarEnergy(SurfNum) = 0.0; + s_surf->SurfWinDifSolarEnergy(SurfNum) = 0.0; + s_surf->SurfWinHeatGainRepEnergy(SurfNum) = 0.0; + s_surf->SurfWinHeatLossRepEnergy(SurfNum) = 0.0; + s_surf->SurfWinGapConvHtFlowRepEnergy(SurfNum) = 0.0; + s_surf->SurfWinShadingAbsorbedSolarEnergy(SurfNum) = 0.0; state.dataHeatBal->SurfWinQRadSWwinAbsTot(SurfNum) = 0.0; state.dataHeatBal->SurfWinQRadSWwinAbsTotEnergy(SurfNum) = 0.0; state.dataHeatBal->SurfWinSWwinAbsTotalReport(SurfNum) = 0.0; state.dataHeatBal->SurfWinInitialDifSolInTransReport(SurfNum) = 0.0; - state.dataSurface->SurfWinInsideGlassCondensationFlag(SurfNum) = 0; - state.dataSurface->SurfWinInsideFrameCondensationFlag(SurfNum) = 0; - state.dataSurface->SurfWinInsideDividerCondensationFlag(SurfNum) = 0; + s_surf->SurfWinInsideGlassCondensationFlag(SurfNum) = 0; + s_surf->SurfWinInsideFrameCondensationFlag(SurfNum) = 0; + s_surf->SurfWinInsideDividerCondensationFlag(SurfNum) = 0; } } } @@ -369,10 +370,12 @@ void InitSolarCalculations(EnergyPlusData &state) void checkShadingSurfaceSchedules(EnergyPlusData &state) { + auto &s_surf = state.dataSurface; + // Shading surfaces with a transmittance schedule that is always 1.0 are marked IsTransparent during shading surface input processing // Now that EMS (and other types) actuators are set up, check to see if the schedule has an actuator and reset if needed - for (int surfNum = state.dataSurface->ShadingSurfaceFirst; surfNum <= state.dataSurface->ShadingSurfaceLast; ++surfNum) { - auto &thisSurface = state.dataSurface->Surface(surfNum); + for (int surfNum = s_surf->ShadingSurfaceFirst; surfNum <= s_surf->ShadingSurfaceLast; ++surfNum) { + auto &thisSurface = s_surf->Surface(surfNum); if (!thisSurface.IsTransparent) continue; // creating some dummy bools here on purpose -- we need to do some renaming and/or consolidate these into a meaningful new global sometime // for now I want the logic to be as readable as possible, so creating shorthand variables makes it very clear @@ -385,7 +388,7 @@ void checkShadingSurfaceSchedules(EnergyPlusData &state) thisSurface.IsTransparent = false; // Also set global flags state.dataSolarShading->anyScheduledShadingSurface = true; - state.dataSurface->ShadingTransmittanceVaries = true; + s_surf->ShadingTransmittanceVaries = true; } else if (!thisSurface.MirroredSurf) { // Warning moved here from shading surface input processing (skip warning for mirrored surfaces) ShowWarningError(state, @@ -407,6 +410,8 @@ void GetShadowingInput(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // This subroutine gets the Shadowing Calculation object. + auto &s_surf = state.dataSurface; + // Using/Aliasing using DataSystemVariables::ShadingMethod; @@ -662,7 +667,7 @@ void GetShadowingInput(EnergyPlusData &state) state.dataSysVars->shadingGroupZoneListNames(numZone) = state.dataIPShortCut->cAlphaArgs(aNum - 1 + numZone); } - if (!state.dataSysVars->DetailedSolarTimestepIntegration && state.dataSurface->ShadingTransmittanceVaries && + if (!state.dataSysVars->DetailedSolarTimestepIntegration && s_surf->ShadingTransmittanceVaries && state.dataHeatBal->SolarDistribution != DataHeatBalance::Shadowing::Minimal) { ShowWarningError(state, "GetShadowingInput: The shading transmittance for shading devices may change throughout the year."); @@ -670,7 +675,7 @@ void GetShadowingInput(EnergyPlusData &state) format("Choose Shading Calculation Update Frequency Method = Timestep in the {} object to capture all shading impacts.", cCurrentModuleObject)); } - if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm && state.dataSurface->ShadingTransmittanceVaries && + if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm && s_surf->ShadingTransmittanceVaries && state.dataHeatBal->SolarDistribution != DataHeatBalance::Shadowing::Minimal) { ShowWarningError(state, "GetShadowingInput: The shading transmittance for shading devices may change throughout the year."); @@ -685,7 +690,7 @@ void GetShadowingInput(EnergyPlusData &state) cCurrentModuleObject)); } } else if (state.dataSysVars->DetailedSkyDiffuseAlgorithm) { - if (!state.dataSurface->ShadingTransmittanceVaries || state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { + if (!s_surf->ShadingTransmittanceVaries || state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { ShowWarningError(state, "GetShadowingInput: DetailedSkyDiffuseModeling is chosen but not needed as either the shading transmittance for " "shading devices does not change throughout the year"); @@ -851,22 +856,23 @@ void AllocateModuleArrays(EnergyPlusData &state) int I; int NumOfLayers; - int constexpr HoursInDay(24); - state.dataSolarShading->SurfSunCosTheta.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSolarShading->SurfSunlitArea.dimension(state.dataSurface->TotSurfaces, 0.0); + auto &s_surf = state.dataSurface; + + state.dataSolarShading->SurfSunCosTheta.dimension(s_surf->TotSurfaces, 0.0); + state.dataSolarShading->SurfSunlitArea.dimension(s_surf->TotSurfaces, 0.0); if (!state.dataWindowManager->inExtWindowModel->isExternalLibraryModel() || !state.dataWindowManager->winOpticalModel->isSimplifiedModel()) { - state.dataSolarShading->SurfWinIntBeamAbsByShadFac.allocate(state.dataSurface->TotSurfaces); - state.dataSolarShading->SurfWinExtBeamAbsByShadFac.allocate(state.dataSurface->TotSurfaces); - state.dataSolarShading->SurfWinTransBmSolar.allocate(state.dataSurface->TotSurfaces); - state.dataSolarShading->SurfWinTransDifSolar.allocate(state.dataSurface->TotSurfaces); - state.dataSolarShading->SurfWinTransDifSolarGnd.allocate(state.dataSurface->TotSurfaces); - state.dataSolarShading->SurfWinTransDifSolarSky.allocate(state.dataSurface->TotSurfaces); - state.dataSolarShading->SurfWinTransBmBmSolar.allocate(state.dataSurface->TotSurfaces); - state.dataSolarShading->SurfWinTransBmDifSolar.allocate(state.dataSurface->TotSurfaces); - } - state.dataSolarShading->SurfAnisoSkyMult.dimension(state.dataSurface->TotSurfaces, 1.0); - state.dataSolarShading->SurfIntAbsFac.dimension(state.dataSurface->TotSurfaces, 0.0); + state.dataSolarShading->SurfWinIntBeamAbsByShadFac.allocate(s_surf->TotSurfaces); + state.dataSolarShading->SurfWinExtBeamAbsByShadFac.allocate(s_surf->TotSurfaces); + state.dataSolarShading->SurfWinTransBmSolar.allocate(s_surf->TotSurfaces); + state.dataSolarShading->SurfWinTransDifSolar.allocate(s_surf->TotSurfaces); + state.dataSolarShading->SurfWinTransDifSolarGnd.allocate(s_surf->TotSurfaces); + state.dataSolarShading->SurfWinTransDifSolarSky.allocate(s_surf->TotSurfaces); + state.dataSolarShading->SurfWinTransBmBmSolar.allocate(s_surf->TotSurfaces); + state.dataSolarShading->SurfWinTransBmDifSolar.allocate(s_surf->TotSurfaces); + } + state.dataSolarShading->SurfAnisoSkyMult.dimension(s_surf->TotSurfaces, 1.0); + state.dataSolarShading->SurfIntAbsFac.dimension(s_surf->TotSurfaces, 0.0); // For isotropic sky: recalculated in AnisoSkyViewFactors if anisotropic radiance // ALLOCATE(WithShdgIsoSky(TotSurfaces)) // WithShdgIsoSky=0.0 @@ -880,75 +886,75 @@ void AllocateModuleArrays(EnergyPlusData &state) // DifShdgRatioIsoSky=0.0 // ALLOCATE(DifShdgRatioHoriz(TotSurfaces)) // DifShdgRatioHoriz=0.0 - state.dataSolarShading->SurfMultIsoSky.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSolarShading->SurfMultCircumSolar.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSolarShading->SurfMultHorizonZenith.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSolarShading->SurfWinRevealStatus.dimension(24, state.dataGlobal->NumOfTimeStepInHour, state.dataSurface->TotSurfaces, 0); + state.dataSolarShading->SurfMultIsoSky.dimension(s_surf->TotSurfaces, 0.0); + state.dataSolarShading->SurfMultCircumSolar.dimension(s_surf->TotSurfaces, 0.0); + state.dataSolarShading->SurfMultHorizonZenith.dimension(s_surf->TotSurfaces, 0.0); + state.dataSolarShading->SurfWinRevealStatus.dimension(24, state.dataGlobal->NumOfTimeStepInHour, s_surf->TotSurfaces, 0); // Weiler-Atherton - state.dataSolarShading->MAXHCArrayBounds = 2 * (state.dataSurface->MaxVerticesPerSurface + 1); - state.dataSolarShading->MAXHCArrayIncrement = state.dataSurface->MaxVerticesPerSurface + 1; - state.dataSolarShading->XTEMP.dimension(2 * (state.dataSurface->MaxVerticesPerSurface + 1), 0.0); - state.dataSolarShading->YTEMP.dimension(2 * (state.dataSurface->MaxVerticesPerSurface + 1), 0.0); - state.dataSolarShading->XVC.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); - state.dataSolarShading->XVS.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); - state.dataSolarShading->YVC.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); - state.dataSolarShading->YVS.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); - state.dataSolarShading->ZVC.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->MAXHCArrayBounds = 2 * (s_surf->MaxVerticesPerSurface + 1); + state.dataSolarShading->MAXHCArrayIncrement = s_surf->MaxVerticesPerSurface + 1; + state.dataSolarShading->XTEMP.dimension(2 * (s_surf->MaxVerticesPerSurface + 1), 0.0); + state.dataSolarShading->YTEMP.dimension(2 * (s_surf->MaxVerticesPerSurface + 1), 0.0); + state.dataSolarShading->XVC.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->XVS.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->YVC.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->YVS.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->ZVC.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); // Sutherland-Hodgman - state.dataSolarShading->ATEMP.dimension(2 * (state.dataSurface->MaxVerticesPerSurface + 1), 0.0); - state.dataSolarShading->BTEMP.dimension(2 * (state.dataSurface->MaxVerticesPerSurface + 1), 0.0); - state.dataSolarShading->CTEMP.dimension(2 * (state.dataSurface->MaxVerticesPerSurface + 1), 0.0); - state.dataSolarShading->XTEMP1.dimension(2 * (state.dataSurface->MaxVerticesPerSurface + 1), 0.0); - state.dataSolarShading->YTEMP1.dimension(2 * (state.dataSurface->MaxVerticesPerSurface + 1), 0.0); - - state.dataSurface->SurfSunCosHourly.allocate(HoursInDay); - for (int hour = 1; hour <= HoursInDay; hour++) { - state.dataSurface->SurfSunCosHourly(hour) = 0.0; - } - state.dataSurface->SurfSunlitArea.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfSunlitFrac.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfSkySolarInc.dimension(state.dataSurface->TotSurfaces, 0); - state.dataSurface->SurfGndSolarInc.dimension(state.dataSurface->TotSurfaces, 0); - state.dataSurface->SurfBmToBmReflFacObs.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfBmToDiffReflFacObs.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfBmToDiffReflFacGnd.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfSkyDiffReflFacGnd.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfOpaqAI.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfOpaqAO.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinTransSolar.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinBmSolar.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinBmBmSolar.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinBmDifSolar.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinDifSolar.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinHeatGain.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinHeatGainRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinHeatLossRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinGainConvGlazToZoneRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinGainIRGlazToZoneRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinLossSWZoneToOutWinRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinGainFrameDividerToZoneRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinGainConvShadeToZoneRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinGainIRShadeToZoneRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinGapConvHtFlowRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinShadingAbsorbedSolar.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinSysSolTransmittance.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinSysSolReflectance.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinSysSolAbsorptance.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinInsideGlassCondensationFlag.dimension(state.dataSurface->TotSurfaces, 0); - state.dataSurface->SurfWinInsideFrameCondensationFlag.dimension(state.dataSurface->TotSurfaces, 0); - state.dataSurface->SurfWinInsideDividerCondensationFlag.dimension(state.dataSurface->TotSurfaces, 0); - - state.dataHeatBal->SurfSunlitFracHR.dimension(HoursInDay, state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfSunlitFrac.dimension(HoursInDay, state.dataGlobal->NumOfTimeStepInHour, state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfSunlitFracWithoutReveal.dimension(HoursInDay, state.dataGlobal->NumOfTimeStepInHour, state.dataSurface->TotSurfaces, 0.0); + state.dataSolarShading->ATEMP.dimension(2 * (s_surf->MaxVerticesPerSurface + 1), 0.0); + state.dataSolarShading->BTEMP.dimension(2 * (s_surf->MaxVerticesPerSurface + 1), 0.0); + state.dataSolarShading->CTEMP.dimension(2 * (s_surf->MaxVerticesPerSurface + 1), 0.0); + state.dataSolarShading->XTEMP1.dimension(2 * (s_surf->MaxVerticesPerSurface + 1), 0.0); + state.dataSolarShading->YTEMP1.dimension(2 * (s_surf->MaxVerticesPerSurface + 1), 0.0); + + s_surf->SurfSunCosHourly.allocate(Constant::HoursInDay); + for (int hour = 1; hour <= Constant::HoursInDay; hour++) { + s_surf->SurfSunCosHourly(hour) = 0.0; + } + s_surf->SurfSunlitArea.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfSunlitFrac.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfSkySolarInc.dimension(s_surf->TotSurfaces, 0); + s_surf->SurfGndSolarInc.dimension(s_surf->TotSurfaces, 0); + s_surf->SurfBmToBmReflFacObs.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfBmToDiffReflFacObs.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfBmToDiffReflFacGnd.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfSkyDiffReflFacGnd.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfOpaqAI.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfOpaqAO.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinTransSolar.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinBmSolar.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinBmBmSolar.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinBmDifSolar.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinDifSolar.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinHeatGain.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinHeatGainRep.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinHeatLossRep.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinGainConvGlazToZoneRep.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinGainIRGlazToZoneRep.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinLossSWZoneToOutWinRep.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinGainFrameDividerToZoneRep.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinGainConvShadeToZoneRep.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinGainIRShadeToZoneRep.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinGapConvHtFlowRep.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinShadingAbsorbedSolar.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinSysSolTransmittance.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinSysSolReflectance.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinSysSolAbsorptance.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinInsideGlassCondensationFlag.dimension(s_surf->TotSurfaces, 0); + s_surf->SurfWinInsideFrameCondensationFlag.dimension(s_surf->TotSurfaces, 0); + s_surf->SurfWinInsideDividerCondensationFlag.dimension(s_surf->TotSurfaces, 0); + + state.dataHeatBal->SurfSunlitFracHR.dimension(Constant::HoursInDay, s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfSunlitFrac.dimension(Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfSunlitFracWithoutReveal.dimension(Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, s_surf->TotSurfaces, 0.0); state.dataHeatBal->SurfWinBackSurfaces.dimension( - HoursInDay, state.dataGlobal->NumOfTimeStepInHour, state.dataBSDFWindow->MaxBkSurf, state.dataSurface->TotSurfaces, 0); + Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, state.dataBSDFWindow->MaxBkSurf, s_surf->TotSurfaces, 0); state.dataHeatBal->SurfWinOverlapAreas.dimension( - HoursInDay, state.dataGlobal->NumOfTimeStepInHour, state.dataBSDFWindow->MaxBkSurf, state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfCosIncAngHR.dimension(HoursInDay, state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfCosIncAng.dimension(HoursInDay, state.dataGlobal->NumOfTimeStepInHour, state.dataSurface->TotSurfaces, 0.0); + Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, state.dataBSDFWindow->MaxBkSurf, s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfCosIncAngHR.dimension(Constant::HoursInDay, s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfCosIncAng.dimension(Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, s_surf->TotSurfaces, 0.0); state.dataHeatBal->ZoneTransSolar.dimension(state.dataViewFactor->NumOfSolarEnclosures, 0.0); state.dataHeatBal->ZoneBmSolFrExtWinsRep.dimension(state.dataViewFactor->NumOfSolarEnclosures, 0.0); @@ -966,54 +972,54 @@ void AllocateModuleArrays(EnergyPlusData &state) state.dataHeatBal->ZoneOpaqSurfExtFaceCondGainRep.dimension(state.dataGlobal->NumOfZones, 0.0); state.dataHeatBal->ZoneOpaqSurfExtFaceCondLossRep.dimension(state.dataGlobal->NumOfZones, 0.0); - state.dataHeatBal->SurfQRadSWOutIncident.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfQRadSWOutIncidentBeam.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfBmIncInsSurfIntensRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfBmIncInsSurfAmountRep.dimension(state.dataSurface->TotSurfaces, 0.0); + state.dataHeatBal->SurfQRadSWOutIncident.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfQRadSWOutIncidentBeam.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfBmIncInsSurfIntensRep.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfBmIncInsSurfAmountRep.dimension(s_surf->TotSurfaces, 0.0); // ALLOCATE(DifIncInsSurfIntensRep(TotSurfaces)) // DifIncInsSurfIntensRep=0.0 // ALLOCATE(DifIncInsSurfAmountRep(TotSurfaces)) // DifIncInsSurfAmountRep=0.0 - state.dataHeatBal->SurfIntBmIncInsSurfIntensRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfIntBmIncInsSurfAmountRep.dimension(state.dataSurface->TotSurfaces, 0.0); + state.dataHeatBal->SurfIntBmIncInsSurfIntensRep.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfIntBmIncInsSurfAmountRep.dimension(s_surf->TotSurfaces, 0.0); // ALLOCATE(IntDifIncInsSurfIntensRep(TotSurfaces)) // IntDifIncInsSurfIntensRep=0.0 // ALLOCATE(IntDifIncInsSurfAmountRep(TotSurfaces)) // IntDifIncInsSurfAmountRep=0.0 - state.dataHeatBal->SurfQRadSWOutIncidentSkyDiffuse.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfQRadSWOutIncidentGndDiffuse.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfQRadSWOutIncBmToDiffReflGnd.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfQRadSWOutIncSkyDiffReflGnd.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfQRadSWOutIncBmToBmReflObs.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfQRadSWOutIncBmToDiffReflObs.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfQRadSWOutIncSkyDiffReflObs.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfCosIncidenceAngle.dimension(state.dataSurface->TotSurfaces, 0.0); - - state.dataHeatBal->SurfWinBSDFBeamDirectionRep.dimension(state.dataSurface->TotSurfaces, 0); - state.dataHeatBal->SurfWinBSDFBeamThetaRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfWinBSDFBeamPhiRep.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfWinQRadSWwinAbsTot.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfWinQRadSWwinAbsLayer.dimension(state.dataSurface->TotSurfaces, state.dataHeatBal->MaxSolidWinLayers, 0.0); - state.dataHeatBal->SurfWinFenLaySurfTempFront.dimension(state.dataSurface->TotSurfaces, state.dataHeatBal->MaxSolidWinLayers, 0.0); - state.dataHeatBal->SurfWinFenLaySurfTempBack.dimension(state.dataSurface->TotSurfaces, state.dataHeatBal->MaxSolidWinLayers, 0.0); - - state.dataHeatBal->SurfWinSWwinAbsTotalReport.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfInitialDifSolInAbsReport.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfWinInitialDifSolInTransReport.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfSWInAbsTotalReport.dimension(state.dataSurface->TotSurfaces, 0.0); + state.dataHeatBal->SurfQRadSWOutIncidentSkyDiffuse.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfQRadSWOutIncidentGndDiffuse.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfQRadSWOutIncBmToDiffReflGnd.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfQRadSWOutIncSkyDiffReflGnd.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfQRadSWOutIncBmToBmReflObs.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfQRadSWOutIncBmToDiffReflObs.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfQRadSWOutIncSkyDiffReflObs.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfCosIncidenceAngle.dimension(s_surf->TotSurfaces, 0.0); + + state.dataHeatBal->SurfWinBSDFBeamDirectionRep.dimension(s_surf->TotSurfaces, 0); + state.dataHeatBal->SurfWinBSDFBeamThetaRep.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfWinBSDFBeamPhiRep.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfWinQRadSWwinAbsTot.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfWinQRadSWwinAbsLayer.dimension(s_surf->TotSurfaces, state.dataHeatBal->MaxSolidWinLayers, 0.0); + state.dataHeatBal->SurfWinFenLaySurfTempFront.dimension(s_surf->TotSurfaces, state.dataHeatBal->MaxSolidWinLayers, 0.0); + state.dataHeatBal->SurfWinFenLaySurfTempBack.dimension(s_surf->TotSurfaces, state.dataHeatBal->MaxSolidWinLayers, 0.0); + + state.dataHeatBal->SurfWinSWwinAbsTotalReport.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfInitialDifSolInAbsReport.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfWinInitialDifSolInTransReport.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfSWInAbsTotalReport.dimension(s_surf->TotSurfaces, 0.0); // energy - state.dataSurface->SurfWinTransSolarEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinBmSolarEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinBmBmSolarEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinBmDifSolarEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - - state.dataSurface->SurfWinDifSolarEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinHeatGainRepEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinHeatLossRepEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinGapConvHtFlowRepEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinHeatTransferRepEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSurface->SurfWinShadingAbsorbedSolarEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); + s_surf->SurfWinTransSolarEnergy.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinBmSolarEnergy.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinBmBmSolarEnergy.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinBmDifSolarEnergy.dimension(s_surf->TotSurfaces, 0.0); + + s_surf->SurfWinDifSolarEnergy.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinHeatGainRepEnergy.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinHeatLossRepEnergy.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinGapConvHtFlowRepEnergy.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinHeatTransferRepEnergy.dimension(s_surf->TotSurfaces, 0.0); + s_surf->SurfWinShadingAbsorbedSolarEnergy.dimension(s_surf->TotSurfaces, 0.0); state.dataHeatBal->ZoneTransSolarEnergy.dimension(state.dataViewFactor->NumOfSolarEnclosures, 0.0); state.dataHeatBal->ZoneBmSolFrExtWinsRepEnergy.dimension(state.dataViewFactor->NumOfSolarEnclosures, 0.0); @@ -1029,31 +1035,31 @@ void AllocateModuleArrays(EnergyPlusData &state) state.dataHeatBal->ZnOpqSurfExtFaceCondLsRepEnrg.dimension(state.dataGlobal->NumOfZones, 0.0); // ALLOCATE(DifIncInsSurfAmountRepEnergy(TotSurfaces)) // DifIncInsSurfAmountRepEnergy=0.0 - state.dataHeatBal->SurfBmIncInsSurfAmountRepEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBal->SurfIntBmIncInsSurfAmountRepEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); + state.dataHeatBal->SurfBmIncInsSurfAmountRepEnergy.dimension(s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfIntBmIncInsSurfAmountRepEnergy.dimension(s_surf->TotSurfaces, 0.0); // ALLOCATE(IntDifIncInsSurfAmountRepEnergy(TotSurfaces)) // IntDifIncInsSurfAmountRepEnergy=0.0 - state.dataHeatBal->SurfWinQRadSWwinAbsTotEnergy.dimension(state.dataSurface->TotSurfaces, 0.0); + state.dataHeatBal->SurfWinQRadSWwinAbsTotEnergy.dimension(s_surf->TotSurfaces, 0.0); - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) { - state.dataSurface->SurfWinBmSolAbsdOutsReveal(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolRefldOutsRevealReport(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolAbsdInsReveal(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolRefldInsReveal(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolRefldInsRevealReport(SurfNum) = 0.0; - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffOntoGlazing(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffIntoZone(SurfNum) = 0.0; - state.dataSurface->SurfWinOutsRevealDiffOntoFrame(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffOntoFrame(SurfNum) = 0.0; + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; SurfNum++) { + s_surf->SurfWinBmSolAbsdOutsReveal(SurfNum) = 0.0; + s_surf->SurfWinBmSolRefldOutsRevealReport(SurfNum) = 0.0; + s_surf->SurfWinBmSolAbsdInsReveal(SurfNum) = 0.0; + s_surf->SurfWinBmSolRefldInsReveal(SurfNum) = 0.0; + s_surf->SurfWinBmSolRefldInsRevealReport(SurfNum) = 0.0; + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffOntoGlazing(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffIntoZone(SurfNum) = 0.0; + s_surf->SurfWinOutsRevealDiffOntoFrame(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffOntoFrame(SurfNum) = 0.0; } // Added report variables for inside reveal to debug CR 7596. TH 5/26/2009 - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) { - state.dataSurface->SurfWinInsRevealDiffOntoGlazingReport(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffIntoZoneReport(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffOntoFrameReport(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolAbsdInsRevealReport(SurfNum) = 0.0; + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; SurfNum++) { + s_surf->SurfWinInsRevealDiffOntoGlazingReport(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffIntoZoneReport(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffOntoFrameReport(SurfNum) = 0.0; + s_surf->SurfWinBmSolAbsdInsRevealReport(SurfNum) = 0.0; } DisplayString(state, "Initializing Zone and Enclosure Report Variables"); @@ -1196,8 +1202,8 @@ void AllocateModuleArrays(EnergyPlusData &state) DisplayString(state, "Initializing Surface (Shading) Report Variables"); // CurrentModuleObject='Surfaces' - for (int SurfLoop = 1; SurfLoop <= state.dataSurface->TotSurfaces; ++SurfLoop) { - auto &surf = state.dataSurface->Surface(SurfLoop); + for (int SurfLoop = 1; SurfLoop <= s_surf->TotSurfaces; ++SurfLoop) { + auto &surf = s_surf->Surface(SurfLoop); SetupOutputVariable(state, "Surface Outside Normal Azimuth Angle", Constant::Units::deg, @@ -1209,14 +1215,14 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Outside Face Sunlit Area", Constant::Units::m2, - state.dataSurface->SurfSunlitArea(SurfLoop), + s_surf->SurfSunlitArea(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Outside Face Sunlit Fraction", Constant::Units::None, - state.dataSurface->SurfSunlitFrac(SurfLoop), + s_surf->SurfSunlitFrac(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1377,14 +1383,14 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinTransSolar(SurfLoop), + s_surf->SurfWinTransSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Transmitted Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmSolar(SurfLoop), + s_surf->SurfWinBmSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1393,14 +1399,14 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Beam To Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmBmSolar(SurfLoop), + s_surf->SurfWinBmBmSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Transmitted Beam To Diffuse Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmDifSolar(SurfLoop), + s_surf->SurfWinBmDifSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1408,42 +1414,42 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Diffuse Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinDifSolar(SurfLoop), + s_surf->SurfWinDifSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinHeatGainRep(SurfLoop), + s_surf->SurfWinHeatGainRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Heat Loss Rate", Constant::Units::W, - state.dataSurface->SurfWinHeatLossRep(SurfLoop), + s_surf->SurfWinHeatLossRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Gap Convective Heat Transfer Rate", Constant::Units::W, - state.dataSurface->SurfWinGapConvHtFlowRep(SurfLoop), + s_surf->SurfWinGapConvHtFlowRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Shading Device Absorbed Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinShadingAbsorbedSolar(SurfLoop), + s_surf->SurfWinShadingAbsorbedSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Net Heat Transfer Rate", Constant::Units::W, - state.dataSurface->SurfWinHeatGain(SurfLoop), + s_surf->SurfWinHeatGain(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1453,49 +1459,49 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Inside Face Glazing Zone Convection Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinGainConvGlazToZoneRep(SurfLoop), + s_surf->SurfWinGainConvGlazToZoneRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Glazing Net Infrared Heat Transfer Rate", Constant::Units::W, - state.dataSurface->SurfWinGainIRGlazToZoneRep(SurfLoop), + s_surf->SurfWinGainIRGlazToZoneRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Shortwave from Zone Back Out Window Heat Transfer Rate", Constant::Units::W, - state.dataSurface->SurfWinLossSWZoneToOutWinRep(SurfLoop), + s_surf->SurfWinLossSWZoneToOutWinRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Frame and Divider Zone Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinGainFrameDividerToZoneRep(SurfLoop), + s_surf->SurfWinGainFrameDividerToZoneRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Gap between Shade and Glazing Zone Convection Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinConvHeatFlowNatural(SurfLoop), + s_surf->SurfWinConvHeatFlowNatural(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Shade Zone Convection Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinGainConvShadeToZoneRep(SurfLoop), + s_surf->SurfWinGainConvShadeToZoneRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Shade Net Infrared Heat Transfer Rate", Constant::Units::W, - state.dataSurface->SurfWinGainIRShadeToZoneRep(SurfLoop), + s_surf->SurfWinGainIRShadeToZoneRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1503,7 +1509,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Inside Face Other Convection Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinOtherConvHeatGain(SurfLoop), + s_surf->SurfWinOtherConvHeatGain(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1512,18 +1518,18 @@ void AllocateModuleArrays(EnergyPlusData &state) // Added TH 12/23/2008 for thermochromic windows // CurrentModuleObject='Thermochromic Windows' - if (state.dataConstruction->Construct(surf.Construction).TCFlag == 1) { + if (state.dataConstruction->Construct(surf.Construction).isTCWindow) { SetupOutputVariable(state, "Surface Window Thermochromic Layer Temperature", Constant::Units::C, - state.dataSurface->SurfWinTCLayerTemp(SurfLoop), + s_surf->SurfWinTCLayerTemp(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Thermochromic Layer Property Specification Temperature", Constant::Units::C, - state.dataSurface->SurfWinSpecTemp(SurfLoop), + s_surf->SurfWinSpecTemp(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1532,84 +1538,84 @@ void AllocateModuleArrays(EnergyPlusData &state) // Added TH 5/26/2009 for switchable windows to report switching factor (tinted level) // CurrentModuleObject='Switchable Windows' if (surf.HasShadeControl) { - if (state.dataSurface->WindowShadingControl(surf.activeWindowShadingControl).ShadingType == WinShadingType::SwitchableGlazing) { + if (s_surf->WindowShadingControl(surf.activeWindowShadingControl).ShadingType == WinShadingType::SwitchableGlazing) { // IF (SurfaceWindow(SurfLoop)%ShadingFlag == WinShadingType::SwitchableGlazing) THEN !ShadingFlag is not set to // WinShadingType::SwitchableGlazing yet! SetupOutputVariable(state, "Surface Window Switchable Glazing Switching Factor", Constant::Units::None, - state.dataSurface->SurfWinSwitchingFactor(SurfLoop), + s_surf->SurfWinSwitchingFactor(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Switchable Glazing Visible Transmittance", Constant::Units::None, - state.dataSurface->SurfWinVisTransSelected(SurfLoop), + s_surf->SurfWinVisTransSelected(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); } } - if (state.dataSurface->SurfWinFrameArea(SurfLoop) > 0.0) { + if (s_surf->SurfWinFrameArea(SurfLoop) > 0.0) { // CurrentModuleObject='Window Frames' SetupOutputVariable(state, "Surface Window Frame Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinFrameHeatGain(SurfLoop), + s_surf->SurfWinFrameHeatGain(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Frame Heat Loss Rate", Constant::Units::W, - state.dataSurface->SurfWinFrameHeatLoss(SurfLoop), + s_surf->SurfWinFrameHeatLoss(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Frame Inside Temperature", Constant::Units::C, - state.dataSurface->SurfWinFrameTempIn(SurfLoop), + s_surf->SurfWinFrameTempIn(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Frame Outside Temperature", Constant::Units::C, - state.dataSurface->SurfWinFrameTempSurfOut(SurfLoop), + s_surf->SurfWinFrameTempSurfOut(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); } - if (state.dataSurface->SurfWinDividerArea(SurfLoop) > 0.0) { + if (s_surf->SurfWinDividerArea(SurfLoop) > 0.0) { // CurrentModuleObject='Window Dividers' SetupOutputVariable(state, "Surface Window Divider Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinDividerHeatGain(SurfLoop), + s_surf->SurfWinDividerHeatGain(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Divider Heat Loss Rate", Constant::Units::W, - state.dataSurface->SurfWinDividerHeatLoss(SurfLoop), + s_surf->SurfWinDividerHeatLoss(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Divider Inside Temperature", Constant::Units::C, - state.dataSurface->SurfWinDividerTempIn(SurfLoop), + s_surf->SurfWinDividerTempIn(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Divider Outside Temperature", Constant::Units::C, - state.dataSurface->SurfWinDividerTempSurfOut(SurfLoop), + s_surf->SurfWinDividerTempSurfOut(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1627,14 +1633,14 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinTransSolarEnergy(SurfLoop), + s_surf->SurfWinTransSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Transmitted Beam Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmSolarEnergy(SurfLoop), + s_surf->SurfWinBmSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -1643,14 +1649,14 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Beam To Beam Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmBmSolarEnergy(SurfLoop), + s_surf->SurfWinBmBmSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Transmitted Beam To Diffuse Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmDifSolarEnergy(SurfLoop), + s_surf->SurfWinBmDifSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -1658,42 +1664,42 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Diffuse Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinDifSolarEnergy(SurfLoop), + s_surf->SurfWinDifSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Heat Gain Energy", Constant::Units::J, - state.dataSurface->SurfWinHeatGainRepEnergy(SurfLoop), + s_surf->SurfWinHeatGainRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Heat Loss Energy", Constant::Units::J, - state.dataSurface->SurfWinHeatLossRepEnergy(SurfLoop), + s_surf->SurfWinHeatLossRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Gap Convective Heat Transfer Energy", Constant::Units::J, - state.dataSurface->SurfWinGapConvHtFlowRepEnergy(SurfLoop), + s_surf->SurfWinGapConvHtFlowRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Shading Device Absorbed Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinShadingAbsorbedSolarEnergy(SurfLoop), + s_surf->SurfWinShadingAbsorbedSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Net Heat Transfer Energy", Constant::Units::J, - state.dataSurface->SurfWinHeatTransferRepEnergy(SurfLoop), + s_surf->SurfWinHeatTransferRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -1701,42 +1707,42 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window System Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinSysSolTransmittance(SurfLoop), + s_surf->SurfWinSysSolTransmittance(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window System Solar Reflectance", Constant::Units::None, - state.dataSurface->SurfWinSysSolReflectance(SurfLoop), + s_surf->SurfWinSysSolReflectance(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window System Solar Absorptance", Constant::Units::None, - state.dataSurface->SurfWinSysSolAbsorptance(SurfLoop), + s_surf->SurfWinSysSolAbsorptance(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Glazing Condensation Status", Constant::Units::None, - state.dataSurface->SurfWinInsideGlassCondensationFlag(SurfLoop), + s_surf->SurfWinInsideGlassCondensationFlag(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Frame Condensation Status", Constant::Units::None, - state.dataSurface->SurfWinInsideFrameCondensationFlag(SurfLoop), + s_surf->SurfWinInsideFrameCondensationFlag(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Divider Condensation Status", Constant::Units::None, - state.dataSurface->SurfWinInsideDividerCondensationFlag(SurfLoop), + s_surf->SurfWinInsideDividerCondensationFlag(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1746,7 +1752,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Outside Reveal Reflected Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmSolRefldOutsRevealReport(SurfLoop), + s_surf->SurfWinBmSolRefldOutsRevealReport(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1754,18 +1760,18 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Outside Reveal Reflected Beam Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmSolRefldOutsRevealRepEnergy(SurfLoop), + s_surf->SurfWinBmSolRefldOutsRevealRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); // ENDIF // Inside reveal report variables - if (state.dataSurface->SurfWinInsideReveal(SurfLoop) > 0.0 || state.dataSurface->SurfWinInsideSillDepth(SurfLoop) > 0.0) { + if (s_surf->SurfWinInsideReveal(SurfLoop) > 0.0 || s_surf->SurfWinInsideSillDepth(SurfLoop) > 0.0) { SetupOutputVariable(state, "Surface Window Inside Reveal Reflected Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmSolRefldInsRevealReport(SurfLoop), + s_surf->SurfWinBmSolRefldInsRevealReport(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1773,7 +1779,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Inside Reveal Reflected Beam Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmSolRefldInsRevealRepEnergy(SurfLoop), + s_surf->SurfWinBmSolRefldInsRevealRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -1783,108 +1789,109 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Inside Reveal Absorbed Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmSolAbsdInsRevealReport(SurfLoop), + s_surf->SurfWinBmSolAbsdInsRevealReport(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Reveal Reflected Diffuse Zone Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinInsRevealDiffIntoZoneReport(SurfLoop), + s_surf->SurfWinInsRevealDiffIntoZoneReport(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Reveal Reflected Diffuse Frame Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinInsRevealDiffOntoFrameReport(SurfLoop), + s_surf->SurfWinInsRevealDiffOntoFrameReport(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Reveal Reflected Diffuse Glazing Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinInsRevealDiffOntoGlazingReport(SurfLoop), + s_surf->SurfWinInsRevealDiffOntoGlazingReport(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); } // Output blind report variables only when blinds are used - if (state.dataSurface->SurfWinBlindNumber(SurfLoop) > 0) { + auto &surfShade = s_surf->surfShades(SurfLoop); + if (surfShade.blind.matNum > 0) { // CurrentModuleObject='Window Blinds' SetupOutputVariable(state, "Surface Window Blind Beam to Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlTsolBmBm(SurfLoop), + s_surf->SurfWinBlTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Blind Beam to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlTsolBmDif(SurfLoop), + s_surf->SurfWinBlTsolBmDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Blind Diffuse to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlTsolDifDif(SurfLoop), + s_surf->SurfWinBlTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Blind and Glazing System Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlGlSysTsolBmBm(SurfLoop), + s_surf->SurfWinBlGlSysTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Blind and Glazing System Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlGlSysTsolDifDif(SurfLoop), + s_surf->SurfWinBlGlSysTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); } // Output screen report variables only when screens are used - if (state.dataSurface->SurfaceWindow(SurfLoop).screenNum > 0) { + if (s_surf->SurfaceWindow(SurfLoop).screenNum > 0) { // CurrentModuleObject='Window Screens' SetupOutputVariable(state, "Surface Window Screen Beam to Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScTsolBmBm(SurfLoop), + s_surf->SurfWinScTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Screen Beam to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScTsolBmDif(SurfLoop), + s_surf->SurfWinScTsolBmDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Screen Diffuse to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScTsolDifDif(SurfLoop), + s_surf->SurfWinScTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Screen and Glazing System Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScGlSysTsolBmBm(SurfLoop), + s_surf->SurfWinScGlSysTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Screen and Glazing System Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScGlSysTsolDifDif(SurfLoop), + s_surf->SurfWinScGlSysTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1894,42 +1901,42 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Solar Horizontal Profile Angle", Constant::Units::deg, - state.dataSurface->SurfWinProfileAngHor(SurfLoop), + s_surf->SurfWinProfileAngHor(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Solar Vertical Profile Angle", Constant::Units::deg, - state.dataSurface->SurfWinProfileAngVert(SurfLoop), + s_surf->SurfWinProfileAngVert(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Glazing Beam to Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinGlTsolBmBm(SurfLoop), + s_surf->SurfWinGlTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Glazing Beam to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinGlTsolBmDif(SurfLoop), + s_surf->SurfWinGlTsolBmDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Glazing Diffuse to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinGlTsolDifDif(SurfLoop), + s_surf->SurfWinGlTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Model Solver Iteration Count", Constant::Units::None, - state.dataSurface->SurfWinWindowCalcIterationsRep(SurfLoop), + s_surf->SurfWinWindowCalcIterationsRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1957,7 +1964,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinTransSolar(SurfLoop), + s_surf->SurfWinTransSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1965,7 +1972,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmSolar(SurfLoop), + s_surf->SurfWinBmSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1974,14 +1981,14 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Beam To Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmBmSolar(SurfLoop), + s_surf->SurfWinBmBmSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Transmitted Beam To Diffuse Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmDifSolar(SurfLoop), + s_surf->SurfWinBmDifSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -1989,94 +1996,94 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Diffuse Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinDifSolar(SurfLoop), + s_surf->SurfWinDifSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinHeatGainRep(SurfLoop), + s_surf->SurfWinHeatGainRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Heat Loss Rate", Constant::Units::W, - state.dataSurface->SurfWinHeatLossRep(SurfLoop), + s_surf->SurfWinHeatLossRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Gap Convective Heat Transfer Rate", Constant::Units::W, - state.dataSurface->SurfWinGapConvHtFlowRep(SurfLoop), + s_surf->SurfWinGapConvHtFlowRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Shading Device Absorbed Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinShadingAbsorbedSolar(SurfLoop), + s_surf->SurfWinShadingAbsorbedSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); - if (state.dataSurface->SurfWinFrameArea(SurfLoop) > 0.0) { + if (s_surf->SurfWinFrameArea(SurfLoop) > 0.0) { SetupOutputVariable(state, "Surface Window Frame Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinFrameHeatGain(SurfLoop), + s_surf->SurfWinFrameHeatGain(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Frame Heat Loss Rate", Constant::Units::W, - state.dataSurface->SurfWinFrameHeatLoss(SurfLoop), + s_surf->SurfWinFrameHeatLoss(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Frame Inside Temperature", Constant::Units::C, - state.dataSurface->SurfWinFrameTempIn(SurfLoop), + s_surf->SurfWinFrameTempIn(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Frame Outside Temperature", Constant::Units::C, - state.dataSurface->SurfWinFrameTempSurfOut(SurfLoop), + s_surf->SurfWinFrameTempSurfOut(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); } - if (state.dataSurface->SurfWinDividerArea(SurfLoop) > 0.0) { + if (s_surf->SurfWinDividerArea(SurfLoop) > 0.0) { SetupOutputVariable(state, "Surface Window Divider Heat Gain Rate", Constant::Units::W, - state.dataSurface->SurfWinDividerHeatGain(SurfLoop), + s_surf->SurfWinDividerHeatGain(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Divider Heat Loss Rate", Constant::Units::W, - state.dataSurface->SurfWinDividerHeatLoss(SurfLoop), + s_surf->SurfWinDividerHeatLoss(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Divider Inside Temperature", Constant::Units::C, - state.dataSurface->SurfWinDividerTempIn(SurfLoop), + s_surf->SurfWinDividerTempIn(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Divider Outside Temperature", Constant::Units::C, - state.dataSurface->SurfWinDividerTempSurfOut(SurfLoop), + s_surf->SurfWinDividerTempSurfOut(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -2097,7 +2104,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinTransSolarEnergy(SurfLoop), + s_surf->SurfWinTransSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -2105,7 +2112,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Beam Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmSolarEnergy(SurfLoop), + s_surf->SurfWinBmSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -2113,14 +2120,14 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Beam To Beam Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmBmSolarEnergy(SurfLoop), + s_surf->SurfWinBmBmSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Transmitted Beam To Diffuse Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmDifSolarEnergy(SurfLoop), + s_surf->SurfWinBmDifSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -2128,35 +2135,35 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Diffuse Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinDifSolarEnergy(SurfLoop), + s_surf->SurfWinDifSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Heat Gain Energy", Constant::Units::J, - state.dataSurface->SurfWinHeatGainRepEnergy(SurfLoop), + s_surf->SurfWinHeatGainRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Heat Loss Energy", Constant::Units::J, - state.dataSurface->SurfWinHeatLossRepEnergy(SurfLoop), + s_surf->SurfWinHeatLossRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Gap Convective Heat Transfer Energy", Constant::Units::J, - state.dataSurface->SurfWinGapConvHtFlowRepEnergy(SurfLoop), + s_surf->SurfWinGapConvHtFlowRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Shading Device Absorbed Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinShadingAbsorbedSolarEnergy(SurfLoop), + s_surf->SurfWinShadingAbsorbedSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -2164,56 +2171,56 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window System Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinSysSolTransmittance(SurfLoop), + s_surf->SurfWinSysSolTransmittance(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window System Solar Reflectance", Constant::Units::None, - state.dataSurface->SurfWinSysSolReflectance(SurfLoop), + s_surf->SurfWinSysSolReflectance(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window System Solar Absorptance", Constant::Units::None, - state.dataSurface->SurfWinSysSolAbsorptance(SurfLoop), + s_surf->SurfWinSysSolAbsorptance(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Glazing Condensation Status", Constant::Units::None, - state.dataSurface->SurfWinInsideGlassCondensationFlag(SurfLoop), + s_surf->SurfWinInsideGlassCondensationFlag(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Frame Condensation Status", Constant::Units::None, - state.dataSurface->SurfWinInsideFrameCondensationFlag(SurfLoop), + s_surf->SurfWinInsideFrameCondensationFlag(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Face Divider Condensation Status", Constant::Units::None, - state.dataSurface->SurfWinInsideDividerCondensationFlag(SurfLoop), + s_surf->SurfWinInsideDividerCondensationFlag(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Outside Reveal Reflected Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmSolRefldOutsRevealReport(SurfLoop), + s_surf->SurfWinBmSolRefldOutsRevealReport(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Inside Reveal Reflected Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmSolRefldInsRevealReport(SurfLoop), + s_surf->SurfWinBmSolRefldInsRevealReport(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -2221,91 +2228,92 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Outside Reveal Reflected Beam Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmSolRefldOutsRevealRepEnergy(SurfLoop), + s_surf->SurfWinBmSolRefldOutsRevealRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); SetupOutputVariable(state, "Surface Window Inside Reveal Reflected Beam Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmSolRefldInsRevealRepEnergy(SurfLoop), + s_surf->SurfWinBmSolRefldInsRevealRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); // Output blind report variables only when blinds are used - if (state.dataSurface->SurfWinBlindNumber(SurfLoop) > 0) { + auto &surfShade = s_surf->surfShades(SurfLoop); + if (surfShade.blind.matNum > 0) { SetupOutputVariable(state, "Surface Window Blind Beam to Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlTsolBmBm(SurfLoop), + s_surf->SurfWinBlTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Blind Beam to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlTsolBmDif(SurfLoop), + s_surf->SurfWinBlTsolBmDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Blind Diffuse to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlTsolDifDif(SurfLoop), + s_surf->SurfWinBlTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Blind and Glazing System Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlGlSysTsolBmBm(SurfLoop), + s_surf->SurfWinBlGlSysTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Blind and Glazing System Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinBlGlSysTsolDifDif(SurfLoop), + s_surf->SurfWinBlGlSysTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); } // Output screen report variables only when screens are used - if (state.dataSurface->SurfaceWindow(SurfLoop).screenNum > 0) { + if (s_surf->SurfaceWindow(SurfLoop).screenNum > 0) { SetupOutputVariable(state, "Surface Window Screen Beam to Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScTsolBmBm(SurfLoop), + s_surf->SurfWinScTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Screen Beam to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScTsolBmDif(SurfLoop), + s_surf->SurfWinScTsolBmDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Screen Diffuse to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScTsolDifDif(SurfLoop), + s_surf->SurfWinScTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Screen and Glazing System Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScGlSysTsolBmBm(SurfLoop), + s_surf->SurfWinScGlSysTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Screen and Glazing System Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinScGlSysTsolDifDif(SurfLoop), + s_surf->SurfWinScGlSysTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -2314,42 +2322,42 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Solar Horizontal Profile Angle", Constant::Units::deg, - state.dataSurface->SurfWinProfileAngHor(SurfLoop), + s_surf->SurfWinProfileAngHor(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Solar Vertical Profile Angle", Constant::Units::deg, - state.dataSurface->SurfWinProfileAngVert(SurfLoop), + s_surf->SurfWinProfileAngVert(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Glazing Beam to Beam Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinGlTsolBmBm(SurfLoop), + s_surf->SurfWinGlTsolBmBm(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Glazing Beam to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinGlTsolBmDif(SurfLoop), + s_surf->SurfWinGlTsolBmDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Glazing Diffuse to Diffuse Solar Transmittance", Constant::Units::None, - state.dataSurface->SurfWinGlTsolDifDif(SurfLoop), + s_surf->SurfWinGlTsolDifDif(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); SetupOutputVariable(state, "Surface Window Model Solver Iteration Count", Constant::Units::None, - state.dataSurface->SurfWinWindowCalcIterationsRep(SurfLoop), + s_surf->SurfWinWindowCalcIterationsRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -2361,7 +2369,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Beam Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinBmSolTransThruIntWinRep(SurfLoop), + s_surf->SurfWinBmSolTransThruIntWinRep(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -2369,7 +2377,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Beam Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinBmSolTransThruIntWinRepEnergy(SurfLoop), + s_surf->SurfWinBmSolTransThruIntWinRepEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -2386,7 +2394,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinTransSolar(SurfLoop), + s_surf->SurfWinTransSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -2401,7 +2409,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinTransSolarEnergy(SurfLoop), + s_surf->SurfWinTransSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); @@ -2425,7 +2433,7 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Solar Radiation Rate", Constant::Units::W, - state.dataSurface->SurfWinTransSolar(SurfLoop), + s_surf->SurfWinTransSolar(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, surf.Name); @@ -2440,15 +2448,15 @@ void AllocateModuleArrays(EnergyPlusData &state) SetupOutputVariable(state, "Surface Window Transmitted Solar Radiation Energy", Constant::Units::J, - state.dataSurface->SurfWinTransSolarEnergy(SurfLoop), + s_surf->SurfWinTransSolarEnergy(SurfLoop), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Sum, surf.Name); } } - for (int SurfLoop = 1; SurfLoop <= state.dataSurface->TotSurfaces; ++SurfLoop) { - auto &surf = state.dataSurface->Surface(SurfLoop); + for (int SurfLoop = 1; SurfLoop <= s_surf->TotSurfaces; ++SurfLoop) { + auto &surf = s_surf->Surface(SurfLoop); if (!surf.HeatTransSurf) continue; // CurrentModuleObject='Surfaces' SetupOutputVariable(state, @@ -2594,6 +2602,8 @@ void AnisoSkyViewFactors(EnergyPlusData &state) Real64 ViewFactorSkyGeom; // Geometrical sky view factor Real64 constexpr cosine_tolerance(0.0001); + auto &s_surf = state.dataSurface; + #ifdef EP_Count_Calls ++state.dataTimingsData->NumAnisoSky_Calls; #endif @@ -2622,11 +2632,11 @@ void AnisoSkyViewFactors(EnergyPlusData &state) F1 = max(0.0, F11R[EpsilonBin] + F12R[EpsilonBin] * Delta + F13R[EpsilonBin] * ZenithAng); F2 = F21R[EpsilonBin] + F22R[EpsilonBin] * Delta + F23R[EpsilonBin] * ZenithAng; - for (int SurfNum : state.dataSurface->AllExtSolarSurfaceList) { + for (int SurfNum : s_surf->AllExtSolarSurfaceList) { - CosIncAngBeamOnSurface = state.dataEnvrn->SOLCOS(1) * state.dataSurface->Surface(SurfNum).OutNormVec(1) + - state.dataEnvrn->SOLCOS(2) * state.dataSurface->Surface(SurfNum).OutNormVec(2) + - state.dataEnvrn->SOLCOS(3) * state.dataSurface->Surface(SurfNum).OutNormVec(3); + CosIncAngBeamOnSurface = state.dataEnvrn->SOLCOS(1) * s_surf->Surface(SurfNum).OutNormVec(1) + + state.dataEnvrn->SOLCOS(2) * s_surf->Surface(SurfNum).OutNormVec(2) + + state.dataEnvrn->SOLCOS(3) * s_surf->Surface(SurfNum).OutNormVec(3); // So I believe this should only be a diagnostic error...the calcs should always be within -1,+1; it's just round-off that we need to trap // for @@ -2634,7 +2644,7 @@ void AnisoSkyViewFactors(EnergyPlusData &state) if (CosIncAngBeamOnSurface > (1.0 + cosine_tolerance)) { ShowSevereError(state, "Cosine of incident angle of beam solar on surface out of range...too high"); ShowContinueError(state, "This is a diagnostic error that should not be encountered under normal circumstances"); - ShowContinueError(state, format("Occurs on surface: {}", state.dataSurface->Surface(SurfNum).Name)); + ShowContinueError(state, format("Occurs on surface: {}", s_surf->Surface(SurfNum).Name)); ShowContinueError(state, format("Current value = {} ... should be within [-1, +1]", CosIncAngBeamOnSurface)); ShowFatalError(state, "Anisotropic solar calculation causes fatal error"); } @@ -2643,14 +2653,14 @@ void AnisoSkyViewFactors(EnergyPlusData &state) if (CosIncAngBeamOnSurface < (-1.0 - cosine_tolerance)) { ShowSevereError(state, "Cosine of incident angle of beam solar on surface out of range...too low"); ShowContinueError(state, "This is a diagnostic error that should not be encountered under normal circumstances"); - ShowContinueError(state, format("Occurs on surface: {}", state.dataSurface->Surface(SurfNum).Name)); + ShowContinueError(state, format("Occurs on surface: {}", s_surf->Surface(SurfNum).Name)); ShowContinueError(state, format("Current value = {} ... should be within [-1, +1]", CosIncAngBeamOnSurface)); ShowFatalError(state, "Anisotropic solar calculation causes fatal error"); } CosIncAngBeamOnSurface = -1.0; } - ViewFactorSkyGeom = state.dataSurface->Surface(SurfNum).ViewFactorSky; + ViewFactorSkyGeom = s_surf->Surface(SurfNum).ViewFactorSky; state.dataSolarShading->SurfMultIsoSky(SurfNum) = ViewFactorSkyGeom * (1.0 - F1); // 0.0871557 below corresponds to a zenith angle of 85 deg CircumSolarFac = max(0.0, CosIncAngBeamOnSurface) / max(0.0871557, CosZenithAng); @@ -2658,11 +2668,11 @@ void AnisoSkyViewFactors(EnergyPlusData &state) // irradiance significantly different from DifSolarRad when zenith angle is // above 85 deg. The following forces irradiance to be very close to DifSolarRad // in this case. - if (CircumSolarFac > 0.0 && CosZenithAng < 0.0871557 && state.dataSurface->Surface(SurfNum).Tilt < 2.0) CircumSolarFac = 1.0; + if (CircumSolarFac > 0.0 && CosZenithAng < 0.0871557 && s_surf->Surface(SurfNum).Tilt < 2.0) CircumSolarFac = 1.0; state.dataSolarShading->SurfMultCircumSolar(SurfNum) = F1 * CircumSolarFac; - state.dataSolarShading->SurfMultHorizonZenith(SurfNum) = F2 * state.dataSurface->Surface(SurfNum).SinTilt; + state.dataSolarShading->SurfMultHorizonZenith(SurfNum) = F2 * s_surf->Surface(SurfNum).SinTilt; - if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm || !state.dataSurface->ShadingTransmittanceVaries || + if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm || !s_surf->ShadingTransmittanceVaries || state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { state.dataSolarShading->SurfAnisoSkyMult(SurfNum) = state.dataSolarShading->SurfMultIsoSky(SurfNum) * state.dataSolarShading->SurfDifShdgRatioIsoSky(SurfNum) + @@ -2722,29 +2732,30 @@ void CHKBKS(EnergyPlusData &state, Vector CVec(0.0); // Vector perpendicular to surface at vertex 1 Vector DVec(0.0); // Vector from vertex 1 of first surface to vertex 'n' of second surface - NVRS = state.dataSurface->Surface(NRS).Sides; - NVBS = state.dataSurface->Surface(NBS).Sides; + auto &s_surf = state.dataSurface; + + NVRS = s_surf->Surface(NRS).Sides; + NVBS = s_surf->Surface(NBS).Sides; // SEE IF ANY VERTICES OF THE back surface ARE IN FRONT OF THE receiving surface for (N = 2; N < NVRS; N++) { - CVec += cross(state.dataSurface->Surface(NRS).Vertex(N) - state.dataSurface->Surface(NRS).Vertex(1), - state.dataSurface->Surface(NRS).Vertex((N + 1)) - state.dataSurface->Surface(NRS).Vertex(1)); + CVec += cross(s_surf->Surface(NRS).Vertex(N) - s_surf->Surface(NRS).Vertex(1), + s_surf->Surface(NRS).Vertex((N + 1)) - s_surf->Surface(NRS).Vertex(1)); } CVec /= (NVRS >= 3 ? NVRS : 3); for (N = 1; N <= NVBS; ++N) { - DVec = state.dataSurface->Surface(NBS).Vertex(N) - state.dataSurface->Surface(NRS).Vertex(1); + DVec = s_surf->Surface(NBS).Vertex(N) - s_surf->Surface(NRS).Vertex(1); DOTP = dot(CVec, DVec); if (DOTP > 0.0009) { ShowSevereError(state, "Problem in interior solar distribution calculation (CHKBKS)"); - ShowContinueError( - state, format(" Solar Distribution = FullInteriorExterior will not work in Zone={}", state.dataSurface->Surface(NRS).ZoneName)); + ShowContinueError(state, format(" Solar Distribution = FullInteriorExterior will not work in Zone={}", s_surf->Surface(NRS).ZoneName)); ShowContinueError(state, format(" because one or more of vertices, such as Vertex {} of back surface={}, is in front of receiving surface={}", N, - state.dataSurface->Surface(NBS).Name, - state.dataSurface->Surface(NRS).Name)); + s_surf->Surface(NBS).Name, + s_surf->Surface(NRS).Name)); ShowContinueError(state, format(" (Dot Product indicator={:20.4F})", DOTP)); ShowContinueError(state, " Check surface geometry; if OK, use Solar Distribution = FullExterior instead. Use Output:Diagnostics, " @@ -2791,9 +2802,11 @@ void CHKGSS(EnergyPlusData &state, CannotShade = true; + auto &s_surf = state.dataSurface; + // see if no point of shadow casting surface is above low point of receiving surface - auto const &surface_C = state.dataSurface->Surface(NSS); + auto const &surface_C = s_surf->Surface(NSS); if (surface_C.OutNormVec(3) > 0.9999) return; // Shadow Casting Surface is horizontal and facing upward auto const &vertex_C = surface_C.Vertex; Real64 ZMAX(vertex_C(1).z); @@ -2804,7 +2817,7 @@ void CHKGSS(EnergyPlusData &state, // SEE IF ANY VERTICES OF THE Shadow Casting Surface ARE ABOVE THE PLANE OF THE receiving surface - auto const &surface_R = state.dataSurface->Surface(NRS); + auto const &surface_R = s_surf->Surface(NRS); auto const &vertex_R = surface_R.Vertex; Vector const &vertex_R_2 = vertex_R(2); Vector const AVec = (vertex_R(1) - vertex_R_2); // Vector from vertex 2 to vertex 1 of receiving surface @@ -2898,10 +2911,12 @@ void CHKSBS(EnergyPlusData &state, Real64 BMAX; // INTEGER M + auto &s_surf = state.dataSurface; + if (state.dataSolarShading->CHKSBSOneTimeFlag) { - state.dataSolarShading->XVT.allocate(state.dataSurface->MaxVerticesPerSurface + 1); - state.dataSolarShading->YVT.allocate(state.dataSurface->MaxVerticesPerSurface + 1); - state.dataSolarShading->ZVT.allocate(state.dataSurface->MaxVerticesPerSurface + 1); + state.dataSolarShading->XVT.allocate(s_surf->MaxVerticesPerSurface + 1); + state.dataSolarShading->YVT.allocate(s_surf->MaxVerticesPerSurface + 1); + state.dataSolarShading->ZVT.allocate(s_surf->MaxVerticesPerSurface + 1); state.dataSolarShading->XVT = 0.0; state.dataSolarShading->YVT = 0.0; state.dataSolarShading->ZVT = 0.0; @@ -2931,10 +2946,10 @@ void CHKSBS(EnergyPlusData &state, // Put coordinates of the subsurface into clockwise sequence. - state.dataSolarShading->NVS = state.dataSurface->Surface(SBSNR).Sides; + state.dataSolarShading->NVS = s_surf->Surface(SBSNR).Sides; for (N = 1; N <= state.dataSolarShading->NVS; ++N) { - state.dataSolarShading->XVS(N) = state.dataSurface->ShadeV(SBSNR).XV(state.dataSolarShading->NVS + 1 - N); - state.dataSolarShading->YVS(N) = state.dataSurface->ShadeV(SBSNR).YV(state.dataSolarShading->NVS + 1 - N); + state.dataSolarShading->XVS(N) = s_surf->ShadeV(SBSNR).XV(state.dataSolarShading->NVS + 1 - N); + state.dataSolarShading->YVS(N) = s_surf->ShadeV(SBSNR).YV(state.dataSolarShading->NVS + 1 - N); } HTRANS1(state, NS1, state.dataSolarShading->NVS); @@ -2948,12 +2963,12 @@ void CHKSBS(EnergyPlusData &state, Out = false; // C COMPUTE COMPONENTS OF VECTOR // C NORMAL TO BASE SURFACE. - X1 = state.dataSurface->Surface(GRSNR).Vertex(1).x - state.dataSurface->Surface(GRSNR).Vertex(2).x; // XV(1,GRSNR)-XV(2,GRSNR) - Y1 = state.dataSurface->Surface(GRSNR).Vertex(1).y - state.dataSurface->Surface(GRSNR).Vertex(2).y; // YV(1,GRSNR)-YV(2,GRSNR) - Z1 = state.dataSurface->Surface(GRSNR).Vertex(1).z - state.dataSurface->Surface(GRSNR).Vertex(2).z; // ZV(1,GRSNR)-ZV(2,GRSNR) - X2 = state.dataSurface->Surface(GRSNR).Vertex(3).x - state.dataSurface->Surface(GRSNR).Vertex(2).x; // XV(3,GRSNR)-XV(2,GRSNR) - Y2 = state.dataSurface->Surface(GRSNR).Vertex(3).y - state.dataSurface->Surface(GRSNR).Vertex(2).y; // YV(3,GRSNR)-YV(2,GRSNR) - Z2 = state.dataSurface->Surface(GRSNR).Vertex(3).z - state.dataSurface->Surface(GRSNR).Vertex(2).z; // ZV(3,GRSNR)-ZV(2,GRSNR) + X1 = s_surf->Surface(GRSNR).Vertex(1).x - s_surf->Surface(GRSNR).Vertex(2).x; // XV(1,GRSNR)-XV(2,GRSNR) + Y1 = s_surf->Surface(GRSNR).Vertex(1).y - s_surf->Surface(GRSNR).Vertex(2).y; // YV(1,GRSNR)-YV(2,GRSNR) + Z1 = s_surf->Surface(GRSNR).Vertex(1).z - s_surf->Surface(GRSNR).Vertex(2).z; // ZV(1,GRSNR)-ZV(2,GRSNR) + X2 = s_surf->Surface(GRSNR).Vertex(3).x - s_surf->Surface(GRSNR).Vertex(2).x; // XV(3,GRSNR)-XV(2,GRSNR) + Y2 = s_surf->Surface(GRSNR).Vertex(3).y - s_surf->Surface(GRSNR).Vertex(2).y; // YV(3,GRSNR)-YV(2,GRSNR) + Z2 = s_surf->Surface(GRSNR).Vertex(3).z - s_surf->Surface(GRSNR).Vertex(2).z; // ZV(3,GRSNR)-ZV(2,GRSNR) BX = Y1 * Z2 - Y2 * Z1; BY = Z1 * X2 - Z2 * X1; BZ = X1 * Y2 - X2 * Y1; @@ -2962,13 +2977,9 @@ void CHKSBS(EnergyPlusData &state, // C if (std::abs(BX) == BMAX) { // write(outputfiledebug,*) ' looking bx-bmax',bmax - for (N = 1; N <= state.dataSurface->Surface(SBSNR).Sides; ++N) { // NV(SBSNR) - inside = polygon_contains_point(state.dataSurface->Surface(GRSNR).Sides, - state.dataSurface->Surface(GRSNR).Vertex, - state.dataSurface->Surface(SBSNR).Vertex(N), - true, - false, - false); + for (N = 1; N <= s_surf->Surface(SBSNR).Sides; ++N) { // NV(SBSNR) + inside = polygon_contains_point( + s_surf->Surface(GRSNR).Sides, s_surf->Surface(GRSNR).Vertex, s_surf->Surface(SBSNR).Vertex(N), true, false, false); if (!inside) { Out = true; // do m=1,surface(grsnr)%sides @@ -2996,13 +3007,9 @@ void CHKSBS(EnergyPlusData &state, } } else if (std::abs(BY) == BMAX) { // write(outputfiledebug,*) ' looking by-bmax',bmax - for (N = 1; N <= state.dataSurface->Surface(SBSNR).Sides; ++N) { // NV(SBSNR) - inside = polygon_contains_point(state.dataSurface->Surface(GRSNR).Sides, - state.dataSurface->Surface(GRSNR).Vertex, - state.dataSurface->Surface(SBSNR).Vertex(N), - false, - true, - false); + for (N = 1; N <= s_surf->Surface(SBSNR).Sides; ++N) { // NV(SBSNR) + inside = polygon_contains_point( + s_surf->Surface(GRSNR).Sides, s_surf->Surface(GRSNR).Vertex, s_surf->Surface(SBSNR).Vertex(N), false, true, false); if (!inside) { Out = true; // do m=1,surface(grsnr)%sides @@ -3030,13 +3037,9 @@ void CHKSBS(EnergyPlusData &state, } } else { // write(outputfiledebug,*) ' looking bz-bmax',bmax - for (N = 1; N <= state.dataSurface->Surface(SBSNR).Sides; ++N) { // NV(SBSNR) - inside = polygon_contains_point(state.dataSurface->Surface(GRSNR).Sides, - state.dataSurface->Surface(GRSNR).Vertex, - state.dataSurface->Surface(SBSNR).Vertex(N), - false, - false, - true); + for (N = 1; N <= s_surf->Surface(SBSNR).Sides; ++N) { // NV(SBSNR) + inside = polygon_contains_point( + s_surf->Surface(GRSNR).Sides, s_surf->Surface(GRSNR).Vertex, s_surf->Surface(SBSNR).Vertex(N), false, false, true); if (!inside) { Out = true; // do m=1,surface(grsnr)%sides @@ -3087,21 +3090,21 @@ void CHKSBS(EnergyPlusData &state, // TrackBaseSubSurround(SBSNR)%ErrIndex2) if (state.dataSolarShading->shd_stream) { *state.dataSolarShading->shd_stream << "==== Base does not Surround subsurface details ====\n"; - *state.dataSolarShading->shd_stream << "Surface=" << state.dataSurface->Surface(GRSNR).Name << ' ' + *state.dataSolarShading->shd_stream << "Surface=" << s_surf->Surface(GRSNR).Name << ' ' << state.dataSolarShading->cOverLapStatus(state.dataSolarShading->OverlapStatus) << '\n'; *state.dataSolarShading->shd_stream << "Surface#=" << std::setw(5) << GRSNR << " NSides=" << std::setw(5) - << state.dataSurface->Surface(GRSNR).Sides << '\n'; + << s_surf->Surface(GRSNR).Sides << '\n'; *state.dataSolarShading->shd_stream << std::fixed << std::setprecision(2); - for (N = 1; N <= state.dataSurface->Surface(GRSNR).Sides; ++N) { - Vector const &v(state.dataSurface->Surface(GRSNR).Vertex(N)); + for (N = 1; N <= s_surf->Surface(GRSNR).Sides; ++N) { + Vector const &v(s_surf->Surface(GRSNR).Vertex(N)); *state.dataSolarShading->shd_stream << "Vertex " << std::setw(5) << N << "=(" << std::setw(15) << v.x << ',' << std::setw(15) << v.y << ',' << std::setw(15) << v.z << ")\n"; } - *state.dataSolarShading->shd_stream << "SubSurface=" << state.dataSurface->Surface(SBSNR).Name << '\n'; + *state.dataSolarShading->shd_stream << "SubSurface=" << s_surf->Surface(SBSNR).Name << '\n'; *state.dataSolarShading->shd_stream << "Surface#=" << std::setw(5) << SBSNR << " NSides=" << std::setw(5) - << state.dataSurface->Surface(SBSNR).Sides << '\n'; - for (N = 1; N <= state.dataSurface->Surface(SBSNR).Sides; ++N) { - Vector const &v(state.dataSurface->Surface(SBSNR).Vertex(N)); + << s_surf->Surface(SBSNR).Sides << '\n'; + for (N = 1; N <= s_surf->Surface(SBSNR).Sides; ++N) { + Vector const &v(s_surf->Surface(SBSNR).Vertex(N)); *state.dataSolarShading->shd_stream << "Vertex " << std::setw(5) << N << "=(" << std::setw(15) << v.x << ',' << std::setw(15) << v.y << ',' << std::setw(15) << v.z << ")\n"; } @@ -3224,15 +3227,16 @@ void ComputeIntSolarAbsorpFactors(EnergyPlusData &state) Real64 TestFractSum; Real64 HorizAreaSum; + auto &s_surf = state.dataSurface; + for (int enclosureNum = 1; enclosureNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclosureNum) { auto &thisEnclosure = state.dataViewFactor->EnclSolInfo(enclosureNum); AreaSum = 0.0; TestFractSum = 0.0; for (int const SurfNum : thisEnclosure.SurfacePtr) { - if (state.dataHeatBal->Zone(state.dataSurface->Surface(SurfNum).Zone).OfType == StandardZone && - state.dataSurface->Surface(SurfNum).CosTilt < -0.5) { - AreaSum += state.dataSurface->Surface(SurfNum).Area; + if (state.dataHeatBal->Zone(s_surf->Surface(SurfNum).Zone).OfType == StandardZone && s_surf->Surface(SurfNum).CosTilt < -0.5) { + AreaSum += s_surf->Surface(SurfNum).Area; } } @@ -3252,22 +3256,19 @@ void ComputeIntSolarAbsorpFactors(EnergyPlusData &state) // only horizontal surfaces. ! !CR 8229, relaxed from -0.99 to -0.5 (Tilt > 154) // only horizontal surfaces. ! !CR8769 use ASHRAE std of >120, -0.9 to -0.5 (Tilt > 120) - if ((state.dataHeatBal->Zone(state.dataSurface->Surface(SurfNum).Zone).OfType != StandardZone || - state.dataSurface->Surface(SurfNum).CosTilt < -0.5) && - (state.dataHeatBal->Zone(state.dataSurface->Surface(SurfNum).Zone).OfType == StandardZone || - state.dataSurface->Surface(SurfNum).ExtBoundCond > 0)) { + if ((state.dataHeatBal->Zone(s_surf->Surface(SurfNum).Zone).OfType != StandardZone || s_surf->Surface(SurfNum).CosTilt < -0.5) && + (state.dataHeatBal->Zone(s_surf->Surface(SurfNum).Zone).OfType == StandardZone || s_surf->Surface(SurfNum).ExtBoundCond > 0)) { - int const ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); + int const ConstrNum = s_surf->SurfActiveConstruction(SurfNum); auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); // last minute V3.1 if (thisConstruct.TransDiff <= 0.0) { // Opaque surface if (AreaSum > 0.0) - state.dataSolarShading->SurfIntAbsFac(SurfNum) = - state.dataSurface->Surface(SurfNum).Area * thisConstruct.InsideAbsorpSolar / AreaSum; + state.dataSolarShading->SurfIntAbsFac(SurfNum) = s_surf->Surface(SurfNum).Area * thisConstruct.InsideAbsorpSolar / AreaSum; } else { // Window (floor windows are assumed to have no shading device and no divider, // and assumed to be non-switchable) AbsDiffTotWin = 0.0; - if (!state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).WindowTypeEQL) { + if (!state.dataConstruction->Construct(s_surf->Surface(SurfNum).Construction).WindowTypeEQL) { for (Lay = 1; Lay <= thisConstruct.TotGlassLayers; ++Lay) { AbsDiffTotWin += thisConstruct.AbsDiffBack(Lay); } @@ -3276,8 +3277,7 @@ void ComputeIntSolarAbsorpFactors(EnergyPlusData &state) AbsDiffTotWin += thisConstruct.AbsDiffBackEQL(Lay); } } - if (AreaSum > 0.0) - state.dataSolarShading->SurfIntAbsFac(SurfNum) = state.dataSurface->Surface(SurfNum).Area * AbsDiffTotWin / AreaSum; + if (AreaSum > 0.0) state.dataSolarShading->SurfIntAbsFac(SurfNum) = s_surf->Surface(SurfNum).Area * AbsDiffTotWin / AreaSum; } } // CR 8229 test ISABSF for problems @@ -3301,20 +3301,20 @@ void ComputeIntSolarAbsorpFactors(EnergyPlusData &state) // so as to not lose solar energy AreaSum = 0.0; for (int SurfNum : thisEnclosure.SurfacePtr) { - AreaSum += state.dataSurface->Surface(SurfNum).Area; + AreaSum += s_surf->Surface(SurfNum).Area; } for (int const SurfNum : thisEnclosure.SurfacePtr) { - int const ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); + int const ConstrNum = s_surf->SurfActiveConstruction(SurfNum); auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); if (thisConstruct.TransDiff <= 0.0) { // Opaque surface if (AreaSum > 0.0) state.dataSolarShading->SurfIntAbsFac(SurfNum) = - state.dataSurface->Surface(SurfNum).Area * thisConstruct.InsideAbsorpSolar / AreaSum; + s_surf->Surface(SurfNum).Area * thisConstruct.InsideAbsorpSolar / AreaSum; } else { // Window (floor windows are assumed to have no shading device and no divider, // and assumed to be non-switchable) AbsDiffTotWin = 0.0; - if (!state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).WindowTypeEQL) { + if (!state.dataConstruction->Construct(s_surf->Surface(SurfNum).Construction).WindowTypeEQL) { for (Lay = 1; Lay <= thisConstruct.TotGlassLayers; ++Lay) { AbsDiffTotWin += thisConstruct.AbsDiffBack(Lay); } @@ -3324,8 +3324,7 @@ void ComputeIntSolarAbsorpFactors(EnergyPlusData &state) } } - if (AreaSum > 0.0) - state.dataSolarShading->SurfIntAbsFac(SurfNum) = state.dataSurface->Surface(SurfNum).Area * AbsDiffTotWin / AreaSum; + if (AreaSum > 0.0) state.dataSolarShading->SurfIntAbsFac(SurfNum) = s_surf->Surface(SurfNum).Area * AbsDiffTotWin / AreaSum; } } } @@ -3456,15 +3455,17 @@ void CTRANS(EnergyPlusData &state, Real64 Ydif; // Intermediate Result Real64 Zdif; // Intermediate Result + auto &s_surf = state.dataSurface; + // Tuned - auto const &surface = state.dataSurface->Surface(NS); - auto const &base_surface = state.dataSurface->Surface(NGRS); + auto const &surface = s_surf->Surface(NS); + auto const &base_surface = s_surf->Surface(NGRS); auto const &base_lcsx = base_surface.lcsx; auto const &base_lcsy = base_surface.lcsy; auto const &base_lcsz = base_surface.lcsz; - Real64 const base_X0 = state.dataSurface->X0(NGRS); - Real64 const base_Y0 = state.dataSurface->Y0(NGRS); - Real64 const base_Z0 = state.dataSurface->Z0(NGRS); + Real64 const base_X0 = s_surf->X0(NGRS); + Real64 const base_Y0 = s_surf->Y0(NGRS); + Real64 const base_Z0 = s_surf->Z0(NGRS); NVT = surface.Sides; @@ -4219,6 +4220,8 @@ void CLIPPOLY(EnergyPlusData &state, Real64 W; // Normalization factor Real64 HFunct; + auto &s_surf = state.dataSurface; + #ifdef EP_Count_Calls ++state.dataTimingsData->NumClipPoly_Calls; #endif @@ -4346,8 +4349,8 @@ void CLIPPOLY(EnergyPlusData &state, } else { HFunct = XTEMP1_S * HCA_E + YTEMP1_S * HCB_E + HCC_E; - if (HFunct <= 0.0) { // Test vertex is not in the clipping plane - if (NVTEMP < 2 * (state.dataSurface->MaxVerticesPerSurface + 1)) { // avoid assigning to element outside of XTEMP array size + if (HFunct <= 0.0) { // Test vertex is not in the clipping plane + if (NVTEMP < 2 * (s_surf->MaxVerticesPerSurface + 1)) { // avoid assigning to element outside of XTEMP array size KK = NVTEMP; ++NVTEMP; Real64 const ATEMP_S(state.dataSolarShading->ATEMP(S)); @@ -4504,8 +4507,10 @@ void ORDER(EnergyPlusData &state, int N; // Vertex number int P; // Location of first slope to be sorted + auto &s_surf = state.dataSurface; + if (state.dataSolarShading->ORDERFirstTimeFlag) { - state.dataSolarShading->SLOPE.allocate(max(10, state.dataSurface->MaxVerticesPerSurface + 1)); + state.dataSolarShading->SLOPE.allocate(max(10, s_surf->MaxVerticesPerSurface + 1)); state.dataSolarShading->ORDERFirstTimeFlag = false; } // Determine left-most vertex. @@ -4771,6 +4776,8 @@ void CalcPerSolarBeam(EnergyPlusData &state, int iHour; // Hour index number int TS; // TimeStep Loop Countergit + auto &s_surf = state.dataSurface; + if (state.dataSolarShading->InitComplexOnce) InitComplexWindows(state); state.dataSolarShading->InitComplexOnce = false; @@ -4788,7 +4795,7 @@ void CalcPerSolarBeam(EnergyPlusData &state, int firstSurf = thisSpace.OpaqOrIntMassSurfaceFirst; int lastSurf = thisSpace.OpaqOrIntMassSurfaceLast; for (int surfNum = firstSurf; surfNum <= lastSurf; ++surfNum) { - state.dataSurface->SurfOpaqAO(surfNum) = 0.0; + s_surf->SurfOpaqAO(surfNum) = 0.0; } firstSurf = thisSpace.HTSurfaceFirst; lastSurf = thisSpace.HTSurfaceLast; @@ -4823,7 +4830,7 @@ void CalcPerSolarBeam(EnergyPlusData &state, } // for (spaceNum) } // for (zoneNum) - for (auto &e : state.dataSurface->SurfaceWindow) { + for (auto &e : s_surf->SurfaceWindow) { std::fill(e.OutProjSLFracMult.begin(), e.OutProjSLFracMult.end(), 1.0); std::fill(e.InOutProjSLFracMult.begin(), e.InOutProjSLFracMult.end(), 1.0); } @@ -4835,7 +4842,7 @@ void CalcPerSolarBeam(EnergyPlusData &state, int const lastSurf = thisSpace.HTSurfaceLast; for (int surfNum = firstSurf; surfNum <= lastSurf; ++surfNum) { state.dataSolarShading->SurfSunCosTheta(surfNum) = 0.0; - state.dataSurface->SurfOpaqAO(surfNum) = 0.0; + s_surf->SurfOpaqAO(surfNum) = 0.0; state.dataHeatBal->SurfSunlitFrac(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, surfNum) = 0.0; state.dataHeatBal->SurfSunlitFracWithoutReveal(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, surfNum) = 0.0; state.dataHeatBal->SurfSunlitFracHR(state.dataGlobal->HourOfDay, surfNum) = 0.0; @@ -4851,9 +4858,9 @@ void CalcPerSolarBeam(EnergyPlusData &state, } } - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - state.dataSurface->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay] = 1.0; - state.dataSurface->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay] = 1.0; + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + s_surf->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay] = 1.0; + s_surf->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay] = 1.0; } } @@ -4905,6 +4912,8 @@ void FigureSunCosines(EnergyPlusData &state, Real64 CurrentTime; // Current Time for passing to Solar Position Routine + auto &s_surf = state.dataSurface; + if (state.dataGlobal->NumOfTimeStepInHour != 1) { CurrentTime = double(iHour - 1) + double(iTimeStep) * (state.dataGlobal->TimeStepZone); } else { @@ -4914,9 +4923,9 @@ void FigureSunCosines(EnergyPlusData &state, // Save hourly values for use in DaylightingManager if (!state.dataSysVars->DetailedSolarTimestepIntegration) { - if (iTimeStep == state.dataGlobal->NumOfTimeStepInHour) state.dataSurface->SurfSunCosHourly(iHour) = state.dataSolarShading->SUNCOS; + if (iTimeStep == state.dataGlobal->NumOfTimeStepInHour) s_surf->SurfSunCosHourly(iHour) = state.dataSolarShading->SUNCOS; } else { - state.dataSurface->SurfSunCosHourly(iHour) = state.dataSolarShading->SUNCOS; + s_surf->SurfSunCosHourly(iHour) = state.dataSolarShading->SUNCOS; } // Save timestep values for use in WindowComplexManager state.dataBSDFWindow->SUNCOSTS(iTimeStep, iHour) = state.dataSolarShading->SUNCOS; @@ -4942,6 +4951,8 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const Real64 Fac1WithShdg; // Intermediate calculation factor, with shading Real64 FracIlluminated; // Fraction of surface area illuminated by a sky patch + auto &s_surf = state.dataSurface; + // Recover the sun direction from the array stored in previous loop state.dataSolarShading->SUNCOS = state.dataBSDFWindow->SUNCOSTS(iTimeStep, iHour); @@ -4949,10 +4960,10 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const if (state.dataSolarShading->SUNCOS(3) < DataEnvironment::SunIsUpValue) return; - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - state.dataSolarShading->SurfSunCosTheta(SurfNum) = state.dataSolarShading->SUNCOS(1) * state.dataSurface->Surface(SurfNum).OutNormVec(1) + - state.dataSolarShading->SUNCOS(2) * state.dataSurface->Surface(SurfNum).OutNormVec(2) + - state.dataSolarShading->SUNCOS(3) * state.dataSurface->Surface(SurfNum).OutNormVec(3); + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + state.dataSolarShading->SurfSunCosTheta(SurfNum) = state.dataSolarShading->SUNCOS(1) * s_surf->Surface(SurfNum).OutNormVec(1) + + state.dataSolarShading->SUNCOS(2) * s_surf->Surface(SurfNum).OutNormVec(2) + + state.dataSolarShading->SUNCOS(3) * s_surf->Surface(SurfNum).OutNormVec(3); if (!state.dataSysVars->DetailedSolarTimestepIntegration) { if (iTimeStep == state.dataGlobal->NumOfTimeStepInHour) state.dataHeatBal->SurfCosIncAngHR(iHour, SurfNum) = state.dataSolarShading->SurfSunCosTheta(SurfNum); @@ -4964,19 +4975,19 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const if ((state.dataSysVars->shadingMethod == ShadingMethod::Scheduled || state.dataSysVars->shadingMethod == ShadingMethod::Imported) && !state.dataGlobal->DoingSizing && state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather) { - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (state.dataSurface->Surface(SurfNum).SurfSchedExternalShadingFrac) { + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + if (s_surf->Surface(SurfNum).SurfSchedExternalShadingFrac) { state.dataHeatBal->SurfSunlitFrac(iHour, iTimeStep, SurfNum) = - LookUpScheduleValue(state, state.dataSurface->Surface(SurfNum).SurfExternalShadingSchInd, iHour, iTimeStep); + LookUpScheduleValue(state, s_surf->Surface(SurfNum).SurfExternalShadingSchInd, iHour, iTimeStep); } else { state.dataHeatBal->SurfSunlitFrac(iHour, iTimeStep, SurfNum) = 1.0; } } } else { SHADOW(state, iHour, iTimeStep); // Determine sunlit areas and solar multipliers for all surfaces. - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (state.dataSurface->Surface(SurfNum).Area >= 1.e-10) { - SurfArea = state.dataSurface->Surface(SurfNum).NetAreaShadowCalc; + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + if (s_surf->Surface(SurfNum).Area >= 1.e-10) { + SurfArea = s_surf->Surface(SurfNum).NetAreaShadowCalc; if (!state.dataSysVars->DetailedSolarTimestepIntegration) { if (iTimeStep == state.dataGlobal->NumOfTimeStepInHour) state.dataHeatBal->SurfSunlitFracHR(iHour, SurfNum) = state.dataSolarShading->SurfSunlitArea(SurfNum) / SurfArea; @@ -4994,9 +5005,9 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const } } // Note -- if not the below, values are set in SkyDifSolarShading routine (constant for simulation) - if (state.dataSysVars->DetailedSkyDiffuseAlgorithm && state.dataSurface->ShadingTransmittanceVaries && + if (state.dataSysVars->DetailedSkyDiffuseAlgorithm && s_surf->ShadingTransmittanceVaries && state.dataHeatBal->SolarDistribution != DataHeatBalance::Shadowing::Minimal) { - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { state.dataSolarShading->SurfWithShdgIsoSky(SurfNum) = 0.; state.dataSolarShading->SurfWoShdgIsoSky(SurfNum) = 0.; state.dataSolarShading->SurfWithShdgHoriz(SurfNum) = 0.; @@ -5010,21 +5021,20 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const state.dataSolarShading->SUNCOS(1) = state.dataSolarShading->cos_Phi[IPhi] * state.dataSolarShading->cos_Theta[ITheta]; state.dataSolarShading->SUNCOS(2) = state.dataSolarShading->cos_Phi[IPhi] * state.dataSolarShading->sin_Theta[ITheta]; - for (int SurfNum : state.dataSurface->AllExtSolAndShadingSurfaceList) { - state.dataSolarShading->SurfSunCosTheta(SurfNum) = - state.dataSolarShading->SUNCOS(1) * state.dataSurface->Surface(SurfNum).OutNormVec(1) + - state.dataSolarShading->SUNCOS(2) * state.dataSurface->Surface(SurfNum).OutNormVec(2) + - state.dataSolarShading->SUNCOS(3) * state.dataSurface->Surface(SurfNum).OutNormVec(3); + for (int SurfNum : s_surf->AllExtSolAndShadingSurfaceList) { + state.dataSolarShading->SurfSunCosTheta(SurfNum) = state.dataSolarShading->SUNCOS(1) * s_surf->Surface(SurfNum).OutNormVec(1) + + state.dataSolarShading->SUNCOS(2) * s_surf->Surface(SurfNum).OutNormVec(2) + + state.dataSolarShading->SUNCOS(3) * s_surf->Surface(SurfNum).OutNormVec(3); } SHADOW(state, iHour, iTimeStep); // Determine sunlit areas and solar multipliers for all surfaces. - for (int SurfNum : state.dataSurface->AllExtSolAndShadingSurfaceList) { + for (int SurfNum : s_surf->AllExtSolAndShadingSurfaceList) { if (state.dataSolarShading->SurfSunCosTheta(SurfNum) < 0.0) continue; Fac1WoShdg = state.dataSolarShading->cos_Phi[IPhi] * DThetaDPhi * state.dataSolarShading->SurfSunCosTheta(SurfNum); - SurfArea = state.dataSurface->Surface(SurfNum).NetAreaShadowCalc; + SurfArea = s_surf->Surface(SurfNum).NetAreaShadowCalc; if (SurfArea > Eps) { FracIlluminated = state.dataSolarShading->SurfSunlitArea(SurfNum) / SurfArea; } else { @@ -5043,10 +5053,10 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const } // End of Theta loop } // End of Phi loop - for (int SurfNum : state.dataSurface->AllExtSolAndShadingSurfaceList) { + for (int SurfNum : s_surf->AllExtSolAndShadingSurfaceList) { // Original conditions: - // if (!state.dataSurface->Surface(SurfNum).IsShadowing && - // (!state.dataSurface->Surface(SurfNum).HeatTransSurf || !state.dataSurface->Surface(SurfNum).ExtSolar)) + // if (!s_surf->Surface(SurfNum).IsShadowing && + // (!s_surf->Surface(SurfNum).HeatTransSurf || !s_surf->Surface(SurfNum).ExtSolar)) // continue; if (std::abs(state.dataSolarShading->SurfWoShdgIsoSky(SurfNum)) > Eps) { @@ -5080,14 +5090,14 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const } // test for shading surfaces - for (int SurfNum : state.dataSurface->AllExtSolWinWithFrameSurfaceList) { + for (int SurfNum : s_surf->AllExtSolWinWithFrameSurfaceList) { // For exterior windows with frame/divider that are partially or fully sunlit, // correct SunlitFrac due to shadowing of frame and divider projections onto window glass. // Note: if SunlitFrac = 0.0 the window is either completely shaded or the sun is in back // of the window; in either case, frame/divider shadowing doesn't have to be done. if (state.dataHeatBal->SurfSunlitFrac(iHour, iTimeStep, SurfNum) > 0.0) { - CalcFrameDividerShadow(state, SurfNum, state.dataSurface->Surface(SurfNum).FrameDivider, iHour); + CalcFrameDividerShadow(state, SurfNum, s_surf->Surface(SurfNum).FrameDivider, iHour); } } } @@ -5136,14 +5146,15 @@ void DetermineShadowingCombinations(EnergyPlusData &state) bool ShadowingSurf; // True if a receiving surface is a shadowing surface Array1D_bool CastingSurface; // tracking during setup of ShadowComb + auto &s_surf = state.dataSurface; + #ifdef EP_Count_Calls ++state.dataTimingsData->NumDetShadowCombs_Calls; #endif - state.dataShadowComb->ShadowComb.dimension(state.dataSurface->TotSurfaces, - ShadowingCombinations{}); // Set all elements to default constructed state + state.dataShadowComb->ShadowComb.dimension(s_surf->TotSurfaces, ShadowingCombinations{}); // Set all elements to default constructed state - CastingSurface.dimension(state.dataSurface->TotSurfaces, false); + CastingSurface.dimension(s_surf->TotSurfaces, false); state.dataSolarShading->HCA.dimension(2 * state.dataSolarShading->MaxHCS, state.dataSolarShading->MaxHCV + 1, 0); state.dataSolarShading->HCB.dimension(2 * state.dataSolarShading->MaxHCS, state.dataSolarShading->MaxHCV + 1, 0); @@ -5168,25 +5179,25 @@ void DetermineShadowingCombinations(EnergyPlusData &state) return; } - for (GRSNR = 1; GRSNR <= state.dataSurface->TotSurfaces; ++GRSNR) { // Loop through all surfaces (looking for potential receiving surfaces)... + for (GRSNR = 1; GRSNR <= s_surf->TotSurfaces; ++GRSNR) { // Loop through all surfaces (looking for potential receiving surfaces)... - ShadowingSurf = state.dataSurface->Surface(GRSNR).IsShadowing; + ShadowingSurf = s_surf->Surface(GRSNR).IsShadowing; NGSS = 0; NSBS = 0; NBKS = 0; - if (!ShadowingSurf && !state.dataSurface->Surface(GRSNR).HeatTransSurf) continue; + if (!ShadowingSurf && !s_surf->Surface(GRSNR).HeatTransSurf) continue; HTS = GRSNR; #ifndef EP_NO_OPENGL if (state.dataSolarShading->penumbra) { - bool skipSurface = state.dataSurface->Surface(GRSNR).MirroredSurf; + bool skipSurface = s_surf->Surface(GRSNR).MirroredSurf; // Penumbra doesn't need mirrored surfaces TODO: Don't bother creating them in the first place? // Skip interior surfaces if the other side has already been added to penumbra - if (state.dataSurface->Surface(GRSNR).ExtBoundCond > 0) { - if (state.dataSurface->SurfPenumbraID(state.dataSurface->Surface(GRSNR).ExtBoundCond) >= 0) { - state.dataSurface->SurfPenumbraID(GRSNR) = state.dataSurface->SurfPenumbraID(state.dataSurface->Surface(GRSNR).ExtBoundCond); + if (s_surf->Surface(GRSNR).ExtBoundCond > 0) { + if (s_surf->SurfPenumbraID(s_surf->Surface(GRSNR).ExtBoundCond) >= 0) { + s_surf->SurfPenumbraID(GRSNR) = s_surf->SurfPenumbraID(s_surf->Surface(GRSNR).ExtBoundCond); skipSurface = true; } } @@ -5195,10 +5206,10 @@ void DetermineShadowingCombinations(EnergyPlusData &state) // Add surfaces to penumbra... Penumbra::Polygon poly; - if (state.dataSurface->Surface(GRSNR).Reveal > 0.0) { - Real64 R = state.dataSurface->Surface(GRSNR).Reveal; - auto &norm = state.dataSurface->Surface(GRSNR).NewellSurfaceNormalVector; - auto &v = state.dataSurface->Surface(GRSNR).Vertex; + if (s_surf->Surface(GRSNR).Reveal > 0.0) { + Real64 R = s_surf->Surface(GRSNR).Reveal; + auto &norm = s_surf->Surface(GRSNR).NewellSurfaceNormalVector; + auto &v = s_surf->Surface(GRSNR).Vertex; for (unsigned i = 0; i < v.size(); ++i) { poly.push_back(v[i].x); poly.push_back(v[i].y); @@ -5228,36 +5239,36 @@ void DetermineShadowingCombinations(EnergyPlusData &state) rPoly.push_back(vPrev.y); rPoly.push_back(vPrev.z); - Penumbra::Surface rSurf(rPoly, fmt::format("{} reveal {}", state.dataSurface->Surface(GRSNR).Name, i)); + Penumbra::Surface rSurf(rPoly, fmt::format("{} reveal {}", s_surf->Surface(GRSNR).Name, i)); state.dataSolarShading->penumbra->add_surface(rSurf); } } else { - for (auto const &v : state.dataSurface->Surface(GRSNR).Vertex) { + for (auto const &v : s_surf->Surface(GRSNR).Vertex) { poly.push_back(v.x); poly.push_back(v.y); poly.push_back(v.z); } } - Penumbra::Surface pSurf(poly, state.dataSurface->Surface(GRSNR).Name); + Penumbra::Surface pSurf(poly, s_surf->Surface(GRSNR).Name); // Punch holes for subsurfaces - if (state.dataSurface->Surface(GRSNR).BaseSurf == GRSNR) { // Only look for subsurfaces on base surfaces - for (int subSurface = 1; subSurface <= state.dataSurface->TotSurfaces; ++subSurface) { - if (state.dataSurface->Surface(subSurface).BaseSurf != GRSNR) continue; // Ignore subsurfaces of other surfaces - if (!state.dataSurface->Surface(subSurface).HeatTransSurf) continue; // Skip non heat transfer subsurfaces - if (subSurface == GRSNR) continue; // Surface itself cannot be its own subsurface + if (s_surf->Surface(GRSNR).BaseSurf == GRSNR) { // Only look for subsurfaces on base surfaces + for (int subSurface = 1; subSurface <= s_surf->TotSurfaces; ++subSurface) { + if (s_surf->Surface(subSurface).BaseSurf != GRSNR) continue; // Ignore subsurfaces of other surfaces + if (!s_surf->Surface(subSurface).HeatTransSurf) continue; // Skip non heat transfer subsurfaces + if (subSurface == GRSNR) continue; // Surface itself cannot be its own subsurface Penumbra::Polygon subPoly; - if (state.dataSurface->Surface(subSurface).Reveal > 0.0) { - Real64 R = state.dataSurface->Surface(subSurface).Reveal; - auto &norm = state.dataSurface->Surface(subSurface).NewellSurfaceNormalVector; - for (auto const &v : state.dataSurface->Surface(subSurface).Vertex) { + if (s_surf->Surface(subSurface).Reveal > 0.0) { + Real64 R = s_surf->Surface(subSurface).Reveal; + auto &norm = s_surf->Surface(subSurface).NewellSurfaceNormalVector; + for (auto const &v : s_surf->Surface(subSurface).Vertex) { subPoly.push_back(v.x + norm.x * R); subPoly.push_back(v.y + norm.y * R); subPoly.push_back(v.z + norm.z * R); } } else { - for (auto const &v : state.dataSurface->Surface(subSurface).Vertex) { + for (auto const &v : s_surf->Surface(subSurface).Vertex) { subPoly.push_back(v.x); subPoly.push_back(v.y); subPoly.push_back(v.z); @@ -5267,41 +5278,41 @@ void DetermineShadowingCombinations(EnergyPlusData &state) pSurf.add_hole(subPoly); } } - state.dataSurface->SurfPenumbraID(GRSNR) = state.dataSolarShading->penumbra->add_surface(pSurf); - state.dataSolarShading->penumbraIDs.push_back(state.dataSurface->SurfPenumbraID(GRSNR)); + s_surf->SurfPenumbraID(GRSNR) = state.dataSolarShading->penumbra->add_surface(pSurf); + state.dataSolarShading->penumbraIDs.push_back(s_surf->SurfPenumbraID(GRSNR)); } } #endif - if (!ShadowingSurf && !state.dataSurface->Surface(GRSNR).ExtSolar) continue; // Skip surfaces with no external solar + if (!ShadowingSurf && !s_surf->Surface(GRSNR).ExtSolar) continue; // Skip surfaces with no external solar - if (!ShadowingSurf && state.dataSurface->Surface(GRSNR).BaseSurf != GRSNR) { // Skip subsurfaces (SBS) + if (!ShadowingSurf && s_surf->Surface(GRSNR).BaseSurf != GRSNR) { // Skip subsurfaces (SBS) continue; } // Get the lowest point of receiving surface - ZMIN = minval(state.dataSurface->Surface(GRSNR).Vertex, &Vector::z); + ZMIN = minval(s_surf->Surface(GRSNR).Vertex, &Vector::z); // Check every surface as a possible shadow casting surface ("SS" = shadow sending) NGSS = 0; if (state.dataHeatBal->SolarDistribution != DataHeatBalance::Shadowing::Minimal) { // Except when doing simplified exterior shadowing. - for (GSSNR = 1; GSSNR <= state.dataSurface->TotSurfaces; ++GSSNR) { // Loop through all surfaces, looking for ones that could shade GRSNR + for (GSSNR = 1; GSSNR <= s_surf->TotSurfaces; ++GSSNR) { // Loop through all surfaces, looking for ones that could shade GRSNR if (GSSNR == GRSNR) continue; // Receiving surface cannot shade itself - if ((state.dataSurface->Surface(GSSNR).HeatTransSurf) && (state.dataSurface->Surface(GSSNR).BaseSurf == GRSNR)) + if ((s_surf->Surface(GSSNR).HeatTransSurf) && (s_surf->Surface(GSSNR).BaseSurf == GRSNR)) continue; // A heat transfer subsurface of a receiving surface // cannot shade the receiving surface if (ShadowingSurf) { // If receiving surf is a shadowing surface exclude matching shadow surface as sending surface // IF((GSSNR == GRSNR+1 .AND. Surface(GSSNR)%Name(1:3) == 'Mir').OR. & // (GSSNR == GRSNR-1 .AND. Surface(GRSNR)%Name(1:3) == 'Mir')) CYCLE - if (((GSSNR == GRSNR + 1) && state.dataSurface->Surface(GSSNR).MirroredSurf) || - ((GSSNR == GRSNR - 1) && state.dataSurface->Surface(GRSNR).MirroredSurf)) + if (((GSSNR == GRSNR + 1) && s_surf->Surface(GSSNR).MirroredSurf) || + ((GSSNR == GRSNR - 1) && s_surf->Surface(GRSNR).MirroredSurf)) continue; } - if (state.dataSurface->Surface(GSSNR).BaseSurf == GRSNR) { // Shadowing subsurface of receiving surface + if (s_surf->Surface(GSSNR).BaseSurf == GRSNR) { // Shadowing subsurface of receiving surface ++NGSS; if (NGSS > state.dataSolarShading->MaxGSS) { @@ -5309,10 +5320,10 @@ void DetermineShadowingCombinations(EnergyPlusData &state) } GSS(NGSS) = GSSNR; - } else if ((state.dataSurface->Surface(GSSNR).BaseSurf == 0) || - ((state.dataSurface->Surface(GSSNR).BaseSurf == GSSNR) && - ((state.dataSurface->Surface(GSSNR).ExtBoundCond == ExternalEnvironment) || - state.dataSurface->Surface(GSSNR).ExtBoundCond == + } else if ((s_surf->Surface(GSSNR).BaseSurf == 0) || + ((s_surf->Surface(GSSNR).BaseSurf == GSSNR) && + ((s_surf->Surface(GSSNR).ExtBoundCond == ExternalEnvironment) || + s_surf->Surface(GSSNR).ExtBoundCond == OtherSideCondModeledExt))) { // Detached shadowing surface or | any other base surface // exposed to outside environment @@ -5329,13 +5340,12 @@ void DetermineShadowingCombinations(EnergyPlusData &state) } // ...end of surfaces DO loop (GSSNR) } else { // Simplified Distribution -- still check for Shading Subsurfaces - for (GSSNR = 1; GSSNR <= state.dataSurface->TotSurfaces; - ++GSSNR) { // Loop through all surfaces (looking for surfaces which could shade GRSNR) ... + for (GSSNR = 1; GSSNR <= s_surf->TotSurfaces; ++GSSNR) { // Loop through all surfaces (looking for surfaces which could shade GRSNR) ... if (GSSNR == GRSNR) continue; // Receiving surface cannot shade itself - if ((state.dataSurface->Surface(GSSNR).HeatTransSurf) && (state.dataSurface->Surface(GSSNR).BaseSurf == GRSNR)) - continue; // Skip heat transfer subsurfaces of receiving surface - if (state.dataSurface->Surface(GSSNR).BaseSurf == GRSNR) { // Shadowing subsurface of receiving surface + if ((s_surf->Surface(GSSNR).HeatTransSurf) && (s_surf->Surface(GSSNR).BaseSurf == GRSNR)) + continue; // Skip heat transfer subsurfaces of receiving surface + if (s_surf->Surface(GSSNR).BaseSurf == GRSNR) { // Shadowing subsurface of receiving surface ++NGSS; if (NGSS > state.dataSolarShading->MaxGSS) { GSS.redimension(state.dataSolarShading->MaxGSS *= 2, 0); @@ -5350,15 +5360,13 @@ void DetermineShadowingCombinations(EnergyPlusData &state) NSBS = 0; HasWindow = false; // legacy: IF (OSENV(HTS) > 10) WINDOW=.TRUE. -->Note: WINDOW was set true for roof ponds, solar walls, or other zones - for (SBSNR = 1; SBSNR <= state.dataSurface->TotSurfaces; - ++SBSNR) { // Loop through the surfaces yet again (looking for subsurfaces of GRSNR)... + for (SBSNR = 1; SBSNR <= s_surf->TotSurfaces; ++SBSNR) { // Loop through the surfaces yet again (looking for subsurfaces of GRSNR)... - if (!state.dataSurface->Surface(SBSNR).HeatTransSurf) continue; // Skip non heat transfer subsurfaces - if (SBSNR == GRSNR) continue; // Surface itself cannot be its own subsurface - if (state.dataSurface->Surface(SBSNR).BaseSurf != GRSNR) continue; // Ignore subsurfaces of other surfaces and other surfaces + if (!s_surf->Surface(SBSNR).HeatTransSurf) continue; // Skip non heat transfer subsurfaces + if (SBSNR == GRSNR) continue; // Surface itself cannot be its own subsurface + if (s_surf->Surface(SBSNR).BaseSurf != GRSNR) continue; // Ignore subsurfaces of other surfaces and other surfaces - if (state.dataConstruction->Construct(state.dataSurface->Surface(SBSNR).Construction).TransDiff > 0.0) - HasWindow = true; // Check for window + if (state.dataConstruction->Construct(s_surf->Surface(SBSNR).Construction).TransDiff > 0.0) HasWindow = true; // Check for window CHKSBS(state, HTS, GRSNR, SBSNR); // Check that the receiving surface completely encloses the subsurface; // severe error if not ++NSBS; @@ -5376,16 +5384,16 @@ void DetermineShadowingCombinations(EnergyPlusData &state) if ((state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::FullInteriorExterior) && (HasWindow)) { // For full interior solar distribution | and a window present on base surface (GRSNR) - for (BackSurfaceNumber = 1; BackSurfaceNumber <= state.dataSurface->TotSurfaces; + for (BackSurfaceNumber = 1; BackSurfaceNumber <= s_surf->TotSurfaces; ++BackSurfaceNumber) { // Loop through surfaces yet again, looking for back surfaces to GRSNR - if (!state.dataSurface->Surface(BackSurfaceNumber).HeatTransSurf) continue; // Skip non-heat transfer surfaces - if (state.dataSurface->Surface(BackSurfaceNumber).BaseSurf == GRSNR) continue; // Skip subsurfaces of this GRSNR - if (BackSurfaceNumber == GRSNR) continue; // A back surface cannot be GRSNR itself - if (state.dataSurface->Surface(BackSurfaceNumber).SolarEnclIndex != state.dataSurface->Surface(GRSNR).SolarEnclIndex) + if (!s_surf->Surface(BackSurfaceNumber).HeatTransSurf) continue; // Skip non-heat transfer surfaces + if (s_surf->Surface(BackSurfaceNumber).BaseSurf == GRSNR) continue; // Skip subsurfaces of this GRSNR + if (BackSurfaceNumber == GRSNR) continue; // A back surface cannot be GRSNR itself + if (s_surf->Surface(BackSurfaceNumber).SolarEnclIndex != s_surf->Surface(GRSNR).SolarEnclIndex) continue; // Skip if back surface not in same solar enclosure - if (state.dataSurface->Surface(BackSurfaceNumber).Class == SurfaceClass::IntMass) continue; + if (s_surf->Surface(BackSurfaceNumber).Class == SurfaceClass::IntMass) continue; // Following line removed 1/27/03 by FCW. Was in original code that didn't do beam solar transmitted through // interior windows. Was removed to allow such beam solar but then somehow was put back in. @@ -5441,13 +5449,13 @@ void DetermineShadowingCombinations(EnergyPlusData &state) *state.dataSolarShading->shd_stream << "..Solar Distribution=Minimal Shadowing, Detached Shading will not be used in shadowing calculations\n"; } else if (state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::FullExterior) { - if (state.dataSurface->CalcSolRefl) { + if (s_surf->CalcSolRefl) { *state.dataSolarShading->shd_stream << "..Solar Distribution=FullExteriorWithReflectionsFromExteriorSurfaces\n"; } else { *state.dataSolarShading->shd_stream << "..Solar Distribution=FullExterior\n"; } } else if (state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::FullInteriorExterior) { - if (state.dataSurface->CalcSolRefl) { + if (s_surf->CalcSolRefl) { *state.dataSolarShading->shd_stream << "..Solar Distribution=FullInteriorAndExteriorWithReflectionsFromExteriorSurfaces\n"; } else { *state.dataSolarShading->shd_stream << "..Solar Distribution=FullInteriorAndExterior\n"; @@ -5458,20 +5466,20 @@ void DetermineShadowingCombinations(EnergyPlusData &state) *state.dataSolarShading->shd_stream << "..In the following, only the first 10 reference surfaces will be shown.\n"; *state.dataSolarShading->shd_stream << "..But all surfaces are used in the calculations.\n"; - for (int HTSnum : state.dataSurface->AllSurfaceListReportOrder) { + for (int HTSnum : s_surf->AllSurfaceListReportOrder) { *state.dataSolarShading->shd_stream << "==================================\n"; if (state.dataShadowComb->ShadowComb(HTSnum).UseThisSurf) { - if (state.dataSurface->Surface(HTSnum).IsConvex) { - *state.dataSolarShading->shd_stream << "Surface=" << state.dataSurface->Surface(HTSnum).Name + if (s_surf->Surface(HTSnum).IsConvex) { + *state.dataSolarShading->shd_stream << "Surface=" << s_surf->Surface(HTSnum).Name << " is used as Receiving Surface in calculations and is convex.\n"; } else { - *state.dataSolarShading->shd_stream << "Surface=" << state.dataSurface->Surface(HTSnum).Name + *state.dataSolarShading->shd_stream << "Surface=" << s_surf->Surface(HTSnum).Name << " is used as Receiving Surface in calculations and is non-convex.\n"; if (state.dataShadowComb->ShadowComb(HTSnum).NumGenSurf > 0) { if (state.dataGlobal->DisplayExtraWarnings) { ShowWarningError(state, format("DetermineShadowingCombinations: Surface=\"{}\" is a receiving surface and is non-convex.", - state.dataSurface->Surface(HTSnum).Name)); + s_surf->Surface(HTSnum).Name)); ShowContinueError(state, "...Shadowing values may be inaccurate. Check .shd report file for more surface shading details"); } else { @@ -5480,7 +5488,7 @@ void DetermineShadowingCombinations(EnergyPlusData &state) } } } else { - *state.dataSolarShading->shd_stream << "Surface=" << state.dataSurface->Surface(HTSnum).Name + *state.dataSolarShading->shd_stream << "Surface=" << s_surf->Surface(HTSnum).Name << " is not used as Receiving Surface in calculations.\n"; } *state.dataSolarShading->shd_stream << "Number of general casting surfaces=" << state.dataShadowComb->ShadowComb(HTSnum).NumGenSurf @@ -5488,29 +5496,29 @@ void DetermineShadowingCombinations(EnergyPlusData &state) for (NGSS = 1; NGSS <= state.dataShadowComb->ShadowComb(HTSnum).NumGenSurf; ++NGSS) { if (NGSS <= 10) *state.dataSolarShading->shd_stream - << "..Surface=" << state.dataSurface->Surface(state.dataShadowComb->ShadowComb(HTSnum).GenSurf(NGSS)).Name << '\n'; + << "..Surface=" << s_surf->Surface(state.dataShadowComb->ShadowComb(HTSnum).GenSurf(NGSS)).Name << '\n'; CastingSurface(state.dataShadowComb->ShadowComb(HTSnum).GenSurf(NGSS)) = true; } *state.dataSolarShading->shd_stream << "Number of back surfaces=" << state.dataShadowComb->ShadowComb(HTSnum).NumBackSurf << '\n'; for (NGSS = 1; NGSS <= min(10, state.dataShadowComb->ShadowComb(HTSnum).NumBackSurf); ++NGSS) { *state.dataSolarShading->shd_stream - << "...Surface=" << state.dataSurface->Surface(state.dataShadowComb->ShadowComb(HTSnum).BackSurf(NGSS)).Name << '\n'; + << "...Surface=" << s_surf->Surface(state.dataShadowComb->ShadowComb(HTSnum).BackSurf(NGSS)).Name << '\n'; } *state.dataSolarShading->shd_stream << "Number of receiving sub surfaces=" << state.dataShadowComb->ShadowComb(HTSnum).NumSubSurf << '\n'; for (NGSS = 1; NGSS <= min(10, state.dataShadowComb->ShadowComb(HTSnum).NumSubSurf); ++NGSS) { *state.dataSolarShading->shd_stream - << "....Surface=" << state.dataSurface->Surface(state.dataShadowComb->ShadowComb(HTSnum).SubSurf(NGSS)).Name << '\n'; + << "....Surface=" << s_surf->Surface(state.dataShadowComb->ShadowComb(HTSnum).SubSurf(NGSS)).Name << '\n'; } } } - for (HTS = 1; HTS <= state.dataSurface->TotSurfaces; ++HTS) { - if (CastingSurface(HTS) && !state.dataSurface->Surface(HTS).IsConvex) { + for (HTS = 1; HTS <= s_surf->TotSurfaces; ++HTS) { + if (CastingSurface(HTS) && !s_surf->Surface(HTS).IsConvex) { if (state.dataGlobal->DisplayExtraWarnings) { - ShowSevereError(state, - format("DetermineShadowingCombinations: Surface=\"{}\" is a casting surface and is non-convex.", - state.dataSurface->Surface(HTS).Name)); + ShowSevereError( + state, + format("DetermineShadowingCombinations: Surface=\"{}\" is a casting surface and is non-convex.", s_surf->Surface(HTS).Name)); ShowContinueError(state, "...Shadowing values may be inaccurate. Check .shd report file for more surface shading details"); } else { ++state.dataErrTracking->TotalCastingNonConvexSurfaces; @@ -5579,10 +5587,12 @@ void SHADOW(EnergyPlusData &state, Real64 SurfArea; // Surface area. For walls, includes all window frame areas. // For windows, includes divider area + auto &s_surf = state.dataSurface; + if (state.dataSolarShading->ShadowOneTimeFlag) { - state.dataSolarShading->XVrt.allocate(state.dataSurface->MaxVerticesPerSurface + 1); - state.dataSolarShading->YVrt.allocate(state.dataSurface->MaxVerticesPerSurface + 1); - state.dataSolarShading->ZVrt.allocate(state.dataSurface->MaxVerticesPerSurface + 1); + state.dataSolarShading->XVrt.allocate(s_surf->MaxVerticesPerSurface + 1); + state.dataSolarShading->YVrt.allocate(s_surf->MaxVerticesPerSurface + 1); + state.dataSolarShading->ZVrt.allocate(s_surf->MaxVerticesPerSurface + 1); state.dataSolarShading->XVrt = 0.0; state.dataSolarShading->YVrt = 0.0; state.dataSolarShading->ZVrt = 0.0; @@ -5608,7 +5618,7 @@ void SHADOW(EnergyPlusData &state, } #endif - for (GRSNR = 1; GRSNR <= state.dataSurface->TotSurfaces; ++GRSNR) { + for (GRSNR = 1; GRSNR <= s_surf->TotSurfaces; ++GRSNR) { if (!state.dataShadowComb->ShadowComb(GRSNR).UseThisSurf) continue; @@ -5632,11 +5642,11 @@ void SHADOW(EnergyPlusData &state, } else if ((NGSS <= 0) && (NSBS <= 0)) { // Simple surface--no shaders or subsurfaces - state.dataSolarShading->SurfSunlitArea(HTS) = state.dataSurface->Surface(GRSNR).NetAreaShadowCalc; + state.dataSolarShading->SurfSunlitArea(HTS) = s_surf->Surface(GRSNR).NetAreaShadowCalc; } else { // Surface in sun and either shading surfaces or subsurfaces present (or both) #ifndef EP_NO_OPENGL - int id = state.dataSurface->SurfPenumbraID(HTS); + int id = s_surf->SurfPenumbraID(HTS); if (state.dataSolarShading->penumbra && id >= 0) { // SurfSunlitArea(HTS) = buildingPSSF.at(id) / SurfSunCosTheta(HTS); state.dataSolarShading->SurfSunlitArea(HTS) = @@ -5644,7 +5654,7 @@ void SHADOW(EnergyPlusData &state, // SurfSunlitArea(HTS) = penumbra->fetchPSSA(Surface(HTS).PenumbraID)/SurfSunCosTheta(HTS); for (int SS = 1; SS <= NSBS; ++SS) { int HTSS = state.dataShadowComb->ShadowComb(HTS).SubSurf(SS); - id = state.dataSurface->SurfPenumbraID(HTSS); + id = s_surf->SurfPenumbraID(HTSS); if (id >= 0) { // SurfSunlitArea(HTSS) = buildingPSSF.at(id) / SurfSunCosTheta(HTSS); state.dataSolarShading->SurfSunlitArea(HTSS) = @@ -5653,7 +5663,7 @@ void SHADOW(EnergyPlusData &state, if (state.dataSolarShading->SurfSunlitArea(HTSS) > 0.0) { if (iHour > 0 && TS > 0) state.dataHeatBal->SurfSunlitFracWithoutReveal(iHour, TS, HTSS) = - state.dataSolarShading->SurfSunlitArea(HTSS) / state.dataSurface->Surface(HTSS).Area; + state.dataSolarShading->SurfSunlitArea(HTSS) / s_surf->Surface(HTSS).Area; } } } @@ -5661,19 +5671,19 @@ void SHADOW(EnergyPlusData &state, #else { #endif - NGRS = state.dataSurface->Surface(GRSNR).BaseSurf; - if (state.dataSurface->Surface(GRSNR).IsShadowing) NGRS = GRSNR; + NGRS = s_surf->Surface(GRSNR).BaseSurf; + if (s_surf->Surface(GRSNR).IsShadowing) NGRS = GRSNR; // Compute the X and Y displacements of a shadow. - XS = state.dataSurface->Surface(NGRS).lcsx.x * state.dataSolarShading->SUNCOS(1) + - state.dataSurface->Surface(NGRS).lcsx.y * state.dataSolarShading->SUNCOS(2) + - state.dataSurface->Surface(NGRS).lcsx.z * state.dataSolarShading->SUNCOS(3); - YS = state.dataSurface->Surface(NGRS).lcsy.x * state.dataSolarShading->SUNCOS(1) + - state.dataSurface->Surface(NGRS).lcsy.y * state.dataSolarShading->SUNCOS(2) + - state.dataSurface->Surface(NGRS).lcsy.z * state.dataSolarShading->SUNCOS(3); - ZS = state.dataSurface->Surface(NGRS).lcsz.x * state.dataSolarShading->SUNCOS(1) + - state.dataSurface->Surface(NGRS).lcsz.y * state.dataSolarShading->SUNCOS(2) + - state.dataSurface->Surface(NGRS).lcsz.z * state.dataSolarShading->SUNCOS(3); + XS = s_surf->Surface(NGRS).lcsx.x * state.dataSolarShading->SUNCOS(1) + + s_surf->Surface(NGRS).lcsx.y * state.dataSolarShading->SUNCOS(2) + + s_surf->Surface(NGRS).lcsx.z * state.dataSolarShading->SUNCOS(3); + YS = s_surf->Surface(NGRS).lcsy.x * state.dataSolarShading->SUNCOS(1) + + s_surf->Surface(NGRS).lcsy.y * state.dataSolarShading->SUNCOS(2) + + s_surf->Surface(NGRS).lcsy.z * state.dataSolarShading->SUNCOS(3); + ZS = s_surf->Surface(NGRS).lcsz.x * state.dataSolarShading->SUNCOS(1) + + s_surf->Surface(NGRS).lcsz.y * state.dataSolarShading->SUNCOS(2) + + s_surf->Surface(NGRS).lcsz.z * state.dataSolarShading->SUNCOS(3); if (std::abs(ZS) > Constant::SmallDistance) { state.dataSolarShading->XShadowProjection = XS / ZS; @@ -5707,14 +5717,14 @@ void SHADOW(EnergyPlusData &state, SHDGSS(state, NGRS, iHour, TS, GRSNR, NGSS, HTS); // Determine shadowing on surface. if (!state.dataSolarShading->CalcSkyDifShading) { - SHDBKS(state, state.dataSurface->Surface(GRSNR).BaseSurf, GRSNR, NBKS, HTS); // Determine possible back surfaces. + SHDBKS(state, s_surf->Surface(GRSNR).BaseSurf, GRSNR, NBKS, HTS); // Determine possible back surfaces. } } SHDSBS(state, iHour, GRSNR, NBKS, NSBS, HTS, TS); // Subtract subsurf areas from total // Error checking: require that 0 <= SurfSunlitArea <= AREA. + or - .01*AREA added for round-off errors - SurfArea = state.dataSurface->Surface(GRSNR).NetAreaShadowCalc; + SurfArea = s_surf->Surface(GRSNR).NetAreaShadowCalc; state.dataSolarShading->SurfSunlitArea(HTS) = max(0.0, state.dataSolarShading->SurfSunlitArea(HTS)); state.dataSolarShading->SurfSunlitArea(HTS) = min(state.dataSolarShading->SurfSunlitArea(HTS), SurfArea); @@ -5758,15 +5768,17 @@ void SHDBKS(EnergyPlusData &state, int NS2; // Number of the figure doing overlapping int NS3; // Location to place results of overlap + auto &s_surf = state.dataSurface; + // Tuned Linear indexing assert(equal_dimensions(state.dataSolarShading->HCX, state.dataSolarShading->HCY)); assert(equal_dimensions(state.dataSolarShading->HCX, state.dataSolarShading->HCA)); if (state.dataSolarShading->SHDBKSOneTimeFlag) { - state.dataSolarShading->XVrtx.allocate(state.dataSurface->MaxVerticesPerSurface + 1); - state.dataSolarShading->YVrtx.allocate(state.dataSurface->MaxVerticesPerSurface + 1); - state.dataSolarShading->ZVrtx.allocate(state.dataSurface->MaxVerticesPerSurface + 1); + state.dataSolarShading->XVrtx.allocate(s_surf->MaxVerticesPerSurface + 1); + state.dataSolarShading->YVrtx.allocate(s_surf->MaxVerticesPerSurface + 1); + state.dataSolarShading->ZVrtx.allocate(s_surf->MaxVerticesPerSurface + 1); state.dataSolarShading->XVrtx = 0.0; state.dataSolarShading->YVrtx = 0.0; state.dataSolarShading->ZVrtx = 0.0; @@ -5884,10 +5896,12 @@ void SHDGSS(EnergyPlusData &state, int NS3; // Location to place results of overlap Real64 SchValue; // Value for Schedule of shading transmittence + auto &s_surf = state.dataSurface; + if (state.dataSolarShading->SHDGSSOneTimeFlag) { - state.dataSolarShading->XVert.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); - state.dataSolarShading->YVert.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); - state.dataSolarShading->ZVert.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->XVert.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->YVert.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->ZVert.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); state.dataSolarShading->SHDGSSOneTimeFlag = false; } @@ -5910,7 +5924,7 @@ void SHDGSS(EnergyPlusData &state, if (state.dataSolarShading->SurfSunCosTheta(GSSNR) > sunIsUp) continue; //.001) CYCLE ! NO SHADOW IF GSS IN SUNLIGHT. - auto const &surface = state.dataSurface->Surface(GSSNR); + auto const &surface = s_surf->Surface(GSSNR); bool const notHeatTransSurf = !surface.HeatTransSurf; // This used to check to see if the shadowing surface was not opaque (within the scheduled dates of @@ -5935,7 +5949,7 @@ void SHDGSS(EnergyPlusData &state, continue; // Disable all shadowing surfaces in all zones. Attached shading surfaces are not part of a zone, zone value is 0. } } else if (state.dataSysVars->DisableGroupSelfShading) { - std::vector DisabledZones = state.dataSurface->SurfShadowDisabledZoneList(CurSurf); + std::vector DisabledZones = s_surf->SurfShadowDisabledZoneList(CurSurf); bool isDisabledShadowSurf = false; for (int i : DisabledZones) { if (surface.Zone == i) { @@ -5957,9 +5971,9 @@ void SHDGSS(EnergyPlusData &state, // project shadow to the receiving surface state.dataSolarShading->NVS = surface.Sides; - auto const &XV = state.dataSurface->ShadeV(GSSNR).XV; - auto const &YV = state.dataSurface->ShadeV(GSSNR).YV; - auto const &ZV = state.dataSurface->ShadeV(GSSNR).ZV; + auto const &XV = s_surf->ShadeV(GSSNR).XV; + auto const &YV = s_surf->ShadeV(GSSNR).YV; + auto const &ZV = s_surf->ShadeV(GSSNR).ZV; for (int N = 1; N <= state.dataSolarShading->NVS; ++N) { state.dataSolarShading->XVS(N) = XV(N) - state.dataSolarShading->XShadowProjection * ZV(N); state.dataSolarShading->YVS(N) = YV(N) - state.dataSolarShading->YShadowProjection * ZV(N); @@ -6139,6 +6153,8 @@ void CalcInteriorSolarOverlaps(EnergyPlusData &state, // FALSE means exact interior solar distribution // (track which back surfaces beam illuminates) + auto &s_surf = state.dataSurface; + // Tuned Linear indexing assert(equal_dimensions(state.dataSolarShading->HCX, state.dataSolarShading->HCY)); @@ -6150,7 +6166,7 @@ void CalcInteriorSolarOverlaps(EnergyPlusData &state, UseSimpleDistribution = false; - if ((NBKS <= 0) || (state.dataSurface->Surface(GRSNR).ExtBoundCond > 0)) { + if ((NBKS <= 0) || (s_surf->Surface(GRSNR).ExtBoundCond > 0)) { UseSimpleDistribution = true; @@ -6200,22 +6216,20 @@ void CalcInteriorSolarOverlaps(EnergyPlusData &state, for (int bkSurfNum : state.dataShadowComb->ShadowComb(GRSNR).BackSurf) { if (bkSurfNum == 0) continue; if (state.dataSolarShading->SurfSunCosTheta(bkSurfNum) < DataEnvironment::SunIsUpValue) { - pbBackSurfaces.push_back(state.dataSurface->SurfPenumbraID(bkSurfNum)); + pbBackSurfaces.push_back(s_surf->SurfPenumbraID(bkSurfNum)); } } - pssas = - state.dataSolarShading->penumbra->calculate_interior_pssas({(unsigned)state.dataSurface->SurfPenumbraID(HTSS)}, pbBackSurfaces); + pssas = state.dataSolarShading->penumbra->calculate_interior_pssas({(unsigned)s_surf->SurfPenumbraID(HTSS)}, pbBackSurfaces); // penumbra->render_interior_scene({(unsigned)Surface(HTSS).PenumbraID}, pbBackSurfaces); JBKS = 0; for (int bkSurfNum : state.dataShadowComb->ShadowComb(GRSNR).BackSurf) { if (bkSurfNum == 0) continue; - if (pssas[state.dataSurface->SurfPenumbraID(bkSurfNum)] > 0) { + if (pssas[s_surf->SurfPenumbraID(bkSurfNum)] > 0) { ++JBKS; state.dataHeatBal->SurfWinBackSurfaces(iHour, TS, JBKS, HTSS) = bkSurfNum; - Real64 OverlapArea = pssas[state.dataSurface->SurfPenumbraID(bkSurfNum)] / state.dataSolarShading->SurfSunCosTheta(HTSS); - state.dataHeatBal->SurfWinOverlapAreas(iHour, TS, JBKS, HTSS) = - OverlapArea * state.dataSurface->SurfaceWindow(HTSS).glazedFrac; + Real64 OverlapArea = pssas[s_surf->SurfPenumbraID(bkSurfNum)] / state.dataSolarShading->SurfSunCosTheta(HTSS); + state.dataHeatBal->SurfWinOverlapAreas(iHour, TS, JBKS, HTSS) = OverlapArea * s_surf->SurfaceWindow(HTSS).glazedFrac; } } } @@ -6257,9 +6271,8 @@ void CalcInteriorSolarOverlaps(EnergyPlusData &state, ++JBKS; if (JBKS <= state.dataBSDFWindow->MaxBkSurf) { state.dataHeatBal->SurfWinBackSurfaces(iHour, TS, JBKS, HTSS) = BackSurfNum; - int baseSurfaceNum = state.dataSurface->Surface(BackSurfNum).BaseSurf; - state.dataHeatBal->SurfWinOverlapAreas(iHour, TS, JBKS, HTSS) = - OverlapArea * state.dataSurface->SurfaceWindow(HTSS).glazedFrac; + int baseSurfaceNum = s_surf->Surface(BackSurfNum).BaseSurf; + state.dataHeatBal->SurfWinOverlapAreas(iHour, TS, JBKS, HTSS) = OverlapArea * s_surf->SurfaceWindow(HTSS).glazedFrac; // If this is a subsurface, subtract its overlap area from its base surface if (baseSurfaceNum != BackSurfNum) { for (int iBaseBKS = 1; iBaseBKS <= JBKS; ++iBaseBKS) { @@ -6279,6 +6292,7 @@ void CalcInteriorSolarOverlaps(EnergyPlusData &state, } } // End of check that sunlit area > 0. } + void CalcInteriorSolarDistribution(EnergyPlusData &state) { @@ -6316,9 +6330,13 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Array1D CFBoverlap; // Sum of boverlap for each back surface Array2D CFDirBoverlap; // Directional boverlap (Direction, IBack) + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; + #ifdef EP_Count_Calls ++state.dataTimingsData->NumIntSolarDist_Calls; #endif + for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); @@ -6326,7 +6344,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) int const lastSurfWin = thisSpace.WindowSurfaceLast; for (int SurfNum = firstSurfWin; SurfNum <= lastSurfWin; ++SurfNum) { for (int lay = 1; lay <= CFSMAXNL + 1; ++lay) { - state.dataSurface->SurfWinA(SurfNum, lay) = 0.0; + s_surf->SurfWinA(SurfNum, lay) = 0.0; } state.dataSolarShading->SurfWinIntBeamAbsByShadFac(SurfNum) = 0.0; state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = 0.0; @@ -6334,16 +6352,17 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) int const firstSurfOpaque = thisSpace.OpaqOrIntMassSurfaceFirst; int const lastSurfOpaque = thisSpace.OpaqOrIntMassSurfaceLast; for (int SurfNum = firstSurfOpaque; SurfNum <= lastSurfOpaque; ++SurfNum) { - state.dataSurface->SurfOpaqAI(SurfNum) = 0.0; - state.dataSurface->SurfOpaqAO(SurfNum) = 0.0; + s_surf->SurfOpaqAI(SurfNum) = 0.0; + s_surf->SurfOpaqAO(SurfNum) = 0.0; } } } + if ((int)state.dataDaylightingDevicesData->TDDPipe.size() > 0) { for (auto &e : state.dataDaylightingDevicesData->TDDPipe) { int SurfDome = e.Dome; for (int lay = 1; lay <= CFSMAXNL + 1; ++lay) { - state.dataSurface->SurfWinA(SurfDome, lay) = 0.0; + s_surf->SurfWinA(SurfDome, lay) = 0.0; } state.dataSolarShading->SurfWinIntBeamAbsByShadFac(SurfDome) = 0.0; state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfDome) = 0.0; @@ -6361,7 +6380,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Loop over exterior surfaces in this zone auto &thisEnclosure = state.dataViewFactor->EnclSolInfo(enclosureNum); // delete values from previous timestep - if (state.dataHeatBal->AnyBSDF) state.dataSurface->SurfWinACFOverlap = 0.0; + if (state.dataHeatBal->AnyBSDF) s_surf->SurfWinACFOverlap = 0.0; //------------------------------------------------------------------------- // EXTERIOR BEAM SOLAR RADIATION ABSORBED ON THE OUTSIDE OF OPAQUE SURFACES @@ -6369,14 +6388,13 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // TODO: use opaq and window loop after airboundary is sorted // TODO: It may be useful to sort SurfacePtr to group windows and domes together to reduce if conditions for (int const SurfNum : thisEnclosure.SurfacePtr) { - if (state.dataSurface->Surface(SurfNum).Class != SurfaceClass::Window && - state.dataSurface->Surface(SurfNum).Class != SurfaceClass::TDD_Dome) { - if (!state.dataSurface->Surface(SurfNum).HeatTransSurf) continue; - if (!state.dataSurface->Surface(SurfNum).ExtSolar) continue; - int const ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); + if (s_surf->Surface(SurfNum).Class != SurfaceClass::Window && s_surf->Surface(SurfNum).Class != SurfaceClass::TDD_Dome) { + if (!s_surf->Surface(SurfNum).HeatTransSurf) continue; + if (!s_surf->Surface(SurfNum).ExtSolar) continue; + int const ConstrNum = s_surf->SurfActiveConstruction(SurfNum); Real64 CosInc = state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum); Real64 SunLitFract = state.dataHeatBal->SurfSunlitFrac(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum); - state.dataSurface->SurfOpaqAO(SurfNum) = state.dataConstruction->Construct(ConstrNum).OutsideAbsorpSolar * CosInc * SunLitFract; + s_surf->SurfOpaqAO(SurfNum) = state.dataConstruction->Construct(ConstrNum).OutsideAbsorpSolar * CosInc * SunLitFract; } } @@ -6384,22 +6402,23 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // EXTERIOR WINDOWS OR TDD DOMES //-------------------------------------------------------------------------------------------------------- for (int const SurfNum : thisEnclosure.SurfacePtr) { - auto &surf = state.dataSurface->Surface(SurfNum); - auto &surfWin = state.dataSurface->SurfaceWindow(SurfNum); + auto &surf = s_surf->Surface(SurfNum); if (surf.Class != SurfaceClass::Window && surf.Class != SurfaceClass::TDD_Dome) continue; if (!surf.ExtSolar && surf.OriginalClass != SurfaceClass::TDD_Diffuser) continue; - int const ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); - int const ConstrNumSh = state.dataSurface->SurfWinActiveShadedConstruction(SurfNum); + + auto &surfWin = s_surf->SurfaceWindow(SurfNum); + int const ConstrNum = s_surf->SurfActiveConstruction(SurfNum); + int const ConstrNumSh = s_surf->SurfWinActiveShadedConstruction(SurfNum); auto &thisConstruct = state.dataConstruction->Construct(ConstrNum); - int BlNum = state.dataSurface->SurfWinBlindNumber(SurfNum); int ScNum = surfWin.screenNum; - WinShadingType ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); // Set in subr. WindowShadingManager + WinShadingType ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); // Set in subr. WindowShadingManager + + auto &surfShade = s_surf->surfShades(SurfNum); Real64 ProfAng = 0.0; // Window solar profile angle (radians) - Real64 SlatAng = state.dataSurface->SurfWinSlatAngThisTS(SurfNum); - Real64 VarSlats = state.dataSurface->SurfWinMovableSlats(SurfNum); - int PipeNum = state.dataSurface->SurfWinTDDPipeNum(SurfNum); + Real64 SlatAng = surfShade.blind.slatAng; + int PipeNum = s_surf->SurfWinTDDPipeNum(SurfNum); int SurfNum2 = SurfNum; if (surf.OriginalClass == SurfaceClass::TDD_Diffuser) { SurfNum2 = state.dataDaylightingDevicesData->TDDPipe(PipeNum).Dome; @@ -6417,7 +6436,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) state.dataHeatBal->SurfSunlitFracWithoutReveal(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum) = SunLitFract; // Frames/dividers not allow int FenSolAbsPtr = 0; - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { FenSolAbsPtr = WindowScheduledSolarAbs(state, SurfNum, ConstrNum); } bool SunlitFracWithoutReveal = @@ -6438,111 +6457,48 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 FrontBeamAbs; // Blind solar front beam absorptance Real64 BackBeamAbs; // Blind solar back beam absorptance - if (state.dataSurface->SurfWinWindowModelType(SurfNum) != WindowModel::EQL && ANY_BLIND(ShadeFlag)) { - int SlatsAngIndexLower = state.dataSurface->SurfWinSlatsAngIndex(SurfNum); - int ProfAngIndexLower = state.dataSurface->SurfWinProfAngIndex(SurfNum); - int SlatsAngIndexUpper = std::min(Material::MaxSlatAngs, SlatsAngIndexLower + 1); - int ProfAngIndexUpper = std::min(Material::MaxProfAngs, ProfAngIndexLower + 1); - Real64 SlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum); - Real64 ProfAngInterpFac = state.dataSurface->SurfWinProfAngInterpFac(SurfNum); - - auto const &thisBlind = state.dataMaterial->Blind(BlNum); - if (VarSlats) { - // Used in time step variable reporting - FrontDiffDiffTrans = General::Interp( - thisBlind.SolFrontDiffDiffTrans(SlatsAngIndexLower), thisBlind.SolFrontDiffDiffTrans(SlatsAngIndexUpper), SlatsAngInterpFac); - } else { - FrontDiffDiffTrans = thisBlind.SolFrontDiffDiffTrans(1); - } + if (s_surf->SurfWinWindowModelType(SurfNum) != WindowModel::EQL && ANY_BLIND(ShadeFlag)) { + auto const &surfShade = s_surf->surfShades(SurfNum); + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + + int profIdxLo = surfShade.blind.profAngIdxLo; + int profIdxHi = surfShade.blind.profAngIdxHi; + Real64 profInterpFac = surfShade.blind.profAngInterpFac; + + FrontDiffDiffTrans = surfShade.blind.TAR.Sol.Ft.Df.Tra; if (SunLitFract > 0.0 || SunlitFracWithoutReveal) { - if (VarSlats) { - FrontBeamDiffTrans = Window::InterpProfSlat(thisBlind.SolFrontBeamDiffTrans(SlatsAngIndexLower, ProfAngIndexLower), - thisBlind.SolFrontBeamDiffTrans(SlatsAngIndexUpper, ProfAngIndexLower), - thisBlind.SolFrontBeamDiffTrans(SlatsAngIndexLower, ProfAngIndexUpper), - thisBlind.SolFrontBeamDiffTrans(SlatsAngIndexUpper, ProfAngIndexUpper), - SlatsAngInterpFac, - ProfAngInterpFac); - FrontBeamAbs = Window::InterpProfSlat(thisBlind.SolFrontBeamAbs(SlatsAngIndexLower, ProfAngIndexLower), - thisBlind.SolFrontBeamAbs(SlatsAngIndexUpper, ProfAngIndexLower), - thisBlind.SolFrontBeamAbs(SlatsAngIndexLower, ProfAngIndexUpper), - thisBlind.SolFrontBeamAbs(SlatsAngIndexUpper, ProfAngIndexUpper), - SlatsAngInterpFac, - ProfAngInterpFac); - if (ShadeFlag != WinShadingType::ExtBlind) { // FRONT: interior or bg blinds - FrontDiffDiffRefl = General::Interp(thisBlind.SolFrontDiffDiffRefl(SlatsAngIndexLower), - thisBlind.SolFrontDiffDiffRefl(SlatsAngIndexUpper), - SlatsAngInterpFac); - FrontDiffAbs = General::Interp( - thisBlind.SolFrontDiffAbs(SlatsAngIndexLower), thisBlind.SolFrontDiffAbs(SlatsAngIndexUpper), SlatsAngInterpFac); - FrontBeamDiffRefl = Window::InterpProfSlat(thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexLower, ProfAngIndexLower), - thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexUpper, ProfAngIndexLower), - thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexLower, ProfAngIndexUpper), - thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexUpper, ProfAngIndexUpper), - SlatsAngInterpFac, - ProfAngInterpFac); - } - if (ShadeFlag != WinShadingType::IntBlind) { // BACK: exterior or bg blinds - BackDiffDiffTrans = General::Interp(thisBlind.SolBackDiffDiffTrans(SlatsAngIndexLower), - thisBlind.SolBackDiffDiffTrans(SlatsAngIndexUpper), - SlatsAngInterpFac); - BackDiffDiffRefl = General::Interp(thisBlind.SolBackDiffDiffRefl(SlatsAngIndexLower), - thisBlind.SolBackDiffDiffRefl(SlatsAngIndexUpper), - SlatsAngInterpFac); - BackDiffAbs = General::Interp( - thisBlind.SolBackDiffAbs(SlatsAngIndexLower), thisBlind.SolBackDiffAbs(SlatsAngIndexUpper), SlatsAngInterpFac); - BackBeamDiffTrans = Window::InterpProfSlat(thisBlind.SolBackBeamDiffTrans(SlatsAngIndexLower, ProfAngIndexLower), - thisBlind.SolBackBeamDiffTrans(SlatsAngIndexUpper, ProfAngIndexLower), - thisBlind.SolBackBeamDiffTrans(SlatsAngIndexLower, ProfAngIndexUpper), - thisBlind.SolBackBeamDiffTrans(SlatsAngIndexUpper, ProfAngIndexUpper), - SlatsAngInterpFac, - ProfAngInterpFac); - BackBeamDiffRefl = Window::InterpProfSlat(thisBlind.SolBackBeamDiffRefl(SlatsAngIndexLower, ProfAngIndexLower), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexUpper, ProfAngIndexLower), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexLower, ProfAngIndexUpper), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexUpper, ProfAngIndexUpper), - SlatsAngInterpFac, - ProfAngInterpFac); - BackBeamAbs = Window::InterpProfSlat(thisBlind.SolBackBeamAbs(SlatsAngIndexLower, ProfAngIndexLower), - thisBlind.SolBackBeamAbs(SlatsAngIndexUpper, ProfAngIndexLower), - thisBlind.SolBackBeamAbs(SlatsAngIndexLower, ProfAngIndexUpper), - thisBlind.SolBackBeamAbs(SlatsAngIndexUpper, ProfAngIndexUpper), - SlatsAngInterpFac, - ProfAngInterpFac); - } - } else { - FrontBeamAbs = General::Interp( - thisBlind.SolFrontBeamAbs(1, ProfAngIndexLower), thisBlind.SolFrontBeamAbs(1, ProfAngIndexUpper), ProfAngInterpFac); - FrontBeamDiffTrans = General::Interp(thisBlind.SolFrontBeamDiffTrans(1, ProfAngIndexLower), - thisBlind.SolFrontBeamDiffTrans(1, ProfAngIndexUpper), - ProfAngInterpFac); - if (ShadeFlag != WinShadingType::ExtBlind) { // FRONT: interior or bg blinds - FrontDiffDiffRefl = thisBlind.SolFrontDiffDiffRefl(1); - FrontDiffAbs = thisBlind.SolFrontDiffAbs(1); - FrontBeamDiffRefl = General::Interp(thisBlind.SolFrontBeamDiffRefl(1, ProfAngIndexLower), - thisBlind.SolFrontBeamDiffRefl(1, ProfAngIndexUpper), - ProfAngInterpFac); - } - if (ShadeFlag != WinShadingType::IntBlind) { // BACK: exterior or bg blinds{ - BackDiffDiffTrans = thisBlind.SolBackDiffDiffTrans(1); - BackDiffDiffRefl = thisBlind.SolBackDiffDiffRefl(1); - BackDiffAbs = thisBlind.SolBackDiffAbs(1); - BackBeamDiffTrans = General::Interp(thisBlind.SolBackBeamDiffTrans(1, ProfAngIndexLower), - thisBlind.SolBackBeamDiffTrans(1, ProfAngIndexUpper), - ProfAngInterpFac); - BackBeamDiffRefl = General::Interp(thisBlind.SolBackBeamDiffRefl(1, ProfAngIndexLower), - thisBlind.SolBackBeamDiffRefl(1, ProfAngIndexUpper), - ProfAngInterpFac); - BackBeamAbs = General::Interp( - thisBlind.SolBackBeamAbs(1, ProfAngIndexLower), thisBlind.SolBackBeamAbs(1, ProfAngIndexUpper), ProfAngInterpFac); - } + auto const &btar1 = surfShade.blind.TAR; + auto const &btarFront1Lo = btar1.Sol.Ft.Bm[profIdxLo]; + auto const &btarFront1Hi = btar1.Sol.Ft.Bm[profIdxHi]; + + FrontBeamAbs = Interp(btarFront1Lo.Abs, btarFront1Hi.Abs, profInterpFac); + FrontBeamDiffTrans = Interp(btarFront1Lo.DfTra, btarFront1Hi.DfTra, profInterpFac); + if (ShadeFlag != WinShadingType::ExtBlind) { // FRONT: interior or bg blinds + FrontDiffDiffRefl = btar1.Sol.Ft.Df.Ref; + FrontDiffAbs = btar1.Sol.Ft.Df.Abs; + FrontBeamDiffRefl = Interp(btarFront1Lo.DfRef, btarFront1Hi.DfRef, profInterpFac); } - } - } + + if (ShadeFlag != WinShadingType::IntBlind) { // BACK: exterior or bg blinds{ + BackDiffDiffTrans = btar1.Sol.Bk.Df.Tra; + BackDiffDiffRefl = btar1.Sol.Bk.Df.Ref; + BackDiffAbs = btar1.Sol.Bk.Df.Abs; + + auto const &btarBack1Lo = btar1.Sol.Bk.Bm[profIdxLo]; + auto const &btarBack1Hi = btar1.Sol.Bk.Bm[profIdxHi]; + + BackBeamDiffTrans = Interp(btarBack1Lo.DfTra, btarBack1Hi.DfTra, profInterpFac); + BackBeamDiffRefl = Interp(btarBack1Lo.DfRef, btarBack1Hi.DfRef, profInterpFac); + BackBeamAbs = Interp(btarBack1Lo.Abs, btarBack1Hi.Abs, profInterpFac); + } + } // if (SunLitFrac > 0.0) + } // if (ANY_BLIND) if (SunlitFracWithoutReveal) { - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { // For bare glazing or switchable glazing, the following includes the effects of // (1) diffuse solar produced by beam solar incident on the outside and inside reveal @@ -6554,22 +6510,22 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Array1D AbWin(NGlass); // Factor for front beam radiation absorbed in window glass layer for (int Lay = 1; Lay <= NGlass; ++Lay) { AbWin(Lay) = POLYF(CosInc, thisConstruct.AbsBeamCoef(Lay)) * CosInc * SunLitFract * - state.dataSurface->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay]; + s_surf->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay]; } if (!IS_SHADED_NO_GLARE_CTRL(ShadeFlag)) { // (ShadeFlag <= 0 || ShadeFlag >= 10) - Bare window (ShadeFlag = -1 or 0 or shading device of off) for (int Lay = 1; Lay <= NGlass; ++Lay) { // Add contribution of beam reflected from outside and inside reveal - state.dataSurface->SurfWinA(SurfNum, Lay) = - AbWin(Lay) + state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstruct.AbsDiff(Lay) + - state.dataSurface->SurfWinInsRevealDiffOntoGlazing(SurfNum) * thisConstruct.AbsDiffBack(Lay); + s_surf->SurfWinA(SurfNum, Lay) = AbWin(Lay) + + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstruct.AbsDiff(Lay) + + s_surf->SurfWinInsRevealDiffOntoGlazing(SurfNum) * thisConstruct.AbsDiffBack(Lay); } } else { // Shade, screen, blind or switchable glazing on (ShadeFlag > 0) Real64 FracSunLit = - SunLitFract * state.dataSurface->SurfaceWindow(SurfNum) + SunLitFract * s_surf->SurfaceWindow(SurfNum) .OutProjSLFracMult[state.dataGlobal->HourOfDay]; // Effective fraction of window that is sunlit; - Real64 InOutProjSLFracMult = state.dataSurface->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay]; + Real64 InOutProjSLFracMult = s_surf->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay]; Array1D AbWinSh(NGlass); // Like AbWin, but for shaded window Array1D ADiffWinSh(NGlass); // Diffuse solar absorptance of glass layer, window with shading device if (ANY_EXTERIOR_SHADE_BLIND_SCREEN(ShadeFlag)) FracSunLit = SunLitFract; @@ -6587,7 +6543,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) thisConstructSh.AbsBeamShadeCoef); // Interior shade or blind beam solar absorptance state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = (AbsShade * CosInc * SunLitFract * InOutProjSLFracMult + - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstructSh.AbsDiffShade) * + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstructSh.AbsDiffShade) * surfWin.glazedFrac; // In the above, GlazedFrac corrects for shadowing of divider onto interior shade } else if (ShadeFlag == WinShadingType::ExtShade) { // Exterior beam absorbed by EXTERIOR SHADE @@ -6596,12 +6552,12 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 AbsShade = POLYF(CosInc, thisConstructSh.AbsBeamShadeCoef); state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = AbsShade * CosInc * SunLitFract + - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstructSh.AbsDiffShade; + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstructSh.AbsDiffShade; } } else { // Blind or screen on - ProfAng = state.dataSurface->SurfWinProfileAng(SurfNum); + ProfAng = surfShade.blind.profAng; if (ShadeFlag == WinShadingType::IntBlind) { // Interior blind on Real64 TBmBm = POLYF(CosInc, thisConstruct.TransSolBeamCoef); @@ -6629,16 +6585,17 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = (AbsShade * CosInc * SunLitFract * InOutProjSLFracMult + - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * AbsShadeDiff) * + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * AbsShadeDiff) * surfWin.glazedFrac; + // In the above, GlazedFrac corrects for shadowing of divider onto interior blind } else if (ShadeFlag == WinShadingType::ExtBlind) { // Exterior blind on - Real64 TBlBmBm = state.dataSurface->SurfWinBlindBmBmTrans(SurfNum); // Blind solar front beam-beam transmittance - Real64 TBlDifDif = FrontDiffDiffTrans; // Diffuse-diffuse solar transmittance of blind - Real64 TBlBmDiff = FrontBeamDiffTrans; // Blind solar front beam-diffuse transmittance - Real64 RhoBlBack = BackBeamDiffRefl; // Blind solar back beam-diffuse reflectance - Real64 RhoBlDiffBack = BackDiffDiffRefl; // Blind solar back diffuse reflectance + Real64 TBlBmBm = surfShade.blind.bmBmTrans; // Blind solar front beam-beam transmittance + Real64 TBlDifDif = FrontDiffDiffTrans; // Diffuse-diffuse solar transmittance of blind + Real64 TBlBmDiff = FrontBeamDiffTrans; // Blind solar front beam-diffuse transmittance + Real64 RhoBlBack = BackBeamDiffRefl; // Blind solar back beam-diffuse reflectance + Real64 RhoBlDiffBack = BackDiffDiffRefl; // Blind solar back diffuse reflectance Real64 RGlFront = POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance @@ -6662,10 +6619,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = AbsShade * CosInc * SunLitFract * InOutProjSLFracMult; } else if (ShadeFlag == WinShadingType::ExtScreen) { // Exterior screen on - auto const *screen = dynamic_cast(state.dataMaterial->Material(ScNum)); + auto const *screen = dynamic_cast(s_mat->materials(ScNum)); assert(screen != nullptr); - auto &surf = state.dataSurface->Surface(SurfNum); + auto &surf = s_surf->Surface(SurfNum); Real64 solPhi = std::acos(state.dataEnvrn->SOLCOS.z); Real64 solTheta = std::atan2(state.dataEnvrn->SOLCOS.x, state.dataEnvrn->SOLCOS.y); @@ -6676,7 +6633,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Material::NormalizePhiTheta(phi, theta); #ifdef PRECALC_INTERP_SCREEN int ip1, ip2, it1, it2; - General::BilinearInterpCoeffs coeffs; + BilinearInterpCoeffs coeffs; Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); GetBilinearInterpCoeffs( phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); @@ -6764,11 +6721,11 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 rfd2 = thisConstruct.rfBareSolDiff(2); Real64 rbd1 = thisConstruct.rbBareSolDiff(1); // Bare-glass diffuse solar back reflectance for glass layers 1,2 and 3 Real64 rbd2 = thisConstruct.rbBareSolDiff(2); - Real64 tfshBB = - state.dataSurface->SurfWinBlindBmBmTrans(SurfNum); // Bare-blind front and back beam-beam solar transmittance - auto const &thisBlind = state.dataMaterial->Blind(BlNum); - Real64 tbshBB = Window::BlindBeamBeamTrans( - ProfAng, Constant::Pi - SlatAng, thisBlind.SlatWidth, thisBlind.SlatSeparation, thisBlind.SlatThickness); + Real64 tfshBB = surfShade.blind.bmBmTrans; // Bare-blind front and back beam-beam solar transmittance + + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + Real64 tbshBB = matBlind->BeamBeamTrans(ProfAng, Constant::Pi - SlatAng); Real64 tfshBd = FrontBeamDiffTrans; // Bare-blind front and back beam-diffuse solar transmittance Real64 tbshBd = BackBeamDiffTrans; Real64 rfshB = FrontBeamDiffRefl; // Bare-blind front and back beam solar reflectance @@ -6828,68 +6785,64 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } // End of check if NGlass state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = AbsShade * CosInc * SunLitFract * InOutProjSLFracMult + - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * AbsShadeDiff; + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * AbsShadeDiff; } // End of check if blind is interior, exterior or between-glass } // End of check if a blind is on if (ShadeFlag != WinShadingType::SwitchableGlazing) { // Interior or between glass shade or blind on for (int Lay = 1; Lay <= NGlass; ++Lay) { - state.dataSurface->SurfWinA(SurfNum, Lay) = AbWinSh(Lay); + s_surf->SurfWinA(SurfNum, Lay) = AbWinSh(Lay); // Add contribution of diffuse from beam on outside reveal if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag) || ANY_BETWEENGLASS_SHADE_BLIND(ShadeFlag)) - state.dataSurface->SurfWinA(SurfNum, Lay) += - ADiffWinSh(Lay) * state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum); + s_surf->SurfWinA(SurfNum, Lay) += ADiffWinSh(Lay) * s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum); } } else { auto const &thisConstructSh = state.dataConstruction->Construct(ConstrNumSh); // Switchable glazing for (int Lay = 1; Lay <= NGlass; ++Lay) { - Real64 SwitchFac = state.dataSurface->SurfWinSwitchingFactor(SurfNum); + Real64 SwitchFac = s_surf->SurfWinSwitchingFactor(SurfNum); Real64 ADiffWin = thisConstruct.AbsDiff(Lay); - state.dataSurface->SurfWinA(SurfNum, Lay) = Window::InterpSw(SwitchFac, AbWin(Lay), AbWinSh(Lay)); + s_surf->SurfWinA(SurfNum, Lay) = Window::InterpSw(SwitchFac, AbWin(Lay), AbWinSh(Lay)); // Add contribution of diffuse from beam on outside and inside reveal - state.dataSurface->SurfWinA(SurfNum, Lay) += - Window::InterpSw(SwitchFac, ADiffWin, ADiffWinSh(Lay)) * - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) + + s_surf->SurfWinA(SurfNum, Lay) += + Window::InterpSw(SwitchFac, ADiffWin, ADiffWinSh(Lay)) * s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) + Window::InterpSw(SwitchFac, thisConstruct.AbsDiffBack(Lay), thisConstructSh.AbsDiffBack(Lay)) * - state.dataSurface->SurfWinInsRevealDiffOntoGlazing(SurfNum); + s_surf->SurfWinInsRevealDiffOntoGlazing(SurfNum); } } } - } else if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { + } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Do not read from schedule file here since this will be called only if direct beam is hitting the window and schedule // will not be loaded in that case even if diffuse part of solar radiation is entering through the window if (FenSolAbsPtr == 0) { // Put in the equivalent layer absorptions // Simon: This should not be multiplied with CosInc since Abs coefficient already includes angular // factor - for (int Lay = 1; Lay <= state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) - .NLayers; + for (int Lay = 1; + Lay <= s_surf->SurfaceWindow(SurfNum).ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState).NLayers; ++Lay) { - Real64 absBeamWin = state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) + Real64 absBeamWin = s_surf->SurfaceWindow(SurfNum) + .ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState) .WinBmFtAbs(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, Lay); - Real64 AbWin = absBeamWin * CosInc * SunLitFract * - state.dataSurface->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay]; + Real64 AbWin = + absBeamWin * CosInc * SunLitFract * s_surf->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay]; // Add contribution of beam reflected from outside and inside reveal - state.dataSurface->SurfWinA(SurfNum, Lay) = - AbWin + - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * - state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) - .WinFtHemAbs(Lay) + - state.dataSurface->SurfWinInsRevealDiffOntoGlazing(SurfNum) * - state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) - .WinBkHemAbs(Lay); + s_surf->SurfWinA(SurfNum, Lay) = AbWin + + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * + s_surf->SurfaceWindow(SurfNum) + .ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState) + .WinFtHemAbs(Lay) + + s_surf->SurfWinInsRevealDiffOntoGlazing(SurfNum) * + s_surf->SurfaceWindow(SurfNum) + .ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState) + .WinBkHemAbs(Lay); } } - } else if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { + } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { // call the ASHWAT fenestration model for optical properties // determine the beam radiation absorptance and tranmittance of the // the equivalent layer window model @@ -6910,23 +6863,22 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) for (int Lay = 1; Lay <= CFS(EQLNum).NL + 1; ++Lay) { // Factor for front beam radiation absorbed for equivalent layer window model Real64 AbWinEQL = state.dataSolarShading->SurfWinAbsSolBeamEQL(1, Lay) * CosInc * SunLitFract * - state.dataSurface->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay]; + s_surf->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay]; ; if (CFS(EQLNum).L(1).LTYPE != LayerType::GLAZE) { // if the first layer is not glazing (or it is a shade) do not - state.dataSurface->SurfWinA(SurfNum, Lay) = AbWinEQL; + s_surf->SurfWinA(SurfNum, Lay) = AbWinEQL; } else { // the first layer is a glazing, include the outside reveal reflection // and the inside reveal reflection until indoor shade layer is encountered. if (CFS(EQLNum).L(Lay).LTYPE == LayerType::GLAZE) { - state.dataSurface->SurfWinA(SurfNum, Lay) = AbWinEQL + - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * - state.dataSolarShading->SurfWinAbsSolBeamEQL(1, Lay) + - state.dataSurface->SurfWinInsRevealDiffOntoGlazing(SurfNum) * - state.dataSolarShading->SurfWinAbsSolDiffEQL(2, Lay); + s_surf->SurfWinA(SurfNum, Lay) = + AbWinEQL + + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * state.dataSolarShading->SurfWinAbsSolBeamEQL(1, Lay) + + s_surf->SurfWinInsRevealDiffOntoGlazing(SurfNum) * state.dataSolarShading->SurfWinAbsSolDiffEQL(2, Lay); } else { - state.dataSurface->SurfWinA(SurfNum, Lay) = AbWinEQL + state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * - state.dataSolarShading->SurfWinAbsSolBeamEQL(1, Lay); + s_surf->SurfWinA(SurfNum, Lay) = AbWinEQL + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * + state.dataSolarShading->SurfWinAbsSolBeamEQL(1, Lay); } } } @@ -6938,39 +6890,35 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // SKY AND GROUND DIFFUSE SOLAR GAIN INTO ZONE FROM EXTERIOR WINDOW //----------------------------------------------------------------- - Real64 SkySolarInc = state.dataSurface->SurfSkySolarInc( - SurfNum); // Incident solar radiation on a window: sky diffuse plus beam reflected from obstruction (W/m2) - Real64 DiffTrans = 0.0; // Glazing diffuse solar transmittance (including shade/blind/switching, if present) - Real64 DiffTransGnd; // Ground diffuse solar transmittance for glazing with blind with horiz. slats or complex fen - Real64 DiffTransBmGnd; // Complex fen: diffuse solar transmittance for ground-reflected beam radiation - Real64 DiffTransSky; // Sky diffuse solar transmittance for glazing with blind with horiz. slats or complex fen + Real64 SkySolarInc = + s_surf->SurfSkySolarInc(SurfNum); // Incident solar radiation on a window: sky diffuse plus beam reflected from obstruction (W/m2) + Real64 DiffTrans = 0.0; // Glazing diffuse solar transmittance (including shade/blind/switching, if present) + Real64 DiffTransGnd; // Ground diffuse solar transmittance for glazing with blind with horiz. slats or complex fen + Real64 DiffTransBmGnd; // Complex fen: diffuse solar transmittance for ground-reflected beam radiation + Real64 DiffTransSky; // Sky diffuse solar transmittance for glazing with blind with horiz. slats or complex fen Real64 NomDiffTrans = 0.0; - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // complex fenestration + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // complex fenestration if (FenSolAbsPtr == 0) { // Sky diffuse solar transmittance for glazing with blind with horiz. slats or complex fen - DiffTransSky = state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) - .WinSkyTrans; + DiffTransSky = + s_surf->SurfaceWindow(SurfNum).ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState).WinSkyTrans; // Ground diffuse solar transmittance for glazing with blind with horiz. slats or complex fen - DiffTransGnd = state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) - .WinSkyGndTrans; + DiffTransGnd = + s_surf->SurfaceWindow(SurfNum).ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState).WinSkyGndTrans; // Complex fen: diffuse solar transmittance for ground-reflected beam radiation - DiffTransBmGnd = state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) + DiffTransBmGnd = s_surf->SurfaceWindow(SurfNum) + .ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState) .WinBmGndTrans(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep); // Define the effective transmittance for total sky and ground radiation - if ((SkySolarInc + state.dataSurface->SurfWinBmGndSolarInc(SurfNum) + state.dataSurface->SurfWinSkyGndSolarInc(SurfNum)) != 0.0) { - DiffTrans = - (SkySolarInc * DiffTransSky + state.dataSurface->SurfWinBmGndSolarInc(SurfNum) * DiffTransBmGnd + - state.dataSurface->SurfWinSkyGndSolarInc(SurfNum) * DiffTransGnd) / - (SkySolarInc + state.dataSurface->SurfWinBmGndSolarInc(SurfNum) + state.dataSurface->SurfWinSkyGndSolarInc(SurfNum)); + if ((SkySolarInc + s_surf->SurfWinBmGndSolarInc(SurfNum) + s_surf->SurfWinSkyGndSolarInc(SurfNum)) != 0.0) { + DiffTrans = (SkySolarInc * DiffTransSky + s_surf->SurfWinBmGndSolarInc(SurfNum) * DiffTransBmGnd + + s_surf->SurfWinSkyGndSolarInc(SurfNum) * DiffTransGnd) / + (SkySolarInc + s_surf->SurfWinBmGndSolarInc(SurfNum) + s_surf->SurfWinSkyGndSolarInc(SurfNum)); } // Also update the nominal diffuse transmittance - NomDiffTrans = state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) - .WinDiffTrans; + NomDiffTrans = + s_surf->SurfaceWindow(SurfNum).ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState).WinDiffTrans; // Do not store in TransDiff because it is not used by BSDF and rest of the code uses it as flag for opaque // surface incorrectly assuming wall heat transfer routines for windows. // Construct( Surface( SurfNum ).Construction ).TransDiff = NomDiffTrans; @@ -6981,66 +6929,56 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) DiffTrans = thisConstruct.TransDiff; } - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { - if (IS_SHADED_NO_GLARE_CTRL(state.dataSurface->SurfWinShadingFlag(SurfNum))) { - auto const &thisConstructSh = state.dataConstruction->Construct(ConstrNumSh); + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { + if (IS_SHADED_NO_GLARE_CTRL(s_surf->SurfWinShadingFlag(SurfNum))) { + auto const &constrSh = state.dataConstruction->Construct(ConstrNumSh); if (ShadeFlag != WinShadingType::SwitchableGlazing) { // Shade or blind if (ANY_SHADE_SCREEN(ShadeFlag)) { // Shade or screen - DiffTrans = thisConstructSh.TransDiff; + DiffTrans = constrSh.TransDiff; } else { // Blind - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(SurfNum); - Real64 SurfWinSlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum); - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - DiffTrans = General::Interp(thisConstructSh.BlTransDiff(SurfWinSlatsAngIndex), - thisConstructSh.BlTransDiff(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - DiffTrans = thisConstructSh.BlTransDiff(1); - } + int slatIdxLo = surfShade.blind.slatAngIdxLo; + int slatIdxHi = surfShade.blind.slatAngIdxHi; + Real64 slatInterpFac = surfShade.blind.slatAngInterpFac; + + auto const &btarLo = constrSh.blindTARs[slatIdxLo]; + auto const &btarHi = constrSh.blindTARs[slatIdxHi]; + + DiffTrans = Interp(btarLo.Sol.Ft.Df.Tra, btarHi.Sol.Ft.Df.Tra, slatInterpFac); + // For blinds with horizontal slats, allow different diffuse/diffuse transmittance for // ground and sky solar - if (state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).SlatOrientation == - DataWindowEquivalentLayer::Orientation::Horizontal) { - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - DiffTransGnd = - General::Interp(thisConstructSh.BlTransDiffGnd(SurfWinSlatsAngIndex), - thisConstructSh.BlTransDiffGnd(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - DiffTransSky = - General::Interp(thisConstructSh.BlTransDiffSky(SurfWinSlatsAngIndex), - thisConstructSh.BlTransDiffSky(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - DiffTransGnd = thisConstructSh.BlTransDiffGnd(1); - DiffTransSky = thisConstructSh.BlTransDiffSky(1); - } + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + if (matBlind->SlatOrientation == DataWindowEquivalentLayer::Orientation::Horizontal) { + DiffTransGnd = Interp(btarLo.Sol.Ft.Df.TraGnd, btarHi.Sol.Ft.Df.TraGnd, slatInterpFac); + DiffTransSky = Interp(btarLo.Sol.Ft.Df.TraSky, btarHi.Sol.Ft.Df.TraSky, slatInterpFac); } } - } else { - // Switchable glazing - Real64 SwitchFac = state.dataSurface->SurfWinSwitchingFactor(SurfNum); // Switching factor for a window - DiffTrans = Window::InterpSw(SwitchFac, thisConstruct.TransDiff, thisConstructSh.TransDiff); + } else { // Switchable glazing + + Real64 SwitchFac = s_surf->SurfWinSwitchingFactor(SurfNum); // Switching factor for a window + DiffTrans = Window::InterpSw(SwitchFac, thisConstruct.TransDiff, constrSh.TransDiff); } } } // Reporting variables - if (state.dataSurface->SurfWinWindowModelType(SurfNum) != WindowModel::EQL) { - state.dataSurface->SurfWinBlGlSysTsolDifDif(SurfNum) = DiffTrans; - state.dataSurface->SurfWinScGlSysTsolDifDif(SurfNum) = DiffTrans; + if (s_surf->SurfWinWindowModelType(SurfNum) != WindowModel::EQL) { + s_surf->SurfWinBlGlSysTsolDifDif(SurfNum) = DiffTrans; + s_surf->SurfWinScGlSysTsolDifDif(SurfNum) = DiffTrans; if (ANY_BLIND(ShadeFlag) || ShadeFlag == WinShadingType::ExtScreen) { - state.dataSurface->SurfWinBlGlSysTsolDifDif(SurfNum) = DiffTrans; - state.dataSurface->SurfWinScGlSysTsolDifDif(SurfNum) = DiffTrans; + s_surf->SurfWinBlGlSysTsolDifDif(SurfNum) = DiffTrans; + s_surf->SurfWinScGlSysTsolDifDif(SurfNum) = DiffTrans; if (ShadeFlag == WinShadingType::ExtScreen) { - auto const *screen = dynamic_cast(state.dataMaterial->Material(ScNum)); + auto const *screen = dynamic_cast(s_mat->materials(ScNum)); assert(screen != nullptr); - state.dataSurface->SurfWinScTsolDifDif(SurfNum) = screen->DfTrans; + s_surf->SurfWinScTsolDifDif(SurfNum) = screen->DfTrans; } else { - state.dataSurface->SurfWinBlTsolDifDif(SurfNum) = FrontDiffDiffTrans; + s_surf->SurfWinBlTsolDifDif(SurfNum) = FrontDiffDiffTrans; } } } @@ -7060,23 +6998,23 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (SunLitFract > 0.0) { if (surf.OriginalClass == SurfaceClass::TDD_Diffuser) { TBmDif = TransTDD(state, PipeNum, CosInc, Dayltg::RadType::SolarBeam); - state.dataDaylightingDevicesData->TDDPipe(PipeNum).TransSolBeam = TBmDif; // Report variable - } else if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { // Regular window - if (!state.dataSurface->SurfWinSolarDiffusing(SurfNum)) { // Clear glazing - TBmBm = POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] - } else { // Diffusing glazing - TBmDif = POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] + state.dataDaylightingDevicesData->TDDPipe(PipeNum).TransSolBeam = TBmDif; // Report variable + } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { // Regular window + if (!s_surf->SurfWinSolarDiffusing(SurfNum)) { // Clear glazing + TBmBm = POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] + } else { // Diffusing glazing + TBmDif = POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] } - } else if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { + } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Need to check what effect, if any, defining these here has - TBmBm = state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) + TBmBm = s_surf->SurfaceWindow(SurfNum) + .ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState) .WinDirSpecTrans(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep); - TBmDif = state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) + TBmDif = s_surf->SurfaceWindow(SurfNum) + .ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState) .WinDirHemiTrans(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep) - TBmBm; - } else if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { + } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { // get ASHWAT fenestration model beam-beam and beam-diffuse properties int EQLNum = state.dataConstruction->Construct(surf.Construction).EQLConsPtr; // equivalent layer fenestration index Real64 TBmBmEQL = state.dataSolarShading->SurfWinAbsSolBeamEQL(1, state.dataWindowEquivLayer->CFS(EQLNum).NL + 1); @@ -7092,12 +7030,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (surf.OriginalClass == SurfaceClass::TDD_Diffuser) { TDifBare = TransTDD(state, PipeNum, CosInc, Dayltg::RadType::SolarAniso); } else { - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Complex Fenestration: use hemispherical ave of directional-hemispherical transmittance // Note: this is not quite the same as the effective transmittance for total of sky and ground radiation - TDifBare = state.dataSurface->SurfaceWindow(SurfNum) - .ComplexFen.State(state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState) - .WinDiffTrans; + TDifBare = s_surf->SurfaceWindow(SurfNum).ComplexFen.State(s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState).WinDiffTrans; } else { // Regular window TDifBare = thisConstruct.TransDiff; } @@ -7108,7 +7044,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) //----------------------------------------------------------------- if (ConstrNumSh != 0 && SunLitFract > 0.0) { auto const &thisConstructSh = state.dataConstruction->Construct(ConstrNumSh); - if (state.dataSurface->SurfWinWindowModelType(SurfNum) != WindowModel::EQL) { + if (s_surf->SurfWinWindowModelType(SurfNum) != WindowModel::EQL) { if (IS_SHADED_NO_GLARE_CTRL(ShadeFlag)) { // Shade or screen or blind on, or switchable glazing // (note in the following that diffusing glass is not allowed in a window with shade, blind or switchable glazing) @@ -7123,10 +7059,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 TScBmBm; Real64 TBlBmBm; if (ShadeFlag == WinShadingType::ExtScreen) { // Exterior screen - auto const *screen = dynamic_cast(state.dataMaterial->Material(ScNum)); + auto const *screen = dynamic_cast(s_mat->materials(ScNum)); assert(screen != nullptr); - auto &surf = state.dataSurface->Surface(SurfNum); + auto &surf = s_surf->Surface(SurfNum); Real64 solPhi = std::acos(state.dataEnvrn->SOLCOS.z); Real64 solTheta = std::atan2(state.dataEnvrn->SOLCOS.x, state.dataEnvrn->SOLCOS.y); Real64 winPhi = surf.Tilt * Constant::DegToRad; @@ -7136,7 +7072,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Material::NormalizePhiTheta(phi, theta); #ifdef PRECALC_INTERP_SCREEN int ip1, ip2, it1, it2; - General::BilinearInterpCoeffs coeffs; + BilinearInterpCoeffs coeffs; Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); GetBilinearInterpCoeffs( phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); @@ -7160,9 +7096,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) TBmBmShBlSc = TBmBmSc; TBmDifShBlSc = TBmAllShBlSc - TBmBmShBlSc; // Report variable for Beam-to-Diffuse transmittance (scattered transmittance) - state.dataSurface->SurfWinScGlSysTsolBmBm(SurfNum) = TBmBmSc; - state.dataSurface->SurfWinScTsolBmBm(SurfNum) = TScBmBm; - state.dataSurface->SurfWinScTsolBmDif(SurfNum) = TScBmDif; + s_surf->SurfWinScGlSysTsolBmBm(SurfNum) = TBmBmSc; + s_surf->SurfWinScTsolBmBm(SurfNum) = TScBmBm; + s_surf->SurfWinScTsolBmDif(SurfNum) = TScBmDif; #else // !PRECALC_INTERP_SCREEN Material::ScreenBmTransAbsRef btar; CalcScreenTransmittance(state, screen, phi, theta, btar); @@ -7182,12 +7118,12 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) TBmBmShBlSc = TBmBmSc; TBmDifShBlSc = TBmAllShBlSc - TBmBmShBlSc; // Report variable for Beam-to-Diffuse transmittance (scattered transmittance) - state.dataSurface->SurfWinScGlSysTsolBmBm(SurfNum) = TBmBmSc; - state.dataSurface->SurfWinScTsolBmBm(SurfNum) = TScBmBm; - state.dataSurface->SurfWinScTsolBmDif(SurfNum) = TScBmDif; + s_surf->SurfWinScGlSysTsolBmBm(SurfNum) = TBmBmSc; + s_surf->SurfWinScTsolBmBm(SurfNum) = TScBmBm; + s_surf->SurfWinScTsolBmDif(SurfNum) = TScBmDif; #endif // PRECALC_INTERP_SCREEN } else { - TBlBmBm = state.dataSurface->SurfWinBlindBmBmTrans(SurfNum); + TBlBmBm = surfShade.blind.bmBmTrans; TBlBmDif = FrontBeamDiffTrans; if (ShadeFlag == WinShadingType::IntBlind) { Real64 RhoBlBmDifFr = FrontBeamDiffRefl; // Beam-diffuse front reflectance of blind @@ -7223,7 +7159,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 tfshBd = FrontBeamDiffTrans; Real64 t1 = POLYF(CosInc, thisConstruct.tBareSolCoef(1)); Real64 t2 = POLYF(CosInc, thisConstruct.tBareSolCoef(2)); - Real64 tfshBB = state.dataSurface->SurfWinBlindBmBmTrans(SurfNum); + Real64 tfshBB = surfShade.blind.bmBmTrans; if (NGlass == 2) { Real64 rf2 = POLYF(CosInc, thisConstruct.rfBareSolCoef(2)); Real64 rfshB = FrontBeamDiffRefl; @@ -7249,9 +7185,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) TBmBmShBlSc = TBmBmBl; TBmDifShBlSc = TBmAllShBlSc - TBmBmShBlSc; } - state.dataSurface->SurfWinBlTsolBmBm(SurfNum) = TBlBmBm; - state.dataSurface->SurfWinBlTsolBmDif(SurfNum) = TBlBmDif; - state.dataSurface->SurfWinBlGlSysTsolBmBm(SurfNum) = TBmBmBl; + s_surf->SurfWinBlTsolBmBm(SurfNum) = TBlBmBm; + s_surf->SurfWinBlTsolBmDif(SurfNum) = TBlBmDif; + s_surf->SurfWinBlGlSysTsolBmBm(SurfNum) = TBmBmBl; } } } // End of check if ShadeFlag > 0 and ShadeFlag < 10 @@ -7260,17 +7196,17 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (ShadeFlag == WinShadingType::SwitchableGlazing) { // Switchable glazing - Real64 SwitchFac = state.dataSurface->SurfWinSwitchingFactor(SurfNum); - if (!state.dataSurface->SurfWinSolarDiffusing(SurfNum)) { + Real64 SwitchFac = s_surf->SurfWinSwitchingFactor(SurfNum); + if (!s_surf->SurfWinSolarDiffusing(SurfNum)) { TBmBm = Window::InterpSw(SwitchFac, TBmBm, TBmAllShBlSc); } else { TBmDif = Window::InterpSw(SwitchFac, TBmDif, TBmAllShBlSc); } } // Report variables - state.dataSurface->SurfWinGlTsolBmBm(SurfNum) = TBmBm; - state.dataSurface->SurfWinGlTsolBmDif(SurfNum) = TBmDif; - state.dataSurface->SurfWinGlTsolDifDif(SurfNum) = TDifBare; + s_surf->SurfWinGlTsolBmBm(SurfNum) = TBmBm; + s_surf->SurfWinGlTsolBmDif(SurfNum) = TBmDif; + s_surf->SurfWinGlTsolDifDif(SurfNum) = TDifBare; //----------------------------------------------------------------- // BLOCK 4 - REPORT WINDOW TRANSMITTANCE @@ -7287,12 +7223,13 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) state.dataSolarShading->SurfWinTransBmDifSolar(SurfNum) = 0.0; // Factor for exterior beam to diffuse solar transmitted through window, or window plus shade, into zone at current time (m2) - Real64 InOutProjSLFracMult = state.dataSurface->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay]; - if (state.dataSurface->SurfWinWindowModelType(SurfNum) != WindowModel::EQL) { + Real64 InOutProjSLFracMult = s_surf->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay]; + if (s_surf->SurfWinWindowModelType(SurfNum) != WindowModel::EQL) { state.dataSolarShading->SurfWinTransDifSolar(SurfNum) = DiffTrans * surf.Area; if (ANY_BLIND(ShadeFlag)) { - if (state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).SlatOrientation == - DataWindowEquivalentLayer::Orientation::Horizontal) { + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + if (matBlind->SlatOrientation == DataWindowEquivalentLayer::Orientation::Horizontal) { state.dataSolarShading->SurfWinTransDifSolarGnd(SurfNum) = DiffTransGnd * surf.Area; state.dataSolarShading->SurfWinTransDifSolarSky(SurfNum) = DiffTransSky * surf.Area; } @@ -7321,25 +7258,23 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } // Add diffuse transmitted by window from beam reflected from outside reveal - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Complex Fenestration + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Complex Fenestration if (FenSolAbsPtr == 0) { state.dataSolarShading->SurfWinTransBmSolar(SurfNum) = (TBmBm + TBmDif) * SunLitFract * CosInc * surf.Area * InOutProjSLFracMult; state.dataSolarShading->SurfWinTransBmBmSolar(SurfNum) = TBmBm * SunLitFract * CosInc * surf.Area * InOutProjSLFracMult; // m2 state.dataSolarShading->SurfWinTransBmDifSolar(SurfNum) = TBmDif * SunLitFract * CosInc * surf.Area * InOutProjSLFracMult; // m2 state.dataSolarShading->SurfWinTransBmSolar(SurfNum) += - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * NomDiffTrans * surf.Area; + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * NomDiffTrans * surf.Area; state.dataSolarShading->SurfWinTransBmDifSolar(SurfNum) += - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * NomDiffTrans * surf.Area; + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * NomDiffTrans * surf.Area; } else { state.dataSolarShading->SurfWinTransBmSolar(SurfNum) = 0.0; state.dataSolarShading->SurfWinTransBmDifSolar(SurfNum) = 0.0; } } else { // Regular window // this is also valid for equivalent layer window - state.dataSolarShading->SurfWinTransBmSolar(SurfNum) += - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * DiffTrans * surf.Area; - state.dataSolarShading->SurfWinTransBmDifSolar(SurfNum) += - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * DiffTrans * surf.Area; + state.dataSolarShading->SurfWinTransBmSolar(SurfNum) += s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * DiffTrans * surf.Area; + state.dataSolarShading->SurfWinTransBmDifSolar(SurfNum) += s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * DiffTrans * surf.Area; } //----------------------------------------------------------------- @@ -7350,8 +7285,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Window is schedule surface gained. Do not make addition to what enters into zone since that information is not available if (FenSolAbsPtr == 0) { Real64 TBmAll; // Window beam-to-(beam+diffuse) transmittance - if (state.dataSurface->SurfWinWindowModelType(SurfNum) != WindowModel::BSDF && - (ANY_BLIND(ShadeFlag) || ANY_SHADE_SCREEN(ShadeFlag))) { + if (s_surf->SurfWinWindowModelType(SurfNum) != WindowModel::BSDF && (ANY_BLIND(ShadeFlag) || ANY_SHADE_SCREEN(ShadeFlag))) { TBmAll = TBmAllShBlSc; } else { TBmAll = TBmBm + TBmDif; @@ -7366,25 +7300,23 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // The BTOTZone is the solar into zone assuming no inside or outside reveals // The inside reveals receive solar (reflected part + absorbed part) from the window, this amount should be deducted from the // BTOTZone, then adds the InsRevealDiffIntoZone - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Complex Fenestration + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Complex Fenestration // Do not add total into zone from scheduled surface gains. That will be added later if (SurfaceScheduledSolarInc(state, SurfNum, ConstrNum) == 0) { - BTOTZone = BTOTZone - state.dataSurface->SurfWinBmSolRefldInsReveal(SurfNum) - - state.dataSurface->SurfWinBmSolAbsdInsReveal(SurfNum) + state.dataSurface->SurfWinInsRevealDiffIntoZone(SurfNum) + - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * NomDiffTrans * surf.Area; + BTOTZone = BTOTZone - s_surf->SurfWinBmSolRefldInsReveal(SurfNum) - s_surf->SurfWinBmSolAbsdInsReveal(SurfNum) + + s_surf->SurfWinInsRevealDiffIntoZone(SurfNum) + + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * NomDiffTrans * surf.Area; } } else { // Regular window - BTOTZone = BTOTZone - state.dataSurface->SurfWinBmSolRefldInsReveal(SurfNum) - - state.dataSurface->SurfWinBmSolAbsdInsReveal(SurfNum) + state.dataSurface->SurfWinInsRevealDiffIntoZone(SurfNum) + - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * DiffTrans * surf.Area; + BTOTZone = BTOTZone - s_surf->SurfWinBmSolRefldInsReveal(SurfNum) - s_surf->SurfWinBmSolAbsdInsReveal(SurfNum) + + s_surf->SurfWinInsRevealDiffIntoZone(SurfNum) + + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * DiffTrans * surf.Area; } // Add beam solar absorbed by outside reveal to outside of window's base surface. Add beam solar absorbed by inside reveal to inside // of window's base surface. This ignores 2-D heat transfer effects. int BaseSurfNum = surf.BaseSurf; - state.dataSurface->SurfOpaqAI(BaseSurfNum) += - state.dataSurface->SurfWinBmSolAbsdInsReveal(SurfNum) / state.dataSurface->Surface(BaseSurfNum).Area; - state.dataSurface->SurfOpaqAO(BaseSurfNum) += - state.dataSurface->SurfWinBmSolAbsdOutsReveal(SurfNum) / state.dataSurface->Surface(BaseSurfNum).Area; + s_surf->SurfOpaqAI(BaseSurfNum) += s_surf->SurfWinBmSolAbsdInsReveal(SurfNum) / s_surf->Surface(BaseSurfNum).Area; + s_surf->SurfOpaqAO(BaseSurfNum) += s_surf->SurfWinBmSolAbsdOutsReveal(SurfNum) / s_surf->Surface(BaseSurfNum).Area; } //----------------------------------------------------------------- @@ -7396,9 +7328,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // is assumed to be zero. The beam-beam transmittance of tubular daylighting devices is also // assumed to be zero. if (SunLitFract > 0.0) { - if (state.dataSurface->SurfWinWindowModelType(SurfNum) != WindowModel::BSDF) - if (ANY_SHADE(ShadeFlag) || state.dataSurface->SurfWinSolarDiffusing(SurfNum) || - surf.OriginalClass == SurfaceClass::TDD_Diffuser || surf.Class == SurfaceClass::TDD_Dome) + if (s_surf->SurfWinWindowModelType(SurfNum) != WindowModel::BSDF) + if (ANY_SHADE(ShadeFlag) || s_surf->SurfWinSolarDiffusing(SurfNum) || surf.OriginalClass == SurfaceClass::TDD_Diffuser || + surf.Class == SurfaceClass::TDD_Dome) continue; // Find interior beam radiation that is: @@ -7410,13 +7342,13 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Beam-beam transmittance of exterior window Real64 TBm; // Window beam-beam transmittance Real64 TBmDenom; // TBmDenominator - Real64 TBmBmSc = state.dataSurface->SurfWinScGlSysTsolBmBm(SurfNum); - Real64 TBmBmBl = state.dataSurface->SurfWinBlGlSysTsolBmBm(SurfNum); - Real64 TBmBm = state.dataSurface->SurfWinGlTsolBmBm(SurfNum); + Real64 TBmBmSc = s_surf->SurfWinScGlSysTsolBmBm(SurfNum); + Real64 TBmBmBl = s_surf->SurfWinBlGlSysTsolBmBm(SurfNum); + Real64 TBmBm = s_surf->SurfWinGlTsolBmBm(SurfNum); - Real64 InOutProjSLFracMult = state.dataSurface->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay]; + Real64 InOutProjSLFracMult = s_surf->SurfaceWindow(SurfNum).InOutProjSLFracMult[state.dataGlobal->HourOfDay]; int InShelfSurf = 0; // Inside daylighting shelf surface number - int ShelfNum = state.dataSurface->SurfDaylightingShelfInd(SurfNum); + int ShelfNum = s_surf->SurfDaylightingShelfInd(SurfNum); if (ShelfNum > 0) { // Daylighting shelf InShelfSurf = state.dataDaylightingDevicesData->Shelf(ShelfNum).InSurf; } @@ -7429,7 +7361,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Correction for beam absorbed by inside reveal TBmDenom = (SunLitFract * CosInc * surf.Area * InOutProjSLFracMult); if (TBmDenom != 0.0) { // when =0.0, no correction - TBm -= state.dataSurface->SurfWinBmSolAbsdInsReveal(SurfNum) / TBmDenom; + TBm -= s_surf->SurfWinBmSolAbsdInsReveal(SurfNum) / TBmDenom; } TBm = max(0.0, TBm); // this multiplier doesn't work with other shading, so no need to apply in other branches @@ -7443,19 +7375,22 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // BTOTWinZone - Transmitted beam solar factor for a window [m2] Real64 BTOTWinZone = TBm * SunLitFract * surf.Area * CosInc * InOutProjSLFracMult; // Shelf surface area is divided by 2 because only one side sees beam (Area was multiplied by 2 during init) - state.dataSurface->SurfOpaqAI(InShelfSurf) += BTOTWinZone / (0.5 * state.dataSurface->Surface(InShelfSurf).Area); //[-] - BABSZone += BTOTWinZone; //[m2] + s_surf->SurfOpaqAI(InShelfSurf) += BTOTWinZone / (0.5 * s_surf->Surface(InShelfSurf).Area); //[-] + BABSZone += BTOTWinZone; //[m2] continue; } if (state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::FullInteriorExterior) { // Full interior solar distribution - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { // Loop over back surfaces irradiated by beam from this exterior window for (int IBack = 1; IBack <= state.dataBSDFWindow->MaxBkSurf; ++IBack) { int BackSurfNum = state.dataHeatBal->SurfWinBackSurfaces(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, IBack, SurfNum); if (BackSurfNum == 0) break; // No more irradiated back surfaces for this exterior window - int ConstrNumBack = state.dataSurface->SurfActiveConstruction(BackSurfNum); + + auto &surfShadeBack = s_surf->surfShades(BackSurfNum); + int ConstrNumBack = s_surf->SurfActiveConstruction(BackSurfNum); + int NBackGlass = state.dataConstruction->Construct(ConstrNumBack).TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) @@ -7469,9 +7404,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Back surface is opaque interior or exterior wall // Interior solar absorptance of opaque surface Real64 AbsIntSurf = state.dataHeatBalSurf->SurfAbsSolarInt(BackSurfNum); - state.dataSurface->SurfOpaqAI(BackSurfNum) += - BOverlap * AbsIntSurf / state.dataSurface->Surface(BackSurfNum).Area; //[-] - BABSZone += BOverlap * AbsIntSurf; //[m2] + s_surf->SurfOpaqAI(BackSurfNum) += BOverlap * AbsIntSurf / s_surf->Surface(BackSurfNum).Area; //[-] + BABSZone += BOverlap * AbsIntSurf; //[m2] } else { @@ -7480,16 +7414,16 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // are assumed to be bare, i.e., they have no shading device and are non-switchable. // The layer order for interior windows is "outside" to "inside," where "outside" refers to // the adjacent zone and "inside" refers to the current zone. - WinShadingType ShadeFlagBack = state.dataSurface->SurfWinShadingFlag(BackSurfNum); - Real64 SlatAngBack = state.dataSurface->SurfWinSlatAngThisTS(BackSurfNum); + WinShadingType ShadeFlagBack = s_surf->SurfWinShadingFlag(BackSurfNum); + Real64 slatAngBack = surfShadeBack.blind.slatAng; Real64 CosIncBack = std::abs(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, BackSurfNum)); - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Transmitting window is complex fen, change the incident angle to one for ray joining // transmitting and back window centers CosIncBack = std::abs(state.dataBSDFWindow->ComplexWind(SurfNum).sdotN(IBack)); } - int ConstrNumBackShRaw = state.dataSurface->SurfWinActiveShadedConstruction(BackSurfNum); + int ConstrNumBackShRaw = s_surf->SurfWinActiveShadedConstruction(BackSurfNum); int const ConstrNumBackSh = ConstrNumBackShRaw == 0 ? ConstrNumBack : ConstrNumBackShRaw; state.dataSolarShading->SurfWinAbsBeam.dimension(state.dataHeatBal->MaxSolidWinLayers, 0.0); Real64 TransBeamWin = 0.0; // Beam solar transmittance of a window @@ -7517,40 +7451,41 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } // Interior beam absorbed by INTERIOR SHADE of back exterior window - if (ShadeFlagBack == WinShadingType::IntShade) { state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = BOverlap * state.dataConstruction->Construct(ConstrNumBackSh).AbsDiffBackShade / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); + (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); BABSZone += BOverlap * state.dataConstruction->Construct(ConstrNumBackSh).AbsDiffBackShade; backSurfBeamSolInTrans += BOverlap * state.dataConstruction->Construct(ConstrNumBackSh).AbsDiffBackShade; - } else if (ShadeFlagBack == - WinShadingType::ExtShade) { // Interior beam absorbed by EXTERIOR SHADE of back exterior window + + // Interior beam absorbed by EXTERIOR SHADE of back exterior window + } else if (ShadeFlagBack == WinShadingType::ExtShade) { Real64 RGlFront = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffFront; - auto const *thisMaterial = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(1))); - assert(thisMaterial != nullptr); - Real64 AbsSh = thisMaterial->AbsorpSolar; - Real64 RhoSh = 1.0 - AbsSh - thisMaterial->Trans; + auto const *matSh = s_mat->materials(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(1)); + auto const *matFenSh = dynamic_cast(matSh); + assert(matFenSh != nullptr); + + Real64 AbsSh = matFenSh->AbsorpSolar; + Real64 RhoSh = 1.0 - AbsSh - matFenSh->Trans; Real64 AShBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef) * AbsSh / (1.0 - RGlFront * RhoSh); BABSZone += BOverlap * AShBack; backSurfBeamSolInTrans += BOverlap * AShBack; state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = - BOverlap * AShBack / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); - } else if (ShadeFlagBack == - WinShadingType::BGShade) { // Interior beam absorbed by BETWEEN-GLASS SHADE of back exterior window + BOverlap * AShBack / (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); + + // Interior beam absorbed by BETWEEN-GLASS SHADE of back exterior window + } else if (ShadeFlagBack == WinShadingType::BGShade) { Real64 rbd1k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(1); Real64 rfd2k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(2); Real64 AShBack; // System shade absorptance for interior beam solar if (NBackGlass == 2) { Real64 t2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(2)); - auto const *thisMaterial = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(3))); - assert(thisMaterial != nullptr); - Real64 TrSh = thisMaterial->Trans; // Shade material solar transmittance - Real64 RhoSh = thisMaterial->ReflectShade; // Shade material solar absorptance + auto const *matShade = dynamic_cast( + s_mat->materials(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(3))); + assert(matShade != nullptr); + Real64 TrSh = matShade->Trans; // Shade material solar transmittance + Real64 RhoSh = matShade->ReflectShade; // Shade material solar absorptance Real64 AbsSh = min(1.0, max(0.0, 1 - TrSh - RhoSh)); // Shade material solar absorptance AShBack = t2k * (1 + RhoSh * rfd2k + TrSh * rbd1k) * AbsSh; } else { // NBackGlass = 3 @@ -7558,16 +7493,16 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 td2k = state.dataConstruction->Construct(ConstrNumBack).tBareSolDiff(2); Real64 rbd2k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(2); Real64 rfd3k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(3); - auto const *thisMaterial = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(5))); - assert(thisMaterial != nullptr); - Real64 TrSh = thisMaterial->Trans; - Real64 RhoSh = thisMaterial->ReflectShade; + auto const *matShade = dynamic_cast( + s_mat->materials(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(5))); + assert(matShade != nullptr); + Real64 TrSh = matShade->Trans; + Real64 RhoSh = matShade->ReflectShade; Real64 AbsSh = min(1.0, max(0.0, 1 - TrSh - RhoSh)); AShBack = t3k * (1 + RhoSh * rfd3k + TrSh * (rbd2k + td2k * rbd1k * td2k)) * AbsSh; } state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = - BOverlap * AShBack / state.dataSurface->Surface(BackSurfNum).Area; + BOverlap * AShBack / s_surf->Surface(BackSurfNum).Area; BABSZone += BOverlap * AShBack; backSurfBeamSolInTrans += BOverlap * AShBack; } @@ -7575,91 +7510,36 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Interior beam absorptance of glass layers and beam absorbed in blind // of back exterior window with BLIND if (ANY_BLIND(ShadeFlagBack)) { - int BlNumBack = state.dataSurface->SurfWinBlindNumber(BackSurfNum); // Back surface blind number - auto const &thisBlindBack = state.dataMaterial->Blind(BlNumBack); - auto const &thisBlind = state.dataMaterial->Blind(BlNum); - Real64 ProfAngBack = - state.dataSurface->SurfWinProfileAng(BackSurfNum); // Back window solar profile angle (radians) - - int SlatsAngIndexLowerBack = state.dataSurface->SurfWinSlatsAngIndex(BackSurfNum); - int ProfAngIndexLowerBack = state.dataSurface->SurfWinProfAngIndex(BackSurfNum); - int SlatsAngIndexUpperBack = std::min(Material::MaxSlatAngs, SlatsAngIndexLowerBack + 1); - int ProfAngIndexUpperBack = std::min(Material::MaxProfAngs, ProfAngIndexLowerBack + 1); - Real64 SlatsAngInterpFacBack = state.dataSurface->SurfWinSlatsAngInterpFac(BackSurfNum); - Real64 ProfAngInterpFacBack = state.dataSurface->SurfWinProfAngInterpFac(BackSurfNum); + auto const &btarBack = surfShadeBack.blind.TAR; + auto const *matBlindBack = + dynamic_cast(s_mat->materials(surfShadeBack.blind.matNum)); + assert(matBlindBack != nullptr); + + auto const &btar = surfShade.blind.TAR; + Real64 profAngBack = surfShadeBack.blind.profAng; + + int profIdxLoBack = surfShadeBack.blind.profAngIdxLo; + int profIdxHiBack = surfShadeBack.blind.profAngIdxHi; + Real64 profInterpFacBack = surfShadeBack.blind.profAngInterpFac; Real64 TGlBmBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); - Real64 TBlBmBmBack = - Window::BlindBeamBeamTrans(ProfAngBack, - Constant::Pi - SlatAngBack, - thisBlindBack.SlatWidth, - thisBlindBack.SlatSeparation, - thisBlindBack.SlatThickness); // Blind solar back beam-beam transmittance - Real64 TBlBmDiffBack; // Blind solar back beam-diffuse transmittance - if (state.dataSurface->SurfWinMovableSlats(BackSurfNum)) { - TBlBmDiffBack = - Window::InterpProfSlat(thisBlind.SolBackBeamDiffTrans(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffTrans(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffTrans(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolBackBeamDiffTrans(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - } else { - TBlBmDiffBack = General::Interp(thisBlind.SolBackBeamDiffTrans(1, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffTrans(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - } + Real64 TBlBmBmBack = matBlindBack->BeamBeamTrans(profAngBack, Constant::Pi - slatAngBack); + + // Blind solar back beam-diffuse transmittance + // Is this supposed to be blindBack? + Real64 TBlBmDiffBack = + Interp(btar.Sol.Bk.Bm[profIdxLoBack].DfTra, btar.Sol.Bk.Bm[profIdxLoBack].DfTra, profInterpFacBack); if (ShadeFlagBack == WinShadingType::IntBlind) { // Interior beam absorptance of GLASS LAYERS of exterior back window with INTERIOR BLIND - Real64 RhoBlFront; // Blind solar front diffuse reflectance - Real64 AbsBlFront; // Blind solar front beam absorptance - Real64 AbsBlBack; // Blind solar back beam absorptance - if (state.dataSurface->SurfWinMovableSlats(BackSurfNum)) { - FrontDiffDiffRefl = General::Interp( - thisBlindBack.SolFrontDiffDiffRefl(state.dataSurface->SurfWinSlatsAngIndex(BackSurfNum)), - thisBlindBack.SolFrontDiffDiffRefl( - std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(BackSurfNum) + 1)), - state.dataSurface->SurfWinSlatsAngInterpFac(BackSurfNum)); - FrontDiffAbs = - General::Interp(thisBlindBack.SolFrontDiffAbs(state.dataSurface->SurfWinSlatsAngIndex(BackSurfNum)), - thisBlindBack.SolFrontDiffAbs(std::min( - Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(BackSurfNum) + 1)), - state.dataSurface->SurfWinSlatsAngInterpFac(BackSurfNum)); - RhoBlFront = - Window::InterpProfSlat(thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - AbsBlFront = - Window::InterpProfSlat(thisBlind.SolFrontBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolFrontBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - AbsBlBack = - Window::InterpProfSlat(thisBlind.SolBackBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolBackBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - } else { - FrontDiffDiffRefl = thisBlindBack.SolFrontDiffDiffRefl(1); // Blind solar front beam reflectance - FrontDiffAbs = thisBlindBack.SolFrontDiffAbs(1); - RhoBlFront = General::Interp(thisBlind.SolFrontBeamDiffRefl(1, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamDiffRefl(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - AbsBlFront = General::Interp(thisBlind.SolFrontBeamAbs(1, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamAbs(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - AbsBlBack = General::Interp(thisBlind.SolBackBeamAbs(1, ProfAngIndexLowerBack), - thisBlind.SolBackBeamAbs(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - } + FrontDiffDiffRefl = btarBack.Sol.Ft.Df.Ref; // Blind solar front beam reflectance + FrontDiffAbs = btarBack.Sol.Ft.Df.Abs; + Real64 RhoBlFront = + Interp(btar.Sol.Ft.Bm[profIdxLoBack].DfRef, btar.Sol.Ft.Bm[profIdxHiBack].DfRef, profInterpFacBack); + Real64 AbsBlFront = + Interp(btar.Sol.Ft.Bm[profIdxLoBack].Abs, btar.Sol.Ft.Bm[profIdxHiBack].Abs, profInterpFacBack); + Real64 AbsBlBack = + Interp(btar.Sol.Bk.Bm[profIdxLoBack].Abs, btar.Sol.Bk.Bm[profIdxHiBack].Abs, profInterpFacBack); Real64 RhoBlDiffFront = FrontDiffDiffRefl; // Glazing system solar back beam-beam reflectance Real64 RGlBack = POLYF(CosIncBack, @@ -7693,8 +7573,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) (RGlBack * TBlBmBmBack * RhoBlFront + TBlBmDiffBack); // Blind solar back absorptance for interior solar state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = - BOverlap * ABlBack / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); + BOverlap * ABlBack / (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); BABSZone += BOverlap * ABlBack; backSurfBeamSolInTrans += BOverlap * ABlBack; @@ -7704,42 +7583,14 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RGlDiffFront = state.dataConstruction->Construct(ConstrNumBack) .ReflectSolDiffFront; // Glazing system front diffuse solar reflectance - Real64 RhoBlBack; // Blind solar back beam-diffuse reflectance - Real64 RhoBlBmDifBk; - Real64 AbsBlBack; - if (state.dataSurface->SurfWinMovableSlats(BackSurfNum)) { - RhoBlBack = - Window::InterpProfSlat(thisBlind.SolBackBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - RhoBlBmDifBk = - Window::InterpProfSlat(thisBlind.SolBackBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - AbsBlBack = - Window::InterpProfSlat(thisBlind.SolBackBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolBackBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - } else { - RhoBlBack = General::Interp(thisBlind.SolBackBeamDiffRefl(1, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffRefl(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - RhoBlBmDifBk = General::Interp(thisBlind.SolBackBeamDiffRefl(1, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffRefl(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - AbsBlBack = General::Interp(thisBlind.SolBackBeamAbs(1, ProfAngIndexLowerBack), - thisBlind.SolBackBeamAbs(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - } + + // Is this supposed to be beam-beam reflection? + Real64 RhoBlBack = + Interp(btar.Sol.Bk.Bm[profIdxLoBack].DfRef, btar.Sol.Bk.Bm[profIdxHiBack].DfRef, profInterpFacBack); + Real64 RhoBlBmDifBk = + Interp(btar.Sol.Bk.Bm[profIdxLoBack].DfRef, btar.Sol.Bk.Bm[profIdxHiBack].DfRef, profInterpFacBack); + Real64 AbsBlBack = + Interp(btar.Sol.Bk.Bm[profIdxLoBack].Abs, btar.Sol.Bk.Bm[profIdxHiBack].Abs, profInterpFacBack); for (int Lay = 1; Lay <= NBackGlass; ++Lay) { Real64 AbWinBack = @@ -7762,8 +7613,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) BABSZone += BOverlap * ABlBack; backSurfBeamSolInTrans += BOverlap * ABlBack; state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = - BOverlap * ABlBack / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); + BOverlap * ABlBack / (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); } else { // ShadeFlagBack == BGBlindOn @@ -7782,103 +7632,29 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 rfd2k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(2); Real64 rbd1k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(1); Real64 rbd2k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(2); - Real64 tfshBBk = Window::BlindBeamBeamTrans(ProfAngBack, - SlatAngBack, - thisBlindBack.SlatWidth, - thisBlindBack.SlatSeparation, - thisBlindBack.SlatThickness); - Real64 tbshBBk = Window::BlindBeamBeamTrans(ProfAngBack, - Constant::Pi - SlatAngBack, - thisBlindBack.SlatWidth, - thisBlindBack.SlatSeparation, - thisBlindBack.SlatThickness); - - Real64 tfshBdk = General::Interp(thisBlind.SolFrontBeamDiffTrans(1, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamDiffTrans(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - Real64 tbshBdk = General::Interp(thisBlind.SolBackBeamDiffTrans(1, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffTrans(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - Real64 rfshBk = General::Interp(thisBlind.SolFrontBeamDiffRefl(1, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamDiffRefl(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - Real64 rbshBk = General::Interp(thisBlind.SolBackBeamDiffRefl(1, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffRefl(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - Real64 afshBk = General::Interp(thisBlind.SolFrontBeamAbs(1, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamAbs(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - Real64 abshBk = General::Interp(thisBlind.SolBackBeamAbs(1, ProfAngIndexLowerBack), - thisBlind.SolBackBeamAbs(1, ProfAngIndexUpperBack), - ProfAngInterpFacBack); - Real64 tfshdk = thisBlindBack.SolFrontDiffDiffTrans(1); - Real64 rfshdk = thisBlindBack.SolFrontDiffDiffRefl(1); - Real64 afshdk = thisBlindBack.SolFrontDiffAbs(1); - Real64 tbshdk = thisBlindBack.SolBackDiffDiffTrans(1); - Real64 rbshdk = thisBlindBack.SolBackDiffDiffRefl(1); - Real64 abshdk = thisBlindBack.SolBackDiffAbs(1); - if (state.dataSurface->SurfWinMovableSlats(BackSurfNum)) { - tfshdk = General::Interp(thisBlindBack.SolFrontDiffDiffTrans(SlatsAngIndexLowerBack), - thisBlindBack.SolFrontDiffDiffTrans(SlatsAngIndexUpperBack), - SlatsAngInterpFacBack); - rfshdk = General::Interp(thisBlindBack.SolFrontDiffDiffRefl(SlatsAngIndexLowerBack), - thisBlindBack.SolFrontDiffDiffRefl(SlatsAngIndexUpperBack), - SlatsAngInterpFacBack); - afshdk = General::Interp(thisBlindBack.SolFrontDiffAbs(SlatsAngIndexLowerBack), - thisBlindBack.SolFrontDiffAbs(SlatsAngIndexUpperBack), - SlatsAngInterpFacBack); - tbshdk = General::Interp(thisBlindBack.SolBackDiffDiffTrans(SlatsAngIndexLowerBack), - thisBlindBack.SolBackDiffDiffTrans(SlatsAngIndexUpperBack), - SlatsAngInterpFacBack); - rbshdk = General::Interp(thisBlindBack.SolBackDiffDiffRefl(SlatsAngIndexLowerBack), - thisBlindBack.SolBackDiffDiffRefl(SlatsAngIndexUpperBack), - SlatsAngInterpFacBack); - abshdk = General::Interp(thisBlindBack.SolBackDiffAbs(SlatsAngIndexLowerBack), - thisBlindBack.SolBackDiffAbs(SlatsAngIndexUpperBack), - SlatsAngInterpFacBack); - tfshBdk = - Window::InterpProfSlat(thisBlind.SolFrontBeamDiffTrans(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamDiffTrans(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamDiffTrans(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolFrontBeamDiffTrans(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - tbshBdk = - Window::InterpProfSlat(thisBlind.SolBackBeamDiffTrans(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffTrans(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffTrans(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolBackBeamDiffTrans(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - rfshBk = - Window::InterpProfSlat(thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolFrontBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - rbshBk = - Window::InterpProfSlat(thisBlind.SolBackBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolBackBeamDiffRefl(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - afshBk = Window::InterpProfSlat(thisBlind.SolFrontBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolFrontBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolFrontBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - abshBk = Window::InterpProfSlat(thisBlind.SolBackBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexLowerBack), - thisBlind.SolBackBeamAbs(SlatsAngIndexLowerBack, ProfAngIndexUpperBack), - thisBlind.SolBackBeamAbs(SlatsAngIndexUpperBack, ProfAngIndexUpperBack), - SlatsAngInterpFacBack, - ProfAngInterpFacBack); - } - + Real64 tfshBBk = matBlindBack->BeamBeamTrans(profAngBack, slatAngBack); + Real64 tbshBBk = matBlindBack->BeamBeamTrans(profAngBack, Constant::Pi - slatAngBack); + + Real64 tfshBdk = + Interp(btar.Sol.Ft.Bm[profIdxLoBack].DfTra, btar.Sol.Ft.Bm[profIdxHiBack].DfTra, profInterpFacBack); + Real64 tbshBdk = + Interp(btar.Sol.Bk.Bm[profIdxLoBack].DfTra, btar.Sol.Bk.Bm[profIdxHiBack].DfTra, profInterpFacBack); + Real64 rfshBk = + Interp(btar.Sol.Ft.Bm[profIdxLoBack].DfRef, btar.Sol.Ft.Bm[profIdxHiBack].DfRef, profInterpFacBack); + Real64 rbshBk = + Interp(btar.Sol.Bk.Bm[profIdxLoBack].DfRef, btar.Sol.Bk.Bm[profIdxHiBack].DfRef, profInterpFacBack); + Real64 afshBk = + Interp(btar.Sol.Ft.Bm[profIdxLoBack].Abs, btar.Sol.Ft.Bm[profIdxHiBack].Abs, profInterpFacBack); + Real64 abshBk = + Interp(btar.Sol.Bk.Bm[profIdxLoBack].Abs, btar.Sol.Bk.Bm[profIdxHiBack].Abs, profInterpFacBack); + Real64 tfshdk = btarBack.Sol.Ft.Df.Tra; + Real64 rfshdk = btarBack.Sol.Ft.Df.Ref; + Real64 afshdk = btarBack.Sol.Ft.Df.Abs; + Real64 tbshdk = btarBack.Sol.Bk.Df.Tra; + Real64 rbshdk = btarBack.Sol.Bk.Df.Ref; + Real64 abshdk = btarBack.Sol.Bk.Df.Abs; Real64 ABlBack; + if (NBackGlass == 2) { // Interior beam absorptance of GLASS LAYERS of exterior back window with BETWEEN-GLASS BLIND state.dataSolarShading->SurfWinAbsBeam(2) = @@ -7924,20 +7700,19 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) BABSZone += BOverlap * ABlBack; backSurfBeamSolInTrans += BOverlap * ABlBack; state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = - BOverlap * ABlBack / state.dataSurface->Surface(BackSurfNum).Area; + BOverlap * ABlBack / s_surf->Surface(BackSurfNum).Area; } // End of check if between-glass blind is on back window } else if (ShadeFlagBack == WinShadingType::ExtScreen) { // Interior beam absorptance of GLASS LAYERS of exterior back window with EXTERIOR SCREEN - int ScNumBack = surfWin.screenNum; // Back surface screen number Real64 TGlBmBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); Real64 RGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffFront; - auto const *screen = dynamic_cast(state.dataMaterial->Material(ScNum)); + auto const *screen = dynamic_cast(s_mat->materials(ScNum)); assert(screen != nullptr); - auto &surf = state.dataSurface->Surface(SurfNum); + auto &surf = s_surf->Surface(SurfNum); Real64 solPhi = std::acos(state.dataEnvrn->SOLCOS.z); Real64 solTheta = std::atan2(state.dataEnvrn->SOLCOS.x, state.dataEnvrn->SOLCOS.y); Real64 winPhi = surf.Tilt * Constant::DegToRad; @@ -7947,7 +7722,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Material::NormalizePhiTheta(phi, theta); #ifdef PRECALC_INTERP_SCREEN int ip1, ip2, it1, it2; - General::BilinearInterpCoeffs coeffs; + BilinearInterpCoeffs coeffs; Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); GetBilinearInterpCoeffs( phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); @@ -7986,8 +7761,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) BABSZone += BOverlap * AScBack; backSurfBeamSolInTrans += BOverlap * AScBack; state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = - BOverlap * AScBack / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); + BOverlap * AScBack / (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); #else // !PRECALC_INTERP_SCREEN Material::ScreenBmTransAbsRef btar; Material::CalcScreenTransmittance(state, screen, phi, theta, btar); @@ -8021,15 +7795,14 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) BABSZone += BOverlap * AScBack; state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = - BOverlap * AScBack / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); + BOverlap * AScBack / (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); #endif // PRECALC_INTERP_SCREEN } // End of check if exterior screen on back window // Interior beam absorptance of glass layers of back exterior window with SWITCHABLE GLAZING - if (ShadeFlagBack == WinShadingType::SwitchableGlazing && state.dataSurface->Surface(BackSurfNum).ExtBoundCond == 0) { - Real64 SwitchFac = state.dataSurface->SurfWinSwitchingFactor(SurfNum); // Switching factor for a window + if (ShadeFlagBack == WinShadingType::SwitchableGlazing && s_surf->Surface(BackSurfNum).ExtBoundCond == 0) { + Real64 SwitchFac = s_surf->SurfWinSwitchingFactor(SurfNum); // Switching factor for a window Real64 AbsBeamWinSh; // Glass layer beam solar absorptance of a shaded window for (int Lay = 1; Lay <= NBackGlass; ++Lay) { AbsBeamWinSh = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); @@ -8045,9 +7818,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) AbsBeamTotWin = 0.0; for (int Lay = 1; Lay <= NBackGlass; ++Lay) { AbsBeamTotWin += state.dataSolarShading->SurfWinAbsBeam(Lay); - state.dataSurface->SurfWinA(BackSurfNum, Lay) += + s_surf->SurfWinA(BackSurfNum, Lay) += BOverlap * state.dataSolarShading->SurfWinAbsBeam(Lay) / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); //[-] + (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); //[-] } // To BABSZon, add interior beam glass absorption and overall beam transmission for this back window @@ -8057,28 +7830,26 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) backSurfBeamSolInTrans * state.dataEnvrn->BeamSolarRad; //[W] // Interior beam transmitted to adjacent zone through an interior back window (assumed unshaded); // this beam radiation is categorized as diffuse radiation in the adjacent zone. - int AdjSurfNum = state.dataSurface->Surface(BackSurfNum).ExtBoundCond; + int AdjSurfNum = s_surf->Surface(BackSurfNum).ExtBoundCond; if (AdjSurfNum > 0) { - int adjEnclosureNum = state.dataSurface->Surface(AdjSurfNum).SolarEnclIndex; + int adjEnclosureNum = s_surf->Surface(AdjSurfNum).SolarEnclIndex; state.dataHeatBal->EnclSolDBIntWin(adjEnclosureNum) += BOverlap * TransBeamWin; //[m2] - state.dataSurface->SurfWinBmSolTransThruIntWinRep(BackSurfNum) += + s_surf->SurfWinBmSolTransThruIntWinRep(BackSurfNum) += BOverlap * TransBeamWin * state.dataEnvrn->BeamSolarRad; //[W] - state.dataSurface->SurfWinBmSolTransThruIntWinRepEnergy(BackSurfNum) = - state.dataSurface->SurfWinBmSolTransThruIntWinRep(BackSurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinBmSolTransThruIntWinRepEnergy(BackSurfNum) = + s_surf->SurfWinBmSolTransThruIntWinRep(BackSurfNum) * state.dataGlobal->TimeStepZoneSec; } } // End of check if back surface is opaque or window state.dataHeatBal->SurfBmIncInsSurfAmountRep(BackSurfNum) += BOverlap; state.dataHeatBal->SurfBmIncInsSurfAmountRepEnergy(BackSurfNum) = state.dataHeatBal->SurfBmIncInsSurfAmountRep(BackSurfNum) * state.dataGlobal->TimeStepZoneSec; } // End of loop over back surfaces - } else if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { + } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // For complex window calculation goes over outgoing basis directions for current state - int CurCplxFenState = - state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState; // Current state for complex fenestration + int CurCplxFenState = s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState; // Current state for complex fenestration // Get construction number which keeps transmittance properties - int IConst = - state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.State(CurCplxFenState).Konst; // Current surface construction number - // (it depends of state too) + int IConst = s_surf->SurfaceWindow(SurfNum).ComplexFen.State(CurCplxFenState).Konst; // Current surface construction number + // (it depends of state too) // Solar radiation from this window will be calculated only in case when this window is not scheduled surface gained if (WindowScheduledSolarAbs(state, SurfNum, IConst) == 0) { // Current incoming direction number (Sun direction) @@ -8128,15 +7899,15 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Summarizing results for (int IBack = 1; IBack <= NBkSurf; ++IBack) { int BackSurfaceNumber = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(IBack); - int ConstrNumBack = state.dataSurface->Surface(BackSurfaceNumber).Construction; + int ConstrNumBack = s_surf->Surface(BackSurfaceNumber).Construction; // Do not perform any calculation if surface is scheduled for incoming solar radiation int SurfSolIncPtr = SurfaceScheduledSolarInc(state, BackSurfaceNumber, ConstrNumBack); if (SurfSolIncPtr == 0) { // Surface hit is another complex fenestration - if (state.dataSurface->SurfWinWindowModelType(BackSurfaceNumber) == WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(BackSurfaceNumber) == WindowModel::BSDF) { int CurBackState = - state.dataSurface->SurfaceWindow(BackSurfaceNumber) + s_surf->SurfaceWindow(BackSurfaceNumber) .ComplexFen.CurrentState; // Current state for back surface if that surface is complex fenestration // Do not take into account this window if it is scheduled for surface gains if (WindowScheduledSolarAbs(state, BackSurfaceNumber, ConstrNumBack) == 0) { @@ -8172,10 +7943,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // CurLambda = ComplexWind(BackSurfaceNumber)%Geom(CurBackState)%Trn%Lamda(CurTrnDir) // Add influence of this exact direction to what stays in the zone. It is important to note that // this needs to be done for each outgoing direction - Real64 babs = - CFDirBoverlap(IBack, CurTrnDir) * (1 - state.dataSurface->SurfaceWindow(BackSurfaceNumber) - .ComplexFen.State(CurBackState) - .IntegratedBkRefl(bestBackTrn)); + Real64 babs = CFDirBoverlap(IBack, CurTrnDir) * (1 - s_surf->SurfaceWindow(BackSurfaceNumber) + .ComplexFen.State(CurBackState) + .IntegratedBkRefl(bestBackTrn)); BABSZone += babs; state.dataHeatBalSurf->SurfWinInitialBeamSolInTrans(BackSurfaceNumber) += babs * state.dataEnvrn->BeamSolarRad; //[W] @@ -8187,31 +7957,30 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // 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 - state.dataSurface->SurfWinACFOverlap(BackSurfaceNumber, Lay) += + s_surf->SurfWinACFOverlap(BackSurfaceNumber, Lay) += state.dataConstruction->Construct(ConstrNumBack).BSDFInput.Layer(Lay).BkAbs(bestBackTrn, 1) * - CFDirBoverlap(IBack, CurTrnDir) / state.dataSurface->Surface(BackSurfaceNumber).Area; + CFDirBoverlap(IBack, CurTrnDir) / s_surf->Surface(BackSurfaceNumber).Area; // END IF } // Interior beam transmitted to adjacent zone through an interior back window; // This beam radiation is categorized as diffuse radiation in the adjacent zone. // Note that this is done for each outgoing direction of exterior window - int AdjSurfNum = state.dataSurface->Surface(BackSurfaceNumber).ExtBoundCond; + int AdjSurfNum = s_surf->Surface(BackSurfaceNumber).ExtBoundCond; if (AdjSurfNum > 0) { - int adjEnclosureNum = state.dataSurface->Surface(AdjSurfNum).SolarEnclIndex; + int adjEnclosureNum = s_surf->Surface(AdjSurfNum).SolarEnclIndex; state.dataHeatBal->EnclSolDBIntWin(adjEnclosureNum) += - CFDirBoverlap(IBack, CurTrnDir) * state.dataSurface->SurfaceWindow(BackSurfaceNumber) + CFDirBoverlap(IBack, CurTrnDir) * s_surf->SurfaceWindow(BackSurfaceNumber) .ComplexFen.State(CurBackState) .IntegratedBkTrans(bestBackTrn); - state.dataSurface->SurfWinBmSolTransThruIntWinRep(BackSurfaceNumber) += + s_surf->SurfWinBmSolTransThruIntWinRep(BackSurfaceNumber) += CFDirBoverlap(IBack, CurTrnDir) * - state.dataSurface->SurfaceWindow(BackSurfaceNumber) + s_surf->SurfaceWindow(BackSurfaceNumber) .ComplexFen.State(CurBackState) .IntegratedBkTrans(bestBackTrn) * state.dataEnvrn->BeamSolarRad; //[W] - state.dataSurface->SurfWinBmSolTransThruIntWinRepEnergy(BackSurfaceNumber) = - state.dataSurface->SurfWinBmSolTransThruIntWinRep(BackSurfaceNumber) * - state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinBmSolTransThruIntWinRepEnergy(BackSurfaceNumber) = + s_surf->SurfWinBmSolTransThruIntWinRep(BackSurfaceNumber) * state.dataGlobal->TimeStepZoneSec; } } } @@ -8219,8 +7988,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { // Do not take into account this window if it is scheduled for surface gains Real64 AbsIntSurf = state.dataConstruction->Construct(ConstrNumBack).InsideAbsorpSolar; - state.dataSurface->SurfOpaqAI(BackSurfaceNumber) += - CFBoverlap(IBack) * AbsIntSurf / state.dataSurface->Surface(BackSurfaceNumber).Area; + s_surf->SurfOpaqAI(BackSurfaceNumber) += + CFBoverlap(IBack) * AbsIntSurf / s_surf->Surface(BackSurfaceNumber).Area; BABSZone += CFBoverlap(IBack) * AbsIntSurf; } else { // Code for mixed windows goes here. It is same as above code for "ordinary" windows. @@ -8234,15 +8003,15 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (allocated(CFDirBoverlap)) CFDirBoverlap.deallocate(); } - } else if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { + } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { for (int IBack = 1; IBack <= state.dataBSDFWindow->MaxBkSurf; ++IBack) { int BackSurfNum = state.dataHeatBal->SurfWinBackSurfaces(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, IBack, SurfNum); if (BackSurfNum == 0) break; // No more irradiated back surfaces for this exterior window - if (state.dataSurface->SurfWinWindowModelType(IBack) != WindowModel::EQL) continue; // only EQL back window is allowed + if (s_surf->SurfWinWindowModelType(IBack) != WindowModel::EQL) continue; // only EQL back window is allowed - int ConstrNumBack = state.dataSurface->Surface(BackSurfNum).Construction; + int ConstrNumBack = s_surf->Surface(BackSurfNum).Construction; int NBackGlass = state.dataConstruction->Construct(ConstrNumBack).TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) @@ -8255,9 +8024,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Back surface is opaque interior or exterior wall Real64 AbsIntSurf = state.dataHeatBalSurf->SurfAbsSolarInt(BackSurfNum); - state.dataSurface->SurfOpaqAI(BackSurfNum) += - BOverlap * AbsIntSurf / state.dataSurface->Surface(BackSurfNum).Area; //[-] - BABSZone += BOverlap * AbsIntSurf; //[m2] + s_surf->SurfOpaqAI(BackSurfNum) += BOverlap * AbsIntSurf / s_surf->Surface(BackSurfNum).Area; //[-] + BABSZone += BOverlap * AbsIntSurf; //[m2] } else { @@ -8287,7 +8055,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (CFS(EQLNum).L(CFS(EQLNum).NL).LTYPE != LayerType::GLAZE) { state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = BOverlap * state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, CFS(EQLNum).NL) / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); + (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); BABSZone += BOverlap * state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, CFS(EQLNum).NL); backSurfBeamSolInTrans += BOverlap * state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, CFS(EQLNum).NL); } @@ -8295,7 +8063,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (CFS(EQLNum).L(1).LTYPE != LayerType::GLAZE) { state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = BOverlap * state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, 1) / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); + (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); BABSZone += BOverlap * state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, 1); backSurfBeamSolInTrans += BOverlap * state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, 1); } @@ -8313,7 +8081,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // if there is in between shade glass determine the shade absorptance state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) += BOverlap * state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, Lay) / - state.dataSurface->Surface(BackSurfNum).Area; + s_surf->Surface(BackSurfNum).Area; BABSZone += BOverlap * state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, Lay); backSurfBeamSolInTrans += BOverlap * state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, Lay); } @@ -8323,9 +8091,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 AbsBeamTotWin = 0.0; // Glass layer beam solar absorptance of a shaded window for (int Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { AbsBeamTotWin += state.dataSolarShading->SurfWinAbsBeamEQL(Lay); - state.dataSurface->SurfWinA(BackSurfNum, Lay) += + s_surf->SurfWinA(BackSurfNum, Lay) += BOverlap * state.dataSolarShading->SurfWinAbsBeamEQL(Lay) / - (state.dataSurface->Surface(BackSurfNum).Area + state.dataSurface->SurfWinDividerArea(BackSurfNum)); //[-] + (s_surf->Surface(BackSurfNum).Area + s_surf->SurfWinDividerArea(BackSurfNum)); //[-] } // To BABSZon, add interior beam glass absorption and overall beam transmission for this back window @@ -8338,14 +8106,14 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Interior beam transmitted to adjacent zone through an interior back window (assumed unshaded); // this beam radiation is categorized as diffuse radiation in the adjacent zone. - int AdjSurfNum = state.dataSurface->Surface(BackSurfNum).ExtBoundCond; + int AdjSurfNum = s_surf->Surface(BackSurfNum).ExtBoundCond; if (AdjSurfNum > 0) { - int adjEnclosureNum = state.dataSurface->Surface(AdjSurfNum).SolarEnclIndex; + int adjEnclosureNum = s_surf->Surface(AdjSurfNum).SolarEnclIndex; state.dataHeatBal->EnclSolDBIntWin(adjEnclosureNum) += BOverlap * TransBeamWin; //[m2] - state.dataSurface->SurfWinBmSolTransThruIntWinRep(BackSurfNum) += + s_surf->SurfWinBmSolTransThruIntWinRep(BackSurfNum) += BOverlap * TransBeamWin * state.dataEnvrn->BeamSolarRad; //[W] - state.dataSurface->SurfWinBmSolTransThruIntWinRepEnergy(BackSurfNum) = - state.dataSurface->SurfWinBmSolTransThruIntWinRep(BackSurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinBmSolTransThruIntWinRepEnergy(BackSurfNum) = + s_surf->SurfWinBmSolTransThruIntWinRep(BackSurfNum) * state.dataGlobal->TimeStepZoneSec; } } // End of check if back surface is opaque or window state.dataHeatBal->SurfBmIncInsSurfAmountRep(BackSurfNum) += BOverlap; @@ -8362,15 +8130,15 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) for (int const FloorNum : thisEnclosure.SurfacePtr) { // In following, ISABSF is zero except for nominal floor surfaces if (state.dataSolarShading->SurfIntAbsFac(FloorNum) <= 0.0 || FloorNum == SurfNum) continue; // Keep only floor surfaces - int const FlConstrNum = state.dataSurface->SurfActiveConstruction(FloorNum); + int const FlConstrNum = s_surf->SurfActiveConstruction(FloorNum); Real64 BTOTWinZone = TBm * SunLitFract * surf.Area * CosInc * InOutProjSLFracMult; //[m2] Real64 AbsBeamTotWin = 0.0; if (state.dataConstruction->Construct(FlConstrNum).TransDiff <= 0.0) { // Opaque surface - state.dataSurface->SurfOpaqAI(FloorNum) += - BTOTWinZone * state.dataSolarShading->SurfIntAbsFac(FloorNum) / state.dataSurface->Surface(FloorNum).Area; //[-] + s_surf->SurfOpaqAI(FloorNum) += + BTOTWinZone * state.dataSolarShading->SurfIntAbsFac(FloorNum) / s_surf->Surface(FloorNum).Area; //[-] } else { // Window @@ -8390,20 +8158,20 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // (see ComputeIntSolarAbsorpFactors). for (int Lay = 1; Lay <= state.dataConstruction->Construct(FlConstrNum).TotGlassLayers; ++Lay) { - state.dataSurface->SurfWinA(FloorNum, Lay) += - state.dataConstruction->Construct(FlConstrNum).AbsDiffBack(Lay) / AbsBeamTotWin * BTOTWinZone * - state.dataSolarShading->SurfIntAbsFac(FloorNum) / state.dataSurface->Surface(FloorNum).Area; //[-] + s_surf->SurfWinA(FloorNum, Lay) += state.dataConstruction->Construct(FlConstrNum).AbsDiffBack(Lay) / AbsBeamTotWin * + BTOTWinZone * state.dataSolarShading->SurfIntAbsFac(FloorNum) / + s_surf->Surface(FloorNum).Area; //[-] } } BABSZone += BTOTWinZone * state.dataSolarShading->SurfIntAbsFac(FloorNum); //[m2] - int AdjSurfNum = state.dataSurface->Surface(FloorNum).ExtBoundCond; + int AdjSurfNum = s_surf->Surface(FloorNum).ExtBoundCond; if (state.dataConstruction->Construct(FlConstrNum).TransDiff > 0.0 && AdjSurfNum > 0) { // Window in an interior floor - int adjEnclosureNum = state.dataSurface->Surface(AdjSurfNum).SolarEnclIndex; + int adjEnclosureNum = s_surf->Surface(AdjSurfNum).SolarEnclIndex; // Contribution (assumed diffuse) to adjacent zone of beam radiation passing // through this window @@ -8423,18 +8191,18 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 BABSZoneSSG = 0.0; // Beam radiation from exterior windows absorbed in a zone (only for scheduled surface gains) Real64 BTOTZoneSSG = 0.0; // Solar entering a zone in case of scheduled surface gains - for (int iSSG = 1; iSSG <= state.dataSurface->TotSurfIncSolSSG; ++iSSG) { - int SurfNum = state.dataSurface->SurfIncSolSSG(iSSG).SurfPtr; - auto &surf = state.dataSurface->Surface(SurfNum); + for (int iSSG = 1; iSSG <= s_surf->TotSurfIncSolSSG; ++iSSG) { + int SurfNum = s_surf->SurfIncSolSSG(iSSG).SurfPtr; + auto &surf = s_surf->Surface(SurfNum); // do calculation only if construction number match. - if (state.dataSurface->SurfIncSolSSG(iSSG).ConstrPtr == surf.Construction) { + if (s_surf->SurfIncSolSSG(iSSG).ConstrPtr == surf.Construction) { if (surf.SolarEnclIndex == enclosureNum) { Real64 AbsIntSurf = state.dataConstruction->Construct(surf.Construction).InsideAbsorpSolar; // SolarIntoZone = GetCurrentScheduleValue(SurfIncSolSSG(iSSG)%SchedPtr) * Surface(SurfNum)%Area - Real64 SolarIntoZone = GetCurrentScheduleValue( - state, state.dataSurface->SurfIncSolSSG(iSSG).SchedPtr); // Solar radiation into zone to current surface - state.dataSurface->SurfOpaqAI(SurfNum) = SolarIntoZone * AbsIntSurf; - BABSZoneSSG += state.dataSurface->SurfOpaqAI(SurfNum) * surf.Area; + Real64 SolarIntoZone = + GetCurrentScheduleValue(state, s_surf->SurfIncSolSSG(iSSG).SchedPtr); // Solar radiation into zone to current surface + s_surf->SurfOpaqAI(SurfNum) = SolarIntoZone * AbsIntSurf; + BABSZoneSSG += s_surf->SurfOpaqAI(SurfNum) * surf.Area; BTOTZoneSSG += SolarIntoZone * surf.Area; } } @@ -8448,7 +8216,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Variables for reporting for (int const SurfNum : thisEnclosure.SurfacePtr) { - auto &surf = state.dataSurface->Surface(SurfNum); + auto &surf = s_surf->Surface(SurfNum); + Real64 SurfIncSolarMultiplier = surf.IncSolMultiplier; Real64 currBeamSolarRad = state.dataEnvrn->BeamSolarRad * SurfIncSolarMultiplier; Real64 currDifSolarRad = state.dataEnvrn->DifSolarRad * SurfIncSolarMultiplier; @@ -8458,7 +8227,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) state.dataHeatBal->SurfBmIncInsSurfAmountRepEnergy(SurfNum) = state.dataHeatBal->SurfBmIncInsSurfAmountRep(SurfNum) * state.dataGlobal->TimeStepZoneSec; state.dataHeatBal->SurfBmIncInsSurfIntensRep(SurfNum) = - state.dataHeatBal->SurfBmIncInsSurfAmountRep(SurfNum) / (surf.Area + state.dataSurface->SurfWinDividerArea(SurfNum)); + state.dataHeatBal->SurfBmIncInsSurfAmountRep(SurfNum) / (surf.Area + s_surf->SurfWinDividerArea(SurfNum)); } else { // Simple interior solar distribution. All beam falls on floor. if (state.dataSolarShading->SurfIntAbsFac(SurfNum) > 0.0 && surf.HeatTransSurf) { if (thisEnclosure.FloorArea > 0.0) { @@ -8477,13 +8246,13 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } if (surf.Class == SurfaceClass::Window || surf.Class == SurfaceClass::TDD_Dome) { - state.dataSurface->SurfWinIntBeamAbsByShade(SurfNum) = state.dataSolarShading->SurfWinIntBeamAbsByShadFac(SurfNum); - state.dataSurface->SurfWinExtBeamAbsByShade(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum); + s_surf->SurfWinIntBeamAbsByShade(SurfNum) = state.dataSolarShading->SurfWinIntBeamAbsByShadFac(SurfNum); + s_surf->SurfWinExtBeamAbsByShade(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum); if ((surf.ExtBoundCond == ExternalEnvironment) || (surf.ExtBoundCond == OtherSideCondModeledExt)) { - WinShadingType ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); - int ShelfNum = state.dataSurface->SurfDaylightingShelfInd(SurfNum); + WinShadingType ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); + int ShelfNum = s_surf->SurfDaylightingShelfInd(SurfNum); int OutShelfSurf = 0; if (ShelfNum > 0) { // Outside daylighting shelf OutShelfSurf = state.dataDaylightingDevicesData->Shelf(ShelfNum).OutSurf; @@ -8491,32 +8260,28 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // This lookup may be avoid if this 2nd surf loop can be combined with the 1st if (surf.OriginalClass == SurfaceClass::TDD_Diffuser) { - int PipeNum = state.dataSurface->SurfWinTDDPipeNum(SurfNum); + int PipeNum = s_surf->SurfWinTDDPipeNum(SurfNum); int SurfNum2 = state.dataDaylightingDevicesData->TDDPipe(PipeNum).Dome; Real64 CosInc = state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum2); // Exterior diffuse solar incident on window (W/m2) Real64 DifSolarInc = currDifSolarRad * state.dataSolarShading->SurfAnisoSkyMult(SurfNum2) + - currGndSolarRad * state.dataSurface->Surface(SurfNum2).ViewFactorGround; + currGndSolarRad * s_surf->Surface(SurfNum2).ViewFactorGround; // Exterior diffuse sky solar transmitted by TDD (W/m2) Real64 SkySolarTrans = currDifSolarRad * TransTDD(state, PipeNum, CosInc, Dayltg::RadType::SolarAniso) * state.dataSolarShading->SurfAnisoSkyMult(SurfNum2); // Exterior diffuse ground solar transmitted by TDD (W/m2) Real64 GndSolarTrans = currGndSolarRad * state.dataDaylightingDevicesData->TDDPipe(PipeNum).TransSolIso * - state.dataSurface->Surface(SurfNum2).ViewFactorGround; + s_surf->Surface(SurfNum2).ViewFactorGround; - state.dataSurface->SurfWinBmSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmSolar(SurfNum); - state.dataSurface->SurfWinDifSolar(SurfNum) = SkySolarTrans * surf.Area + GndSolarTrans * surf.Area; - state.dataSurface->SurfWinBmSolarEnergy(SurfNum) = - state.dataSurface->SurfWinBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; - state.dataSurface->SurfWinDifSolarEnergy(SurfNum) = - state.dataSurface->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinBmSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmSolar(SurfNum); + s_surf->SurfWinDifSolar(SurfNum) = SkySolarTrans * surf.Area + GndSolarTrans * surf.Area; + s_surf->SurfWinBmSolarEnergy(SurfNum) = s_surf->SurfWinBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinDifSolarEnergy(SurfNum) = s_surf->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; - state.dataSurface->SurfWinTransSolar(SurfNum) = - state.dataSurface->SurfWinBmSolar(SurfNum) + state.dataSurface->SurfWinDifSolar(SurfNum); //[W] - state.dataSurface->SurfWinTransSolarEnergy(SurfNum) = - state.dataSurface->SurfWinTransSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinTransSolar(SurfNum) = s_surf->SurfWinBmSolar(SurfNum) + s_surf->SurfWinDifSolar(SurfNum); //[W] + s_surf->SurfWinTransSolarEnergy(SurfNum) = s_surf->SurfWinTransSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; - state.dataDaylightingDevicesData->TDDPipe(PipeNum).TransmittedSolar = state.dataSurface->SurfWinTransSolar(SurfNum); + state.dataDaylightingDevicesData->TDDPipe(PipeNum).TransmittedSolar = s_surf->SurfWinTransSolar(SurfNum); // TDDPipe(PipeNum)%TransSolBeam = TBmBm ! Reported above if (DifSolarInc > 0) { state.dataDaylightingDevicesData->TDDPipe(PipeNum).TransSolDiff = (SkySolarTrans + GndSolarTrans) / DifSolarInc; @@ -8536,63 +8301,54 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) currGndSolarRad * surf.ViewFactorGround + ShelfSolarRad * state.dataDaylightingDevicesData->Shelf(ShelfNum).ViewFactor; - state.dataSurface->SurfWinBmSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmSolar(SurfNum); - state.dataSurface->SurfWinDifSolar(SurfNum) = DifSolarInc * state.dataSolarShading->SurfWinTransDifSolar(SurfNum); - state.dataSurface->SurfWinBmSolarEnergy(SurfNum) = - state.dataSurface->SurfWinBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; - state.dataSurface->SurfWinDifSolarEnergy(SurfNum) = - state.dataSurface->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinBmSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmSolar(SurfNum); + s_surf->SurfWinDifSolar(SurfNum) = DifSolarInc * state.dataSolarShading->SurfWinTransDifSolar(SurfNum); + s_surf->SurfWinBmSolarEnergy(SurfNum) = s_surf->SurfWinBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinDifSolarEnergy(SurfNum) = s_surf->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; - state.dataSurface->SurfWinTransSolar(SurfNum) = - state.dataSurface->SurfWinBmSolar(SurfNum) + state.dataSurface->SurfWinDifSolar(SurfNum); //[W] - state.dataSurface->SurfWinTransSolarEnergy(SurfNum) = - state.dataSurface->SurfWinTransSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinTransSolar(SurfNum) = s_surf->SurfWinBmSolar(SurfNum) + s_surf->SurfWinDifSolar(SurfNum); //[W] + s_surf->SurfWinTransSolarEnergy(SurfNum) = s_surf->SurfWinTransSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; } else { // Regular window - Real64 SkySolarInc = state.dataSurface->SurfSkySolarInc(SurfNum); - Real64 GndSolarInc = state.dataSurface->SurfGndSolarInc(SurfNum); + Real64 SkySolarInc = s_surf->SurfSkySolarInc(SurfNum); + Real64 GndSolarInc = s_surf->SurfGndSolarInc(SurfNum); Real64 DifSolarInc = SkySolarInc + GndSolarInc; - state.dataSurface->SurfWinBmSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmSolar(SurfNum); + s_surf->SurfWinBmSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmSolar(SurfNum); // Note: for complex fenestration, SurfWinTransDifSolar has previously been defined using the effective // transmittance for sky and ground diffuse radiation (including beam radiation reflected from the ground) // so these calculations should be correct - state.dataSurface->SurfWinDifSolar(SurfNum) = DifSolarInc * state.dataSolarShading->SurfWinTransDifSolar(SurfNum); - state.dataSurface->SurfWinBmSolarEnergy(SurfNum) = - state.dataSurface->SurfWinBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; - state.dataSurface->SurfWinDifSolarEnergy(SurfNum) = - state.dataSurface->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinDifSolar(SurfNum) = DifSolarInc * state.dataSolarShading->SurfWinTransDifSolar(SurfNum); + s_surf->SurfWinBmSolarEnergy(SurfNum) = s_surf->SurfWinBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinDifSolarEnergy(SurfNum) = s_surf->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; if (ANY_BLIND(ShadeFlag)) { - if (state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).SlatOrientation == - DataWindowEquivalentLayer::Orientation::Horizontal) { - state.dataSurface->SurfWinDifSolar(SurfNum) = SkySolarInc * state.dataSolarShading->SurfWinTransDifSolarSky(SurfNum) + - GndSolarInc * state.dataSolarShading->SurfWinTransDifSolarGnd(SurfNum); - state.dataSurface->SurfWinDifSolarEnergy(SurfNum) = - state.dataSurface->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + auto const &surfShade = s_surf->surfShades(SurfNum); + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + if (matBlind->SlatOrientation == DataWindowEquivalentLayer::Orientation::Horizontal) { + s_surf->SurfWinDifSolar(SurfNum) = SkySolarInc * state.dataSolarShading->SurfWinTransDifSolarSky(SurfNum) + + GndSolarInc * state.dataSolarShading->SurfWinTransDifSolarGnd(SurfNum); + s_surf->SurfWinDifSolarEnergy(SurfNum) = s_surf->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; } } - state.dataSurface->SurfWinTransSolar(SurfNum) = - state.dataSurface->SurfWinBmSolar(SurfNum) + state.dataSurface->SurfWinDifSolar(SurfNum); //[W] - state.dataSurface->SurfWinTransSolarEnergy(SurfNum) = - state.dataSurface->SurfWinTransSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinTransSolar(SurfNum) = s_surf->SurfWinBmSolar(SurfNum) + s_surf->SurfWinDifSolar(SurfNum); //[W] + s_surf->SurfWinTransSolarEnergy(SurfNum) = s_surf->SurfWinTransSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; } // added TH 12/9/2009, CR 7907 & 7809 - state.dataSurface->SurfWinBmBmSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmBmSolar(SurfNum); + s_surf->SurfWinBmBmSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmBmSolar(SurfNum); - state.dataSurface->SurfWinBmDifSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmDifSolar(SurfNum); - state.dataSurface->SurfWinBmBmSolarEnergy(SurfNum) = - state.dataSurface->SurfWinBmBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; - state.dataSurface->SurfWinBmDifSolarEnergy(SurfNum) = - state.dataSurface->SurfWinBmDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinBmDifSolar(SurfNum) = currBeamSolarRad * state.dataSolarShading->SurfWinTransBmDifSolar(SurfNum); + s_surf->SurfWinBmBmSolarEnergy(SurfNum) = s_surf->SurfWinBmBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinBmDifSolarEnergy(SurfNum) = s_surf->SurfWinBmDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; // Solar not added by TDD:DOME; added to zone via TDD:DIFFUSER if (surf.Class != SurfaceClass::TDD_Dome) { - state.dataHeatBal->ZoneTransSolar(enclosureNum) += state.dataSurface->SurfWinTransSolar(SurfNum); //[W] + state.dataHeatBal->ZoneTransSolar(enclosureNum) += s_surf->SurfWinTransSolar(SurfNum); //[W] state.dataHeatBal->ZoneTransSolarEnergy(enclosureNum) = state.dataHeatBal->ZoneTransSolar(enclosureNum) * state.dataGlobal->TimeStepZoneSec; //[J] - state.dataHeatBal->ZoneBmSolFrExtWinsRep(enclosureNum) += state.dataSurface->SurfWinBmSolar(SurfNum); - state.dataHeatBal->ZoneDifSolFrExtWinsRep(enclosureNum) += state.dataSurface->SurfWinDifSolar(SurfNum); + state.dataHeatBal->ZoneBmSolFrExtWinsRep(enclosureNum) += s_surf->SurfWinBmSolar(SurfNum); + state.dataHeatBal->ZoneDifSolFrExtWinsRep(enclosureNum) += s_surf->SurfWinDifSolar(SurfNum); state.dataHeatBal->ZoneBmSolFrExtWinsRepEnergy(enclosureNum) = state.dataHeatBal->ZoneBmSolFrExtWinsRep(enclosureNum) * state.dataGlobal->TimeStepZoneSec; //[J] state.dataHeatBal->ZoneDifSolFrExtWinsRepEnergy(enclosureNum) = @@ -8629,17 +8385,19 @@ void CalcAbsorbedOnExteriorOpaqueSurfaces(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // Calculates solar energy absorbed on exterior opaque surfaces + auto &s_surf = state.dataSurface; + for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - auto &surf = state.dataSurface->Surface(SurfNum); + auto &surf = s_surf->Surface(SurfNum); // TH added 3/24/2010 while debugging CR 7872 if (!surf.ExtSolar && surf.OriginalClass != SurfaceClass::TDD_Diffuser) continue; - int const ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); + int const ConstrNum = s_surf->SurfActiveConstruction(SurfNum); int SurfNum2 = SurfNum; if (surf.OriginalClass == SurfaceClass::TDD_Diffuser) { - int PipeNum = state.dataSurface->SurfWinTDDPipeNum(SurfNum); + int PipeNum = s_surf->SurfWinTDDPipeNum(SurfNum); SurfNum2 = state.dataDaylightingDevicesData->TDDPipe(PipeNum).Dome; } Real64 CosInc = state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum2); @@ -8650,7 +8408,7 @@ void CalcAbsorbedOnExteriorOpaqueSurfaces(EnergyPlusData &state) //------------------------------------------------------------------------- if (SunLitFract > 0.0 && state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { - state.dataSurface->SurfOpaqAO(SurfNum) = state.dataConstruction->Construct(ConstrNum).OutsideAbsorpSolar * CosInc * SunLitFract; + s_surf->SurfOpaqAO(SurfNum) = state.dataConstruction->Construct(ConstrNum).OutsideAbsorpSolar * CosInc * SunLitFract; // Note: movable insulation, if present, is accounted for in subr. InitIntSolarDistribution, // where SurfQRadSWOutMvIns is calculated from SurfOpaqQRadSWOutAbs and insulation solar absorptance @@ -8675,14 +8433,16 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) using ScheduleManager::GetCurrentScheduleValue; using namespace MultiLayerOptics; + auto &s_surf = state.dataSurface; + for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); int const firstSurf = thisSpace.HTSurfaceFirst; int const lastSurf = thisSpace.HTSurfaceLast; for (int surfNum = firstSurf; surfNum <= lastSurf; ++surfNum) { - state.dataSurface->SurfOpaqAI(surfNum) = 0.0; - state.dataSurface->SurfOpaqAO(surfNum) = 0.0; + s_surf->SurfOpaqAI(surfNum) = 0.0; + s_surf->SurfOpaqAO(surfNum) = 0.0; } } } @@ -8702,16 +8462,16 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) auto &thisEnclosure = state.dataViewFactor->EnclSolInfo(enclosureNum); for (int const SurfNum : thisEnclosure.SurfacePtr) { - auto &surf = state.dataSurface->Surface(SurfNum); + auto &surf = s_surf->Surface(SurfNum); if (surf.Class != SurfaceClass::Window) continue; int SurfNum2 = 0; if (surf.OriginalClass == SurfaceClass::TDD_Diffuser) { - int PipeNum = state.dataSurface->SurfWinTDDPipeNum(SurfNum); + int PipeNum = s_surf->SurfWinTDDPipeNum(SurfNum); SurfNum2 = state.dataDaylightingDevicesData->TDDPipe(PipeNum).Dome; } else { SurfNum2 = SurfNum; } - auto &window = state.dataSurface->SurfaceWindow(SurfNum2); + auto &window = s_surf->SurfaceWindow(SurfNum2); Real64 CosInc = state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum2); // Note: surfnum 2 Real64 SunLitFract = state.dataHeatBal->SurfSunlitFrac(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum2); @@ -8719,9 +8479,8 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) Real64 Theta = incomingAngle.first; Real64 Phi = incomingAngle.second; - int ConstrNum = state.dataSurface->Surface(SurfNum2).Construction; - if (state.dataSurface->Surface(SurfNum2).activeShadedConstruction > 0) - ConstrNum = state.dataSurface->Surface(SurfNum2).activeShadedConstruction; + int ConstrNum = s_surf->Surface(SurfNum2).Construction; + if (s_surf->Surface(SurfNum2).activeShadedConstruction > 0) ConstrNum = s_surf->Surface(SurfNum2).activeShadedConstruction; auto aLayer = // (AUTO_OK_OBJ) CWindowConstructionsSimplified::instance(state).getEquivalentLayer(state, WavelengthRange::Solar, ConstrNum); @@ -8730,21 +8489,21 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) /////////////////////////////////////////////// if (state.dataHeatBal->SurfSunlitFracWithoutReveal(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum2) > 0.0) { size_t numOfLayers = aLayer->getNumOfLayers(); - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { - int CurrentState = state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.CurrentState; - auto &cplxState = state.dataSurface->SurfaceWindow(SurfNum).ComplexFen.State(CurrentState); + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { + int CurrentState = s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState; + auto &cplxState = s_surf->SurfaceWindow(SurfNum).ComplexFen.State(CurrentState); for (size_t Lay = 1; Lay <= numOfLayers; ++Lay) { // Simon: Imporant note about this equation is to use BeamSolarRad and not SurfQRadSWOutIncident // is becuase BeamSolarRad is direct normal radiation (looking at the Sun) while SurfRadSWOutIncident // is normal to window incidence. Since BSDF coefficients are taking into account angle of incidence, // BeamSolarRad should be used in this case state.dataHeatBal->SurfWinQRadSWwinAbs(SurfNum, Lay) = - cplxState.WinSkyFtAbs(Lay) * state.dataSurface->SurfSkySolarInc(SurfNum2) + - cplxState.WinSkyGndAbs(Lay) * state.dataSurface->SurfGndSolarInc(SurfNum2) + - state.dataSurface->SurfWinA(SurfNum, Lay) * state.dataEnvrn->BeamSolarRad + - state.dataSurface->SurfWinACFOverlap(SurfNum, Lay) * state.dataEnvrn->BeamSolarRad; + cplxState.WinSkyFtAbs(Lay) * s_surf->SurfSkySolarInc(SurfNum2) + + cplxState.WinSkyGndAbs(Lay) * s_surf->SurfGndSolarInc(SurfNum2) + + s_surf->SurfWinA(SurfNum, Lay) * state.dataEnvrn->BeamSolarRad + + s_surf->SurfWinACFOverlap(SurfNum, Lay) * state.dataEnvrn->BeamSolarRad; state.dataHeatBal->SurfWinQRadSWwinAbsLayer(SurfNum, Lay) = state.dataHeatBal->SurfWinQRadSWwinAbs(SurfNum, Lay) * surf.Area; - state.dataSurface->SurfWinADiffFront(SurfNum, Lay) = cplxState.WinSkyGndAbs(Lay); + s_surf->SurfWinADiffFront(SurfNum, Lay) = cplxState.WinSkyGndAbs(Lay); } } else { for (size_t Lay = 1; Lay <= numOfLayers; ++Lay) { @@ -8756,16 +8515,15 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) // Simon: This should not be multiplied with cosine of incident angle. This however gives same // results as BSDF and Winkelmann models. - state.dataSurface->SurfWinA(SurfNum, Lay) = - AbWinBeam * CosInc * SunLitFract * - state.dataSurface->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay]; - state.dataSurface->SurfWinADiffFront(SurfNum, Lay) = AbWinDiffFront; + s_surf->SurfWinA(SurfNum, Lay) = + AbWinBeam * CosInc * SunLitFract * s_surf->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay]; + s_surf->SurfWinADiffFront(SurfNum, Lay) = AbWinDiffFront; // Simon: Same not as for BSDF. Normal solar radiation should be taken here because angle of // incidence is already taken into account - Real64 absBeam = state.dataSurface->SurfWinA(SurfNum, Lay) * state.dataEnvrn->BeamSolarRad; - Real64 absDiff = state.dataSurface->SurfWinADiffFront(SurfNum, Lay) * - (state.dataSurface->SurfSkySolarInc(SurfNum2) + state.dataSurface->SurfGndSolarInc(SurfNum2)); + Real64 absBeam = s_surf->SurfWinA(SurfNum, Lay) * state.dataEnvrn->BeamSolarRad; + Real64 absDiff = + s_surf->SurfWinADiffFront(SurfNum, Lay) * (s_surf->SurfSkySolarInc(SurfNum2) + s_surf->SurfGndSolarInc(SurfNum2)); state.dataHeatBal->SurfWinQRadSWwinAbs(SurfNum, Lay) = (absBeam + absDiff); state.dataHeatBal->SurfWinQRadSWwinAbsLayer(SurfNum, Lay) = state.dataHeatBal->SurfWinQRadSWwinAbs(SurfNum, Lay) * surf.Area; } @@ -8780,14 +8538,14 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) const Real64 Tdiff = aLayer->getPropertySimple(minLambda, maxLambda, PropertySimple::T, Side::Front, Scattering::DiffuseDiffuse, Theta, Phi); state.dataConstruction->Construct(ConstrNum).TransDiff = Tdiff; - Real64 EnclSolDSWin = state.dataSurface->SurfSkySolarInc(SurfNum2) * Tdiff * state.dataSurface->Surface(SurfNum2).Area; + Real64 EnclSolDSWin = s_surf->SurfSkySolarInc(SurfNum2) * Tdiff * s_surf->Surface(SurfNum2).Area; if ((state.dataEnvrn->DifSolarRad != 0)) { EnclSolDSWin /= state.dataEnvrn->DifSolarRad; } else { EnclSolDSWin /= 1e-8; } - Real64 EnclSolDGWin = state.dataSurface->SurfGndSolarInc(SurfNum2) * Tdiff * state.dataSurface->Surface(SurfNum2).Area; + Real64 EnclSolDGWin = s_surf->SurfGndSolarInc(SurfNum2) * Tdiff * s_surf->Surface(SurfNum2).Area; (state.dataEnvrn->GndSolarRad != 0) ? EnclSolDGWin /= state.dataEnvrn->GndSolarRad : EnclSolDGWin /= 1e-8; //////////////////////////////////////////////////////////////////// @@ -8799,22 +8557,20 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) Real64 SurfWinTransBmDifSolar = TBmDif * SunLitFract * CosInc * surf.Area * window.InOutProjSLFracMult[state.dataGlobal->HourOfDay]; BTOTZone += SurfWinTransBmBmSolar + SurfWinTransBmDifSolar; - Real64 DifSolarRadiation = state.dataSurface->SurfSkySolarInc(SurfNum2) + state.dataSurface->SurfGndSolarInc(SurfNum2); - state.dataSurface->SurfWinBmSolar(SurfNum) = state.dataEnvrn->BeamSolarRad * (TBmBm + TBmDif) * surf.Area * CosInc; - state.dataSurface->SurfWinDifSolar(SurfNum) = DifSolarRadiation * Tdiff * surf.Area; - state.dataSurface->SurfWinBmSolarEnergy(SurfNum) = state.dataSurface->SurfWinBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; - state.dataSurface->SurfWinDifSolarEnergy(SurfNum) = state.dataSurface->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; - state.dataSurface->SurfWinTransSolar(SurfNum) = state.dataSurface->SurfWinBmSolar(SurfNum) + state.dataSurface->SurfWinDifSolar(SurfNum); - state.dataSurface->SurfWinTransSolarEnergy(SurfNum) = state.dataSurface->SurfWinTransSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + Real64 DifSolarRadiation = s_surf->SurfSkySolarInc(SurfNum2) + s_surf->SurfGndSolarInc(SurfNum2); + s_surf->SurfWinBmSolar(SurfNum) = state.dataEnvrn->BeamSolarRad * (TBmBm + TBmDif) * surf.Area * CosInc; + s_surf->SurfWinDifSolar(SurfNum) = DifSolarRadiation * Tdiff * surf.Area; + s_surf->SurfWinBmSolarEnergy(SurfNum) = s_surf->SurfWinBmSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinDifSolarEnergy(SurfNum) = s_surf->SurfWinDifSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinTransSolar(SurfNum) = s_surf->SurfWinBmSolar(SurfNum) + s_surf->SurfWinDifSolar(SurfNum); + s_surf->SurfWinTransSolarEnergy(SurfNum) = s_surf->SurfWinTransSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; // Add beam solar absorbed by outside reveal to outside of window's base surface. // Add beam solar absorbed by inside reveal to inside of window's base surface. // This ignores 2-D heat transfer effects. int BaseSurfNum = surf.BaseSurf; - state.dataSurface->SurfOpaqAI(BaseSurfNum) = - state.dataSurface->SurfWinBmSolAbsdInsReveal(SurfNum2) / state.dataSurface->Surface(BaseSurfNum).Area; - state.dataSurface->SurfOpaqAO(BaseSurfNum) = - state.dataSurface->SurfWinBmSolAbsdOutsReveal(SurfNum2) / state.dataSurface->Surface(BaseSurfNum).Area; + s_surf->SurfOpaqAI(BaseSurfNum) = s_surf->SurfWinBmSolAbsdInsReveal(SurfNum2) / s_surf->Surface(BaseSurfNum).Area; + s_surf->SurfOpaqAO(BaseSurfNum) = s_surf->SurfWinBmSolAbsdOutsReveal(SurfNum2) / s_surf->Surface(BaseSurfNum).Area; //////////////////////////////////////////////////////////////////// // BEAM SOLAR ON EXTERIOR WINDOW TRANSMITTED AS BEAM AND/OR DIFFUSE @@ -8823,7 +8579,7 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) // Correction for beam absorbed by inside reveal Real64 TBmDenom = SunLitFract * CosInc * surf.Area * window.InOutProjSLFracMult[state.dataGlobal->HourOfDay]; if (TBmDenom != 0.0) { // when =0.0, no correction - TBm -= state.dataSurface->SurfWinBmSolAbsdInsReveal(SurfNum) / TBmDenom; + TBm -= s_surf->SurfWinBmSolAbsdInsReveal(SurfNum) / TBmDenom; } TBm = max(0.0, TBm); @@ -8838,7 +8594,7 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) state.dataHeatBal->SurfWinBackSurfaces(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, IBack, SurfNum); if (BackSurfNum == 0) break; // No more irradiated back surfaces for this exterior window - int ConstrNumBack = state.dataSurface->Surface(BackSurfNum).Construction; + int ConstrNumBack = s_surf->Surface(BackSurfNum).Construction; // NBackGlass = Construct( ConstrNumBack ).TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) @@ -8849,30 +8605,30 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) // Back surface is opaque interior or exterior wall Real64 AbsIntSurf = state.dataHeatBalSurf->SurfAbsSolarInt(BackSurfNum); - state.dataSurface->SurfOpaqAI(BackSurfNum) += BOverlap * AbsIntSurf / state.dataSurface->Surface(BackSurfNum).Area; //[-] - BABSZone += BOverlap * AbsIntSurf; //[m2] + s_surf->SurfOpaqAI(BackSurfNum) += BOverlap * AbsIntSurf / s_surf->Surface(BackSurfNum).Area; //[-] + BABSZone += BOverlap * AbsIntSurf; //[m2] } } } else { for (int const FloorNum : thisEnclosure.SurfacePtr) { // In following, ISABSF is zero except for nominal floor surfaces - if (!state.dataSurface->Surface(FloorNum).HeatTransSurf) continue; + if (!s_surf->Surface(FloorNum).HeatTransSurf) continue; if (state.dataSolarShading->SurfIntAbsFac(FloorNum) <= 0.0 || FloorNum == SurfNum) continue; // Keep only floor surfaces Real64 BTOTWinZone = TBm * SunLitFract * surf.Area * CosInc * window.InOutProjSLFracMult[state.dataGlobal->HourOfDay]; //[m2] - if (state.dataConstruction->Construct(state.dataSurface->Surface(FloorNum).Construction).TransDiff <= 0.0) { + if (state.dataConstruction->Construct(s_surf->Surface(FloorNum).Construction).TransDiff <= 0.0) { // Opaque surface - state.dataSurface->SurfOpaqAI(FloorNum) += - BTOTWinZone * state.dataSolarShading->SurfIntAbsFac(FloorNum) / state.dataSurface->Surface(FloorNum).Area; //[-] + s_surf->SurfOpaqAI(FloorNum) += + BTOTWinZone * state.dataSolarShading->SurfIntAbsFac(FloorNum) / s_surf->Surface(FloorNum).Area; //[-] } } } - state.dataHeatBal->ZoneTransSolar(enclosureNum) += state.dataSurface->SurfWinTransSolar(SurfNum); //[W] + state.dataHeatBal->ZoneTransSolar(enclosureNum) += s_surf->SurfWinTransSolar(SurfNum); //[W] state.dataHeatBal->ZoneTransSolarEnergy(enclosureNum) = state.dataHeatBal->ZoneTransSolar(enclosureNum) * state.dataGlobal->TimeStepZoneSec; //[J] - state.dataHeatBal->ZoneBmSolFrExtWinsRep(enclosureNum) += state.dataSurface->SurfWinBmSolar(SurfNum); - state.dataHeatBal->ZoneDifSolFrExtWinsRep(enclosureNum) += state.dataSurface->SurfWinDifSolar(SurfNum); + state.dataHeatBal->ZoneBmSolFrExtWinsRep(enclosureNum) += s_surf->SurfWinBmSolar(SurfNum); + state.dataHeatBal->ZoneDifSolFrExtWinsRep(enclosureNum) += s_surf->SurfWinDifSolar(SurfNum); state.dataHeatBal->ZoneBmSolFrExtWinsRepEnergy(enclosureNum) = state.dataHeatBal->ZoneBmSolFrExtWinsRep(enclosureNum) * state.dataGlobal->TimeStepZoneSec; //[J] state.dataHeatBal->ZoneDifSolFrExtWinsRepEnergy(enclosureNum) = @@ -8893,20 +8649,15 @@ int WindowScheduledSolarAbs(EnergyPlusData &state, // PURPOSE OF THIS SUBROUTINE: // Returns scheduled surface gain object for given surface-construction combination + auto &s_surf = state.dataSurface; - // Return value - int WindowScheduledSolarAbs; - - WindowScheduledSolarAbs = 0; - - for (int i = 1; i <= state.dataSurface->TotFenLayAbsSSG; ++i) { - if ((state.dataSurface->FenLayAbsSSG(i).SurfPtr == SurfNum) && (state.dataSurface->FenLayAbsSSG(i).ConstrPtr == ConstNum)) { - WindowScheduledSolarAbs = i; - return WindowScheduledSolarAbs; + for (int i = 1; i <= s_surf->TotFenLayAbsSSG; ++i) { + if ((s_surf->FenLayAbsSSG(i).SurfPtr == SurfNum) && (s_surf->FenLayAbsSSG(i).ConstrPtr == ConstNum)) { + return i; } } - return WindowScheduledSolarAbs; + return 0; } int SurfaceScheduledSolarInc(EnergyPlusData &state, @@ -8921,19 +8672,15 @@ int SurfaceScheduledSolarInc(EnergyPlusData &state, // PURPOSE OF THIS SUBROUTINE: // Returns scheduled surface gain pointer for given surface-construction combination - // Return value - int SurfaceScheduledSolarInc; - - SurfaceScheduledSolarInc = 0; + auto &s_surf = state.dataSurface; - for (int i = 1; i <= state.dataSurface->TotSurfIncSolSSG; ++i) { - if ((state.dataSurface->SurfIncSolSSG(i).SurfPtr == SurfNum) && (state.dataSurface->SurfIncSolSSG(i).ConstrPtr == ConstNum)) { - SurfaceScheduledSolarInc = i; - return SurfaceScheduledSolarInc; + for (int i = 1; i <= s_surf->TotSurfIncSolSSG; ++i) { + if ((s_surf->SurfIncSolSSG(i).SurfPtr == SurfNum) && (s_surf->SurfIncSolSSG(i).ConstrPtr == ConstNum)) { + return i; } } - return SurfaceScheduledSolarInc; + return 0; } void PerformSolarCalculations(EnergyPlusData &state) @@ -8991,6 +8738,7 @@ void PerformSolarCalculations(EnergyPlusData &state) Real64 EqTime; // not used INTEGER SurfNum + auto &s_surf = state.dataSurface; // Calculate sky diffuse shading if (state.dataGlobal->BeginSimFlag) { @@ -9049,7 +8797,7 @@ void PerformSolarCalculations(EnergyPlusData &state) CalcPerSolarBeam(state, AvgEqOfTime, AvgSinSolarDeclin, AvgCosSolarDeclin); // Calculate factors for solar reflection - if (state.dataSurface->CalcSolRefl) { + if (s_surf->CalcSolRefl) { CalcBeamSolDiffuseReflFactors(state); CalcBeamSolSpecularReflFactors(state); if (state.dataGlobal->BeginSimFlag) CalcSkySolDiffuseReflFactors(state); @@ -9065,7 +8813,7 @@ void PerformSolarCalculations(EnergyPlusData &state) // Recalculate daylighting coefficients if storm window has been added // or removed from one or more windows at beginning of day if (state.dataDayltg->TotWindowsWithDayl > 0 && !state.dataGlobal->BeginSimFlag && !state.dataGlobal->BeginEnvrnFlag && - !state.dataGlobal->WarmupFlag && state.dataSurface->TotStormWin > 0 && state.dataHeatBal->StormWinChangeThisDay) { + !state.dataGlobal->WarmupFlag && s_surf->TotStormWin > 0 && state.dataHeatBal->StormWinChangeThisDay) { CalcDayltgCoefficients(state); } } @@ -9108,6 +8856,8 @@ void SHDRVL(EnergyPlusData &state, // Certain operations performed only if reveal status not yet set. int RevealStatus; // Status of the reveal, takes the parameter values above + auto &s_surf = state.dataSurface; + RevealStatus = None; RevealStatusSet = false; @@ -9115,7 +8865,7 @@ void SHDRVL(EnergyPlusData &state, state.dataSolarShading->SurfWinRevealStatus(Hour, TS, SBSNR) = None; } - R = state.dataSurface->Surface(SBSNR).Reveal; + R = s_surf->Surface(SBSNR).Reveal; if (R <= 0.0) { RevealStatus = None; RevealStatusSet = true; @@ -9125,7 +8875,7 @@ void SHDRVL(EnergyPlusData &state, state.dataSolarShading->FRVLHC = state.dataSolarShading->LOCHCA + 1; ++state.dataSolarShading->LOCHCA; - NVS = state.dataSurface->Surface(SBSNR).Sides; + NVS = s_surf->Surface(SBSNR).Sides; // Currently (06May02) windows are either rectangles (NVS=4) or triangles (NVS=3) @@ -9134,14 +8884,14 @@ void SHDRVL(EnergyPlusData &state, // Determine vertices of reveal. // Project the subsurface up to the plane of the wall. - XVT(1) = state.dataSurface->ShadeV(SBSNR).XV(1) + R * max(state.dataSolarShading->XShadowProjection, 0.0); - XVT(2) = state.dataSurface->ShadeV(SBSNR).XV(2) + R * max(state.dataSolarShading->XShadowProjection, 0.0); - XVT(3) = state.dataSurface->ShadeV(SBSNR).XV(3) + R * min(state.dataSolarShading->XShadowProjection, 0.0); - XVT(4) = state.dataSurface->ShadeV(SBSNR).XV(4) + R * min(state.dataSolarShading->XShadowProjection, 0.0); - YVT(1) = state.dataSurface->ShadeV(SBSNR).YV(1) + R * min(state.dataSolarShading->YShadowProjection, 0.0); - YVT(2) = state.dataSurface->ShadeV(SBSNR).YV(2) + R * max(state.dataSolarShading->YShadowProjection, 0.0); - YVT(3) = state.dataSurface->ShadeV(SBSNR).YV(3) + R * max(state.dataSolarShading->YShadowProjection, 0.0); - YVT(4) = state.dataSurface->ShadeV(SBSNR).YV(4) + R * min(state.dataSolarShading->YShadowProjection, 0.0); + XVT(1) = s_surf->ShadeV(SBSNR).XV(1) + R * max(state.dataSolarShading->XShadowProjection, 0.0); + XVT(2) = s_surf->ShadeV(SBSNR).XV(2) + R * max(state.dataSolarShading->XShadowProjection, 0.0); + XVT(3) = s_surf->ShadeV(SBSNR).XV(3) + R * min(state.dataSolarShading->XShadowProjection, 0.0); + XVT(4) = s_surf->ShadeV(SBSNR).XV(4) + R * min(state.dataSolarShading->XShadowProjection, 0.0); + YVT(1) = s_surf->ShadeV(SBSNR).YV(1) + R * min(state.dataSolarShading->YShadowProjection, 0.0); + YVT(2) = s_surf->ShadeV(SBSNR).YV(2) + R * max(state.dataSolarShading->YShadowProjection, 0.0); + YVT(3) = s_surf->ShadeV(SBSNR).YV(3) + R * max(state.dataSolarShading->YShadowProjection, 0.0); + YVT(4) = s_surf->ShadeV(SBSNR).YV(4) + R * min(state.dataSolarShading->YShadowProjection, 0.0); // Check for complete shadowing. @@ -9175,8 +8925,8 @@ void SHDRVL(EnergyPlusData &state, // Project window to outside plane of parent surface for (N = 1; N <= 3; ++N) { - XVT(N) = state.dataSurface->ShadeV(SBSNR).XV(N) + R * state.dataSolarShading->XShadowProjection; - YVT(N) = state.dataSurface->ShadeV(SBSNR).YV(N) + R * state.dataSolarShading->YShadowProjection; + XVT(N) = s_surf->ShadeV(SBSNR).XV(N) + R * state.dataSolarShading->XShadowProjection; + YVT(N) = s_surf->ShadeV(SBSNR).YV(N) + R * state.dataSolarShading->YShadowProjection; } // Find the overlap between the original window and the projected window @@ -9196,8 +8946,8 @@ void SHDRVL(EnergyPlusData &state, // Put XV,YV in clockwise order for (N = 1; N <= NVS; ++N) { - state.dataSolarShading->XVS(N) = state.dataSurface->ShadeV(SBSNR).XV(NVS + 1 - N); - state.dataSolarShading->YVS(N) = state.dataSurface->ShadeV(SBSNR).YV(NVS + 1 - N); + state.dataSolarShading->XVS(N) = s_surf->ShadeV(SBSNR).XV(NVS + 1 - N); + state.dataSolarShading->YVS(N) = s_surf->ShadeV(SBSNR).YV(NVS + 1 - N); } // Transform to homogenous coordinates @@ -9303,6 +9053,8 @@ void SHDSBS(EnergyPlusData &state, int HTSS; // Heat transfer surface number of the subsurface int SBSNR; // Subsurface number + auto &s_surf = state.dataSurface; + if (NSBS > 0) { // Action taken only if subsurfaces present state.dataSolarShading->FSBSHC = state.dataSolarShading->LOCHCA + 1; @@ -9313,17 +9065,17 @@ void SHDSBS(EnergyPlusData &state, HTSS = SBSNR; - K = state.dataSurface->Surface(SBSNR).Construction; + K = s_surf->Surface(SBSNR).Construction; if (!state.dataSolarShading->penumbra) { if ((state.dataSolarShading->OverlapStatus != TooManyVertices) && (state.dataSolarShading->OverlapStatus != TooManyFigures) && (state.dataSolarShading->SurfSunlitArea(HTS) > 0.0)) { // Re-order vertices to clockwise sequential; compute homogeneous coordinates. - state.dataSolarShading->NVS = state.dataSurface->Surface(SBSNR).Sides; + state.dataSolarShading->NVS = s_surf->Surface(SBSNR).Sides; for (N = 1; N <= state.dataSolarShading->NVS; ++N) { - state.dataSolarShading->XVS(N) = state.dataSurface->ShadeV(SBSNR).XV(state.dataSolarShading->NVS + 1 - N); - state.dataSolarShading->YVS(N) = state.dataSurface->ShadeV(SBSNR).YV(state.dataSolarShading->NVS + 1 - N); + state.dataSolarShading->XVS(N) = s_surf->ShadeV(SBSNR).XV(state.dataSolarShading->NVS + 1 - N); + state.dataSolarShading->YVS(N) = s_surf->ShadeV(SBSNR).YV(state.dataSolarShading->NVS + 1 - N); } state.dataSolarShading->LOCHCA = state.dataSolarShading->FSBSHC; HTRANS1(state, state.dataSolarShading->LOCHCA, state.dataSolarShading->NVS); @@ -9359,7 +9111,7 @@ void SHDSBS(EnergyPlusData &state, // new code fixed part of CR 7596. TH 5/29/2009 if (iHour > 0 && TS > 0) state.dataHeatBal->SurfSunlitFracWithoutReveal(iHour, TS, HTSS) = - state.dataSolarShading->SurfSunlitArea(HTSS) / state.dataSurface->Surface(HTSS).NetAreaShadowCalc; + state.dataSolarShading->SurfSunlitArea(HTSS) / s_surf->Surface(HTSS).NetAreaShadowCalc; SHDRVL(state, HTSS, SBSNR, iHour, TS); // Determine shadowing from reveal. @@ -9381,7 +9133,7 @@ void SHDSBS(EnergyPlusData &state, if (iHour > 0 && TS > 0) state.dataHeatBal->SurfSunlitFracWithoutReveal(iHour, TS, HTSS) = - state.dataSolarShading->SurfSunlitArea(HTSS) / state.dataSurface->Surface(HTSS).Area; + state.dataSolarShading->SurfSunlitArea(HTSS) / s_surf->Surface(HTSS).Area; SHDRVL(state, HTSS, SBSNR, iHour, TS); // Determine shadowing from reveal. @@ -9406,7 +9158,7 @@ void SHDSBS(EnergyPlusData &state, } // Error checking. - SurfArea = state.dataSurface->Surface(SBSNR).NetAreaShadowCalc; + SurfArea = s_surf->Surface(SBSNR).NetAreaShadowCalc; state.dataSolarShading->SurfSunlitArea(HTSS) = max(0.0, state.dataSolarShading->SurfSunlitArea(HTSS)); state.dataSolarShading->SurfSunlitArea(HTSS) = min(state.dataSolarShading->SurfSunlitArea(HTSS), SurfArea); @@ -9575,129 +9327,124 @@ void WindowShadingManager(EnergyPlusData &state) using General::POLYF; using ScheduleManager::GetCurrentScheduleValue; - static Real64 constexpr DeltaAng(Constant::Pi / (double(Material::MaxSlatAngs) - 1.0)); - static Real64 constexpr DeltaAng_inv(1.0 / DeltaAng); - static Real64 constexpr DeltaProfAng(Constant::Pi / 36.0); int IConst; // Construction + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; + for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); int const firstSurfWin = thisSpace.WindowSurfaceFirst; int const lastSurfWin = thisSpace.WindowSurfaceLast; for (int ISurf = firstSurfWin; ISurf <= lastSurfWin; ++ISurf) { - auto const &surfWin = state.dataSurface->SurfaceWindow(ISurf); - state.dataSurface->SurfWinExtIntShadePrevTS(ISurf) = state.dataSurface->SurfWinShadingFlag(ISurf); + auto &surfWin = s_surf->SurfaceWindow(ISurf); + s_surf->SurfWinExtIntShadePrevTS(ISurf) = s_surf->SurfWinShadingFlag(ISurf); - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::NoShade; - state.dataSurface->SurfWinFracTimeShadingDeviceOn(ISurf) = 0.0; - if (state.dataSurface->SurfWinWindowModelType(ISurf) == WindowModel::EQL) { - int EQLNum = state.dataConstruction->Construct(state.dataSurface->Surface(ISurf).Construction).EQLConsPtr; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::NoShade; + s_surf->SurfWinFracTimeShadingDeviceOn(ISurf) = 0.0; + if (s_surf->SurfWinWindowModelType(ISurf) == WindowModel::EQL) { + int EQLNum = state.dataConstruction->Construct(s_surf->Surface(ISurf).Construction).EQLConsPtr; if (state.dataWindowEquivLayer->CFS(EQLNum).VBLayerPtr > 0) { + auto &surfShade = s_surf->surfShades(ISurf); if (state.dataWindowEquivLayer->CFS(EQLNum).L(state.dataWindowEquivLayer->CFS(EQLNum).VBLayerPtr).CNTRL == state.dataWindowEquivalentLayer->lscNONE) { - state.dataSurface->SurfWinSlatAngThisTSDeg(ISurf) = + surfShade.blind.slatAngDeg = state.dataWindowEquivLayer->CFS(EQLNum).L(state.dataWindowEquivLayer->CFS(EQLNum).VBLayerPtr).PHI_DEG; } else { - state.dataSurface->SurfWinSlatAngThisTSDeg(ISurf) = 0.0; + surfShade.blind.slatAngDeg = 0.0; } } } // Initialization of complex fenestration shading device - if (state.dataSurface->SurfWinWindowModelType(ISurf) == WindowModel::BSDF) { - auto &construction = state.dataConstruction->Construct(state.dataSurface->Surface(ISurf).Construction); - auto &surface_window = state.dataSurface->SurfaceWindow(ISurf); + if (s_surf->SurfWinWindowModelType(ISurf) == WindowModel::BSDF) { + auto &construction = state.dataConstruction->Construct(s_surf->Surface(ISurf).Construction); int TotLayers = construction.TotLayers; for (int Lay = 1; Lay <= TotLayers; ++Lay) { const int LayPtr = construction.LayerPoint(Lay); - auto *material(state.dataMaterial->Material(LayPtr)); - const bool isShading = material->group == Material::Group::ComplexWindowShade; + auto const *material = s_mat->materials(LayPtr); + const bool isShading = material->group == Material::Group::ComplexShade; if (isShading && Lay == 1) { - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::ExtShade; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::ExtShade; } if (isShading && Lay == TotLayers) { - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::IntShade; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::IntShade; } } - if (state.dataSurface->SurfWinShadingFlag(ISurf) == WinShadingType::IntShade) { - auto &construction = state.dataConstruction->Construct(state.dataSurface->Surface(ISurf).Construction); + + if (s_surf->SurfWinShadingFlag(ISurf) == WinShadingType::IntShade) { + auto &surfShade = s_surf->surfShades(ISurf); + auto &construction = state.dataConstruction->Construct(s_surf->Surface(ISurf).Construction); const int TotLay = construction.TotLayers; int ShadingLayerPtr = construction.LayerPoint(TotLay); - ShadingLayerPtr = dynamic_cast(state.dataMaterial->Material(ShadingLayerPtr))->ComplexShadePtr; - auto &complexShade = state.dataMaterial->ComplexShade(ShadingLayerPtr); - Real64 TauShadeIR = complexShade.IRTransmittance; - Real64 EpsShadeIR = complexShade.BackEmissivity; + auto const *matComplexShade = dynamic_cast(s_mat->materials(ShadingLayerPtr)); + Real64 TauShadeIR = matComplexShade->TransThermal; + Real64 EpsShadeIR = matComplexShade->BackEmissivity; Real64 RhoShadeIR = max(0.0, 1.0 - TauShadeIR - EpsShadeIR); // Get properties of glass next to inside shading layer int GlassLayPtr = construction.LayerPoint(TotLay - 2); - Real64 EpsGlassIR = dynamic_cast(state.dataMaterial->Material(GlassLayPtr))->AbsorpThermalBack; + Real64 EpsGlassIR = s_mat->materials(GlassLayPtr)->AbsorpThermalBack; Real64 RhoGlassIR = 1 - EpsGlassIR; - Real64 EffShBlEmiss = EpsShadeIR * (1.0 + RhoGlassIR * TauShadeIR / (1.0 - RhoGlassIR * RhoShadeIR)); - surface_window.EffShBlindEmiss[1] = EffShBlEmiss; - Real64 EffGlEmiss = EpsGlassIR * TauShadeIR / (1.0 - RhoGlassIR * RhoShadeIR); - surface_window.EffGlassEmiss[1] = EffGlEmiss; + surfShade.effShadeEmi = EpsShadeIR * (1.0 + RhoGlassIR * TauShadeIR / (1.0 - RhoGlassIR * RhoShadeIR)); + surfShade.effGlassEmi = EpsGlassIR * TauShadeIR / (1.0 - RhoGlassIR * RhoShadeIR); } } - if (state.dataSurface->Surface(ISurf).ExtBoundCond != ExternalEnvironment) continue; - if (!state.dataSurface->Surface(ISurf).HasShadeControl) { + if (s_surf->Surface(ISurf).ExtBoundCond != ExternalEnvironment) continue; + if (!s_surf->Surface(ISurf).HasShadeControl) { continue; } else { // } // Initialize switching factor (applicable only to switchable glazing) to unswitched - state.dataSurface->SurfWinSwitchingFactor(ISurf) = 0.0; + s_surf->SurfWinSwitchingFactor(ISurf) = 0.0; - IConst = state.dataSurface->Surface(ISurf).Construction; + IConst = s_surf->Surface(ISurf).Construction; // Vis trans at normal incidence of unswitched glass. Counting the GlazedFrac if (IConst > 0) - state.dataSurface->SurfWinVisTransSelected(ISurf) = + s_surf->SurfWinVisTransSelected(ISurf) = POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // Window has shading control // select the active window shading control and corresponding contructions size_t indexWindowShadingControl = selectActiveWindowShadingControlIndex(state, ISurf); - if (!state.dataSurface->Surface(ISurf).windowShadingControlList.empty() && - indexWindowShadingControl <= state.dataSurface->Surface(ISurf).windowShadingControlList.size() - 1) { - state.dataSurface->Surface(ISurf).activeWindowShadingControl = - state.dataSurface->Surface(ISurf).windowShadingControlList[indexWindowShadingControl]; - } - state.dataSurface->Surface(ISurf).activeShadedConstructionPrev = state.dataSurface->Surface(ISurf).activeShadedConstruction; - if (!state.dataSurface->Surface(ISurf).shadedConstructionList.empty() && - indexWindowShadingControl <= state.dataSurface->Surface(ISurf).shadedConstructionList.size() - 1) { - state.dataSurface->Surface(ISurf).activeShadedConstruction = - state.dataSurface->Surface(ISurf).shadedConstructionList[indexWindowShadingControl]; - } - state.dataSurface->SurfWinActiveShadedConstruction(ISurf) = state.dataSurface->Surface(ISurf).activeShadedConstruction; - if (!state.dataSurface->Surface(ISurf).shadedStormWinConstructionList.empty() && - indexWindowShadingControl <= state.dataSurface->Surface(ISurf).shadedStormWinConstructionList.size() - 1) { - if (state.dataSurface->SurfWinStormWinFlag(ISurf) == 1) { - state.dataSurface->SurfWinActiveShadedConstruction(ISurf) = - state.dataSurface->Surface(ISurf).shadedStormWinConstructionList[indexWindowShadingControl]; + if (!s_surf->Surface(ISurf).windowShadingControlList.empty() && + indexWindowShadingControl <= s_surf->Surface(ISurf).windowShadingControlList.size() - 1) { + s_surf->Surface(ISurf).activeWindowShadingControl = s_surf->Surface(ISurf).windowShadingControlList[indexWindowShadingControl]; + } + s_surf->Surface(ISurf).activeShadedConstructionPrev = s_surf->Surface(ISurf).activeShadedConstruction; + if (!s_surf->Surface(ISurf).shadedConstructionList.empty() && + indexWindowShadingControl <= s_surf->Surface(ISurf).shadedConstructionList.size() - 1) { + s_surf->Surface(ISurf).activeShadedConstruction = s_surf->Surface(ISurf).shadedConstructionList[indexWindowShadingControl]; + } + s_surf->SurfWinActiveShadedConstruction(ISurf) = s_surf->Surface(ISurf).activeShadedConstruction; + if (!s_surf->Surface(ISurf).shadedStormWinConstructionList.empty() && + indexWindowShadingControl <= s_surf->Surface(ISurf).shadedStormWinConstructionList.size() - 1) { + if (s_surf->SurfWinStormWinFlag(ISurf) == 1) { + s_surf->SurfWinActiveShadedConstruction(ISurf) = + s_surf->Surface(ISurf).shadedStormWinConstructionList[indexWindowShadingControl]; } } - int IShadingCtrl = state.dataSurface->Surface(ISurf).activeWindowShadingControl; - int IZone = state.dataSurface->Surface(ISurf).Zone; + int IShadingCtrl = s_surf->Surface(ISurf).activeWindowShadingControl; + int IZone = s_surf->Surface(ISurf).Zone; // Setpoint for shading - Real64 SetPoint = state.dataSurface->WindowShadingControl(IShadingCtrl).SetPoint; // Control setpoint - Real64 SetPoint2 = state.dataSurface->WindowShadingControl(IShadingCtrl).SetPoint2; // Second control setpoint + Real64 SetPoint = s_surf->WindowShadingControl(IShadingCtrl).SetPoint; // Control setpoint + Real64 SetPoint2 = s_surf->WindowShadingControl(IShadingCtrl).SetPoint2; // Second control setpoint bool SchedAllowsControl = true; // True if control schedule is not specified or is specified and schedule value = 1 - int SchedulePtr = state.dataSurface->WindowShadingControl(IShadingCtrl).Schedule; + int SchedulePtr = s_surf->WindowShadingControl(IShadingCtrl).Schedule; if (SchedulePtr != 0) { - if (state.dataSurface->WindowShadingControl(IShadingCtrl).ShadingControlIsScheduled && - GetCurrentScheduleValue(state, SchedulePtr) <= 0.0) + if (s_surf->WindowShadingControl(IShadingCtrl).ShadingControlIsScheduled && GetCurrentScheduleValue(state, SchedulePtr) <= 0.0) SchedAllowsControl = false; } - Real64 GlareControlIsActive = - (state.dataDayltg->ZoneDaylight(IZone).totRefPts > 0 && state.dataEnvrn->SunIsUp && - state.dataSurface->WindowShadingControl(IShadingCtrl).GlareControlIsActive); // True if glare control is active + Real64 GlareControlIsActive = (state.dataDayltg->ZoneDaylight(IZone).totRefPts > 0 && state.dataEnvrn->SunIsUp && + s_surf->WindowShadingControl(IShadingCtrl).GlareControlIsActive); // True if glare control is active Real64 SolarOnWindow = 0.0; // Direct plus diffuse solar intensity on window (W/m2) Real64 BeamSolarOnWindow = 0.0; // Direct solar intensity on window (W/m2) @@ -9708,8 +9455,7 @@ void WindowShadingManager(EnergyPlusData &state) BeamSolarOnWindow = state.dataEnvrn->BeamSolarRad * state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, ISurf) * state.dataHeatBal->SurfSunlitFrac(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, ISurf); - SolarOnWindow = - BeamSolarOnWindow + SkySolarOnWindow + state.dataEnvrn->GndSolarRad * state.dataSurface->Surface(ISurf).ViewFactorGround; + SolarOnWindow = BeamSolarOnWindow + SkySolarOnWindow + state.dataEnvrn->GndSolarRad * s_surf->Surface(ISurf).ViewFactorGround; HorizSolar = state.dataEnvrn->BeamSolarRad * state.dataEnvrn->SOLCOS(3) + state.dataEnvrn->DifSolarRad; } @@ -9718,7 +9464,7 @@ void WindowShadingManager(EnergyPlusData &state) bool shadingOn = false; bool shadingOffButGlareControlOn = false; - switch (state.dataSurface->WindowShadingControl(IShadingCtrl).shadingControlType) { + switch (s_surf->WindowShadingControl(IShadingCtrl).shadingControlType) { case WindowShadingControlType::AlwaysOn: // 'ALWAYSON' shadingOn = true; break; @@ -9749,7 +9495,7 @@ void WindowShadingManager(EnergyPlusData &state) break; case WindowShadingControlType::HiOutAirTemp: // 'OnIfHighOutdoorAirTemperature' - if (state.dataSurface->SurfOutDryBulbTemp(ISurf) > SetPoint && SchedAllowsControl) { + if (s_surf->SurfOutDryBulbTemp(ISurf) > SetPoint && SchedAllowsControl) { shadingOn = true; } else if (GlareControlIsActive) { shadingOffButGlareControlOn = true; @@ -9767,7 +9513,7 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::OnHiOutTemp_HiSolarWindow: // 'OnIfHighOutdoorAirTempAndHighSolarOnWindow' ! Outside air temp and // solar on window if (state.dataEnvrn->SunIsUp) { - if (state.dataSurface->SurfOutDryBulbTemp(ISurf) > SetPoint && SolarOnWindow > SetPoint2 && SchedAllowsControl) { + if (s_surf->SurfOutDryBulbTemp(ISurf) > SetPoint && SolarOnWindow > SetPoint2 && SchedAllowsControl) { shadingOn = true; } else if (GlareControlIsActive) { shadingOffButGlareControlOn = true; @@ -9778,7 +9524,7 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::OnHiOutTemp_HiHorzSolar: // 'OnIfHighOutdoorAirTempAndHighHorizontalSolar' ! Outside air temp and // horizontal solar if (state.dataEnvrn->SunIsUp) { - if (state.dataSurface->SurfOutDryBulbTemp(ISurf) > SetPoint && HorizSolar > SetPoint2 && SchedAllowsControl) { + if (s_surf->SurfOutDryBulbTemp(ISurf) > SetPoint && HorizSolar > SetPoint2 && SchedAllowsControl) { shadingOn = true; } else if (GlareControlIsActive) { shadingOffButGlareControlOn = true; @@ -9841,7 +9587,7 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::HiSolar_HiLumin_OffMidNight: // 'OnIfHighSolarOrHighLuminanceTillMidnight' // if shade is already on, then keep it on until midnight, otherwise check thresholds - if (SchedAllowsControl && IS_SHADED(state.dataSurface->SurfWinExtIntShadePrevTS(ISurf))) { + if (SchedAllowsControl && IS_SHADED(s_surf->SurfWinExtIntShadePrevTS(ISurf))) { shadingOn = true; } else if (state.dataEnvrn->SunIsUp && SchedAllowsControl) { if (SolarOnWindow > SetPoint) { @@ -9862,7 +9608,7 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::HiSolar_HiLumin_OffSunset: // 'OnIfHighSolarOrHighLuminanceTillSunset' // if shade is already on, then keep it on until sunset, otherwise check thresholds - if (SchedAllowsControl && IS_SHADED(state.dataSurface->SurfWinExtIntShadePrevTS(ISurf))) { + if (SchedAllowsControl && IS_SHADED(s_surf->SurfWinExtIntShadePrevTS(ISurf))) { shadingOn = true; } else if (state.dataEnvrn->SunIsUp && SchedAllowsControl) { if (SolarOnWindow > SetPoint) { @@ -9883,7 +9629,7 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::HiSolar_HiLumin_OffNextMorning: // 'OnIfHighSolarOrHighLuminanceTillNextMorning' // if shade is already on, then keep it on until next day when sun is up, otherwise check thresholds - if (SchedAllowsControl && IS_SHADED(state.dataSurface->SurfWinExtIntShadePrevTS(ISurf))) { + if (SchedAllowsControl && IS_SHADED(s_surf->SurfWinExtIntShadePrevTS(ISurf))) { shadingOn = true; } else if (state.dataEnvrn->SunIsUp && SchedAllowsControl) { if (SolarOnWindow > SetPoint) { @@ -9902,7 +9648,7 @@ void WindowShadingManager(EnergyPlusData &state) break; case WindowShadingControlType::OnNightLoOutTemp_OffDay: // 'OnNightIfLowOutdoorTempAndOffDay' - if (!state.dataEnvrn->SunIsUp && state.dataSurface->SurfOutDryBulbTemp(ISurf) < SetPoint && SchedAllowsControl) { + if (!state.dataEnvrn->SunIsUp && s_surf->SurfOutDryBulbTemp(ISurf) < SetPoint && SchedAllowsControl) { shadingOn = true; } else if (GlareControlIsActive) { shadingOffButGlareControlOn = true; @@ -9931,7 +9677,7 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::OnNightLoOutTemp_OnDayCooling: // 'OnNightIfLowOutdoorTempAndOnDayIfCooling' if (!state.dataGlobal->BeginSimFlag) { if (!state.dataEnvrn->SunIsUp) { // Night - if (state.dataSurface->SurfOutDryBulbTemp(ISurf) < SetPoint && SchedAllowsControl) shadingOn = true; + if (s_surf->SurfOutDryBulbTemp(ISurf) < SetPoint && SchedAllowsControl) shadingOn = true; } else { // Day if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).airSysCoolRate > 0.0 && SchedAllowsControl) { shadingOn = true; @@ -9981,99 +9727,94 @@ void WindowShadingManager(EnergyPlusData &state) } break; default: - ShowWarningError( - state, format("Invalid Selection of Window Shading Control Type for Surface {}", state.dataSurface->Surface(ISurf).Name)); + ShowWarningError(state, format("Invalid Selection of Window Shading Control Type for Surface {}", s_surf->Surface(ISurf).Name)); } - WinShadingType ShType = state.dataSurface->WindowShadingControl(IShadingCtrl).ShadingType; + WinShadingType ShType = s_surf->WindowShadingControl(IShadingCtrl).ShadingType; - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::ShadeOff; // Initialize shading flag to off + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::ShadeOff; // Initialize shading flag to off if (IS_SHADED(ShType)) { if (shadingOn) { - state.dataSurface->SurfWinShadingFlag(ISurf) = ShType; + s_surf->SurfWinShadingFlag(ISurf) = ShType; } else if (shadingOffButGlareControlOn) { if (ShType == WinShadingType::SwitchableGlazing) - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::GlassConditionallyLightened; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::GlassConditionallyLightened; else if (ShType == WinShadingType::IntShade) - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::IntShadeConditionallyOff; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::IntShadeConditionallyOff; else if (ShType == WinShadingType::ExtShade) - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::ExtShadeConditionallyOff; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::ExtShadeConditionallyOff; else if (ShType == WinShadingType::IntBlind) - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::IntBlindConditionallyOff; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::IntBlindConditionallyOff; else if (ShType == WinShadingType::ExtBlind) - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::ExtBlindConditionallyOff; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::ExtBlindConditionallyOff; else if (ShType == WinShadingType::BGShade) - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::BGShadeConditionallyOff; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::BGShadeConditionallyOff; else if (ShType == WinShadingType::BGBlind) - state.dataSurface->SurfWinShadingFlag(ISurf) = WinShadingType::BGBlindConditionallyOff; + s_surf->SurfWinShadingFlag(ISurf) = WinShadingType::BGBlindConditionallyOff; } } // Set switching factor to fully switched if ShadingFlag = 2 - if (state.dataSurface->SurfWinShadingFlag(ISurf) == WinShadingType::SwitchableGlazing) { - state.dataSurface->SurfWinSwitchingFactor(ISurf) = 1.0; + if (s_surf->SurfWinShadingFlag(ISurf) == WinShadingType::SwitchableGlazing) { + s_surf->SurfWinSwitchingFactor(ISurf) = 1.0; // Added TH 1/20/2010 // Vis trans at normal incidence of fully switched glass - IConst = state.dataSurface->Surface(ISurf).activeShadedConstruction; - state.dataSurface->SurfWinVisTransSelected(ISurf) = + IConst = s_surf->Surface(ISurf).activeShadedConstruction; + s_surf->SurfWinVisTransSelected(ISurf) = POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; } // Slat angle control for blinds - - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = 0.0; - state.dataSurface->SurfWinSlatAngThisTSDeg(ISurf) = 0.0; - state.dataSurface->SurfWinSlatsBlockBeam(ISurf) = false; - if (ANY_BLIND(state.dataSurface->SurfWinShadingFlag(ISurf)) || - state.dataSurface->SurfWinShadingFlag(ISurf) == WinShadingType::IntBlindConditionallyOff || - state.dataSurface->SurfWinShadingFlag(ISurf) == WinShadingType::ExtBlindConditionallyOff || - state.dataSurface->SurfWinShadingFlag(ISurf) == WinShadingType::BGBlindConditionallyOff) { + auto &surfShade = s_surf->surfShades(ISurf); + surfShade.blind.slatAng = 0.0; + surfShade.blind.slatAngDeg = 0.0; + surfShade.blind.slatBlockBeam = false; + if (ANY_BLIND(s_surf->SurfWinShadingFlag(ISurf)) || s_surf->SurfWinShadingFlag(ISurf) == WinShadingType::IntBlindConditionallyOff || + s_surf->SurfWinShadingFlag(ISurf) == WinShadingType::ExtBlindConditionallyOff || + s_surf->SurfWinShadingFlag(ISurf) == WinShadingType::BGBlindConditionallyOff) { // Blind in place or may be in place due to glare control - int BlNum = state.dataSurface->SurfWinBlindNumber(ISurf); - if (BlNum > 0) { - Real64 InputSlatAngle = state.dataMaterial->Blind(BlNum).SlatAngle * - Constant::DegToRadians; // Slat angle of associated Material:WindowBlind (rad) - Real64 SlatAng; // Slat angle this time step (rad) - Real64 PermeabilityA; // Intermediate variables in blind permeability calc - Real64 PermeabilityB; - Real64 ThetaBase; // Intermediate slat angle variable (rad) - Real64 ThetaBlock1; // Slat angles that just block beam solar (rad) + if (surfShade.blind.matNum > 0) { + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + Real64 InputSlatAngle = matBlind->SlatAngle * Constant::DegToRad; // Slat angle of associated Material:WindowBlind (rad) + Real64 ThetaBase; // Intermediate slat angle variable (rad) + Real64 ThetaBlock1; // Slat angles that just block beam solar (rad) Real64 ThetaBlock2; - auto const &blind = state.dataMaterial->Blind(BlNum); - Real64 ProfAng = state.dataSurface->SurfWinProfileAng(ISurf) = - Dayltg::ProfileAngle(state, ISurf, state.dataEnvrn->SOLCOS, blind.SlatOrientation); + Real64 ProfAng = surfShade.blind.profAng = + Dayltg::ProfileAngle(state, ISurf, state.dataEnvrn->SOLCOS, matBlind->SlatOrientation); if (ProfAng > Constant::PiOvr2 || ProfAng < -Constant::PiOvr2) { ProfAng = min(max(ProfAng, -Constant::PiOvr2), Constant::PiOvr2); } - int ProfAngIndex = int((ProfAng + Constant::PiOvr2) / DeltaProfAng) + 1; - state.dataSurface->SurfWinProfAngIndex(ISurf) = ProfAngIndex; - state.dataSurface->SurfWinProfAngInterpFac(ISurf) = - (ProfAng + Constant::PiOvr2 - (ProfAngIndex - 1) * DeltaProfAng) / DeltaProfAng; - - if (blind.SlatWidth > blind.SlatSeparation && BeamSolarOnWindow > 0.0) { - ProfAng = state.dataSurface->SurfWinProfileAng(ISurf); - Real64 ThetaBase = std::acos(std::cos(ProfAng) * blind.SlatSeparation / blind.SlatWidth); + surfShade.blind.profAngIdxLo = int((ProfAng + Constant::PiOvr2) / Material::dProfAng) + 1; + surfShade.blind.profAngIdxHi = std::min(Material::MaxProfAngs, surfShade.blind.profAngIdxLo + 1); + + surfShade.blind.profAngInterpFac = + (ProfAng + Constant::PiOvr2 - (surfShade.blind.profAngIdxLo - 1) * Material::dProfAng) / Material::dProfAng; + + if (matBlind->SlatWidth > matBlind->SlatSeparation && BeamSolarOnWindow > 0.0) { + ProfAng = surfShade.blind.profAng; + Real64 ThetaBase = std::acos(std::cos(ProfAng) * matBlind->SlatSeparation / matBlind->SlatWidth); // There are two solutions for the slat angle that just blocks beam radiation ThetaBlock1 = ProfAng + ThetaBase; ThetaBlock2 = ProfAng + Constant::Pi - ThetaBase; state.dataSolarShading->ThetaSmall = min(ThetaBlock1, ThetaBlock2); state.dataSolarShading->ThetaBig = max(ThetaBlock1, ThetaBlock2); - state.dataSolarShading->ThetaMin = blind.MinSlatAngle * Constant::DegToRadians; - state.dataSolarShading->ThetaMax = blind.MaxSlatAngle * Constant::DegToRadians; + state.dataSolarShading->ThetaMin = matBlind->MinSlatAngle * Constant::DegToRad; + state.dataSolarShading->ThetaMax = matBlind->MaxSlatAngle * Constant::DegToRad; } // TH 5/20/2010, CR 8064: Slat Width <= Slat Separation - if (blind.SlatWidth <= blind.SlatSeparation && BeamSolarOnWindow > 0.0) { - if (state.dataSurface->WindowShadingControl(IShadingCtrl).slatAngleControl == SlatAngleControl::BlockBeamSolar) { - ProfAng = state.dataSurface->SurfWinProfileAng(ISurf); - if (std::abs(std::cos(ProfAng) * blind.SlatSeparation / blind.SlatWidth) <= 1.0) { + if (matBlind->SlatWidth <= matBlind->SlatSeparation && BeamSolarOnWindow > 0.0) { + if (s_surf->WindowShadingControl(IShadingCtrl).slatAngleControl == SlatAngleControl::BlockBeamSolar) { + ProfAng = surfShade.blind.profAng; + if (std::abs(std::cos(ProfAng) * matBlind->SlatSeparation / matBlind->SlatWidth) <= 1.0) { // set to block 100% of beam solar, not necessarily to block maximum solar (beam + diffuse) - ThetaBase = std::acos(std::cos(ProfAng) * blind.SlatSeparation / blind.SlatWidth); - state.dataSurface->SurfWinSlatsBlockBeam(ISurf) = true; + ThetaBase = std::acos(std::cos(ProfAng) * matBlind->SlatSeparation / matBlind->SlatWidth); + surfShade.blind.slatBlockBeam = true; } else { // cannot block 100% of beam solar, turn slats to be perpendicular to sun beam to block maximal beam solar ThetaBase = 0.0; @@ -10085,33 +9826,36 @@ void WindowShadingManager(EnergyPlusData &state) state.dataSolarShading->ThetaSmall = min(ThetaBlock1, ThetaBlock2); state.dataSolarShading->ThetaBig = max(ThetaBlock1, ThetaBlock2); - state.dataSolarShading->ThetaMin = blind.MinSlatAngle * Constant::DegToRadians; - state.dataSolarShading->ThetaMax = blind.MaxSlatAngle * Constant::DegToRadians; + state.dataSolarShading->ThetaMin = matBlind->MinSlatAngle * Constant::DegToRad; + state.dataSolarShading->ThetaMax = matBlind->MaxSlatAngle * Constant::DegToRad; } } - switch (state.dataSurface->WindowShadingControl(IShadingCtrl).slatAngleControl) { + // + Real64 slatAng = 0.0; + bool slatBlockBeam = false; + switch (s_surf->WindowShadingControl(IShadingCtrl).slatAngleControl) { + case SlatAngleControl::Fixed: { // 'FIXEDSLATANGLE' - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = InputSlatAngle; - if ((state.dataSurface->SurfWinSlatAngThisTS(ISurf) <= state.dataSolarShading->ThetaSmall || - state.dataSurface->SurfWinSlatAngThisTS(ISurf) >= state.dataSolarShading->ThetaBig) && - (blind.SlatWidth > blind.SlatSeparation) && (BeamSolarOnWindow > 0.0)) - state.dataSurface->SurfWinSlatsBlockBeam(ISurf) = true; + slatAng = InputSlatAngle; + + if ((slatAng <= state.dataSolarShading->ThetaSmall || slatAng >= state.dataSolarShading->ThetaBig) && + (matBlind->SlatWidth > matBlind->SlatSeparation) && (BeamSolarOnWindow > 0.0)) + slatBlockBeam = true; } break; + case SlatAngleControl::Scheduled: { // 'SCHEDULEDSLATANGLE' - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = - GetCurrentScheduleValue(state, state.dataSurface->WindowShadingControl(IShadingCtrl).SlatAngleSchedule); - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = - max(blind.MinSlatAngle, min(state.dataSurface->SurfWinSlatAngThisTS(ISurf), blind.MaxSlatAngle)) * - Constant::DegToRadians; - if ((state.dataSurface->SurfWinSlatAngThisTS(ISurf) <= state.dataSolarShading->ThetaSmall || - state.dataSurface->SurfWinSlatAngThisTS(ISurf) >= state.dataSolarShading->ThetaBig) && - (blind.SlatWidth > blind.SlatSeparation) && (BeamSolarOnWindow > 0.0)) - state.dataSurface->SurfWinSlatsBlockBeam(ISurf) = true; + slatAng = GetCurrentScheduleValue(state, s_surf->WindowShadingControl(IShadingCtrl).SlatAngleSchedule); + slatAng = max(matBlind->MinSlatAngle, min(slatAng, matBlind->MaxSlatAngle)) * Constant::DegToRad; + + if ((slatAng <= state.dataSolarShading->ThetaSmall || slatAng >= state.dataSolarShading->ThetaBig) && + (matBlind->SlatWidth > matBlind->SlatSeparation) && (BeamSolarOnWindow > 0.0)) + slatBlockBeam = true; } break; + case SlatAngleControl::BlockBeamSolar: { // 'BLOCKBEAMSOLAR' if (BeamSolarOnWindow > 0.0) { - if (blind.SlatSeparation >= blind.SlatWidth) { + if (matBlind->SlatSeparation >= matBlind->SlatWidth) { // TH 5/20/2010. CR 8064. // The following line of code assumes slats are always vertical/closed to minimize solar penetration // The slat angle can however change if the only goal is to block maximum amount of direct beam solar @@ -10119,89 +9863,100 @@ void WindowShadingManager(EnergyPlusData &state) if (state.dataSolarShading->ThetaSmall >= state.dataSolarShading->ThetaMin && state.dataSolarShading->ThetaSmall <= state.dataSolarShading->ThetaMax) { - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaSmall; + slatAng = state.dataSolarShading->ThetaSmall; } else if (state.dataSolarShading->ThetaBig >= state.dataSolarShading->ThetaMin && state.dataSolarShading->ThetaBig <= state.dataSolarShading->ThetaMax) { - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaBig; + slatAng = state.dataSolarShading->ThetaBig; } else if (state.dataSolarShading->ThetaSmall < state.dataSolarShading->ThetaMin && state.dataSolarShading->ThetaBig < state.dataSolarShading->ThetaMin) { - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaMin; + slatAng = state.dataSolarShading->ThetaMin; } else if (state.dataSolarShading->ThetaSmall > state.dataSolarShading->ThetaMax && state.dataSolarShading->ThetaBig > state.dataSolarShading->ThetaMax) { - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaMax; + slatAng = state.dataSolarShading->ThetaMax; } else { // ThetaBig > ThetaMax and ThetaSmall < ThetaMin (no-block condition) - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaMin; + slatAng = state.dataSolarShading->ThetaMin; } } else { // Usual case -- slat width greater than slat separation if (state.dataSolarShading->ThetaSmall >= state.dataSolarShading->ThetaMin && state.dataSolarShading->ThetaSmall <= state.dataSolarShading->ThetaMax) { - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaSmall; - state.dataSurface->SurfWinSlatsBlockBeam(ISurf) = true; + slatAng = state.dataSolarShading->ThetaSmall; + slatBlockBeam = true; } else if (state.dataSolarShading->ThetaBig >= state.dataSolarShading->ThetaMin && state.dataSolarShading->ThetaBig <= state.dataSolarShading->ThetaMax) { - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaBig; - state.dataSurface->SurfWinSlatsBlockBeam(ISurf) = true; + slatAng = state.dataSolarShading->ThetaBig; + slatBlockBeam = true; } else if (state.dataSolarShading->ThetaSmall < state.dataSolarShading->ThetaMin && state.dataSolarShading->ThetaBig < state.dataSolarShading->ThetaMin) { - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaMin; - state.dataSurface->SurfWinSlatsBlockBeam(ISurf) = true; + slatAng = state.dataSolarShading->ThetaMin; + slatBlockBeam = true; } else if (state.dataSolarShading->ThetaSmall > state.dataSolarShading->ThetaMax && state.dataSolarShading->ThetaBig > state.dataSolarShading->ThetaMax) { - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaMax; - state.dataSurface->SurfWinSlatsBlockBeam(ISurf) = true; + slatAng = state.dataSolarShading->ThetaMax; + slatBlockBeam = true; } else { // ThetaBig > ThetaMax and ThetaSmall < ThetaMin (no-block condition) - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = state.dataSolarShading->ThetaMin; + slatAng = state.dataSolarShading->ThetaMin; } } } else { - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = InputSlatAngle; + slatAng = InputSlatAngle; } } break; default: break; + } // switch (slatAngControl) + + if (surfShade.blind.slatAngDegEMSon) { + slatAng = Constant::DegToRad * surfShade.blind.slatAngDegEMSValue; } - state.dataSurface->SurfWinSlatAngThisTSDeg(ISurf) = state.dataSurface->SurfWinSlatAngThisTS(ISurf) / Constant::DegToRadians; - if (state.dataSurface->SurfWinSlatAngThisTSDegEMSon(ISurf)) { - state.dataSurface->SurfWinSlatAngThisTSDeg(ISurf) = state.dataSurface->SurfWinSlatAngThisTSDegEMSValue(ISurf); - state.dataSurface->SurfWinSlatAngThisTS(ISurf) = - Constant::DegToRadians * state.dataSurface->SurfWinSlatAngThisTSDeg(ISurf); + // Slat angle is changing, need to recalcualte stored values + if (slatAng != surfShade.blind.slatAng) { + surfShade.blind.slatAng = slatAng; + surfShade.blind.slatAngDeg = surfShade.blind.slatAng * Constant::RadToDeg; + + Material::GetSlatIndicesInterpFac(surfShade.blind.slatAng, + surfShade.blind.slatAngIdxLo, + surfShade.blind.slatAngIdxHi, + surfShade.blind.slatAngInterpFac); + surfShade.blind.TAR.interpSlatAng(matBlind->TARs[surfShade.blind.slatAngIdxLo], + matBlind->TARs[surfShade.blind.slatAngIdxHi], + surfShade.blind.slatAngInterpFac); + + Real64 TauShIR = surfShade.blind.TAR.IR.Ft.Tra; + Real64 EpsShIR = surfShade.blind.TAR.IR.Bk.Emi; + Real64 RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); + + surfShade.effShadeEmi = EpsShIR * (1.0 + surfShade.glass.rhoIR * TauShIR / (1.0 - surfShade.glass.rhoIR * RhoShIR)); + surfShade.effGlassEmi = surfShade.glass.epsIR * TauShIR / (1.0 - surfShade.glass.rhoIR * RhoShIR); } + + surfShade.blind.slatBlockBeam = slatBlockBeam; + // Air flow permeability for calculation of convective air flow between blind and glass - SlatAng = state.dataSurface->SurfWinSlatAngThisTS(ISurf); - PermeabilityA = std::sin(SlatAng) - blind.SlatThickness / blind.SlatSeparation; - PermeabilityB = - 1.0 - (std::abs(blind.SlatWidth * std::cos(SlatAng)) + blind.SlatThickness * std::sin(SlatAng)) / blind.SlatSeparation; - state.dataSurface->SurfWinBlindAirFlowPermeability(ISurf) = min(1.0, max(0.0, PermeabilityA, PermeabilityB)); - state.dataSurface->SurfWinBlindBmBmTrans(ISurf) = - Window::BlindBeamBeamTrans(ProfAng, SlatAng, blind.SlatWidth, blind.SlatSeparation, blind.SlatThickness); - // Calculate blind interpolation factors and indices. - if (state.dataSurface->SurfWinMovableSlats(ISurf)) { - if (SlatAng > Constant::Pi || SlatAng < 0.0) { - SlatAng = min(max(SlatAng, 0.0), Constant::Pi); - } - Real64 SlatsAngIndex = 1 + int(SlatAng * DeltaAng_inv); - state.dataSurface->SurfWinSlatsAngIndex(ISurf) = SlatsAngIndex; - state.dataSurface->SurfWinSlatsAngInterpFac(ISurf) = (SlatAng - DeltaAng * (SlatsAngIndex - 1)) * DeltaAng_inv; - } + Real64 PermeabilityA = std::sin(surfShade.blind.slatAng) - matBlind->SlatThickness / matBlind->SlatSeparation; + Real64 PermeabilityB = 1.0 - (std::abs(matBlind->SlatWidth * std::cos(surfShade.blind.slatAng)) + + matBlind->SlatThickness * std::sin(surfShade.blind.slatAng)) / + matBlind->SlatSeparation; + surfShade.blind.airFlowPermeability = min(1.0, max(0.0, PermeabilityA, PermeabilityB)); + surfShade.blind.bmBmTrans = matBlind->BeamBeamTrans(surfShade.blind.profAng, surfShade.blind.slatAng); } } // End of check if interior or exterior or between glass blind in place // AR: don't need to do this anymore I don't think // CALL CalcScreenTransmittance to intialized all screens prior to HB calc's - // if (state.dataSurface->SurfWinShadingFlag(ISurf) == WinShadingType::ExtScreen && state.dataEnvrn->SunIsUp) { + // if (s_surf->SurfWinShadingFlag(ISurf) == WinShadingType::ExtScreen && state.dataEnvrn->SunIsUp) { // CalcScreenTransmittance(state, ISurf); // } // EMS Actuator Point: override setting if ems flag on - if (state.dataSurface->SurfWinShadingFlagEMSOn(ISurf)) { - WinShadingType SurfWinShadingFlagEMS = findValueInEnumeration(state.dataSurface->SurfWinShadingFlagEMSValue(ISurf)); + if (s_surf->SurfWinShadingFlagEMSOn(ISurf)) { + WinShadingType SurfWinShadingFlagEMS = findValueInEnumeration(s_surf->SurfWinShadingFlagEMSValue(ISurf)); if (SurfWinShadingFlagEMS != WinShadingType::Invalid) { - state.dataSurface->SurfWinShadingFlag(ISurf) = SurfWinShadingFlagEMS; + s_surf->SurfWinShadingFlag(ISurf) = SurfWinShadingFlagEMS; } else { - ShowWarningError( - state, format("Invalid EMS value of Window Shading Control Type for Surface {}", state.dataSurface->Surface(ISurf).Name)); + ShowWarningError(state, + format("Invalid EMS value of Window Shading Control Type for Surface {}", s_surf->Surface(ISurf).Name)); } } } // End of surface loop @@ -10211,6 +9966,7 @@ void WindowShadingManager(EnergyPlusData &state) void CheckGlazingShadingStatusChange(EnergyPlusData &state) { + auto &s_surf = state.dataSurface; if (state.dataGlobal->BeginSimFlag) { if (state.dataWindowManager->inExtWindowModel->isExternalLibraryModel() && state.dataWindowManager->winOpticalModel->isSimplifiedModel()) { state.dataHeatBal->EnclRadAlwaysReCalc = true; @@ -10219,8 +9975,8 @@ void CheckGlazingShadingStatusChange(EnergyPlusData &state) for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - auto &surf = state.dataSurface->Surface(SurfNum); - if (state.dataConstruction->Construct(surf.Construction).TCFlag == 1 || + auto &surf = s_surf->Surface(SurfNum); + if (state.dataConstruction->Construct(surf.Construction).isTCWindow || state.dataConstruction->Construct(surf.Construction).WindowTypeEQL) { state.dataHeatBal->EnclRadAlwaysReCalc = true; break; @@ -10258,10 +10014,10 @@ void CheckGlazingShadingStatusChange(EnergyPlusData &state) if (!state.dataGlobal->AndShadingControlInModel) return; for (int enclosureNum = 1; enclosureNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclosureNum) { for (int const SurfNum : state.dataViewFactor->EnclRadInfo(enclosureNum).SurfacePtr) { - auto &surf = state.dataSurface->Surface(SurfNum); - bool surfShadingStatusChange = state.dataSurface->SurfWinExtIntShadePrevTS(SurfNum) != state.dataSurface->SurfWinShadingFlag(SurfNum) || - surf.activeShadedConstruction != surf.activeShadedConstructionPrev || - state.dataSurface->SurfWinMovableSlats(SurfNum); + auto &surf = s_surf->Surface(SurfNum); + auto &surfShade = s_surf->surfShades(SurfNum); + bool surfShadingStatusChange = s_surf->SurfWinExtIntShadePrevTS(SurfNum) != s_surf->SurfWinShadingFlag(SurfNum) || + surf.activeShadedConstruction != surf.activeShadedConstructionPrev || surfShade.blind.movableSlats; if (surfShadingStatusChange) { state.dataViewFactor->EnclSolInfo(enclosureNum).radReCalc = true; state.dataViewFactor->EnclRadInfo(enclosureNum).radReCalc = true; @@ -10319,21 +10075,21 @@ DataSurfaces::WinShadingType findValueInEnumeration(Real64 controlValue) int selectActiveWindowShadingControlIndex(EnergyPlusData &state, int curSurface) { + auto &s_surf = state.dataSurface; // For a given surface, determine based on the schedules which index to the window shading control list vector // should be active - int selected = 0; // presume it is the first shading control - even if it is not active it needs to be some - // shading control which is then turned off in the WindowShadingManager - if (state.dataSurface->Surface(curSurface).windowShadingControlList.size() > 1) { - for (std::size_t listIndex = 0; listIndex < state.dataSurface->Surface(curSurface).windowShadingControlList.size(); ++listIndex) { - int wsc = state.dataSurface->Surface(curSurface).windowShadingControlList[listIndex]; + // presume it is the first shading control - even if it is not active it needs to be some + // shading control which is then turned off in the WindowShadingManager + if (s_surf->Surface(curSurface).windowShadingControlList.size() > 1) { + for (std::size_t listIndex = 0; listIndex < s_surf->Surface(curSurface).windowShadingControlList.size(); ++listIndex) { + int wsc = s_surf->Surface(curSurface).windowShadingControlList[listIndex]; // pick the first WindowShadingControl that has a non-zero schedule value - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->WindowShadingControl(wsc).Schedule) > 0.0) { - selected = listIndex; - break; + if (ScheduleManager::GetCurrentScheduleValue(state, s_surf->WindowShadingControl(wsc).Schedule) > 0.0) { + return listIndex; } } } - return (selected); + return 0; } void WindowGapAirflowControl(EnergyPlusData &state) @@ -10355,6 +10111,7 @@ void WindowGapAirflowControl(EnergyPlusData &state) // Using/Aliasing using ScheduleManager::GetCurrentScheduleValue; + auto &s_surf = state.dataSurface; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); @@ -10362,26 +10119,26 @@ void WindowGapAirflowControl(EnergyPlusData &state) int const lastSurfWin = thisSpace.WindowSurfaceLast; for (int ISurf = firstSurfWin; ISurf <= lastSurfWin; ++ISurf) { - state.dataSurface->SurfWinAirflowThisTS(ISurf) = 0.0; - if (state.dataSurface->SurfWinMaxAirflow(ISurf) == 0.0) continue; - if (state.dataSurface->Surface(ISurf).ExtBoundCond != ExternalEnvironment) continue; - switch (state.dataSurface->SurfWinAirflowControlType(ISurf)) { + s_surf->SurfWinAirflowThisTS(ISurf) = 0.0; + if (s_surf->SurfWinMaxAirflow(ISurf) == 0.0) continue; + if (s_surf->Surface(ISurf).ExtBoundCond != ExternalEnvironment) continue; + switch (s_surf->SurfWinAirflowControlType(ISurf)) { case WindowAirFlowControlType::MaxFlow: { - state.dataSurface->SurfWinAirflowThisTS(ISurf) = state.dataSurface->SurfWinMaxAirflow(ISurf); + s_surf->SurfWinAirflowThisTS(ISurf) = s_surf->SurfWinMaxAirflow(ISurf); } break; case WindowAirFlowControlType::AlwaysOff: { - state.dataSurface->SurfWinAirflowThisTS(ISurf) = 0.0; + s_surf->SurfWinAirflowThisTS(ISurf) = 0.0; } break; case WindowAirFlowControlType::Schedule: { - if (state.dataSurface->SurfWinAirflowHasSchedule(ISurf)) { - int SchedulePtr = state.dataSurface->SurfWinAirflowSchedulePtr(ISurf); // Schedule pointer - Real64 ScheduleMult = GetCurrentScheduleValue(state, SchedulePtr); // Multiplier value from schedule + if (s_surf->SurfWinAirflowHasSchedule(ISurf)) { + int SchedulePtr = s_surf->SurfWinAirflowSchedulePtr(ISurf); // Schedule pointer + Real64 ScheduleMult = GetCurrentScheduleValue(state, SchedulePtr); // Multiplier value from schedule if (ScheduleMult < 0.0 || ScheduleMult > 1.0) { - ShowFatalError(state, - format("Airflow schedule has a value outside the range 0.0 to 1.0 for window={}", - state.dataSurface->Surface(ISurf).Name)); + ShowFatalError( + state, + format("Airflow schedule has a value outside the range 0.0 to 1.0 for window={}", s_surf->Surface(ISurf).Name)); } - state.dataSurface->SurfWinAirflowThisTS(ISurf) = ScheduleMult * state.dataSurface->SurfWinMaxAirflow(ISurf); + s_surf->SurfWinAirflowThisTS(ISurf) = ScheduleMult * s_surf->SurfWinMaxAirflow(ISurf); } } break; default: @@ -10459,28 +10216,30 @@ void SkyDifSolarShading(EnergyPlusData &state) // INTEGER iHour,iTS // Initialize Surfaces Arrays - bool detailedShading = state.dataSysVars->DetailedSkyDiffuseAlgorithm && state.dataSurface->ShadingTransmittanceVaries && + auto &s_surf = state.dataSurface; + + bool detailedShading = state.dataSysVars->DetailedSkyDiffuseAlgorithm && s_surf->ShadingTransmittanceVaries && state.dataHeatBal->SolarDistribution != DataHeatBalance::Shadowing::Minimal; state.dataSolarShading->SurfSunlitArea = 0.0; - state.dataSolarShading->SurfWithShdgIsoSky.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSolarShading->SurfWoShdgIsoSky.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSolarShading->SurfWithShdgHoriz.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSolarShading->SurfWoShdgHoriz.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataSolarShading->SurfDifShdgRatioIsoSky.allocate(state.dataSurface->TotSurfaces); - state.dataSolarShading->SurfDifShdgRatioHoriz.allocate(state.dataSurface->TotSurfaces); + state.dataSolarShading->SurfWithShdgIsoSky.dimension(s_surf->TotSurfaces, 0.0); + state.dataSolarShading->SurfWoShdgIsoSky.dimension(s_surf->TotSurfaces, 0.0); + state.dataSolarShading->SurfWithShdgHoriz.dimension(s_surf->TotSurfaces, 0.0); + state.dataSolarShading->SurfWoShdgHoriz.dimension(s_surf->TotSurfaces, 0.0); + state.dataSolarShading->SurfDifShdgRatioIsoSky.allocate(s_surf->TotSurfaces); + state.dataSolarShading->SurfDifShdgRatioHoriz.allocate(s_surf->TotSurfaces); // initialized as no shading state.dataSolarShading->SurfDifShdgRatioIsoSky = 1.0; state.dataSolarShading->SurfDifShdgRatioHoriz = 1.0; if (detailedShading) { - state.dataSolarShading->SurfCurDifShdgRatioIsoSky.dimension(state.dataSurface->TotSurfaces, 1.0); - state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS.allocate(state.dataGlobal->NumOfTimeStepInHour, 24, state.dataSurface->TotSurfaces); + state.dataSolarShading->SurfCurDifShdgRatioIsoSky.dimension(s_surf->TotSurfaces, 1.0); + state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS.allocate(state.dataGlobal->NumOfTimeStepInHour, 24, s_surf->TotSurfaces); state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS = 1.0; - state.dataSolarShading->SurfDifShdgRatioHorizHRTS.allocate(state.dataGlobal->NumOfTimeStepInHour, 24, state.dataSurface->TotSurfaces); + state.dataSolarShading->SurfDifShdgRatioHorizHRTS.allocate(state.dataGlobal->NumOfTimeStepInHour, 24, s_surf->TotSurfaces); state.dataSolarShading->SurfDifShdgRatioHorizHRTS = 1.0; } - for (int SurfNum : state.dataSurface->AllExtSolarSurfaceList) { - auto &surf = state.dataSurface->Surface(SurfNum); + for (int SurfNum : s_surf->AllExtSolarSurfaceList) { + auto &surf = s_surf->Surface(SurfNum); // CurrentModuleObject='Surfaces' if (detailedShading) { @@ -10530,8 +10289,8 @@ void SkyDifSolarShading(EnergyPlusData &state) state.dataSolarShading->SUNCOS(1) = state.dataSolarShading->cos_Phi[IPhi] * state.dataSolarShading->cos_Theta[ITheta]; state.dataSolarShading->SUNCOS(2) = state.dataSolarShading->cos_Phi[IPhi] * state.dataSolarShading->sin_Theta[ITheta]; - for (int SurfNum : state.dataSurface->AllExtSolAndShadingSurfaceList) { - auto &surf = state.dataSurface->Surface(SurfNum); + for (int SurfNum : s_surf->AllExtSolAndShadingSurfaceList) { + auto &surf = s_surf->Surface(SurfNum); // Cosine of angle of incidence on surface of solar radiation from patch state.dataSolarShading->SurfSunCosTheta(SurfNum) = state.dataSolarShading->SUNCOS.x * surf.OutNormVec.x + @@ -10541,8 +10300,8 @@ void SkyDifSolarShading(EnergyPlusData &state) SHADOW(state, 24, 0); - for (int SurfNum : state.dataSurface->AllExtSolAndShadingSurfaceList) { - auto &surf = state.dataSurface->Surface(SurfNum); + for (int SurfNum : s_surf->AllExtSolAndShadingSurfaceList) { + auto &surf = s_surf->Surface(SurfNum); if (state.dataSolarShading->SurfSunCosTheta(SurfNum) < 0.0) continue; @@ -10566,7 +10325,7 @@ void SkyDifSolarShading(EnergyPlusData &state) } // End of Theta loop } // End of Phi loop - for (int SurfNum : state.dataSurface->AllExtSolAndShadingSurfaceList) { + for (int SurfNum : s_surf->AllExtSolAndShadingSurfaceList) { if (std::abs(state.dataSolarShading->SurfWoShdgIsoSky(SurfNum)) > Eps) { state.dataSolarShading->SurfDifShdgRatioIsoSky(SurfNum) = @@ -10592,9 +10351,9 @@ void SkyDifSolarShading(EnergyPlusData &state) // surfaces are assumed to be opaque to IR so they totally "shade" IR from // sky or ground. - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto &surface = state.dataSurface->Surface(SurfNum); - if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm || !state.dataSurface->ShadingTransmittanceVaries || + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + auto &surface = s_surf->Surface(SurfNum); + if (!state.dataSysVars->DetailedSkyDiffuseAlgorithm || !s_surf->ShadingTransmittanceVaries || state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { surface.ViewFactorSkyIR *= state.dataSolarShading->SurfDifShdgRatioIsoSky(SurfNum); } else { @@ -10612,9 +10371,9 @@ void SkyDifSolarShading(EnergyPlusData &state) // DEALLOCATE(WithShdgHoriz) // DEALLOCATE(WoShdgHoriz) - if (state.dataSysVars->DetailedSkyDiffuseAlgorithm && state.dataSurface->ShadingTransmittanceVaries && + if (state.dataSysVars->DetailedSkyDiffuseAlgorithm && s_surf->ShadingTransmittanceVaries && state.dataHeatBal->SolarDistribution != DataHeatBalance::Shadowing::Minimal) { - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS({1, state.dataGlobal->NumOfTimeStepInHour}, {1, 24}, SurfNum) = state.dataSolarShading->SurfDifShdgRatioIsoSky(SurfNum); state.dataSolarShading->SurfDifShdgRatioHorizHRTS({1, state.dataGlobal->NumOfTimeStepInHour}, {1, 24}, SurfNum) = @@ -10660,6 +10419,8 @@ void CalcWindowProfileAngles(EnergyPlusData &state) Real64 dot2; Real64 dot3; + auto &s_surf = state.dataSurface; + ElevSun = Constant::PiOvr2 - std::acos(SolCosVec.z); AzimSun = std::atan2(SolCosVec.x, SolCosVec.y); @@ -10672,11 +10433,11 @@ void CalcWindowProfileAngles(EnergyPlusData &state) int const firstSurfWin = thisSpace.WindowSurfaceFirst; int const lastSurfWin = thisSpace.WindowSurfaceLast; for (int SurfNum = firstSurfWin; SurfNum <= lastSurfWin; ++SurfNum) { - auto &surf = state.dataSurface->Surface(SurfNum); + auto &surf = s_surf->Surface(SurfNum); if (surf.ExtBoundCond != ExternalEnvironment && surf.ExtBoundCond != OtherSideCondModeledExt) continue; - state.dataSurface->SurfWinProfileAngHor(SurfNum) = 0.0; - state.dataSurface->SurfWinProfileAngVert(SurfNum) = 0.0; + s_surf->SurfWinProfileAngHor(SurfNum) = 0.0; + s_surf->SurfWinProfileAngVert(SurfNum) = 0.0; if (state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum) <= 0.0) continue; ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRadians; @@ -10711,10 +10472,10 @@ void CalcWindowProfileAngles(EnergyPlusData &state) // Constrain to 0 to pi if (ProfileAngVert > Constant::Pi) ProfileAngVert = Constant::TwoPi - ProfileAngVert; - state.dataSurface->SurfWinProfileAngHor(SurfNum) = ProfileAngHor / Constant::DegToRadians; - state.dataSurface->SurfWinProfileAngVert(SurfNum) = ProfileAngVert / Constant::DegToRadians; - state.dataSurface->SurfWinTanProfileAngHor(SurfNum) = std::abs(std::tan(ProfileAngHor)); - state.dataSurface->SurfWinTanProfileAngVert(SurfNum) = std::abs(std::tan(ProfileAngVert)); + s_surf->SurfWinProfileAngHor(SurfNum) = ProfileAngHor / Constant::DegToRadians; + s_surf->SurfWinProfileAngVert(SurfNum) = ProfileAngVert / Constant::DegToRadians; + s_surf->SurfWinTanProfileAngHor(SurfNum) = std::abs(std::tan(ProfileAngHor)); + s_surf->SurfWinTanProfileAngVert(SurfNum) = std::abs(std::tan(ProfileAngVert)); } } } @@ -10801,23 +10562,25 @@ void CalcFrameDividerShadow(EnergyPlusData &state, Real64 FracShFDin; // Fraction of glazing that illuminates frame and divider // inside projections with beam radiation - Vector3 WinNorm(3); // Window outward normal unit vector + Vector3 WinNorm(3); // Window outward normal unit vector // Why the (3)? Real64 ThWin; // Azimuth angle of WinNorm - Vector3 SunPrime(3); // Projection of sun vector onto plane (perpendicular to + Vector3 SunPrime(3); // Projection of sun vector onto plane (perpendicular to // Why the (3)? // window plane) determined by WinNorm and vector along // baseline of window - Vector3 WinNormCrossBase(3); // Cross product of WinNorm and vector along window baseline + Vector3 WinNormCrossBase(3); // Cross product of WinNorm and vector along window baseline // Why the (3)? + + auto &s_surf = state.dataSurface; - if (state.dataSurface->FrameDivider(FrDivNum).FrameProjectionOut == 0.0 && state.dataSurface->FrameDivider(FrDivNum).FrameProjectionIn == 0.0 && - state.dataSurface->FrameDivider(FrDivNum).DividerProjectionOut == 0.0 && state.dataSurface->FrameDivider(FrDivNum).DividerProjectionIn == 0.0) + if (s_surf->FrameDivider(FrDivNum).FrameProjectionOut == 0.0 && s_surf->FrameDivider(FrDivNum).FrameProjectionIn == 0.0 && + s_surf->FrameDivider(FrDivNum).DividerProjectionOut == 0.0 && s_surf->FrameDivider(FrDivNum).DividerProjectionIn == 0.0) return; - FrProjOut = state.dataSurface->FrameDivider(FrDivNum).FrameProjectionOut; - FrProjIn = state.dataSurface->FrameDivider(FrDivNum).FrameProjectionIn; - DivProjOut = state.dataSurface->FrameDivider(FrDivNum).DividerProjectionOut; - DivProjIn = state.dataSurface->FrameDivider(FrDivNum).DividerProjectionIn; + FrProjOut = s_surf->FrameDivider(FrDivNum).FrameProjectionOut; + FrProjIn = s_surf->FrameDivider(FrDivNum).FrameProjectionIn; + DivProjOut = s_surf->FrameDivider(FrDivNum).DividerProjectionOut; + DivProjIn = s_surf->FrameDivider(FrDivNum).DividerProjectionIn; - auto &surf = state.dataSurface->Surface(SurfNum); + auto &surf = s_surf->Surface(SurfNum); GlArea = surf.Area; ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRadians; ElevSun = Constant::PiOvr2 - std::acos(state.dataSolarShading->SUNCOS(3)); @@ -10841,10 +10604,10 @@ void CalcFrameDividerShadow(EnergyPlusData &state, TanProfileAngHor = std::abs(std::tan(ProfileAngHor)); TanProfileAngVert = std::abs(std::tan(ProfileAngVert)); - NHorDiv = state.dataSurface->FrameDivider(FrDivNum).HorDividers; - NVertDiv = state.dataSurface->FrameDivider(FrDivNum).VertDividers; - FrWidth = state.dataSurface->FrameDivider(FrDivNum).FrameWidth; - DivWidth = state.dataSurface->FrameDivider(FrDivNum).DividerWidth; + NHorDiv = s_surf->FrameDivider(FrDivNum).HorDividers; + NVertDiv = s_surf->FrameDivider(FrDivNum).VertDividers; + FrWidth = s_surf->FrameDivider(FrDivNum).FrameWidth; + DivWidth = s_surf->FrameDivider(FrDivNum).DividerWidth; Arealite = (surf.Height / (NHorDiv + 1.0) - DivWidth / 2.0) * (surf.Width / (NVertDiv + 1.0) - DivWidth / 2.0); if (DivProjOut > 0.0 || DivProjIn > 0.0) { @@ -10906,14 +10669,14 @@ void CalcFrameDividerShadow(EnergyPlusData &state, } AshFDtotOut = AshVDout + AshHDout + AshVFout + AshHFout - (AshDDover + AshFFover + AshFVDover + AshFHDover); - AshFDtotIn = (AshVDin + AshHDin) * state.dataSurface->FrameDivider(FrDivNum).DividerSolAbsorp + - (AshVFin + AshHFin) * state.dataSurface->FrameDivider(FrDivNum).FrameSolAbsorp; + AshFDtotIn = + (AshVDin + AshHDin) * s_surf->FrameDivider(FrDivNum).DividerSolAbsorp + (AshVFin + AshHFin) * s_surf->FrameDivider(FrDivNum).FrameSolAbsorp; // Divide by the glazed area of the window FracShFDOut = AshFDtotOut / GlArea; FracShFDin = AshFDtotIn / GlArea; - state.dataSurface->SurfaceWindow(SurfNum).OutProjSLFracMult[HourNum] = 1.0 - FracShFDOut; - state.dataSurface->SurfaceWindow(SurfNum).InOutProjSLFracMult[HourNum] = 1.0 - (FracShFDin + FracShFDOut); + s_surf->SurfaceWindow(SurfNum).OutProjSLFracMult[HourNum] = 1.0 - FracShFDOut; + s_surf->SurfaceWindow(SurfNum).InOutProjSLFracMult[HourNum] = 1.0 - (FracShFDin + FracShFDOut); } void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) @@ -11054,6 +10817,8 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) Real64 tmp_SunlitFracWithoutReveal; // Temporary variable + auto &s_surf = state.dataSurface; + for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); @@ -11062,33 +10827,31 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) for (int SurfNum = firstSurfWin; SurfNum <= lastSurfWin; ++SurfNum) { // Added TH for initialization. CR 7596 inside reveal causing high cooling loads // for outside reveals - state.dataSurface->SurfWinBmSolAbsdOutsReveal(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolRefldOutsRevealReport(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolRefldOutsRevealRepEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) = 0.0; - state.dataSurface->SurfWinOutsRevealDiffOntoFrame(SurfNum) = 0.0; + s_surf->SurfWinBmSolAbsdOutsReveal(SurfNum) = 0.0; + s_surf->SurfWinBmSolRefldOutsRevealReport(SurfNum) = 0.0; + s_surf->SurfWinBmSolRefldOutsRevealRepEnergy(SurfNum) = 0.0; + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) = 0.0; + s_surf->SurfWinOutsRevealDiffOntoFrame(SurfNum) = 0.0; // for inside reveals - state.dataSurface->SurfWinBmSolAbsdInsReveal(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolAbsdInsRevealReport(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolRefldInsReveal(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolRefldInsRevealReport(SurfNum) = 0.0; - state.dataSurface->SurfWinBmSolRefldInsRevealRepEnergy(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffOntoGlazing(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffOntoGlazingReport(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffOntoFrame(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffOntoFrameReport(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffIntoZone(SurfNum) = 0.0; - state.dataSurface->SurfWinInsRevealDiffIntoZoneReport(SurfNum) = 0.0; - - auto &surf = state.dataSurface->Surface(SurfNum); + s_surf->SurfWinBmSolAbsdInsReveal(SurfNum) = 0.0; + s_surf->SurfWinBmSolAbsdInsRevealReport(SurfNum) = 0.0; + s_surf->SurfWinBmSolRefldInsReveal(SurfNum) = 0.0; + s_surf->SurfWinBmSolRefldInsRevealReport(SurfNum) = 0.0; + s_surf->SurfWinBmSolRefldInsRevealRepEnergy(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffOntoGlazing(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffOntoGlazingReport(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffOntoFrame(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffOntoFrameReport(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffIntoZone(SurfNum) = 0.0; + s_surf->SurfWinInsRevealDiffIntoZoneReport(SurfNum) = 0.0; + + auto &surf = s_surf->Surface(SurfNum); if ((surf.ExtBoundCond != ExternalEnvironment && surf.ExtBoundCond != OtherSideCondModeledExt)) continue; - if (surf.Reveal == 0.0 && state.dataSurface->SurfWinInsideReveal(SurfNum) == 0.0 && - state.dataSurface->SurfWinInsideSillDepth(SurfNum) == 0.0) - continue; + if (surf.Reveal == 0.0 && s_surf->SurfWinInsideReveal(SurfNum) == 0.0 && s_surf->SurfWinInsideSillDepth(SurfNum) == 0.0) continue; if (surf.Sides != 4) continue; - if (state.dataSurface->SurfWinInsideSillDepth(SurfNum) < state.dataSurface->SurfWinInsideReveal(SurfNum)) continue; + if (s_surf->SurfWinInsideSillDepth(SurfNum) < s_surf->SurfWinInsideReveal(SurfNum)) continue; - ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); + ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); if ((ShadeFlag == WinShadingType::ExtShade) || (ShadeFlag == WinShadingType::ExtBlind)) continue; if (state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum) <= 0.0) continue; @@ -11107,27 +10870,27 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) // Note: CosBetaTop = -CosBetaBottom, CosBetaRight = -CosBetaLeft OutsReveal = surf.Reveal; - InsReveal = state.dataSurface->SurfWinInsideReveal(SurfNum); + InsReveal = s_surf->SurfWinInsideReveal(SurfNum); InsideRevealSolAbs = 0.0; - GlazingThickness = state.dataSurface->SurfWinTotGlazingThickness(SurfNum); + GlazingThickness = s_surf->SurfWinTotGlazingThickness(SurfNum); H = surf.Height; W = surf.Width; d1 = OutsReveal + 0.5 * GlazingThickness; - ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); - ConstrNumSh = state.dataSurface->SurfWinActiveShadedConstruction(SurfNum); + ConstrNum = s_surf->SurfActiveConstruction(SurfNum); + ConstrNumSh = s_surf->SurfWinActiveShadedConstruction(SurfNum); auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); SolTransGlass = POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), thisConstruct.TransSolBeamCoef); - TanProfileAngVert = state.dataSurface->SurfWinTanProfileAngVert(SurfNum); - TanProfileAngHor = state.dataSurface->SurfWinTanProfileAngHor(SurfNum); + TanProfileAngVert = s_surf->SurfWinTanProfileAngVert(SurfNum); + TanProfileAngHor = s_surf->SurfWinTanProfileAngHor(SurfNum); FrameDivNum = surf.FrameDivider; FrameWidth = 0.0; if (FrameDivNum != 0) { - FrameWidth = state.dataSurface->FrameDivider(FrameDivNum).FrameWidth; + FrameWidth = s_surf->FrameDivider(FrameDivNum).FrameWidth; if (FrameWidth > 0.0) { - P1 = state.dataSurface->FrameDivider(FrameDivNum).FrameProjectionOut + 0.5 * GlazingThickness; - P2 = state.dataSurface->FrameDivider(FrameDivNum).FrameProjectionIn + 0.5 * GlazingThickness; + P1 = s_surf->FrameDivider(FrameDivNum).FrameProjectionOut + 0.5 * GlazingThickness; + P2 = s_surf->FrameDivider(FrameDivNum).FrameProjectionIn + 0.5 * GlazingThickness; if (OutsReveal + 0.5 * GlazingThickness <= P1) d1 = P1 + 0.001; } } @@ -11152,19 +10915,19 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) L = surf.Height; d2 = InsReveal + 0.5 * GlazingThickness; d2prime = d1 + d2 - W / TanGamma; - InsideRevealSolAbs = state.dataSurface->SurfWinInsideRevealSolAbs(SurfNum); + InsideRevealSolAbs = s_surf->SurfWinInsideRevealSolAbs(SurfNum); } else { // Horizontal reveal - InsSillDepth = state.dataSurface->SurfWinInsideSillDepth(SurfNum); + InsSillDepth = s_surf->SurfWinInsideSillDepth(SurfNum); TanAlpha = TanProfileAngVert; TanGamma = TanProfileAngHor; CosBeta = std::abs(CosBetaBottom); L = surf.Width; if (CosBetaBottom > 0.0) { // Bottom reveal surfaces may be illuminated d2 = InsSillDepth + 0.5 * GlazingThickness; - InsideRevealSolAbs = state.dataSurface->SurfWinInsideSillSolAbs(SurfNum); + InsideRevealSolAbs = s_surf->SurfWinInsideSillSolAbs(SurfNum); } else { // Top reveal surfaces may be illuminated d2 = InsReveal + 0.5 * GlazingThickness; - InsideRevealSolAbs = state.dataSurface->SurfWinInsideRevealSolAbs(SurfNum); + InsideRevealSolAbs = s_surf->SurfWinInsideRevealSolAbs(SurfNum); } d2prime = d1 + d2 - H / TanGamma; } @@ -11316,23 +11079,22 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) // Quantities related to outside reveal if (A1ill > Constant::OneMillionth) { - state.dataSurface->SurfWinBmSolAbsdOutsReveal(SurfNum) += - A1ill * state.dataSurface->SurfWinOutsideRevealSolAbs(SurfNum) * CosBeta * tmp_SunlitFracWithoutReveal; + s_surf->SurfWinBmSolAbsdOutsReveal(SurfNum) += + A1ill * s_surf->SurfWinOutsideRevealSolAbs(SurfNum) * CosBeta * tmp_SunlitFracWithoutReveal; - BmSolRefldOutsReveal = - A1ill * (1.0 - state.dataSurface->SurfWinOutsideRevealSolAbs(SurfNum)) * CosBeta * tmp_SunlitFracWithoutReveal; + BmSolRefldOutsReveal = A1ill * (1.0 - s_surf->SurfWinOutsideRevealSolAbs(SurfNum)) * CosBeta * tmp_SunlitFracWithoutReveal; - state.dataSurface->SurfWinBmSolRefldOutsRevealReport(SurfNum) += state.dataEnvrn->BeamSolarRad * BmSolRefldOutsReveal; - state.dataSurface->SurfWinBmSolRefldOutsRevealRepEnergy(SurfNum) = - state.dataSurface->SurfWinBmSolRefldOutsRevealReport(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinBmSolRefldOutsRevealReport(SurfNum) += state.dataEnvrn->BeamSolarRad * BmSolRefldOutsReveal; + s_surf->SurfWinBmSolRefldOutsRevealRepEnergy(SurfNum) = + s_surf->SurfWinBmSolRefldOutsRevealReport(SurfNum) * state.dataGlobal->TimeStepZoneSec; // Reflected solar from outside horizontal and vertical reveal incident on glazing - state.dataSurface->SurfWinOutsRevealDiffOntoGlazing(SurfNum) += FracToGlassOuts * BmSolRefldOutsReveal / surf.Area; + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) += FracToGlassOuts * BmSolRefldOutsReveal / surf.Area; if (FrameWidth > 0.0) { // Reflected solar from outside horizontal and vertical reveal incident on frame - state.dataSurface->SurfWinOutsRevealDiffOntoFrame(SurfNum) += - (0.5 - FracToGlassOuts) * BmSolRefldOutsReveal / state.dataSurface->SurfWinFrameArea(SurfNum); + s_surf->SurfWinOutsRevealDiffOntoFrame(SurfNum) += + (0.5 - FracToGlassOuts) * BmSolRefldOutsReveal / s_surf->SurfWinFrameArea(SurfNum); } } // End of check if A1ill > 0.0 (actually 10^-6) @@ -11350,56 +11112,56 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) SolTransGlassSh = POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), thisConstructSh.TransSolBeamCoef); - SolTransGlass = Window::InterpSw(state.dataSurface->SurfWinSwitchingFactor(SurfNum), SolTransGlass, SolTransGlassSh); + SolTransGlass = Window::InterpSw(s_surf->SurfWinSwitchingFactor(SurfNum), SolTransGlass, SolTransGlassSh); DiffReflGlassSh = thisConstructSh.ReflectSolDiffBack; - DiffReflGlass = Window::InterpSw(state.dataSurface->SurfWinSwitchingFactor(SurfNum), DiffReflGlass, DiffReflGlassSh); + DiffReflGlass = Window::InterpSw(s_surf->SurfWinSwitchingFactor(SurfNum), DiffReflGlass, DiffReflGlassSh); } // Calc beam solar sbsorbed (m2) - state.dataSurface->SurfWinBmSolAbsdInsReveal(SurfNum) += + s_surf->SurfWinBmSolAbsdInsReveal(SurfNum) += A2ill * SolTransGlass * InsideRevealSolAbs * CosBeta * tmp_SunlitFracWithoutReveal; // Added TH 5/26/2009 for reporting purpose - Beam solar absorbed by the inside reveal // (W) - state.dataSurface->SurfWinBmSolAbsdInsRevealReport(SurfNum) += + s_surf->SurfWinBmSolAbsdInsRevealReport(SurfNum) += state.dataEnvrn->BeamSolarRad * A2ill * SolTransGlass * InsideRevealSolAbs * CosBeta * tmp_SunlitFracWithoutReveal; // in m2 = Area * solar transmitted fraction * inside reveal reflection fraction BmSolRefldInsReveal = A2ill * SolTransGlass * (1.0 - InsideRevealSolAbs) * CosBeta * tmp_SunlitFracWithoutReveal; - state.dataSurface->SurfWinBmSolRefldInsReveal(SurfNum) += BmSolRefldInsReveal; + s_surf->SurfWinBmSolRefldInsReveal(SurfNum) += BmSolRefldInsReveal; - state.dataSurface->SurfWinBmSolRefldInsRevealReport(SurfNum) += + s_surf->SurfWinBmSolRefldInsRevealReport(SurfNum) += state.dataEnvrn->BeamSolarRad * BmSolRefldInsReveal; // W, BeamSolarRad in W/m2 - state.dataSurface->SurfWinBmSolRefldInsRevealRepEnergy(SurfNum) = - state.dataSurface->SurfWinBmSolRefldInsRevealReport(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinBmSolRefldInsRevealRepEnergy(SurfNum) = + s_surf->SurfWinBmSolRefldInsRevealReport(SurfNum) * state.dataGlobal->TimeStepZoneSec; // Reflected solar from inside horizontal and vertical reveal incident on glazing - state.dataSurface->SurfWinInsRevealDiffOntoGlazing(SurfNum) += FracToGlassIns * BmSolRefldInsReveal / surf.Area; + s_surf->SurfWinInsRevealDiffOntoGlazing(SurfNum) += FracToGlassIns * BmSolRefldInsReveal / surf.Area; // Added TH 5/26/2009 for reporting purpose - diffuse on window glass from inside // reveal (W) - state.dataSurface->SurfWinInsRevealDiffOntoGlazingReport(SurfNum) += + s_surf->SurfWinInsRevealDiffOntoGlazingReport(SurfNum) += state.dataEnvrn->BeamSolarRad * FracToGlassIns * BmSolRefldInsReveal; // Reflected solar from inside horizontal and vertical reveal incident on frame if (FrameWidth > 0.0) { - state.dataSurface->SurfWinInsRevealDiffOntoFrame(SurfNum) += - (0.5 - FracToGlassIns) * BmSolRefldInsReveal / state.dataSurface->SurfWinFrameArea(SurfNum); + s_surf->SurfWinInsRevealDiffOntoFrame(SurfNum) += + (0.5 - FracToGlassIns) * BmSolRefldInsReveal / s_surf->SurfWinFrameArea(SurfNum); // Added TH 5/26/2009 for reporting purpose - diffuse on window frame from inside // reveal (W) - state.dataSurface->SurfWinInsRevealDiffOntoFrameReport(SurfNum) += + s_surf->SurfWinInsRevealDiffOntoFrameReport(SurfNum) += state.dataEnvrn->BeamSolarRad * (0.5 - FracToGlassIns) * BmSolRefldInsReveal; } // Reflected solar from inside reveal going directly into zone and reflected from // glass. Assumes half of solar reflected from inside reveal goes as diffuse radiation // into the zone and half goes as diffuse radiation towards window. - state.dataSurface->SurfWinInsRevealDiffIntoZone(SurfNum) += BmSolRefldInsReveal * (0.5 + DiffReflGlass * FracToGlassIns); + s_surf->SurfWinInsRevealDiffIntoZone(SurfNum) += BmSolRefldInsReveal * (0.5 + DiffReflGlass * FracToGlassIns); // Added TH 5/26/2009 for reporting purpose - diffuse into zone from inside reveal (W) - state.dataSurface->SurfWinInsRevealDiffIntoZoneReport(SurfNum) += + s_surf->SurfWinInsRevealDiffIntoZoneReport(SurfNum) += state.dataEnvrn->BeamSolarRad * BmSolRefldInsReveal * (0.5 + DiffReflGlass * FracToGlassIns); } // End of check if A2ill > 0.0 (actually 10^-6) @@ -11456,12 +11218,12 @@ void ReportSurfaceShading(EnergyPlusData &state) int SurfNum; // Loop Counter int RepCol; // the column of the predefined report - for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto &surf = state.dataSurface->Surface(SurfNum); + auto &s_surf = state.dataSurface; + for (SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + auto &surf = s_surf->Surface(SurfNum); - state.dataSurface->SurfSunlitFrac(SurfNum) = - state.dataHeatBal->SurfSunlitFrac(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum); - state.dataSurface->SurfSunlitArea(SurfNum) = + s_surf->SurfSunlitFrac(SurfNum) = state.dataHeatBal->SurfSunlitFrac(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum); + s_surf->SurfSunlitArea(SurfNum) = state.dataHeatBal->SurfSunlitFrac(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum) * surf.Area; } // added for predefined reporting @@ -11492,10 +11254,10 @@ void ReportSurfaceShading(EnergyPlusData &state) } } if (RepCol != 0) { - for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto &surf = state.dataSurface->Surface(SurfNum); + for (SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + auto &surf = s_surf->Surface(SurfNum); if (surf.Class == SurfaceClass::Window) { - PreDefTableEntry(state, RepCol, surf.Name, state.dataSurface->SurfSunlitFrac(SurfNum)); + PreDefTableEntry(state, RepCol, surf.Name, s_surf->SurfSunlitFrac(SurfNum)); } } } @@ -11525,6 +11287,8 @@ void ReportSurfaceErrors(EnergyPlusData &state) Array1D_bool SurfErrorReported; Array1D_bool SurfErrorReported2; + auto &s_surf = state.dataSurface; + if (state.dataSolarShading->NumTooManyFigures + state.dataSolarShading->NumTooManyVertices + state.dataSolarShading->NumBaseSubSurround > 0) { ShowMessage(state, ""); ShowMessage(state, "===== Recurring Surface Error Summary ====="); @@ -11539,7 +11303,7 @@ void ReportSurfaceErrors(EnergyPlusData &state) ShowMessage(state, ""); } - SurfErrorReported.dimension(state.dataSurface->TotSurfaces, false); + SurfErrorReported.dimension(s_surf->TotSurfaces, false); TotCount = 0; for (Loop1 = 1; Loop1 <= state.dataSolarShading->NumBaseSubSurround; ++Loop1) { Count = 0; @@ -11563,9 +11327,9 @@ void ReportSurfaceErrors(EnergyPlusData &state) state.dataSolarShading->TrackBaseSubSurround(Loop1).MiscIndex == state.dataSolarShading->TrackBaseSubSurround(Loop2).MiscIndex) { ShowContinueError(state, format("Surface \"{}\" {} SubSurface \"{}\"", - state.dataSurface->Surface(state.dataSolarShading->TrackBaseSubSurround(Loop1).SurfIndex1).Name, + s_surf->Surface(state.dataSolarShading->TrackBaseSubSurround(Loop1).SurfIndex1).Name, MSG(state.dataSolarShading->TrackBaseSubSurround(Loop1).MiscIndex), - state.dataSurface->Surface(state.dataSolarShading->TrackBaseSubSurround(Loop2).SurfIndex2).Name)); + s_surf->Surface(state.dataSolarShading->TrackBaseSubSurround(Loop2).SurfIndex2).Name)); } } SurfErrorReported(state.dataSolarShading->TrackBaseSubSurround(Loop1).SurfIndex1) = true; @@ -11576,7 +11340,7 @@ void ReportSurfaceErrors(EnergyPlusData &state) ShowMessage(state, ""); } - SurfErrorReported2.allocate(state.dataSurface->TotSurfaces); + SurfErrorReported2.allocate(s_surf->TotSurfaces); SurfErrorReported = false; TotCount = 0; if (state.dataSolarShading->NumTooManyVertices > 0) { @@ -11600,21 +11364,19 @@ void ReportSurfaceErrors(EnergyPlusData &state) state.dataErrTracking->TotalWarningErrors += Count - 1; ShowMessage(state, ""); ShowWarningError(state, format("Too many vertices [>={}] in a shadow overlap", state.dataSolarShading->MaxHCV)); - ShowContinueError( - state, - format("Overlapping figure={}, Surface Class=[{}]", - state.dataSurface->Surface(state.dataSolarShading->TrackTooManyVertices(Loop1).SurfIndex1).Name, - cSurfaceClass(state.dataSurface->Surface(state.dataSolarShading->TrackTooManyVertices(Loop1).SurfIndex1).Class))); + ShowContinueError(state, + format("Overlapping figure={}, Surface Class=[{}]", + s_surf->Surface(state.dataSolarShading->TrackTooManyVertices(Loop1).SurfIndex1).Name, + cSurfaceClass(s_surf->Surface(state.dataSolarShading->TrackTooManyVertices(Loop1).SurfIndex1).Class))); ShowContinueError(state, format(" This error occurred {} times.", Count)); for (Loop2 = 1; Loop2 <= state.dataSolarShading->NumTooManyVertices; ++Loop2) { if (state.dataSolarShading->TrackTooManyVertices(Loop1).SurfIndex1 == state.dataSolarShading->TrackTooManyVertices(Loop2).SurfIndex1) { if (SurfErrorReported2(state.dataSolarShading->TrackTooManyVertices(Loop2).SurfIndex2)) continue; - ShowContinueError( - state, - format("Figure being Overlapped={}, Surface Class=[{}]", - state.dataSurface->Surface(state.dataSolarShading->TrackTooManyVertices(Loop2).SurfIndex2).Name, - cSurfaceClass(state.dataSurface->Surface(state.dataSolarShading->TrackTooManyVertices(Loop2).SurfIndex2).Class))); + ShowContinueError(state, + format("Figure being Overlapped={}, Surface Class=[{}]", + s_surf->Surface(state.dataSolarShading->TrackTooManyVertices(Loop2).SurfIndex2).Name, + cSurfaceClass(s_surf->Surface(state.dataSolarShading->TrackTooManyVertices(Loop2).SurfIndex2).Class))); SurfErrorReported2(state.dataSolarShading->TrackTooManyVertices(Loop2).SurfIndex2) = true; } } @@ -11650,17 +11412,16 @@ void ReportSurfaceErrors(EnergyPlusData &state) ShowWarningError(state, format("Too many figures [>={}] in a shadow overlap", state.dataSolarShading->MaxHCS)); ShowContinueError(state, format("Overlapping figure={}, Surface Class=[{}]", - state.dataSurface->Surface(state.dataSolarShading->TrackTooManyFigures(Loop1).SurfIndex1).Name, - cSurfaceClass(state.dataSurface->Surface(state.dataSolarShading->TrackTooManyFigures(Loop1).SurfIndex1).Class))); + s_surf->Surface(state.dataSolarShading->TrackTooManyFigures(Loop1).SurfIndex1).Name, + cSurfaceClass(s_surf->Surface(state.dataSolarShading->TrackTooManyFigures(Loop1).SurfIndex1).Class))); ShowContinueError(state, format(" This error occurred {} times.", Count)); for (Loop2 = 1; Loop2 <= state.dataSolarShading->NumTooManyFigures; ++Loop2) { if (state.dataSolarShading->TrackTooManyFigures(Loop1).SurfIndex1 == state.dataSolarShading->TrackTooManyFigures(Loop2).SurfIndex1) { if (SurfErrorReported2(state.dataSolarShading->TrackTooManyFigures(Loop2).SurfIndex2)) continue; - ShowContinueError( - state, - format("Figure being Overlapped={}, Surface Class=[{}]", - state.dataSurface->Surface(state.dataSolarShading->TrackTooManyFigures(Loop2).SurfIndex2).Name, - cSurfaceClass(state.dataSurface->Surface(state.dataSolarShading->TrackTooManyFigures(Loop2).SurfIndex2).Class))); + ShowContinueError(state, + format("Figure being Overlapped={}, Surface Class=[{}]", + s_surf->Surface(state.dataSolarShading->TrackTooManyFigures(Loop2).SurfIndex2).Name, + cSurfaceClass(s_surf->Surface(state.dataSolarShading->TrackTooManyFigures(Loop2).SurfIndex2).Class))); SurfErrorReported2(state.dataSolarShading->TrackTooManyFigures(Loop2).SurfIndex2) = true; } } @@ -11696,6 +11457,8 @@ void ComputeWinShadeAbsorpFactors(EnergyPlusData &state) // REFERENCES: See EnergyPlus engineering documentation // USE STATEMENTS: na + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { @@ -11703,7 +11466,7 @@ void ComputeWinShadeAbsorpFactors(EnergyPlusData &state) int const firstSurfWin = thisSpace.WindowSurfaceFirst; int const lastSurfWin = thisSpace.WindowSurfaceLast; for (int SurfNum = firstSurfWin; SurfNum <= lastSurfWin; ++SurfNum) { - auto &surf = state.dataSurface->Surface(SurfNum); + auto &surf = s_surf->Surface(SurfNum); if (surf.Class == SurfaceClass::Window && surf.HasShadeControl) { int WinShadeCtrlNum = surf.activeWindowShadingControl; // Window shading control number @@ -11711,15 +11474,15 @@ void ComputeWinShadeAbsorpFactors(EnergyPlusData &state) Real64 AbsorpEff = 0.0; // Effective absorptance of isolated shade layer (fraction of // of incident radiation remaining after reflected portion is // removed that is absorbed - if (ANY_SHADE(state.dataSurface->WindowShadingControl(WinShadeCtrlNum).ShadingType)) { + if (ANY_SHADE(s_surf->WindowShadingControl(WinShadeCtrlNum).ShadingType)) { int const ConstrNumSh = surf.activeShadedConstruction; // Window construction number with shade int TotLay = state.dataConstruction->Construct(ConstrNumSh).TotLayers; // Total layers in a construction - if (state.dataSurface->WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingType::IntShade) { + if (s_surf->WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingType::IntShade) { MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay); // Interior shade - } else if (state.dataSurface->WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingType::ExtShade) { + } else if (s_surf->WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingType::ExtShade) { MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1); // Exterior shade - } else if (state.dataSurface->WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingType::BGShade) { + } else if (s_surf->WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingType::BGShade) { if (state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers == 2) { // Double pane with between-glass shade MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(3); @@ -11728,12 +11491,15 @@ void ComputeWinShadeAbsorpFactors(EnergyPlusData &state) MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(5); } } - auto const *thisMaterialSh = dynamic_cast(state.dataMaterial->Material(MatNumSh)); - AbsorpEff = thisMaterialSh->AbsorpSolar / (thisMaterialSh->AbsorpSolar + thisMaterialSh->Trans + 0.0001); + + auto const *matSh = s_mat->materials(MatNumSh); + auto const *matFenSh = dynamic_cast(matSh); + assert(matFenSh != nullptr); + AbsorpEff = matFenSh->AbsorpSolar / (matFenSh->AbsorpSolar + matFenSh->Trans + 0.0001); AbsorpEff = min(max(AbsorpEff, 0.0001), 0.999); // Constrain to avoid problems with following log eval - state.dataSurface->SurfWinShadeAbsFacFace1(SurfNum) = (1.0 - std::exp(0.5 * std::log(1.0 - AbsorpEff))) / AbsorpEff; - state.dataSurface->SurfWinShadeAbsFacFace2(SurfNum) = 1.0 - state.dataSurface->SurfWinShadeAbsFacFace1(SurfNum); + s_surf->SurfWinShadeAbsFacFace1(SurfNum) = (1.0 - std::exp(0.5 * std::log(1.0 - AbsorpEff))) / AbsorpEff; + s_surf->SurfWinShadeAbsFacFace2(SurfNum) = 1.0 - s_surf->SurfWinShadeAbsFacFace1(SurfNum); } } } @@ -11818,6 +11584,8 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) int EQLNum; // equivalent layer fenestration index int Lay; // equivalent layer fenestration layer index + auto &s_surf = state.dataSurface; + // Init accumulators for absorbed diffuse solar for all surfaces for later heat balance calcs state.dataHeatBalSurf->SurfOpaqInitialDifSolInAbs = 0.0; state.dataHeatBal->SurfWinInitialDifSolwinAbs = 0.0; @@ -11839,7 +11607,7 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) // Loop over all diffuse solar transmitting surfaces (i.e., exterior windows and TDDs) in the current zone for (int const DifTransSurfNum : thisEnclosure.SurfacePtr) { // Skip surfaces that are not exterior, except for TDD_Diffusers - auto &difTransSurf = state.dataSurface->Surface(DifTransSurfNum); + auto &difTransSurf = s_surf->Surface(DifTransSurfNum); if ((difTransSurf.ExtBoundCond != ExternalEnvironment) && (difTransSurf.ExtBoundCond != OtherSideCondModeledExt) && (difTransSurf.OriginalClass != SurfaceClass::TDD_Diffuser)) continue; @@ -11859,7 +11627,7 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) // Init transmitted solar debug vars // ViewFactorTotal = 0.0; - WinDifSolarTrans = state.dataSurface->SurfWinDifSolar(DifTransSurfNum); + WinDifSolarTrans = s_surf->SurfWinDifSolar(DifTransSurfNum); // ZoneDifSolarTrans += WinDifSolarTrans; // Init Exterior Window accumulators for debugging @@ -11871,15 +11639,16 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) for (int const HeatTransSurfNum : thisEnclosure.SurfacePtr) { // Skip surfaces that are not heat transfer surfaces // Skip tubular daylighting device domes - if (state.dataSurface->Surface(HeatTransSurfNum).Class == SurfaceClass::TDD_Dome) continue; + auto &surf = s_surf->Surface(HeatTransSurfNum); + + if (surf.Class == SurfaceClass::TDD_Dome) continue; // View factor from current (sending) window DifTransSurfNum to current (receiving) surface // HeatTransSurfNum - int const HTenclosureSurfNum = - state.dataSurface->Surface(HeatTransSurfNum).SolarEnclSurfIndex; // HT surface index for EnclSolInfo.SurfacePtr and F arrays - int const enclosureNum = state.dataSurface->Surface(HeatTransSurfNum).SolarEnclIndex; // index for EnclSolInfo + int const HTenclosureSurfNum = surf.SolarEnclSurfIndex; // HT surface index for EnclSolInfo.SurfacePtr and F arrays + int const enclosureNum = surf.SolarEnclIndex; // index for EnclSolInfo int const DTenclSurfNum = - state.dataSurface->Surface(DifTransSurfNum).SolarEnclSurfIndex; // Window surface index for EnclSolInfo.SurfacePtr and F arrays + s_surf->Surface(DifTransSurfNum).SolarEnclSurfIndex; // Window surface index for EnclSolInfo.SurfacePtr and F arrays ViewFactor = state.dataViewFactor->EnclSolInfo(enclosureNum).F(HTenclosureSurfNum, DTenclSurfNum); // debug ViewFactorTotal @@ -11889,13 +11658,13 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) if (ViewFactor <= 0.0) continue; Real64 const WinDifSolarTrans_Factor(WinDifSolarTrans * ViewFactor); - Real64 const win_SwitchingFactor(state.dataSurface->SurfWinSwitchingFactor(HeatTransSurfNum)); - Real64 const per_HTSurfaceArea(1.0 / state.dataSurface->Surface(HeatTransSurfNum).Area); + Real64 const win_SwitchingFactor(s_surf->SurfWinSwitchingFactor(HeatTransSurfNum)); + Real64 const per_HTSurfaceArea(1.0 / surf.Area); // 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 const ConstrNum = state.dataSurface->SurfActiveConstruction(HeatTransSurfNum); + int const ConstrNum = s_surf->SurfActiveConstruction(HeatTransSurfNum); if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Interior Opaque Surface // Determine the inside (back) diffuse solar absorptance @@ -11931,11 +11700,11 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) // energy For opaque surfaces all incident diffuse is either absorbed or reflected } else { // Exterior or Interior Window - int const ConstrNumSh = state.dataSurface->SurfWinActiveShadedConstruction(HeatTransSurfNum); + int const ConstrNumSh = s_surf->SurfWinActiveShadedConstruction(HeatTransSurfNum); int TotGlassLayers = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; - WinShadingType ShadeFlag = state.dataSurface->SurfWinShadingFlag(HeatTransSurfNum); + WinShadingType ShadeFlag = s_surf->SurfWinShadingFlag(HeatTransSurfNum); - if (state.dataSurface->SurfWinWindowModelType(HeatTransSurfNum) != WindowModel::EQL) { + if (s_surf->SurfWinWindowModelType(HeatTransSurfNum) != WindowModel::EQL) { if (NOT_SHADED(ShadeFlag)) { // No window shading // Init accumulator for transmittance calc below DifSolarAbsW = 0.0; @@ -11982,7 +11751,7 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) // shading // Get the adjacent surface number for this receiving window surface - int AdjSurfNum = state.dataSurface->Surface(HeatTransSurfNum).ExtBoundCond; + int AdjSurfNum = surf.ExtBoundCond; // If the adjacent surface number is > 0, this is an interior window if (AdjSurfNum > 0) { // this is an interior window surface @@ -12008,7 +11777,7 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) // * Construct(AdjConstrNum)%TransDiff // Get the adjacent zone index - int const adjEnclosureNum = state.dataSurface->Surface(AdjSurfNum).SolarEnclIndex; + int const adjEnclosureNum = s_surf->Surface(AdjSurfNum).SolarEnclIndex; // Call routine to distribute diffuse solar transmitted through this interior // window into adjacent zone @@ -12073,26 +11842,18 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) // First calc diffuse solar absorbed by each glass layer in this window with // shade/blind in place - auto const &construct_sh = state.dataConstruction->Construct(ConstrNumSh); - auto const &construct_sh_AbsDiffBack = construct_sh.AbsDiffBack; - auto const &construct_sh_BlAbsDiffBack = construct_sh.BlAbsDiffBack; + auto const &constrSh = state.dataConstruction->Construct(ConstrNumSh); + auto const &surfShade = s_surf->surfShades(HeatTransSurfNum); + Real64 slatInterpFac = surfShade.blind.slatAngInterpFac; - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(HeatTransSurfNum); - Real64 SurfWinSlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(HeatTransSurfNum); - - for (int IGlass = 1; IGlass <= construct_sh.TotGlassLayers; ++IGlass) { + for (int IGlass = 1; IGlass <= constrSh.TotGlassLayers; ++IGlass) { if (ANY_SHADE_SCREEN(ShadeFlag)) { // Calc diffuse solar absorbed in each window glass layer and shade - WinDifSolLayAbsW = WinDifSolarTrans_Factor * construct_sh_AbsDiffBack(IGlass); + WinDifSolLayAbsW = WinDifSolarTrans_Factor * constrSh.AbsDiffBack(IGlass); } else if (ANY_BLIND(ShadeFlag)) { - if (state.dataSurface->SurfWinMovableSlats(HeatTransSurfNum)) { - BlAbsDiffBk = General::Interp( - construct_sh_BlAbsDiffBack(SurfWinSlatsAngIndex, IGlass), - construct_sh_BlAbsDiffBack(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1), IGlass), - SurfWinSlatsAngInterpFac); - } else { - BlAbsDiffBk = construct_sh_BlAbsDiffBack(1, IGlass); - } + auto const &slatDfAbsLo = constrSh.layerSlatBlindDfAbs(IGlass)[surfShade.blind.slatAngIdxLo]; + auto const &slatDfAbsHi = constrSh.layerSlatBlindDfAbs(IGlass)[surfShade.blind.slatAngIdxHi]; + BlAbsDiffBk = Interp(slatDfAbsLo.Sol.Bk.Df.Abs, slatDfAbsHi.Sol.Bk.Df.Abs, slatInterpFac); // Calc diffuse solar absorbed in each window glass layer and shade WinDifSolLayAbsW = WinDifSolarTrans_Factor * BlAbsDiffBk; } @@ -12110,16 +11871,13 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) // Diffuse back solar reflectance, bare glass or shade on InsideDifReflectance = state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack; if ((ShadeFlag == WinShadingType::IntBlind) || (ShadeFlag == WinShadingType::ExtBlind)) { + auto const &constr = state.dataConstruction->Construct(ConstrNum); + auto const &surfShade = state.dataSurface->surfShades(HeatTransSurfNum); + auto const &btarSlatLo = constr.blindTARs[surfShade.blind.slatAngIdxLo]; + auto const &btarSlatHi = constr.blindTARs[surfShade.blind.slatAngIdxHi]; + Real64 slatInterpFac = surfShade.blind.slatAngInterpFac; // Diffuse back solar reflectance, blind present, vs. slat angle - if (state.dataSurface->SurfWinMovableSlats(HeatTransSurfNum)) { - InsideDifReflectance = - General::Interp(state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffBack(SurfWinSlatsAngIndex), - state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffBack( - std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - InsideDifReflectance = state.dataConstruction->Construct(ConstrNum).BlReflectSolDiffBack(1); - } + InsideDifReflectance = Interp(btarSlatLo.Sol.Bk.Df.Ref, btarSlatHi.Sol.Bk.Df.Ref, slatInterpFac); } DifSolarReflW = WinDifSolarTrans_Factor * InsideDifReflectance; @@ -12128,29 +11886,25 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) state.dataHeatBal->EnclSolInitialDifSolReflW(enclosureNum) += DifSolarReflW; // [W] // Now calc diffuse solar absorbed by shade/blind itself - BlNum = state.dataSurface->SurfWinBlindNumber(HeatTransSurfNum); + BlNum = surfShade.blind.matNum; if (ANY_SHADE_SCREEN(ShadeFlag)) { // Calc diffuse solar absorbed by shade or screen [W] - ShBlDifSolarAbsW = WinDifSolarTrans_Factor * construct_sh.AbsDiffBackShade; + ShBlDifSolarAbsW = WinDifSolarTrans_Factor * constrSh.AbsDiffBackShade; } else if (ANY_BLIND(ShadeFlag)) { - // Calc diffuse solar absorbed by blind [W] - if (state.dataSurface->SurfWinMovableSlats(HeatTransSurfNum)) { - AbsDiffBkBl = - General::Interp(construct_sh.AbsDiffBackBlind(SurfWinSlatsAngIndex), - construct_sh.AbsDiffBackBlind(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - AbsDiffBkBl = construct_sh.AbsDiffBackBlind(1); - } + auto const &surfShade = state.dataSurface->surfShades(HeatTransSurfNum); + auto const &btarSlatLo = constrSh.blindTARs[surfShade.blind.slatAngIdxLo]; + auto const &btarSlatHi = constrSh.blindTARs[surfShade.blind.slatAngIdxHi]; + Real64 slatInterpFac = surfShade.blind.slatAngInterpFac; + AbsDiffBkBl = Interp(btarSlatLo.Sol.Bk.Df.Abs, btarSlatHi.Sol.Bk.Df.Abs, slatInterpFac); ShBlDifSolarAbsW = WinDifSolarTrans_Factor * AbsDiffBkBl; } // Correct for divider shadowing if (ANY_EXTERIOR_SHADE_BLIND_SCREEN(ShadeFlag)) { - ShBlDifSolarAbsW *= state.dataSurface->SurfaceWindow(HeatTransSurfNum).glazedFrac; + ShBlDifSolarAbsW *= s_surf->SurfaceWindow(HeatTransSurfNum).glazedFrac; } // Accumulate diffuse solar absorbed by shade or screen [W/m2] for heat balance calcs - state.dataSurface->SurfWinInitialDifSolAbsByShade(HeatTransSurfNum) += ShBlDifSolarAbsW * per_HTSurfaceArea; + s_surf->SurfWinInitialDifSolAbsByShade(HeatTransSurfNum) += ShBlDifSolarAbsW * per_HTSurfaceArea; // Accumulate distributed diffuse solar absorbed [W] by overall window for // transmittance calc below @@ -12217,7 +11971,7 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) // shading // Get the adjacent surface number for this receiving window surface - int const AdjSurfNum = state.dataSurface->Surface(HeatTransSurfNum).ExtBoundCond; + int const AdjSurfNum = s_surf->Surface(HeatTransSurfNum).ExtBoundCond; // If the adjacent surface number is > 0, this is an interior window if (AdjSurfNum > 0) { // this is an interior window surface @@ -12229,7 +11983,7 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) Real64 DifSolarTransW = AbsSolDiffBackEQL(2, state.dataWindowEquivLayer->CFS(EQLNum).NL + 1) * ViewFactor; // int AdjConstrNum = Surface(AdjSurfNum).Construction; // Get the adjacent zone index - int adjEnclosureNum = state.dataSurface->Surface(AdjSurfNum).SolarEnclIndex; + int adjEnclosureNum = s_surf->Surface(AdjSurfNum).SolarEnclIndex; // Call routine to distribute diffuse solar transmitted through this interior window // into adjacent zone CalcInteriorWinTransDifSolInitialDistribution(state, adjEnclosureNum, AdjSurfNum, DifSolarTransW); @@ -12391,6 +12145,8 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // DISTRIBUTE TRANSMITTED DIFFUSE SOLAR THROUGH INTERIOR WINDOW TO INTERIOR HEAT TRANSFER SURFACES //------------------------------------------------------------------------------------------------- + auto &s_surf = state.dataSurface; + // Init debug vars ViewFactorTotal = 0.0; WinDifSolarTrans = IntWinDifSolarTransW; @@ -12399,17 +12155,18 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // Loop over all heat transfer surfaces in the current zone that might receive diffuse solar Real64 InitialZoneDifSolReflW_zone(0.0); for (int const HeatTransSurfNum : thisEnclosure.SurfacePtr) { + + auto &surf = s_surf->Surface(HeatTransSurfNum); + // Skip surfaces that are not heat transfer surfaces - if (!state.dataSurface->Surface(HeatTransSurfNum).HeatTransSurf) continue; + if (!surf.HeatTransSurf) continue; // Skip tubular daylighting device domes - if (state.dataSurface->Surface(HeatTransSurfNum).Class == SurfaceClass::TDD_Dome) continue; + if (surf.Class == SurfaceClass::TDD_Dome) continue; // View factor from current (sending) window IntWinSurfNum to current (receiving) surface HeatTransSurfNum - int HTenclosureSurfNum = - state.dataSurface->Surface(HeatTransSurfNum).SolarEnclSurfIndex; // HT surface index for EnclSolInfo.SurfacePtr and F arrays - int enclosureNum = state.dataSurface->Surface(HeatTransSurfNum).SolarEnclIndex; // index for EnclSolInfo - int IntWinEnclSurfNum = - state.dataSurface->Surface(IntWinSurfNum).SolarEnclSurfIndex; // Window surface index for EnclSolInfo.SurfacePtr and F arrays + int HTenclosureSurfNum = surf.SolarEnclSurfIndex; // HT surface index for EnclSolInfo.SurfacePtr and F arrays + int enclosureNum = surf.SolarEnclIndex; // index for EnclSolInfo + int IntWinEnclSurfNum = s_surf->Surface(IntWinSurfNum).SolarEnclSurfIndex; // Window surface index for EnclSolInfo.SurfacePtr and F arrays ViewFactor = state.dataViewFactor->EnclSolInfo(enclosureNum).F(HTenclosureSurfNum, IntWinEnclSurfNum); // debug ViewFactorTotal @@ -12421,7 +12178,7 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // 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 const ConstrNum = state.dataSurface->SurfActiveConstruction(HeatTransSurfNum); + int const ConstrNum = s_surf->SurfActiveConstruction(HeatTransSurfNum); if (state.dataConstruction->Construct(ConstrNum).TransDiff <= 0.0) { // Interior Opaque Surface // Determine the inside (back) diffuse solar absorptance @@ -12438,7 +12195,7 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // Absorbed diffuse solar [W/m2] = Absorbed diffuse solar [W] // / current surface net area - DifSolarAbs = DifSolarAbsW / state.dataSurface->Surface(HeatTransSurfNum).Area; + DifSolarAbs = DifSolarAbsW / surf.Area; // Accumulate absorbed diffuse solar [W/m2] on this surface for heat balance calcs state.dataHeatBalSurf->SurfOpaqInitialDifSolInAbs(HeatTransSurfNum) += DifSolarAbs; @@ -12462,11 +12219,11 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, } else { // Exterior or Interior Window - int const ConstrNumSh = state.dataSurface->SurfWinActiveShadedConstruction(HeatTransSurfNum); + int const ConstrNumSh = s_surf->SurfWinActiveShadedConstruction(HeatTransSurfNum); auto const &construction = state.dataConstruction->Construct(ConstrNum); TotGlassLayers = construction.TotGlassLayers; - ShadeFlag = state.dataSurface->SurfWinShadingFlag(HeatTransSurfNum); + ShadeFlag = s_surf->SurfWinShadingFlag(HeatTransSurfNum); if (NOT_SHADED(ShadeFlag)) { // No window shading // Init accumulator for transmittance calc below @@ -12486,8 +12243,7 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // Accumulate diffuse solar absorbed from the inside by each window glass layer [W/m2] for // heat balance calcs - state.dataHeatBal->SurfWinInitialDifSolwinAbs(HeatTransSurfNum, IGlass) += - (WinDifSolLayAbsW / state.dataSurface->Surface(HeatTransSurfNum).Area); + state.dataHeatBal->SurfWinInitialDifSolwinAbs(HeatTransSurfNum, IGlass) += (WinDifSolLayAbsW / surf.Area); } // Accumulate Window and Zone total distributed diffuse solar to check for conservation of energy // WinDifSolarDistAbsorbedTotl += DifSolarAbsW; // debug @@ -12522,8 +12278,7 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // ZoneDifSolarDistTransmittedTotl += DifSolarTransW; // debug [W] // Accumulate transmitted diffuse solar for reporting - state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(HeatTransSurfNum) += - (SolarTrans_ViewFactor - DifSolarReflW) / state.dataSurface->Surface(HeatTransSurfNum).Area; + state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(HeatTransSurfNum) += (SolarTrans_ViewFactor - DifSolarReflW) / surf.Area; //----------------------------------------------------------------------------------- // ADD TRANSMITTED DIFFUSE SOLAR THROUGH INTERIOR WINDOW TO ADJACENT ZONE @@ -12536,14 +12291,14 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // NOTE: This calc is here because interior windows are currently assumed to have no shading // Get the adjacent surface number for this receiving window surface - int const AdjSurfNum = state.dataSurface->Surface(HeatTransSurfNum).ExtBoundCond; + int const AdjSurfNum = surf.ExtBoundCond; // If the adjacent surface number is > 0, this is an interior window if (AdjSurfNum > 0) { // this is an interior window surface // Get the adjacent zone/enclosure index // Add transmitted diffuse solar to total reflected distributed diffuse solar for each zone // for subsequent interreflection calcs - state.dataHeatBal->EnclSolInitialDifSolReflW(state.dataSurface->Surface(AdjSurfNum).SolarEnclIndex) += DifSolarTransW; // [W] + state.dataHeatBal->EnclSolInitialDifSolReflW(s_surf->Surface(AdjSurfNum).SolarEnclIndex) += DifSolarTransW; // [W] } } else if (ShadeFlag == WinShadingType::SwitchableGlazing) { // Switchable glazing @@ -12553,7 +12308,7 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, for (IGlass = 1; IGlass <= TotGlassLayers; ++IGlass) { // Calc diffuse solar absorbed in each window glass layer - WinDifSolLayAbsW = SolarTrans_ViewFactor * InterpSw(state.dataSurface->SurfWinSwitchingFactor(HeatTransSurfNum), + WinDifSolLayAbsW = SolarTrans_ViewFactor * InterpSw(s_surf->SurfWinSwitchingFactor(HeatTransSurfNum), construction.AbsDiffBack(IGlass), constructionSh.AbsDiffBack(IGlass)); @@ -12563,17 +12318,16 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // Accumulate diffuse solar absorbed from the inside by each window glass layer [W/m2] for // heat balance calcs - state.dataHeatBal->SurfWinInitialDifSolwinAbs(HeatTransSurfNum, IGlass) += - (WinDifSolLayAbsW / state.dataSurface->Surface(HeatTransSurfNum).Area); + state.dataHeatBal->SurfWinInitialDifSolwinAbs(HeatTransSurfNum, IGlass) += (WinDifSolLayAbsW / surf.Area); } // Accumulate Window and Zone total distributed diffuse solar to check for conservation of energy // WinDifSolarDistAbsorbedTotl += DifSolarAbsW; // debug // ZoneDifSolarDistAbsorbedTotl += DifSolarAbsW; // debug // Calc diffuse solar reflected back to zone - DifSolarReflW = SolarTrans_ViewFactor * InterpSw(state.dataSurface->SurfWinSwitchingFactor(HeatTransSurfNum), - construction.ReflectSolDiffBack, - constructionSh.ReflectSolDiffBack); + DifSolarReflW = + SolarTrans_ViewFactor * + InterpSw(s_surf->SurfWinSwitchingFactor(HeatTransSurfNum), construction.ReflectSolDiffBack, constructionSh.ReflectSolDiffBack); // Accumulate total reflected distributed diffuse solar for each zone for subsequent // interreflection calcs @@ -12592,33 +12346,28 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, //[W] // Accumulate transmitted diffuse solar for reporting - state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(HeatTransSurfNum) += - (SolarTrans_ViewFactor - DifSolarReflW) / state.dataSurface->Surface(HeatTransSurfNum).Area; + state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(HeatTransSurfNum) += (SolarTrans_ViewFactor - DifSolarReflW) / surf.Area; } else { + auto const &surfShade = s_surf->surfShades(HeatTransSurfNum); // Interior, exterior or between-glass shade, screen or blind in place // Init accumulator for transmittance calc below DifSolarAbsW = 0.0; WinDifSolLayAbsW = 0.0; - int SurfWinSlatsAngIndex = state.dataSurface->SurfWinSlatsAngIndex(HeatTransSurfNum); - Real64 SurfWinSlatsAngInterpFac = state.dataSurface->SurfWinSlatsAngInterpFac(HeatTransSurfNum); // First calc diffuse solar absorbed by each glass layer in this window with shade/blind in place - auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - for (IGlass = 1; IGlass <= constructionSh.TotGlassLayers; ++IGlass) { + auto const &constrSh = state.dataConstruction->Construct(ConstrNumSh); + for (IGlass = 1; IGlass <= constrSh.TotGlassLayers; ++IGlass) { if (ANY_SHADE_SCREEN(ShadeFlag)) { // Calc diffuse solar absorbed in each window glass layer and shade - WinDifSolLayAbsW = SolarTrans_ViewFactor * constructionSh.AbsDiffBack(IGlass); + WinDifSolLayAbsW = SolarTrans_ViewFactor * constrSh.AbsDiffBack(IGlass); } else if (ANY_BLIND(ShadeFlag)) { - if (state.dataSurface->SurfWinMovableSlats(HeatTransSurfNum)) { - BlAbsDiffBk = - General::Interp(constructionSh.BlAbsDiffBack(SurfWinSlatsAngIndex, IGlass), - constructionSh.BlAbsDiffBack(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1), IGlass), - SurfWinSlatsAngInterpFac); - } else { - BlAbsDiffBk = constructionSh.BlAbsDiffBack(1, IGlass); - } + auto const &surfShade = state.dataSurface->surfShades(HeatTransSurfNum); + auto const &dfAbsSlatLo = constrSh.layerSlatBlindDfAbs(IGlass)[surfShade.blind.slatAngIdxLo]; + auto const &dfAbsSlatHi = constrSh.layerSlatBlindDfAbs(IGlass)[surfShade.blind.slatAngIdxHi]; + Real64 slatInterpFac = surfShade.blind.slatAngInterpFac; + BlAbsDiffBk = Interp(dfAbsSlatLo.Sol.Bk.Df.Abs, dfAbsSlatHi.Sol.Bk.Df.Abs, slatInterpFac); // Calc diffuse solar absorbed in each window glass layer and shade WinDifSolLayAbsW = SolarTrans_ViewFactor * BlAbsDiffBk; } @@ -12629,8 +12378,7 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // Accumulate diffuse solar absorbed from the inside by each window glass layer [W/m2] for // heat balance calcs - state.dataHeatBal->SurfWinInitialDifSolwinAbs(HeatTransSurfNum, IGlass) += - (WinDifSolLayAbsW / state.dataSurface->Surface(HeatTransSurfNum).Area); + state.dataHeatBal->SurfWinInitialDifSolwinAbs(HeatTransSurfNum, IGlass) += (WinDifSolLayAbsW / surf.Area); } // Accumulate Window and Zone total distributed diffuse solar to check for conservation of energy // WinDifSolarDistAbsorbedTotl += DifSolarAbsW; // debug @@ -12640,15 +12388,12 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // Diffuse back solar reflectance, bare glass or shade on InsideDifReflectance = construction.ReflectSolDiffBack; if ((ShadeFlag == WinShadingType::IntBlind) || (ShadeFlag == WinShadingType::ExtBlind)) { + auto const &surfShade = state.dataSurface->surfShades(HeatTransSurfNum); + auto const &btarSlatLo = constrSh.blindTARs[surfShade.blind.slatAngIdxLo]; + auto const &btarSlatHi = constrSh.blindTARs[surfShade.blind.slatAngIdxHi]; + Real64 slatInterpFac = surfShade.blind.slatAngInterpFac; // Diffuse back solar reflectance, blind present, vs. slat angle - if (state.dataSurface->SurfWinMovableSlats(HeatTransSurfNum)) { - InsideDifReflectance = - General::Interp(constructionSh.BlReflectSolDiffBack(SurfWinSlatsAngIndex), - constructionSh.BlReflectSolDiffBack(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - InsideDifReflectance = constructionSh.BlReflectSolDiffBack(1); - } + InsideDifReflectance = Interp(btarSlatLo.Sol.Bk.Df.Ref, btarSlatHi.Sol.Bk.Df.Ref, slatInterpFac); } DifSolarReflW = SolarTrans_ViewFactor * InsideDifReflectance; @@ -12661,29 +12406,26 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // ZoneDifSolarDistReflectedTotl += DifSolarReflW; // debug // Now calc diffuse solar absorbed by shade/blind itself - BlNum = state.dataSurface->SurfWinBlindNumber(HeatTransSurfNum); + BlNum = surfShade.blind.matNum; if (ANY_SHADE_SCREEN(ShadeFlag)) { // Calc diffuse solar absorbed by shade or screen [W] - ShBlDifSolarAbsW = SolarTrans_ViewFactor * constructionSh.AbsDiffBackShade; + ShBlDifSolarAbsW = SolarTrans_ViewFactor * constrSh.AbsDiffBackShade; } else if (ANY_BLIND(ShadeFlag)) { + auto const &surfShade = state.dataSurface->surfShades(HeatTransSurfNum); + auto const &btarSlatLo = constrSh.blindTARs[surfShade.blind.slatAngIdxLo]; + auto const &btarSlatHi = constrSh.blindTARs[surfShade.blind.slatAngIdxHi]; + Real64 slatInterpFac = surfShade.blind.slatAngInterpFac; // Calc diffuse solar absorbed by blind [W] - if (state.dataSurface->SurfWinMovableSlats(HeatTransSurfNum)) { - AbsDiffBkBl = General::Interp(constructionSh.AbsDiffBackBlind(SurfWinSlatsAngIndex), - constructionSh.AbsDiffBackBlind(std::min(Material::MaxSlatAngs, SurfWinSlatsAngIndex + 1)), - SurfWinSlatsAngInterpFac); - } else { - AbsDiffBkBl = constructionSh.AbsDiffBackBlind(1); - } + AbsDiffBkBl = Interp(btarSlatLo.Sol.Bk.Df.Abs, btarSlatHi.Sol.Bk.Df.Abs, slatInterpFac); ShBlDifSolarAbsW = SolarTrans_ViewFactor * AbsDiffBkBl; } // Correct for divider shadowing if (ANY_EXTERIOR_SHADE_BLIND_SCREEN(ShadeFlag)) { - ShBlDifSolarAbsW *= state.dataSurface->SurfaceWindow(HeatTransSurfNum).glazedFrac; + ShBlDifSolarAbsW *= s_surf->SurfaceWindow(HeatTransSurfNum).glazedFrac; } // Accumulate diffuse solar absorbed by shade or screen [W/m2] for heat balance calcs - state.dataSurface->SurfWinInitialDifSolAbsByShade(HeatTransSurfNum) += - (ShBlDifSolarAbsW / state.dataSurface->Surface(HeatTransSurfNum).Area); + s_surf->SurfWinInitialDifSolAbsByShade(HeatTransSurfNum) += (ShBlDifSolarAbsW / surf.Area); // Accumulate distributed diffuse solar absorbed [W] by overall window for transmittance calc // below @@ -12701,8 +12443,7 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // ZoneDifSolarDistTransmittedTotl += DifSolarTransW; // debug [W] // Accumulate transmitted diffuse solar for reporting - state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(HeatTransSurfNum) += - (SolarTrans_ViewFactor - DifSolarReflW) / state.dataSurface->Surface(HeatTransSurfNum).Area; + state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(HeatTransSurfNum) += (SolarTrans_ViewFactor - DifSolarReflW) / surf.Area; } // End of shading flag check @@ -12794,9 +12535,11 @@ void CalcComplexWindowOverlap(EnergyPlusData &state, Real64 TotAOverlap; // Total overlap area for given outgoing direction Real64 TotARhoVisOverlap; // Total overlap area time reflectance for given outgoing direction - state.dataSolarShading->XVertex.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); - state.dataSolarShading->YVertex.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); - state.dataSolarShading->ZVertex.dimension(state.dataSurface->MaxVerticesPerSurface + 1, 0.0); + auto &s_surf = state.dataSurface; + + state.dataSolarShading->XVertex.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->YVertex.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); + state.dataSolarShading->ZVertex.dimension(s_surf->MaxVerticesPerSurface + 1, 0.0); Geom.AOverlap.dimension(Window.NBkSurf, Geom.Trn.NBasis, 0.0); Geom.ARhoVisOverlap.dimension(Window.NBkSurf, Geom.Trn.NBasis, 0.0); @@ -12804,7 +12547,7 @@ void CalcComplexWindowOverlap(EnergyPlusData &state, // First to calculate and store coordinates of the window surface state.dataSolarShading->LOCHCA = 1; - int BaseSurf = state.dataSurface->Surface(ISurf).BaseSurf; // Base surface number + int BaseSurf = s_surf->Surface(ISurf).BaseSurf; // Base surface number // Base surface contains current window surface (ISurf). // Since that is case, below transformation should always return ZVT = 0.0 @@ -12827,9 +12570,9 @@ void CalcComplexWindowOverlap(EnergyPlusData &state, // For current basis direction calculate dot product between window surface // and basis direction. This will be used to calculate projection of each // of the back surfaces to window surface for given basis direciton - SdotX = dot(state.dataSurface->Surface(ISurf).lcsx, Geom.sTrn(IRay)); - SdotY = dot(state.dataSurface->Surface(ISurf).lcsy, Geom.sTrn(IRay)); - SdotZ = dot(state.dataSurface->Surface(ISurf).lcsz, Geom.sTrn(IRay)); + SdotX = dot(s_surf->Surface(ISurf).lcsx, Geom.sTrn(IRay)); + SdotY = dot(s_surf->Surface(ISurf).lcsy, Geom.sTrn(IRay)); + SdotZ = dot(s_surf->Surface(ISurf).lcsz, Geom.sTrn(IRay)); XSp = -SdotX; YSp = -SdotY; ZSp = -SdotZ; @@ -12897,7 +12640,7 @@ void CalcComplexWindowOverlap(EnergyPlusData &state, for (KBkSurf = 1; KBkSurf <= Window.NBkSurf; ++KBkSurf) { // back surf loop BackSurfaceNumber = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(KBkSurf); // CurBaseSurf is Current base surface number for shadow overlap calcualtions - int CurBaseSurf = state.dataSurface->Surface(BackSurfaceNumber).BaseSurf; + int CurBaseSurf = s_surf->Surface(BackSurfaceNumber).BaseSurf; if (CurBaseSurf != BackSurfaceNumber) { // Search if that base surface in list of back surfaces for current window // CurBackSurface is Current back surface number for base surface @@ -12914,18 +12657,20 @@ void CalcComplexWindowOverlap(EnergyPlusData &state, } } + auto &s_mat = state.dataMaterial; + // Calculate overlap area times reflectance. This is necessary for complex fenestration daylighting // calculations TotAOverlap = 0.0; TotARhoVisOverlap = 0.0; for (KBkSurf = 1; KBkSurf <= Window.NBkSurf; ++KBkSurf) { // back surf loop BackSurfaceNumber = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(KBkSurf); - IConst = state.dataSurface->Surface(BackSurfaceNumber).Construction; + IConst = s_surf->Surface(BackSurfaceNumber).Construction; InsideConLay = state.dataConstruction->Construct(IConst).TotLayers; - if (state.dataSurface->SurfWinWindowModelType(BackSurfaceNumber) == WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(BackSurfaceNumber) == WindowModel::BSDF) { VisibleReflectance = state.dataConstruction->Construct(IConst).ReflectVisDiffBack; } else { - VisibleReflectance = (1.0 - dynamic_cast(state.dataMaterial->Material(InsideConLay))->AbsorpVisible); + VisibleReflectance = (1.0 - s_mat->materials(InsideConLay)->AbsorpVisible); } Geom.ARhoVisOverlap(KBkSurf, IRay) = Geom.AOverlap(KBkSurf, IRay) * VisibleReflectance; TotAOverlap += Geom.AOverlap(KBkSurf, IRay); @@ -12962,8 +12707,10 @@ void TimestepInitComplexFenestration(EnergyPlusData &state) int iState; // current state number int NumOfStates; // number of states for current window - for (iSurf = 1; iSurf <= state.dataSurface->TotSurfaces; ++iSurf) { - if (state.dataSurface->SurfWinWindowModelType(iSurf) == WindowModel::BSDF) { + auto &s_surf = state.dataSurface; + + for (iSurf = 1; iSurf <= s_surf->TotSurfaces; ++iSurf) { + if (s_surf->SurfWinWindowModelType(iSurf) == WindowModel::BSDF) { // This will check complex fenestrations state and add new one if necessary (EMS case) CheckCFSStates(state, iSurf); diff --git a/src/EnergyPlus/StandardRatings.cc b/src/EnergyPlus/StandardRatings.cc index 8d14a96aba9..4f5a85f8348 100644 --- a/src/EnergyPlus/StandardRatings.cc +++ b/src/EnergyPlus/StandardRatings.cc @@ -1086,8 +1086,6 @@ namespace StandardRatings { Real64 EER2(0.0); // Energy Efficiency Ratio using AHRI 210/140 - 2023 Real64 EER_2022(0.0); // Energy Efficiency Ratio in SI [W/W] Real64 IEER_2022(0.0); // Integerated Energy Efficiency Ratio in SI [W/W] - Real64 NetCoolingCapRated2022(0.0); - Real64 NetCoolingCapRatedMaxSpeed2023(0.0); Real64 HSPF(0.0); // Heating Seasonal Performance Factor in SI [W/W] Real64 NetHeatingCapRatedHighTemp(0.0); // Net Rated heating capacity at high temp [W] @@ -2440,8 +2438,9 @@ namespace StandardRatings { return EER; } - std::tuple - SEER2CalulcationCurveFit(EnergyPlusData &state, std::string const &CoilType, EnergyPlus::CoilCoolingDXCurveFitOperatingMode operatingMode) + std::tuple SEER2CalulcationCurveFit(EnergyPlusData &state, + [[maybe_unused]] std::string const &CoilType, + EnergyPlus::CoilCoolingDXCurveFitOperatingMode operatingMode) { Real64 EEER2(0.0); Real64 SEER2_User(0.0); @@ -4106,7 +4105,7 @@ namespace StandardRatings { std::pair GetMatchingSpeedFromBuildingLoad(Real64 buildingLoad, const Array1A &speedList) { std::pair result = {-1, -1}; // Initialize result to indicate no suitable number found - for (int i = 0; i < speedList.size(); ++i) { + for (int i = 0; i < speedList.isize(); ++i) { Real64 scaledSpeed = speedList[i]; if (scaledSpeed >= buildingLoad) { result = {speedList[i], i}; @@ -6307,17 +6306,17 @@ namespace StandardRatings { Real64 q_H0_low = Q_H0_Low(spnum); Real64 q_H1_low = Q_H1_Low(spnum); Real64 q_H2_int = Q_H2_Int(spnum); - Real64 q_H1_full = Q_H1_Full(spnum); - Real64 q_H2_full = Q_H2_Full(spnum); - Real64 q_H3_full = Q_H3_Full(spnum); - Real64 q_H4_full = Q_H4_Full(spnum); + Real64 q_H1_full = Q_H1_Full(spnum + 1); + Real64 q_H2_full = Q_H2_Full(spnum + 1); + Real64 q_H3_full = Q_H3_Full(spnum + 1); + Real64 q_H4_full = Q_H4_Full(spnum + 1); // Equation 11.177 AHRI-2023 //?? (replaced 62 with 35) in Ratio expression // (t=>35-47/62-47) Real64 q_35_low = // q_H1_low + (q_H0_low - q_H1_low) * ((t - (8.33)) / (1.66 - (8.33))); q_H1_low + (q_H0_low - q_H1_low) * ((1.67 - (8.33)) / (16.67 - (8.33))); // Equation 11.191 AHRI-2023 - Real64 N_Hq = min(1.0, (q_H2_int - q_35_low) / (q_H2_full - q_35_low)); + Real64 N_Hq = (q_H2_full != q_35_low) ? min(1.0, (q_H2_int - q_35_low) / (q_H2_full - q_35_low)) : 0.0; N_Hq = max(0.0, N_Hq); // Equation 11.190 AHRI-2023 Real64 M_Hq = (q_H0_low - q_H1_low) / (16.66 - 8.33) * (1.0 - N_Hq) + (q_H2_full - q_H3_full) / (1.66 - (-8.33)) * N_Hq; @@ -6326,17 +6325,17 @@ namespace StandardRatings { Real64 p_H0_low = P_H0_Low(spnum); Real64 p_H1_low = P_H1_Low(spnum); Real64 p_H2_int = P_H2_Int(spnum); - Real64 p_H1_full = P_H1_Full(spnum); - Real64 p_H2_full = P_H2_Full(spnum); - Real64 p_H3_full = P_H3_Full(spnum); - Real64 p_H4_full = P_H4_Full(spnum); + Real64 p_H1_full = P_H1_Full(spnum + 1); + Real64 p_H2_full = P_H2_Full(spnum + 1); + Real64 p_H3_full = P_H3_Full(spnum + 1); + Real64 p_H4_full = P_H4_Full(spnum + 1); // Equation 11.178 AHRI - 2023 //?? (replaced 62 with 35) in Ratio expression (t=>35 F-47/35-47) Real64 p_35_low = // p_H1_low + (p_H0_low - p_H1_low) * ((t - (8.33)) / (1.66 - (8.33))); p_H1_low + (p_H0_low - p_H1_low) * ((1.67 - (8.33)) / (16.67 - (8.33))); // Equation 11.194 AHRI-2023 - Real64 N_HE = min(1.0, (p_H2_int - p_35_low) / (p_H2_full - p_35_low)); + Real64 N_HE = (p_H2_full != p_35_low) ? min(1.0, (p_H2_int - p_35_low) / (p_H2_full - p_35_low)) : 0.0; N_HE = max(0.0, N_HE); // Equation 11.193 AHRI-2023 @@ -6350,35 +6349,63 @@ namespace StandardRatings { Real64 q_hs(0.0); Real64 p_hs(0.0); // Low Speed - if (t < -8.33) { - q_low = Q_H3_Full(spnum) + ((Q_H1_Low(spnum) - Q_H3_Full(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) / - (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test)); - - p_low = P_H3_Full(spnum) + ((P_H1_Low(spnum) - P_H3_Full(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) / - (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test)); - } else if (t >= 4.44) { - q_low = Q_H1_Low(spnum) + ((Q_H0_Low(spnum) - Q_H1_Low(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempRated) / - (HeatingOutdoorCoilInletAirDBTempH0Test - HeatingOutdoorCoilInletAirDBTempRated)); - p_low = P_H1_Low(spnum) + ((P_H0_Low(spnum) - P_H1_Low(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempRated) / - (HeatingOutdoorCoilInletAirDBTempH0Test - HeatingOutdoorCoilInletAirDBTempRated)); - } else { - q_low = Q_H3_Full(spnum) + ((Q_H2_Full(spnum) - Q_H3_Full(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) / - (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test)); - p_low = P_H3_Full(spnum) + ((P_H2_Full(spnum) - P_H3_Full(spnum)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) / - (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test)); + if (t >= 8.33) { + Real64 ratio = // (t - 8.33) / (16.67 - 8.33) + (t - HeatingOutdoorCoilInletAirDBTempRated) / + (HeatingOutdoorCoilInletAirDBTempH0Test - HeatingOutdoorCoilInletAirDBTempRated); + // equation 11.179 + q_low = Q_H1_Low(spnum) + ((Q_H1_Low(spnum) - Q_H3_Full(spnum)) * ratio); + // equation 11.182 + p_low = P_H1_Low(spnum) + ((P_H1_Low(spnum) - P_H3_Full(spnum)) * ratio); + } else if (t >= 1.67 && t < 8.33) { + Real64 ratio = // (t - 1.67) / (8.33 - 1.67) + (t - HeatingOutdoorCoilInletAirDBTempH2Test) / + (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH2Test); + // equation 11.180 + q_low = Q_H2_Int(spnum) + ((Q_H0_Low(spnum) - Q_H1_Low(spnum)) * ratio); + // equation 11.183 + p_low = P_H2_Int(spnum) + ((P_H0_Low(spnum) - P_H1_Low(spnum)) * ratio); + } else if (t < 1.67) { + // for now Q_H2_Int is replaced with Q_H_Int, no equation for the later + // equation 11.181 + q_low = Q_H2_Int(spnum); + // equation 11.184 + p_low = P_H2_Int(spnum); } // High Speed - if ((t <= -8.33) || (t >= 7.20)) { - q_hs = Q_H3_Full(spnum + 1) + ((Q_H1_Full(spnum + 1) - Q_H3_Full(spnum + 1)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) / - (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test)); - p_hs = P_H3_Full(spnum + 1) + ((P_H1_Full(spnum + 1) - P_H3_Full(spnum + 1)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) / - (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test)); - } else { - q_hs = Q_H3_Full(spnum + 1) + ((Q_H2_Full(spnum + 1) - Q_H3_Full(spnum + 1)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) / - (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test)); - p_hs = P_H3_Full(spnum + 1) + ((P_H2_Full(spnum + 1) - P_H3_Full(spnum + 1)) * (t - HeatingOutdoorCoilInletAirDBTempH3Test) / - (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test)); + if (t <= -15.0) { + Real64 ratio = // ((t - (-15.0)) / (8.33 - (-8.33))); + (t - HeatingOutdoorCoilInletAirDBTemp_H4FullTest) / + (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test); + // equation 11.205 + q_hs = Q_H4_Full(spnum + 1) + ((Q_H1_Full(spnum + 1) - Q_H3_Full(spnum + 1)) * ratio); + // equation 11.206 + p_hs = P_H4_Full(spnum + 1) + ((P_H1_Full(spnum + 1) - P_H3_Full(spnum + 1)) * ratio); + } else if ((t > -15.0) && (t < -8.33)) { + Real64 ratio = // ((t - (-15.0)) / (-8.33 - (-15.0))); + (t - HeatingOutdoorCoilInletAirDBTemp_H4FullTest) / + (HeatingOutdoorCoilInletAirDBTempH3Test - HeatingOutdoorCoilInletAirDBTemp_H4FullTest); + // equation 11.203 + q_hs = Q_H4_Full(spnum + 1) + ((Q_H3_Full(spnum + 1) - Q_H4_Full(spnum + 1)) * ratio); + // equation 11.204 + p_hs = P_H4_Full(spnum + 1) + ((P_H3_Full(spnum + 1) - P_H4_Full(spnum + 1)) * ratio); + } else if ((t > -8.33) && (t < t_ob)) { + Real64 ratio = //((t - (-8.33)) / (1.67 - (-8.33))); + (t - HeatingOutdoorCoilInletAirDBTempH3Test) / + (HeatingOutdoorCoilInletAirDBTempH2Test - HeatingOutdoorCoilInletAirDBTempH3Test); + // equation 11.201 + q_hs = Q_H3_Full(spnum + 1) + ((Q_H2_Full(spnum + 1) - Q_H3_Full(spnum + 1)) * ratio); + // equation 11.202 + p_hs = P_H3_Full(spnum + 1) + ((P_H2_Full(spnum + 1) - P_H3_Full(spnum + 1)) * ratio); + } else if ((t >= t_ob) && (t <= -8.33)) { + Real64 ratio = // ((t - (-8.33)) / (8.33 - (-8.33))); + (t - HeatingOutdoorCoilInletAirDBTempH3Test) / + (HeatingOutdoorCoilInletAirDBTempRated - HeatingOutdoorCoilInletAirDBTempH3Test); + // equation 11.199 + q_hs = Q_H3_Full(spnum + 1) + ((Q_H1_Full(spnum + 1) - Q_H3_Full(spnum + 1)) * ratio); + // equation 11.200 + p_hs = P_H3_Full(spnum + 1) + ((P_H1_Full(spnum + 1) - P_H3_Full(spnum + 1)) * ratio); } Real64 cop_low = q_low / p_low; @@ -6444,18 +6471,30 @@ namespace StandardRatings { } else if (bl >= q_full) { // CASE 3 : 11.2.2.3.3 AHRI-2023 // Building Load is greater than the capacity of the unit at the Full Compressor Speed, q_full <= bl or (bl >= q_full:) - if (t > (-15) || t <= (-8.33)) { // Logical disjunction always evaluates to true: t > -15 || t <= -8.33 - Real64 t_ratio = (t - (-15)) / ((-8.33) - (-15)); - // Equation 11.203 AHRI-2023 - q_full = q_H4_full + (q_H3_full - q_H4_full) * t_ratio; - // Equation 11.204 AHRI-2023 - p_full = p_H4_full + (p_H3_full - p_H4_full) * t_ratio; - } else if (t < (-15)) { - Real64 t_ratio = (t - (-15)) / (8.33 - (-8.33)); + if (t <= -15.0) { + Real64 t_ratio = (t - (-15.0)) / ((8.33) - (-8.33)); // Equation 11.205 AHRI-2023 q_full = q_H4_full + (q_H1_full - q_H3_full) * t_ratio; // Equation 11.206 AHRI-2023 p_full = p_H4_full + (p_H1_full - p_H3_full) * t_ratio; + } else if (t > (-15.0) && t < (-8.33)) { + Real64 t_ratio = (t - (-15.0)) / (-8.33 - (-15.0)); + // Equation 11.203 AHRI-2023 + q_full = q_H4_full + (q_H3_full - q_H4_full) * t_ratio; + // Equation 11.204 AHRI-2023 + p_full = p_H4_full + (p_H3_full - p_H4_full) * t_ratio; + } else if (t > (-8.33) && t < t_ob) { + Real64 t_ratio = (t - (-8.33)) / (1.67 - (-8.33)); + // Equation 11.201 AHRI-2023 + q_full = q_H3_full + (q_H2_full - q_H3_full) * t_ratio; + // Equation 11.202 AHRI-2023 + p_full = p_H3_full + (p_H2_full - p_H3_full) * t_ratio; + } else if (t >= t_ob || t == (-8.33)) { + Real64 t_ratio = (t - (-8.33)) / (8.33 - (-8.33)); + // Equation 11.199 AHRI-2023 + q_full = q_H3_full + (q_H1_full - q_H3_full) * t_ratio; + // Equation 11.200 AHRI-2023 + p_full = p_H3_full + (p_H1_full - p_H3_full) * t_ratio; } // if not conducting H4 Test then use this block diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 07be3cb2695..51eb490b07a 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -216,21 +216,7 @@ namespace SurfaceGeometry { state.dataSurface->SurfWinShadeAbsFacFace2.dimension(NumSurfaces, 0.5); state.dataSurface->SurfWinConvCoeffWithShade.dimension(NumSurfaces, 0); state.dataSurface->SurfWinOtherConvHeatGain.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinBlindNumber.dimension(NumSurfaces, 0); state.dataSurface->SurfWinEffInsSurfTemp.dimension(NumSurfaces, 23.0); - state.dataSurface->SurfWinMovableSlats.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinSlatAngThisTS.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinSlatAngThisTSDeg.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinSlatAngThisTSDegEMSon.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinSlatAngThisTSDegEMSValue.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinSlatsBlockBeam.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinSlatsAngIndex.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinSlatsAngInterpFac.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinProfileAng.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinProfAngIndex.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinProfAngInterpFac.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinBlindBmBmTrans.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinBlindAirFlowPermeability.dimension(NumSurfaces, 0); state.dataSurface->SurfWinTotGlazingThickness.dimension(NumSurfaces, 0); state.dataSurface->SurfWinTanProfileAngHor.dimension(NumSurfaces, 0); state.dataSurface->SurfWinTanProfileAngVert.dimension(NumSurfaces, 0); @@ -423,6 +409,8 @@ namespace SurfaceGeometry { thisZone.ExtGrossWallArea += thisSurface.GrossArea; thisSpace.ExtGrossWallArea += thisSurface.GrossArea; thisZone.ExtGrossWallArea_Multiplied += thisSurface.GrossArea * thisZone.Multiplier * thisZone.ListMultiplier; + thisZone.extPerimeter += thisSurface.Width; + thisSpace.extPerimeter += thisSurface.Width; if (DetailedWWR) { print(state.files.debug, "{},Wall,{:.2R},{:.1R}\n", @@ -1100,7 +1088,6 @@ namespace SurfaceGeometry { bool RelWarning(false); int ConstrNumSh; // Shaded construction number for a window int LayNumOutside; // Outside material numbers for a shaded construction - int BlNum; // Blind number int AddedSubSurfaces; // Subsurfaces (windows) added when windows reference Window5 Data File // entries with two glazing systems int NeedToAddSurfaces; // Surfaces that will be added due to "unentered" other zone surface @@ -1121,10 +1108,6 @@ namespace SurfaceGeometry { bool errFlag; int iTmp1; - int iTmp2; - // unused INTEGER :: SchID - int BlNumNew; - int WinShadingControlPtr(0); int ErrCount; bool izConstDiff; // differences in construction for IZ surfaces bool izConstDiffMsg; // display message about hb diffs only once. @@ -1287,6 +1270,7 @@ namespace SurfaceGeometry { state.dataSurface->Surface.allocate(state.dataSurface->TotSurfaces); // Allocate the Surface derived type appropriately state.dataSurface->SurfaceWindow.allocate(state.dataSurface->TotSurfaces); + state.dataSurface->surfShades.allocate(state.dataSurface->TotSurfaces); AllocateSurfaceArrays(state); AllocateSurfaceWindows(state, state.dataSurface->TotSurfaces); @@ -2260,31 +2244,28 @@ namespace SurfaceGeometry { Real64 constexpr floorAreaTolerance(0.05); Real64 constexpr floorAreaPercentTolerance(floorAreaTolerance * 100.0); if (!SurfError) { - for (auto &thisZone : state.dataHeatBal->Zone) { - for (int spaceNum : thisZone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); - for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - auto &thisSurf = state.dataSurface->Surface(SurfNum); - if (thisSurf.Class == SurfaceClass::Floor) { - thisZone.HasFloor = true; - thisSpace.hasFloor = true; - thisSpace.calcFloorArea += thisSurf.Area; - } - if (thisSurf.Class == SurfaceClass::Roof) { - thisZone.CeilingArea += thisSurf.Area; - thisZone.HasRoof = true; - } - } - } - } ErrCount = 0; for (auto &thisSpace : state.dataHeatBal->space) { + auto &thisZone = state.dataHeatBal->Zone(thisSpace.zoneNum); + Real64 calcFloorArea = 0.0; // Calculated floor area used for this space + for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { + auto &thisSurf = state.dataSurface->Surface(SurfNum); + if (thisSurf.Class == SurfaceClass::Floor) { + thisZone.HasFloor = true; + thisSpace.hasFloor = true; + calcFloorArea += thisSurf.Area; + } + if (thisSurf.Class == SurfaceClass::Roof) { + thisZone.CeilingArea += thisSurf.Area; + thisZone.HasRoof = true; + } + } if (thisSpace.userEnteredFloorArea != Constant::AutoCalculate) { // Check entered vs calculated if (thisSpace.userEnteredFloorArea > 0.0) { // User entered Space floor area, // produce message if not near calculated - if (thisSpace.calcFloorArea > 0.0) { - Real64 diffp = std::abs(thisSpace.calcFloorArea - thisSpace.userEnteredFloorArea) / thisSpace.userEnteredFloorArea; + if (calcFloorArea > 0.0) { + Real64 diffp = std::abs(calcFloorArea - thisSpace.userEnteredFloorArea) / thisSpace.userEnteredFloorArea; if (diffp > floorAreaTolerance) { ++ErrCount; if (ErrCount == 1 && !state.dataGlobal->DisplayExtraWarnings) { @@ -2308,7 +2289,7 @@ namespace SurfaceGeometry { format("Entered Space Floor Area={:.2R}, Calculated Space Floor Area={:.2R}, entered " "Floor Area will be used.", thisSpace.userEnteredFloorArea, - thisSpace.calcFloorArea)); + calcFloorArea)); } } } @@ -2316,22 +2297,23 @@ namespace SurfaceGeometry { thisSpace.hasFloor = true; } } else { - thisSpace.FloorArea = thisSpace.calcFloorArea; + thisSpace.FloorArea = calcFloorArea; } } ErrCount = 0; for (auto &thisZone : state.dataHeatBal->Zone) { // Calculate zone floor area as sum of space floor areas + Real64 zoneCalcFloorArea = 0.0; // Calculated floor area excluding air boundary surfaces for (int spaceNum : thisZone.spaceIndexes) { - thisZone.CalcFloorArea += state.dataHeatBal->space(spaceNum).FloorArea; + zoneCalcFloorArea += state.dataHeatBal->space(spaceNum).FloorArea; thisZone.HasFloor |= state.dataHeatBal->space(spaceNum).hasFloor; } if (thisZone.UserEnteredFloorArea != Constant::AutoCalculate) { // Check entered vs calculated if (thisZone.UserEnteredFloorArea > 0.0) { // User entered zone floor area, // produce message if not near calculated - if (thisZone.CalcFloorArea > 0.0) { - Real64 diffp = std::abs(thisZone.CalcFloorArea - thisZone.UserEnteredFloorArea) / thisZone.UserEnteredFloorArea; + if (zoneCalcFloorArea > 0.0) { + Real64 diffp = std::abs(zoneCalcFloorArea - thisZone.UserEnteredFloorArea) / thisZone.UserEnteredFloorArea; if (diffp > 0.05) { ++ErrCount; if (ErrCount == 1 && !state.dataGlobal->DisplayExtraWarnings) { @@ -2354,7 +2336,7 @@ namespace SurfaceGeometry { ShowContinueError(state, format("Entered Zone Floor Area={:.2R}, Sum of Space Floor Area(s)={:.2R}", thisZone.UserEnteredFloorArea, - thisZone.CalcFloorArea)); + zoneCalcFloorArea)); ShowContinueError( state, "Entered Zone Floor Area will be used and Space Floor Area(s) will be adjusted proportionately."); } @@ -2368,9 +2350,9 @@ namespace SurfaceGeometry { // If the zone contains only one space, then set the Space area to the Zone area int spaceNum = thisZone.spaceIndexes(1); state.dataHeatBal->space(spaceNum).FloorArea = thisZone.FloorArea; - } else if (thisZone.CalcFloorArea > 0.0) { + } else if (zoneCalcFloorArea > 0.0) { // Adjust space areas proportionately - Real64 areaRatio = thisZone.FloorArea / thisZone.CalcFloorArea; + Real64 areaRatio = thisZone.FloorArea / zoneCalcFloorArea; for (int spaceNum : thisZone.spaceIndexes) { state.dataHeatBal->space(spaceNum).FloorArea *= areaRatio; } @@ -2388,10 +2370,10 @@ namespace SurfaceGeometry { } } } else { - if (thisZone.CalcFloorArea > 0.0) thisZone.FloorArea = thisZone.CalcFloorArea; + if (zoneCalcFloorArea > 0.0) thisZone.FloorArea = zoneCalcFloorArea; } } else { - thisZone.FloorArea = thisZone.CalcFloorArea; + thisZone.FloorArea = zoneCalcFloorArea; } Real64 totSpacesFloorArea = 0.0; for (int spaceNum : thisZone.spaceIndexes) { @@ -2439,397 +2421,382 @@ namespace SurfaceGeometry { } } + auto &s_mat = state.dataMaterial; + + // I don't think this entire loop matters errFlag = false; if (!SurfError) { for (int SurfNum = 1; SurfNum <= MovedSurfs; ++SurfNum) { // TotSurfaces auto &surf = state.dataSurface->Surface(SurfNum); - if (surf.HasShadeControl) { - WinShadingControlPtr = surf.activeWindowShadingControl; // use first item since others should be identical - if (state.dataSurface->WindowShadingControl(WinShadingControlPtr).slatAngleControl != SlatAngleControl::Fixed) { - state.dataSurface->SurfWinMovableSlats(SurfNum) = true; - state.dataSurface->AnyMovableSlat = true; - state.dataHeatBalSurf->SurfMovSlatsIndexList.push_back(SurfNum); - } - - ConstrNumSh = surf.activeShadedConstruction; - if (ConstrNumSh <= 0) continue; - - WinShadingType ShadingType = state.dataSurface->WindowShadingControl(WinShadingControlPtr).ShadingType; - - // only for blinds - if (ANY_BLIND(ShadingType)) { - - // 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 <= state.dataConstruction->Construct(ConstrNumSh).TotLayers; ++iTmp1) { - iTmp2 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(iTmp1); - auto *mat = state.dataMaterial->Material(iTmp2); - - if (mat->group != Material::Group::WindowBlind) continue; - - auto *matBlind = dynamic_cast(mat); - assert(matBlind != nullptr); - - BlNum = matBlind->BlindDataPtr; - state.dataSurface->SurfWinBlindNumber(SurfNum) = BlNum; - // TH 2/18/2010. CR 8010 - // if it is a blind with movable slats, create one new blind and set it to VariableSlat if not done so yet. - // the new blind is created only once, it can be shared by multiple windows though. - if (state.dataSurface->SurfWinMovableSlats(SurfNum) && - state.dataMaterial->Blind(BlNum).SlatAngleType != DataWindowEquivalentLayer::AngleType::Variable) { - errFlag = false; - AddVariableSlatBlind(state, BlNum, BlNumNew, errFlag); - // point to the new blind - matBlind->BlindDataPtr = BlNumNew; - // window surface points to new blind - state.dataSurface->SurfWinBlindNumber(SurfNum) = BlNumNew; - } - break; - } + if (!surf.HasShadeControl) continue; - if (errFlag) { - ErrorsFound = true; - ShowContinueError(state, - format("WindowShadingControl {} has errors, program will terminate.", - state.dataSurface->WindowShadingControl(WinShadingControlPtr).Name)); - } - } - } // End of surface loop + ConstrNumSh = surf.activeShadedConstruction; + if (ConstrNumSh <= 0) continue; - // final associate fenestration surfaces referenced in WindowShadingControl - FinalAssociateWindowShadingControlFenestration(state, ErrorsFound); - CheckWindowShadingControlSimilarForWindow(state, ErrorsFound); - } + auto &winShadeCtrl = state.dataSurface->WindowShadingControl(surf.activeWindowShadingControl); + if (!ANY_BLIND(winShadeCtrl.ShadingType)) continue; + // use first item since others should be identical - // Check for zones with not enough surfaces - for (auto &thisZone : state.dataHeatBal->Zone) { - int OpaqueHTSurfs = 0; // Number of floors, walls and roofs in a zone - int OpaqueHTSurfsWithWin = 0; // Number of floors, walls and roofs with windows in a zone - int InternalMassSurfs = 0; // Number of internal mass surfaces in a zone - int priorBaseSurfNum = 0; + auto &surfShade = state.dataSurface->surfShades(SurfNum); + // 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 (int iMatNum = 1; iMatNum <= state.dataConstruction->Construct(ConstrNumSh).TotLayers; ++iMatNum) { + auto *mat = s_mat->materials(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(iMatNum)); - for (int spaceNum : thisZone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); - if (thisSpace.HTSurfaceFirst == 0) continue; // Zone with no surfaces - for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - auto &thisSurf = state.dataSurface->Surface(SurfNum); - if (thisSurf.Class == SurfaceClass::Floor || thisSurf.Class == SurfaceClass::Wall || thisSurf.Class == SurfaceClass::Roof) - ++OpaqueHTSurfs; - if (thisSurf.Class == SurfaceClass::IntMass) ++InternalMassSurfs; - if (thisSurf.Class == SurfaceClass::Window) { - // Count base surface only once for multiple windows on a wall - int thisBaseSurfNum = thisSurf.BaseSurf; - if (thisBaseSurfNum != priorBaseSurfNum) { - ++OpaqueHTSurfsWithWin; - priorBaseSurfNum = thisBaseSurfNum; - } + if (mat->group != Material::Group::Blind) continue; + + auto *matBlind = dynamic_cast(mat); + assert(matBlind != nullptr); + + surfShade.blind.matNum = mat->Num; + break; + } + + if (errFlag) { + ErrorsFound = true; + ShowContinueError(state, format("WindowShadingControl {} has errors, program will terminate.", winShadeCtrl.Name)); + } + + if (winShadeCtrl.slatAngleControl != SlatAngleControl::Fixed) { + surfShade.blind.movableSlats = true; + state.dataSurface->AnyMovableSlat = true; + state.dataHeatBalSurf->SurfMovSlatsIndexList.push_back(SurfNum); + } + } // End of surface loop + + // final associate fenestration surfaces referenced in WindowShadingControl + FinalAssociateWindowShadingControlFenestration(state, ErrorsFound); + CheckWindowShadingControlSimilarForWindow(state, ErrorsFound); + } + + // Check for zones with not enough surfaces + for (auto &thisZone : state.dataHeatBal->Zone) { + int OpaqueHTSurfs = 0; // Number of floors, walls and roofs in a zone + int OpaqueHTSurfsWithWin = 0; // Number of floors, walls and roofs with windows in a zone + int InternalMassSurfs = 0; // Number of internal mass surfaces in a zone + int priorBaseSurfNum = 0; + + for (int spaceNum : thisZone.spaceIndexes) { + auto &thisSpace = state.dataHeatBal->space(spaceNum); + if (thisSpace.HTSurfaceFirst == 0) continue; // Zone with no surfaces + for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { + auto &thisSurf = state.dataSurface->Surface(SurfNum); + if (thisSurf.Class == SurfaceClass::Floor || thisSurf.Class == SurfaceClass::Wall || thisSurf.Class == SurfaceClass::Roof) + ++OpaqueHTSurfs; + if (thisSurf.Class == SurfaceClass::IntMass) ++InternalMassSurfs; + if (thisSurf.Class == SurfaceClass::Window) { + // Count base surface only once for multiple windows on a wall + int thisBaseSurfNum = thisSurf.BaseSurf; + if (thisBaseSurfNum != priorBaseSurfNum) { + ++OpaqueHTSurfsWithWin; + priorBaseSurfNum = thisBaseSurfNum; } } } - if (OpaqueHTSurfsWithWin == 1 && OpaqueHTSurfs == 1 && InternalMassSurfs == 0) { - SurfError = true; - ShowSevereError(state, - format("{}Zone {} has only one floor, wall or roof, and this surface has a window.", RoutineName, thisZone.Name)); - ShowContinueError(state, "Add more floors, walls or roofs, or an internal mass surface."); - } } + if (OpaqueHTSurfsWithWin == 1 && OpaqueHTSurfs == 1 && InternalMassSurfs == 0) { + SurfError = true; + ShowSevereError(state, + format("{}Zone {} has only one floor, wall or roof, and this surface has a window.", RoutineName, thisZone.Name)); + ShowContinueError(state, "Add more floors, walls or roofs, or an internal mass surface."); + } + } - // set up vertex of centroid for each surface. - CalcSurfaceCentroid(state); + // set up vertex of centroid for each surface. + CalcSurfaceCentroid(state); - SetupShadeSurfacesForSolarCalcs(state); // if shading surfaces are solar collectors or PV, then we need full solar calc. + SetupShadeSurfacesForSolarCalcs(state); // if shading surfaces are solar collectors or PV, then we need full solar calc. - GetMovableInsulationData(state, ErrorsFound); + GetMovableInsulationData(state, ErrorsFound); - if (state.dataSurface->CalcSolRefl) GetShadingSurfReflectanceData(state, ErrorsFound); + if (state.dataSurface->CalcSolRefl) GetShadingSurfReflectanceData(state, ErrorsFound); - LayNumOutside = 0; - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto &surf = state.dataSurface->Surface(SurfNum); - // Check for EcoRoof and only 1 allowed to be used. - if (surf.Construction > 0) - state.dataSurface->SurfExtEcoRoof(SurfNum) = state.dataConstruction->Construct(surf.Construction).TypeIsEcoRoof; - if (!state.dataSurface->SurfExtEcoRoof(SurfNum)) continue; - if (LayNumOutside == 0) { - LayNumOutside = state.dataConstruction->Construct(surf.Construction).LayerPoint(1); - continue; - } - if (LayNumOutside != state.dataConstruction->Construct(surf.Construction).LayerPoint(1)) { - ShowSevereError(state, format("{}Only one EcoRoof Material is currently allowed for all constructions.", RoutineName)); - ShowContinueError(state, format("... first material={}", state.dataMaterial->Material(LayNumOutside)->Name)); - ShowContinueError(state, - format("... conflicting Construction={} uses material={}", - state.dataConstruction->Construct(surf.Construction).Name, - state.dataMaterial->Material(state.dataConstruction->Construct(surf.Construction).LayerPoint(1))->Name)); - ErrorsFound = true; - } - } + LayNumOutside = 0; - // Reserve space to avoid excess allocations - state.dataSurface->AllHTSurfaceList.reserve(state.dataSurface->TotSurfaces); - state.dataSurface->AllExtSolarSurfaceList.reserve(state.dataSurface->TotSurfaces); - state.dataSurface->AllShadowPossObstrSurfaceList.reserve(state.dataSurface->TotSurfaces); - state.dataSurface->AllIZSurfaceList.reserve(state.dataSurface->TotSurfaces); - state.dataSurface->AllHTNonWindowSurfaceList.reserve(state.dataSurface->TotSurfaces - state.dataSurface->TotWindows); - state.dataSurface->AllHTWindowSurfaceList.reserve(state.dataSurface->TotWindows); - state.dataSurface->AllExtSolWindowSurfaceList.reserve(state.dataSurface->TotWindows); - state.dataSurface->AllExtSolWinWithFrameSurfaceList.reserve(state.dataSurface->TotWindows); - state.dataSurface->AllHTKivaSurfaceList.reserve(state.dataSurface->TotSurfaces); + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + auto &surf = state.dataSurface->Surface(SurfNum); + // Check for EcoRoof and only 1 allowed to be used. + if (surf.Construction > 0) + state.dataSurface->SurfExtEcoRoof(SurfNum) = state.dataConstruction->Construct(surf.Construction).TypeIsEcoRoof; + if (!state.dataSurface->SurfExtEcoRoof(SurfNum)) continue; + if (LayNumOutside == 0) { + LayNumOutside = state.dataConstruction->Construct(surf.Construction).LayerPoint(1); + continue; + } + if (LayNumOutside != state.dataConstruction->Construct(surf.Construction).LayerPoint(1)) { + ShowSevereError(state, format("{}Only one EcoRoof Material is currently allowed for all constructions.", RoutineName)); + ShowContinueError(state, format("... first material={}", s_mat->materials(LayNumOutside)->Name)); + ShowContinueError(state, + format("... conflicting Construction={} uses material={}", + state.dataConstruction->Construct(surf.Construction).Name, + s_mat->materials(state.dataConstruction->Construct(surf.Construction).LayerPoint(1))->Name)); + ErrorsFound = true; + } + } - // Set flag that determines whether a surface can be an exterior obstruction - // Also set associated surfaces for Kiva foundations and build heat transfer surface lists - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto &surf = state.dataSurface->Surface(SurfNum); - surf.IsShadowPossibleObstruction = false; - if (surf.ExtSolar) { - // This may include some attached shading surfaces - state.dataSurface->AllExtSolarSurfaceList.push_back(SurfNum); - } - if (surf.HeatTransSurf) { - // Outside light shelves get tagged later as HeatTransSurf=true but they haven't been processed yet - state.dataSurface->AllHTSurfaceList.push_back(SurfNum); - int const zoneNum(surf.Zone); - auto &surfZone(state.dataHeatBal->Zone(zoneNum)); - surfZone.ZoneHTSurfaceList.push_back(SurfNum); + // Reserve space to avoid excess allocations + state.dataSurface->AllHTSurfaceList.reserve(state.dataSurface->TotSurfaces); + state.dataSurface->AllExtSolarSurfaceList.reserve(state.dataSurface->TotSurfaces); + state.dataSurface->AllShadowPossObstrSurfaceList.reserve(state.dataSurface->TotSurfaces); + state.dataSurface->AllIZSurfaceList.reserve(state.dataSurface->TotSurfaces); + state.dataSurface->AllHTNonWindowSurfaceList.reserve(state.dataSurface->TotSurfaces - state.dataSurface->TotWindows); + state.dataSurface->AllHTWindowSurfaceList.reserve(state.dataSurface->TotWindows); + state.dataSurface->AllExtSolWindowSurfaceList.reserve(state.dataSurface->TotWindows); + state.dataSurface->AllExtSolWinWithFrameSurfaceList.reserve(state.dataSurface->TotWindows); + state.dataSurface->AllHTKivaSurfaceList.reserve(state.dataSurface->TotSurfaces); + + // Set flag that determines whether a surface can be an exterior obstruction + // Also set associated surfaces for Kiva foundations and build heat transfer surface lists + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + auto &surf = state.dataSurface->Surface(SurfNum); + surf.IsShadowPossibleObstruction = false; + if (surf.ExtSolar) { + // This may include some attached shading surfaces + state.dataSurface->AllExtSolarSurfaceList.push_back(SurfNum); + } + if (surf.HeatTransSurf) { + // Outside light shelves get tagged later as HeatTransSurf=true but they haven't been processed yet + state.dataSurface->AllHTSurfaceList.push_back(SurfNum); + int const zoneNum(surf.Zone); + auto &surfZone(state.dataHeatBal->Zone(zoneNum)); + surfZone.ZoneHTSurfaceList.push_back(SurfNum); + // Sort window vs non-window surfaces + if (surf.Class == DataSurfaces::SurfaceClass::Window) { + state.dataSurface->AllHTWindowSurfaceList.push_back(SurfNum); + surfZone.ZoneHTWindowSurfaceList.push_back(SurfNum); + if (surf.ExtSolar) { + state.dataSurface->AllExtSolWindowSurfaceList.push_back(SurfNum); + if (surf.FrameDivider > 0) { + state.dataSurface->AllExtSolWinWithFrameSurfaceList.push_back(SurfNum); + } + } + } else { + state.dataSurface->AllHTNonWindowSurfaceList.push_back(SurfNum); + surfZone.ZoneHTNonWindowSurfaceList.push_back(SurfNum); + } + int const surfExtBoundCond(surf.ExtBoundCond); + // Build zone and interzone surface lists + if ((surfExtBoundCond > 0) && (surfExtBoundCond != SurfNum)) { + state.dataSurface->AllIZSurfaceList.push_back(SurfNum); + surfZone.ZoneIZSurfaceList.push_back(SurfNum); + auto &adjZone(state.dataHeatBal->Zone(state.dataSurface->Surface(surfExtBoundCond).Zone)); + adjZone.ZoneHTSurfaceList.push_back(SurfNum); + adjZone.ZoneIZSurfaceList.push_back(SurfNum); // Sort window vs non-window surfaces if (surf.Class == DataSurfaces::SurfaceClass::Window) { - state.dataSurface->AllHTWindowSurfaceList.push_back(SurfNum); - surfZone.ZoneHTWindowSurfaceList.push_back(SurfNum); - if (surf.ExtSolar) { - state.dataSurface->AllExtSolWindowSurfaceList.push_back(SurfNum); - if (surf.FrameDivider > 0) { - state.dataSurface->AllExtSolWinWithFrameSurfaceList.push_back(SurfNum); - } - } + adjZone.ZoneHTWindowSurfaceList.push_back(SurfNum); } else { - state.dataSurface->AllHTNonWindowSurfaceList.push_back(SurfNum); - surfZone.ZoneHTNonWindowSurfaceList.push_back(SurfNum); - } - int const surfExtBoundCond(surf.ExtBoundCond); - // Build zone and interzone surface lists - if ((surfExtBoundCond > 0) && (surfExtBoundCond != SurfNum)) { - state.dataSurface->AllIZSurfaceList.push_back(SurfNum); - surfZone.ZoneIZSurfaceList.push_back(SurfNum); - auto &adjZone(state.dataHeatBal->Zone(state.dataSurface->Surface(surfExtBoundCond).Zone)); - adjZone.ZoneHTSurfaceList.push_back(SurfNum); - adjZone.ZoneIZSurfaceList.push_back(SurfNum); - // Sort window vs non-window surfaces - if (surf.Class == DataSurfaces::SurfaceClass::Window) { - adjZone.ZoneHTWindowSurfaceList.push_back(SurfNum); - } else { - adjZone.ZoneHTNonWindowSurfaceList.push_back(SurfNum); - } + adjZone.ZoneHTNonWindowSurfaceList.push_back(SurfNum); } } + } - // Exclude non-exterior heat transfer surfaces (but not OtherSideCondModeledExt = -4 CR7640) - if (surf.HeatTransSurf && surf.ExtBoundCond > 0) continue; - if (surf.HeatTransSurf && surf.ExtBoundCond == Ground) continue; - if (surf.HeatTransSurf && surf.ExtBoundCond == KivaFoundation) { - state.dataSurface->AllHTKivaSurfaceList.push_back(SurfNum); - if (!ErrorsFound) state.dataSurfaceGeometry->kivaManager.foundationInputs[surf.OSCPtr].surfaces.push_back(SurfNum); + // Exclude non-exterior heat transfer surfaces (but not OtherSideCondModeledExt = -4 CR7640) + if (surf.HeatTransSurf && surf.ExtBoundCond > 0) continue; + if (surf.HeatTransSurf && surf.ExtBoundCond == Ground) continue; + if (surf.HeatTransSurf && surf.ExtBoundCond == KivaFoundation) { + state.dataSurface->AllHTKivaSurfaceList.push_back(SurfNum); + if (!ErrorsFound) state.dataSurfaceGeometry->kivaManager.foundationInputs[surf.OSCPtr].surfaces.push_back(SurfNum); + continue; + } + if (surf.HeatTransSurf && surf.ExtBoundCond == OtherSideCoefNoCalcExt) continue; + if (surf.HeatTransSurf && surf.ExtBoundCond == OtherSideCoefCalcExt) continue; + // Exclude windows and doors, i.e., consider only their base surfaces as possible obstructions + if (surf.Class == SurfaceClass::Window || surf.Class == SurfaceClass::Door) continue; + // Exclude duplicate shading surfaces + if (surf.MirroredSurf) continue; + // Exclude air boundary surfaces + if (surf.IsAirBoundarySurf) continue; + + surf.IsShadowPossibleObstruction = true; + state.dataSurface->AllShadowPossObstrSurfaceList.push_back(SurfNum); + } // for (SurfNum) + + // Check for IRT surfaces in invalid places. + iTmp1 = 0; + if (std::any_of(state.dataConstruction->Construct.begin(), + state.dataConstruction->Construct.end(), + [](Construction::ConstructionProps const &e) { return e.TypeIsIRT; })) { + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + auto &surf = state.dataSurface->Surface(SurfNum); + if (!surf.HeatTransSurf) continue; // ignore shading surfaces + if (surf.ExtBoundCond > 0 && surf.ExtBoundCond != SurfNum) continue; // interzone, not adiabatic surface + if (!state.dataConstruction->Construct(surf.Construction).TypeIsIRT) { continue; } - if (surf.HeatTransSurf && surf.ExtBoundCond == OtherSideCoefNoCalcExt) continue; - if (surf.HeatTransSurf && surf.ExtBoundCond == OtherSideCoefCalcExt) continue; - // Exclude windows and doors, i.e., consider only their base surfaces as possible obstructions - if (surf.Class == SurfaceClass::Window || surf.Class == SurfaceClass::Door) continue; - // Exclude duplicate shading surfaces - if (surf.MirroredSurf) continue; - // Exclude air boundary surfaces - if (surf.IsAirBoundarySurf) continue; - - surf.IsShadowPossibleObstruction = true; - state.dataSurface->AllShadowPossObstrSurfaceList.push_back(SurfNum); + if (!state.dataGlobal->DisplayExtraWarnings) { + ++iTmp1; + } else { + ShowWarningError(state, + format("{}Surface=\"{}\" uses InfraredTransparent construction in a non-interzone surface. (illegal use)", + RoutineName, + surf.Name)); + } + } + if (iTmp1 > 0) { + ShowWarningError( + state, + format("{}Surfaces use InfraredTransparent constructions {} in non-interzone surfaces. (illegal use)", RoutineName, iTmp1)); + ShowContinueError(state, "For explicit details on each use, use Output:Diagnostics,DisplayExtraWarnings;"); } + } - // Check for IRT surfaces in invalid places. - iTmp1 = 0; - if (std::any_of(state.dataConstruction->Construct.begin(), - state.dataConstruction->Construct.end(), - [](Construction::ConstructionProps const &e) { return e.TypeIsIRT; })) { - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto &surf = state.dataSurface->Surface(SurfNum); - if (!surf.HeatTransSurf) continue; // ignore shading surfaces - if (surf.ExtBoundCond > 0 && surf.ExtBoundCond != SurfNum) continue; // interzone, not adiabatic surface - if (!state.dataConstruction->Construct(surf.Construction).TypeIsIRT) { - continue; - } - if (!state.dataGlobal->DisplayExtraWarnings) { - ++iTmp1; - } else { - ShowWarningError(state, - format("{}Surface=\"{}\" uses InfraredTransparent construction in a non-interzone surface. (illegal use)", - RoutineName, - surf.Name)); - } - } - if (iTmp1 > 0) { - ShowWarningError( - state, - format("{}Surfaces use InfraredTransparent constructions {} in non-interzone surfaces. (illegal use)", RoutineName, iTmp1)); - ShowContinueError(state, "For explicit details on each use, use Output:Diagnostics,DisplayExtraWarnings;"); + // Populate SurfaceFilter lists + for (int iSurfaceFilter = 1; iSurfaceFilter < static_cast(SurfaceFilter::Num); ++iSurfaceFilter) + state.dataSurface->SurfaceFilterLists[iSurfaceFilter].reserve(state.dataSurface->TotSurfaces); + + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + auto const &surf = state.dataSurface->Surface(SurfNum); + if (!surf.HeatTransSurf) continue; + if (surf.ExtBoundCond > 0) { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorSurfaces)].push_back(SurfNum); + if (state.dataConstruction->Construct(surf.Construction).TypeIsWindow) { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorWindows)].push_back(SurfNum); + } else if (surf.Class == SurfaceClass::Wall) { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorWalls)].push_back(SurfNum); + } else if (surf.Class == SurfaceClass::Floor) { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorFloors)].push_back(SurfNum); + } else if (surf.Class == SurfaceClass::Roof) { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorRoofs)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorCeilings)].push_back(SurfNum); } - } + } else { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorSurfaces)].push_back(SurfNum); + if (state.dataConstruction->Construct(surf.Construction).TypeIsWindow) { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorWindows)].push_back(SurfNum); + } else if (surf.Class == SurfaceClass::Wall) { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorWalls)].push_back(SurfNum); + } else if (surf.Class == SurfaceClass::Floor) { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorFloors)].push_back(SurfNum); + } else if (surf.Class == SurfaceClass::Roof) { + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorRoofs)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorCeilings)].push_back(SurfNum); + } + } + } // for (SurfNum) + + // Note, could do same for Window Area and detecting if Interzone Surface in Zone + + if (state.dataSurfaceGeometry->Warning1Count > 0) { + ShowWarningMessage(state, + format("{}Window dimensions differ from Window 5/6 data file dimensions, {} times.", + RoutineName, + state.dataSurfaceGeometry->Warning1Count)); + ShowContinueError(state, "This will affect the frame heat transfer calculation if the frame in the Data File entry"); + ShowContinueError(state, "is not uniform, i.e., has sections with different geometry and/or thermal properties."); + ShowContinueError(state, "For explicit details on each window, use Output:Diagnostics,DisplayExtraWarnings;"); + } + if (state.dataSurfaceGeometry->Warning2Count > 0) { + ShowWarningMessage(state, + format("{}Exterior Windows have been replaced with Window 5/6 two glazing systems, {} times.", + RoutineName, + state.dataSurfaceGeometry->Warning2Count)); + ShowContinueError(state, "Note that originally entered dimensions are overridden."); + ShowContinueError(state, "For explicit details on each window, use Output:Diagnostics,DisplayExtraWarnings;"); + } + if (state.dataSurfaceGeometry->Warning3Count > 0) { + ShowWarningMessage(state, + format("{}Interior Windows have been replaced with Window 5/6 two glazing systems, {} times.", + RoutineName, + state.dataSurfaceGeometry->Warning3Count)); + ShowContinueError(state, "Note that originally entered dimensions are overridden."); + ShowContinueError(state, "For explicit details on each window, use Output:Diagnostics,DisplayExtraWarnings;"); + } + + if (state.dataErrTracking->TotalMultipliedWindows > 0) { + ShowWarningMessage(state, + format("{}There are {} window/glass door(s) that may cause inaccurate shadowing due to Solar Distribution.", + RoutineName, + state.dataErrTracking->TotalMultipliedWindows)); + ShowContinueError(state, "For explicit details on each window, use Output:Diagnostics,DisplayExtraWarnings;"); + state.dataErrTracking->TotalWarningErrors += state.dataErrTracking->TotalMultipliedWindows; + } + if (state.dataErrTracking->TotalCoincidentVertices > 0) { + ShowWarningMessage(state, + format("{}There are {} coincident/collinear vertices; These have been deleted unless the deletion would bring the " + "number of surface sides < 3.", + RoutineName, + state.dataErrTracking->TotalCoincidentVertices)); + ShowContinueError(state, "For explicit details on each problem surface, use Output:Diagnostics,DisplayExtraWarnings;"); + state.dataErrTracking->TotalWarningErrors += state.dataErrTracking->TotalCoincidentVertices; + } + if (state.dataErrTracking->TotalDegenerateSurfaces > 0) { + ShowSevereMessage(state, + format("{}There are {} degenerate surfaces; Degenerate surfaces are those with number of sides < 3.", + RoutineName, + state.dataErrTracking->TotalDegenerateSurfaces)); + ShowContinueError(state, "These surfaces should be deleted."); + ShowContinueError(state, "For explicit details on each problem surface, use Output:Diagnostics,DisplayExtraWarnings;"); + state.dataErrTracking->TotalSevereErrors += state.dataErrTracking->TotalDegenerateSurfaces; + } + + GetHTSurfExtVentedCavityData(state, ErrorsFound); + + state.dataSurfaceGeometry->exposedFoundationPerimeter.getData(state, ErrorsFound); + + GetSurfaceHeatTransferAlgorithmOverrides(state, ErrorsFound); + + // Set up enclosures, process Air Boundaries if any + SetupEnclosuresAndAirBoundaries(state, state.dataViewFactor->EnclRadInfo, SurfaceGeometry::enclosureType::RadiantEnclosures, ErrorsFound); + + GetSurfaceGroundSurfsData(state, ErrorsFound); + + GetSurfaceSrdSurfsData(state, ErrorsFound); + + GetSurfaceLocalEnvData(state, ErrorsFound); - // Populate SurfaceFilter lists - for (int iSurfaceFilter = 1; iSurfaceFilter < static_cast(SurfaceFilter::Num); ++iSurfaceFilter) - state.dataSurface->SurfaceFilterLists[iSurfaceFilter].reserve(state.dataSurface->TotSurfaces); + if (SurfError || ErrorsFound) { + ErrorsFound = true; + ShowFatalError(state, format("{}Errors discovered, program terminates.", RoutineName)); + } - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto const &surf = state.dataSurface->Surface(SurfNum); - if (!surf.HeatTransSurf) continue; - if (surf.ExtBoundCond > 0) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorSurfaces)].push_back(SurfNum); - if (state.dataConstruction->Construct(surf.Construction).TypeIsWindow) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorWindows)].push_back(SurfNum); - } else if (surf.Class == SurfaceClass::Wall) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorWalls)].push_back(SurfNum); - } else if (surf.Class == SurfaceClass::Floor) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorFloors)].push_back(SurfNum); - } else if (surf.Class == SurfaceClass::Roof) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorRoofs)].push_back(SurfNum); - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorCeilings)].push_back(SurfNum); - } - } else { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorSurfaces)].push_back(SurfNum); - if (state.dataConstruction->Construct(surf.Construction).TypeIsWindow) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorWindows)].push_back(SurfNum); - } else if (surf.Class == SurfaceClass::Wall) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorWalls)].push_back(SurfNum); - } else if (surf.Class == SurfaceClass::Floor) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorFloors)].push_back(SurfNum); - } else if (surf.Class == SurfaceClass::Roof) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorRoofs)].push_back(SurfNum); - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorCeilings)].push_back(SurfNum); - } - } - } - - // Note, could do same for Window Area and detecting if Interzone Surface in Zone - - if (state.dataSurfaceGeometry->Warning1Count > 0) { - ShowWarningMessage(state, - format("{}Window dimensions differ from Window 5/6 data file dimensions, {} times.", - RoutineName, - state.dataSurfaceGeometry->Warning1Count)); - ShowContinueError(state, "This will affect the frame heat transfer calculation if the frame in the Data File entry"); - ShowContinueError(state, "is not uniform, i.e., has sections with different geometry and/or thermal properties."); - ShowContinueError(state, "For explicit details on each window, use Output:Diagnostics,DisplayExtraWarnings;"); - } - if (state.dataSurfaceGeometry->Warning2Count > 0) { - ShowWarningMessage(state, - format("{}Exterior Windows have been replaced with Window 5/6 two glazing systems, {} times.", - RoutineName, - state.dataSurfaceGeometry->Warning2Count)); - ShowContinueError(state, "Note that originally entered dimensions are overridden."); - ShowContinueError(state, "For explicit details on each window, use Output:Diagnostics,DisplayExtraWarnings;"); - } - if (state.dataSurfaceGeometry->Warning3Count > 0) { - ShowWarningMessage(state, - format("{}Interior Windows have been replaced with Window 5/6 two glazing systems, {} times.", - RoutineName, - state.dataSurfaceGeometry->Warning3Count)); - ShowContinueError(state, "Note that originally entered dimensions are overridden."); - ShowContinueError(state, "For explicit details on each window, use Output:Diagnostics,DisplayExtraWarnings;"); - } - - if (state.dataErrTracking->TotalMultipliedWindows > 0) { - ShowWarningMessage(state, - format("{}There are {} window/glass door(s) that may cause inaccurate shadowing due to Solar Distribution.", - RoutineName, - state.dataErrTracking->TotalMultipliedWindows)); - ShowContinueError(state, "For explicit details on each window, use Output:Diagnostics,DisplayExtraWarnings;"); - state.dataErrTracking->TotalWarningErrors += state.dataErrTracking->TotalMultipliedWindows; - } - if (state.dataErrTracking->TotalCoincidentVertices > 0) { - ShowWarningMessage(state, - format("{}There are {} coincident/collinear vertices; These have been deleted unless the deletion would bring the " - "number of surface sides < 3.", - RoutineName, - state.dataErrTracking->TotalCoincidentVertices)); - ShowContinueError(state, "For explicit details on each problem surface, use Output:Diagnostics,DisplayExtraWarnings;"); - state.dataErrTracking->TotalWarningErrors += state.dataErrTracking->TotalCoincidentVertices; - } - if (state.dataErrTracking->TotalDegenerateSurfaces > 0) { - ShowSevereMessage(state, - format("{}There are {} degenerate surfaces; Degenerate surfaces are those with number of sides < 3.", - RoutineName, - state.dataErrTracking->TotalDegenerateSurfaces)); - ShowContinueError(state, "These surfaces should be deleted."); - ShowContinueError(state, "For explicit details on each problem surface, use Output:Diagnostics,DisplayExtraWarnings;"); - state.dataErrTracking->TotalSevereErrors += state.dataErrTracking->TotalDegenerateSurfaces; - } - - GetHTSurfExtVentedCavityData(state, ErrorsFound); - - state.dataSurfaceGeometry->exposedFoundationPerimeter.getData(state, ErrorsFound); - - GetSurfaceHeatTransferAlgorithmOverrides(state, ErrorsFound); - - // Set up enclosures, process Air Boundaries if any - SetupEnclosuresAndAirBoundaries(state, state.dataViewFactor->EnclRadInfo, SurfaceGeometry::enclosureType::RadiantEnclosures, ErrorsFound); - - GetSurfaceGroundSurfsData(state, ErrorsFound); - - GetSurfaceSrdSurfsData(state, ErrorsFound); - - GetSurfaceLocalEnvData(state, ErrorsFound); - - if (SurfError || ErrorsFound) { - ErrorsFound = true; - ShowFatalError(state, format("{}Errors discovered, program terminates.", RoutineName)); - } + int TotShadSurf = TotDetachedFixed + TotDetachedBldg + TotRectDetachedFixed + TotRectDetachedBldg + TotShdSubs + TotOverhangs + + TotOverhangsProjection + TotFins + TotFinsProjection; + int NumDElightCmplxFen = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Daylighting:DElight:ComplexFenestration"); + if (TotShadSurf > 0 && (NumDElightCmplxFen > 0 || Dayltg::doesDayLightingUseDElight(state))) { + ShowWarningError(state, format("{}When using DElight daylighting the presence of exterior shading surfaces is ignored.", RoutineName)); + } - int TotShadSurf = TotDetachedFixed + TotDetachedBldg + TotRectDetachedFixed + TotRectDetachedBldg + TotShdSubs + TotOverhangs + - TotOverhangsProjection + TotFins + TotFinsProjection; - int NumDElightCmplxFen = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Daylighting:DElight:ComplexFenestration"); - if (TotShadSurf > 0 && (NumDElightCmplxFen > 0 || Dayltg::doesDayLightingUseDElight(state))) { - ShowWarningError(state, - format("{}When using DElight daylighting the presence of exterior shading surfaces is ignored.", RoutineName)); - } + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) { + auto &surf = state.dataSurface->Surface(SurfNum); + // Initialize run time surface arrays + state.dataSurface->SurfActiveConstruction(SurfNum) = surf.Construction; + surf.RepresentativeCalcSurfNum = SurfNum; + } - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) { - auto &surf = state.dataSurface->Surface(SurfNum); - // Initialize run time surface arrays - state.dataSurface->SurfActiveConstruction(SurfNum) = surf.Construction; - surf.RepresentativeCalcSurfNum = SurfNum; - } - - // Representative surface calculations: Assign representative heat transfer surfaces - if (state.dataSurface->UseRepresentativeSurfaceCalculations && - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneProperty:UserViewFactors:BySurfaceName") == 0) { - for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { - for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); - for (int surfNum = thisSpace.HTSurfaceFirst; surfNum <= thisSpace.HTSurfaceLast; surfNum++) { - auto &surface(state.dataSurface->Surface(surfNum)); - // Conditions where surface always needs to be unique - bool forceUniqueSurface = - surface.HasShadeControl || - state.dataSurface->SurfWinAirflowSource(surfNum) != DataSurfaces::WindowAirFlowSource::Invalid || - state.dataConstruction->Construct(surface.Construction).SourceSinkPresent || - surface.Class == SurfaceClass::TDD_Dome || - (surface.Class == SurfaceClass::Window && - (surface.OriginalClass == SurfaceClass::TDD_Diffuser || - state.dataSurface->SurfWinWindowModelType(surfNum) != WindowModel::Detailed || - state.dataWindowManager->inExtWindowModel->isExternalLibraryModel() || - state.dataConstruction->Construct(surface.Construction).TCFlag == 1)); - if (!forceUniqueSurface) { - state.dataSurface->Surface(surfNum).set_representative_surface(state, surfNum); - } + // Representative surface calculations: Assign representative heat transfer surfaces + if (state.dataSurface->UseRepresentativeSurfaceCalculations && + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneProperty:UserViewFactors:BySurfaceName") == 0) { + for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { + for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { + auto &thisSpace = state.dataHeatBal->space(spaceNum); + for (int surfNum = thisSpace.HTSurfaceFirst; surfNum <= thisSpace.HTSurfaceLast; surfNum++) { + auto &surface(state.dataSurface->Surface(surfNum)); + // Conditions where surface always needs to be unique + bool forceUniqueSurface = + surface.HasShadeControl || + state.dataSurface->SurfWinAirflowSource(surfNum) != DataSurfaces::WindowAirFlowSource::Invalid || + state.dataConstruction->Construct(surface.Construction).SourceSinkPresent || surface.Class == SurfaceClass::TDD_Dome || + (surface.Class == SurfaceClass::Window && (surface.OriginalClass == SurfaceClass::TDD_Diffuser || + state.dataSurface->SurfWinWindowModelType(surfNum) != WindowModel::Detailed || + state.dataWindowManager->inExtWindowModel->isExternalLibraryModel() || + state.dataConstruction->Construct(surface.Construction).isTCWindow)); + if (!forceUniqueSurface) { + state.dataSurface->Surface(surfNum).set_representative_surface(state, surfNum); } } } } - // Initialize surface with movable insulation index list - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) { - if (state.dataSurface->SurfMaterialMovInsulExt(SurfNum) > 0 || state.dataSurface->SurfMaterialMovInsulInt(SurfNum) > 0) { - state.dataHeatBalSurf->SurfMovInsulIndexList.push_back(SurfNum); - } + } + + // Initialize surface with movable insulation index list + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) { + if (state.dataSurface->SurfMaterialMovInsulExt(SurfNum) > 0 || state.dataSurface->SurfMaterialMovInsulInt(SurfNum) > 0) { + state.dataHeatBalSurf->SurfMovInsulIndexList.push_back(SurfNum); } } + if (SurfError || ErrorsFound) { ErrorsFound = true; ShowFatalError(state, format("{}Errors discovered, program terminates.", RoutineName)); @@ -2883,6 +2850,8 @@ namespace SurfaceGeometry { } } } + // Right-size space vector + state.dataHeatBal->space.resize(state.dataGlobal->numSpaces); // Assign Spaces to surfaces without one for (int surfNum = 1; surfNum <= state.dataSurface->TotSurfaces; ++surfNum) { @@ -3120,10 +3089,11 @@ namespace SurfaceGeometry { std::string OutMsg; int ZoneNum; // For loop counter bool RelWarning(false); - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "GlobalGeometryRules"; - NumStmt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "GlobalGeometryRules"; + NumStmt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); OutMsg = " Surface Geometry,"; { @@ -3132,17 +3102,17 @@ namespace SurfaceGeometry { if (SELECT_CASE_var == 1) { // This is the valid case state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, 1, GAlphas, NAlphas, GNum, NNum, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // Even though these will be validated, set defaults in case error here -- wont // cause aborts in later surface gets (hopefully) @@ -3153,7 +3123,7 @@ namespace SurfaceGeometry { OK = false; Found = Util::FindItem(GAlphas(1), FlCorners, 4); if (Found == 0) { - ShowSevereError(state, format("{}: Invalid {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), GAlphas(1))); + ShowSevereError(state, format("{}: Invalid {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), GAlphas(1))); ErrorsFound = true; } else { state.dataSurface->Corner = Found; @@ -3173,7 +3143,7 @@ namespace SurfaceGeometry { OK = true; } if (!OK) { - ShowSevereError(state, format("{}: Invalid {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(2), GAlphas(2))); + ShowSevereError(state, format("{}: Invalid {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), GAlphas(2))); ErrorsFound = true; } @@ -3189,8 +3159,8 @@ namespace SurfaceGeometry { OK = true; } if (!OK) { - ShowWarningError(state, format("{}: Invalid {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(3), GAlphas(3))); - ShowContinueError(state, format("{} defaults to \"WorldCoordinateSystem\"", state.dataIPShortCut->cAlphaFieldNames(3))); + ShowWarningError(state, format("{}: Invalid {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(3), GAlphas(3))); + ShowContinueError(state, format("{} defaults to \"WorldCoordinateSystem\"", s_ipsc->cAlphaFieldNames(3))); state.dataSurface->WorldCoordSystem = true; OutMsg += "WorldCoordinateSystem,"; } @@ -3207,8 +3177,8 @@ namespace SurfaceGeometry { OK = true; } if (!OK) { - ShowWarningError(state, format("{}: Invalid {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(4), GAlphas(4))); - ShowContinueError(state, format("{} defaults to \"RelativeToZoneOrigin\"", state.dataIPShortCut->cAlphaFieldNames(4))); + ShowWarningError(state, format("{}: Invalid {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(4), GAlphas(4))); + ShowContinueError(state, format("{} defaults to \"RelativeToZoneOrigin\"", s_ipsc->cAlphaFieldNames(4))); state.dataSurface->DaylRefWorldCoordSystem = false; OutMsg += "RelativeToZoneOrigin,"; } @@ -3225,35 +3195,35 @@ namespace SurfaceGeometry { OK = true; } if (!OK) { - ShowWarningError(state, format("{}: Invalid {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(5), GAlphas(5))); - ShowContinueError(state, format("{} defaults to \"RelativeToZoneOrigin\"", state.dataIPShortCut->cAlphaFieldNames(5))); + ShowWarningError(state, format("{}: Invalid {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(5), GAlphas(5))); + ShowContinueError(state, format("{} defaults to \"RelativeToZoneOrigin\"", s_ipsc->cAlphaFieldNames(5))); state.dataSurfaceGeometry->RectSurfRefWorldCoordSystem = false; OutMsg += "RelativeToZoneOrigin"; } } else if (SELECT_CASE_var == 0) { - ShowSevereError(state, format("{}: Required object not found.", cCurrentModuleObject)); + ShowSevereError(state, format("{}: Required object not found.", s_ipsc->cCurrentModuleObject)); OutMsg += "None found in input"; ErrorsFound = true; } else { - ShowSevereError(state, format("{}: Too many objects entered. Only one allowed.", cCurrentModuleObject)); + ShowSevereError(state, format("{}: Too many objects entered. Only one allowed.", s_ipsc->cCurrentModuleObject)); ErrorsFound = true; } } if (!state.dataSurface->WorldCoordSystem) { if (state.dataSurface->DaylRefWorldCoordSystem) { - ShowWarningError(state, format("{}: Potential mismatch of coordinate specifications.", cCurrentModuleObject)); - ShowContinueError(state, format("{}=\"{}\"; while ", state.dataIPShortCut->cAlphaFieldNames(3), GAlphas(3))); - ShowContinueError(state, format("{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(4), GAlphas(4))); + ShowWarningError(state, format("{}: Potential mismatch of coordinate specifications.", s_ipsc->cCurrentModuleObject)); + ShowContinueError(state, format("{}=\"{}\"; while ", s_ipsc->cAlphaFieldNames(3), GAlphas(3))); + ShowContinueError(state, format("{}=\"{}\".", s_ipsc->cAlphaFieldNames(4), GAlphas(4))); } if (state.dataSurfaceGeometry->RectSurfRefWorldCoordSystem) { - ShowWarningError(state, format("{}: Potential mismatch of coordinate specifications.", cCurrentModuleObject)); - ShowContinueError(state, format("{}=\"{}\"; while ", state.dataIPShortCut->cAlphaFieldNames(3), GAlphas(3))); - ShowContinueError(state, format("{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(5), GAlphas(5))); + ShowWarningError(state, format("{}: Potential mismatch of coordinate specifications.", s_ipsc->cCurrentModuleObject)); + ShowContinueError(state, format("{}=\"{}\"; while ", s_ipsc->cAlphaFieldNames(3), GAlphas(3))); + ShowContinueError(state, format("{}=\"{}\".", s_ipsc->cAlphaFieldNames(5), GAlphas(5))); } } else { RelWarning = false; @@ -3266,12 +3236,12 @@ namespace SurfaceGeometry { ShowWarningError(state, format("{}: Potential mismatch of coordinate specifications. Note that the rectangular surfaces are relying on the " "default SurfaceGeometry for 'Relative to zone' coordinate.", - cCurrentModuleObject)); - ShowContinueError(state, format("{}=\"{}\"; while ", state.dataIPShortCut->cAlphaFieldNames(3), GAlphas(3))); + s_ipsc->cCurrentModuleObject)); + ShowContinueError(state, format("{}=\"{}\"; while ", s_ipsc->cAlphaFieldNames(3), GAlphas(3))); if (GAlphas(5) == "RELATIVE") { - ShowContinueError(state, format("{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(5), GAlphas(5))); + ShowContinueError(state, format("{}=\"{}\".", s_ipsc->cAlphaFieldNames(5), GAlphas(5))); } else if (GAlphas(5) != "ABSOLUTE") { - ShowContinueError(state, format("{}=\"defaults to RELATIVE\".", state.dataIPShortCut->cAlphaFieldNames(5))); + ShowContinueError(state, format("{}=\"defaults to RELATIVE\".", s_ipsc->cAlphaFieldNames(5))); } } } @@ -3318,7 +3288,7 @@ namespace SurfaceGeometry { Real64 SchedMinValue; Real64 SchedMaxValue; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + auto &s_ipsc = state.dataIPShortCut; if ((TotDetachedFixed + TotDetachedBldg) > 0 && state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { ShowWarningError(state, "Detached shading effects are ignored when Solar Distribution = MinimalShadowing"); @@ -3328,7 +3298,7 @@ namespace SurfaceGeometry { for (Item = 1; Item <= 2; ++Item) { - cCurrentModuleObject = cModuleObjects(Item); + s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { ItemsToGet = TotDetachedFixed; ClassItem = SurfaceClass::Detached_F; @@ -3337,53 +3307,53 @@ namespace SurfaceGeometry { ClassItem = SurfaceClass::Detached_B; } - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, Loop, NumAlphas, NumNumbers); + state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, s_ipsc->cCurrentModuleObject, Loop, NumAlphas, NumNumbers); if (NumAlphas != 2) { ShowSevereError( - state, format("{}: Object Definition indicates not = 2 Alpha Objects, Number Indicated={}", cCurrentModuleObject, NumAlphas)); + state, + format("{}: Object Definition indicates not = 2 Alpha Objects, Number Indicated={}", s_ipsc->cCurrentModuleObject, NumAlphas)); ErrorsFound = true; } for (Loop = 1; Loop <= ItemsToGet; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound)) { continue; } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Set the Surface Name in the Derived Type + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = ClassItem; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = true; // Base transmittance of a shadowing (sub)surface - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { + if (!s_ipsc->lAlphaFieldBlanks(2)) { // Schedule for a shadowing (sub)surface - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = - GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = GetScheduleIndex(state, s_ipsc->cAlphaArgs(2)); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex == 0) { ShowSevereError(state, format("{}=\"{}\", {} not found={}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } } else { @@ -3393,10 +3363,10 @@ namespace SurfaceGeometry { if (!CheckScheduleValueMinMax(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex, ">=", 0.0, "<=", 1.0)) { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\", values not in range [0,1].", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } SchedMinValue = GetScheduleMinValue(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex); @@ -3409,10 +3379,10 @@ namespace SurfaceGeometry { if (SchedMinValue < 0.0) { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\", has schedule values < 0.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...Schedule values < 0 have no meaning for shading elements."); } if (SchedMaxValue > 0.0) { @@ -3421,56 +3391,54 @@ namespace SurfaceGeometry { if (SchedMaxValue > 1.0) { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\", has schedule values > 1.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...Schedule values > 1 have no meaning for shading elements."); } if (std::abs(SchedMinValue - SchedMaxValue) > Constant::OneMillionth) { state.dataSurface->ShadingTransmittanceVaries = true; } } - if (state.dataIPShortCut->lNumericFieldBlanks(1) || state.dataIPShortCut->rNumericArgs(1) == Constant::AutoCalculate) { + if (s_ipsc->lNumericFieldBlanks(1) || s_ipsc->rNumericArgs(1) == Constant::AutoCalculate) { numSides = (NumNumbers - 1) / 3; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = numSides; if (mod(NumNumbers - 1, 3) != 0) { ShowWarningError(state, format("{}=\"{}\", {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, format("{} not even multiple of 3. Will read in {}", - state.dataIPShortCut->cNumericFieldNames(1), + s_ipsc->cNumericFieldNames(1), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); } if (numSides < 3) { ShowSevereError(state, format("{}=\"{}\", {} (autocalculate) must be >= 3. Only {} provided.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cNumericFieldNames(1), + s_ipsc->cNumericFieldNames(1), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides)); ErrorsFound = true; continue; } } else { numSides = (NumNumbers - 1) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = state.dataIPShortCut->rNumericArgs(1); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(1); if (numSides > state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides) { ShowWarningError(state, format("{}=\"{}\", field {}={}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cNumericFieldNames(1), + s_ipsc->cNumericFieldNames(1), fmt::to_string(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); - ShowContinueError(state, - format("...but {} were entered. Only the indicated {} will be used.", - numSides, - state.dataIPShortCut->cNumericFieldNames(1))); + ShowContinueError( + state, format("...but {} were entered. Only the indicated {} will be used.", numSides, s_ipsc->cNumericFieldNames(1))); } } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, state.dataIPShortCut->rNumericArgs({2, _})); + GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, s_ipsc->rNumericArgs({2, _})); CheckConvexity(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); if (state.dataReportFlag->MakeMirroredDetachedShading) { MakeMirrorSurface(state, SurfNum); @@ -3511,15 +3479,16 @@ namespace SurfaceGeometry { int ItemsToGet; SurfaceClass ClassItem; + auto &s_ipsc = state.dataIPShortCut; + if ((TotRectDetachedFixed + TotRectDetachedBldg) > 0 && state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { ShowWarningError(state, "Detached shading effects are ignored when Solar Distribution = MinimalShadowing"); } if (TotRectDetachedFixed + TotRectDetachedBldg == 0) return; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; for (Item = 1; Item <= 2; ++Item) { - cCurrentModuleObject = cModuleObjects(Item); + s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { ItemsToGet = TotRectDetachedFixed; ClassItem = SurfaceClass::Detached_F; @@ -3528,50 +3497,51 @@ namespace SurfaceGeometry { ClassItem = SurfaceClass::Detached_B; } - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, Loop, NumAlphas, NumNumbers); + state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, s_ipsc->cCurrentModuleObject, Loop, NumAlphas, NumNumbers); if (NumAlphas != 1) { ShowSevereError( - state, format("{}: Object Definition indicates not = 1 Alpha Objects, Number Indicated={}", cCurrentModuleObject, NumAlphas)); + state, + format("{}: Object Definition indicates not = 1 Alpha Objects, Number Indicated={}", s_ipsc->cCurrentModuleObject, NumAlphas)); ErrorsFound = true; } for (Loop = 1; Loop <= ItemsToGet; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound)) { continue; } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Set the Surface Name in the Derived Type + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = ClassItem; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = state.dataIPShortCut->rNumericArgs(1); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = s_ipsc->rNumericArgs(1); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Detached_B && !state.dataSurface->WorldCoordSystem) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth += state.dataHeatBal->BuildingAzimuth; } if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Detached_B) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth += state.dataHeatBal->BuildingRotationAppendixG; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = state.dataIPShortCut->rNumericArgs(2); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = s_ipsc->rNumericArgs(2); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); @@ -3580,17 +3550,17 @@ namespace SurfaceGeometry { MakeRectangularVertices(state, SurfNum, - state.dataIPShortCut->rNumericArgs(3), - state.dataIPShortCut->rNumericArgs(4), - state.dataIPShortCut->rNumericArgs(5), - state.dataIPShortCut->rNumericArgs(6), - state.dataIPShortCut->rNumericArgs(7), + s_ipsc->rNumericArgs(3), + s_ipsc->rNumericArgs(4), + s_ipsc->rNumericArgs(5), + s_ipsc->rNumericArgs(6), + s_ipsc->rNumericArgs(7), state.dataSurfaceGeometry->RectSurfRefWorldCoordSystem); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area <= 0.0) { ShowSevereError(state, format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); ErrorsFound = true; @@ -3747,15 +3717,16 @@ namespace SurfaceGeometry { int ArgPointer; int numSides; + auto &s_ipsc = state.dataIPShortCut; + GetOSCData(state, ErrorsFound); GetOSCMData(state, ErrorsFound); GetFoundationData(state, ErrorsFound); NeedToAddSurfaces = 0; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; for (Item = 1; Item <= 4; ++Item) { - cCurrentModuleObject = cModuleObjects(Item); + s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { ItemsToGet = TotHTSurfs; ClassItem = 0; @@ -3770,59 +3741,62 @@ namespace SurfaceGeometry { ClassItem = 3; } - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, Loop, SurfaceNumAlpha, SurfaceNumProp); + state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs( + state, s_ipsc->cCurrentModuleObject, Loop, SurfaceNumAlpha, SurfaceNumProp); if (Item == 1) { if (SurfaceNumAlpha != 9) { - ShowSevereError( - state, - format("{}: Object Definition indicates not = 9 Alpha Objects, Number Indicated={}", cCurrentModuleObject, SurfaceNumAlpha)); + ShowSevereError(state, + format("{}: Object Definition indicates not = 9 Alpha Objects, Number Indicated={}", + s_ipsc->cCurrentModuleObject, + SurfaceNumAlpha)); ErrorsFound = true; } } else { if (SurfaceNumAlpha != 8) { - ShowSevereError( - state, - format("{}: Object Definition indicates not = 8 Alpha Objects, Number Indicated={}", cCurrentModuleObject, SurfaceNumAlpha)); + ShowSevereError(state, + format("{}: Object Definition indicates not = 8 Alpha Objects, Number Indicated={}", + s_ipsc->cCurrentModuleObject, + SurfaceNumAlpha)); ErrorsFound = true; } } for (Loop = 1; Loop <= ItemsToGet; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, SurfaceNumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, SurfaceNumProp, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound)) { continue; } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Set the Surface Name in the Derived Type + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type ArgPointer = 2; if (Item == 1) { - if (state.dataIPShortCut->cAlphaArgs(2) == "CEILING") state.dataIPShortCut->cAlphaArgs(2) = "ROOF"; - ClassItem = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), BaseSurfCls, 3); + if (s_ipsc->cAlphaArgs(2) == "CEILING") s_ipsc->cAlphaArgs(2) = "ROOF"; + ClassItem = Util::FindItemInList(s_ipsc->cAlphaArgs(2), BaseSurfCls, 3); if (ClassItem == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = BaseSurfIDs(ClassItem); @@ -3832,28 +3806,27 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = BaseSurfIDs(ClassItem); } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = Util::FindItemInList( - state.dataIPShortCut->cAlphaArgs(ArgPointer), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = + Util::FindItemInList(s_ipsc->cAlphaArgs(ArgPointer), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction == 0) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); } else if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" - has Window materials.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); if (Item == 1) { - ShowContinueError(state, - format("...because {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); + ShowContinueError(state, format("...because {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); } else { ShowContinueError(state, format("...because Surface Type={}", BaseSurfCls(ClassItem))); } @@ -3867,7 +3840,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; ++ArgPointer; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = state.dataIPShortCut->cAlphaArgs(ArgPointer); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = s_ipsc->cAlphaArgs(ArgPointer); ZoneNum = Util::FindItemInList( state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); @@ -3876,38 +3849,38 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; ErrorsFound = true; } ++ArgPointer; - if (!state.dataIPShortCut->lAlphaFieldBlanks(ArgPointer)) { - int spaceNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(ArgPointer), state.dataHeatBal->space); + if (!s_ipsc->lAlphaFieldBlanks(ArgPointer)) { + int spaceNum = Util::FindItemInList(s_ipsc->cAlphaArgs(ArgPointer), state.dataHeatBal->space); if (spaceNum != 0) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum = spaceNum; if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone != state.dataHeatBal->space(spaceNum).zoneNum) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" is not in the same zone as the surface.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; ErrorsFound = true; } } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" not found.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; ErrorsFound = true; } @@ -3916,23 +3889,23 @@ namespace SurfaceGeometry { // can take place. The conditions are set with a 0, -1, or -2, or all of the // zone names have to be looked at and generate the interzone array number ++ArgPointer; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataIPShortCut->cAlphaArgs(ArgPointer + 1); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(ArgPointer + 1); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "Outdoors")) { + if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Outdoors")) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = ExternalEnvironment; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "Adiabatic")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Adiabatic")) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnreconciledZoneSurface; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "Ground")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Ground")) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = Ground; if (state.dataSurfaceGeometry->NoGroundTempObjWarning) { if (!state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::BuildingSurface]) { ShowWarningError(state, "GetHTSurfaceData: Surfaces with interface to Ground found but no \"Ground Temperatures\" were input."); - ShowContinueError(state, format("Found first in surface={}", state.dataIPShortCut->cAlphaArgs(1))); + ShowContinueError(state, format("Found first in surface={}", s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Defaults, constant throughout the year of ({:.1R}) will be used.", state.dataEnvrn->GroundTemp[(int)DataEnvironment::GroundTempType::BuildingSurface])); @@ -3941,14 +3914,14 @@ namespace SurfaceGeometry { } // Added for FCfactor method - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "GroundFCfactorMethod")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundFCfactorMethod")) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = GroundFCfactorMethod; if (state.dataSurfaceGeometry->NoFCGroundTempObjWarning) { if (!state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::FCFactorMethod]) { ShowSevereError(state, "GetHTSurfaceData: Surfaces with interface to GroundFCfactorMethod found but no \"FC Ground " "Temperatures\" were input."); - ShowContinueError(state, format("Found first in surface={}", state.dataIPShortCut->cAlphaArgs(1))); + ShowContinueError(state, format("Found first in surface={}", s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Either add a \"Site:GroundTemperature:FCfactorMethod\" object or use a weather file with " "Ground Temperatures."); @@ -3961,9 +3934,9 @@ namespace SurfaceGeometry { !state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { ShowSevereError(state, format("{}=\"{}\", invalid {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer))); ShowContinueError( state, format("Construction=\"{}\" is not type Construction:CfactorUndergroundWall.", @@ -3974,9 +3947,9 @@ namespace SurfaceGeometry { !state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { ShowSevereError(state, format("{}=\"{}\", invalid {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer))); ShowContinueError( state, format("Construction=\"{}\" is not type Construction:FfactorGroundFloor.", @@ -3985,16 +3958,16 @@ namespace SurfaceGeometry { } } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "OtherSideCoefficients")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "OtherSideCoefficients")) { Found = Util::FindItemInList( state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataSurface->OSC, state.dataSurface->TotOSC); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer + 1), - state.dataIPShortCut->cAlphaArgs(ArgPointer + 1))); + s_ipsc->cAlphaFieldNames(ArgPointer + 1), + s_ipsc->cAlphaArgs(ArgPointer + 1))); ShowContinueError(state, " no OtherSideCoefficients of that name."); ErrorsFound = true; } else { @@ -4006,24 +3979,24 @@ namespace SurfaceGeometry { } } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "Surface")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Surface")) { // it has to be another surface which needs to be found // this will be found on the second pass through the surface input // for flagging, set the value to UnreconciledZoneSurface // name (ExtBoundCondName) will be validated later. state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnreconciledZoneSurface; - if (state.dataIPShortCut->lAlphaFieldBlanks(ArgPointer + 1)) { + if (s_ipsc->lAlphaFieldBlanks(ArgPointer + 1)) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; ShowSevereError(state, format("{}=\"{}\", invalid {}=.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer + 1))); - ShowContinueError(state, format("..{}=\"Surface\" must be non-blank.", state.dataIPShortCut->cAlphaFieldNames(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer + 1))); + ShowContinueError(state, format("..{}=\"Surface\" must be non-blank.", s_ipsc->cAlphaFieldNames(ArgPointer))); ShowContinueError(state, "..This surface will become an adiabatic surface - no doors/windows allowed."); } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "Zone")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Zone")) { // This is the code for an unmatched "other surface" // will be set up later. state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnenteredAdjacentZoneSurface; @@ -4035,21 +4008,21 @@ namespace SurfaceGeometry { if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); ShowContinueError(state, "..Referenced as Zone for this surface."); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "Foundation")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Foundation")) { if (!state.dataWeather->WeatherFileExists) { ShowSevereError( state, format("{}=\"{}\", using \"Foundation\" type Outside Boundary Condition requires specification of a weather file", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); ShowContinueError(state, "Either place in.epw in the working directory or specify a weather file on the command line using -w " @@ -4058,7 +4031,7 @@ namespace SurfaceGeometry { } // Find foundation object, if blank use default - if (state.dataIPShortCut->lAlphaFieldBlanks(ArgPointer + 1)) { + if (s_ipsc->lAlphaFieldBlanks(ArgPointer + 1)) { if (!state.dataSurfaceGeometry->kivaManager.defaultAdded) { // Add default foundation if no other foundation object specified @@ -4074,10 +4047,10 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer + 1), - state.dataIPShortCut->cAlphaArgs(ArgPointer + 1))); + s_ipsc->cAlphaFieldNames(ArgPointer + 1), + s_ipsc->cAlphaArgs(ArgPointer + 1))); ErrorsFound = true; } } @@ -4085,50 +4058,50 @@ namespace SurfaceGeometry { if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { ShowSevereError(state, format("{}=\"{}\", construction may not have an internal source/sink", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); ErrorsFound = true; } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = KivaFoundation; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "OtherSideConditionsModel")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "OtherSideConditionsModel")) { Found = Util::FindItemInList( state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataSurface->OSCM, state.dataSurface->TotOSCM); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer + 1), - state.dataIPShortCut->cAlphaArgs(ArgPointer + 1))); + s_ipsc->cAlphaFieldNames(ArgPointer + 1), + s_ipsc->cAlphaArgs(ArgPointer + 1))); ErrorsFound = true; } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCMPtr = Found; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = OtherSideCondModeledExt; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "GroundSlabPreprocessorAverage") || - Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "GroundSlabPreprocessorCore") || - Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "GroundSlabPreprocessorPerimeter") || - Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "GroundBasementPreprocessorAverageFloor") || - Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "GroundBasementPreprocessorAverageWall") || - Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "GroundBasementPreprocessorUpperWall") || - Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "GroundBasementPreprocessorLowerWall")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundSlabPreprocessorAverage") || + Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundSlabPreprocessorCore") || + Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundSlabPreprocessorPerimeter") || + Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundBasementPreprocessorAverageFloor") || + Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundBasementPreprocessorAverageWall") || + Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundBasementPreprocessorUpperWall") || + Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundBasementPreprocessorLowerWall")) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); ShowContinueError(state, "The ExpandObjects program has not been run or is not in your EnergyPlus.exe folder."); ErrorsFound = true; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); ShowContinueError(state, "Should be one of \"Outdoors\", \"Adiabatic\", Ground\", \"Surface\", \"OtherSideCoefficients\", " "\"OtherSideConditionsModel\" or \"Zone\""); @@ -4137,44 +4110,44 @@ namespace SurfaceGeometry { ArgPointer += 2; // Set the logical flag for the exterior solar - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "SunExposed")) { + if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "SunExposed")) { if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond != ExternalEnvironment) && (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond != OtherSideCondModeledExt)) { ShowWarningError(state, format("{}=\"{}\", {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); ShowContinueError(state, "..This surface is not exposed to External Environment. Sun exposure has no effect."); } else { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "NoSun")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "NoSun")) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = false; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); ErrorsFound = true; } ++ArgPointer; // Set the logical flag for the exterior wind - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "WindExposed")) { + if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "WindExposed")) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = true; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(ArgPointer), "NoWind")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "NoWind")) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = false; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(ArgPointer), - state.dataIPShortCut->cAlphaArgs(ArgPointer))); + s_ipsc->cAlphaFieldNames(ArgPointer), + s_ipsc->cAlphaArgs(ArgPointer))); ErrorsFound = true; } @@ -4183,66 +4156,63 @@ namespace SurfaceGeometry { // state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtEcoRoof = // state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsEcoRoof; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = state.dataIPShortCut->rNumericArgs(1); - if (state.dataIPShortCut->lNumericFieldBlanks(1)) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = Constant::AutoCalculate; - if (state.dataIPShortCut->lNumericFieldBlanks(2) || state.dataIPShortCut->rNumericArgs(2) == Constant::AutoCalculate) { + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = s_ipsc->rNumericArgs(1); + if (s_ipsc->lNumericFieldBlanks(1)) state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = Constant::AutoCalculate; + if (s_ipsc->lNumericFieldBlanks(2) || s_ipsc->rNumericArgs(2) == Constant::AutoCalculate) { numSides = (SurfaceNumProp - 2) / 3; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = numSides; if (mod(SurfaceNumProp - 2, 3) != 0) { ShowWarningError(state, format("{}=\"{}\", {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, format("{} not even multiple of 3. Will read in {}", - state.dataIPShortCut->cNumericFieldNames(2), + s_ipsc->cNumericFieldNames(2), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); } if (numSides < 3) { ShowSevereError(state, format("{}=\"{}\", {} (autocalculate) must be >= 3. Only {} provided.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cNumericFieldNames(2), + s_ipsc->cNumericFieldNames(2), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides)); ErrorsFound = true; continue; } } else { numSides = (SurfaceNumProp - 2) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = state.dataIPShortCut->rNumericArgs(2); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(2); if (numSides > state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides) { ShowWarningError(state, format("{}=\"{}\", field {}={}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cNumericFieldNames(2), + s_ipsc->cNumericFieldNames(2), fmt::to_string(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); - ShowContinueError(state, - format("...but {} were entered. Only the indicated {} will be used.", - numSides, - state.dataIPShortCut->cNumericFieldNames(2))); + ShowContinueError( + state, format("...but {} were entered. Only the indicated {} will be used.", numSides, s_ipsc->cNumericFieldNames(2))); } } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewVertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, state.dataIPShortCut->rNumericArgs({3, _})); + GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, s_ipsc->rNumericArgs({3, _})); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area <= 0.0) { ShowSevereError(state, format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); ErrorsFound = true; } CheckConvexity(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "Surface")) { + if (Util::SameString(s_ipsc->cAlphaArgs(5), "Surface")) { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides != static_cast(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.size())) { ShowSevereError(state, format("{}=\"{}\", After CheckConvexity, mismatch between Sides ({}) and size of Vertex ({}).", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.size())); @@ -4259,7 +4229,7 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Height) > 0.05) { ShowWarningError(state, format("{}=\"{}\", underground Wall Height = {:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height)); ShowContinueError(state, "..which does not match its construction height."); @@ -4273,7 +4243,7 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Area) > 0.1) { ShowWarningError(state, format("{}=\"{}\", underground Floor Area = {:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); ShowContinueError(state, "..which does not match its construction area."); @@ -4282,7 +4252,7 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).PerimeterExposed - 0.1) { ShowWarningError(state, format("{}=\"{}\", underground Floor Perimeter = {:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter)); ShowContinueError(state, "..which is less than its construction exposed perimeter."); @@ -4301,7 +4271,7 @@ namespace SurfaceGeometry { if (ExtSurfNum == 0) { ShowSevereError(state, format("{}=\"{}\" references an outside boundary surface that cannot be found:{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(i).Name, state.dataSurfaceGeometry->SurfaceTmp(i).ExtBoundCondName)); ErrorsFound = true; @@ -4310,7 +4280,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(ExtSurfNum).Vertex.size()) { ShowSevereError(state, format("{}=\"{}\", Vertex size mismatch between base surface :{} and outside boundary surface: {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(i).Name, state.dataSurfaceGeometry->SurfaceTmp(i).Name, state.dataSurfaceGeometry->SurfaceTmp(ExtSurfNum).Name)); @@ -4378,10 +4348,12 @@ namespace SurfaceGeometry { int ExtBoundCondition; int ClassItem; int ZoneNum; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + + auto &s_ipsc = state.dataIPShortCut; + for (Item = 1; Item <= 10; ++Item) { - cCurrentModuleObject = cModuleObjects(Item); + s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { ItemsToGet = TotRectExtWalls; GettingIZSurfaces = false; @@ -4446,61 +4418,58 @@ namespace SurfaceGeometry { for (Loop = 1; Loop <= ItemsToGet; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound)) { continue; } if (NumNumbers < 7) { - ShowSevereError(state, - format("{}=\"{}\", Too few number of numeric args=[{}].", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - NumNumbers)); + ShowSevereError( + state, + format("{}=\"{}\", Too few number of numeric args=[{}].", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), NumNumbers)); ErrorsFound = true; } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Set the Surface Name in the Derived Type - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = BaseSurfIDs(ClassItem); // Set class number + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = BaseSurfIDs(ClassItem); // Set class number state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction == 0) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); } else if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" - has Window materials.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, - format("...because {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, format("...because {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); } else { state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).IsUsed = true; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ConstructionStoredInputValue = @@ -4510,7 +4479,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = SurfNum; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = state.dataIPShortCut->cAlphaArgs(3); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = s_ipsc->cAlphaArgs(3); ZoneNum = Util::FindItemInList( state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); @@ -4519,27 +4488,27 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; ErrorsFound = true; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - int spaceNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataHeatBal->space); + if (!s_ipsc->lAlphaFieldBlanks(4)) { + int spaceNum = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->space); if (spaceNum != 0) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum = spaceNum; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; ErrorsFound = true; } @@ -4555,7 +4524,7 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", Construction type is \"Construction:CfactorUndergroundWall\" but invalid for this object.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); } if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Floor && @@ -4566,7 +4535,7 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", Construction type is \"Construction:FfactorGroundFloor\" but invalid for this object.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); } } @@ -4585,7 +4554,7 @@ namespace SurfaceGeometry { } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { if (GettingIZSurfaces) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataIPShortCut->cAlphaArgs(OtherSurfaceField); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(OtherSurfaceField); Found = Util::FindItemInList( state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); // see if match to zone, then it's an unentered other surface, else reconciled later @@ -4603,7 +4572,7 @@ namespace SurfaceGeometry { if (!state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::BuildingSurface]) { ShowWarningError(state, "GetRectSurfaces: Surfaces with interface to Ground found but no \"Ground Temperatures\" were input."); - ShowContinueError(state, format("Found first in surface={}", state.dataIPShortCut->cAlphaArgs(1))); + ShowContinueError(state, format("Found first in surface={}", s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Defaults, constant throughout the year of ({:.1R}) will be used.", state.dataEnvrn->GroundTemp[(int)DataEnvironment::GroundTempType::BuildingSurface])); @@ -4617,7 +4586,7 @@ namespace SurfaceGeometry { ShowSevereError(state, "GetRectSurfaces: Surfaces with interface to GroundFCfactorMethod found but no \"FC Ground " "Temperatures\" were input."); - ShowContinueError(state, format("Found first in surface={}", state.dataIPShortCut->cAlphaArgs(1))); + ShowContinueError(state, format("Found first in surface={}", s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Either add a \"Site:GroundTemperature:FCfactorMethod\" object or use a weather file with " "Ground Temperatures."); @@ -4628,8 +4597,8 @@ namespace SurfaceGeometry { } // ... End of the ExtBoundCond logical IF Block - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = state.dataIPShortCut->rNumericArgs(1); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = state.dataIPShortCut->rNumericArgs(2); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = s_ipsc->rNumericArgs(1); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = s_ipsc->rNumericArgs(2); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); if (!state.dataSurface->WorldCoordSystem) { @@ -4647,17 +4616,17 @@ namespace SurfaceGeometry { MakeRectangularVertices(state, SurfNum, - state.dataIPShortCut->rNumericArgs(3), - state.dataIPShortCut->rNumericArgs(4), - state.dataIPShortCut->rNumericArgs(5), - state.dataIPShortCut->rNumericArgs(6), - state.dataIPShortCut->rNumericArgs(7), + s_ipsc->rNumericArgs(3), + s_ipsc->rNumericArgs(4), + s_ipsc->rNumericArgs(5), + s_ipsc->rNumericArgs(6), + s_ipsc->rNumericArgs(7), state.dataSurfaceGeometry->RectSurfRefWorldCoordSystem); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area <= 0.0) { ShowSevereError(state, format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); ErrorsFound = true; @@ -4670,7 +4639,7 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Height) > 0.05) { ShowWarningError(state, format("{}=\"{}\", underground Wall Height = {:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height)); ShowContinueError(state, "..which deos not match its construction height."); @@ -4684,7 +4653,7 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Area) > 0.1) { ShowWarningError(state, format("{}=\"{}\", underground Floor Area = {:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); ShowContinueError(state, "..which does not match its construction area."); @@ -4693,7 +4662,7 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).PerimeterExposed - 0.1) { ShowWarningError(state, format("{}=\"{}\", underground Floor Perimeter = {:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter)); ShowContinueError(state, "..which is less than its construction exposed perimeter."); @@ -4993,43 +4962,46 @@ namespace SurfaceGeometry { int ValidChk; int numSides; + auto &s_ipsc = state.dataIPShortCut; + GetWindowShadingControlData(state, ErrorsFound); - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "FenestrationSurface:Detailed"; - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, Loop, SurfaceNumAlpha, SurfaceNumProp); + s_ipsc->cCurrentModuleObject = "FenestrationSurface:Detailed"; + state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, s_ipsc->cCurrentModuleObject, Loop, SurfaceNumAlpha, SurfaceNumProp); if (SurfaceNumAlpha != 6) { ShowSevereError( - state, format("{}: Object Definition indicates not = 6 Alpha Objects, Number Indicated={}", cCurrentModuleObject, SurfaceNumAlpha)); + state, + format("{}: Object Definition indicates not = 6 Alpha Objects, Number Indicated={}", s_ipsc->cCurrentModuleObject, SurfaceNumAlpha)); ErrorsFound = true; } if (SurfaceNumProp != 15) { ShowSevereError( - state, format("{}: Object Definition indicates > 15 Numeric Objects, Number Indicated={}", cCurrentModuleObject, SurfaceNumAlpha)); + state, + format("{}: Object Definition indicates > 15 Numeric Objects, Number Indicated={}", s_ipsc->cCurrentModuleObject, SurfaceNumAlpha)); ErrorsFound = true; } NeedToAddSurfaces = 0; for (Loop = 1; Loop <= TotHTSubs; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, SurfaceNumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, SurfaceNumProp, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound)) { continue; } @@ -5037,37 +5009,37 @@ namespace SurfaceGeometry { if (SurfaceNumProp < 12) { ShowSevereError(state, format("{}=\"{}\", Too few number of numeric args=[{}].", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, SurfaceNumProp)); ErrorsFound = true; } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Set the Surface Name in the Derived Type - ValidChk = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), SubSurfCls, 6); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + ValidChk = Util::FindItemInList(s_ipsc->cAlphaArgs(2), SubSurfCls, 6); if (ValidChk == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SubSurfIDs(ValidChk); // Set class number } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ErrorsFound = true; continue; } else { @@ -5087,14 +5059,14 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" has an opaque surface construction; it should have a window construction.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); } if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\": Windows are not allowed to have embedded sources/sinks", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); } } @@ -5104,18 +5076,17 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" - has Window materials.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, - format("...because {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); + ShowContinueError(state, format("...because {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); } } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataIPShortCut->cAlphaArgs(4); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = s_ipsc->cAlphaArgs(4); // The subsurface inherits properties from the base surface // Exterior conditions, Zone, etc. // We can figure out the base surface though, because they've all been entered @@ -5135,10 +5106,10 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(Found).Name) { // Adiabatic surface, no windows or doors allowed ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, "... adiabatic surfaces cannot have windows or doors."); ShowContinueError(state, "... no solar transmission will result for these windows or doors. You must have interior windows or doors on " @@ -5147,10 +5118,10 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; ErrorsFound = true; } @@ -5160,35 +5131,35 @@ namespace SurfaceGeometry { } if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == ExternalEnvironment) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(5)) { + if (!s_ipsc->lAlphaFieldBlanks(5)) { ShowWarningError(state, format("{}=\"{}\", invalid field {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(5))); + s_ipsc->cAlphaFieldNames(5))); ShowContinueError( state, format("...when Base surface uses \"Outdoors\" as {}, subsurfaces need to be blank to inherit the outdoor characteristics.", - state.dataIPShortCut->cAlphaFieldNames(5))); + s_ipsc->cAlphaFieldNames(5))); ShowContinueError(state, "...Surface external characteristics changed to reflect base surface."); } } if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { // "Surface" Base Surface - if (!state.dataIPShortCut->lAlphaFieldBlanks(5)) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataIPShortCut->cAlphaArgs(5); + if (!s_ipsc->lAlphaFieldBlanks(5)) { + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(5); } else { ShowSevereError(state, format("{}=\"{}\", invalid blank {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(5))); + s_ipsc->cAlphaFieldNames(5))); ShowContinueError( state, format("...when Base surface uses \"Surface\" as {}, subsurfaces must also specify specific surfaces in the adjacent zone.", - state.dataIPShortCut->cAlphaFieldNames(5))); + s_ipsc->cAlphaFieldNames(5))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = - state.dataIPShortCut->cAlphaArgs(5); // putting it as blank will not confuse things later. + s_ipsc->cAlphaArgs(5); // putting it as blank will not confuse things later. ErrorsFound = true; } } @@ -5200,22 +5171,22 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt || state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefCalcExt) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(5)) { // Otherside Coef special Name - Found = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(5), state.dataSurface->OSC, state.dataSurface->TotOSC); + if (!s_ipsc->lAlphaFieldBlanks(5)) { // Otherside Coef special Name + Found = Util::FindItemInList(s_ipsc->cAlphaArgs(5), state.dataSurface->OSC, state.dataSurface->TotOSC); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); ShowContinueError(state, "...base surface requires that this subsurface have OtherSideCoefficients -- not found."); ErrorsFound = true; } else { // found // The following allows for a subsurface that has different characteristics than // the base surface with OtherSide Coeff -- do we want that or is it an error? state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCPtr = Found; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataIPShortCut->cAlphaArgs(5); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(5); if (state.dataSurface->OSC(Found).SurfFilmCoef > 0.0) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = OtherSideCoefCalcExt; } else { @@ -5232,71 +5203,67 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName == BlankString) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = state.dataIPShortCut->rNumericArgs(1); - if (state.dataIPShortCut->lNumericFieldBlanks(1)) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = Constant::AutoCalculate; + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = s_ipsc->rNumericArgs(1); + if (s_ipsc->lNumericFieldBlanks(1)) state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = Constant::AutoCalculate; - if (state.dataIPShortCut->lNumericFieldBlanks(3) || state.dataIPShortCut->rNumericArgs(3) == Constant::AutoCalculate) { - state.dataIPShortCut->rNumericArgs(3) = (SurfaceNumProp - 3) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = state.dataIPShortCut->rNumericArgs(3); + if (s_ipsc->lNumericFieldBlanks(3) || s_ipsc->rNumericArgs(3) == Constant::AutoCalculate) { + s_ipsc->rNumericArgs(3) = (SurfaceNumProp - 3) / 3; + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(3); if (mod(SurfaceNumProp - 3, 3) != 0) { ShowWarningError(state, format("{}=\"{}\", {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, format("{} not even multiple of 3. Will read in {}", - state.dataIPShortCut->cNumericFieldNames(3), + s_ipsc->cNumericFieldNames(3), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); } - if (state.dataIPShortCut->rNumericArgs(3) < 3) { + if (s_ipsc->rNumericArgs(3) < 3) { ShowSevereError(state, format("{}=\"{}\", {} (autocalculate) must be >= 3. Only {} provided.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cNumericFieldNames(3), + s_ipsc->cNumericFieldNames(3), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides)); ErrorsFound = true; continue; } } else { numSides = (SurfaceNumProp - 2) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = state.dataIPShortCut->rNumericArgs(3); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(3); if (numSides > state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides) { ShowWarningError(state, format("{}=\"{}\", field {}={}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cNumericFieldNames(3), + s_ipsc->cNumericFieldNames(3), fmt::to_string(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); - ShowContinueError( - state, - format("...but {} were entered. Only the indicated {} will be used.", numSides, state.dataIPShortCut->cNumericFieldNames(3))); + ShowContinueError(state, + format("...but {} were entered. Only the indicated {} will be used.", numSides, s_ipsc->cNumericFieldNames(3))); } } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor || state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Door) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = int(state.dataIPShortCut->rNumericArgs(2)); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = int(s_ipsc->rNumericArgs(2)); // Only windows, glass doors and doors can have Multiplier > 1: if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Window && state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::GlassDoor && state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Door) && - state.dataIPShortCut->rNumericArgs(2) > 1.0) { + s_ipsc->rNumericArgs(2) > 1.0) { ShowWarningError(state, format("{}=\"{}\", invalid {}=[{:.1T}].", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cNumericFieldNames(2), - state.dataIPShortCut->rNumericArgs(2))); + s_ipsc->cNumericFieldNames(2), + s_ipsc->rNumericArgs(2))); ShowContinueError(state, - format("...because {}={} multiplier will be set to 1.0.", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + format("...because {}={} multiplier will be set to 1.0.", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = 1.0; } - GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, state.dataIPShortCut->rNumericArgs({4, _})); + GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, s_ipsc->rNumericArgs({4, _})); CheckConvexity(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList.clear(); @@ -5316,7 +5283,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefCalcExt) { ShowSevereError(state, format("{}=\"{}\", Other side coefficients are not allowed with windows.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); ErrorsFound = true; } @@ -5324,7 +5291,7 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == Ground) { ShowSevereError(state, format("{}=\"{}\", Exterior boundary condition = Ground is not allowed with windows.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); ErrorsFound = true; } @@ -5332,7 +5299,7 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == KivaFoundation) { ShowSevereError(state, format("{}=\"{}\", Exterior boundary condition = Foundation is not allowed with windows.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); ErrorsFound = true; } @@ -5342,13 +5309,13 @@ namespace SurfaceGeometry { CheckWindowShadingControlFrameDivider(state, "GetHTSubSurfaceData", ErrorsFound, SurfNum, 6); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides == 3) { // Triangular window - if (!state.dataIPShortCut->cAlphaArgs(6).empty()) { + if (!s_ipsc->cAlphaArgs(6).empty()) { ShowWarningError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(6), - state.dataIPShortCut->cAlphaArgs(6))); + s_ipsc->cAlphaFieldNames(6), + s_ipsc->cAlphaArgs(6))); ShowContinueError(state, ".. because it is a triangular window and cannot have a frame or divider or reveal reflection."); ShowContinueError(state, "Frame, divider and reveal reflection will be ignored for this window."); } @@ -5357,13 +5324,8 @@ namespace SurfaceGeometry { } // check on non-opaquedoor subsurfaces - CheckSubSurfaceMiscellaneous(state, - "GetHTSubSurfaceData", - ErrorsFound, - SurfNum, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(3), - AddedSubSurfaces); + CheckSubSurfaceMiscellaneous( + state, "GetHTSubSurfaceData", ErrorsFound, SurfNum, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(3), AddedSubSurfaces); } // End of main loop over subsurfaces } @@ -5415,10 +5377,11 @@ namespace SurfaceGeometry { int OtherSurfaceField; int ClassItem; int IZFound; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + + auto &s_ipsc = state.dataIPShortCut; for (Item = 1; Item <= 6; ++Item) { - cCurrentModuleObject = cModuleObjects(Item); + s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { ItemsToGet = TotWindows; GettingIZSurfaces = false; @@ -5465,51 +5428,49 @@ namespace SurfaceGeometry { for (Loop = 1; Loop <= ItemsToGet; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound)) { continue; } if (NumNumbers < 5) { - ShowSevereError(state, - format("{}=\"{}\", Too few number of numeric args=[{}].", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - NumNumbers)); + ShowSevereError( + state, + format("{}=\"{}\", Too few number of numeric args=[{}].", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), NumNumbers)); ErrorsFound = true; } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Set the Surface Name in the Derived Type - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SubSurfIDs(ClassItem); // Set class number + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SubSurfIDs(ClassItem); // Set class number state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction == 0) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); } else { state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).IsUsed = true; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ConstructionStoredInputValue = @@ -5525,14 +5486,14 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" has an opaque surface construction; it should have a window construction.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); } if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\": Windows are not allowed to have embedded sources/sinks", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); } } @@ -5542,16 +5503,16 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" - has Window materials.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); } } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataIPShortCut->cAlphaArgs(3); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = s_ipsc->cAlphaArgs(3); // The subsurface inherits properties from the base surface // Exterior conditions, Zone, etc. // We can figure out the base surface though, because they've all been entered @@ -5576,10 +5537,10 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; ErrorsFound = true; continue; @@ -5589,10 +5550,10 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(Found).Name) { // Adiabatic surface, no windows or doors allowed ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ShowContinueError(state, "... adiabatic surfaces cannot have windows or doors."); ShowContinueError(state, "... no solar transmission will result for these windows or doors. You must have interior windows or doors on " @@ -5601,15 +5562,16 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { // "Surface" Base Surface if (!GettingIZSurfaces) { - ShowSevereError( - state, - format("{}=\"{}\", invalid use of object", cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + ShowSevereError(state, + format("{}=\"{}\", invalid use of object", + s_ipsc->cCurrentModuleObject, + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); ShowContinueError( state, format( "...when Base surface uses \"Surface\" as {}, subsurfaces must also specify specific surfaces in the adjacent zone.", - state.dataIPShortCut->cAlphaFieldNames(5))); - ShowContinueError(state, format("...Please use {}:Interzone to enter this surface.", cCurrentModuleObject)); + s_ipsc->cAlphaFieldNames(5))); + ShowContinueError(state, format("...Please use {}:Interzone to enter this surface.", s_ipsc->cCurrentModuleObject)); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = BlankString; // putting it as blank will not confuse things later. ErrorsFound = true; @@ -5618,7 +5580,7 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { // "Surface" Base Surface if (GettingIZSurfaces) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataIPShortCut->cAlphaArgs(OtherSurfaceField); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(OtherSurfaceField); IZFound = Util::FindItemInList( state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); if (IZFound > 0) state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnenteredAdjacentZoneSurface; @@ -5635,9 +5597,9 @@ namespace SurfaceGeometry { } else { // Interior Window ShowSevereError(state, format("{}=\"{}\", invalid Interzone Surface, specify {}:InterZone", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - cCurrentModuleObject)); + s_ipsc->cCurrentModuleObject)); ShowContinueError(state, "...when base surface is an interzone surface, subsurface must also be an interzone surface."); ++NeedToAddSubSurfaces; ErrorsFound = true; @@ -5645,7 +5607,7 @@ namespace SurfaceGeometry { } if (GettingIZSurfaces) { - if (state.dataIPShortCut->lAlphaFieldBlanks(OtherSurfaceField)) { + if (s_ipsc->lAlphaFieldBlanks(OtherSurfaceField)) { // blank -- set it up for unentered adjacent zone if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnenteredAdjacentZoneSurface) { // already set but need Zone @@ -5658,7 +5620,7 @@ namespace SurfaceGeometry { } else { // not correct boundary condition for interzone subsurface ShowSevereError(state, format("{}=\"{}\", invalid Base Surface type for Interzone Surface", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); ShowContinueError(state, "...when base surface is not an interzone surface, subsurface must also not be an interzone surface."); @@ -5678,37 +5640,35 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor || state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Door) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = int(state.dataIPShortCut->rNumericArgs(1)); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = int(s_ipsc->rNumericArgs(1)); // Only windows, glass doors and doors can have Multiplier > 1: if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Window && state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::GlassDoor && state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Door) && - state.dataIPShortCut->rNumericArgs(1) > 1.0) { + s_ipsc->rNumericArgs(1) > 1.0) { ShowWarningError(state, format("{}=\"{}\", invalid {}=[{:.1T}].", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cNumericFieldNames(1), - state.dataIPShortCut->rNumericArgs(1))); + s_ipsc->cNumericFieldNames(1), + s_ipsc->rNumericArgs(1))); ShowContinueError(state, - format("...because {}={} multiplier will be set to 1.0.", - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); + format("...because {}={} multiplier will be set to 1.0.", s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1))); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = 1.0; } MakeRelativeRectangularVertices(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf, SurfNum, - state.dataIPShortCut->rNumericArgs(2), - state.dataIPShortCut->rNumericArgs(3), - state.dataIPShortCut->rNumericArgs(4), - state.dataIPShortCut->rNumericArgs(5)); + s_ipsc->rNumericArgs(2), + s_ipsc->rNumericArgs(3), + s_ipsc->rNumericArgs(4), + s_ipsc->rNumericArgs(5)); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area <= 0.0) { ShowSevereError(state, format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); ErrorsFound = true; @@ -5731,7 +5691,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefCalcExt) { ShowSevereError(state, format("{}=\"{}\", Other side coefficients are not allowed with windows.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); ErrorsFound = true; } @@ -5739,7 +5699,7 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == Ground) { ShowSevereError(state, format("{}=\"{}\", Exterior boundary condition = Ground is not allowed with windows.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); ErrorsFound = true; } @@ -5748,13 +5708,8 @@ namespace SurfaceGeometry { } // check on non-opaquedoor subsurfaces - CheckSubSurfaceMiscellaneous(state, - "GetRectSubSurfaces", - ErrorsFound, - SurfNum, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(2), - AddedSubSurfaces); + CheckSubSurfaceMiscellaneous( + state, "GetRectSubSurfaces", ErrorsFound, SurfNum, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(2), AddedSubSurfaces); } // Getting Items } @@ -5798,6 +5753,9 @@ namespace SurfaceGeometry { // Otherwise, create shaded construction if WindowShadingControl for this window has // interior or exterior shade/blind (but not between-glass shade/blind) specified. + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; + for (std::size_t shadeControlIndex = 0; shadeControlIndex < state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList.size(); ++shadeControlIndex) { int WSCPtr = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList[shadeControlIndex]; @@ -5908,16 +5866,14 @@ namespace SurfaceGeometry { if (state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers) != state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotShLayers)) { ShowSevereError(state, format("{}: Mis-match in unshaded/shaded inside layer materials. These should match.", cRoutineName)); - ShowContinueError( - state, - format("Unshaded construction={}, Material={}", - state.dataConstruction->Construct(ConstrNum).Name, - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers))->Name)); - ShowContinueError( - state, - format("Shaded construction={}, Material={}", - state.dataConstruction->Construct(ConstrNumSh).Name, - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotShLayers))->Name)); + ShowContinueError(state, + format("Unshaded construction={}, Material={}", + state.dataConstruction->Construct(ConstrNum).Name, + s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayers))->Name)); + ShowContinueError(state, + format("Shaded construction={}, Material={}", + state.dataConstruction->Construct(ConstrNumSh).Name, + s_mat->materials(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotShLayers))->Name)); ErrorsFound = true; } if (state.dataConstruction->Construct(ConstrNum).LayerPoint(1) != state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1)) { @@ -5925,11 +5881,11 @@ namespace SurfaceGeometry { ShowContinueError(state, format("Unshaded construction={}, Material={}", state.dataConstruction->Construct(ConstrNum).Name, - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))->Name)); + s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))->Name)); ShowContinueError(state, format("Shaded construction={}, Material={}", state.dataConstruction->Construct(ConstrNumSh).Name, - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1))->Name)); + s_mat->materials(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1))->Name)); ErrorsFound = true; } if (TotGlassLayers == 2 || TotGlassLayers == 3) { @@ -5938,9 +5894,8 @@ namespace SurfaceGeometry { MatGap2 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers); MatSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers - 1); if (state.dataSurface->WindowShadingControl(WSCPtr).ShadingType == WinShadingType::BGBlind) { - MatGapCalc = - std::abs(state.dataMaterial->Material(MatGap)->Thickness - - (state.dataMaterial->Material(MatGap1)->Thickness + state.dataMaterial->Material(MatGap2)->Thickness)); + MatGapCalc = std::abs(s_mat->materials(MatGap)->Thickness - + (s_mat->materials(MatGap1)->Thickness + s_mat->materials(MatGap2)->Thickness)); if (MatGapCalc > 0.001) { ShowSevereError(state, format("{}: The gap width(s) for the unshaded window construction {}", @@ -5952,26 +5907,24 @@ namespace SurfaceGeometry { ShowContinueError(state, "for window " + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name + ", which has a between-glass blind."); - ShowContinueError(state, - format("..Material={} thickness={:.3R} -", - state.dataMaterial->Material(MatGap)->Name, - state.dataMaterial->Material(MatGap)->Thickness)); + ShowContinueError( + state, + format("..Material={} thickness={:.3R} -", s_mat->materials(MatGap)->Name, s_mat->materials(MatGap)->Thickness)); ShowContinueError(state, format("..( Material={} thickness={:.3R} +", - state.dataMaterial->Material(MatGap1)->Name, - state.dataMaterial->Material(MatGap1)->Thickness)); + s_mat->materials(MatGap1)->Name, + s_mat->materials(MatGap1)->Thickness)); ShowContinueError(state, format("..Material={} thickness={:.3R} )=[{:.3R}] >.001", - state.dataMaterial->Material(MatGap2)->Name, - state.dataMaterial->Material(MatGap2)->Thickness, + s_mat->materials(MatGap2)->Name, + s_mat->materials(MatGap2)->Thickness, MatGapCalc)); ErrorsFound = true; } } else { // Between-glass shade - MatGapCalc = - std::abs(state.dataMaterial->Material(MatGap)->Thickness - - (state.dataMaterial->Material(MatGap1)->Thickness + state.dataMaterial->Material(MatGap2)->Thickness + - state.dataMaterial->Material(MatSh)->Thickness)); + MatGapCalc = std::abs( + s_mat->materials(MatGap)->Thickness - + (s_mat->materials(MatGap1)->Thickness + s_mat->materials(MatGap2)->Thickness + s_mat->materials(MatSh)->Thickness)); if (MatGapCalc > 0.001) { ShowSevereError(state, format("{}: The gap width(s) for the unshaded window construction {}", @@ -5983,22 +5936,21 @@ namespace SurfaceGeometry { ShowContinueError(state, "for window " + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name + ", which has a between-glass shade."); - ShowContinueError(state, - format("..Material={} thickness={:.3R} -", - state.dataMaterial->Material(MatGap)->Name, - state.dataMaterial->Material(MatGap)->Thickness)); + ShowContinueError( + state, + format("..Material={} thickness={:.3R} -", s_mat->materials(MatGap)->Name, s_mat->materials(MatGap)->Thickness)); ShowContinueError(state, format("...( Material={} thickness={:.3R} +", - state.dataMaterial->Material(MatGap1)->Name, - state.dataMaterial->Material(MatGap1)->Thickness)); + s_mat->materials(MatGap1)->Name, + s_mat->materials(MatGap1)->Thickness)); ShowContinueError(state, format("..Material={} thickness={:.3R} +", - state.dataMaterial->Material(MatGap2)->Name, - state.dataMaterial->Material(MatGap2)->Thickness)); + s_mat->materials(MatGap2)->Name, + s_mat->materials(MatGap2)->Thickness)); ShowContinueError(state, format("..Material={} thickness={:.3R} )=[{:.3R}] >.001", - state.dataMaterial->Material(MatSh)->Name, - state.dataMaterial->Material(MatSh)->Thickness, + s_mat->materials(MatSh)->Name, + s_mat->materials(MatSh)->Thickness, MatGapCalc)); ErrorsFound = true; } @@ -6007,7 +5959,7 @@ namespace SurfaceGeometry { } } } - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides != 3) { // Rectangular Window // Initialize the FrameDivider number for this window. W5FrameDivider will be positive if // this window's construction came from the Window5 data file and that construction had an @@ -6021,37 +5973,37 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).W5FrameDivider; // Warning if FrameAndDivider for this window is over-ridden by one from Window5 Data File - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider > 0 && !state.dataIPShortCut->lAlphaFieldBlanks(FrameField)) { + if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider > 0 && !s_ipsc->lAlphaFieldBlanks(FrameField)) { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(FrameField), - state.dataIPShortCut->cAlphaArgs(FrameField))); + s_ipsc->cAlphaFieldNames(FrameField), + s_ipsc->cAlphaArgs(FrameField))); ShowContinueError(state, format("will be replaced with FrameAndDivider from Window5 Data File entry {}", state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Name)); } - if (!state.dataIPShortCut->lAlphaFieldBlanks(FrameField) && state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider == 0) { + if (!s_ipsc->lAlphaFieldBlanks(FrameField) && state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider == 0) { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(FrameField), state.dataSurface->FrameDivider); + Util::FindItemInList(s_ipsc->cAlphaArgs(FrameField), state.dataSurface->FrameDivider); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider == 0) { if (!state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(FrameField), - state.dataIPShortCut->cAlphaArgs(FrameField))); + s_ipsc->cAlphaFieldNames(FrameField), + s_ipsc->cAlphaArgs(FrameField))); ErrorsFound = true; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(FrameField), - state.dataIPShortCut->cAlphaArgs(FrameField))); + s_ipsc->cAlphaFieldNames(FrameField), + s_ipsc->cAlphaArgs(FrameField))); ShowContinueError(state, "...Frame/Divider is not supported in Equivalent Layer Window model."); } } @@ -6064,10 +6016,10 @@ namespace SurfaceGeometry { 0.0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(FrameField), - state.dataIPShortCut->cAlphaArgs(FrameField))); + s_ipsc->cAlphaFieldNames(FrameField), + s_ipsc->cAlphaArgs(FrameField))); ShowContinueError(state, "Divider cannot be specified because the construction has a between-glass shade or blind."); ShowContinueError(state, "Calculation will proceed without the divider for this window."); @@ -6092,10 +6044,10 @@ namespace SurfaceGeometry { // Equivalent Layer window does not have frame/divider model ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(FrameField), - state.dataIPShortCut->cAlphaArgs(FrameField))); + s_ipsc->cAlphaFieldNames(FrameField), + s_ipsc->cAlphaArgs(FrameField))); ShowContinueError(state, "Frame/Divider is not supported in Equivalent Layer Window model."); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider = 0; } @@ -6131,6 +6083,7 @@ namespace SurfaceGeometry { int ConstrNum; // Construction number int Found; // when item is found + auto &s_mat = state.dataMaterial; // Warning if window has multiplier > 1 and SolarDistribution = FullExterior or FullInteriorExterior if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || @@ -6156,9 +6109,8 @@ namespace SurfaceGeometry { 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 (state.dataMaterial->Material(LayerPtr)->group == Material::Group::Shade || - state.dataMaterial->Material(LayerPtr)->group == Material::Group::WindowBlind || - state.dataMaterial->Material(LayerPtr)->group == Material::Group::Screen) + if (s_mat->materials(LayerPtr)->group == Material::Group::Shade || s_mat->materials(LayerPtr)->group == Material::Group::Blind || + s_mat->materials(LayerPtr)->group == Material::Group::Screen) ++NumShades; } if (NumShades != 0) { @@ -6178,9 +6130,10 @@ namespace SurfaceGeometry { if (ConstrNum > 0) { for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Lay) { LayerPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(LayerPtr)); - assert(thisMaterial != nullptr); - if (thisMaterial->group == Material::Group::WindowGlass && thisMaterial->GlassTransDirtFactor < 1.0) { + auto const *mat = s_mat->materials(LayerPtr); + if (mat->group != Material::Group::Glass) continue; + + if (dynamic_cast(mat)->GlassTransDirtFactor < 1.0) { ShowSevereError(state, format("{}: Interior Window or GlassDoor {} has a glass layer with", cRoutineName, SubSurfaceName)); ShowContinueError(state, "Dirt Correction Factor for Solar and Visible Transmittance < 1.0"); ShowContinueError(state, "A value less than 1.0 for this factor is only allowed for exterior windows and glass doors."); @@ -6453,46 +6406,47 @@ namespace SurfaceGeometry { Real64 SchedMinValue; Real64 SchedMaxValue; + auto &s_ipsc = state.dataIPShortCut; + if (TotShdSubs > 0 && state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { ShowWarningError(state, "Shading effects of Fins and Overhangs are ignored when Solar Distribution = MinimalShadowing"); } - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "Shading:Zone:Detailed"; - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, Loop, NumAlphas, NumNumbers); + s_ipsc->cCurrentModuleObject = "Shading:Zone:Detailed"; + state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, s_ipsc->cCurrentModuleObject, Loop, NumAlphas, NumNumbers); if (NumAlphas != 3) { - ShowSevereError(state, - format("{}: Object Definition indicates not = 3 Alpha Objects, Number Indicated={}", cCurrentModuleObject, NumAlphas)); + ShowSevereError( + state, format("{}: Object Definition indicates not = 3 Alpha Objects, Number Indicated={}", s_ipsc->cCurrentModuleObject, NumAlphas)); ErrorsFound = true; } for (Loop = 1; Loop <= TotShdSubs; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound)) { continue; } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Set the Surface Name in the Derived Type + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Shading; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataIPShortCut->cAlphaArgs(2); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = s_ipsc->cAlphaArgs(2); // The subsurface inherits properties from the base surface // Exterior conditions, Zone, etc. // We can figure out the base surface though, because they've all been entered @@ -6510,19 +6464,19 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnenteredAdjacentZoneSurface) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...trying to attach a shading device to an interzone surface."); ErrorsFound = true; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = @@ -6531,25 +6485,25 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...trying to attach a shading device to an interior surface."); ErrorsFound = true; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = ExternalEnvironment; // reset so program won't crash during "add surfaces" } - if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); + if (!s_ipsc->lAlphaFieldBlanks(3)) { + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = GetScheduleIndex(state, s_ipsc->cAlphaArgs(3)); if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex == 0) { ShowSevereError(state, format("{}=\"{}\", {} not found=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } } else { @@ -6559,10 +6513,10 @@ namespace SurfaceGeometry { if (!CheckScheduleValueMinMax(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex, ">=", 0.0, "<=", 1.0)) { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\", values not in range [0,1].", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } SchedMinValue = GetScheduleMinValue(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex); @@ -6575,10 +6529,10 @@ namespace SurfaceGeometry { if (SchedMinValue < 0.0) { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\", has schedule values < 0.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...Schedule values < 0 have no meaning for shading elements."); } if (SchedMaxValue > 0.0) { @@ -6587,46 +6541,46 @@ namespace SurfaceGeometry { if (SchedMaxValue > 1.0) { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\", has schedule values > 1.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...Schedule values > 1 have no meaning for shading elements."); } if (std::abs(SchedMinValue - SchedMaxValue) > Constant::OneMillionth) { state.dataSurface->ShadingTransmittanceVaries = true; } } - if (state.dataIPShortCut->lNumericFieldBlanks(1) || state.dataIPShortCut->rNumericArgs(1) == Constant::AutoCalculate) { - state.dataIPShortCut->rNumericArgs(1) = (NumNumbers - 1) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = state.dataIPShortCut->rNumericArgs(1); + if (s_ipsc->lNumericFieldBlanks(1) || s_ipsc->rNumericArgs(1) == Constant::AutoCalculate) { + s_ipsc->rNumericArgs(1) = (NumNumbers - 1) / 3; + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(1); if (mod(NumNumbers - 1, 3) != 0) { ShowWarningError(state, format("{}=\"{}\", {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, format("{} not even multiple of 3. Will read in {}", - state.dataIPShortCut->cNumericFieldNames(1), + s_ipsc->cNumericFieldNames(1), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); } - if (state.dataIPShortCut->rNumericArgs(1) < 3) { + if (s_ipsc->rNumericArgs(1) < 3) { ShowSevereError(state, format("{}=\"{}\", {} (autocalculate) must be >= 3. Only {} provided.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cNumericFieldNames(1), + s_ipsc->cNumericFieldNames(1), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides)); ErrorsFound = true; continue; } } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = state.dataIPShortCut->rNumericArgs(1); + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(1); } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, state.dataIPShortCut->rNumericArgs({2, _})); + GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, s_ipsc->rNumericArgs({2, _})); CheckConvexity(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); // IF (SurfaceTmp(SurfNum)%Sides == 3) THEN - // CALL ShowWarningError(state, TRIM(cCurrentModuleObject)//'="'//TRIM(SurfaceTmp(SurfNum)%Name)// & + // CALL ShowWarningError(state, TRIM(s_ipsc->cCurrentModuleObject)//'="'//TRIM(SurfaceTmp(SurfNum)%Name)// & // ' should not be triangular.') // CALL ShowContinueError(state, '...Check results carefully.') // ErrorsFound=.TRUE. @@ -6686,14 +6640,15 @@ namespace SurfaceGeometry { Real64 TiltAngle; bool MakeFin; + auto &s_ipsc = state.dataIPShortCut; + if ((TotOverhangs + TotOverhangsProjection + TotFins + TotFinsProjection) > 0 && state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { ShowWarningError(state, "Shading effects of Fins and Overhangs are ignored when Solar Distribution = MinimalShadowing"); } - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; for (Item = 1; Item <= 4; ++Item) { - cCurrentModuleObject = cModuleObjects(Item); + s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { ItemsToGet = TotOverhangs; } else if (Item == 2) { @@ -6706,34 +6661,33 @@ namespace SurfaceGeometry { for (Loop = 1; Loop <= ItemsToGet; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound)) { continue; } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Set the Surface Name in the Derived Type + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Shading; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; // this object references a window or door.... - Found = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); + Found = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); if (Found > 0) { BaseSurfNum = state.dataSurfaceGeometry->SurfaceTmp(Found).BaseSurf; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(Found).BaseSurfName; @@ -6747,20 +6701,20 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; continue; } if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnenteredAdjacentZoneSurface) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...trying to attach a shading device to an interzone surface."); ErrorsFound = true; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = @@ -6769,10 +6723,10 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...trying to attach a shading device to an interior surface."); ErrorsFound = true; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = @@ -6802,24 +6756,23 @@ namespace SurfaceGeometry { // for projection option: // N5; \field Depth as Fraction of Window/Door Height // \units m - Length = state.dataIPShortCut->rNumericArgs(3) + state.dataIPShortCut->rNumericArgs(4) + - state.dataSurfaceGeometry->SurfaceTmp(Found).Width; + Length = s_ipsc->rNumericArgs(3) + s_ipsc->rNumericArgs(4) + state.dataSurfaceGeometry->SurfaceTmp(Found).Width; if (Item == 1) { - Depth = state.dataIPShortCut->rNumericArgs(5); + Depth = s_ipsc->rNumericArgs(5); } else if (Item == 2) { - Depth = state.dataIPShortCut->rNumericArgs(5) * state.dataSurfaceGeometry->SurfaceTmp(Found).Height; + Depth = s_ipsc->rNumericArgs(5) * state.dataSurfaceGeometry->SurfaceTmp(Found).Height; } if (Length * Depth <= 0.0) { ShowSevereError(state, format("{}=\"{}\", illegal surface area=[{:.2R}]. Surface will NOT be entered.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), Length * Depth)); continue; } - TiltAngle = state.dataSurfaceGeometry->SurfaceTmp(Found).Tilt + state.dataIPShortCut->rNumericArgs(2); + TiltAngle = state.dataSurfaceGeometry->SurfaceTmp(Found).Tilt + s_ipsc->rNumericArgs(2); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = TiltAngle; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); @@ -6845,9 +6798,8 @@ namespace SurfaceGeometry { MakeRelativeRectangularVertices(state, BaseSurfNum, SurfNum, - XLLC - state.dataIPShortCut->rNumericArgs(3), - YLLC + state.dataSurfaceGeometry->SurfaceTmp(Found).Height + - state.dataIPShortCut->rNumericArgs(1), + XLLC - s_ipsc->rNumericArgs(3), + YLLC + state.dataSurfaceGeometry->SurfaceTmp(Found).Height + s_ipsc->rNumericArgs(1), Length, Depth); @@ -6887,20 +6839,19 @@ namespace SurfaceGeometry { // N5, \field Left Depth as Fraction of Window/Door Width // \units m state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name + " Left"; - Length = state.dataIPShortCut->rNumericArgs(2) + state.dataIPShortCut->rNumericArgs(3) + - state.dataSurfaceGeometry->SurfaceTmp(Found).Height; + Length = s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(3) + state.dataSurfaceGeometry->SurfaceTmp(Found).Height; if (Item == 3) { - Depth = state.dataIPShortCut->rNumericArgs(5); + Depth = s_ipsc->rNumericArgs(5); } else if (Item == 4) { - Depth = state.dataIPShortCut->rNumericArgs(5) * state.dataSurfaceGeometry->SurfaceTmp(Found).Width; + Depth = s_ipsc->rNumericArgs(5) * state.dataSurfaceGeometry->SurfaceTmp(Found).Width; } MakeFin = true; if (Length * Depth <= 0.0) { ShowWarningError(state, format("{}=Left Fin of \"{}\", illegal surface area=[{:.2R}]. Surface will NOT be entered.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), Length * Depth)); MakeFin = false; } @@ -6911,7 +6862,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = - state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth - (180.0 - state.dataIPShortCut->rNumericArgs(4)); + state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth - (180.0 - s_ipsc->rNumericArgs(4)); // Make it relative to surface origin..... @@ -6943,13 +6894,8 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = 4; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - MakeRelativeRectangularVertices(state, - BaseSurfNum, - SurfNum, - XLLC - state.dataIPShortCut->rNumericArgs(1), - YLLC - state.dataIPShortCut->rNumericArgs(3), - -Depth, - Length); + MakeRelativeRectangularVertices( + state, BaseSurfNum, SurfNum, XLLC - s_ipsc->rNumericArgs(1), YLLC - s_ipsc->rNumericArgs(3), -Depth, Length); // Reset surface to be "detached" // SurfaceTmp(SurfNum)%BaseSurfName=' ' @@ -6988,7 +6934,7 @@ namespace SurfaceGeometry { ++SurfNum; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = - state.dataIPShortCut->cAlphaArgs(1) + " Right"; // Set the Surface Name in the Derived Type + s_ipsc->cAlphaArgs(1) + " Right"; // Set the Surface Name in the Derived Type state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Shading; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; BaseSurfNum = state.dataSurfaceGeometry->SurfaceTmp(Found).BaseSurf; @@ -7002,20 +6948,19 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; // Necessary to have surface drawn in OutputReports state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = 0; - Length = state.dataIPShortCut->rNumericArgs(7) + state.dataIPShortCut->rNumericArgs(8) + - state.dataSurfaceGeometry->SurfaceTmp(Found).Height; + Length = s_ipsc->rNumericArgs(7) + s_ipsc->rNumericArgs(8) + state.dataSurfaceGeometry->SurfaceTmp(Found).Height; if (Item == 3) { - Depth = state.dataIPShortCut->rNumericArgs(10); + Depth = s_ipsc->rNumericArgs(10); } else if (Item == 4) { - Depth = state.dataIPShortCut->rNumericArgs(10) * state.dataSurfaceGeometry->SurfaceTmp(Found).Width; + Depth = s_ipsc->rNumericArgs(10) * state.dataSurfaceGeometry->SurfaceTmp(Found).Width; } MakeFin = true; if (Length * Depth <= 0.0) { ShowWarningError(state, format("{}=Right Fin of \"{}\", illegal surface area=[{:.2R}]. Surface will NOT be entered.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), Length * Depth)); MakeFin = false; } @@ -7044,7 +6989,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = - state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth - (180.0 - state.dataIPShortCut->rNumericArgs(9)); + state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth - (180.0 - s_ipsc->rNumericArgs(9)); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosAzim = std::cos(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth * Constant::DegToRadians); state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinAzim = @@ -7060,9 +7005,8 @@ namespace SurfaceGeometry { MakeRelativeRectangularVertices(state, BaseSurfNum, SurfNum, - XLLC + state.dataSurfaceGeometry->SurfaceTmp(Found).Width + - state.dataIPShortCut->rNumericArgs(6), - YLLC - state.dataIPShortCut->rNumericArgs(8), + XLLC + state.dataSurfaceGeometry->SurfaceTmp(Found).Width + s_ipsc->rNumericArgs(6), + YLLC - s_ipsc->rNumericArgs(8), -Depth, Length); @@ -7139,9 +7083,10 @@ namespace SurfaceGeometry { int ZoneNum; // index to a zone int NumIntMassSurfaces(0); // total count of internal mass surfaces bool errFlag; // local error flag - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "InternalMass"; - int TotIntMass = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "InternalMass"; + int TotIntMass = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (TotIntMass == 0) return; state.dataSurface->IntMassObjects.allocate(TotIntMass); @@ -7151,38 +7096,38 @@ namespace SurfaceGeometry { NumIntMassSurfaces = 0; for (int Item = 1; Item <= TotIntMass; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Item, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, SurfaceNumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, SurfaceNumArg, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, - state.dataIPShortCut->cAlphaArgs(1), - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), ErrorsFound)) { continue; } - state.dataSurface->IntMassObjects(Item).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataSurface->IntMassObjects(Item).GrossArea = state.dataIPShortCut->rNumericArgs(1); + state.dataSurface->IntMassObjects(Item).Name = s_ipsc->cAlphaArgs(1); + state.dataSurface->IntMassObjects(Item).GrossArea = s_ipsc->rNumericArgs(1); state.dataSurface->IntMassObjects(Item).Construction = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); - state.dataSurface->IntMassObjects(Item).ZoneOrZoneListName = state.dataIPShortCut->cAlphaArgs(3); - int Item1 = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + state.dataSurface->IntMassObjects(Item).ZoneOrZoneListName = s_ipsc->cAlphaArgs(3); + int Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); int ZLItem = 0; if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) - ZLItem = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataHeatBal->ZoneList); + ZLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataHeatBal->ZoneList); if (Item1 > 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { + if (s_ipsc->lAlphaFieldBlanks(4)) { ++NumIntMassSurfaces; } state.dataSurface->IntMassObjects(Item).NumOfZones = 1; @@ -7197,10 +7142,10 @@ namespace SurfaceGeometry { // If Space or SpaceList Name is blank, then throw error. ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ++SurfNum; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; @@ -7208,12 +7153,12 @@ namespace SurfaceGeometry { errFlag = true; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - state.dataSurface->IntMassObjects(Item).spaceOrSpaceListName = state.dataIPShortCut->cAlphaArgs(4); - int Item1 = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataHeatBal->space); + if (!s_ipsc->lAlphaFieldBlanks(4)) { + state.dataSurface->IntMassObjects(Item).spaceOrSpaceListName = s_ipsc->cAlphaArgs(4); + int Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->space); int SLItem = 0; if (Item1 == 0 && int(state.dataHeatBal->spaceList.size()) > 0) - SLItem = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataHeatBal->spaceList); + SLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->spaceList); if (Item1 > 0) { ++NumIntMassSurfaces; state.dataSurface->IntMassObjects(Item).numOfSpaces = 1; @@ -7231,10 +7176,10 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ++SurfNum; state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; ErrorsFound = true; @@ -7243,7 +7188,7 @@ namespace SurfaceGeometry { } if (errFlag) { - ShowSevereError(state, format("{}Errors with invalid names in {} objects.", RoutineName, cCurrentModuleObject)); + ShowSevereError(state, format("{}Errors with invalid names in {} objects.", RoutineName, s_ipsc->cCurrentModuleObject)); ShowContinueError(state, "...These will not be read in. Other errors may occur."); NumIntMassSurfaces = 0; } @@ -7252,18 +7197,18 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", {} not found={}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); } else if (state.dataConstruction->Construct(state.dataSurface->IntMassObjects(Item).Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" - has Window materials.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); } else { state.dataConstruction->Construct(state.dataSurface->IntMassObjects(Item).Construction).IsUsed = true; } @@ -7296,7 +7241,7 @@ namespace SurfaceGeometry { CheckCreatedZoneItemName( state, RoutineName, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal ->Zone(state.dataHeatBal->ZoneList(state.dataSurface->IntMassObjects(Loop).ZoneOrZoneListPtr).Zone(Item1)) .Name, @@ -7367,44 +7312,45 @@ namespace SurfaceGeometry { int SurfaceNumArg; // Number of material properties being passed int NumIntMassSurf; // total count of internal mass surfaces + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "InternalMass"; + NumIntMassSurf = 0; int TotIntMass = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "InternalMass"); if (TotIntMass == 0) return NumIntMassSurf; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "InternalMass"; // scan for zones and zone lists in InternalMass objects for (int Item = 1; Item <= TotIntMass; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Item, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, SurfaceNumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, SurfaceNumArg, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - int Item1 = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + int Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); int ZLItem = 0; if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) - ZLItem = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataHeatBal->ZoneList); + ZLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataHeatBal->ZoneList); if (Item1 > 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { + if (s_ipsc->lAlphaFieldBlanks(4)) { ++NumIntMassSurf; } } else if (ZLItem > 0) { NumIntMassSurf += state.dataHeatBal->ZoneList(ZLItem).NumOfZones; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - int Item1 = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataHeatBal->space); + if (!s_ipsc->lAlphaFieldBlanks(4)) { + int Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->space); int SLItem = 0; if (Item1 == 0 && int(state.dataHeatBal->spaceList.size()) > 0) - SLItem = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataHeatBal->spaceList); + SLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->spaceList); if (Item1 > 0) { ++NumIntMassSurf; } else if (SLItem > 0) { @@ -7443,6 +7389,7 @@ namespace SurfaceGeometry { int GlConstrNum; // Glazing construction number bool WrongSurfaceType; + auto &s_ipsc = state.dataIPShortCut; // For shading surfaces, initialize value of reflectance values to default values. These values // may be overridden below for shading surfaces with an associated Shading Surface Reflectance object. for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { @@ -7457,30 +7404,28 @@ namespace SurfaceGeometry { } // Get the total number of Shading Surface Reflectance objects - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "ShadingProperty:Reflectance"; - TotShadingSurfaceReflectance = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "ShadingProperty:Reflectance"; + TotShadingSurfaceReflectance = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); // IF(TotShadingSurfaceReflectance.EQ.0) RETURN for (Loop = 1; Loop <= TotShadingSurfaceReflectance; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumProp, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - SurfNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + SurfNum = Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (SurfNum == 0) { - ShowWarningError(state, format("{}=\"{}\", invalid specification", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format(".. not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(1), state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}=\"{}\", invalid specification", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format(".. not found {}=\"{}\".", s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1))); // ErrorsFound =.TRUE. continue; } @@ -7493,46 +7438,41 @@ namespace SurfaceGeometry { surf.Class == SurfaceClass::Overhang || surf.Class == SurfaceClass::Fin)) WrongSurfaceType = true; if (WrongSurfaceType) { - ShowSevereError( - state, - format("GetShadingSurfReflectanceData: {}=\"{}\", surface is not a shading surface.", cCurrentModuleObject, surf.Name)); + ShowSevereError(state, + format("GetShadingSurfReflectanceData: {}=\"{}\", surface is not a shading surface.", + s_ipsc->cCurrentModuleObject, + surf.Name)); ErrorsFound = true; continue; } } // If associated surface is a shading surface, set reflectance values - state.dataSurface->SurfShadowGlazingFrac(SurfNum) = state.dataIPShortCut->rNumericArgs(3); - state.dataSurface->SurfShadowDiffuseSolRefl(SurfNum) = - (1.0 - state.dataIPShortCut->rNumericArgs(3)) * state.dataIPShortCut->rNumericArgs(1); - state.dataSurface->SurfShadowDiffuseVisRefl(SurfNum) = - (1.0 - state.dataIPShortCut->rNumericArgs(3)) * state.dataIPShortCut->rNumericArgs(2); - if (state.dataIPShortCut->rNumericArgs(3) > 0.0) { - GlConstrNum = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + state.dataSurface->SurfShadowGlazingFrac(SurfNum) = s_ipsc->rNumericArgs(3); + state.dataSurface->SurfShadowDiffuseSolRefl(SurfNum) = (1.0 - s_ipsc->rNumericArgs(3)) * s_ipsc->rNumericArgs(1); + state.dataSurface->SurfShadowDiffuseVisRefl(SurfNum) = (1.0 - s_ipsc->rNumericArgs(3)) * s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(3) > 0.0) { + GlConstrNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); if (GlConstrNum == 0) { ShowSevereError(state, format("{}=\"{}\", {} not found={}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(SurfNum).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { state.dataConstruction->Construct(GlConstrNum).IsUsed = true; } state.dataSurface->SurfShadowGlazingConstruct(SurfNum) = GlConstrNum; } - SurfNum = Util::FindItemInList("Mir-" + state.dataIPShortCut->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + SurfNum = Util::FindItemInList("Mir-" + s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (SurfNum == 0) continue; - state.dataSurface->SurfShadowGlazingFrac(SurfNum) = state.dataIPShortCut->rNumericArgs(3); - state.dataSurface->SurfShadowDiffuseSolRefl(SurfNum) = - (1.0 - state.dataIPShortCut->rNumericArgs(3)) * state.dataIPShortCut->rNumericArgs(1); - state.dataSurface->SurfShadowDiffuseVisRefl(SurfNum) = - (1.0 - state.dataIPShortCut->rNumericArgs(3)) * state.dataIPShortCut->rNumericArgs(2); - if (state.dataIPShortCut->rNumericArgs(3) > 0.0) { - GlConstrNum = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + state.dataSurface->SurfShadowGlazingFrac(SurfNum) = s_ipsc->rNumericArgs(3); + state.dataSurface->SurfShadowDiffuseSolRefl(SurfNum) = (1.0 - s_ipsc->rNumericArgs(3)) * s_ipsc->rNumericArgs(1); + state.dataSurface->SurfShadowDiffuseVisRefl(SurfNum) = (1.0 - s_ipsc->rNumericArgs(3)) * s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(3) > 0.0) { + GlConstrNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); if (GlConstrNum != 0) { state.dataConstruction->Construct(GlConstrNum).IsUsed = true; } @@ -7615,75 +7555,77 @@ namespace SurfaceGeometry { int SurfID; // local surface "pointer" bool IsBlank; bool ErrorInName; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "SurfaceProperty:ExteriorNaturalVentedCavity"; - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, Dummy, MaxNumAlphas, MaxNumNumbers); + + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "SurfaceProperty:ExteriorNaturalVentedCavity"; + state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, s_ipsc->cCurrentModuleObject, Dummy, MaxNumAlphas, MaxNumNumbers); if (MaxNumNumbers != 8) { ShowSevereError( - state, format("{}: Object Definition indicates not = 8 Number Objects, Number Indicated={}", cCurrentModuleObject, MaxNumNumbers)); + state, + format("{}: Object Definition indicates not = 8 Number Objects, Number Indicated={}", s_ipsc->cCurrentModuleObject, MaxNumNumbers)); ErrorsFound = true; } - state.dataSurface->TotExtVentCav = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + state.dataSurface->TotExtVentCav = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataHeatBal->ExtVentedCavity.allocate(state.dataSurface->TotExtVentCav); for (Item = 1; Item <= state.dataSurface->TotExtVentCav; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Item, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // first handle cAlphaArgs ErrorInName = false; IsBlank = false; Util::VerifyName(state, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), state.dataHeatBal->ExtVentedCavity, Item - 1, ErrorInName, IsBlank, - cCurrentModuleObject + " Name"); + s_ipsc->cCurrentModuleObject + " Name"); if (ErrorInName) { ShowContinueError(state, "...cannot not duplicate other names"); ErrorsFound = true; continue; } - state.dataHeatBal->ExtVentedCavity(Item).Name = state.dataIPShortCut->cAlphaArgs(1); + state.dataHeatBal->ExtVentedCavity(Item).Name = s_ipsc->cAlphaArgs(1); - state.dataHeatBal->ExtVentedCavity(Item).OSCMName = state.dataIPShortCut->cAlphaArgs(2); - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { + state.dataHeatBal->ExtVentedCavity(Item).OSCMName = s_ipsc->cAlphaArgs(2); + if (!s_ipsc->lAlphaFieldBlanks(2)) { Found = Util::FindItemInList(state.dataHeatBal->ExtVentedCavity(Item).OSCMName, state.dataSurface->OSCM, state.dataSurface->TotOSCM); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } } else { Found = 0; ShowSevereError(state, format("{}=\"{}\", invalid {} cannot be blank.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, - state.dataIPShortCut->cAlphaFieldNames(2))); + s_ipsc->cAlphaFieldNames(2))); ErrorsFound = true; } state.dataHeatBal->ExtVentedCavity(Item).OSCMPtr = Found; - Roughness = state.dataIPShortCut->cAlphaArgs(3); + Roughness = s_ipsc->cAlphaArgs(3); // Select the correct Number for the associated ascii name for the roughness type if (Util::SameString(Roughness, "VerySmooth")) { state.dataHeatBal->ExtVentedCavity(Item).BaffleRoughness = Material::SurfaceRoughness::VerySmooth; @@ -7703,10 +7645,10 @@ namespace SurfaceGeometry { if (state.dataHeatBal->ExtVentedCavity(Item).BaffleRoughness == Material::SurfaceRoughness::Invalid) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } @@ -7715,7 +7657,7 @@ namespace SurfaceGeometry { if (state.dataHeatBal->ExtVentedCavity(Item).NumSurfs == 0) { ShowSevereError(state, format("{}=\"{}\", no underlying surfaces specified. Must have at least one.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name)); ErrorsFound = true; continue; @@ -7723,15 +7665,14 @@ namespace SurfaceGeometry { state.dataHeatBal->ExtVentedCavity(Item).SurfPtrs.allocate(state.dataHeatBal->ExtVentedCavity(Item).NumSurfs); state.dataHeatBal->ExtVentedCavity(Item).SurfPtrs = 0; for (ThisSurf = 1; ThisSurf <= state.dataHeatBal->ExtVentedCavity(Item).NumSurfs; ++ThisSurf) { - Found = Util::FindItemInList( - state.dataIPShortCut->cAlphaArgs(ThisSurf + AlphaOffset), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + Found = Util::FindItemInList(s_ipsc->cAlphaArgs(ThisSurf + AlphaOffset), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, - state.dataIPShortCut->cAlphaFieldNames(ThisSurf + AlphaOffset), - state.dataIPShortCut->cAlphaArgs(ThisSurf + AlphaOffset))); + s_ipsc->cAlphaFieldNames(ThisSurf + AlphaOffset), + s_ipsc->cAlphaArgs(ThisSurf + AlphaOffset))); ErrorsFound = true; continue; } @@ -7739,10 +7680,10 @@ namespace SurfaceGeometry { if (!state.dataSurface->Surface(Found).HeatTransSurf) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, - state.dataIPShortCut->cAlphaFieldNames(ThisSurf + AlphaOffset), - state.dataIPShortCut->cAlphaArgs(ThisSurf + AlphaOffset))); + s_ipsc->cAlphaFieldNames(ThisSurf + AlphaOffset), + s_ipsc->cAlphaArgs(ThisSurf + AlphaOffset))); ShowContinueError(state, "...because it is not a Heat Transfer Surface."); ErrorsFound = true; continue; @@ -7750,10 +7691,10 @@ namespace SurfaceGeometry { if (!state.dataSurface->Surface(Found).ExtSolar) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, - state.dataIPShortCut->cAlphaFieldNames(ThisSurf + AlphaOffset), - state.dataIPShortCut->cAlphaArgs(ThisSurf + AlphaOffset))); + s_ipsc->cAlphaFieldNames(ThisSurf + AlphaOffset), + s_ipsc->cAlphaArgs(ThisSurf + AlphaOffset))); ShowContinueError(state, "...because it is not exposed to Sun."); ErrorsFound = true; continue; @@ -7761,20 +7702,21 @@ namespace SurfaceGeometry { if (!state.dataSurface->Surface(Found).ExtWind) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, - state.dataIPShortCut->cAlphaFieldNames(ThisSurf + AlphaOffset), - state.dataIPShortCut->cAlphaArgs(ThisSurf + AlphaOffset))); + s_ipsc->cAlphaFieldNames(ThisSurf + AlphaOffset), + s_ipsc->cAlphaArgs(ThisSurf + AlphaOffset))); ShowContinueError(state, "...because it is not exposed to Wind."); ErrorsFound = true; continue; } if (state.dataSurface->Surface(Found).ExtBoundCond != OtherSideCondModeledExt) { - ShowSevereError(state, format("{}=\"{}\", is invalid", cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name)); + ShowSevereError(state, + format("{}=\"{}\", is invalid", s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name)); ShowContinueError(state, format("...because {}=\"{}\".", - state.dataIPShortCut->cAlphaFieldNames(ThisSurf + AlphaOffset), - state.dataIPShortCut->cAlphaArgs(ThisSurf + AlphaOffset))); + s_ipsc->cAlphaFieldNames(ThisSurf + AlphaOffset), + s_ipsc->cAlphaArgs(ThisSurf + AlphaOffset))); ShowContinueError(state, "...is not an OtherSideConditionedModel surface."); ErrorsFound = true; continue; @@ -7812,14 +7754,14 @@ namespace SurfaceGeometry { if (General::rotAzmDiffDeg(state.dataSurface->Surface(SurfID).Azimuth, AvgAzimuth) > AZITOL) { ShowWarningError(state, format("{}=\"{}, Surface {} has Azimuth different from others in the associated group.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, state.dataSurface->Surface(SurfID).Name)); } if (std::abs(state.dataSurface->Surface(SurfID).Tilt - AvgTilt) > TILTOL) { ShowWarningError(state, format("{}=\"{}, Surface {} has Tilt different from others in the associated group.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, state.dataSurface->Surface(SurfID).Name)); } @@ -7847,23 +7789,22 @@ namespace SurfaceGeometry { surfaceArea; // Autodesk:F2C++ Functions handle array subscript usage // now handle rNumericArgs from input object - state.dataHeatBal->ExtVentedCavity(Item).Porosity = state.dataIPShortCut->rNumericArgs(1); - state.dataHeatBal->ExtVentedCavity(Item).LWEmitt = state.dataIPShortCut->rNumericArgs(2); - state.dataHeatBal->ExtVentedCavity(Item).SolAbsorp = state.dataIPShortCut->rNumericArgs(3); - state.dataHeatBal->ExtVentedCavity(Item).HdeltaNPL = state.dataIPShortCut->rNumericArgs(4); - state.dataHeatBal->ExtVentedCavity(Item).PlenGapThick = state.dataIPShortCut->rNumericArgs(5); + state.dataHeatBal->ExtVentedCavity(Item).Porosity = s_ipsc->rNumericArgs(1); + state.dataHeatBal->ExtVentedCavity(Item).LWEmitt = s_ipsc->rNumericArgs(2); + state.dataHeatBal->ExtVentedCavity(Item).SolAbsorp = s_ipsc->rNumericArgs(3); + state.dataHeatBal->ExtVentedCavity(Item).HdeltaNPL = s_ipsc->rNumericArgs(4); + state.dataHeatBal->ExtVentedCavity(Item).PlenGapThick = s_ipsc->rNumericArgs(5); if (state.dataHeatBal->ExtVentedCavity(Item).PlenGapThick <= 0.0) { - ShowSevereError(state, format("{}=\"{}\", invalid .", cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name)); + ShowSevereError(state, format("{}=\"{}\", invalid .", s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name)); ErrorsFound = true; - ShowContinueError(state, - format("...because field \"{}\" must be greater than Zero=[{:.2T}].", - state.dataIPShortCut->cNumericFieldNames(5), - state.dataIPShortCut->rNumericArgs(5))); + ShowContinueError( + state, + format("...because field \"{}\" must be greater than Zero=[{:.2T}].", s_ipsc->cNumericFieldNames(5), s_ipsc->rNumericArgs(5))); continue; } - state.dataHeatBal->ExtVentedCavity(Item).AreaRatio = state.dataIPShortCut->rNumericArgs(6); - state.dataHeatBal->ExtVentedCavity(Item).Cv = state.dataIPShortCut->rNumericArgs(7); - state.dataHeatBal->ExtVentedCavity(Item).Cd = state.dataIPShortCut->rNumericArgs(8); + state.dataHeatBal->ExtVentedCavity(Item).AreaRatio = s_ipsc->rNumericArgs(6); + state.dataHeatBal->ExtVentedCavity(Item).Cv = s_ipsc->rNumericArgs(7); + state.dataHeatBal->ExtVentedCavity(Item).Cd = s_ipsc->rNumericArgs(8); // Fill out data we now know // sum areas of HT surface areas @@ -7871,7 +7812,7 @@ namespace SurfaceGeometry { // subscript usage: Replaced by below state.dataHeatBal->ExtVentedCavity(Item).ProjArea = surfaceArea; if (state.dataHeatBal->ExtVentedCavity(Item).ProjArea <= 0.0) { - ShowSevereError(state, format("{}=\"{}\", invalid .", cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name)); + ShowSevereError(state, format("{}=\"{}\", invalid .", s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name)); ErrorsFound = true; ShowContinueError(state, format("...because gross area of underlying surfaces must be greater than Zero=[{:.2T}].", @@ -7935,34 +7876,36 @@ namespace SurfaceGeometry { Real64 constexpr tolerance = 1e-6; - constexpr std::string_view cCurrentModuleObject = "SurfaceProperty:ExposedFoundationPerimeter"; - int numObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "SurfaceProperty:ExposedFoundationPerimeter"; + int numObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); for (int obj = 1; obj <= numObjects; ++obj) { int alpF = 1; int numF = 1; state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, obj, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - int Found = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(alpF), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + int Found = Util::FindItemInList(s_ipsc->cAlphaArgs(alpF), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (Found == 0) { - ShowSevereError(state, format("{}=\"{}\", did not find matching surface", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\", did not find matching surface", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } alpF++; if (state.dataSurface->Surface(Found).Class != SurfaceClass::Floor) { - ShowWarningError(state, - format("{}: {}, surface is not a floor surface", cCurrentModuleObject, state.dataSurface->Surface(Found).Name)); - ShowContinueError(state, format("{} will not be used", cCurrentModuleObject)); + ShowWarningError( + state, format("{}: {}, surface is not a floor surface", s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name)); + ShowContinueError(state, format("{} will not be used", s_ipsc->cCurrentModuleObject)); continue; } @@ -7979,16 +7922,15 @@ namespace SurfaceGeometry { constexpr std::array(CalculationMethod::Num)> CalculationMethodUC = { "TOTALEXPOSEDPERIMETER", "EXPOSEDPERIMETERFRACTION", "BYSEGMENT"}; - CalculationMethod calculationMethod = - static_cast(getEnumValue(CalculationMethodUC, state.dataIPShortCut->cAlphaArgs(alpF))); + CalculationMethod calculationMethod = static_cast(getEnumValue(CalculationMethodUC, s_ipsc->cAlphaArgs(alpF))); if (calculationMethod != CalculationMethod::TotalExposedPerimeter && calculationMethod != CalculationMethod::ExposedPerimeterFraction && calculationMethod != CalculationMethod::Bysegment) { ShowSevereError(state, format("{}=\"{}\", {} is not a valid choice for {}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), calculationMethod, - state.dataIPShortCut->cAlphaFieldNames(alpF))); + s_ipsc->cAlphaFieldNames(alpF))); ErrorsFound = true; } alpF++; @@ -7996,26 +7938,25 @@ namespace SurfaceGeometry { Data data; data.useDetailedExposedPerimeter = true; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lNumericFieldBlanks(numF)) { if (calculationMethod == CalculationMethod::TotalExposedPerimeter) { - data.exposedFraction = state.dataIPShortCut->rNumericArgs(numF) / state.dataSurface->Surface(Found).Perimeter; + data.exposedFraction = s_ipsc->rNumericArgs(numF) / state.dataSurface->Surface(Found).Perimeter; if (data.exposedFraction > 1 + tolerance) { ShowWarningError(state, format("{}: {}, {} is greater than the perimeter of {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name, - state.dataIPShortCut->cNumericFieldNames(numF), + s_ipsc->cNumericFieldNames(numF), state.dataSurface->Surface(Found).Name)); ShowContinueError(state, format("{} perimeter = {}, {} exposed perimeter = {}", state.dataSurface->Surface(Found).Name, state.dataSurface->Surface(Found).Perimeter, - cCurrentModuleObject, - state.dataIPShortCut->rNumericArgs(numF))); - ShowContinueError(state, - format("{} will be set equal to {} perimeter", - state.dataIPShortCut->cNumericFieldNames(numF), - state.dataSurface->Surface(Found).Name)); + s_ipsc->cCurrentModuleObject, + s_ipsc->rNumericArgs(numF))); + ShowContinueError( + state, + format("{} will be set equal to {} perimeter", s_ipsc->cNumericFieldNames(numF), state.dataSurface->Surface(Found).Name)); data.exposedFraction = 1.0; } @@ -8023,44 +7964,44 @@ namespace SurfaceGeometry { } else { ShowWarningError(state, format("{}: {}, {} set as calculation method, but a value has been set for {}. This value will be ignored.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name, calculationMethod, - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cNumericFieldNames(numF))); } } else { if (calculationMethod == CalculationMethod::TotalExposedPerimeter) { ShowSevereError(state, format("{}: {}, {} set as calculation method, but no value has been set for {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name, calculationMethod, - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cNumericFieldNames(numF))); ErrorsFound = true; } } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lNumericFieldBlanks(numF)) { if (calculationMethod == CalculationMethod::ExposedPerimeterFraction) { - data.exposedFraction = state.dataIPShortCut->rNumericArgs(numF); + data.exposedFraction = s_ipsc->rNumericArgs(numF); data.useDetailedExposedPerimeter = false; } else { ShowWarningError(state, format("{}: {}, {} set as calculation method, but a value has been set for {}. This value will be ignored.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name, calculationMethod, - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cNumericFieldNames(numF))); } } else { if (calculationMethod == CalculationMethod::ExposedPerimeterFraction) { ShowSevereError(state, format("{}: {}, {} set as calculation method, but no value has been set for {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name, calculationMethod, - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cNumericFieldNames(numF))); ErrorsFound = true; } } @@ -8072,39 +8013,39 @@ namespace SurfaceGeometry { if (numRemainingFields != (int)state.dataSurface->Surface(Found).Vertex.size()) { ShowSevereError(state, format("{}: {}, must have equal number of segments as the floor has vertices.{}\" and \"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cNumericFieldNames(numF - 1))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cNumericFieldNames(numF - 1))); ShowContinueError(state, format("{} number of vertices = {}, {} number of segments = {}", state.dataSurface->Surface(Found).Name, state.dataSurface->Surface(Found).Vertex.size(), - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, numRemainingFields)); ErrorsFound = true; } for (int segNum = 0; segNum < numRemainingFields; segNum++) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(alpF), "YES")) { + if (Util::SameString(s_ipsc->cAlphaArgs(alpF), "YES")) { data.isExposedPerimeter.push_back(true); - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(alpF), "NO")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(alpF), "NO")) { data.isExposedPerimeter.push_back(false); - } else if (state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { + } else if (s_ipsc->lAlphaFieldBlanks(alpF)) { ShowSevereError( state, format("{}: {}, {} set as calculation method, but no value has been set for {}. Must be \"Yes\" or \"No\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name, calculationMethod, - state.dataIPShortCut->cAlphaFieldNames(alpF))); + s_ipsc->cAlphaFieldNames(alpF))); ErrorsFound = true; } else { ShowSevereError(state, format("{}: {}, {} invalid [{}]. Must be \"Yes\" or \"No\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); ErrorsFound = true; } alpF++; @@ -8114,7 +8055,7 @@ namespace SurfaceGeometry { if (calculationMethod == CalculationMethod::Bysegment) { ShowSevereError(state, format("{}: {}, {} set as calculation method, but no values have been set for Surface Segments Exposed", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->Surface(Found).Name, calculationMethod)); ErrorsFound = true; @@ -8155,9 +8096,10 @@ namespace SurfaceGeometry { //----------------------------------------------------------------------- // SurfaceProperty:LocalEnvironment //----------------------------------------------------------------------- - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "SurfaceProperty:LocalEnvironment"; - state.dataSurface->TotSurfLocalEnv = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "SurfaceProperty:LocalEnvironment"; + state.dataSurface->TotSurfLocalEnv = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (state.dataSurface->TotSurfLocalEnv > 0) { @@ -8172,55 +8114,55 @@ namespace SurfaceGeometry { auto &SurfLocalEnv = state.dataSurface->SurfLocalEnvironment(Loop); state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumeric, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); - SurfLocalEnv.Name = state.dataIPShortCut->cAlphaArgs(1); + SurfLocalEnv.Name = s_ipsc->cAlphaArgs(1); // Assign surface number - int SurfNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataSurface->Surface); + int SurfNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataSurface->Surface); if (SurfNum == 0) { ShowSevereError(state, format("{} {} = \"{}\", object. Illegal value for \"{}\" has been found.", RoutineName, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, SurfLocalEnv.Name, - state.dataIPShortCut->cAlphaFieldNames(2))); + s_ipsc->cAlphaFieldNames(2))); ShowContinueError(state, format("{} entered value = \"{}\", no corresponding surface (ref BuildingSurface:Detailed) has been " "found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { SurfLocalEnv.SurfPtr = SurfNum; } // Assign Sunlit Fraction Schedule number - if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { - int SunlitFracSchedNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); + if (!s_ipsc->lAlphaFieldBlanks(3)) { + int SunlitFracSchedNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(3)); if (SunlitFracSchedNum == 0) { ShowSevereError(state, format("{} {} = \"{}\", object. Illegal value for \"{}\" has been found.", RoutineName, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, SurfLocalEnv.Name, - state.dataIPShortCut->cAlphaFieldNames(3))); + s_ipsc->cAlphaFieldNames(3))); ShowContinueError( state, format("{} entered value = \"{}\", no corresponding sunlit fraction schedule has been found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } else { SurfLocalEnv.SunlitFracSchedPtr = SunlitFracSchedNum; @@ -8228,20 +8170,20 @@ namespace SurfaceGeometry { } // Assign surrounding surfaces object number; - if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - int SurroundingSurfsNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataSurface->SurroundingSurfsProperty); + if (!s_ipsc->lAlphaFieldBlanks(4)) { + int SurroundingSurfsNum = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataSurface->SurroundingSurfsProperty); if (SurroundingSurfsNum == 0) { ShowSevereError(state, format("{} {} = \"{}\", object. Illegal value for \"{}\" has been found.", RoutineName, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, SurfLocalEnv.Name, - state.dataIPShortCut->cAlphaFieldNames(4))); + s_ipsc->cAlphaFieldNames(4))); ShowContinueError(state, format("{} entered value = \"{}\", no corresponding surrounding surfaces properties has been found " "in the input file.", - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ErrorsFound = true; } else { SurfLocalEnv.SurroundingSurfsPtr = SurroundingSurfsNum; @@ -8249,9 +8191,9 @@ namespace SurfaceGeometry { } // Assign outdoor air node number; - if (!state.dataIPShortCut->lAlphaFieldBlanks(5)) { + if (!s_ipsc->lAlphaFieldBlanks(5)) { int NodeNum = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(5), + s_ipsc->cAlphaArgs(5), ErrorsFound, DataLoopNode::ConnectionObjectType::SurfacePropertyLocalEnvironment, SurfLocalEnv.Name, @@ -8263,13 +8205,13 @@ namespace SurfaceGeometry { ShowSevereError(state, format("{} {} = \"{}\", object. Illegal value for \"{}\" has been found.", RoutineName, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, SurfLocalEnv.Name, - state.dataIPShortCut->cAlphaFieldNames(5))); + s_ipsc->cAlphaFieldNames(5))); ShowContinueError(state, format("{} entered value = \"{}\", no corresponding outdoor air node has been found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); ErrorsFound = true; } else { SurfLocalEnv.OutdoorAirNodePtr = NodeNum; @@ -8277,20 +8219,20 @@ namespace SurfaceGeometry { } // get ground surfaces object number; - if (!state.dataIPShortCut->lAlphaFieldBlanks(6)) { - int GndSurfsNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(6), state.dataSurface->GroundSurfsProperty); + if (!s_ipsc->lAlphaFieldBlanks(6)) { + int GndSurfsNum = Util::FindItemInList(s_ipsc->cAlphaArgs(6), state.dataSurface->GroundSurfsProperty); if (GndSurfsNum == 0) { ShowSevereError(state, format("{} {} = \"{}\", object. Illegal value for \"{}\" has been found.", RoutineName, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, SurfLocalEnv.Name, - state.dataIPShortCut->cAlphaFieldNames(6))); + s_ipsc->cAlphaFieldNames(6))); ShowContinueError( state, format("{} entered value = \"{}\", no corresponding ground surfaces object has been found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(6), - state.dataIPShortCut->cAlphaArgs(6))); + s_ipsc->cAlphaFieldNames(6), + s_ipsc->cAlphaArgs(6))); ErrorsFound = true; } else { SurfLocalEnv.GroundSurfsPtr = GndSurfsNum; @@ -8360,9 +8302,10 @@ namespace SurfaceGeometry { //----------------------------------------------------------------------- // SurfaceProperty:SurroundingSurfaces //----------------------------------------------------------------------- - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "SurfaceProperty:SurroundingSurfaces"; - TotSrdSurfProperties = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "SurfaceProperty:SurroundingSurfaces"; + TotSrdSurfProperties = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (TotSrdSurfProperties > 0) { @@ -8375,54 +8318,54 @@ namespace SurfaceGeometry { auto &SrdSurfsProp = state.dataSurface->SurroundingSurfsProperty(Loop); state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumeric, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); // A1: Name - SrdSurfsProp.Name = state.dataIPShortCut->cAlphaArgs(1); + SrdSurfsProp.Name = s_ipsc->cAlphaArgs(1); // N1: sky view factor - if (!state.dataIPShortCut->lNumericFieldBlanks(1)) { - SrdSurfsProp.SkyViewFactor = state.dataIPShortCut->rNumericArgs(1); + if (!s_ipsc->lNumericFieldBlanks(1)) { + SrdSurfsProp.SkyViewFactor = s_ipsc->rNumericArgs(1); SrdSurfsProp.IsSkyViewFactorSet = true; } // A2: sky temp sch name - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { - SrdSurfsProp.SkyTempSchNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); + if (!s_ipsc->lAlphaFieldBlanks(2)) { + SrdSurfsProp.SkyTempSchNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(2)); } // N2: ground view factor - if (!state.dataIPShortCut->lNumericFieldBlanks(2)) { - SrdSurfsProp.GroundViewFactor = state.dataIPShortCut->rNumericArgs(2); + if (!s_ipsc->lNumericFieldBlanks(2)) { + SrdSurfsProp.GroundViewFactor = s_ipsc->rNumericArgs(2); SrdSurfsProp.IsGroundViewFactorSet = true; } // A3: ground temp sch name - if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { - SrdSurfsProp.GroundTempSchNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); + if (!s_ipsc->lAlphaFieldBlanks(3)) { + SrdSurfsProp.GroundTempSchNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(3)); } // The object requires at least one srd surface input, each surface requires a set of 3 fields (2 Alpha fields Name and Temp // Sch Name and 1 Num fields View Factor) if (NumAlpha < 5) { - ShowSevereError(state, format("{} = \"{}\" is not defined correctly.", cCurrentModuleObject, SrdSurfsProp.Name)); + ShowSevereError(state, format("{} = \"{}\" is not defined correctly.", s_ipsc->cCurrentModuleObject, SrdSurfsProp.Name)); ShowContinueError(state, "At lease one set of surrounding surface properties should be defined."); ErrorsFound = true; continue; } if ((NumAlpha - 3) / 2 != (NumNumeric - 2)) { - ShowSevereError(state, format("{} = \"{}\" is not defined correctly.", cCurrentModuleObject, SrdSurfsProp.Name)); + ShowSevereError(state, format("{} = \"{}\" is not defined correctly.", s_ipsc->cCurrentModuleObject, SrdSurfsProp.Name)); ShowContinueError(state, "Check number of input fields for each surrounding surface."); ErrorsFound = true; continue; @@ -8431,9 +8374,9 @@ namespace SurfaceGeometry { SrdSurfsProp.TotSurroundingSurface = NumNumeric - 2; SrdSurfsProp.SurroundingSurfs.allocate(SrdSurfsProp.TotSurroundingSurface); for (int SurfLoop = 1; SurfLoop <= SrdSurfsProp.TotSurroundingSurface; ++SurfLoop) { - SrdSurfsProp.SurroundingSurfs(SurfLoop).Name = state.dataIPShortCut->cAlphaArgs(SurfLoop * 2 + 2); - SrdSurfsProp.SurroundingSurfs(SurfLoop).ViewFactor = state.dataIPShortCut->rNumericArgs(SurfLoop + 2); - SrdSurfsProp.SurroundingSurfs(SurfLoop).TempSchNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(SurfLoop * 2 + 3)); + SrdSurfsProp.SurroundingSurfs(SurfLoop).Name = s_ipsc->cAlphaArgs(SurfLoop * 2 + 2); + SrdSurfsProp.SurroundingSurfs(SurfLoop).ViewFactor = s_ipsc->rNumericArgs(SurfLoop + 2); + SrdSurfsProp.SurroundingSurfs(SurfLoop).TempSchNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(SurfLoop * 2 + 3)); SrdSurfsProp.SurfsViewFactorSum += SrdSurfsProp.SurroundingSurfs(SurfLoop).ViewFactor; } } @@ -8442,10 +8385,10 @@ namespace SurfaceGeometry { void GetSurfaceGroundSurfsData(EnergyPlusData &state, bool &ErrorsFound) { - - std::string const cCurrentModuleObject = "SurfaceProperty:GroundSurfaces"; - state.dataSurface->TotSurfPropGndSurfs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "SurfaceProperty:GroundSurfaces"; + state.dataSurface->TotSurfPropGndSurfs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(s_ipsc->cCurrentModuleObject); if (instances == state.dataInputProcessing->inputProcessor->epJSON.end()) { if (state.dataSurface->TotSurfPropGndSurfs > 0) ErrorsFound = true; return; @@ -8456,7 +8399,7 @@ namespace SurfaceGeometry { std::string const &thisObjectName = instance.key(); GroundSurfacesProperty thisGndSurfsObj; thisGndSurfsObj.Name = Util::makeUPPER(thisObjectName); - state.dataInputProcessing->inputProcessor->markObjectAsUsed(cCurrentModuleObject, thisObjectName); + state.dataInputProcessing->inputProcessor->markObjectAsUsed(s_ipsc->cCurrentModuleObject, thisObjectName); auto groundSurfaces = fields.find("ground_surfaces"); if (groundSurfaces != fields.end()) { auto &groundSurfacesArray = groundSurfaces.value(); @@ -8574,70 +8517,67 @@ namespace SurfaceGeometry { int SumHAMTMat; bool msgneeded; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "SurfaceProperty:HeatBalanceSourceTerm"; - int CountAddHeatSourceSurf = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "SurfaceProperty:HeatBalanceSourceTerm"; + int CountAddHeatSourceSurf = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); for (Item = 1; Item <= CountAddHeatSourceSurf; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Item, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - Found = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + Found = Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (Found == 0) { - ShowSevereError(state, - format("{}=\"{}\", did not find matching surface.", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\", did not find matching surface.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } else if (state.dataSurface->Surface(Found).InsideHeatSourceTermSchedule || state.dataSurface->Surface(Found).OutsideHeatSourceTermSchedule) { ShowSevereError(state, format("{}=\"{}\", multiple SurfaceProperty:HeatBalanceSourceTerm objects applied to the same surface.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { - state.dataSurface->Surface(Found).InsideHeatSourceTermSchedule = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); + if (!s_ipsc->lAlphaFieldBlanks(2)) { + state.dataSurface->Surface(Found).InsideHeatSourceTermSchedule = ScheduleManager::GetScheduleIndex(state, s_ipsc->cAlphaArgs(2)); if (state.dataSurface->Surface(Found).InsideHeatSourceTermSchedule == 0) { ShowSevereError(state, format("{}=\"{}\", cannot find the matching Schedule: {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { state.dataSurface->allInsideSourceSurfaceList.emplace_back(Found); } } - if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { - state.dataSurface->Surface(Found).OutsideHeatSourceTermSchedule = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); + if (!s_ipsc->lAlphaFieldBlanks(3)) { + state.dataSurface->Surface(Found).OutsideHeatSourceTermSchedule = ScheduleManager::GetScheduleIndex(state, s_ipsc->cAlphaArgs(3)); if (state.dataSurface->Surface(Found).OutsideHeatSourceTermSchedule == 0) { ShowSevereError(state, format("{}=\"{}\", cannot find the matching Schedule: {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } else if (state.dataSurface->Surface(Found).OSCPtr > 0) { ShowSevereError(state, format("{}=\"SurfaceProperty:HeatBalanceSourceTerm\", cannot be specified for OtherSideCoefficient Surface={}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } else { state.dataSurface->allOutsideSourceSurfaceList.emplace_back(Found); @@ -8647,8 +8587,7 @@ namespace SurfaceGeometry { if (state.dataSurface->Surface(Found).OutsideHeatSourceTermSchedule == 0 && state.dataSurface->Surface(Found).InsideHeatSourceTermSchedule == 0) { ShowSevereError( - state, - format("{}=\"{}\", no schedule defined for additional heat source.", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + state, format("{}=\"{}\", no schedule defined for additional heat source.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } } @@ -8657,34 +8596,33 @@ namespace SurfaceGeometry { for (auto &e : state.dataSurface->Surface) e.HeatTransferAlgorithm = state.dataHeatBal->OverallHeatTransferSolutionAlgo; - cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm"; - CountHTAlgoObjectsSingleSurf = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm"; + CountHTAlgoObjectsSingleSurf = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); - cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm"; + s_ipsc->cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm"; for (Item = 1; Item <= CountHTAlgoObjectsSingleSurf; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Item, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); ErrorsFoundSingleSurf = false; - Found = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + Found = Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (Found == 0) { - ShowSevereError(state, - format("{}=\"{}\", did not find matching surface.", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\", did not find matching surface.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFoundSingleSurf = true; } { - std::string const &SELECT_CASE_var = state.dataIPShortCut->cAlphaArgs(2); + std::string const &SELECT_CASE_var = s_ipsc->cAlphaArgs(2); if (SELECT_CASE_var == "CONDUCTIONTRANSFERFUNCTION") { tmpAlgoInput = DataSurfaces::HeatTransferModel::CTF; @@ -8701,10 +8639,10 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFoundSingleSurf = true; } } @@ -8716,25 +8654,25 @@ namespace SurfaceGeometry { } } // single surface heat transfer algorithm override - cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:MultipleSurface"; - CountHTAlgoObjectsMultiSurf = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:MultipleSurface"; + CountHTAlgoObjectsMultiSurf = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); for (Item = 1; Item <= CountHTAlgoObjectsMultiSurf; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Item, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); ErrorsFoundMultiSurf = false; { - std::string const &SELECT_CASE_var = state.dataIPShortCut->cAlphaArgs(3); + std::string const &SELECT_CASE_var = s_ipsc->cAlphaArgs(3); if (SELECT_CASE_var == "CONDUCTIONTRANSFERFUNCTION") { tmpAlgoInput = DataSurfaces::HeatTransferModel::CTF; @@ -8751,16 +8689,16 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ErrorsFoundMultiSurf = true; } } { - std::string const &SELECT_CASE_var = state.dataIPShortCut->cAlphaArgs(2); + std::string const &SELECT_CASE_var = s_ipsc->cAlphaArgs(2); if (SELECT_CASE_var == "ALLEXTERIORSURFACES") { SurfacesOfType = false; @@ -8870,10 +8808,10 @@ namespace SurfaceGeometry { SurfacesOfType = false; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFoundMultiSurf = true; } } @@ -8882,32 +8820,32 @@ namespace SurfaceGeometry { ShowWarningError( state, format("In {}=\"{}\", for Multiple Surface Assignment=\"{}\", there were no surfaces of that type found for assignment.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaArgs(2))); } if (ErrorsFoundMultiSurf) ErrorsFound = true; } // multi surface heat transfer algo override - cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:SurfaceList"; - CountHTAlgoObjectsSurfList = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:SurfaceList"; + CountHTAlgoObjectsSurfList = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); for (Item = 1; Item <= CountHTAlgoObjectsSurfList; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Item, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); ErrorsFoundSurfList = false; { - std::string const &SELECT_CASE_var = state.dataIPShortCut->cAlphaArgs(2); + std::string const &SELECT_CASE_var = s_ipsc->cAlphaArgs(2); if (SELECT_CASE_var == "CONDUCTIONTRANSFERFUNCTION") { tmpAlgoInput = DataSurfaces::HeatTransferModel::CTF; @@ -8924,22 +8862,21 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFoundSurfList = true; } } for (Item1 = 3; Item1 <= NumAlphas; ++Item1) { - Found = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(Item1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + Found = Util::FindItemInList(s_ipsc->cAlphaArgs(Item1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (Found == 0) { - ShowSevereError(state, - format("{}=\"{}\", did not find matching surface.", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Name of surface not found = \"{}\"", state.dataIPShortCut->cAlphaArgs(Item1))); + ShowSevereError(state, format("{}=\"{}\", did not find matching surface.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Name of surface not found = \"{}\"", s_ipsc->cAlphaArgs(Item1))); ErrorsFoundSurfList = true; } @@ -8951,24 +8888,24 @@ namespace SurfaceGeometry { } } - cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:Construction"; - CountHTAlgoObjectsSurfList = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:Construction"; + CountHTAlgoObjectsSurfList = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); for (Item = 1; Item <= CountHTAlgoObjectsSurfList; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Item, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); ErrorsFoundByConstruct = false; { - std::string const &SELECT_CASE_var = state.dataIPShortCut->cAlphaArgs(2); + std::string const &SELECT_CASE_var = s_ipsc->cAlphaArgs(2); if (SELECT_CASE_var == "CONDUCTIONTRANSFERFUNCTION") { tmpAlgoInput = DataSurfaces::HeatTransferModel::CTF; @@ -8985,22 +8922,22 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFoundByConstruct = true; } } - Found = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + Found = Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ErrorsFoundByConstruct = true; } @@ -9873,10 +9810,11 @@ namespace SurfaceGeometry { // shade or blind int Found; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + auto &s_mat = state.dataMaterial; + auto &s_ipsc = state.dataIPShortCut; // Get the total number of window shading control blocks - cCurrentModuleObject = "WindowShadingControl"; - state.dataSurface->TotWinShadingControl = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "WindowShadingControl"; + state.dataSurface->TotWinShadingControl = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (state.dataSurface->TotWinShadingControl == 0) return; state.dataSurface->WindowShadingControl.allocate(state.dataSurface->TotWinShadingControl); @@ -9885,27 +9823,27 @@ namespace SurfaceGeometry { for (Loop = 1; Loop <= state.dataSurface->TotWinShadingControl; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, ControlNumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, ControlNumProp, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); ErrorInName = false; IsBlank = false; Util::VerifyName(state, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), state.dataSurface->WindowShadingControl, ControlNum, ErrorInName, IsBlank, - cCurrentModuleObject + " Name"); + s_ipsc->cCurrentModuleObject + " Name"); if (ErrorInName) { ErrorsFound = true; continue; @@ -9915,47 +9853,46 @@ namespace SurfaceGeometry { auto &windowShadingControl = state.dataSurface->WindowShadingControl(ControlNum); - windowShadingControl.Name = state.dataIPShortCut->cAlphaArgs(1); // Set the Control Name in the Derived Type + windowShadingControl.Name = s_ipsc->cAlphaArgs(1); // Set the Control Name in the Derived Type - windowShadingControl.ZoneIndex = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataHeatBal->Zone); + windowShadingControl.ZoneIndex = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataHeatBal->Zone); if (windowShadingControl.ZoneIndex == 0) { ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } - windowShadingControl.SequenceNumber = int(state.dataIPShortCut->rNumericArgs(1)); + windowShadingControl.SequenceNumber = int(s_ipsc->rNumericArgs(1)); // WindowShadingControl().getInputShadedConstruction is only used during GetInput process and is ultimately stored in // Surface().shadedConstructionList windowShadingControl.getInputShadedConstruction = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); - windowShadingControl.ShadingDevice = - Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(9), state.dataMaterial->Material, state.dataMaterial->TotMaterials); - windowShadingControl.Schedule = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); - windowShadingControl.SetPoint = state.dataIPShortCut->rNumericArgs(2); - windowShadingControl.SetPoint2 = state.dataIPShortCut->rNumericArgs(3); - windowShadingControl.ShadingControlIsScheduled = getYesNoValue(state.dataIPShortCut->cAlphaArgs(7)) == BooleanSwitch::Yes; - windowShadingControl.GlareControlIsActive = getYesNoValue(state.dataIPShortCut->cAlphaArgs(8)) == BooleanSwitch::Yes; - windowShadingControl.SlatAngleSchedule = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(11)); + Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + windowShadingControl.ShadingDevice = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(9)); + windowShadingControl.Schedule = GetScheduleIndex(state, s_ipsc->cAlphaArgs(6)); + windowShadingControl.SetPoint = s_ipsc->rNumericArgs(2); + windowShadingControl.SetPoint2 = s_ipsc->rNumericArgs(3); + windowShadingControl.ShadingControlIsScheduled = getYesNoValue(s_ipsc->cAlphaArgs(7)) == BooleanSwitch::Yes; + windowShadingControl.GlareControlIsActive = getYesNoValue(s_ipsc->cAlphaArgs(8)) == BooleanSwitch::Yes; + windowShadingControl.SlatAngleSchedule = GetScheduleIndex(state, s_ipsc->cAlphaArgs(11)); // store the string for now and associate it after daylighting control objects are read - windowShadingControl.DaylightingControlName = state.dataIPShortCut->cAlphaArgs(12); + windowShadingControl.DaylightingControlName = s_ipsc->cAlphaArgs(12); windowShadingControl.multiSurfaceControl = - static_cast(getEnumValue(MultiSurfaceControlNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(13)))); + static_cast(getEnumValue(MultiSurfaceControlNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(13)))); if (windowShadingControl.multiSurfaceControl == MultiSurfaceControl::Invalid) { windowShadingControl.multiSurfaceControl = MultiSurfaceControl::Sequential; ShowWarningError(state, format("{}=\"{}\" should be either SEQUENTIAL or GROUP {}=\"{}\", defaulting to \"SEQUENTIAL\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(13), - state.dataIPShortCut->cAlphaArgs(13))); + s_ipsc->cAlphaFieldNames(13), + s_ipsc->cAlphaArgs(13))); } if (ControlNumAlpha >= 14) { @@ -9963,65 +9900,62 @@ namespace SurfaceGeometry { windowShadingControl.FenestrationName.allocate(windowShadingControl.FenestrationCount); windowShadingControl.FenestrationIndex.allocate(windowShadingControl.FenestrationCount); for (int i = 1; i <= windowShadingControl.FenestrationCount; i++) { - windowShadingControl.FenestrationName(i) = state.dataIPShortCut->cAlphaArgs(i + 13); + windowShadingControl.FenestrationName(i) = s_ipsc->cAlphaArgs(i + 13); } } else { ShowSevereError(state, format("{}=\"{}\" invalid. Must reference at least one Fenestration Surface object name.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); } - windowShadingControl.shadingControlType = static_cast( - getEnumValue(WindowShadingControlTypeNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(5)))); + windowShadingControl.shadingControlType = + static_cast(getEnumValue(WindowShadingControlTypeNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(5)))); if (windowShadingControl.ShadingDevice > 0) { - if (state.dataMaterial->Material(windowShadingControl.ShadingDevice)->group == Material::Group::Screen && + if (s_mat->materials(windowShadingControl.ShadingDevice)->group == Material::Group::Screen && !(windowShadingControl.shadingControlType == WindowShadingControlType::AlwaysOn || windowShadingControl.shadingControlType == WindowShadingControlType::AlwaysOff || windowShadingControl.shadingControlType == WindowShadingControlType::OnIfScheduled)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" for exterior screens.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); ShowContinueError(state, "Valid shading control types for exterior window screens are ALWAYSON, ALWAYSOFF, or ONIFSCHEDULEALLOWS."); } } else { if (windowShadingControl.getInputShadedConstruction > 0) { state.dataConstruction->Construct(windowShadingControl.getInputShadedConstruction).IsUsed = true; - if (state.dataMaterial->Material(state.dataConstruction->Construct(windowShadingControl.getInputShadedConstruction).LayerPoint(1)) - ->group == Material::Group::Screen && + if (s_mat->materials(state.dataConstruction->Construct(windowShadingControl.getInputShadedConstruction).LayerPoint(1))->group == + Material::Group::Screen && !(windowShadingControl.shadingControlType == WindowShadingControlType::AlwaysOn || windowShadingControl.shadingControlType == WindowShadingControlType::AlwaysOff || windowShadingControl.shadingControlType == WindowShadingControlType::OnIfScheduled)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" for exterior screens.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); ShowContinueError(state, "Valid shading control types for exterior window screens are ALWAYSON, ALWAYSOFF, or ONIFSCHEDULEALLOWS."); } - } else if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { + } else if (s_ipsc->lAlphaFieldBlanks(4)) { ShowSevereError( state, - format( - "{}=\"{}\", {} is blank.", cCurrentModuleObject, windowShadingControl.Name, state.dataIPShortCut->cAlphaFieldNames(4))); + format("{}=\"{}\", {} is blank.", s_ipsc->cCurrentModuleObject, windowShadingControl.Name, s_ipsc->cAlphaFieldNames(4))); ShowContinueError(state, "A valid construction is required."); ErrorsFound = true; } else { ShowSevereError( state, - format( - "{}=\"{}\", {} is invalid.", cCurrentModuleObject, windowShadingControl.Name, state.dataIPShortCut->cAlphaFieldNames(4))); - ShowContinueError(state, - format("Construction=\"{}\" was used. A valid construction is required.", state.dataIPShortCut->cAlphaArgs(4))); + format("{}=\"{}\", {} is invalid.", s_ipsc->cCurrentModuleObject, windowShadingControl.Name, s_ipsc->cAlphaFieldNames(4))); + ShowContinueError(state, format("Construction=\"{}\" was used. A valid construction is required.", s_ipsc->cAlphaArgs(4))); ErrorsFound = true; } } @@ -10031,28 +9965,28 @@ namespace SurfaceGeometry { windowShadingControl.shadingControlType != WindowShadingControlType::AlwaysOff && windowShadingControl.shadingControlType != WindowShadingControlType::OnIfScheduled && windowShadingControl.shadingControlType != WindowShadingControlType::HiGlare) { - ShowWarningError(state, format("{}=\"{}\", The first SetPoint is zero.", cCurrentModuleObject, windowShadingControl.Name)); + ShowWarningError(state, format("{}=\"{}\", The first SetPoint is zero.", s_ipsc->cCurrentModuleObject, windowShadingControl.Name)); ShowContinueError(state, "..You may have forgotten to specify that setpoint."); } // Error checks - if (state.dataIPShortCut->cAlphaArgs(7) != "YES" && state.dataIPShortCut->cAlphaArgs(7) != "NO") { // Shading Control is Schedule field + if (s_ipsc->cAlphaArgs(7) != "YES" && s_ipsc->cAlphaArgs(7) != "NO") { // Shading Control is Schedule field ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(7), - state.dataIPShortCut->cAlphaArgs(7))); + s_ipsc->cAlphaFieldNames(7), + s_ipsc->cAlphaArgs(7))); } - if (state.dataIPShortCut->cAlphaArgs(8) != "YES" && state.dataIPShortCut->cAlphaArgs(8) != "NO") { // Glare Control is Active field + if (s_ipsc->cAlphaArgs(8) != "YES" && s_ipsc->cAlphaArgs(8) != "NO") { // Glare Control is Active field ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(8), - state.dataIPShortCut->cAlphaArgs(8))); + s_ipsc->cAlphaFieldNames(8), + s_ipsc->cAlphaArgs(8))); } if ((windowShadingControl.shadingControlType == WindowShadingControlType::OnIfScheduled) && @@ -10060,64 +9994,62 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{} = \"{}\" invalid, {} must be set to \"Yes\" for {} = OnIfScheduleAllows", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(7), - state.dataIPShortCut->cAlphaFieldNames(5))); + s_ipsc->cAlphaFieldNames(7), + s_ipsc->cAlphaFieldNames(5))); } windowShadingControl.slatAngleControl = - static_cast(getEnumValue(SlatAngleNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(10)))); + static_cast(getEnumValue(SlatAngleNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(10)))); // For upward compatibility change old "noninsulating" and "insulating" shade types to // INTERIORSHADE or EXTERIORSHADE - if (state.dataIPShortCut->cAlphaArgs(3) == "INTERIORNONINSULATINGSHADE" || - state.dataIPShortCut->cAlphaArgs(3) == "INTERIORINSULATINGSHADE") { + if (s_ipsc->cAlphaArgs(3) == "INTERIORNONINSULATINGSHADE" || s_ipsc->cAlphaArgs(3) == "INTERIORINSULATINGSHADE") { ShowWarningError(state, format("{}=\"{}\" is using obsolete {}=\"{}\", changing to \"InteriorShade\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); windowShadingControl.ShadingType = WinShadingType::IntShade; - state.dataIPShortCut->cAlphaArgs(3) = "INTERIORSHADE"; + s_ipsc->cAlphaArgs(3) = "INTERIORSHADE"; } - if (state.dataIPShortCut->cAlphaArgs(3) == "EXTERIORNONINSULATINGSHADE" || - state.dataIPShortCut->cAlphaArgs(3) == "EXTERIORINSULATINGSHADE") { + if (s_ipsc->cAlphaArgs(3) == "EXTERIORNONINSULATINGSHADE" || s_ipsc->cAlphaArgs(3) == "EXTERIORINSULATINGSHADE") { ShowWarningError(state, format("{}=\"{}\" is using obsolete {}=\"{}\", changing to \"ExteriorShade\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); windowShadingControl.ShadingType = WinShadingType::ExtShade; - state.dataIPShortCut->cAlphaArgs(3) = "EXTERIORSHADE"; + s_ipsc->cAlphaArgs(3) = "EXTERIORSHADE"; } if (windowShadingControl.shadingControlType == WindowShadingControlType::MeetDaylIlumSetp && - state.dataIPShortCut->cAlphaArgs(3) != "SWITCHABLEGLAZING") { + s_ipsc->cAlphaArgs(3) != "SWITCHABLEGLAZING") { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ShowContinueError(state, format("...{} must be SwitchableGlazing for this control, but entered type=\"{}\".", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); } // Check for illegal shading type name - Found = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), cValidShadingTypes, NumValidShadingTypes); + Found = Util::FindItemInList(s_ipsc->cAlphaArgs(3), cValidShadingTypes, NumValidShadingTypes); if (Found <= 1) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\".", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); } else { windowShadingControl.ShadingType = WinShadingType(Found); } @@ -10127,77 +10059,69 @@ namespace SurfaceGeometry { IShadingDevice = windowShadingControl.ShadingDevice; if (IShadedConst == 0 && IShadingDevice == 0) { - ShowSevereError( - state, - format("{}=\"{}\" has no matching shaded construction or shading device.", cCurrentModuleObject, windowShadingControl.Name)); + ShowSevereError(state, + format("{}=\"{}\" has no matching shaded construction or shading device.", + s_ipsc->cCurrentModuleObject, + windowShadingControl.Name)); ErrorsFound = true; } else if (IShadedConst == 0 && IShadingDevice > 0) { if (ShTyp == WinShadingType::SwitchableGlazing) { ShowSevereError(state, format("{}=\"{}\" has {}= SwitchableGlazing but no matching shaded construction", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } if ((ShTyp == WinShadingType::IntShade || ShTyp == WinShadingType::ExtShade) && - state.dataMaterial->Material(IShadingDevice)->group != Material::Group::Shade) { + s_mat->materials(IShadingDevice)->group != Material::Group::Shade) { ShowSevereError(state, format("{}=\"{}\" has {}= InteriorShade or ExteriorShade but matching shading device is not a window shade", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError( - state, - format("{} in error=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(8), state.dataMaterial->Material(IShadingDevice)->Name)); + s_ipsc->cAlphaArgs(3))); + ShowContinueError(state, format("{} in error=\"{}\".", s_ipsc->cAlphaFieldNames(8), s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } - if ((ShTyp == WinShadingType::ExtScreen) && state.dataMaterial->Material(IShadingDevice)->group != Material::Group::Screen) { + if ((ShTyp == WinShadingType::ExtScreen) && s_mat->materials(IShadingDevice)->group != Material::Group::Screen) { ShowSevereError(state, format("{}=\"{}\" has {}= ExteriorScreen but matching shading device is not a window screen", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError( - state, - format("{} in error=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(8), state.dataMaterial->Material(IShadingDevice)->Name)); + s_ipsc->cAlphaArgs(3))); + ShowContinueError(state, format("{} in error=\"{}\".", s_ipsc->cAlphaFieldNames(8), s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } if ((ShTyp == WinShadingType::IntBlind || ShTyp == WinShadingType::ExtBlind) && - state.dataMaterial->Material(IShadingDevice)->group != Material::Group::WindowBlind) { + s_mat->materials(IShadingDevice)->group != Material::Group::Blind) { ShowSevereError(state, format("{}=\"{}\" has {}= InteriorBlind or ExteriorBlind but matching shading device is not a window blind", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError( - state, - format("{} in error=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(8), state.dataMaterial->Material(IShadingDevice)->Name)); + s_ipsc->cAlphaArgs(3))); + ShowContinueError(state, format("{} in error=\"{}\".", s_ipsc->cAlphaFieldNames(8), s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } if (ShTyp == WinShadingType::BGShade || ShTyp == WinShadingType::BGBlind) { ShowSevereError(state, format("{}=\"{}\" has {}= BetweenGlassShade or BetweenGlassBlind and", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError( - state, - format("{} is specified. This is illegal. Specify shaded construction instead.", state.dataIPShortCut->cAlphaFieldNames(8))); + s_ipsc->cAlphaArgs(3))); + ShowContinueError(state, + format("{} is specified. This is illegal. Specify shaded construction instead.", s_ipsc->cAlphaFieldNames(8))); ErrorsFound = true; } } else if (IShadedConst > 0 && IShadingDevice > 0) { IShadingDevice = 0; ShowWarningError(state, format("{}=\"{}\" Both {} and {} are specified.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaFieldNames(9))); - ShowContinueError(state, - format("The {}=\"{}\" will be used.", - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataConstruction->Construct(IShadedConst).Name)); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaFieldNames(9))); + ShowContinueError( + state, format("The {}=\"{}\" will be used.", s_ipsc->cAlphaFieldNames(4), state.dataConstruction->Construct(IShadedConst).Name)); } // If type = interior or exterior shade or blind require that the shaded construction @@ -10210,166 +10134,157 @@ namespace SurfaceGeometry { if (state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers) != 0) { if (windowShadingControl.ShadingType == WinShadingType::IntShade) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers); - if (state.dataMaterial->Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers))->group != - Material::Group::Shade) { + if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers))->group != Material::Group::Shade) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" the {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("of {}=\"{}\" should have a shade layer on the inside of the window.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); } } else if (windowShadingControl.ShadingType == WinShadingType::ExtShade) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(1); - if (state.dataMaterial->Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(1))->group != - Material::Group::Shade) { + if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(1))->group != Material::Group::Shade) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" the {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(43), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(43), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("of {}=\"{}\" should have a shade layer on the outside of the window.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); } } else if (windowShadingControl.ShadingType == WinShadingType::ExtScreen) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(1); - if (state.dataMaterial->Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(1))->group != - Material::Group::Screen) { + if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(1))->group != Material::Group::Screen) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" the {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("of {}=\"{}\" should have a screen layer on the outside of the window.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); } } else if (windowShadingControl.ShadingType == WinShadingType::IntBlind) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers); - if (state.dataMaterial->Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers))->group != - Material::Group::WindowBlind) { + if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers))->group != Material::Group::Blind) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" the {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("of {}=\"{}\" should have a blind layer on the inside of the window.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); } } else if (windowShadingControl.ShadingType == WinShadingType::ExtBlind) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(1); - if (state.dataMaterial->Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(1))->group != - Material::Group::WindowBlind) { + if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(1))->group != Material::Group::Blind) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" the {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("of {}=\"{}\" should have a blind layer on the outside of the window.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); } } else if (windowShadingControl.ShadingType == WinShadingType::BGShade) { if (NLayers != 5 && NLayers != 7) BGShadeBlindError = true; if (NLayers == 5) { - if (state.dataMaterial->Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(3))->group != - Material::Group::Shade) + if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(3))->group != Material::Group::Shade) BGShadeBlindError = true; } if (NLayers == 7) { - if (state.dataMaterial->Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(5))->group != - Material::Group::Shade) + if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(5))->group != Material::Group::Shade) BGShadeBlindError = true; } if (BGShadeBlindError) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" the {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("of {}=\"{}\" should have two or three glass layers and a", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(32))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(32))); ShowContinueError(state, "between-glass shade layer with a gas layer on each side."); } } else if (windowShadingControl.ShadingType == WinShadingType::BGBlind) { if (NLayers != 5 && NLayers != 7) BGShadeBlindError = true; if (NLayers == 5) { - if (state.dataMaterial->Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(3))->group != - Material::Group::WindowBlind) + if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(3))->group != Material::Group::Blind) BGShadeBlindError = true; } if (NLayers == 7) { - if (state.dataMaterial->Material(state.dataConstruction->Construct(IShadedConst).LayerPoint(5))->group != - Material::Group::WindowBlind) + if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(5))->group != Material::Group::Blind) BGShadeBlindError = true; } if (BGShadeBlindError) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" the {}=\"{}\"", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("of {}=\"{}\" should have two or three glass layers and a", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ShowContinueError(state, "between-glass blind layer with a gas layer on each side."); } } } if (IShadingDevice > 0) { if ((ShTyp == WinShadingType::IntShade || ShTyp == WinShadingType::ExtShade) && - state.dataMaterial->Material(IShadingDevice)->group != Material::Group::Shade) { + s_mat->materials(IShadingDevice)->group != Material::Group::Shade) { ShowSevereError(state, format("{}=\"{}\" has {}= InteriorShade or ExteriorShade but matching shading device is not a window shade", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Shading Device in error=\"{}\".", state.dataMaterial->Material(IShadingDevice)->Name)); + s_ipsc->cAlphaFieldNames(3))); + ShowContinueError(state, format("Shading Device in error=\"{}\".", s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } - if ((ShTyp == WinShadingType::ExtScreen) && state.dataMaterial->Material(IShadingDevice)->group != Material::Group::Screen) { + if ((ShTyp == WinShadingType::ExtScreen) && s_mat->materials(IShadingDevice)->group != Material::Group::Screen) { ShowSevereError(state, format("{}=\"{}\" has {}= ExteriorScreen but matching shading device is not an exterior window screen.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Shading Device in error=\"{}\".", state.dataMaterial->Material(IShadingDevice)->Name)); + s_ipsc->cAlphaFieldNames(3))); + ShowContinueError(state, format("Shading Device in error=\"{}\".", s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } if ((ShTyp == WinShadingType::IntBlind || ShTyp == WinShadingType::ExtBlind) && - state.dataMaterial->Material(IShadingDevice)->group != Material::Group::WindowBlind) { + s_mat->materials(IShadingDevice)->group != Material::Group::Blind) { ShowSevereError(state, format("{}=\"{}\" has {}= InteriorBlind or ExteriorBlind but matching shading device is not a window blind.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, windowShadingControl.Name, - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Shading Device in error=\"{}\".", state.dataMaterial->Material(IShadingDevice)->Name)); + s_ipsc->cAlphaFieldNames(3))); + ShowContinueError(state, format("Shading Device in error=\"{}\".", s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } } @@ -10518,11 +10433,12 @@ namespace SurfaceGeometry { int SurfNum; // Surface number int MatNum; // Material number - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; // Get the total number of storm window input objects - cCurrentModuleObject = "WindowProperty:StormWindow"; - state.dataSurface->TotStormWin = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "WindowProperty:StormWindow"; + state.dataSurface->TotStormWin = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (state.dataSurface->TotStormWin == 0) return; state.dataSurface->StormWindow.allocate(state.dataSurface->TotStormWin); @@ -10531,36 +10447,35 @@ namespace SurfaceGeometry { for (loop = 1; loop <= state.dataSurface->TotStormWin; ++loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, StormWinNumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, StormWinNumProp, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); ++StormWinNum; state.dataSurface->StormWindow(StormWinNum).BaseWindowNum = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); - state.dataSurface->StormWindow(StormWinNum).StormWinMaterialNum = - Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(2), state.dataMaterial->Material, state.dataMaterial->TotMaterials); - state.dataSurface->StormWindow(StormWinNum).StormWinDistance = state.dataIPShortCut->rNumericArgs(1); - state.dataSurface->StormWindow(StormWinNum).MonthOn = state.dataIPShortCut->rNumericArgs(2); - state.dataSurface->StormWindow(StormWinNum).DayOfMonthOn = state.dataIPShortCut->rNumericArgs(3); + Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + state.dataSurface->StormWindow(StormWinNum).StormWinMaterialNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(2)); + state.dataSurface->StormWindow(StormWinNum).StormWinDistance = s_ipsc->rNumericArgs(1); + state.dataSurface->StormWindow(StormWinNum).MonthOn = s_ipsc->rNumericArgs(2); + state.dataSurface->StormWindow(StormWinNum).DayOfMonthOn = s_ipsc->rNumericArgs(3); state.dataSurface->StormWindow(StormWinNum).DateOn = General::OrdinalDay(state.dataSurface->StormWindow(StormWinNum).MonthOn, state.dataSurface->StormWindow(StormWinNum).DayOfMonthOn, 1); - state.dataSurface->StormWindow(StormWinNum).MonthOff = state.dataIPShortCut->rNumericArgs(4); - state.dataSurface->StormWindow(StormWinNum).DayOfMonthOff = state.dataIPShortCut->rNumericArgs(5); + state.dataSurface->StormWindow(StormWinNum).MonthOff = s_ipsc->rNumericArgs(4); + state.dataSurface->StormWindow(StormWinNum).DayOfMonthOff = s_ipsc->rNumericArgs(5); state.dataSurface->StormWindow(StormWinNum).DateOff = General::OrdinalDay( state.dataSurface->StormWindow(StormWinNum).MonthOff, state.dataSurface->StormWindow(StormWinNum).DayOfMonthOff, 1); if (state.dataSurface->StormWindow(StormWinNum).DateOn == state.dataSurface->StormWindow(StormWinNum).DateOff) { ShowSevereError(state, format("{}: Date On = Date Off -- not allowed, occurred in WindowProperty:StormWindow Input #{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, StormWinNum)); ErrorsFound = true; } @@ -10588,7 +10503,7 @@ namespace SurfaceGeometry { oneBasedDaysInMonth[state.dataSurface->StormWindow(StormWinNum).MonthOn]) { ShowSevereError(state, format("{}: Date On (Day of Month) [{}], invalid for WindowProperty:StormWindow Input #{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->StormWindow(StormWinNum).DayOfMonthOn, StormWinNum)); ErrorsFound = true; @@ -10597,7 +10512,7 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}: Date On Month [{}], invalid for WindowProperty:StormWindow Input #{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->StormWindow(StormWinNum).MonthOn, StormWinNum)); ErrorsFound = true; @@ -10609,7 +10524,7 @@ namespace SurfaceGeometry { oneBasedDaysInMonth[state.dataSurface->StormWindow(StormWinNum).MonthOff]) { ShowSevereError(state, format("{}: Date Off (Day of Month) [{}], invalid for WindowProperty:StormWindow Input #{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->StormWindow(StormWinNum).DayOfMonthOff, StormWinNum)); ErrorsFound = true; @@ -10618,7 +10533,7 @@ namespace SurfaceGeometry { } else { ShowSevereError(state, format("{}: Date Off Month [{}], invalid for WindowProperty:StormWindow Input #{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, state.dataSurface->StormWindow(StormWinNum).MonthOff, StormWinNum)); ErrorsFound = true; @@ -10631,13 +10546,13 @@ namespace SurfaceGeometry { // Require BaseWindowNum be that of an exterior window SurfNum = state.dataSurface->StormWindow(StormWinNum).BaseWindowNum; if (SurfNum == 0) { - ShowSevereError(state, format("{}=\"{}\" invalid.", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\" invalid.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } else { auto const &surf = state.dataSurface->Surface(SurfNum); if (surf.Class != SurfaceClass::Window || surf.ExtBoundCond != 0) { - ShowSevereError(state, format("{}=\"{}\"", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("cannot be used with surface={}", surf.Name)); + ShowSevereError(state, format("{}=\"{}\"", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowSevereError(state, format("cannot be used with surface={}", surf.Name)); ShowContinueError(state, "because that surface is not an exterior window."); ErrorsFound = true; } @@ -10647,19 +10562,17 @@ namespace SurfaceGeometry { MatNum = state.dataSurface->StormWindow(StormWinNum).StormWinMaterialNum; if (SurfNum > 0) { if (MatNum == 0) { - ShowSevereError(state, format("{}=\"{}\"", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\"", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, - format("{}=\"{}\" not found as storm window layer.", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + format("{}=\"{}\" not found as storm window layer.", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { - if (state.dataMaterial->Material(MatNum)->group != Material::Group::WindowGlass) { - ShowSevereError(state, format("{}=\"{}\"", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (s_mat->materials(MatNum)->group != Material::Group::Glass) { + ShowSevereError(state, format("{}=\"{}\"", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("{}=\"{}must be a WindowMaterial:Glazing or WindowMaterial:Glazing:RefractionExtinctionMethod", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } } @@ -10671,8 +10584,8 @@ namespace SurfaceGeometry { ShowSevereError( state, format("{}=\"{} cannot be used because it is an airflow window (i.e., has WindowProperty:AirflowControl specified)", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } } @@ -10683,8 +10596,7 @@ namespace SurfaceGeometry { (state.dataSurface->StormWindow(StormWinNum).MonthOn < state.dataSurface->StormWindow(StormWinNum).MonthOff)) || (state.dataEnvrn->Latitude <= 0.0 && (state.dataSurface->StormWindow(StormWinNum).MonthOn > state.dataSurface->StormWindow(StormWinNum).MonthOff))) { - ShowWarningError(state, - format("{}=\"{}\" check times that storm window", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}=\"{}\" check times that storm window", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("is put on (month={}, day={}) and taken off (month={}, day={});", state.dataSurface->StormWindow(StormWinNum).MonthOn, @@ -10714,7 +10626,8 @@ namespace SurfaceGeometry { // Using/Aliasing using ScheduleManager::GetScheduleIndex; - static constexpr std::string_view RoutineName("GetWindowGapAirflowControlData"); + static constexpr std::string_view routineName = "GetWindowGapAirflowControlData"; + int IOStat; // IO Status when calling get input subroutine int ControlNumAlpha; // Number of control alpha names being passed int ControlNumProp; // Number of control properties being passed @@ -10733,30 +10646,32 @@ namespace SurfaceGeometry { "INDOORAIR", "OUTDOORAIR", "RETURNAIR"}; // of the shaded construction of airflow window - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; + // Get the total number of window airflow control statements - cCurrentModuleObject = "WindowProperty:AirflowControl"; - TotWinAirflowControl = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "WindowProperty:AirflowControl"; + TotWinAirflowControl = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (TotWinAirflowControl == 0) return; for (Loop = 1; Loop <= TotWinAirflowControl; ++Loop) { // Loop through all surfaces in the input... state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, ControlNumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, ControlNumProp, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - SurfNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + SurfNum = Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (SurfNum == 0) { - ShowSevereError(state, format("{}=\"{}\" not found.", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\" not found.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // Check that associated surface is a 2- or 3-pane exterior window @@ -10772,122 +10687,120 @@ namespace SurfaceGeometry { if (surf.ExtBoundCond != ExternalEnvironment) WrongSurfaceType = true; } if (WrongSurfaceType) { - ShowSevereError(state, - format("{}=\"{}\" is not an exterior window with 2 or 3 glass layers.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError( + state, + format("{}=\"{}\" is not an exterior window with 2 or 3 glass layers.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } } // Error if illegal airflow source - if (state.dataIPShortCut->cAlphaArgs(2) != "INDOORAIR" && state.dataIPShortCut->cAlphaArgs(2) != "OUTDOORAIR") { + if (s_ipsc->cAlphaArgs(2) != "INDOORAIR" && s_ipsc->cAlphaArgs(2) != "OUTDOORAIR") { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); } // Error if illegal airflow destination - if (state.dataIPShortCut->cAlphaArgs(3) != "INDOORAIR" && state.dataIPShortCut->cAlphaArgs(3) != "OUTDOORAIR" && - state.dataIPShortCut->cAlphaArgs(3) != "RETURNAIR") { + if (s_ipsc->cAlphaArgs(3) != "INDOORAIR" && s_ipsc->cAlphaArgs(3) != "OUTDOORAIR" && s_ipsc->cAlphaArgs(3) != "RETURNAIR") { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); } // Error if source = OutsideAir and destination = ReturnAir - if (state.dataIPShortCut->cAlphaArgs(2) == "OUTDOORAIR" && state.dataIPShortCut->cAlphaArgs(3) == "RETURNAIR") { + if (s_ipsc->cAlphaArgs(2) == "OUTDOORAIR" && s_ipsc->cAlphaArgs(3) == "RETURNAIR") { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("..when {}=\"{}\"", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, format("..when {}=\"{}\"", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } // Error if illegal airflow control type - if (state.dataIPShortCut->cAlphaArgs(4) != "ALWAYSONATMAXIMUMFLOW" && state.dataIPShortCut->cAlphaArgs(4) != "ALWAYSOFF" && - state.dataIPShortCut->cAlphaArgs(4) != "SCHEDULEDONLY") { + if (s_ipsc->cAlphaArgs(4) != "ALWAYSONATMAXIMUMFLOW" && s_ipsc->cAlphaArgs(4) != "ALWAYSOFF" && + s_ipsc->cAlphaArgs(4) != "SCHEDULEDONLY") { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); } // Error if illegal value for Airflow Has Multiplier Schedule - if (state.dataIPShortCut->cAlphaArgs(5) != "YES" && state.dataIPShortCut->cAlphaArgs(5) != "NO") { + if (s_ipsc->cAlphaArgs(5) != "YES" && s_ipsc->cAlphaArgs(5) != "NO") { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } // Error if Airflow Control Type = ScheduledOnly and Airflow Has Multiplier Schedule = No - if (state.dataIPShortCut->cAlphaArgs(4) == "SCHEDULEDONLY" && state.dataIPShortCut->cAlphaArgs(5) == "NO") { + if (s_ipsc->cAlphaArgs(4) == "SCHEDULEDONLY" && s_ipsc->cAlphaArgs(5) == "NO") { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, format("..when {}=\"{}\"", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); + ShowContinueError(state, format("..when {}=\"{}\"", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); } // Warning if Airflow Control Type = AlwaysOnAtMaxFlow and Airflow Has Multiplier Schedule = Yes - if (state.dataIPShortCut->cAlphaArgs(4) == "ALWAYSONATMAXIMUMFLOW" && state.dataIPShortCut->cAlphaArgs(5) == "YES") { + if (s_ipsc->cAlphaArgs(4) == "ALWAYSONATMAXIMUMFLOW" && s_ipsc->cAlphaArgs(5) == "YES") { ShowWarningError(state, format("{}=\"{}has {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("..but {}=\"{}If specified, the {} will be ignored.", - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5), - state.dataIPShortCut->cAlphaFieldNames(5))); + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5), + s_ipsc->cAlphaFieldNames(5))); } // Warning if Airflow Control Type = AlwaysOff and Airflow Has Multiplier Schedule = Yes - if (state.dataIPShortCut->cAlphaArgs(4) == "ALWAYSOFF" && state.dataIPShortCut->cAlphaArgs(5) == "YES") { + if (s_ipsc->cAlphaArgs(4) == "ALWAYSOFF" && s_ipsc->cAlphaArgs(5) == "YES") { ShowWarningError(state, format("{}=\"{}has {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("..but {}=\"{}\". If specified, the {} will be ignored.", - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5), - state.dataIPShortCut->cAlphaFieldNames(5))); + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5), + s_ipsc->cAlphaFieldNames(5))); } if (SurfNum > 0) { auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->AirflowWindows = true; state.dataSurface->SurfWinAirflowSource(SurfNum) = - static_cast(getEnumValue(WindowAirFlowSourceNamesUC, state.dataIPShortCut->cAlphaArgs(2))); + static_cast(getEnumValue(WindowAirFlowSourceNamesUC, s_ipsc->cAlphaArgs(2))); state.dataSurface->SurfWinAirflowDestination(SurfNum) = - static_cast(getEnumValue(WindowAirFlowDestinationNamesUC, state.dataIPShortCut->cAlphaArgs(3))); + static_cast(getEnumValue(WindowAirFlowDestinationNamesUC, s_ipsc->cAlphaArgs(3))); if (state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Return) { int controlledZoneNum = DataZoneEquipment::GetControlledZoneIndex(state, surf.ZoneName); @@ -10898,64 +10811,63 @@ namespace SurfaceGeometry { // Set return air node number state.dataSurface->SurfWinAirflowReturnNodePtr(SurfNum) = 0; std::string retNodeName = ""; - if (!state.dataIPShortCut->lAlphaFieldBlanks(7)) { - retNodeName = state.dataIPShortCut->cAlphaArgs(7); + if (!s_ipsc->lAlphaFieldBlanks(7)) { + retNodeName = s_ipsc->cAlphaArgs(7); } - std::string callDescription = cCurrentModuleObject + "=" + surf.Name; + std::string callDescription = s_ipsc->cCurrentModuleObject + "=" + surf.Name; state.dataSurface->SurfWinAirflowReturnNodePtr(SurfNum) = DataZoneEquipment::GetReturnAirNodeForZone(state, surf.Zone, retNodeName, callDescription); if (state.dataSurface->SurfWinAirflowReturnNodePtr(SurfNum) == 0) { ShowSevereError(state, format("{}{}=\"{}\", airflow window return air node not found for {} = {}", - RoutineName, - cCurrentModuleObject, + routineName, + s_ipsc->cCurrentModuleObject, surf.Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); - if (!state.dataIPShortCut->lAlphaFieldBlanks(7)) - ShowContinueError(state, - format("{}=\"{}\" did not find a matching return air node.", - state.dataIPShortCut->cAlphaFieldNames(7), - state.dataIPShortCut->cAlphaArgs(7))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); + if (!s_ipsc->lAlphaFieldBlanks(7)) + ShowContinueError( + state, + format("{}=\"{}\" did not find a matching return air node.", s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7))); ShowContinueError(state, "..Airflow windows with Airflow Destination = ReturnAir must reference a controlled Zone (appear in a " "ZoneHVAC:EquipmentConnections object) with at least one return air node."); ErrorsFound = true; } } - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(4), "AlwaysOnAtMaximumFlow")) { + if (Util::SameString(s_ipsc->cAlphaArgs(4), "AlwaysOnAtMaximumFlow")) { state.dataSurface->SurfWinAirflowControlType(SurfNum) = WindowAirFlowControlType::MaxFlow; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(4), "AlwaysOff")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(4), "AlwaysOff")) { state.dataSurface->SurfWinAirflowControlType(SurfNum) = WindowAirFlowControlType::AlwaysOff; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(4), "ScheduledOnly")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(4), "ScheduledOnly")) { state.dataSurface->SurfWinAirflowControlType(SurfNum) = WindowAirFlowControlType::Schedule; } - state.dataSurface->SurfWinMaxAirflow(SurfNum) = state.dataIPShortCut->rNumericArgs(1); - if (state.dataIPShortCut->cAlphaArgs(4) == "SCHEDULEDONLY" && state.dataIPShortCut->cAlphaArgs(5) == "YES") { - if (state.dataIPShortCut->lAlphaFieldBlanks(6)) { + state.dataSurface->SurfWinMaxAirflow(SurfNum) = s_ipsc->rNumericArgs(1); + if (s_ipsc->cAlphaArgs(4) == "SCHEDULEDONLY" && s_ipsc->cAlphaArgs(5) == "YES") { + if (s_ipsc->lAlphaFieldBlanks(6)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", has {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ShowContinueError(state, format("..and {}=\"{}\", but no {} specified.", - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5), - state.dataIPShortCut->cAlphaFieldNames(6))); + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5), + s_ipsc->cAlphaFieldNames(6))); } else { state.dataSurface->SurfWinAirflowHasSchedule(SurfNum) = true; - state.dataSurface->SurfWinAirflowSchedulePtr(SurfNum) = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); + state.dataSurface->SurfWinAirflowSchedulePtr(SurfNum) = GetScheduleIndex(state, s_ipsc->cAlphaArgs(6)); if (state.dataSurface->SurfWinAirflowSchedulePtr(SurfNum) == 0) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(6), - state.dataIPShortCut->cAlphaArgs(6))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(6), + s_ipsc->cAlphaArgs(6))); } } } @@ -10963,20 +10875,19 @@ namespace SurfaceGeometry { if (surf.ExtBoundCond != ExternalEnvironment && !ErrorsFound) ShowWarningError(state, format("{}=\"{}\", is an Interior window; cannot be an airflow window.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); if (!ErrorsFound) { // Require that gas in airflow gap has type = air MatGapFlow = state.dataConstruction->Construct(ConstrNum).LayerPoint(2); if (state.dataConstruction->Construct(ConstrNum).TotGlassLayers == 3) MatGapFlow = state.dataConstruction->Construct(ConstrNum).LayerPoint(4); - if (dynamic_cast(state.dataMaterial->Material(MatGapFlow))->gases[0].type != - Material::GasType::Air) { + if (dynamic_cast(s_mat->materials(MatGapFlow))->gases[0].type != Material::GasType::Air) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", Gas type not air in airflow gap of construction {}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), state.dataConstruction->Construct(ConstrNum).Name)); } // Require that gas be air in airflow gaps on either side of a between glass shade/blind @@ -10992,15 +10903,15 @@ namespace SurfaceGeometry { MatGapFlow1 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(4); MatGapFlow2 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(6); } - if (dynamic_cast(state.dataMaterial->Material(MatGapFlow1))->gases[0].type != + if (dynamic_cast(s_mat->materials(MatGapFlow1))->gases[0].type != Material::GasType::Air || - dynamic_cast(state.dataMaterial->Material(MatGapFlow2))->gases[0].type != + dynamic_cast(s_mat->materials(MatGapFlow2))->gases[0].type != Material::GasType::Air) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", gas type must be air on either side of the shade/blind", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); } break; // only need the first window shading control since they should be the same } @@ -11018,82 +10929,86 @@ namespace SurfaceGeometry { int NumAlphas; int NumProps; int IOStat; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + + static constexpr std::string_view routineName = "GetFoundationData"; + + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; // Read Kiva Settings - cCurrentModuleObject = "Foundation:Kiva:Settings"; - int TotKivaStgs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "Foundation:Kiva:Settings"; + int TotKivaStgs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (TotKivaStgs > 1) { ErrorsFound = true; - ShowSevereError(state, format("Multiple {} objects found. Only one is allowed.", cCurrentModuleObject)); + ShowSevereError(state, format("Multiple {} objects found. Only one is allowed.", s_ipsc->cCurrentModuleObject)); } if (TotKivaStgs == 1) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, 1, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumProps, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); int numF = 1; int alpF = 1; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - state.dataSurfaceGeometry->kivaManager.settings.soilK = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + state.dataSurfaceGeometry->kivaManager.settings.soilK = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - state.dataSurfaceGeometry->kivaManager.settings.soilRho = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + state.dataSurfaceGeometry->kivaManager.settings.soilRho = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - state.dataSurfaceGeometry->kivaManager.settings.soilCp = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + state.dataSurfaceGeometry->kivaManager.settings.soilCp = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - state.dataSurfaceGeometry->kivaManager.settings.groundSolarAbs = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + state.dataSurfaceGeometry->kivaManager.settings.groundSolarAbs = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - state.dataSurfaceGeometry->kivaManager.settings.groundThermalAbs = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + state.dataSurfaceGeometry->kivaManager.settings.groundThermalAbs = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - state.dataSurfaceGeometry->kivaManager.settings.groundRoughness = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + state.dataSurfaceGeometry->kivaManager.settings.groundRoughness = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - state.dataSurfaceGeometry->kivaManager.settings.farFieldWidth = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + state.dataSurfaceGeometry->kivaManager.settings.farFieldWidth = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(alpF), "ZeroFlux")) { + if (!s_ipsc->lAlphaFieldBlanks(alpF)) { + if (Util::SameString(s_ipsc->cAlphaArgs(alpF), "ZeroFlux")) { state.dataSurfaceGeometry->kivaManager.settings.deepGroundBoundary = HeatBalanceKivaManager::KivaManager::Settings::ZERO_FLUX; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(alpF), "GroundWater")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(alpF), "GroundWater")) { state.dataSurfaceGeometry->kivaManager.settings.deepGroundBoundary = HeatBalanceKivaManager::KivaManager::Settings::GROUNDWATER; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(alpF), "Autoselect")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(alpF), "Autoselect")) { state.dataSurfaceGeometry->kivaManager.settings.deepGroundBoundary = HeatBalanceKivaManager::KivaManager::Settings::AUTO; } else { ErrorsFound = true; ShowSevereError(state, format("{}, {} is not a valid choice for {}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(alpF), - state.dataIPShortCut->cAlphaFieldNames(alpF))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(alpF), + s_ipsc->cAlphaFieldNames(alpF))); } } alpF++; - if (state.dataIPShortCut->lNumericFieldBlanks(numF) || state.dataIPShortCut->rNumericArgs(numF) == Constant::AutoCalculate) { + if (s_ipsc->lNumericFieldBlanks(numF) || s_ipsc->rNumericArgs(numF) == Constant::AutoCalculate) { // Autocalculate deep-ground depth (see KivaManager::defineDefaultFoundation() for actual calculation) state.dataSurfaceGeometry->kivaManager.settings.deepGroundDepth = 40.0; state.dataSurfaceGeometry->kivaManager.settings.autocalculateDeepGroundDepth = true; @@ -11101,29 +11016,29 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}, {} should not be set to Autocalculate unless {} is set to Autoselect", - cCurrentModuleObject, - state.dataIPShortCut->cNumericFieldNames(numF), - state.dataIPShortCut->cAlphaFieldNames(alpF - 1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cNumericFieldNames(numF), + s_ipsc->cAlphaFieldNames(alpF - 1))); } } else { - state.dataSurfaceGeometry->kivaManager.settings.deepGroundDepth = state.dataIPShortCut->rNumericArgs(numF); + state.dataSurfaceGeometry->kivaManager.settings.deepGroundDepth = s_ipsc->rNumericArgs(numF); state.dataSurfaceGeometry->kivaManager.settings.autocalculateDeepGroundDepth = false; } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - state.dataSurfaceGeometry->kivaManager.settings.minCellDim = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + state.dataSurfaceGeometry->kivaManager.settings.minCellDim = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - state.dataSurfaceGeometry->kivaManager.settings.maxGrowthCoeff = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + state.dataSurfaceGeometry->kivaManager.settings.maxGrowthCoeff = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(alpF), "Hourly")) { + if (!s_ipsc->lAlphaFieldBlanks(alpF)) { + if (Util::SameString(s_ipsc->cAlphaArgs(alpF), "Hourly")) { state.dataSurfaceGeometry->kivaManager.settings.timestepType = HeatBalanceKivaManager::KivaManager::Settings::HOURLY; state.dataSurfaceGeometry->kivaManager.timestep = 3600.; // seconds - } else { // if (Util::SameString(state.dataIPShortCut->cAlphaArgs( alpF ), "Timestep")) + } else { // if (Util::SameString(s_ipsc->cAlphaArgs( alpF ), "Timestep")) state.dataSurfaceGeometry->kivaManager.settings.timestepType = HeatBalanceKivaManager::KivaManager::Settings::TIMESTEP; state.dataSurfaceGeometry->kivaManager.timestep = state.dataGlobal->MinutesPerTimeStep * 60.; } @@ -11139,23 +11054,25 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->kivaManager.defineDefaultFoundation(state); // Read Foundation objects - cCurrentModuleObject = "Foundation:Kiva"; - int TotKivaFnds = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "Foundation:Kiva"; + int TotKivaFnds = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (TotKivaFnds > 0) { for (int Loop = 1; Loop <= TotKivaFnds; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumProps, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; int numF = 1; int alpF = 1; @@ -11164,9 +11081,9 @@ namespace SurfaceGeometry { HeatBalanceKivaManager::FoundationKiva fndInput; - fndInput.name = state.dataIPShortCut->cAlphaArgs(alpF); + fndInput.name = s_ipsc->cAlphaArgs(alpF); alpF++; - Util::IsNameEmpty(state, fndInput.name, cCurrentModuleObject, ErrorInName); + Util::IsNameEmpty(state, fndInput.name, s_ipsc->cCurrentModuleObject, ErrorInName); if (ErrorInName) { ErrorsFound = true; continue; @@ -11177,35 +11094,30 @@ namespace SurfaceGeometry { fnd = state.dataSurfaceGeometry->kivaManager.defaultFoundation.foundation; // Indoor temperature - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - fndInput.assumedIndoorTemperature = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + fndInput.assumedIndoorTemperature = s_ipsc->rNumericArgs(numF); } else { fndInput.assumedIndoorTemperature = -9999; } numF++; // Interior horizontal insulation - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { - int index = Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(alpF), state.dataMaterial->Material); + if (!s_ipsc->lAlphaFieldBlanks(alpF)) { + int index = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(alpF)); if (index == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(alpF), s_ipsc->cAlphaArgs(alpF)); ErrorsFound = true; - ShowSevereError(state, - format("Did not find matching material for {}=\"{}\", {}, missing material = {}", - cCurrentModuleObject, - fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); continue; } - auto *m = state.dataMaterial->Material(index); + auto *m = s_mat->materials(index); if (m->group != Material::Group::Regular || m->ROnly) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); ShowContinueError(state, "Must be of type \"Material\""); continue; } @@ -11215,67 +11127,65 @@ namespace SurfaceGeometry { } alpF++; - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF - 1)) { - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lAlphaFieldBlanks(alpF - 1)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { fndInput.intHIns.z = 0.0; } else { - fndInput.intHIns.z = state.dataIPShortCut->rNumericArgs(numF); + fndInput.intHIns.z = s_ipsc->rNumericArgs(numF); } numF++; - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", {} defined, but no {}provided", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF - 1), - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cAlphaFieldNames(alpF - 1), + s_ipsc->cNumericFieldNames(numF))); continue; } else { - fndInput.intHIns.width = -state.dataIPShortCut->rNumericArgs(numF); + fndInput.intHIns.width = -s_ipsc->rNumericArgs(numF); } numF++; } else { - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lNumericFieldBlanks(numF)) { ShowWarningError( state, - format( - "{}=\"{}\", no {} defined", cCurrentModuleObject, fndInput.name, state.dataIPShortCut->cAlphaFieldNames(alpF - 1))); - ShowContinueError(state, format("{} will not be used.", state.dataIPShortCut->cNumericFieldNames(numF))); + format("{}=\"{}\", no {} defined", s_ipsc->cCurrentModuleObject, fndInput.name, s_ipsc->cAlphaFieldNames(alpF - 1))); + ShowContinueError(state, format("{} will not be used.", s_ipsc->cNumericFieldNames(numF))); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lNumericFieldBlanks(numF)) { ShowWarningError( state, - format( - "{}=\"{}\", no {} defined", cCurrentModuleObject, fndInput.name, state.dataIPShortCut->cAlphaFieldNames(alpF - 1))); - ShowContinueError(state, format("{} will not be used.", state.dataIPShortCut->cNumericFieldNames(numF))); + format("{}=\"{}\", no {} defined", s_ipsc->cCurrentModuleObject, fndInput.name, s_ipsc->cAlphaFieldNames(alpF - 1))); + ShowContinueError(state, format("{} will not be used.", s_ipsc->cNumericFieldNames(numF))); } numF++; } // Interior vertical insulation - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { - int index = Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(alpF), state.dataMaterial->Material); + if (!s_ipsc->lAlphaFieldBlanks(alpF)) { + int index = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(alpF)); if (index == 0) { ErrorsFound = true; ShowSevereError(state, format("Did not find matching material for {}=\"{}\", {}, missing material = {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); continue; } - auto *m = state.dataMaterial->Material(index); + auto *m = s_mat->materials(index); if (m->group != Material::Group::Regular || m->ROnly) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); ShowContinueError(state, "Must be of type \"Material\""); continue; } @@ -11286,53 +11196,52 @@ namespace SurfaceGeometry { } alpF++; - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF - 1)) { - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lAlphaFieldBlanks(alpF - 1)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", {} defined, but no {}provided", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF - 1), - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cAlphaFieldNames(alpF - 1), + s_ipsc->cNumericFieldNames(numF))); continue; } else { - fndInput.intVIns.depth = state.dataIPShortCut->rNumericArgs(numF); + fndInput.intVIns.depth = s_ipsc->rNumericArgs(numF); } numF++; } else { - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lNumericFieldBlanks(numF)) { ShowWarningError( state, - format( - "{}=\"{}\", no {} defined", cCurrentModuleObject, fndInput.name, state.dataIPShortCut->cAlphaFieldNames(alpF - 1))); - ShowContinueError(state, format("{} will not be used.", state.dataIPShortCut->cNumericFieldNames(numF))); + format("{}=\"{}\", no {} defined", s_ipsc->cCurrentModuleObject, fndInput.name, s_ipsc->cAlphaFieldNames(alpF - 1))); + ShowContinueError(state, format("{} will not be used.", s_ipsc->cNumericFieldNames(numF))); } numF++; } // Exterior horizontal insulation - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { - int index = Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(alpF), state.dataMaterial->Material); + if (!s_ipsc->lAlphaFieldBlanks(alpF)) { + int index = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(alpF)); if (index == 0) { ErrorsFound = true; ShowSevereError(state, format("Did not find matching material for {}=\"{}\", {}, missing material = {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); continue; } - auto *m = state.dataMaterial->Material(index); + auto *m = s_mat->materials(index); if (m->group != Material::Group::Regular || m->ROnly) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); ShowContinueError(state, "Must be of type \"Material\""); continue; } @@ -11342,67 +11251,65 @@ namespace SurfaceGeometry { } alpF++; - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF - 1)) { - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lAlphaFieldBlanks(alpF - 1)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { fndInput.extHIns.z = 0.0; } else { - fndInput.extHIns.z = state.dataIPShortCut->rNumericArgs(numF); + fndInput.extHIns.z = s_ipsc->rNumericArgs(numF); } numF++; - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", {} defined, but no {}provided", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF - 1), - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cAlphaFieldNames(alpF - 1), + s_ipsc->cNumericFieldNames(numF))); continue; } else { - fndInput.extHIns.width = state.dataIPShortCut->rNumericArgs(numF); + fndInput.extHIns.width = s_ipsc->rNumericArgs(numF); } numF++; } else { - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lNumericFieldBlanks(numF)) { ShowWarningError( state, - format( - "{}=\"{}\", no {} defined", cCurrentModuleObject, fndInput.name, state.dataIPShortCut->cAlphaFieldNames(alpF - 1))); - ShowContinueError(state, format("{} will not be used.", state.dataIPShortCut->cNumericFieldNames(numF))); + format("{}=\"{}\", no {} defined", s_ipsc->cCurrentModuleObject, fndInput.name, s_ipsc->cAlphaFieldNames(alpF - 1))); + ShowContinueError(state, format("{} will not be used.", s_ipsc->cNumericFieldNames(numF))); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lNumericFieldBlanks(numF)) { ShowWarningError( state, - format( - "{}=\"{}\", no {} defined", cCurrentModuleObject, fndInput.name, state.dataIPShortCut->cAlphaFieldNames(alpF - 1))); - ShowContinueError(state, format("{} will not be used.", state.dataIPShortCut->cNumericFieldNames(numF))); + format("{}=\"{}\", no {} defined", s_ipsc->cCurrentModuleObject, fndInput.name, s_ipsc->cAlphaFieldNames(alpF - 1))); + ShowContinueError(state, format("{} will not be used.", s_ipsc->cNumericFieldNames(numF))); } numF++; } // Exterior vertical insulation - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { - int index = Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(alpF), state.dataMaterial->Material); + if (!s_ipsc->lAlphaFieldBlanks(alpF)) { + int index = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(alpF)); if (index == 0) { ErrorsFound = true; ShowSevereError(state, format("Did not find matching material for {}=\"{}\", {}, missing material = {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); continue; } - auto *m = state.dataMaterial->Material(index); + auto *m = s_mat->materials(index); if (m->group != Material::Group::Regular || m->ROnly) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); ShowContinueError(state, "Must be of type \"Material\""); continue; } @@ -11413,52 +11320,51 @@ namespace SurfaceGeometry { } alpF++; - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF - 1)) { - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lAlphaFieldBlanks(alpF - 1)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", {} defined, but no {}provided", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF - 1), - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cAlphaFieldNames(alpF - 1), + s_ipsc->cNumericFieldNames(numF))); continue; } else { - fndInput.extVIns.depth = state.dataIPShortCut->rNumericArgs(numF); + fndInput.extVIns.depth = s_ipsc->rNumericArgs(numF); } numF++; } else { - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lNumericFieldBlanks(numF)) { ShowWarningError( state, - format( - "{}=\"{}\", no {} defined", cCurrentModuleObject, fndInput.name, state.dataIPShortCut->cAlphaFieldNames(alpF - 1))); - ShowContinueError(state, format("{} will not be used.", state.dataIPShortCut->cNumericFieldNames(numF))); + format("{}=\"{}\", no {} defined", s_ipsc->cCurrentModuleObject, fndInput.name, s_ipsc->cAlphaFieldNames(alpF - 1))); + ShowContinueError(state, format("{} will not be used.", s_ipsc->cNumericFieldNames(numF))); } numF++; } // Foundation wall - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - fnd.wall.heightAboveGrade = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + fnd.wall.heightAboveGrade = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { - fnd.wall.depthBelowSlab = state.dataIPShortCut->rNumericArgs(numF); + if (!s_ipsc->lNumericFieldBlanks(numF)) { + fnd.wall.depthBelowSlab = s_ipsc->rNumericArgs(numF); } numF++; - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { - fndInput.wallConstructionIndex = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(alpF), state.dataConstruction->Construct); + if (!s_ipsc->lAlphaFieldBlanks(alpF)) { + fndInput.wallConstructionIndex = Util::FindItemInList(s_ipsc->cAlphaArgs(alpF), state.dataConstruction->Construct); if (fndInput.wallConstructionIndex == 0) { ErrorsFound = true; ShowSevereError(state, format("Did not find matching construction for {}=\"{}\", {}, missing construction = {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); continue; } auto &c = state.dataConstruction->Construct(fndInput.wallConstructionIndex); @@ -11467,10 +11373,10 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); ShowContinueError(state, "Cannot be a window construction"); continue; } @@ -11480,27 +11386,27 @@ namespace SurfaceGeometry { alpF++; // Footing - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { - int index = Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(alpF), state.dataMaterial->Material); + if (!s_ipsc->lAlphaFieldBlanks(alpF)) { + int index = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(alpF)); if (index == 0) { ErrorsFound = true; ShowSevereError(state, format("Did not find matching material for {}=\"{}\", {}, missing material = {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); continue; } - auto *m = state.dataMaterial->Material(index); + auto *m = s_mat->materials(index); if (m->group != Material::Group::Regular || m->ROnly) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); ShowContinueError(state, "Must be of type \"Material\""); continue; } @@ -11511,27 +11417,26 @@ namespace SurfaceGeometry { } alpF++; - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF - 1)) { - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lAlphaFieldBlanks(alpF - 1)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", {} defined, but no {}provided", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF - 1), - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cAlphaFieldNames(alpF - 1), + s_ipsc->cNumericFieldNames(numF))); continue; } else { - fndInput.footing.depth = state.dataIPShortCut->rNumericArgs(numF); + fndInput.footing.depth = s_ipsc->rNumericArgs(numF); } numF++; } else { - if (!state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (!s_ipsc->lNumericFieldBlanks(numF)) { ShowWarningError( state, - format( - "{}=\"{}\", no {} defined", cCurrentModuleObject, fndInput.name, state.dataIPShortCut->cAlphaFieldNames(alpF - 1))); - ShowContinueError(state, format("{} will not be used.", state.dataIPShortCut->cNumericFieldNames(numF))); + format("{}=\"{}\", no {} defined", s_ipsc->cCurrentModuleObject, fndInput.name, s_ipsc->cAlphaFieldNames(alpF - 1))); + ShowContinueError(state, format("{} will not be used.", s_ipsc->cNumericFieldNames(numF))); } numF++; } @@ -11543,33 +11448,33 @@ namespace SurfaceGeometry { if (mod(numRemainingFields, 4) != 0) { ShowWarningError(state, format("{}=\"{}\", number of Block fields not even multiple of 4. Will read in {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, numBlocks)); } for (int blockNum = 0; blockNum < numBlocks; blockNum++) { Kiva::InputBlock block; - if (!state.dataIPShortCut->lAlphaFieldBlanks(alpF)) { - int index = Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(alpF), state.dataMaterial->Material); + if (!s_ipsc->lAlphaFieldBlanks(alpF)) { + int index = Util::FindItemInPtrList(s_ipsc->cAlphaArgs(alpF), s_mat->materials); if (index == 0) { ErrorsFound = true; ShowSevereError(state, format("Did not find matching material for {}=\"{}\", {}, missing material = {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); continue; } - auto *m = state.dataMaterial->Material(index); + auto *m = s_mat->materials(index); if (m->group != Material::Group::Regular || m->ROnly) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF), - state.dataIPShortCut->cAlphaArgs(alpF))); + s_ipsc->cAlphaFieldNames(alpF), + s_ipsc->cAlphaArgs(alpF))); ShowContinueError(state, "Must be of type \"Material\""); continue; } @@ -11579,38 +11484,38 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", {} is required and not given.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF))); + s_ipsc->cAlphaFieldNames(alpF))); continue; } alpF++; - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { block.depth = 0.0; // Temporary indicator to default to foundation depth } else { - block.depth = state.dataIPShortCut->rNumericArgs(numF); + block.depth = s_ipsc->rNumericArgs(numF); } numF++; - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", {} defined, but no {}provided", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, fndInput.name, - state.dataIPShortCut->cAlphaFieldNames(alpF - 1), - state.dataIPShortCut->cNumericFieldNames(numF))); + s_ipsc->cAlphaFieldNames(alpF - 1), + s_ipsc->cNumericFieldNames(numF))); continue; } else { - block.x = state.dataIPShortCut->rNumericArgs(numF); + block.x = s_ipsc->rNumericArgs(numF); } numF++; - if (state.dataIPShortCut->lNumericFieldBlanks(numF)) { + if (s_ipsc->lNumericFieldBlanks(numF)) { block.z = 0.0; } else { - block.z = state.dataIPShortCut->rNumericArgs(numF); + block.z = s_ipsc->rNumericArgs(numF); } numF++; @@ -11715,109 +11620,108 @@ namespace SurfaceGeometry { bool ErrorInName; bool IsBlank; std::string cOSCLimitsString; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "SurfaceProperty:OtherSideCoefficients"; - state.dataSurface->TotOSC = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "SurfaceProperty:OtherSideCoefficients"; + state.dataSurface->TotOSC = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataSurface->OSC.allocate(state.dataSurface->TotOSC); OSCNum = 0; for (Loop = 1; Loop <= state.dataSurface->TotOSC; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumProps, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); ErrorInName = false; IsBlank = false; Util::VerifyName( - state, state.dataIPShortCut->cAlphaArgs(1), state.dataSurface->OSC, OSCNum, ErrorInName, IsBlank, cCurrentModuleObject + " Name"); + state, s_ipsc->cAlphaArgs(1), state.dataSurface->OSC, OSCNum, ErrorInName, IsBlank, s_ipsc->cCurrentModuleObject + " Name"); if (ErrorInName) { ErrorsFound = true; continue; } ++OSCNum; - state.dataSurface->OSC(OSCNum).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataSurface->OSC(OSCNum).SurfFilmCoef = state.dataIPShortCut->rNumericArgs(1); - state.dataSurface->OSC(OSCNum).ConstTemp = state.dataIPShortCut->rNumericArgs(2); // This will be replaced if schedule is used + state.dataSurface->OSC(OSCNum).Name = s_ipsc->cAlphaArgs(1); + state.dataSurface->OSC(OSCNum).SurfFilmCoef = s_ipsc->rNumericArgs(1); + state.dataSurface->OSC(OSCNum).ConstTemp = s_ipsc->rNumericArgs(2); // This will be replaced if schedule is used state.dataSurface->OSC(OSCNum).ConstTempCoef = - state.dataIPShortCut->rNumericArgs(3); // This multiplier is used (even with schedule). It should normally be 1.0 - state.dataSurface->OSC(OSCNum).ExtDryBulbCoef = state.dataIPShortCut->rNumericArgs(4); - state.dataSurface->OSC(OSCNum).GroundTempCoef = state.dataIPShortCut->rNumericArgs(5); - state.dataSurface->OSC(OSCNum).WindSpeedCoef = state.dataIPShortCut->rNumericArgs(6); - state.dataSurface->OSC(OSCNum).ZoneAirTempCoef = state.dataIPShortCut->rNumericArgs(7); - state.dataSurface->OSC(OSCNum).SinusoidPeriod = state.dataIPShortCut->rNumericArgs(8); - - if ((!state.dataIPShortCut->lAlphaFieldBlanks(2)) && (NumAlphas != 1)) { // Const temp will come from schedule specified below. - state.dataSurface->OSC(OSCNum).ConstTempScheduleName = state.dataIPShortCut->cAlphaArgs(2); + s_ipsc->rNumericArgs(3); // This multiplier is used (even with schedule). It should normally be 1.0 + state.dataSurface->OSC(OSCNum).ExtDryBulbCoef = s_ipsc->rNumericArgs(4); + state.dataSurface->OSC(OSCNum).GroundTempCoef = s_ipsc->rNumericArgs(5); + state.dataSurface->OSC(OSCNum).WindSpeedCoef = s_ipsc->rNumericArgs(6); + state.dataSurface->OSC(OSCNum).ZoneAirTempCoef = s_ipsc->rNumericArgs(7); + state.dataSurface->OSC(OSCNum).SinusoidPeriod = s_ipsc->rNumericArgs(8); + + if ((!s_ipsc->lAlphaFieldBlanks(2)) && (NumAlphas != 1)) { // Const temp will come from schedule specified below. + state.dataSurface->OSC(OSCNum).ConstTempScheduleName = s_ipsc->cAlphaArgs(2); if (!state.dataSurface->OSC(OSCNum).ConstTempScheduleName.empty()) { state.dataSurface->OSC(OSCNum).ConstTempScheduleIndex = GetScheduleIndex(state, state.dataSurface->OSC(OSCNum).ConstTempScheduleName); if (state.dataSurface->OSC(OSCNum).ConstTempScheduleIndex == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } } } - if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { + if (!s_ipsc->lAlphaFieldBlanks(3)) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "No")) { + if (Util::SameString(s_ipsc->cAlphaArgs(3), "No")) { state.dataSurface->OSC(OSCNum).SinusoidalConstTempCoef = false; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "Yes")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "Yes")) { state.dataSurface->OSC(OSCNum).SinusoidalConstTempCoef = true; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } } - if (state.dataIPShortCut->rNumericArgs(1) > 0.0 && !any_ne(state.dataIPShortCut->rNumericArgs({3, 7}), 0.0) && + if (s_ipsc->rNumericArgs(1) > 0.0 && !any_ne(s_ipsc->rNumericArgs({3, 7}), 0.0) && (!state.dataSurface->OSC(OSCNum).SinusoidalConstTempCoef)) { - ShowSevereError(state, - format("{}=\"{}\" has zeros for all coefficients.", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\" has zeros for all coefficients.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "...The outdoor air temperature for surfaces using this OtherSideCoefficients object will always be 0C."); } - if (state.dataIPShortCut->rNumericArgs(1) <= 0.0 && !any_ne(state.dataIPShortCut->rNumericArgs({3, 7}), 0.0) && + if (s_ipsc->rNumericArgs(1) <= 0.0 && !any_ne(s_ipsc->rNumericArgs({3, 7}), 0.0) && (!state.dataSurface->OSC(OSCNum).SinusoidalConstTempCoef)) { - ShowSevereError(state, - format("{}=\"{}\" has zeros for all coefficients.", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\" has zeros for all coefficients.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "...The outside surface temperature for surfaces using this OtherSideCoefficients object will always be 0C."); } - state.dataSurface->OSC(OSCNum).TPreviousCoef = state.dataIPShortCut->rNumericArgs(9); + state.dataSurface->OSC(OSCNum).TPreviousCoef = s_ipsc->rNumericArgs(9); - if (!state.dataIPShortCut->lNumericFieldBlanks(10)) { + if (!s_ipsc->lNumericFieldBlanks(10)) { state.dataSurface->OSC(OSCNum).MinLimitPresent = true; - state.dataSurface->OSC(OSCNum).MinTempLimit = state.dataIPShortCut->rNumericArgs(10); - cOSCLimitsString = format("{:.3R}", state.dataIPShortCut->rNumericArgs(10)); + state.dataSurface->OSC(OSCNum).MinTempLimit = s_ipsc->rNumericArgs(10); + cOSCLimitsString = format("{:.3R}", s_ipsc->rNumericArgs(10)); } else { cOSCLimitsString = "N/A"; } - if (!state.dataIPShortCut->lNumericFieldBlanks(11)) { + if (!s_ipsc->lNumericFieldBlanks(11)) { state.dataSurface->OSC(OSCNum).MaxLimitPresent = true; - state.dataSurface->OSC(OSCNum).MaxTempLimit = state.dataIPShortCut->rNumericArgs(11); - cOSCLimitsString += format(",{:.3R}", state.dataIPShortCut->rNumericArgs(10)); + state.dataSurface->OSC(OSCNum).MaxTempLimit = s_ipsc->rNumericArgs(11); + cOSCLimitsString += format(",{:.3R}", s_ipsc->rNumericArgs(10)); } else { cOSCLimitsString += ",N/A"; } @@ -11835,7 +11739,7 @@ namespace SurfaceGeometry { print(state.files.eio, "{}\n", OSCFormat1); } if (state.dataSurface->OSC(Loop).SurfFilmCoef > 0.0) { - state.dataIPShortCut->cAlphaArgs(1) = format("{:.3R}", state.dataSurface->OSC(Loop).SurfFilmCoef); + s_ipsc->cAlphaArgs(1) = format("{:.3R}", state.dataSurface->OSC(Loop).SurfFilmCoef); SetupOutputVariable(state, "Surface Other Side Coefficients Exterior Air Drybulb Temperature", Constant::Units::C, @@ -11844,42 +11748,42 @@ namespace SurfaceGeometry { OutputProcessor::StoreType::Average, state.dataSurface->OSC(Loop).Name); } else { - state.dataIPShortCut->cAlphaArgs(1) = "N/A"; + s_ipsc->cAlphaArgs(1) = "N/A"; } if (state.dataSurface->OSC(Loop).ConstTempScheduleIndex != 0) { - state.dataIPShortCut->cAlphaArgs(2) = state.dataSurface->OSC(Loop).ConstTempScheduleName; + s_ipsc->cAlphaArgs(2) = state.dataSurface->OSC(Loop).ConstTempScheduleName; constexpr std::string_view format = "Other Side Coefficients,{},{},{},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R},{},{},{:.3R},{:.3R},{}\n"; print(state.files.eio, format, state.dataSurface->OSC(Loop).Name, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), "N/A", state.dataSurface->OSC(Loop).ConstTempCoef, state.dataSurface->OSC(Loop).ExtDryBulbCoef, state.dataSurface->OSC(Loop).GroundTempCoef, state.dataSurface->OSC(Loop).WindSpeedCoef, state.dataSurface->OSC(Loop).ZoneAirTempCoef, - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaArgs(3), + s_ipsc->cAlphaArgs(2), + s_ipsc->cAlphaArgs(3), state.dataSurface->OSC(Loop).SinusoidPeriod, state.dataSurface->OSC(Loop).TPreviousCoef, cOSCLimitsString); } else { - state.dataIPShortCut->cAlphaArgs(2) = "N/A"; + s_ipsc->cAlphaArgs(2) = "N/A"; constexpr std::string_view format = "Other Side Coefficients,{},{},{:.2R},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R},{},{},{:.3R},{:.3R},{}\n"; print(state.files.eio, format, state.dataSurface->OSC(Loop).Name, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), state.dataSurface->OSC(Loop).ConstTemp, state.dataSurface->OSC(Loop).ConstTempCoef, state.dataSurface->OSC(Loop).ExtDryBulbCoef, state.dataSurface->OSC(Loop).GroundTempCoef, state.dataSurface->OSC(Loop).WindSpeedCoef, state.dataSurface->OSC(Loop).ZoneAirTempCoef, - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaArgs(3), + s_ipsc->cAlphaArgs(2), + s_ipsc->cAlphaArgs(3), state.dataSurface->OSC(Loop).SinusoidPeriod, state.dataSurface->OSC(Loop).TPreviousCoef, cOSCLimitsString); @@ -11927,29 +11831,30 @@ namespace SurfaceGeometry { int OSCMNum; bool ErrorInName; bool IsBlank; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "SurfaceProperty:OtherSideConditionsModel"; - state.dataSurface->TotOSCM = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "SurfaceProperty:OtherSideConditionsModel"; + state.dataSurface->TotOSCM = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataSurface->OSCM.allocate(state.dataSurface->TotOSCM); // OSCM is already initialized in derived type defn. OSCMNum = 0; for (Loop = 1; Loop <= state.dataSurface->TotOSCM; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem( - state, cCurrentModuleObject, Loop, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumProps, IOStat); + state, s_ipsc->cCurrentModuleObject, Loop, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumProps, IOStat); ErrorInName = false; IsBlank = false; Util::VerifyName( - state, state.dataIPShortCut->cAlphaArgs(1), state.dataSurface->OSCM, OSCMNum, ErrorInName, IsBlank, cCurrentModuleObject + " Name"); + state, s_ipsc->cAlphaArgs(1), state.dataSurface->OSCM, OSCMNum, ErrorInName, IsBlank, s_ipsc->cCurrentModuleObject + " Name"); if (ErrorInName) { ErrorsFound = true; continue; } ++OSCMNum; - state.dataSurface->OSCM(OSCMNum).Name = state.dataIPShortCut->cAlphaArgs(1); + state.dataSurface->OSCM(OSCMNum).Name = s_ipsc->cAlphaArgs(1); // Note no validation of the below at this time: - state.dataSurface->OSCM(OSCMNum).Class = state.dataIPShortCut->cAlphaArgs(2); + state.dataSurface->OSCM(OSCMNum).Class = s_ipsc->cAlphaArgs(2); // setup output vars for modeled coefficients SetupOutputVariable(state, "Surface Other Side Conditions Modeled Convection Air Temperature", @@ -12081,57 +11986,47 @@ namespace SurfaceGeometry { }; constexpr std::array(InsulationType::Num)> insulationTypeNamesUC = {"OUTSIDE", "INSIDE"}; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "SurfaceControl:MovableInsulation"; - NMatInsul = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + auto &s_mat = state.dataMaterial; + + s_ipsc->cCurrentModuleObject = "SurfaceControl:MovableInsulation"; + NMatInsul = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); for (Loop = 1; Loop <= NMatInsul; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - SurfNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataSurface->Surface, state.dataSurface->TotSurfaces); - MaterNum = Util::FindItemInPtrList(state.dataIPShortCut->cAlphaArgs(3), state.dataMaterial->Material, state.dataMaterial->TotMaterials); - auto *thisMaterial = state.dataMaterial->Material(MaterNum); - SchNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - InsulationType insulationType = static_cast(getEnumValue(insulationTypeNamesUC, state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + SurfNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + MaterNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(3)); + auto *thisMaterial = s_mat->materials(MaterNum); + SchNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(4)); + InsulationType insulationType = static_cast(getEnumValue(insulationTypeNamesUC, s_ipsc->cAlphaArgs(1))); if (insulationType == InsulationType::Invalid) { - ShowSevereError(state, - format("{}, {}=\"{}\", invalid data.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereError( + state, format("{}, {}=\"{}\", invalid data.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, - format(" invalid {}=\"{}\", [should be Inside or Outside]", - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); + format(" invalid {}=\"{}\", [should be Inside or Outside]", s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } if (SurfNum == 0) { - ShowSevereError(state, - format("{}, {}=\"{}\", invalid data.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format(" invalid (not found) {}", state.dataIPShortCut->cAlphaFieldNames(2))); + ShowSevereError( + state, format("{}, {}=\"{}\", invalid data.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, format(" invalid (not found) {}", s_ipsc->cAlphaFieldNames(2))); ErrorsFound = true; } else { if (MaterNum == 0) { - ShowSevereError(state, - format("{}, {}=\"{}\", invalid data.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError( + ShowSevereError( state, - format(" invalid (not found) {}=\"{}\"", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + format("{}, {}=\"{}\", invalid data.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, format(" invalid (not found) {}=\"{}\"", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } else { @@ -12158,28 +12053,21 @@ namespace SurfaceGeometry { "WindowMaterial:Gap:EquivalentLayer"}); Material::Group const MaterialLayerGroup = thisMaterial->group; - if ((MaterialLayerGroup == Material::Group::WindowSimpleGlazing) || - (MaterialLayerGroup == Material::Group::ShadeEquivalentLayer) || - (MaterialLayerGroup == Material::Group::DrapeEquivalentLayer) || - (MaterialLayerGroup == Material::Group::BlindEquivalentLayer) || - (MaterialLayerGroup == Material::Group::ScreenEquivalentLayer) || - (MaterialLayerGroup == Material::Group::GapEquivalentLayer)) { - ShowSevereError(state, format("Invalid movable insulation material for {}:", cCurrentModuleObject)); - ShowContinueError( + if ((MaterialLayerGroup == Material::Group::GlassSimple) || (MaterialLayerGroup == Material::Group::ShadeEQL) || + (MaterialLayerGroup == Material::Group::DrapeEQL) || (MaterialLayerGroup == Material::Group::BlindEQL) || + (MaterialLayerGroup == Material::Group::ScreenEQL) || (MaterialLayerGroup == Material::Group::WindowGapEQL)) { + ShowSevereError(state, format("Invalid movable insulation material for {}:", s_ipsc->cCurrentModuleObject)); + ShowSevereError( state, format("...Movable insulation material type specified = {}", cMaterialGroupType(static_cast(MaterialLayerGroup)))); - ShowContinueError(state, format("...Movable insulation material name specified = {}", state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereError(state, format("...Movable insulation material name specified = {}", s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } if (SchNum == 0) { - ShowSevereError(state, - format("{}, {}=\"{}\", invalid data.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError( + ShowSevereError( state, - format(" invalid (not found) {}=\"{}\"", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); + format("{}, {}=\"{}\", invalid data.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, format(" invalid (not found) {}=\"{}\"", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); ErrorsFound = true; } else { { @@ -12188,13 +12076,12 @@ namespace SurfaceGeometry { if (state.dataSurface->SurfMaterialMovInsulExt(SurfNum) > 0) { ShowSevereError(state, format("{}, {}=\"{}\", already assigned.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError( - state, - format("\"Outside\", was already assigned Material=\"{}\".", - state.dataMaterial->Material(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->Name)); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, + format("\"Outside\", was already assigned Material=\"{}\".", + s_mat->materials(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->Name)); ShowContinueError(state, format("attempting to assign Material=\"{}\".", thisMaterial->Name)); ErrorsFound = true; } @@ -12205,9 +12092,9 @@ namespace SurfaceGeometry { if (thisMaterial->Conductivity <= 0.0 || thisMaterial->Thickness <= 0.0) { ShowSevereError(state, format("{}, {}=\"{}\", invalid material.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "\"Outside\", invalid material for movable insulation."); ShowContinueError(state, format("Material=\"{}\",Resistance=[{:.3R}], must be > 0 for use in Movable Insulation.", @@ -12222,9 +12109,9 @@ namespace SurfaceGeometry { if (thisMaterial->Resistance <= 0.0) { ShowSevereError(state, format("{}, {}=\"{}\", invalid material.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "\"Outside\", invalid material for movable insulation."); ShowContinueError(state, format("Material=\"{}\",Conductivity=[{:.3R}], must be > 0 for use in Movable Insulation.", @@ -12237,12 +12124,11 @@ namespace SurfaceGeometry { case InsulationType::Inside: if (state.dataSurface->SurfMaterialMovInsulInt(SurfNum) > 0) { ShowSevereError(state, - cCurrentModuleObject + ", " + state.dataIPShortCut->cAlphaFieldNames(2) + "=\"" + - state.dataIPShortCut->cAlphaArgs(2) + "\", already assigned."); + s_ipsc->cCurrentModuleObject + ", " + s_ipsc->cAlphaFieldNames(2) + "=\"" + + s_ipsc->cAlphaArgs(2) + "\", already assigned."); ShowContinueError(state, "\"Inside\", was already assigned Material=\"" + - state.dataMaterial->Material(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->Name + - "\"."); + s_mat->materials(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->Name + "\"."); ShowContinueError(state, "attempting to assign Material=\"" + thisMaterial->Name + "\"."); ErrorsFound = true; } @@ -12253,9 +12139,9 @@ namespace SurfaceGeometry { if (thisMaterial->Conductivity <= 0.0 || thisMaterial->Thickness <= 0.0) { ShowSevereError(state, format("{}, {}=\"{}\", invalid material.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "\"Inside\", invalid material for movable insulation."); ShowContinueError(state, format("Material=\"{}\",Resistance=[{:.3R}], must be > 0 for use in Movable Insulation.", @@ -12272,11 +12158,8 @@ namespace SurfaceGeometry { } } if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Window) { - ShowSevereError(state, - format("{}, {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereError( + state, format("{}, {}=\"{}\"", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "invalid use on a Window. Use WindowShadingControl instead."); ErrorsFound = true; } @@ -12339,6 +12222,7 @@ namespace SurfaceGeometry { surfacenotused.dimension(NFaces, 0); for (int SurfNum = thisZone.AllSurfaceFirst; SurfNum <= thisZone.AllSurfaceLast; ++SurfNum) { + assert(SurfNum > 0); auto &thisSurface = state.dataSurface->Surface(SurfNum); // Only include Base Surfaces in Calc. @@ -13752,7 +13636,9 @@ namespace SurfaceGeometry { int TotLayersNew; // Total layers in new (shaded) construction // INTEGER :: loop ! DO loop index - ShDevName = state.dataMaterial->Material(ShDevNum)->Name; + auto &s_mat = state.dataMaterial; + + ShDevName = s_mat->materials(ShDevNum)->Name; ConstrNum = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; ConstrName = state.dataConstruction->Construct(ConstrNum).Name; if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->WindowShadingControl(WSCPtr).ShadingType)) { @@ -13791,7 +13677,7 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(ConstrNewSh).LayerPoint = 0; - auto const *thisMaterialSh = dynamic_cast(state.dataMaterial->Material(ShDevNum)); + auto const *thisMaterialSh = s_mat->materials(ShDevNum); auto &thisConstructNewSh = state.dataConstruction->Construct(ConstrNewSh); if (state.dataSurface->WindowShadingControl(WSCPtr).ShadingType == WinShadingType::IntShade || state.dataSurface->WindowShadingControl(WSCPtr).ShadingType == WinShadingType::IntBlind) { @@ -13799,16 +13685,14 @@ namespace SurfaceGeometry { thisConstructNewSh.LayerPoint({1, TotLayersOld}) = state.dataConstruction->Construct(ConstrNum).LayerPoint({1, TotLayersOld}); thisConstructNewSh.LayerPoint(TotLayersNew) = ShDevNum; thisConstructNewSh.InsideAbsorpSolar = thisMaterialSh->AbsorpSolar; - auto const *thisMaterialShLayer1 = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNewSh).LayerPoint(1))); + auto const *thisMaterialShLayer1 = s_mat->materials(state.dataConstruction->Construct(ConstrNewSh).LayerPoint(1)); thisConstructNewSh.OutsideAbsorpSolar = thisMaterialShLayer1->AbsorpSolar; thisConstructNewSh.OutsideAbsorpThermal = thisMaterialShLayer1->AbsorpThermalFront; } else { // Exterior shading device thisConstructNewSh.LayerPoint(1) = ShDevNum; thisConstructNewSh.LayerPoint({2, TotLayersNew}) = state.dataConstruction->Construct(ConstrNum).LayerPoint({1, TotLayersOld}); - auto const *thisMaterialShInside = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNewSh).LayerPoint(TotLayersNew))); + auto const *thisMaterialShInside = s_mat->materials(state.dataConstruction->Construct(ConstrNewSh).LayerPoint(TotLayersNew)); thisConstructNewSh.InsideAbsorpSolar = thisMaterialShInside->AbsorpSolar; thisConstructNewSh.OutsideAbsorpSolar = thisMaterialSh->AbsorpSolar; thisConstructNewSh.OutsideAbsorpThermal = thisMaterialSh->AbsorpThermalFront; @@ -13816,9 +13700,7 @@ namespace SurfaceGeometry { // The following InsideAbsorpThermal applies only to inside glass; it is corrected // later in InitGlassOpticalCalculations if construction has inside shade or blind. thisConstructNewSh.InsideAbsorpThermal = - dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayersOld))) - ->AbsorpThermalBack; + s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLayersOld))->AbsorpThermalBack; thisConstructNewSh.OutsideRoughness = Material::SurfaceRoughness::VerySmooth; thisConstructNewSh.DayltPropPtr = 0; thisConstructNewSh.CTFCross.fill(0.0); @@ -13885,6 +13767,8 @@ namespace SurfaceGeometry { // construction consisting of the storm window added to the shaded construction. DisplayString(state, "Creating Storm Window Constructions"); + auto &s_mat = state.dataMaterial; + for (int StormWinNum = 1; StormWinNum <= state.dataSurface->TotStormWin; ++StormWinNum) { int SurfNum = state.dataSurface->StormWindow(StormWinNum).BaseWindowNum; // Surface number auto &surf = state.dataSurface->Surface(SurfNum); @@ -13924,12 +13808,11 @@ namespace SurfaceGeometry { int MatBetweenGlassSh = 0; // Material number of between-glass shade or blind if (TotLayers == 5) MatBetweenGlassSh = state.dataConstruction->Construct(curConstruction).LayerPoint(3); if (state.dataConstruction->Construct(curConstruction).TotGlassLayers <= 3 && - (state.dataMaterial->Material(MatIntSh)->group == Material::Group::Shade || - state.dataMaterial->Material(MatIntSh)->group == Material::Group::WindowBlind)) + (s_mat->materials(MatIntSh)->group == Material::Group::Shade || s_mat->materials(MatIntSh)->group == Material::Group::Blind)) ShAndSt = true; if (MatBetweenGlassSh > 0) { - if (state.dataMaterial->Material(MatBetweenGlassSh)->group == Material::Group::Shade || - state.dataMaterial->Material(MatBetweenGlassSh)->group == Material::Group::WindowBlind) { + if (s_mat->materials(MatBetweenGlassSh)->group == Material::Group::Shade || + s_mat->materials(MatBetweenGlassSh)->group == Material::Group::Blind) { ShAndSt = true; } else { ShowContinueError(state, format("Window={} has a shaded construction to which a storm window cannot be applied.", surf.Name)); @@ -13953,67 +13836,41 @@ namespace SurfaceGeometry { int createAirMaterialFromDistance(EnergyPlusData &state, Real64 distance, std::string_view namePrefix) { + auto &s_mat = state.dataMaterial; + int mmDistance = int(1000 * distance); // Thickness of air gap in mm (usually between storm window and rest of window) std::string MatNameStAir = format("{}{}MM", namePrefix, mmDistance); // Name of created air layer material - int newAirMaterial = Util::FindItemInPtrList(MatNameStAir, state.dataMaterial->Material, state.dataMaterial->TotMaterials); - if (newAirMaterial == 0) { - // Create new material - state.dataMaterial->TotMaterials = state.dataMaterial->TotMaterials + 1; - newAirMaterial = state.dataMaterial->TotMaterials; - auto *thisMaterial = new Material::MaterialGasMix; - state.dataMaterial->Material.push_back(thisMaterial); - state.dataHeatBal->NominalR.redimension(state.dataMaterial->TotMaterials); - thisMaterial->Name = MatNameStAir; - thisMaterial->group = Material::Group::WindowGas; - thisMaterial->Roughness = Material::SurfaceRoughness::MediumRough; - thisMaterial->Conductivity = 0.0; - thisMaterial->Density = 0.0; - // thisMaterial->IsoMoistCap = 0.0; - // thisMaterial->Porosity = 0.0; - thisMaterial->Resistance = 0.0; - thisMaterial->SpecHeat = 0.0; - // thisMaterial->ThermGradCoef = 0.0; - thisMaterial->Thickness = distance; - // thisMaterial->VaporDiffus = 0.0; - // thisMaterial->GlassSpectralDataPtr = 0; - thisMaterial->numGases = 1; - thisMaterial->gases[0] = Material::gases[(int)Material::GasType::Air]; - thisMaterial->gasFracts[0] = 1.0; - thisMaterial->AbsorpSolar = 0.0; - thisMaterial->AbsorpThermal = 0.0; - thisMaterial->AbsorpVisible = 0.0; - thisMaterial->Trans = 0.0; - thisMaterial->TransVis = 0.0; - // thisMaterial->GlassTransDirtFactor = 0.0; - // thisMaterial->ReflectShade = 0.0; - // thisMaterial->ReflectShadeVis = 0.0; - // thisMaterial->AbsorpThermalBack = 0.0; - // thisMaterial->AbsorpThermalFront = 0.0; - // thisMaterial->ReflectSolBeamBack = 0.0; - // thisMaterial->ReflectSolBeamFront = 0.0; - // thisMaterial->ReflectSolDiffBack = 0.0; - // thisMaterial->ReflectSolDiffFront = 0.0; - // thisMaterial->ReflectVisBeamBack = 0.0; - // thisMaterial->ReflectVisBeamFront = 0.0; - // thisMaterial->ReflectVisDiffBack = 0.0; - // thisMaterial->ReflectVisDiffFront = 0.0; - // thisMaterial->TransSolBeam = 0.0; - // thisMaterial->TransThermal = 0.0; - // thisMaterial->TransVisBeam = 0.0; - // thisMaterial->BlindDataPtr = 0; - // thisMaterial->WinShadeToGlassDist = 0.0; - // thisMaterial->WinShadeTopOpeningMult = 0.0; - // thisMaterial->WinShadeBottomOpeningMult = 0.0; - // thisMaterial->WinShadeLeftOpeningMult = 0.0; - // thisMaterial->WinShadeRightOpeningMult = 0.0; - // thisMaterial->WinShadeAirFlowPermeability = 0.0; - } - return (newAirMaterial); + int matNum = Material::GetMaterialNum(state, MatNameStAir); + if (matNum != 0) return matNum; + + // Create new material + auto *mat = new Material::MaterialGasMix; + mat->Name = MatNameStAir; + mat->group = Material::Group::Gas; + + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(Util::makeUPPER(mat->Name), mat->Num); + + mat->Roughness = Material::SurfaceRoughness::MediumRough; + mat->Conductivity = 0.0; + mat->Density = 0.0; + mat->Resistance = 0.0; + mat->SpecHeat = 0.0; + mat->Thickness = distance; + mat->numGases = 1; + mat->gases[0] = Material::gases[(int)Material::GasType::Air]; + mat->gasFracts[0] = 1.0; + mat->AbsorpSolar = 0.0; + mat->AbsorpThermal = 0.0; + mat->AbsorpVisible = 0.0; + return mat->Num; } // create a new construction with storm based on an old construction and storm and gap materials int createConstructionWithStorm(EnergyPlusData &state, int oldConstruction, std::string name, int stormMaterial, int gapMaterial) { + auto &s_mat = state.dataMaterial; int newConstruct = Util::FindItemInList(name, state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); // Number of shaded storm window construction that is created @@ -14045,8 +13902,7 @@ namespace SurfaceGeometry { thisConstruct.InsideAbsorpSolar = 0.0; thisConstruct.OutsideAbsorpSolar = 0.0; thisConstruct.InsideAbsorpThermal = state.dataConstruction->Construct(oldConstruction).InsideAbsorpThermal; - thisConstruct.OutsideAbsorpThermal = - dynamic_cast(state.dataMaterial->Material(stormMaterial))->AbsorpThermalFront; + thisConstruct.OutsideAbsorpThermal = s_mat->materials(stormMaterial)->AbsorpThermalFront; thisConstruct.OutsideRoughness = Material::SurfaceRoughness::VerySmooth; thisConstruct.DayltPropPtr = 0; thisConstruct.CTFCross.fill(0.0); @@ -14777,6 +14633,8 @@ namespace SurfaceGeometry { // begin execution // get user input... + auto &s_ipsc = state.dataIPShortCut; + if (state.dataSurfaceGeometry->firstTime) { if (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject) == 1) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -14787,16 +14645,15 @@ namespace SurfaceGeometry { rNumerics, NNum, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); OldAspectRatio = rNumerics(1); NewAspectRatio = rNumerics(2); transformPlane = cAlphas(1); if (transformPlane != "XY") { - ShowWarningError( - state, format("{}: invalid {}=\"{}...ignored.", CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), cAlphas(1))); + ShowWarningError(state, format("{}: invalid {}=\"{}...ignored.", CurrentModuleObject, s_ipsc->cAlphaFieldNames(1), cAlphas(1))); } state.dataSurfaceGeometry->firstTime = false; state.dataSurfaceGeometry->noTransform = false; @@ -15030,16 +14887,17 @@ namespace SurfaceGeometry { int NumAlphas; // Number of alpha names being passed int NumNumbers; // Number of numeric parameters being passed int IOStatus; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + + auto &s_ipsc = state.dataIPShortCut; // First collect names of surfaces referenced by active solar components - cCurrentModuleObject = "SolarCollector:FlatPlate:Water"; - NumOfFlatPlateUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - cCurrentModuleObject = "SolarCollector:FlatPlate:PhotovoltaicThermal"; - NumPVTs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - cCurrentModuleObject = "Generator:Photovoltaic"; - NumPVs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - cCurrentModuleObject = "SolarCollector:IntegralCollectorStorage"; - NumOfICSUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "SolarCollector:FlatPlate:Water"; + NumOfFlatPlateUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "SolarCollector:FlatPlate:PhotovoltaicThermal"; + NumPVTs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "Generator:Photovoltaic"; + NumPVs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "SolarCollector:IntegralCollectorStorage"; + NumOfICSUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); NumCandidateNames = NumOfFlatPlateUnits + NumPVTs + NumPVs + NumOfICSUnits; NumOfCollectors = NumOfFlatPlateUnits + NumOfICSUnits; @@ -15049,69 +14907,45 @@ namespace SurfaceGeometry { TmpCandidateICSBCTypeNames.allocate(NumOfCollectors); if (NumOfCollectors > 0) { - cCurrentModuleObject = "SolarCollector:FlatPlate:Water"; + s_ipsc->cCurrentModuleObject = "SolarCollector:FlatPlate:Water"; for (CollectorNum = 1; CollectorNum <= NumOfFlatPlateUnits; ++CollectorNum) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - CollectorNum, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStatus); + state.dataInputProcessing->inputProcessor->getObjectItem( + state, s_ipsc->cCurrentModuleObject, CollectorNum, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumNumbers, IOStatus); - TmpCandidateSurfaceNames(CollectorNum) = state.dataIPShortCut->cAlphaArgs(3); + TmpCandidateSurfaceNames(CollectorNum) = s_ipsc->cAlphaArgs(3); TmpCandidateICSBCTypeNames(CollectorNum) = ""; } } if (NumPVTs > 0) { - cCurrentModuleObject = "SolarCollector:FlatPlate:PhotovoltaicThermal"; + s_ipsc->cCurrentModuleObject = "SolarCollector:FlatPlate:PhotovoltaicThermal"; for (PVTnum = 1; PVTnum <= NumPVTs; ++PVTnum) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - PVTnum, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStatus); + state.dataInputProcessing->inputProcessor->getObjectItem( + state, s_ipsc->cCurrentModuleObject, PVTnum, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumNumbers, IOStatus); - TmpCandidateSurfaceNames(NumOfFlatPlateUnits + PVTnum) = state.dataIPShortCut->cAlphaArgs(2); + TmpCandidateSurfaceNames(NumOfFlatPlateUnits + PVTnum) = s_ipsc->cAlphaArgs(2); } } if (NumPVs > 0) { - cCurrentModuleObject = "Generator:Photovoltaic"; + s_ipsc->cCurrentModuleObject = "Generator:Photovoltaic"; for (PVnum = 1; PVnum <= NumPVs; ++PVnum) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - PVnum, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStatus); - TmpCandidateSurfaceNames(NumOfFlatPlateUnits + NumPVTs + PVnum) = state.dataIPShortCut->cAlphaArgs(2); + state.dataInputProcessing->inputProcessor->getObjectItem( + state, s_ipsc->cCurrentModuleObject, PVnum, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumNumbers, IOStatus); + TmpCandidateSurfaceNames(NumOfFlatPlateUnits + NumPVTs + PVnum) = s_ipsc->cAlphaArgs(2); } } if (NumOfICSUnits > 0) { - cCurrentModuleObject = "SolarCollector:IntegralCollectorStorage"; + s_ipsc->cCurrentModuleObject = "SolarCollector:IntegralCollectorStorage"; for (CollectorNum = 1; CollectorNum <= NumOfICSUnits; ++CollectorNum) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - CollectorNum, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNumbers, - IOStatus); - TmpCandidateSurfaceNames(NumOfFlatPlateUnits + NumPVTs + NumPVs + CollectorNum) = state.dataIPShortCut->cAlphaArgs(3); - TmpCandidateICSSurfaceNames(NumOfFlatPlateUnits + CollectorNum) = state.dataIPShortCut->cAlphaArgs(3); - TmpCandidateICSBCTypeNames(NumOfFlatPlateUnits + CollectorNum) = state.dataIPShortCut->cAlphaArgs(4); + state.dataInputProcessing->inputProcessor->getObjectItem( + state, s_ipsc->cCurrentModuleObject, CollectorNum, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumNumbers, IOStatus); + TmpCandidateSurfaceNames(NumOfFlatPlateUnits + NumPVTs + NumPVs + CollectorNum) = s_ipsc->cAlphaArgs(3); + TmpCandidateICSSurfaceNames(NumOfFlatPlateUnits + CollectorNum) = s_ipsc->cAlphaArgs(3); + TmpCandidateICSBCTypeNames(NumOfFlatPlateUnits + CollectorNum) = s_ipsc->cAlphaArgs(4); } } @@ -15881,81 +15715,85 @@ namespace SurfaceGeometry { int const TotalLayers // total layers for construction definition ) { + auto &s_mat = state.dataMaterial; RevLayerDiffs = false; for (int LayerNo = 1; LayerNo <= TotalLayers; ++LayerNo) { int thisConstLayer = state.dataConstruction->Construct(ConstrNum).LayerPoint(LayerNo); int revConstLayer = state.dataConstruction->Construct(ConstrNumRev).LayerPoint(TotalLayers - LayerNo + 1); - - auto *thisMatLay = dynamic_cast(state.dataMaterial->Material(thisConstLayer)); - assert(thisMatLay != nullptr); - auto *revMatLay = dynamic_cast(state.dataMaterial->Material(revConstLayer)); - assert(revMatLay != nullptr); - if ((thisConstLayer != revConstLayer) || // Not pointing to the same layer - (thisMatLay->group == Material::Group::WindowGlass) || // Not window glass or glass equivalent layer which have - (revMatLay->group == Material::Group::WindowGlass) || // to have certain properties flipped from front to back - (thisMatLay->group == Material::Group::GlassEquivalentLayer) || (revMatLay->group == Material::Group::GlassEquivalentLayer)) { - // If not point to the same layer, check to see if this is window glass which might need to have - // front and back material properties reversed. - Real64 constexpr SmallDiff = 0.0001; - if ((thisMatLay->group == Material::Group::WindowGlass) && (revMatLay->group == Material::Group::WindowGlass)) { - // Both layers are window glass, so need to check to see if the properties are reversed - if ((abs(thisMatLay->Thickness - revMatLay->Thickness) > SmallDiff) || - (abs(thisMatLay->ReflectSolBeamBack - revMatLay->ReflectSolBeamFront) > SmallDiff) || - (abs(thisMatLay->ReflectSolBeamFront - revMatLay->ReflectSolBeamBack) > SmallDiff) || - (abs(thisMatLay->TransVis - revMatLay->TransVis) > SmallDiff) || - (abs(thisMatLay->ReflectVisBeamBack - revMatLay->ReflectVisBeamFront) > SmallDiff) || - (abs(thisMatLay->ReflectVisBeamFront - revMatLay->ReflectVisBeamBack) > SmallDiff) || - (abs(thisMatLay->TransThermal - revMatLay->TransThermal) > SmallDiff) || - (abs(thisMatLay->AbsorpThermalBack - revMatLay->AbsorpThermalFront) > SmallDiff) || - (abs(thisMatLay->AbsorpThermalFront - revMatLay->AbsorpThermalBack) > SmallDiff) || - (abs(thisMatLay->Conductivity - revMatLay->Conductivity) > SmallDiff) || - (abs(thisMatLay->GlassTransDirtFactor - revMatLay->GlassTransDirtFactor) > SmallDiff) || - (thisMatLay->SolarDiffusing != revMatLay->SolarDiffusing) || - (abs(thisMatLay->YoungModulus - revMatLay->YoungModulus) > SmallDiff) || - (abs(thisMatLay->PoissonsRatio - revMatLay->PoissonsRatio) > SmallDiff)) { - RevLayerDiffs = true; - break; // exit when diff - } // If none of the above conditions is met, then these should be the same layers in reverse (RevLayersDiffs = false) - } else if ((thisMatLay->group == Material::Group::GlassEquivalentLayer) && - (revMatLay->group == Material::Group::GlassEquivalentLayer)) { - if ((abs(thisMatLay->TausBackBeamBeam - revMatLay->TausFrontBeamBeam) > SmallDiff) || - (abs(thisMatLay->TausFrontBeamBeam - revMatLay->TausBackBeamBeam) > SmallDiff) || - (abs(thisMatLay->ReflBackBeamBeam - revMatLay->ReflFrontBeamBeam) > SmallDiff) || - (abs(thisMatLay->ReflFrontBeamBeam - revMatLay->ReflBackBeamBeam) > SmallDiff) || - (abs(thisMatLay->TausBackBeamBeamVis - revMatLay->TausFrontBeamBeamVis) > SmallDiff) || - (abs(thisMatLay->TausFrontBeamBeamVis - revMatLay->TausBackBeamBeamVis) > SmallDiff) || - (abs(thisMatLay->ReflBackBeamBeamVis - revMatLay->ReflFrontBeamBeamVis) > SmallDiff) || - (abs(thisMatLay->ReflFrontBeamBeamVis - revMatLay->ReflBackBeamBeamVis) > SmallDiff) || - (abs(thisMatLay->TausBackBeamDiff - revMatLay->TausFrontBeamDiff) > SmallDiff) || - (abs(thisMatLay->TausFrontBeamDiff - revMatLay->TausBackBeamDiff) > SmallDiff) || - (abs(thisMatLay->ReflBackBeamDiff - revMatLay->ReflFrontBeamDiff) > SmallDiff) || - (abs(thisMatLay->ReflFrontBeamDiff - revMatLay->ReflBackBeamDiff) > SmallDiff) || - (abs(thisMatLay->TausBackBeamDiffVis - revMatLay->TausFrontBeamDiffVis) > SmallDiff) || - (abs(thisMatLay->TausFrontBeamDiffVis - revMatLay->TausBackBeamDiffVis) > SmallDiff) || - (abs(thisMatLay->ReflBackBeamDiffVis - revMatLay->ReflFrontBeamDiffVis) > SmallDiff) || - (abs(thisMatLay->ReflFrontBeamDiffVis - revMatLay->ReflBackBeamDiffVis) > SmallDiff) || - (abs(thisMatLay->TausDiffDiff - revMatLay->TausDiffDiff) > SmallDiff) || - (abs(thisMatLay->ReflBackDiffDiff - revMatLay->ReflFrontDiffDiff) > SmallDiff) || - (abs(thisMatLay->ReflFrontDiffDiff - revMatLay->ReflBackDiffDiff) > SmallDiff) || - (abs(thisMatLay->TausDiffDiffVis - revMatLay->TausDiffDiffVis) > SmallDiff) || - (abs(thisMatLay->ReflBackDiffDiffVis - revMatLay->ReflFrontDiffDiffVis) > SmallDiff) || - (abs(thisMatLay->ReflFrontDiffDiffVis - revMatLay->ReflBackDiffDiffVis) > SmallDiff) || - (abs(thisMatLay->TausThermal - revMatLay->TausThermal) > SmallDiff) || - (abs(thisMatLay->EmissThermalBack - revMatLay->EmissThermalFront) > SmallDiff) || - (abs(thisMatLay->EmissThermalFront - revMatLay->EmissThermalBack) > SmallDiff) || - (abs(thisMatLay->Resistance - revMatLay->Resistance) > SmallDiff)) { - RevLayerDiffs = true; - break; // exit when diff - } // If none of the above conditions is met, then these should be the same layers in reverse (RevLayersDiffs = false) - } else { - // Other material types do not have reversed constructions so if they are not the same layer there is a problem - // (RevLayersDiffs = true) + if (thisConstLayer == revConstLayer) continue; + + auto const *mat = s_mat->materials(thisConstLayer); + auto const *matRev = s_mat->materials(revConstLayer); + + // If not point to the same layer, check to see if this is window glass which might need to have + // front and back material properties reversed. + Real64 constexpr SmallDiff = 0.0001; + if ((mat->group == Material::Group::Glass) && (matRev->group == Material::Group::Glass)) { + auto const *matGlass = dynamic_cast(mat); + auto const *matGlassRev = dynamic_cast(matRev); + assert(matGlass != nullptr); + assert(matGlassRev != nullptr); + + // Both layers are window glass, so need to check to see if the properties are reversed + if ((abs(matGlass->Thickness - matGlassRev->Thickness) > SmallDiff) || + (abs(matGlass->ReflectSolBeamBack - matGlassRev->ReflectSolBeamFront) > SmallDiff) || + (abs(matGlass->ReflectSolBeamFront - matGlassRev->ReflectSolBeamBack) > SmallDiff) || + (abs(matGlass->TransVis - matGlassRev->TransVis) > SmallDiff) || + (abs(matGlass->ReflectVisBeamBack - matGlassRev->ReflectVisBeamFront) > SmallDiff) || + (abs(matGlass->ReflectVisBeamFront - matGlassRev->ReflectVisBeamBack) > SmallDiff) || + (abs(matGlass->TransThermal - matGlassRev->TransThermal) > SmallDiff) || + (abs(matGlass->AbsorpThermalBack - matGlassRev->AbsorpThermalFront) > SmallDiff) || + (abs(matGlass->AbsorpThermalFront - matGlassRev->AbsorpThermalBack) > SmallDiff) || + (abs(matGlass->Conductivity - matGlassRev->Conductivity) > SmallDiff) || + (abs(matGlass->GlassTransDirtFactor - matGlassRev->GlassTransDirtFactor) > SmallDiff) || + (matGlass->SolarDiffusing != matGlassRev->SolarDiffusing) || + (abs(matGlass->YoungModulus - matGlassRev->YoungModulus) > SmallDiff) || + (abs(matGlass->PoissonsRatio - matGlassRev->PoissonsRatio) > SmallDiff)) { RevLayerDiffs = true; break; // exit when diff - } // End check of whether or not these are WindowGlass - } // else: thisConstLayer is the same as revConstLayer--so there is no problem (RevLayersDiffs = false) + } // If none of the above conditions is met, then these should be the same layers in reverse (RevLayersDiffs = false) + } else if ((mat->group == Material::Group::GlassEQL) && (matRev->group == Material::Group::GlassEQL)) { + auto const *matGlass = dynamic_cast(mat); + auto const *matGlassRev = dynamic_cast(matRev); + + if ((abs(matGlass->TAR.Sol.Bk.Bm[0].BmTra - matGlassRev->TAR.Sol.Ft.Bm[0].BmTra) > SmallDiff) || + (abs(matGlass->TAR.Sol.Ft.Bm[0].BmTra - matGlassRev->TAR.Sol.Bk.Bm[0].BmTra) > SmallDiff) || + (abs(matGlass->TAR.Sol.Bk.Bm[0].BmRef - matGlassRev->TAR.Sol.Ft.Bm[0].BmRef) > SmallDiff) || + (abs(matGlass->TAR.Sol.Ft.Bm[0].BmRef - matGlassRev->TAR.Sol.Bk.Bm[0].BmRef) > SmallDiff) || + (abs(matGlass->TAR.Vis.Bk.Bm[0].BmTra - matGlassRev->TAR.Vis.Ft.Bm[0].BmTra) > SmallDiff) || + (abs(matGlass->TAR.Vis.Ft.Bm[0].BmTra - matGlassRev->TAR.Vis.Bk.Bm[0].BmTra) > SmallDiff) || + (abs(matGlass->TAR.Vis.Bk.Bm[0].BmRef - matGlassRev->TAR.Vis.Ft.Bm[0].BmRef) > SmallDiff) || + (abs(matGlass->TAR.Vis.Ft.Bm[0].BmRef - matGlassRev->TAR.Vis.Bk.Bm[0].BmRef) > SmallDiff) || + (abs(matGlass->TAR.Sol.Bk.Bm[0].DfTra - matGlassRev->TAR.Sol.Ft.Bm[0].DfTra) > SmallDiff) || + (abs(matGlass->TAR.Sol.Ft.Bm[0].DfTra - matGlassRev->TAR.Sol.Bk.Bm[0].DfTra) > SmallDiff) || + (abs(matGlass->TAR.Sol.Bk.Bm[0].DfRef - matGlassRev->TAR.Sol.Ft.Bm[0].DfRef) > SmallDiff) || + (abs(matGlass->TAR.Sol.Ft.Bm[0].DfRef - matGlassRev->TAR.Sol.Bk.Bm[0].DfRef) > SmallDiff) || + (abs(matGlass->TAR.Vis.Bk.Bm[0].DfTra - matGlassRev->TAR.Vis.Ft.Bm[0].DfTra) > SmallDiff) || + (abs(matGlass->TAR.Vis.Ft.Bm[0].DfTra - matGlassRev->TAR.Vis.Bk.Bm[0].DfTra) > SmallDiff) || + (abs(matGlass->TAR.Vis.Bk.Bm[0].DfRef - matGlassRev->TAR.Vis.Ft.Bm[0].DfRef) > SmallDiff) || + (abs(matGlass->TAR.Vis.Ft.Bm[0].DfRef - matGlassRev->TAR.Vis.Bk.Bm[0].DfRef) > SmallDiff) || + (abs(matGlass->TAR.Sol.Ft.Df.Tra - matGlassRev->TAR.Sol.Ft.Df.Tra) > SmallDiff) || + (abs(matGlass->TAR.Sol.Bk.Df.Ref - matGlassRev->TAR.Sol.Ft.Df.Ref) > SmallDiff) || + (abs(matGlass->TAR.Sol.Ft.Df.Ref - matGlassRev->TAR.Sol.Bk.Df.Ref) > SmallDiff) || + (abs(matGlass->TAR.Vis.Ft.Df.Tra - matGlassRev->TAR.Vis.Ft.Df.Tra) > SmallDiff) || + (abs(matGlass->TAR.Vis.Bk.Df.Ref - matGlassRev->TAR.Vis.Ft.Df.Ref) > SmallDiff) || + (abs(matGlass->TAR.Vis.Ft.Df.Ref - matGlassRev->TAR.Vis.Bk.Df.Ref) > SmallDiff) || + (abs(matGlass->TAR.IR.Ft.Tra - matGlassRev->TAR.IR.Ft.Tra) > SmallDiff) || + (abs(matGlass->TAR.IR.Bk.Emi - matGlassRev->TAR.IR.Ft.Emi) > SmallDiff) || + (abs(matGlass->TAR.IR.Ft.Emi - matGlassRev->TAR.IR.Bk.Emi) > SmallDiff) || + (abs(matGlass->Resistance - matGlassRev->Resistance) > SmallDiff)) { + RevLayerDiffs = true; + break; // exit when diff + } // If none of the above conditions is met, then these should be the same layers in reverse (RevLayersDiffs = false) + + } else { + // Other material types do not have reversed constructions so if they are not the same layer there is a problem + // (RevLayersDiffs = true) + RevLayerDiffs = true; + break; // exit when diff + } // End check of whether or not these are WindowGlass } } diff --git a/src/EnergyPlus/SurfaceGroundHeatExchanger.cc b/src/EnergyPlus/SurfaceGroundHeatExchanger.cc index a2d01f30089..e410a160e2d 100644 --- a/src/EnergyPlus/SurfaceGroundHeatExchanger.cc +++ b/src/EnergyPlus/SurfaceGroundHeatExchanger.cc @@ -474,6 +474,8 @@ namespace SurfaceGroundHeatExchanger { int LayerNum; // material layer number for bottom Real64 OutDryBulb; // Height Dependent dry bulb. + auto &s_mat = state.dataMaterial; + // get QTF data - only once if (this->InitQTF) { for (Cons = 1; Cons <= state.dataHeatBal->TotConstructs; ++Cons) { @@ -496,13 +498,11 @@ namespace SurfaceGroundHeatExchanger { this->CTFTSourceQ = state.dataConstruction->Construct(Cons).CTFTSourceQ; // w coefficents this->ConstructionNum = Cons; // surface properties - auto const *thisMaterialLayer = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(Cons).LayerPoint(LayerNum))); + auto const *thisMaterialLayer = s_mat->materials(state.dataConstruction->Construct(Cons).LayerPoint(LayerNum)); assert(thisMaterialLayer != nullptr); this->BtmRoughness = thisMaterialLayer->Roughness; this->TopThermAbs = thisMaterialLayer->AbsorpThermal; - auto const *thisMaterial1 = - dynamic_cast(state.dataMaterial->Material(state.dataConstruction->Construct(Cons).LayerPoint(1))); + auto const *thisMaterial1 = s_mat->materials(state.dataConstruction->Construct(Cons).LayerPoint(1)); assert(thisMaterial1 != nullptr); this->TopRoughness = thisMaterial1->Roughness; this->TopThermAbs = thisMaterial1->AbsorpThermal; diff --git a/src/EnergyPlus/SystemAvailabilityManager.cc b/src/EnergyPlus/SystemAvailabilityManager.cc index 4bb55e55913..52f0d52936b 100644 --- a/src/EnergyPlus/SystemAvailabilityManager.cc +++ b/src/EnergyPlus/SystemAvailabilityManager.cc @@ -842,7 +842,6 @@ namespace Avail { cAlphaFieldNames, cNumericFieldNames); - ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; auto &diffThermoMgr = state.dataAvail->DiffThermoData(SysAvailNum); diffThermoMgr.Name = cAlphaArgs(1); diffThermoMgr.type = ManagerType::DiffThermo; @@ -922,7 +921,6 @@ namespace Avail { cAlphaFieldNames, cNumericFieldNames); - ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; auto &hiTurnOffMgr = state.dataAvail->HiTurnOffData(SysAvailNum); hiTurnOffMgr.Name = cAlphaArgs(1); hiTurnOffMgr.type = ManagerType::HiTempTOff; @@ -976,7 +974,6 @@ namespace Avail { lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); - ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; auto &hiTurnOnMgr = state.dataAvail->HiTurnOnData(SysAvailNum); hiTurnOnMgr.Name = cAlphaArgs(1); hiTurnOnMgr.type = ManagerType::HiTempTOn; @@ -1095,7 +1092,6 @@ namespace Avail { cAlphaFieldNames, cNumericFieldNames); - ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; auto &loTurnOnMgr = state.dataAvail->LoTurnOnData(SysAvailNum); loTurnOnMgr.Name = cAlphaArgs(1); loTurnOnMgr.type = ManagerType::LoTempTOn; @@ -1358,7 +1354,7 @@ namespace Avail { std::string const &AvailabilityListName, // name that should be an Availability Manager List Name int const Loop, // which loop this is int const NumAirLoops, // Total number of air loops - bool &ErrorsFound // true if certain errors are detected here + [[maybe_unused]] bool &ErrorsFound // true if certain errors are detected here ) { @@ -1424,9 +1420,9 @@ namespace Avail { } void GetZoneEqAvailabilityManager(EnergyPlusData &state, - int const ZoneEquipType, // Type of ZoneHVAC:* component - int const CompNum, // Index of a particular ZoneHVAC:* component - bool &ErrorsFound // true if certain errors are detected here + int const ZoneEquipType, // Type of ZoneHVAC:* component + int const CompNum, // Index of a particular ZoneHVAC:* component + [[maybe_unused]] bool &ErrorsFound // true if certain errors are detected here ) { @@ -1444,9 +1440,7 @@ namespace Avail { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: std::string AvailabilityListName; // name that should be an Availability Manager List Name - int Found; - int Num; - int CompNumAvailManagers; // Number of availability managers associated with a ZoneHVAC:* component + int CompNumAvailManagers; // Number of availability managers associated with a ZoneHVAC:* component if (state.dataAvail->GetAvailListsInput) { GetSysAvailManagerListInputs(state); @@ -1506,7 +1500,6 @@ namespace Avail { using DataZoneEquipment::NumValidSysAvailZoneComponents; - int ZoneEquipType; int ZoneListNum; int ScanZoneListNum; int ZoneNum; @@ -1725,6 +1718,7 @@ namespace Avail { } } break; + default: { ShowSevereError(state, format("AvailabilityManager Type not found: {}", type)); ShowContinueError(state, format("Occurs in Manager={}", SysAvailName)); diff --git a/src/EnergyPlus/SystemReports.cc b/src/EnergyPlus/SystemReports.cc index e862f4ba56a..ebf30aae9bb 100644 --- a/src/EnergyPlus/SystemReports.cc +++ b/src/EnergyPlus/SystemReports.cc @@ -160,6 +160,7 @@ void InitEnergyReports(EnergyPlusData &state) ++OutNum) { if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(OutNum) == state.dataZoneEquip->SupplyAirPath(SAPNum).InletNodeNum) { + thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).AirLoopNum = AirLoopNum; thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyBranchIndex = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OutletBranchNum[OutNum - 1]; if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.Exists) { @@ -192,6 +193,7 @@ void InitEnergyReports(EnergyPlusData &state) ++BranchNum) { if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).NodeNumOut == state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).AirLoopSupplyNodeNum(NodeIndex)) { + thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).AirLoopNum = AirLoopNum; thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyBranchIndex = BranchNum; if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.Exists) { for (int MainBranchNum = 1; @@ -229,6 +231,7 @@ void InitEnergyReports(EnergyPlusData &state) ++OutNum) { if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(OutNum) == state.dataZoneEquip->SupplyAirPath(SAPNum).InletNodeNum) { + thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).AirLoopNum = AirLoopNum; thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyBranchIndex = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OutletBranchNum[OutNum - 1]; if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.Exists) { @@ -261,6 +264,7 @@ void InitEnergyReports(EnergyPlusData &state) ++BranchNum) { if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).NodeNumOut == state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).AirLoopSupplyNodeNum(NodeIndex)) { + thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).AirLoopNum = AirLoopNum; thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyBranchIndex = BranchNum; if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.Exists) { for (int MainBranchNum = 1; @@ -4040,11 +4044,14 @@ void ReportVentilationLoads(EnergyPlusData &state) case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveElectric: case DataZoneEquipment::ZoneEquipType::HighTemperatureRadiant: // not sure how HeatExchanger:* could be used as zone equipment ????? - case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiant: + case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantConstFlow: + case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantVarFlow: + case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantElectric: case DataZoneEquipment::ZoneEquipType::ExhaustFan: case DataZoneEquipment::ZoneEquipType::HeatExchanger: // HPWaterHeater can be used as zone equipment - case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater: + case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeaterPumpedCondenser: + case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeaterWrappedCondenser: case DataZoneEquipment::ZoneEquipType::BaseboardWater: case DataZoneEquipment::ZoneEquipType::DehumidifierDX: case DataZoneEquipment::ZoneEquipType::BaseboardSteam: @@ -4868,6 +4875,7 @@ void reportAirLoopToplogy(EnergyPlusData &state) auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum); auto &zel = state.dataZoneEquip->ZoneEquipList(zoneNum); for (auto &thisCoolADU : thisZoneEquipConfig.AirDistUnitCool) { + if (thisCoolADU.AirLoopNum != airLoopNum) continue; if (thisCoolADU.SupplyBranchIndex != thisAtoZInfo.SupplyDuctBranchNum(ductNum)) continue; if (thisCoolADU.SupplyAirPathExists) { int spCompNum = thisSupplyPath.OutletNodeSupplyPathCompNum(thisCoolADU.SupplyAirPathOutNodeIndex); @@ -4920,6 +4928,7 @@ void reportAirLoopToplogy(EnergyPlusData &state) auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum); auto &zel = state.dataZoneEquip->ZoneEquipList(zoneNum); for (auto &thisHeatADU : thisZoneEquipConfig.AirDistUnitHeat) { + if (thisHeatADU.AirLoopNum != airLoopNum) continue; if (thisHeatADU.SupplyBranchIndex != thisAtoZInfo.SupplyDuctBranchNum(ductNum)) continue; if (thisHeatADU.SupplyAirPathExists) { int spCompNum = thisSupplyPath.OutletNodeSupplyPathCompNum(thisHeatADU.SupplyAirPathOutNodeIndex); diff --git a/src/EnergyPlus/TARCOGGassesParams.hh b/src/EnergyPlus/TARCOGGassesParams.hh index c1f143f6860..b65e3867bfc 100644 --- a/src/EnergyPlus/TARCOGGassesParams.hh +++ b/src/EnergyPlus/TARCOGGassesParams.hh @@ -66,6 +66,8 @@ enum class Stdrd Num }; +static constexpr std::array stdrdNamesUC = {"ISO15099", "EN673DECLARED", "EN673DESIGN"}; + int constexpr MinStandard = static_cast(Stdrd::ISO15099); // minimum index for standard int constexpr MaxStandard = static_cast(Stdrd::EN673Design); // maximum index for standard diff --git a/src/EnergyPlus/TARCOGParams.cc b/src/EnergyPlus/TARCOGParams.cc index fd517848863..6189b78e9cb 100644 --- a/src/EnergyPlus/TARCOGParams.cc +++ b/src/EnergyPlus/TARCOGParams.cc @@ -63,4 +63,13 @@ namespace EnergyPlus::TARCOGParams { // PURPOSE OF THIS MODULE: // Module which contains common TARCOG parameters and constants +constexpr std::array layerTypeNamesUC = { + "SPECULAR", "VENETIANHORIZONTAL", "WOVEN", "PERFORATED", "OTHERSHADINGTYPE", "BSDF", "VENETIANVERTICAL"}; + +constexpr std::array thermalModelNamesUC = { + "ISO15099", "SCALEDCAVITYWIDTH", "CONVECTIVESCALARMODEL_NOSDTHICKNESS", "CONVECTIVESCALARMODEL_WITHSDTHICKNESS"}; + +constexpr std::array deflectionCalculationNamesUC = { + "NODEFLECTION", "TEMPERATUREANDPRESSUREINPUT", "MEASUREDDEFLECTION"}; + } // namespace EnergyPlus::TARCOGParams diff --git a/src/EnergyPlus/TARCOGParams.hh b/src/EnergyPlus/TARCOGParams.hh index beada723739..f38a750a293 100644 --- a/src/EnergyPlus/TARCOGParams.hh +++ b/src/EnergyPlus/TARCOGParams.hh @@ -78,6 +78,8 @@ enum class TARCOGLayerType : int Num }; +extern const std::array layerTypeNamesUC; + // Thermal models: enum class TARCOGThermalModel : int { @@ -89,7 +91,9 @@ enum class TARCOGThermalModel : int Num }; -int constexpr YES_SupportPillar = 1; +extern const std::array thermalModelNamesUC; + +int constexpr YES_SupportPillar = 1; // Exsqueeze me? // Deflection parameters enum class DeflectionCalculation : int @@ -101,6 +105,8 @@ enum class DeflectionCalculation : int Num }; +extern const std::array deflectionCalculationNamesUC; + // definition of parameters for deflection sum. These parameters define maximum number of loop to which sum // will perform. By equation, these numbers will go to infinite and some test showed that going to NMax and MMax // values would produce enough precision diff --git a/src/EnergyPlus/TranspiredCollector.cc b/src/EnergyPlus/TranspiredCollector.cc index 77a075eeb34..aacbbd87e55 100644 --- a/src/EnergyPlus/TranspiredCollector.cc +++ b/src/EnergyPlus/TranspiredCollector.cc @@ -1078,6 +1078,7 @@ namespace TranspiredCollector { Real64 SensHeatingRate; // Rate at which the system is heating outdoor air Real64 AlessHoles; // Area for Kutscher's relation + auto &s_mat = state.dataMaterial; // Active UTSC calculation // first do common things for both correlations Real64 sum_area = 0.0; @@ -1187,9 +1188,7 @@ namespace TranspiredCollector { HAirARR(ThisSurf), HSrdSurfARR(ThisSurf)); ConstrNum = state.dataSurface->Surface(SurfPtr).Construction; - AbsThermSurf = - dynamic_cast(state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))) - ->AbsorpThermal; + AbsThermSurf = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))->AbsorpThermal; TsoK = state.dataHeatBalSurf->SurfOutsideTempHist(1)(SurfPtr) + Constant::Kelvin; TscollK = state.dataTranspiredCollector->UTSC(UTSCNum).TcollLast + Constant::Kelvin; HPlenARR(ThisSurf) = Sigma * AbsExt * AbsThermSurf * (pow_4(TscollK) - pow_4(TsoK)) / (TscollK - TsoK); @@ -1752,6 +1751,9 @@ namespace TranspiredCollector { Real64 sum_area = 0.0; Real64 sum_produc_area_drybulb = 0.0; Real64 sum_produc_area_wetbulb = 0.0; + + auto &s_mat = state.dataMaterial; + for (int SurfNum : SurfPtrARR) { sum_area += state.dataSurface->Surface(SurfNum).Area; sum_produc_area_drybulb += state.dataSurface->Surface(SurfNum).Area * state.dataSurface->SurfOutDryBulbTemp(SurfNum); @@ -1801,9 +1803,7 @@ namespace TranspiredCollector { HAirARR(ThisSurf), HSrdSurfARR(ThisSurf)); int ConstrNum = state.dataSurface->Surface(SurfPtr).Construction; - Real64 AbsThermSurf = - dynamic_cast(state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))) - ->AbsorpThermal; + Real64 AbsThermSurf = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))->AbsorpThermal; Real64 TsoK = state.dataHeatBalSurf->SurfOutsideTempHist(1)(SurfPtr) + Constant::Kelvin; Real64 TsBaffK = TmpTsBaf + Constant::Kelvin; if (TsBaffK == TsoK) { // avoid divide by zero diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index 85fc42c5674..e68b2f8047a 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -497,9 +497,6 @@ int AbortEnergyPlus(EnergyPlusData &state) std::string NumSevereDuringWarmup; std::string NumWarningsDuringSizing; std::string NumSevereDuringSizing; - int Hours; // Elapsed Time Hour Reporting - int Minutes; // Elapsed Time Minute Reporting - Real64 Seconds; // Elapsed Time Second Reporting bool ErrFound; bool TerminalError; @@ -660,9 +657,6 @@ int EndEnergyPlus(EnergyPlusData &state) std::string NumSevereDuringWarmup; std::string NumWarningsDuringSizing; std::string NumSevereDuringSizing; - int Hours; // Elapsed Time Hour Reporting - int Minutes; // Elapsed Time Minute Reporting - Real64 Seconds; // Elapsed Time Second Reporting if (state.dataSQLiteProcedures->sqlite) { state.dataSQLiteProcedures->sqlite->updateSQLiteSimulationRecord(true, true); diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index f3c539fba89..743972b9beb 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -58,7 +58,6 @@ // EnergyPlus Headers #include #include -#include #include #include #include @@ -96,7 +95,6 @@ namespace WindowComplexManager { // PURPOSE OF THIS MODULE: // Initialize data for solar and thermal calculations and also performs thermal calculations for BSDF window - using namespace DataComplexFenestration; using namespace DataVectorTypes; using namespace DataBSDFWindow; using namespace DataSurfaces; // , ONLY: TotSurfaces,TotWindows,Surface,SurfaceWindow !update this later @@ -2643,8 +2641,6 @@ namespace WindowComplexManager { int ZoneNum; // Zone number corresponding to SurfNum - int i; - int TotLay; // Total number of layers in a construction // (sum of solid layers and gap layers) int Lay; // Layer number @@ -2694,18 +2690,12 @@ namespace WindowComplexManager { int CalcSHGC(0); // SHGC calculations are not necessary for E+ run int NumOfIterations(0); - int ICoeff; - std::string tarcogErrorMessage; // store error text from tarcog // Simon: locally used variables int ngllayer; int nglface; int nglfacep; - int TempInt; - int PillarPtr; - int DeflectionPtr; - int GasPointer; int ThermalModelNum; Real64 rmir; // IR radiance of window's interior surround (W/m2) Real64 outir; @@ -2716,6 +2706,7 @@ namespace WindowComplexManager { Real64 SrdSurfTempAbs; // Absolute temperature of a surrounding surface Real64 OutSrdIR; + auto &s_mat = state.dataMaterial; // fill local vars CalcDeflection = TARCOGParams::DeflectionCalculation::NONE; @@ -2865,73 +2856,65 @@ namespace WindowComplexManager { IGap = 0; for (Lay = 1; Lay <= TotLay; ++Lay) { LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(LayPtr)); - assert(thisMaterial != nullptr); + auto const *mat = s_mat->materials(LayPtr); + + if ((mat->group == Material::Group::Glass) || (mat->group == Material::Group::GlassSimple)) { + auto const *matGlass = dynamic_cast(mat); + assert(matGlass != nullptr); - if ((thisMaterial->group == Material::Group::WindowGlass) || (thisMaterial->group == Material::Group::WindowSimpleGlazing)) { ++IGlass; LayerType(IGlass) = TARCOGParams::TARCOGLayerType::SPECULAR; // this marks specular layer type - thick(IGlass) = thisMaterial->Thickness; - scon(IGlass) = thisMaterial->Conductivity; - emis(2 * IGlass - 1) = thisMaterial->AbsorpThermalFront; - emis(2 * IGlass) = thisMaterial->AbsorpThermalBack; - tir(2 * IGlass - 1) = thisMaterial->TransThermal; - tir(2 * IGlass) = thisMaterial->TransThermal; - YoungsMod(IGlass) = thisMaterial->YoungModulus; - PoissonsRat(IGlass) = thisMaterial->PoissonsRatio; - } else if (thisMaterial->group == Material::Group::ComplexWindowShade) { + thick(IGlass) = matGlass->Thickness; + scon(IGlass) = matGlass->Conductivity; + emis(2 * IGlass - 1) = matGlass->AbsorpThermalFront; + emis(2 * IGlass) = matGlass->AbsorpThermalBack; + tir(2 * IGlass - 1) = matGlass->TransThermal; + tir(2 * IGlass) = matGlass->TransThermal; + YoungsMod(IGlass) = matGlass->YoungModulus; + PoissonsRat(IGlass) = matGlass->PoissonsRatio; + + } else if (mat->group == Material::Group::ComplexShade) { + auto const *matShade = dynamic_cast(mat); ++IGlass; - TempInt = thisMaterial->ComplexShadePtr; - LayerType(IGlass) = state.dataMaterial->ComplexShade(TempInt).LayerType; + LayerType(IGlass) = matShade->LayerType; - thick(IGlass) = state.dataMaterial->ComplexShade(TempInt).Thickness; - scon(IGlass) = state.dataMaterial->ComplexShade(TempInt).Conductivity; - emis(2 * IGlass - 1) = state.dataMaterial->ComplexShade(TempInt).FrontEmissivity; - emis(2 * IGlass) = state.dataMaterial->ComplexShade(TempInt).BackEmissivity; - tir(2 * IGlass - 1) = state.dataMaterial->ComplexShade(TempInt).IRTransmittance; - tir(2 * IGlass) = state.dataMaterial->ComplexShade(TempInt).IRTransmittance; + thick(IGlass) = matShade->Thickness; + scon(IGlass) = matShade->Conductivity; + emis(2 * IGlass - 1) = matShade->FrontEmissivity; + emis(2 * IGlass) = matShade->BackEmissivity; + tir(2 * IGlass - 1) = matShade->TransThermal; + tir(2 * IGlass) = matShade->TransThermal; // This needs to be converted into correct areas. That can be done only after loading complete window data - Atop(IGlass) = state.dataMaterial->ComplexShade(TempInt).TopOpeningMultiplier; - Abot(IGlass) = state.dataMaterial->ComplexShade(TempInt).BottomOpeningMultiplier; - Al(IGlass) = state.dataMaterial->ComplexShade(TempInt).LeftOpeningMultiplier; - Ar(IGlass) = state.dataMaterial->ComplexShade(TempInt).RightOpeningMultiplier; - Ah(IGlass) = state.dataMaterial->ComplexShade(TempInt).FrontOpeningMultiplier; - - SlatThick(IGlass) = state.dataMaterial->ComplexShade(TempInt).SlatThickness; - SlatWidth(IGlass) = state.dataMaterial->ComplexShade(TempInt).SlatWidth; - SlatAngle(IGlass) = state.dataMaterial->ComplexShade(TempInt).SlatAngle; - SlatCond(IGlass) = state.dataMaterial->ComplexShade(TempInt).SlatConductivity; - SlatSpacing(IGlass) = state.dataMaterial->ComplexShade(TempInt).SlatSpacing; - SlatCurve(IGlass) = state.dataMaterial->ComplexShade(TempInt).SlatCurve; - } else if (thisMaterial->group == Material::Group::ComplexWindowGap) { + Atop(IGlass) = matShade->topOpeningMult; + Abot(IGlass) = matShade->bottomOpeningMult; + Al(IGlass) = matShade->leftOpeningMult; + Ar(IGlass) = matShade->rightOpeningMult; + Ah(IGlass) = matShade->frontOpeningMult; + + SlatThick(IGlass) = matShade->SlatThickness; + SlatWidth(IGlass) = matShade->SlatWidth; + SlatAngle(IGlass) = matShade->SlatAngle; + SlatCond(IGlass) = matShade->SlatConductivity; + SlatSpacing(IGlass) = matShade->SlatSpacing; + SlatCurve(IGlass) = matShade->SlatCurve; + + } else if (mat->group == Material::Group::ComplexWindowGap) { + auto const *matGap = dynamic_cast(mat); ++IGap; - gap(IGap) = thisMaterial->Thickness; - presure(IGap) = thisMaterial->Pressure; - - DeflectionPtr = thisMaterial->DeflectionStatePtr; - if (DeflectionPtr != 0) { - GapDefMax(IGap) = state.dataHeatBal->DeflectionState(DeflectionPtr).DeflectedThickness; - } else { - GapDefMax(IGap) = gap(IGap); - } + gap(IGap) = matGap->Thickness; + presure(IGap) = matGap->Pressure; - PillarPtr = thisMaterial->SupportPillarPtr; - - if (PillarPtr != 0) { - SupportPlr(IGap) = 1; - PillarSpacing(IGap) = state.dataHeatBal->SupportPillar(PillarPtr).Spacing; - PillarRadius(IGap) = state.dataHeatBal->SupportPillar(PillarPtr).Radius; - } + GapDefMax(IGap) = matGap->deflectedThickness; - GasPointer = thisMaterial->GasPointer; + PillarSpacing(IGap) = matGap->pillarSpacing; + PillarRadius(IGap) = matGap->pillarRadius; + SupportPlr(IGap) = matGap->pillarSpacing != 0.0 && matGap->pillarRadius != 0.0; - auto const *thisMaterialGas = dynamic_cast(state.dataMaterial->Material(GasPointer)); - assert(thisMaterialGas != nullptr); - nmix(IGap + 1) = thisMaterialGas->numGases; + nmix(IGap + 1) = matGap->numGases; for (IMix = 1; IMix <= nmix(IGap + 1); ++IMix) { - auto const &gas = thisMaterialGas->gases[IMix - 1]; - frct(IMix, IGap + 1) = thisMaterialGas->gasFracts[IMix - 1]; + auto const &gas = matGap->gases[IMix - 1]; + frct(IMix, IGap + 1) = matGap->gasFracts[IMix - 1]; // Now has to build-up gas coefficients arrays. All used gasses should be stored into these arrays and // to be correctly referenced by gap arrays @@ -3388,14 +3371,15 @@ namespace WindowComplexManager { if (ShadeFlag == WinShadingType::IntShade) state.dataSurface->SurfWinConvCoeffWithShade(SurfNum) = 0.0; if (ShadeFlag == WinShadingType::IntShade) { + auto const &surfShade = state.dataSurface->surfShades(SurfNum); SurfInsideTemp = theta(2 * ngllayer + 2) - Constant::Kelvin; // // Get properties of inside shading layer - Real64 EffShBlEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[1]; - Real64 EffGlEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[1]; + Real64 EffShEmiss = surfShade.effShadeEmi; + Real64 EffGlEmiss = surfShade.effGlassEmi; state.dataSurface->SurfWinEffInsSurfTemp(SurfNum) = - (EffShBlEmiss * SurfInsideTemp + EffGlEmiss * (theta(2 * ngllayer) - Constant::Kelvin)) / (EffShBlEmiss + EffGlEmiss); + (EffShEmiss * SurfInsideTemp + EffGlEmiss * (theta(2 * ngllayer) - Constant::Kelvin)) / (EffShEmiss + EffGlEmiss); } else { SurfOutsideTemp = theta(1) - Constant::Kelvin; diff --git a/src/EnergyPlus/WindowComplexManager.hh b/src/EnergyPlus/WindowComplexManager.hh index 2886f4c2e0e..6206b11f336 100644 --- a/src/EnergyPlus/WindowComplexManager.hh +++ b/src/EnergyPlus/WindowComplexManager.hh @@ -379,7 +379,7 @@ struct WindowComplexManagerData : BaseGlobalStruct { } - void clear_state() // override + void clear_state() override { this->NumComplexWind = 0; this->BasisList.deallocate(); diff --git a/src/EnergyPlus/WindowEquivalentLayer.cc b/src/EnergyPlus/WindowEquivalentLayer.cc index 7c556976091..91d406d50e7 100644 --- a/src/EnergyPlus/WindowEquivalentLayer.cc +++ b/src/EnergyPlus/WindowEquivalentLayer.cc @@ -78,8 +78,6 @@ namespace EnergyPlus::WindowEquivalentLayer { // MODULE INFORMATION // AUTHOR Bereket A. Nigusse, FSEC/UCF // DATE WRITTEN May 2013 -// MODIFIED na -// RE-ENGINEERED na // PURPOSE OF THIS MODULE: // Manages the equivalent layer (ASHWAT) window model optical and thermal @@ -122,6 +120,9 @@ namespace EnergyPlus::WindowEquivalentLayer { // Using/Aliasing using namespace DataHeatBalance; using namespace DataSurfaces; + +constexpr std::array orientationNamesUC = {"HORIZONTAL", "VERTICAL"}; + void InitEquivalentLayerWindowCalculations(EnergyPlusData &state) { @@ -130,8 +131,7 @@ void InitEquivalentLayerWindowCalculations(EnergyPlusData &state) // DATE WRITTEN May 2013 // PURPOSE OF THIS SUBROUTINE: - // Initializes the optical properties for the Equivalent Layer (ASHWAT) Window - // model + // Initializes the optical properties for the Equivalent Layer (ASHWAT) Window model // METHODOLOGY EMPLOYED: // Gets the EquivalentLayer Window Layers Inputs. Fills in the derived data type // based on the inputs specified. @@ -168,8 +168,6 @@ void SetEquivalentLayerWindowProperties(EnergyPlusData &state, int const ConstrN // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse // DATE WRITTEN May 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Populates the the equivalent layer window model optical and thermal @@ -178,55 +176,41 @@ void SetEquivalentLayerWindowProperties(EnergyPlusData &state, int const ConstrN // METHODOLOGY EMPLOYED: // uses some routine developed for ASHRAE RP-1311 (ASHWAT Model) - int Layer; // layer index - int MaterNum; // material index of a layer in a construction - int gLayer; // gap layer index - int sLayer; // glazing and shade layers (non-gas layers) index - int EQLNum; // equivalent layer window construction index - int NumGLayers; // number of gap layers - int NumSLayers; // number of glazing and shade layers (non-gas layers) Array2D SysAbs1(2, CFSMAXNL + 1); // layers absorptance and system transmittance + auto &s_mat = state.dataMaterial; + if (!allocated(state.dataWindowEquivLayer->CFSLayers)) state.dataWindowEquivLayer->CFSLayers.allocate(state.dataConstruction->Construct(ConstrNum).TotLayers); - sLayer = 0; - gLayer = 0; - EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; + int sLayer = 0; // glazing and shade layers (non-gas layers) index + int gLayer = 0; // gap layer index + int EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; auto &CFS = state.dataWindowEquivLayer->CFS; CFS(EQLNum).Name = state.dataConstruction->Construct(ConstrNum).Name; - for (Layer = 1; Layer <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Layer) { + for (int Layer = 1; Layer <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Layer) { - Material::Group group1 = state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))->group; - if (group1 != Material::Group::GlassEquivalentLayer && group1 != Material::Group::ShadeEquivalentLayer && - group1 != Material::Group::DrapeEquivalentLayer && group1 != Material::Group::ScreenEquivalentLayer && - group1 != Material::Group::BlindEquivalentLayer && group1 != Material::Group::GapEquivalentLayer) + Material::Group group1 = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))->group; + if (group1 != Material::Group::GlassEQL && group1 != Material::Group::ShadeEQL && group1 != Material::Group::DrapeEQL && + group1 != Material::Group::ScreenEQL && group1 != Material::Group::BlindEQL && group1 != Material::Group::WindowGapEQL) continue; - MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); - auto const *mat = state.dataMaterial->Material(MaterNum); + int MaterNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(Layer); + auto const *mat = s_mat->materials(MaterNum); - if (mat->group == Material::Group::GapEquivalentLayer) { - // Gap or Gas Layer - ++gLayer; - } else { - auto const *thisMaterial = dynamic_cast(mat); + if (mat->group == Material::Group::BlindEQL) { + auto const *thisMaterial = dynamic_cast(mat); assert(thisMaterial != nullptr); - // Solid (Glazing or Shade) Layer + ++sLayer; CFS(EQLNum).L(sLayer).Name = thisMaterial->Name; // longwave property input - CFS(EQLNum).L(sLayer).LWP_MAT.EPSLF = thisMaterial->EmissThermalFront; - CFS(EQLNum).L(sLayer).LWP_MAT.EPSLB = thisMaterial->EmissThermalBack; - CFS(EQLNum).L(sLayer).LWP_MAT.TAUL = thisMaterial->TausThermal; - } - - if (mat->group == Material::Group::BlindEquivalentLayer) { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLF = thisMaterial->TAR.IR.Ft.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLB = thisMaterial->TAR.IR.Bk.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.TAUL = thisMaterial->TAR.IR.Ft.Tra; CFS(EQLNum).VBLayerPtr = sLayer; if (thisMaterial->SlatOrientation == DataWindowEquivalentLayer::Orientation::Horizontal) { @@ -234,86 +218,120 @@ void SetEquivalentLayerWindowProperties(EnergyPlusData &state, int const ConstrN } else if (thisMaterial->SlatOrientation == DataWindowEquivalentLayer::Orientation::Vertical) { CFS(EQLNum).L(sLayer).LTYPE = LayerType::VBVER; } - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->ReflFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->ReflBackBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TausFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TausBackBeamDiff; - - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFDD = thisMaterial->ReflFrontDiffDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBDD = thisMaterial->ReflBackDiffDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUS_DD = thisMaterial->TausDiffDiff; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfRef; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfRef; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfTra; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfTra; + + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFDD = thisMaterial->TAR.Sol.Ft.Df.Ref; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBDD = thisMaterial->TAR.Sol.Bk.Df.Ref; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUS_DD = thisMaterial->TAR.Sol.Ft.Df.Tra; CFS(EQLNum).L(sLayer).PHI_DEG = thisMaterial->SlatAngle; CFS(EQLNum).L(sLayer).CNTRL = static_cast(thisMaterial->slatAngleType); CFS(EQLNum).L(sLayer).S = thisMaterial->SlatSeparation; CFS(EQLNum).L(sLayer).W = thisMaterial->SlatWidth; CFS(EQLNum).L(sLayer).C = thisMaterial->SlatCrown; - } else if (mat->group == Material::Group::GlassEquivalentLayer) { - auto const *thisMaterial = dynamic_cast(mat); + + } else if (mat->group == Material::Group::GlassEQL) { + auto const *thisMaterial = dynamic_cast(mat); assert(thisMaterial != nullptr); // glazing + ++sLayer; + CFS(EQLNum).L(sLayer).Name = thisMaterial->Name; + // longwave property input + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLF = thisMaterial->TAR.IR.Ft.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLB = thisMaterial->TAR.IR.Bk.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.TAUL = thisMaterial->TAR.IR.Ft.Tra; + CFS(EQLNum).L(sLayer).LTYPE = LayerType::GLAZE; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBB = thisMaterial->ReflFrontBeamBeam; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBB = thisMaterial->ReflBackBeamBeam; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBB = thisMaterial->TausFrontBeamBeam; - - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->ReflFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->ReflBackBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TausFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TausBackBeamDiff; - - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFDD = thisMaterial->ReflFrontDiffDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBDD = thisMaterial->ReflBackDiffDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUS_DD = thisMaterial->TausDiffDiff; - } else if (mat->group == Material::Group::ShadeEquivalentLayer) { - auto const *thisMaterial = dynamic_cast(mat); + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBB = thisMaterial->TAR.Sol.Ft.Bm[0].BmRef; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBB = thisMaterial->TAR.Sol.Bk.Bm[0].BmRef; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBB = thisMaterial->TAR.Sol.Ft.Bm[0].BmTra; + + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfRef; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfRef; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfTra; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfTra; + + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFDD = thisMaterial->TAR.Sol.Ft.Df.Ref; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBDD = thisMaterial->TAR.Sol.Bk.Df.Ref; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUS_DD = thisMaterial->TAR.Sol.Ft.Df.Tra; + + } else if (mat->group == Material::Group::ShadeEQL) { + auto const *thisMaterial = dynamic_cast(mat); assert(thisMaterial != nullptr); // roller blind + ++sLayer; + CFS(EQLNum).L(sLayer).Name = thisMaterial->Name; + // longwave property input + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLF = thisMaterial->TAR.IR.Ft.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLB = thisMaterial->TAR.IR.Bk.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.TAUL = thisMaterial->TAR.IR.Ft.Tra; + CFS(EQLNum).L(sLayer).LTYPE = LayerType::ROLLB; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBB = thisMaterial->TausFrontBeamBeam; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBB = thisMaterial->TausBackBeamBeam; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->ReflFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->ReflBackBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TausFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TausBackBeamDiff; - - } else if (mat->group == Material::Group::DrapeEquivalentLayer) { - auto const *thisMaterial = dynamic_cast(mat); + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBB = thisMaterial->TAR.Sol.Ft.Bm[0].BmTra; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBB = thisMaterial->TAR.Sol.Bk.Bm[0].BmTra; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfRef; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfRef; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfTra; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfTra; + + } else if (mat->group == Material::Group::DrapeEQL) { + auto const *thisMaterial = dynamic_cast(mat); assert(thisMaterial != nullptr); // drapery fabric + ++sLayer; + CFS(EQLNum).L(sLayer).Name = thisMaterial->Name; + // longwave property input + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLF = thisMaterial->TAR.IR.Ft.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLB = thisMaterial->TAR.IR.Bk.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.TAUL = thisMaterial->TAR.IR.Ft.Tra; + CFS(EQLNum).L(sLayer).LTYPE = LayerType::DRAPE; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBB = thisMaterial->TausFrontBeamBeam; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBB = thisMaterial->TausBackBeamBeam; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->ReflFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->ReflBackBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TausFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TausBackBeamDiff; - - CFS(EQLNum).L(sLayer).S = thisMaterial->PleatedDrapeLength; - CFS(EQLNum).L(sLayer).W = thisMaterial->PleatedDrapeWidth; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBB = thisMaterial->TAR.Sol.Ft.Bm[0].BmTra; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBB = thisMaterial->TAR.Sol.Bk.Bm[0].BmTra; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfRef; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfRef; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfTra; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfTra; + + CFS(EQLNum).L(sLayer).S = thisMaterial->pleatedLength; + CFS(EQLNum).L(sLayer).W = thisMaterial->pleatedWidth; // init diffuse SWP to force default derivation CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFDD = -1.0; CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBDD = -1.0; CFS(EQLNum).L(sLayer).SWP_MAT.TAUS_DD = -1.0; - } else if (mat->group == Material::Group::ScreenEquivalentLayer) { - auto const *thisMaterial = dynamic_cast(mat); + + } else if (mat->group == Material::Group::ScreenEQL) { + auto const *thisMaterial = dynamic_cast(mat); assert(thisMaterial != nullptr); // insect screen + ++sLayer; + CFS(EQLNum).L(sLayer).Name = thisMaterial->Name; + // longwave property input + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLF = thisMaterial->TAR.IR.Ft.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.EPSLB = thisMaterial->TAR.IR.Bk.Emi; + CFS(EQLNum).L(sLayer).LWP_MAT.TAUL = thisMaterial->TAR.IR.Ft.Tra; + CFS(EQLNum).L(sLayer).LTYPE = LayerType::INSCRN; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBB = thisMaterial->TausFrontBeamBeam; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBB = thisMaterial->TausBackBeamBeam; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->ReflFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->ReflBackBeamDiff; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBB = thisMaterial->TAR.Sol.Ft.Bm[0].BmTra; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBB = thisMaterial->TAR.Sol.Bk.Bm[0].BmTra; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfRef; + CFS(EQLNum).L(sLayer).SWP_MAT.RHOSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfRef; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TausFrontBeamDiff; - CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TausBackBeamDiff; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBD = thisMaterial->TAR.Sol.Ft.Bm[0].DfTra; + CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBD = thisMaterial->TAR.Sol.Bk.Bm[0].DfTra; // wire geometry - CFS(EQLNum).L(sLayer).S = thisMaterial->ScreenWireSpacing; - CFS(EQLNum).L(sLayer).W = thisMaterial->ScreenWireDiameter; - } else if (mat->group == Material::Group::GapEquivalentLayer) { + CFS(EQLNum).L(sLayer).S = thisMaterial->wireSpacing; + CFS(EQLNum).L(sLayer).W = thisMaterial->wireDiameter; + + } else if (mat->group == Material::Group::WindowGapEQL) { auto const *matGas = dynamic_cast(mat); assert(matGas != nullptr); - // This layer is a gap. Fill in the parameters + // Gap or Gas Layer + ++gLayer; + CFS(EQLNum).G(gLayer).Name = matGas->Name; // previously the values of the levels are 1-3, now it's 0-2 CFS(EQLNum).G(gLayer).GTYPE = (int)matGas->gapVentType + 1; @@ -334,12 +352,12 @@ void SetEquivalentLayerWindowProperties(EnergyPlusData &state, int const ConstrN // fills gas density and effective gap thickness BuildGap(state, CFS(EQLNum).G(gLayer), CFS(EQLNum).G(gLayer).GTYPE, CFS(EQLNum).G(gLayer).TAS); } else { + ++sLayer; + CFS(EQLNum).L(sLayer).Name = mat->Name; CFS(EQLNum).L(sLayer).LTYPE = LayerType::NONE; } // beam beam transmittance is the same for front and back side CFS(EQLNum).L(sLayer).SWP_MAT.TAUSBBB = CFS(EQLNum).L(sLayer).SWP_MAT.TAUSFBB; - NumSLayers = sLayer; - NumGLayers = gLayer; CFS(EQLNum).NL = sLayer; // checks optical properties and fill in default values for diffuse optical @@ -381,9 +399,7 @@ void CalcEQLWindowUvalue(EnergyPlusData &state, // AUTHOR JOHN L. WRIGHT/Chip Barnaby // DATE WRITTEN Last Modified February 2008 // MODIFIED Bereket Nigusse, May 2013 - // Replaced inside convection calculation - // with ISO Std 15099 - // RE-ENGINEERED na + // Replaced inside convection calculation with ISO Std 15099 // PURPOSE OF THIS SUBROUTINE: // Calculates U-value of equivalent layer window at standard @@ -415,13 +431,12 @@ void CalcEQLWindowUvalue(EnergyPlusData &state, Real64 TGI; Real64 TGIK; Real64 TIK; - Real64 DT; // temperature difference, K - Real64 EO; // outside face effective emissivity, (-) - Real64 EI; // inside face effective emissivity, (-) - int I; // index - bool CFSURated; // false if U-Value calculation failed + Real64 DT; // temperature difference, K + Real64 EO; // outside face effective emissivity, (-) + Real64 EI; // inside face effective emissivity, (-) + int I; // index - CFSURated = false; + bool CFSURated = false; // false if U-Value calculation failed // Intial guess value for combined conductance HXO = 29.0; // 1/FenROut @@ -474,12 +489,9 @@ void CalcEQLWindowSHGCAndTransNormal(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse // DATE WRITTEN May 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Calculates SHGC and Normal Transmittance of equivalent layer - // fenestration. + // Calculates SHGC and Normal Transmittance of equivalent layer fenestration. // METHODOLOGY EMPLOYED: // Uses routine developed for ASHRAE RP-1311 (ASHWAT Model) @@ -514,12 +526,10 @@ void CalcEQLWindowSHGCAndTransNormal(EnergyPlusData &state, Real64 HProfA; int NL; int I; - bool CFSSHGC; // Object Data Array1D SWP_ON(CFSMAXNL); - CFSSHGC = true; NL = FS.NL; IncA = 0.0; VProfA = 0.0; @@ -546,27 +556,27 @@ void CalcEQLWindowSHGCAndTransNormal(EnergyPlusData &state, TransNormal = Abs1(1, NL + 1); // Calculate SHGC using net radiation method (ASHWAT Model) - CFSSHGC = ASHWAT_ThermalRatings(state, - FS, - TIN, - TOUT, - HCIN, - HCOUT, - TRMOUT, - TRMIN, - BeamSolarInc, - BeamSolarInc * Abs1(1, {1, NL + 1}), - TOL, - QOCF, - QOCFRoom, - T, - Q, - JF, - JB, - H, - UCG, - SHGC, - true); + bool CFSSHGC = ASHWAT_ThermalRatings(state, + FS, + TIN, + TOUT, + HCIN, + HCOUT, + TRMOUT, + TRMIN, + BeamSolarInc, + BeamSolarInc * Abs1(1, {1, NL + 1}), + TOL, + QOCF, + QOCFRoom, + T, + Q, + JF, + JB, + H, + UCG, + SHGC, + true); if (!CFSSHGC) { ShowWarningMessage(state, format("{}Solar heat gain coefficient calculation failed for {}", RoutineName, FS.Name)); @@ -589,17 +599,14 @@ void CalcEQLWindowOpticalProperty(EnergyPlusData &state, { // SUBROUTINE INFORMATION: // AUTHOR University of WaterLoo - // DATE WRITTEN unknown // MODIFIED Bereket Nigusse, May 2013 - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates absorptance for each layer, and transmittance of the // fenestration for beam and diffuse solar radiation // METHODOLOGY EMPLOYED: - // uses routine developed for ASHRAE RP-1311 (ASHWAT Model). Uses net radiation - // method. + // uses routine developed for ASHRAE RP-1311 (ASHWAT Model). Uses net radiation method. // Argument array dimensioning Abs1.dim(2, CFSMAXNL + 1); @@ -616,29 +623,24 @@ void CalcEQLWindowOpticalProperty(EnergyPlusData &state, // + = west-of-normal // convect coefficients, W/m2-K - int NL; - int I; - int iL; - bool DoShadeControlR; - // Object Data Array1D SWP_ON(CFSMAXNL); - NL = FS.NL; + int NL = FS.NL; Abs1 = 0.0; if (FS.ISControlled) { // at least 1 controlled layer found - for (iL = 1; iL <= NL; ++iL) { + for (int iL = 1; iL <= NL; ++iL) { // If there is shade control (Venetian Blind Only). if (IsControlledShade(state, FS.L(iL))) { - DoShadeControlR = DoShadeControl(state, FS.L(iL), IncA, VProfA, HProfA); + DoShadeControl(state, FS.L(iL), IncA, VProfA, HProfA); } } } if (DiffBeamFlag != SolarArrays::DIFF) { // Beam: Convert direct-normal solar properties to off-normal properties - for (I = 1; I <= NL; ++I) { + for (int I = 1; I <= NL; ++I) { ASHWAT_OffNormalProperties(state, FS.L(I), IncA, VProfA, HProfA, SWP_ON(I)); } ASHWAT_Solar(FS.NL, SWP_ON, state.dataWindowEquivLayer->SWP_ROOMBLK, 1.0, 0.0, 0.0, Abs1(1, {1, FS.NL + 1}), Abs1(2, {1, FS.NL + 1})); @@ -663,12 +665,9 @@ void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse // DATE WRITTEN May 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // performs surface heat balance and returns in the inside and outside surface - // temperatures + // performs surface heat balance and returns in the inside and outside surface temperatures // METHODOLOGY EMPLOYED: // uses the solar-thermal routine developed for ASHRAE RP-1311 (ASHWAT Model). @@ -695,10 +694,8 @@ void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, Array1D QAllSWwinAbs({1, CFSMAXNL + 1}); int EQLNum; // equivalent layer window index - int ZoneNum; // Zone number corresponding to SurfNum int ConstrNum; // Construction number - int SurfNumAdj; // An interzone surface's number in the adjacent zone Real64 LWAbsIn; // effective long wave absorptance/emissivity back side Real64 LWAbsOut; // effective long wave absorptance/emissivity front side Real64 outir(0); @@ -726,8 +723,7 @@ void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, HcIn = state.dataHeatBalSurf->SurfHConvInt(SurfNum); // windows inside surface convective film conductance if (CalcCondition == DataBSDFWindow::Condition::Invalid) { - ZoneNum = state.dataSurface->Surface(SurfNum).Zone; - SurfNumAdj = state.dataSurface->Surface(SurfNum).ExtBoundCond; + int SurfNumAdj = state.dataSurface->Surface(SurfNum).ExtBoundCond; Real64 RefAirTemp = state.dataSurface->Surface(SurfNum).getInsideAirTemperature(state, SurfNum); TaIn = RefAirTemp; TIN = TaIn + Constant::Kelvin; // Inside air temperature, K @@ -858,9 +854,6 @@ void OPENNESS_LW(Real64 const OPENNESS, // shade openness (=tausbb at normal inc // SUBROUTINE INFORMATION: // AUTHOR John L. Wright and Nathan Kotey, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Modifies long wave properties for shade types characterized by openness. @@ -888,17 +881,12 @@ Real64 P01(EnergyPlusData &state, ) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown // MODIFIED Bereket Nigusse, May 2013 // Added error messages - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Constrains property to range 0 - 1 - // Return value - Real64 P01; - static constexpr std::string_view RoutineName("P01: "); if (P < -0.05 || P > 1.05) { @@ -910,9 +898,7 @@ Real64 P01(EnergyPlusData &state, ShowContinueError(state, "property value is reset to 1.0"); } } - P01 = max(0.0, min(1.0, P)); - - return P01; + return max(0.0, min(1.0, P)); } Real64 @@ -923,9 +909,6 @@ HEMINT(EnergyPlusData &state, ) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Romberg Integration of Property function over hemispeherical dome @@ -942,26 +925,19 @@ HEMINT(EnergyPlusData &state, Array2D T(KMAX, KMAX); Real64 FX; - Real64 X1; - Real64 X2; Real64 X; Real64 DX; - Real64 SUM; Real64 DIFF; - int nPan; - int I; int K; - int L; - int iPX; - X1 = 0.0; // integration limits - X2 = Constant::PiOvr2; - nPan = 1; - SUM = 0.0; + Real64 X1 = 0.0; // integration limits + Real64 X2 = Constant::PiOvr2; + int nPan = 1; + Real64 SUM = 0.0; for (K = 1; K <= KMAX; ++K) { DX = (X2 - X1) / nPan; - iPX = NPANMAX / nPan; - for (I = 0; I <= nPan; ++I) { + int iPX = NPANMAX / nPan; + for (int I = 0; I <= nPan; ++I) { if (K == 1 || mod(I * iPX, iPX * 2) != 0) { // evaluate integrand function for new X values // 2 * sin( x) * cos( x) covers hemisphere with single integral @@ -976,7 +952,7 @@ HEMINT(EnergyPlusData &state, // trapezoid result - i.e., first column Romberg entry // Now complete the row if (K > 1) { - for (L = 2; L <= K; ++L) { + for (int L = 2; L <= K; ++L) { Real64 const pow_4_L_1(std::pow(4.0, L - 1)); T(K, L) = (pow_4_L_1 * T(K, L - 1) - T(K - 1, L - 1)) / (pow_4_L_1 - 1.0); } @@ -1006,9 +982,6 @@ void RB_DIFF(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright and Nathan Kotey, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates roller blind diffuse-diffuse solar optical properties by integrating @@ -1044,9 +1017,6 @@ Real64 RB_F(EnergyPlusData &state, ) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Roller blind integrand @@ -1083,9 +1053,6 @@ void RB_BEAM(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the roller blind off-normal properties using semi-empirical relations @@ -1146,9 +1113,6 @@ void IS_DIFF(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates insect screen diffuse-diffuse solar optical properties by integrating @@ -1187,16 +1151,10 @@ Real64 IS_F(EnergyPlusData &state, ) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Insect screen integrand - // Return value - Real64 IS_F; - // Argument array dimensioning EP_SIZE_CHECK(P, state.dataWindowEquivalentLayer->hipDIM); @@ -1214,13 +1172,12 @@ Real64 IS_F(EnergyPlusData &state, TAU_BD); if (OPT == state.dataWindowEquivalentLayer->hipRHO) { - IS_F = RHO_BD; + return RHO_BD; } else if (OPT == state.dataWindowEquivalentLayer->hipTAU) { - IS_F = TAU_BB + TAU_BD; + return TAU_BB + TAU_BD; } else { - IS_F = -1.0; + return -1.0; } - return IS_F; } void IS_BEAM(EnergyPlusData &state, @@ -1236,9 +1193,6 @@ void IS_BEAM(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates insect screen off-normal solar optical properties @@ -1293,9 +1247,6 @@ Real64 IS_OPENNESS(Real64 const D, // wire diameter ) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns openness from wire geometry. @@ -1310,9 +1261,6 @@ Real64 IS_OPENNESS(Real64 const D, // wire diameter Real64 IS_DSRATIO(Real64 const OPENNESS) // openness { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns ratio of diameter to spacing @@ -1335,9 +1283,6 @@ void FM_DIFF(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates drape fabric diffuse-diffuse solar optical properties by integrating @@ -1379,16 +1324,10 @@ Real64 FM_F(EnergyPlusData &state, ) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Drape fabric property integrand. - // Return value - Real64 FM_F; - // Argument array dimensioning EP_SIZE_CHECK(P, state.dataWindowEquivalentLayer->hipDIM); @@ -1406,13 +1345,12 @@ Real64 FM_F(EnergyPlusData &state, TAU_BD); if (Opt == state.dataWindowEquivalentLayer->hipRHO) { - FM_F = RHO_BD; + return RHO_BD; } else if (Opt == state.dataWindowEquivalentLayer->hipTAU) { - FM_F = TAU_BB + TAU_BD; + return TAU_BB + TAU_BD; } else { - FM_F = -1.0; + return -1.0; } - return FM_F; } void FM_BEAM(EnergyPlusData &state, @@ -1429,9 +1367,6 @@ void FM_BEAM(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the solar optical properties of a fabric for beam radiation incident @@ -1489,9 +1424,6 @@ void PD_LW(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the effective longwave emittance and transmittance of a drapery layer @@ -1536,9 +1468,6 @@ void PD_DIFF(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the effective diffuse transmittance and reflectance of a drapery layer. @@ -1709,9 +1638,6 @@ void PD_BEAM(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculates the effective front-side solar optical properties of a drapery layer. @@ -1960,9 +1886,6 @@ void PD_BEAM_CASE_I(Real64 const S, // pleat spacing (> 0 // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculates the effective front-side solar optical properties of a drapery layer. @@ -2386,9 +2309,6 @@ void PD_BEAM_CASE_II(Real64 const S, // pleat spacing (> // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculates the effective front-side solar optical properties of a drapery layer. @@ -2718,9 +2638,6 @@ void PD_BEAM_CASE_III(Real64 const S, // pleat spacing (> 0) // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculates the effective front-side solar optical properties of a drapery layer. @@ -3050,9 +2967,6 @@ void PD_BEAM_CASE_IV(Real64 const S, // pleat spacing (> // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculates the effective front-side solar optical properties of a drapery layer. @@ -3233,9 +3147,6 @@ void PD_BEAM_CASE_V(Real64 const S, // pleat spacing (> 0) // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculates the effective front-side solar optical properties of a drapery layer. @@ -3461,9 +3372,6 @@ void PD_BEAM_CASE_VI(Real64 const S, // pleat spacing (> // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculates the effective front-side solar optical properties of a drapery layer. @@ -3618,9 +3526,6 @@ void VB_DIFF(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the venetian blind layer effective diffuse transmittance and reflectance. @@ -3628,7 +3533,6 @@ void VB_DIFF(EnergyPlusData &state, // four surface flat-slat model with slat transmittance // SUBROUTINE ARGUMENT DEFINITIONS: - // must be > 0 // must be > 0 // ltyVBHOR: + = front-side slat tip below horizontal // ltyVBVER: + = front-side slat tip is counter- @@ -3683,29 +3587,20 @@ Real64 VB_SLAT_RADIUS_RATIO(Real64 const W, // slat tip-to-tip (chord) width (an ) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns curved slat radius ratio (W / R) - // Return value - Real64 VB_SLAT_RADIUS_RATIO; - - Real64 CX; - if (C <= 0.0 || W <= 0.0) { // it is flat - VB_SLAT_RADIUS_RATIO = 0.0; + return 0.0; } else { - CX = min(C, W / 2.001); - VB_SLAT_RADIUS_RATIO = 2.0 * W * CX / (CX * CX + W * W / 4); + Real64 CX = min(C, W / 2.001); + return 2.0 * W * CX / (CX * CX + W * W / 4); } - return VB_SLAT_RADIUS_RATIO; } -void VB_SOL46_CURVE(EnergyPlusData &state, +void VB_SOL46_CURVE(EnergyPlusData const &state, Real64 const S, // slat spacing (any length units; same units as W) Real64 const W, // slat tip-to-tip (chord) width (any length units; same units as S) Real64 const SL_WR, // slat curvature radius ratio (= W/R) @@ -3722,9 +3617,6 @@ void VB_SOL46_CURVE(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the venetian blind layer effective solar transmittance and reflectance. @@ -3950,7 +3842,7 @@ void VB_SOL46_CURVE(EnergyPlusData &state, } } -void VB_SOL4(EnergyPlusData &state, +void VB_SOL4(EnergyPlusData const &state, Real64 const S, // slat spacing (any length units; same units as W) Real64 const W, // slat tip-to-tip width (any length units; same units as S) Real64 const OMEGA, // incident beam profile angle (radians) @@ -3966,9 +3858,6 @@ void VB_SOL4(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the venetian blind layer effective solar transmittance and reflectance. @@ -4053,7 +3942,7 @@ void VB_SOL4(EnergyPlusData &state, } // END OF CHECK FOR CLOSED BLIND } -void VB_SOL6(EnergyPlusData &state, +void VB_SOL6(EnergyPlusData const &state, Real64 const S, // slat spacing (any length units; same units as W) Real64 const W, // slat tip-to-tip width (any length units; same units as S) Real64 const OMEGA, // incident beam profile angle (radians) @@ -4069,9 +3958,6 @@ void VB_SOL6(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the venetian blind layer effective solar transmittance and reflectance. @@ -4227,9 +4113,6 @@ void SOLMATS(int const N, // # of active rows in A // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Matrix solver. @@ -4237,43 +4120,27 @@ void SOLMATS(int const N, // # of active rows in A // Solves matrix by the elimination method supplemented by a search for the // largest pivotal element at each stage - Real64 CMAX; - Real64 TEMP; - Real64 C; - Real64 Y; - Real64 D; - int NM1; - int NP1; - int NP2; - int I; - int J; - int L; - int LP; - int NOS; - int NI; - int NJ; + int NM1 = N - 1; + int NP1 = N + 1; + int NP2 = N + 2; - NM1 = N - 1; - NP1 = N + 1; - NP2 = N + 2; - - for (I = 1; I <= N; ++I) { + for (int I = 1; I <= N; ++I) { A(NP2, I) = 0.0; // DO 1 J=1,NP1 ! TODO ? } - for (I = 1; I <= N; ++I) { - for (J = 1; J <= NP1; ++J) { + for (int I = 1; I <= N; ++I) { + for (int J = 1; J <= NP1; ++J) { A(NP2, I) += A(J, I); } } - for (L = 1; L <= N - 1; ++L) { - CMAX = A(L, L); - LP = L + 1; - NOS = L; + for (int L = 1; L <= N - 1; ++L) { + Real64 CMAX = A(L, L); + int LP = L + 1; + int NOS = L; - for (I = LP; I <= N; ++I) { + for (int I = LP; I <= N; ++I) { if (std::abs(CMAX) < std::abs(A(L, I))) { CMAX = A(L, I); NOS = I; @@ -4282,20 +4149,20 @@ void SOLMATS(int const N, // # of active rows in A // Swap rows if (NOS != L) { - for (J = 1; J <= NP2; ++J) { - TEMP = A(J, L); + for (int J = 1; J <= NP2; ++J) { + Real64 TEMP = A(J, L); A(J, L) = A(J, NOS); A(J, NOS) = TEMP; } } - for (I = LP; I <= N; ++I) { - C = 0.0; - Y = -A(L, I) / A(L, L); - for (J = L; J <= NP2; ++J) { + for (int I = LP; I <= N; ++I) { + Real64 C = 0.0; + Real64 Y = -A(L, I) / A(L, L); + for (int J = L; J <= NP2; ++J) { A(J, I) += Y * A(J, L); } - for (J = L; J <= NP1; ++J) { + for (int J = L; J <= NP1; ++J) { C += A(J, I); } } @@ -4303,11 +4170,11 @@ void SOLMATS(int const N, // # of active rows in A // back-substitute XSOL(N) = A(NP1, N) / A(N, N); - for (I = 1; I <= NM1; ++I) { - NI = N - I; - D = 0.0; - for (J = 1; J <= I; ++J) { - NJ = N + 1 - J; + for (int I = 1; I <= NM1; ++I) { + int NI = N - I; + Real64 D = 0.0; + for (int J = 1; J <= I; ++J) { + int NJ = N + 1 - J; D += A(NJ, NI) * XSOL(NJ); } XSOL(NI) = (A(NP1, NI) - D) / A(NI, NI); @@ -4340,7 +4207,6 @@ void ASHWAT_ThermalCalc(EnergyPlusData &state, // MODIFIED Bereket Nigusse, June 2013 // added standard 155099 inside convection // coefficient calculation for U-Factor - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Subroutine to calculate the glazing temperatures of the @@ -4406,9 +4272,7 @@ void ASHWAT_ThermalCalc(EnergyPlusData &state, int NL; int I; int J; - int L; int ITRY; - int hin_scheme; // flags different schemes for indoor convection coefficients Array1D_int ISDL({0, FS.NL + 1}); // Flag to mark diathermanous layers, 0=opaque Array1D QOCF_F(FS.NL); // heat flux to outdoor-facing surface of layer i, from gap i-1, // due to open channel flow, W/m2 @@ -4530,19 +4394,6 @@ void ASHWAT_ThermalCalc(EnergyPlusData &state, // CALCULATE GAS LAYER CONVECTIVE HEAT TRANSFER COEFFICIENTS - hin_scheme = 3; // different schemes for calculating convection - // coefficients glass-to-air and shade-to-air - // if open channel air flow is allowed - // see the corresponding subroutines for detail - // = 1 gives dependence of height, spacing, delta-T - // = 2 gives dependence of spacing, delta-T but - // returns unrealistic values for large spacing - // = 3 glass-shade spacing dependence only on HCIN - // = negative, applies HCIN without adjusting for - // temperature, height, spacing, slat angle - // Recommended -> hin_scheme=3 for use with HBX, - // simplicity, right trends wrt spacing - // start by assuming no open channel flow on indoor side HC[NL] = HCIN; // default - HC[NL] supplied by calling routine @@ -4558,6 +4409,20 @@ void ASHWAT_ThermalCalc(EnergyPlusData &state, // Check for open channels - only possible with at least two layers if (NL >= 2) { + + int hin_scheme = 3; // different schemes for calculating convection + // coefficients glass-to-air and shade-to-air + // if open channel air flow is allowed + // see the corresponding subroutines for detail + // = 1 gives dependence of height, spacing, delta-T + // = 2 gives dependence of spacing, delta-T but + // returns unrealistic values for large spacing + // = 3 glass-shade spacing dependence only on HCIN + // = negative, applies HCIN without adjusting for + // temperature, height, spacing, slat angle + // Recommended -> hin_scheme=3 for use with HBX, + // simplicity, right trends wrt spacing + for (I = 1; I <= NL - 1; ++I) { // Scan gaps between layers // DEAL WITH INDOOR OPEN CHANNEL FLOW HERE @@ -4628,7 +4493,7 @@ void ASHWAT_ThermalCalc(EnergyPlusData &state, XSOL = 0.0; A = 0.0; - L = 1; + int L = 1; A(1, L) = 1.0; A(2, L) = -1.0 * RHOB(0); // -1.0 * RHOB_OUT A(ADIM + 1, L) = EPSB_OUT * Constant::StefanBoltzmann * TRMOUT_4; @@ -4792,7 +4657,6 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, // MODIFIED Bereket Nigusse, June 2013 // added standard 155099 inside convection // coefficient calculation for U-Factor - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Subroutine to calculate the glazing temperatures of the @@ -4860,9 +4724,7 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, int NL; int I; int J; - int L; int ITRY; - int hin_scheme; // flags different schemes for indoor convection coefficients Array1D_int ISDL({0, FS.NL + 1}); // Flag to mark diathermanous layers, 0=opaque int NDLIAR; // Number of Diathermanous Layers In A Row (i.e., consecutive) int IB; // Counter begin and end limits @@ -5007,19 +4869,6 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, // CALCULATE GAS LAYER CONVECTIVE HEAT TRANSFER COEFFICIENTS - hin_scheme = 3; // different schemes for calculating convection - // coefficients glass-to-air and shade-to-air - // if open channel air flow is allowed - // see the corresponding subroutines for detail - // = 1 gives dependence of height, spacing, delta-T - // = 2 gives dependence of spacing, delta-T but - // returns unrealistic values for large spacing - // = 3 glass-shade spacing dependence only on HCIN - // = negative, applies HCIN without adjusting for - // temperature, height, spacing, slat angle - // Recommended -> hin_scheme=3 for use with HBX, - // simplicity, right trends wrt spacing - // start by assuming no open channel flow on indoor side HC[NL] = HCIN; // default - HC[NL] supplied by calling routine @@ -5033,6 +4882,20 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, // Check for open channels - only possible with at least two layers if (NL >= 2) { + + int hin_scheme = 3; // different schemes for calculating convection + // coefficients glass-to-air and shade-to-air + // if open channel air flow is allowed + // see the corresponding subroutines for detail + // = 1 gives dependence of height, spacing, delta-T + // = 2 gives dependence of spacing, delta-T but + // returns unrealistic values for large spacing + // = 3 glass-shade spacing dependence only on HCIN + // = negative, applies HCIN without adjusting for + // temperature, height, spacing, slat angle + // Recommended -> hin_scheme=3 for use with HBX, + // simplicity, right trends wrt spacing + for (I = 1; I <= NL - 1; ++I) { // Scan gaps between layers // DEAL WITH INDOOR OPEN CHANNEL FLOW HERE @@ -5103,7 +4966,7 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, XSOL = 0.0; A = 0.0; - L = 1; + int L = 1; A(1, L) = 1.0; A(2, L) = -1.0 * RHOB(0); // -1.0 * RHOB_OUT A(ADIM + 1, L) = EPSB_OUT * Constant::StefanBoltzmann * TRMOUT_4; @@ -5354,13 +5217,11 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, } // end of IF/ELSE (I .EQ. 0) } // end of IF(ISDL(I) .EQ. 0) .AND. ..... } // end of scan through all layers - } - // calculate convective OCF/jump heat transfer coefficients - - if (NL >= 2) { // no OCF unless at least two layers exist - // It is not possible for both of the following cases to be - // true for the same gap (i.e., for NL=2) + // calculate convective OCF/jump heat transfer coefficients + // no OCF unless at least two layers exist + // It is not possible for both of the following cases to be + // true for the same gap (i.e., for NL=2) if (FS.G(NL - 1).GTYPE == state.dataWindowEquivalentLayer->gtyOPENin) { SaveHCNLm = HC[NL - 1]; @@ -5713,9 +5574,6 @@ void DL_RES_r2(Real64 const Tg, // mean glass layer temperature, {K} // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Returns the radiant heat transfer coefficients between parallel surfaces: @@ -5816,9 +5674,6 @@ void SETUP4x4_A(Real64 const rhog, Real64 const rhodf, Real64 const rhodb, Real6 // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Returns the 4 X 4 matrix for DL_RES_r2 routine: @@ -5857,9 +5712,7 @@ Real64 FRA(Real64 const TM, // mean gas temp, K ) { // AUTHOR (John Wright, University of WaterLoo, ASHRAE 1311-RP) - // DATE WRITTEN unknown // MODIFIED Bereket Nigusse, FSEC/UCF, May 2013 - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns Rayleigh number given surface temperatures, and coefficients of @@ -5871,33 +5724,21 @@ Real64 FRA(Real64 const TM, // mean gas temp, K // REFERENCES: // ASHRAE 1311-RP - // Return value - Real64 FRA; - // FUNCTION ARGUMENT DEFINITIONS: // (as adjusted e.g. re VB models) - Real64 Z; - Real64 K; - Real64 CP; - Real64 VISC; - - Z = 1.0; - K = AK + BK * TM + CK * TM * TM; - CP = ACP + BCP * TM + BCP * TM * TM; - VISC = AVISC + BVISC * TM + BVISC * TM * TM; + Real64 Z = 1.0; + Real64 K = AK + BK * TM + CK * TM * TM; + Real64 CP = ACP + BCP * TM + BCP * TM * TM; + Real64 VISC = AVISC + BVISC * TM + BVISC * TM * TM; - FRA = (Constant::GravityConstant * RHOGAS * RHOGAS * DT * T * T * T * CP) / (VISC * K * TM * Z * Z); - - return FRA; + return (Constant::GravityConstant * RHOGAS * RHOGAS * DT * T * T * T * CP) / (VISC * K * TM * Z * Z); } Real64 FNU(Real64 const RA) // Rayleigh number { // AUTHOR (John Wright, University of WaterLoo, ASHRAE 1311-RP) - // DATE WRITTEN // MODIFIED Bereket Nigusse, FSEC/UCF, May 2013 - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns Nusselt number given Rayleigh number @@ -5908,18 +5749,14 @@ Real64 FNU(Real64 const RA) // Rayleigh number // REFERENCES: // ASHRAE 1311-RP - // Return value - Real64 FNU; - Real64 const ARA(std::abs(RA)); if (ARA <= 10000.0) { - FNU = 1.0 + 1.75967e-10 * std::pow(ARA, 2.2984755); + return 1.0 + 1.75967e-10 * std::pow(ARA, 2.2984755); } else if (ARA <= 50000.0) { - FNU = 0.028154 * std::pow(ARA, 0.413993); + return 0.028154 * std::pow(ARA, 0.413993); } else { - FNU = 0.0673838 * std::pow(ARA, 1.0 / 3.0); + return 0.0673838 * std::pow(ARA, 1.0 / 3.0); } - return FNU; } Real64 HConvGap(CFSGAP const &G, // gap @@ -5927,9 +5764,7 @@ Real64 HConvGap(CFSGAP const &G, // gap Real64 const T2) { // AUTHOR (University of WaterLoo, ASHRAE 1311-RP) - // DATE WRITTEN unknown // MODIFIED Bereket Nigusse, FSEC/UCF, May 2013 - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns convective coefficient for a gap separated between two surfaces at // temperatures T1 and T2 , W/m2-K @@ -5938,9 +5773,6 @@ Real64 HConvGap(CFSGAP const &G, // gap // REFERENCES: // ASHRAE 1311-RP - // Return value - Real64 HConvGap; - Real64 TM; // Mean temperature, K Real64 DT; // temperature difference, (K) Real64 RA; // Rayleigh Number, (-) @@ -5955,8 +5787,7 @@ Real64 HConvGap(CFSGAP const &G, // gap NU = FNU(RA); KGAS = G.FG.AK + G.FG.BK * TM + G.FG.CK * TM * TM; - HConvGap = NU * KGAS / T; - return HConvGap; + return NU * KGAS / T; } Real64 HRadPar(Real64 const T1, // bounding surface temps [K] @@ -5965,9 +5796,6 @@ Real64 HRadPar(Real64 const T1, // bounding surface temps [K] Real64 const E2) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns radiative coefficient between two surfaces, hr, W/m2-K // METHODOLOGY EMPLOYED: @@ -5998,9 +5826,6 @@ Real64 HIC_ASHRAE(Real64 const L, // glazing height, m ) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns inside surface convective coefficient, W/m2-K @@ -6014,7 +5839,7 @@ Real64 HIC_ASHRAE(Real64 const L, // glazing height, m return HIC_ASHRAE; } -void SLtoGL(EnergyPlusData &state, +void SLtoGL(EnergyPlusData const &state, Real64 const breal, // distance from shade to glass (m) Real64 const Ts, // shade temperature (K) Real64 const Tg, // glass temperature (K) @@ -6024,9 +5849,6 @@ void SLtoGL(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Returns the heat transfer coefficient, shade-to-glass @@ -6077,7 +5899,7 @@ void SLtoGL(EnergyPlusData &state, } // end of scheme .eq. 2 } -Real64 SLtoAMB(EnergyPlusData &state, +Real64 SLtoAMB(EnergyPlusData const &state, Real64 const b, // distance from shade to glass (m) where air flow takes place Real64 const L, // window height, m (usually taken as 1 m) Real64 const Ts, // shade temperature, K @@ -6087,9 +5909,6 @@ Real64 SLtoAMB(EnergyPlusData &state, ) { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns shade to room air heat transfer coefficient // METHODOLOGY EMPLOYED: @@ -6191,7 +6010,7 @@ Real64 SLtoAMB(EnergyPlusData &state, return SLtoAMB; } -void GLtoAMB(EnergyPlusData &state, +void GLtoAMB(EnergyPlusData const &state, Real64 const b, // distance from shade to glass {m} Real64 const L, // window height {m}, usually taken as 1 meter Real64 const Tg, // glass temperature {K} @@ -6203,9 +6022,6 @@ void GLtoAMB(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR John L. Wright, University of Waterloo, // Mechanical Engineering, Advanced Glazing System Laboratory - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Returns the glass to room air heat transfer coefficient @@ -6297,25 +6113,16 @@ void GLtoAMB(EnergyPlusData &state, Real64 ConvectionFactor(CFSLAYER const &L) // window layer { // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Modifies convection rate per shade configuration, layer convection enhancement - // Return value - Real64 ConvectionFactor; - - Real64 SlatADeg; - if (L.LTYPE == LayerType::VBHOR) { // horiz VB: enhanced convection at +/- 45 due to "pumping" - SlatADeg = min(90.0, std::abs(L.PHI_DEG)); - ConvectionFactor = 1.0 + 0.2 * std::sin(2.0 * SlatADeg); + Real64 SlatADeg = min(90.0, std::abs(L.PHI_DEG)); + return 1.0 + 0.2 * std::sin(2.0 * SlatADeg); } else { - ConvectionFactor = 1.0; + return 1.0; } - return ConvectionFactor; } bool CFSUFactor(EnergyPlusData &state, @@ -6329,9 +6136,7 @@ bool CFSUFactor(EnergyPlusData &state, { // FUNCTION INFORMATION: // AUTHOR unknown (University of WaterLoo, ASHRAE 1311-RP) - // DATE WRITTEN unknown // MODIFIED Bereket Nigusse, FSEC/UCF, June 2013 - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // ! returns .TRUE. if the U-value calculation succeeded, .FALSE. if error @@ -6722,8 +6527,6 @@ void ASHWAT_OffNormalProperties(EnergyPlusData &state, // = wall-solar azimuth angle for a vertical wall // Used for PD and vertical VB - bool OKAY; - LSWP_ON = L.SWP_EL; // init to normal properties // calls below modify in place @@ -6732,15 +6535,15 @@ void ASHWAT_OffNormalProperties(EnergyPlusData &state, // HBX note: ltyGZS here iff modelOption F=x; spectral cases elsewhere Specular_SWP(LSWP_ON, THETA); } else if (L.LTYPE == LayerType::VBHOR) { - OKAY = VB_SWP(state, L, LSWP_ON, OMEGA_V); + VB_SWP(state, L, LSWP_ON, OMEGA_V); } else if (L.LTYPE == LayerType::VBVER) { - OKAY = VB_SWP(state, L, LSWP_ON, OMEGA_H); + VB_SWP(state, L, LSWP_ON, OMEGA_H); } else if (L.LTYPE == LayerType::DRAPE) { - OKAY = PD_SWP(state, L, LSWP_ON, OMEGA_V, OMEGA_H); + PD_SWP(state, L, LSWP_ON, OMEGA_V, OMEGA_H); } else if (L.LTYPE == LayerType::ROLLB) { - OKAY = RB_SWP(state, L, LSWP_ON, THETA); + RB_SWP(state, L, LSWP_ON, THETA); } else if (L.LTYPE == LayerType::INSCRN) { - OKAY = IS_SWP(state, L, LSWP_ON, THETA); + IS_SWP(state, L, LSWP_ON, THETA); } else if (L.LTYPE == LayerType::NONE || L.LTYPE == LayerType::ROOM) { // none or room: do nothing } else { @@ -6893,7 +6696,7 @@ void Specular_RATDiff(EnergyPlusData &state, Real64 &RAT_1MRDiff, Real64 &RAT_TA RAT_1MRDiff = state.dataWindowEquivalentLayer->X1MRDiff; } -Real64 Specular_F(EnergyPlusData &state, +Real64 Specular_F(EnergyPlusData const &state, Real64 const THETA, // incidence angle, radians int const OPT, // options (unused) [[maybe_unused]] const Array1D &P // parameters (none defined) @@ -7369,7 +7172,7 @@ bool VB_LWP(EnergyPlusData &state, return VB_LWP; } -bool VB_SWP(EnergyPlusData &state, +bool VB_SWP(EnergyPlusData const &state, CFSLAYER const &L, // VB layer CFSSWP &LSWP, // returned: equivalent off-normal properties const Real64 OMEGA // incident profile angle (radians) @@ -7454,7 +7257,7 @@ bool VB_SWP(EnergyPlusData &state, return true; } -bool VB_ShadeControl(EnergyPlusData &state, +bool VB_ShadeControl(EnergyPlusData const &state, CFSLAYER &L, // VB layer Real64 const OMEGA_DEG // incident profile angle (degrees) ) @@ -7582,9 +7385,6 @@ void FinalizeCFSLAYER(EnergyPlusData &state, CFSLAYER &L) // layer, input: LTYPE // SUBROUTINE INFORMATION: // AUTHOR JOHN L. WRIGHT, University of Waterloo, Mechanical Engineering // Advanced Glazing System Laboratory - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Sets equivalent layer properties of a construction. @@ -7597,10 +7397,6 @@ void FinalizeCFSLAYER(EnergyPlusData &state, CFSLAYER &L) // layer, input: LTYPE bool BOK; bool CFSLAYERFlag; - LOK = false; - DOK = false; - BOK = false; - if (IsVBLayer(L)) { LOK = VB_LWP(state, L, L.LWP_EL); DOK = VB_SWP(state, L, L.SWP_EL); // SW diffuse @@ -7649,9 +7445,6 @@ bool IsGZSLayer(CFSLAYER const &L) // FUNCTION INFORMATION: // AUTHOR JOHN L. WRIGHT, University of Waterloo, Mechanical Engineering // Advanced Glazing System Laboratory - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns .TRUE. if Layer has glazing data from external file or returns .FALSE. @@ -7668,9 +7461,6 @@ bool IsGlazeLayerX(CFSLAYER const &L) // FUNCTION INFORMATION: // AUTHOR JOHN L. WRIGHT, University of Waterloo, Mechanical Engineering // Advanced Glazing System Laboratory - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns .TRUE. if Layer has glazing (including GZS) or returns .FALSE. @@ -7682,23 +7472,16 @@ bool IsGlazeLayerX(CFSLAYER const &L) return IsGlazeLayerX; } -bool IsControlledShade(EnergyPlusData &state, CFSLAYER const &L) +bool IsControlledShade(EnergyPlusData const &state, CFSLAYER const &L) { // FUNCTION INFORMATION: // AUTHOR JOHN L. WRIGHT, University of Waterloo, Mechanical Engineering // Advanced Glazing System Laboratory - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns .TRUE. if Layer is Venetian blind and is controlled or returns .FALSE. - // Return value - bool IsControlledShade; - - IsControlledShade = IsVBLayer(L) && L.CNTRL != state.dataWindowEquivalentLayer->lscNONE; - return IsControlledShade; + return IsVBLayer(L) && L.CNTRL != state.dataWindowEquivalentLayer->lscNONE; } bool IsVBLayer(CFSLAYER const &L) @@ -7706,18 +7489,11 @@ bool IsVBLayer(CFSLAYER const &L) // FUNCTION INFORMATION: // AUTHOR JOHN L. WRIGHT, University of Waterloo, Mechanical Engineering // Advanced Glazing System Laboratory - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns .TRUE. if Layer is Venetian blind, or returns .FALSE. - // Return value - bool IsVBLayer; - - IsVBLayer = L.LTYPE == LayerType::VBHOR || L.LTYPE == LayerType::VBVER; - return IsVBLayer; + return L.LTYPE == LayerType::VBHOR || L.LTYPE == LayerType::VBVER; } void BuildGap(EnergyPlusData &state, @@ -7729,9 +7505,7 @@ void BuildGap(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown // MODIFIED Bereket Nigusse, June 2013, Jason W. DeGraw 2023 - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // fills in the effective gap thickness and calculates the gas density @@ -7765,13 +7539,9 @@ void AdjustVBGap(CFSGAP &G, // gap, returned updated { // SUBROUTINE INFORMATION: // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Adjusts thickness of adjacent gaps seperated by - // in between slatted blind. + // Adjusts thickness of adjacent gaps seperated by in between slatted blind. // METHODOLOGY EMPLOYED: // Treat VB layer as if it has 70% of actual thickness @@ -7796,39 +7566,23 @@ float DensityCFSFillGas(CFSFILLGAS const &FG, // gas properties { // FUNCTION INFORMATION: // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns gas density at P and T, kg/m3 // METHODOLOGY EMPLOYED: // Uses ideal gas relations - // Return value - float DensityCFSFillGas; - - DensityCFSFillGas = (P * FG.MHAT) / (Constant::UniversalGasConst * max(T, 1.0)); - - return DensityCFSFillGas; + return (P * FG.MHAT) / (Constant::UniversalGasConst * max(T, 1.0)); } int CFSNGlz(CFSTY const &FS) // CFS { // FUNCTION INFORMATION: // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns the number of glazing layers - // Return value - int CFSNGlz; - - int iL; - - CFSNGlz = 0; - for (iL = 1; iL <= FS.NL; ++iL) { + int CFSNGlz = 0; + for (int iL = 1; iL <= FS.NL; ++iL) { if (IsGlazeLayerX(FS.L(iL))) { ++CFSNGlz; } @@ -7836,24 +7590,16 @@ int CFSNGlz(CFSTY const &FS) // CFS return CFSNGlz; } -int CFSHasControlledShade(EnergyPlusData &state, CFSTY const &FS) +int CFSHasControlledShade(EnergyPlusData const &state, CFSTY const &FS) { // FUNCTION INFORMATION: // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns index of the controlled layer in a fenestratio. If no // controlled layer, then returns zero. - // Return value - int CFSHasControlledShade; - - int iL; - - CFSHasControlledShade = 0; - for (iL = 1; iL <= FS.NL; ++iL) { + int CFSHasControlledShade = 0; + for (int iL = 1; iL <= FS.NL; ++iL) { if (IsControlledShade(state, FS.L(iL))) { CFSHasControlledShade = iL; break; @@ -7866,9 +7612,6 @@ void CheckAndFixCFSLayer(EnergyPlusData &state, CFSLAYER &Layer) { // SUBROUTINE INFORMATION: // AUTHOR ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Verify CFS layer validity, sets bad items to valid defaults if possible @@ -7883,17 +7626,13 @@ void FillDefaultsSWP(EnergyPlusData &state, { // SUBROUTINE INFORMATION: // AUTHOR The University of WaterLoo - // DATE WRITTEN unknown // MODIFIED Bereket Nigusse/FSEC, June 2013 - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Fills in defaulted short wave optical properties for equivalent window - // layers + // Fills in defaulted short wave optical properties for equivalent window layers // may be within L static constexpr std::string_view RoutineName("FillDefaultsSWP: "); - bool OK; // default back taus to front (often equal) if (SWP.TAUSBBB < 0.0) SWP.TAUSBBB = SWP.TAUSFBB; @@ -7914,7 +7653,7 @@ void FillDefaultsSWP(EnergyPlusData &state, } else if (L.LTYPE == LayerType::ROLLB) { // estimate diffuse properties if any < 0 if (min(SWP.RHOSBDD, SWP.RHOSFDD, SWP.TAUS_DD) < 0.0) { - OK = RB_SWP(state, L, SWP); // TODO RB + RB_SWP(state, L, SWP); // TODO RB } } else if (L.LTYPE == LayerType::INSCRN) { if (SWP.TAUSFBB < 0.0) { @@ -7922,7 +7661,7 @@ void FillDefaultsSWP(EnergyPlusData &state, if (SWP.TAUSBBB < 0.0) SWP.TAUSBBB = SWP.TAUSFBB; } if (min(SWP.RHOSBDD, SWP.RHOSFDD, SWP.TAUS_DD) < 0.0) { - OK = IS_SWP(state, L, SWP); // TODO IS + IS_SWP(state, L, SWP); // TODO IS } } else if (L.LTYPE == LayerType::NONE || L.LTYPE == LayerType::ROOM) { // none or room: do nothing @@ -7936,28 +7675,19 @@ void FinalizeCFS(EnergyPlusData &state, CFSTY &FS) { // SUBROUTINE INFORMATION: // AUTHOR The University of WaterLoo - // DATE WRITTEN unknown // MODIFIED Bereket Nigusse/FSEC, May 2013 - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Complete CFS after BuildCFS by checking the shade type and - // gap type + // Complete CFS after BuildCFS by checking the shade type and gap type static constexpr std::string_view RoutineName("FinalizeCFS: "); // include trailing blank space - int iL; - int gType; - bool LVBPREV; - std::string CurrentModuleObject; - bool ErrorsFound; - - CurrentModuleObject = "WindowConstruction:EquivalentLayer"; - ErrorsFound = false; + std::string CurrentModuleObject = "WindowConstruction:EquivalentLayer"; + bool ErrorsFound = false; - LVBPREV = false; // .TRUE. if previous layer is VB + bool LVBPREV = false; // .TRUE. if previous layer is VB - for (iL = 1; iL <= FS.NL; ++iL) { + for (int iL = 1; iL <= FS.NL; ++iL) { if (!IsVBLayer(FS.L(iL))) { LVBPREV = false; } else if (LVBPREV) { @@ -7970,7 +7700,7 @@ void FinalizeCFS(EnergyPlusData &state, CFSTY &FS) if (iL < FS.NL) AdjustVBGap(FS.G(iL), FS.L(iL)); } if (iL < FS.NL) { - gType = FS.G(iL).GTYPE; + int gType = FS.G(iL).GTYPE; if (gType == state.dataWindowEquivalentLayer->gtyOPENout && iL != 1) { ShowSevereError(state, format("{}=\"{}", CurrentModuleObject, FS.Name)); ShowContinueError(state, format("...invalid EquivalentLayer window gap type specified ={}.", FS.G(iL).Name)); @@ -7992,15 +7722,8 @@ Real64 EffectiveEPSLF(CFSTY const &FS) // Complex Fenestration { // FUNCTION INFORMATION: // AUTHOR , ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // Returns effective outside Longwave emissivity. Handles partially - // transparent layers - - // Return value - Real64 EffectiveEPSLF; + // Returns effective outside Longwave emissivity. Handles partially transparent layers Real64 E; // Effective emissivity Real64 TX; // correction factor @@ -8017,31 +7740,19 @@ Real64 EffectiveEPSLF(CFSTY const &FS) // Complex Fenestration TX *= FS.L(iL).LWP_EL.TAUL; } } - EffectiveEPSLF = E; - return EffectiveEPSLF; + return E; } Real64 EffectiveEPSLB(CFSTY const &FS) // Complex Fenestration { // FUNCTION INFORMATION: // AUTHOR , ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // Returns effective inside (room side) Longwave emissivity. Handles partially - // transparent layers + // Returns effective inside (room side) Longwave emissivity. Handles partially transparent layers - // Return value - Real64 EffectiveEPSLB; - - Real64 E; // Effective emissivity - Real64 TX; // correction factor - int iL; // layers index - - E = 0.0; - TX = 1.0; - for (iL = FS.NL; iL >= 0; --iL) { + Real64 E = 0.0; // Effective emissivity + Real64 TX = 1.0; // correction factor + for (int iL = FS.NL; iL >= 0; --iL) { if (iL == 0) { E += 0.9 * TX; } else { @@ -8050,8 +7761,7 @@ Real64 EffectiveEPSLB(CFSTY const &FS) // Complex Fenestration TX *= FS.L(iL).LWP_EL.TAUL; } } - EffectiveEPSLB = E; - return EffectiveEPSLB; + return E; } bool FEQX(Real64 const a, // values to compare, fractional tolerance @@ -8062,28 +7772,18 @@ bool FEQX(Real64 const a, // values to compare, fractional tolerance { // FUNCTION INFORMATION: // AUTHOR , ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns true if the difference between two real numbers is within the // tolerance limit specified. - // Return value - bool FEQX; - - Real64 d; - Real64 tolAbsX; - - tolAbsX = max(tolAbs, 1.e-10); + Real64 tolAbsX = max(tolAbs, 1.e-10); - d = std::abs(a - b); + Real64 d = std::abs(a - b); if (d < tolAbsX) { - FEQX = true; + return true; } else { - FEQX = (2.0 * d / (std::abs(a) + std::abs(b))) < tolF; + return (2.0 * d / (std::abs(a) + std::abs(b))) < tolF; } - return FEQX; } Real64 TRadC(Real64 const J, // radiosity, W/m2 @@ -8092,9 +7792,6 @@ Real64 TRadC(Real64 const J, // radiosity, W/m2 { // FUNCTION INFORMATION: // AUTHOR , ASHRAE 1311-RP - // DATE WRITTEN unknown - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Returns equivalent celsius scale temperature from radiosity @@ -8111,8 +7808,6 @@ void CalcEQLOpticalProperty(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse // DATE WRITTEN May 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the system optical properties from the individual layers @@ -8123,36 +7818,30 @@ void CalcEQLOpticalProperty(EnergyPlusData &state, // Uses the net radiation method developed for ASHWAT fenestration // model (ASHRAE RP-1311) by John Wright, the University of WaterLoo - using Dayltg::ProfileAngle; - // Argument array dimensioning CFSAbs.dim(2, CFSMAXNL + 1); - Real64 ProfAngVer; // Solar vertical profile angle (radians) for horizontal blind - Real64 ProfAngHor; // Solar horizontal profile angle (radians) for vertical blind - Real64 IncAng; // incident angle degree Array2D Abs1(2, CFSMAXNL + 1); - int Lay; // window layer index - int EQLNum; // equivalent layer window construction index - int ConstrNum; // construction index + + auto &surf = state.dataSurface->Surface(SurfNum); auto &CFS = state.dataWindowEquivLayer->CFS; - IncAng = 0.0; // Autodesk:Init Added to elim use uninitialized + Real64 IncAng = 0.0; // incident angle degree CFSAbs = 0.0; - ProfAngHor = 0.0; - ProfAngVer = 0.0; - ConstrNum = state.dataSurface->Surface(SurfNum).Construction; - EQLNum = state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).EQLConsPtr; + Real64 ProfAngHor = 0.0; + Real64 ProfAngVer = 0.0; + int ConstrNum = surf.Construction; + int EQLNum = state.dataConstruction->Construct(surf.Construction).EQLConsPtr; if (BeamDIffFlag != SolarArrays::DIFF) { if (state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum) <= 0.0) return; - for (Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { + for (int Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { if (IsVBLayer(CFS(EQLNum).L(Lay))) { if (CFS(EQLNum).L(Lay).LTYPE == LayerType::VBHOR) { - ProfAngVer = ProfileAngle(state, SurfNum, state.dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Horizontal); + ProfAngVer = Dayltg::ProfileAngle(state, SurfNum, state.dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Horizontal); } else if (CFS(EQLNum).L(Lay).LTYPE == LayerType::VBVER) { - ProfAngHor = ProfileAngle(state, SurfNum, state.dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Vertical); + ProfAngHor = Dayltg::ProfileAngle(state, SurfNum, state.dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Vertical); } } } @@ -8163,12 +7852,13 @@ void CalcEQLOpticalProperty(EnergyPlusData &state, CFSAbs(2, {1, CFSMAXNL + 1}) = Abs1(2, {1, CFSMAXNL + 1}); } else { if (state.dataWindowEquivalentLayer->EQLDiffPropFlag(EQLNum)) { - for (Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { + for (int Lay = 1; Lay <= CFS(EQLNum).NL; ++Lay) { if (IsVBLayer(CFS(EQLNum).L(Lay))) { if (CFS(EQLNum).L(Lay).LTYPE == LayerType::VBHOR) { - ProfAngVer = ProfileAngle(state, SurfNum, state.dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Horizontal); + ProfAngVer = + Dayltg::ProfileAngle(state, SurfNum, state.dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Horizontal); } else if (CFS(EQLNum).L(Lay).LTYPE == LayerType::VBVER) { - ProfAngHor = ProfileAngle(state, SurfNum, state.dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Vertical); + ProfAngHor = Dayltg::ProfileAngle(state, SurfNum, state.dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Vertical); } } } @@ -8190,7 +7880,8 @@ void CalcEQLOpticalProperty(EnergyPlusData &state, } } if (CFS(EQLNum).VBLayerPtr > 0) { - state.dataSurface->SurfWinSlatAngThisTSDeg(SurfNum) = CFS(EQLNum).L(CFS(EQLNum).VBLayerPtr).PHI_DEG; + auto &surfShade = state.dataSurface->surfShades(SurfNum); + surfShade.blind.slatAngDeg = CFS(EQLNum).L(CFS(EQLNum).VBLayerPtr).PHI_DEG; } } @@ -8200,26 +7891,18 @@ void CalcEQLWindowStandardRatings(EnergyPlusData &state, int const ConstrNum) // // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse // DATE WRITTEN May 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Calculates the U-value, SHGC and Normal Transmittance of equivalent layer - // fenestration. + // Calculates the U-value, SHGC and Normal Transmittance of equivalent layer fenestration. // METHODOLOGY EMPLOYED: // Uses routine developed for ASHRAE RP-1311 (ASHWAT Model) - Real64 UValue; - int EQLNum; - Real64 SHGCSummer; - Real64 TransNormal; - - UValue = 0.0; - SHGCSummer = 0.0; - TransNormal = 0.0; + Real64 UValue = 0.0; + Real64 SHGCSummer = 0.0; + Real64 TransNormal = 0.0; - EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; + int EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; // calculate fenestration air-to-air U-value CalcEQLWindowUvalue(state, state.dataWindowEquivLayer->CFS(EQLNum), UValue); @@ -8236,8 +7919,6 @@ Real64 EQLWindowInsideEffectiveEmiss(EnergyPlusData &state, int const ConstrNum) // FUNCTION INFORMATION: // AUTHOR Bereket A Nigusse // DATE WRITTEN May 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Given the consruction number, returns the equivalent layer inside @@ -8251,22 +7932,13 @@ Real64 EQLWindowOutsideEffectiveEmiss(EnergyPlusData &state, int const ConstrNum // FUNCTION INFORMATION: // AUTHOR Bereket A Nigusse // DATE WRITTEN May 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Given the consruction number, returns the equivalent layer outside // face effective longwave emmisivity. - // Return value - Real64 OutSideLWEmiss; // LW outside emissivity - - int EQLNum; // EQL Window object number - - EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; - OutSideLWEmiss = EffectiveEPSLF(state.dataWindowEquivLayer->CFS(EQLNum)); - - return OutSideLWEmiss; + int EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; + return EffectiveEPSLF(state.dataWindowEquivLayer->CFS(EQLNum)); } Real64 HCInWindowStandardRatings(EnergyPlusData &state, @@ -8278,8 +7950,6 @@ Real64 HCInWindowStandardRatings(EnergyPlusData &state, // FUNCTION INFORMATION: // AUTHOR Bereket Nigusse // DATE WRITTEN June 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Return the inside convection coefficient for fenestration ratings. @@ -8290,9 +7960,6 @@ Real64 HCInWindowStandardRatings(EnergyPlusData &state, using Psychrometrics::PsyRhoAirFnPbTdbW; - // Return value - Real64 hcin; // interior surface convection coefficient - static constexpr std::string_view RoutineName("HCInWindowStandardRatings"); Real64 TmeanFilm; // mean film temperature @@ -8325,9 +7992,7 @@ Real64 HCInWindowStandardRatings(EnergyPlusData &state, // eq. 135 in ISO 15099 (only need this one because tilt is 90 deg) Nuint = 0.56 * root_4(RaH * sineTilt); - hcin = Nuint * lambda / Height; - - return hcin; + return Nuint * lambda / Height; } } // namespace EnergyPlus::WindowEquivalentLayer diff --git a/src/EnergyPlus/WindowEquivalentLayer.hh b/src/EnergyPlus/WindowEquivalentLayer.hh index 5bbf28cc2df..affd940c6fc 100644 --- a/src/EnergyPlus/WindowEquivalentLayer.hh +++ b/src/EnergyPlus/WindowEquivalentLayer.hh @@ -409,7 +409,7 @@ namespace WindowEquivalentLayer { Real64 const C // slat crown height (any units, same units as W) must be >= 0 ); - void VB_SOL46_CURVE(EnergyPlusData &state, + void VB_SOL46_CURVE(EnergyPlusData const &state, Real64 const S, // slat spacing (any length units; same units as W) Real64 const W, // slat tip-to-tip (chord) width (any length units; same units as S) Real64 const SL_WR, // slat curvature radius ratio (= W/R) @@ -423,7 +423,7 @@ namespace WindowEquivalentLayer { Real64 &TAU_BD // returned: effective SW (solar) beam-to-diffuse transmittance front side ); - void VB_SOL4(EnergyPlusData &state, + void VB_SOL4(EnergyPlusData const &state, Real64 const S, // slat spacing (any length units; same units as W) Real64 const W, // slat tip-to-tip width (any length units; same units as S) Real64 const OMEGA, // incident beam profile angle (radians) @@ -436,7 +436,7 @@ namespace WindowEquivalentLayer { Real64 &TAU_BD // returned: solar beam-to-diffuse transmittance of the venetian blind (front side) ); - void VB_SOL6(EnergyPlusData &state, + void VB_SOL6(EnergyPlusData const &state, Real64 const S, // slat spacing (any length units; same units as W) Real64 const W, // slat tip-to-tip width (any length units; same units as S) Real64 const OMEGA, // incident beam profile angle (radians) @@ -542,14 +542,14 @@ namespace WindowEquivalentLayer { Real64 const TI // inside air temp, C or K ); - void SLtoGL(EnergyPlusData &state, + void SLtoGL(EnergyPlusData const &state, Real64 const breal, // distance from shade to glass (m) Real64 const Ts, // shade temperature (K) Real64 const Tg, // glass temperature (K) Real64 &hsg, // the heat transfer coefficient, shade-to-glass, {W/m2K} int const scheme); - Real64 SLtoAMB(EnergyPlusData &state, + Real64 SLtoAMB(EnergyPlusData const &state, Real64 const b, // distance from shade to glass (m) where air flow takes place Real64 const L, // window height, m (usually taken as 1 m) Real64 const Ts, // shade temperature, K @@ -558,7 +558,7 @@ namespace WindowEquivalentLayer { int const scheme // flag to select model, scheme=2 has problems ); - void GLtoAMB(EnergyPlusData &state, + void GLtoAMB(EnergyPlusData const &state, Real64 const b, // distance from shade to glass {m} Real64 const L, // window height {m}, usually taken as 1 meter Real64 const Tg, // glass temperature {K} @@ -628,7 +628,7 @@ namespace WindowEquivalentLayer { void Specular_RATDiff(EnergyPlusData &state, Real64 &RAT_1MRDiff, Real64 &RAT_TAUDiff); - Real64 Specular_F(EnergyPlusData &state, + Real64 Specular_F(EnergyPlusData const &state, Real64 const THETA, // incidence angle, radians int const OPT, // options (unused) const Array1D &P // parameters (none defined) @@ -690,7 +690,7 @@ namespace WindowEquivalentLayer { CFSLWP &LLWP // returned: equivalent layer long wave properties ); - bool VB_SWP(EnergyPlusData &state, + bool VB_SWP(EnergyPlusData const &state, CFSLAYER const &L, // VB layer CFSSWP &LSWP, // returned: equivalent off-normal properties const Real64 OMEGA // incident profile angle (radians) @@ -702,7 +702,7 @@ namespace WindowEquivalentLayer { ); - bool VB_ShadeControl(EnergyPlusData &state, + bool VB_ShadeControl(EnergyPlusData const &state, CFSLAYER &L, // VB layer Real64 const OMEGA_DEG // incident profile angle (degrees) ); @@ -723,7 +723,7 @@ namespace WindowEquivalentLayer { bool IsGlazeLayerX(CFSLAYER const &L); - bool IsControlledShade(EnergyPlusData &state, CFSLAYER const &L); + bool IsControlledShade(EnergyPlusData const &state, CFSLAYER const &L); bool IsVBLayer(CFSLAYER const &L); @@ -744,7 +744,7 @@ namespace WindowEquivalentLayer { int CFSNGlz(CFSTY const &FS); // CFS - int CFSHasControlledShade(EnergyPlusData &state, CFSTY const &FS); + int CFSHasControlledShade(EnergyPlusData const &state, CFSTY const &FS); void CheckAndFixCFSLayer(EnergyPlusData &state, CFSLAYER &Layer); @@ -822,7 +822,7 @@ struct WindowEquivalentLayerData : BaseGlobalStruct { } - void clear_state() + void clear_state() override { this->CFSDiffAbsTrans.deallocate(); this->EQLDiffPropFlag.deallocate(); diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 390e8102ac5..67875d0a3ed 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -142,12 +142,13 @@ namespace Window { // PURPOSE OF THIS SUBROUTINE: // Manages if optical calculation will be performed with internal or external routines + auto &s_surf = state.dataSurface; // check and read custom solar and/or visible spectrum data if any CheckAndReadCustomSprectrumData(state); // allocate surface level adj ratio data member - state.dataHeatBalSurf->SurfWinCoeffAdjRatio.dimension(state.dataSurface->TotSurfaces, 1.0); + state.dataHeatBalSurf->SurfWinCoeffAdjRatio.dimension(s_surf->TotSurfaces, 1.0); if (state.dataWindowManager->inExtWindowModel->isExternalLibraryModel()) { InitWCE_SimplifiedOpticalData(state); @@ -179,10 +180,7 @@ namespace Window { using WindowEquivalentLayer::InitEquivalentLayerWindowCalculations; - int CoefNum; // Polynomial coefficient number - int j; // Wavelength counter int TotLay; // Total solid and gas layers in a window construction - int ConstrNum; // Construction number int ConstrNumSh; // Shaded construction number int ShadeLayNum; // Layer number for shade or blind, if present int ShadeLayPtr; // Material number for shade or blind @@ -287,7 +285,6 @@ namespace Window { int LayPtr; // Material number corresponding to LayNum Real64 Phi; // Incidence angle (deg) Real64 CosPhi; // Cosine of incidence angle - int ILam; // Wavelength counter Real64 tsolDiff; // Glazing system diffuse solar transmittance Real64 tvisDiff; // Glazing system diffuse visible transmittance int IGlassBack; // Glass layer number counted from back of window @@ -323,7 +320,7 @@ namespace Window { Real64 rfshv; // Diffuse visible front reflectance of isolated blind Real64 rbshv; // Diffuse visible back reflectance of isolated blind Real64 ShadeReflFacVis; // Shade/blind visible reflection factor - int SpecDataNum; // Spectral data set number + int SpecDataNum = 0; // Spectral data set number int numptDAT; // Number of wavelengths in a spectral data set bool StormWinConst; // True if a construction with a storm window bool Triangle; // True if window is triangular @@ -348,13 +345,16 @@ namespace Window { // Number of spectral data wavelengths for each layer; =2 if no spectra data for a layer std::array numpt = {0}; + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; + W5InitGlassParameters(state); // Calculate optical properties of blind-type layers entered with MATERIAL:WindowBlind - if (state.dataHeatBal->TotBlinds > 0) CalcWindowBlindProperties(state); + if (s_mat->NumBlinds > 0) CalcWindowBlindProperties(state); // Initialize SurfaceScreen structure - if (state.dataHeatBal->NumScreens > 0) CalcWindowScreenProperties(state); + if (s_mat->NumScreens > 0) CalcWindowScreenProperties(state); // Get glazing system optical properties of constructions with glass or glass plus // shade, screen or blind @@ -372,11 +372,11 @@ namespace Window { TotLay = thisConstruct.TotLayers; - auto const *mat = state.dataMaterial->Material(thisConstruct.LayerPoint(1)); + auto const *mat = s_mat->materials(thisConstruct.LayerPoint(1)); // First layer must be glass, shade, screen or blind to be a glazing construction - if (mat->group != Material::Group::WindowGlass && mat->group != Material::Group::Shade && mat->group != Material::Group::Screen && - mat->group != Material::Group::WindowBlind && mat->group != Material::Group::WindowSimpleGlazing) + if (mat->group != Material::Group::Glass && mat->group != Material::Group::Shade && mat->group != Material::Group::Screen && + mat->group != Material::Group::Blind && mat->group != Material::Group::GlassSimple) continue; ShadeLayNum = 0; @@ -390,8 +390,8 @@ namespace Window { StormWinConst = false; wm->lSimpleGlazingSystem = false; - if (mat->group == Material::Group::WindowSimpleGlazing) { - auto const *matWin = dynamic_cast(mat); + if (mat->group == Material::Group::GlassSimple) { + auto const *matWin = dynamic_cast(mat); assert(matWin != nullptr); // what if outside layer is shade, blind, or screen? @@ -407,42 +407,40 @@ namespace Window { if (mat->group == Material::Group::Shade) { ExtShade = true; ShadeLayNum = 1; - } else if (state.dataMaterial->Material(thisConstruct.LayerPoint(TotLay))->group == Material::Group::Shade) { + } else if (s_mat->materials(thisConstruct.LayerPoint(TotLay))->group == Material::Group::Shade) { IntShade = true; ShadeLayNum = TotLay; } else if (thisConstruct.TotLayers == 5) { - if (state.dataMaterial->Material(thisConstruct.LayerPoint(3))->group == Material::Group::Shade) { + if (s_mat->materials(thisConstruct.LayerPoint(3))->group == Material::Group::Shade) { BGShade = true; ShadeLayNum = 3; } } else if (thisConstruct.TotLayers == 7) { - if (state.dataMaterial->Material(thisConstruct.LayerPoint(5))->group == Material::Group::Shade) { + if (s_mat->materials(thisConstruct.LayerPoint(5))->group == Material::Group::Shade) { BGShade = true; ShadeLayNum = 5; } } - if (mat->group == Material::Group::WindowBlind) { + if (mat->group == Material::Group::Blind) { ExtBlind = true; ShadeLayNum = 1; - BlNum = dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(ShadeLayNum)))->BlindDataPtr; - } else if (state.dataMaterial->Material(thisConstruct.LayerPoint(TotLay))->group == Material::Group::WindowBlind) { + BlNum = thisConstruct.LayerPoint(ShadeLayNum); + } else if (s_mat->materials(thisConstruct.LayerPoint(TotLay))->group == Material::Group::Blind) { IntBlind = true; ShadeLayNum = TotLay; - BlNum = dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(ShadeLayNum)))->BlindDataPtr; + BlNum = thisConstruct.LayerPoint(ShadeLayNum); } else if (thisConstruct.TotLayers == 5) { - if (state.dataMaterial->Material(thisConstruct.LayerPoint(3))->group == Material::Group::WindowBlind) { + if (s_mat->materials(thisConstruct.LayerPoint(3))->group == Material::Group::Blind) { BGBlind = true; ShadeLayNum = 3; - BlNum = - dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(ShadeLayNum)))->BlindDataPtr; + BlNum = thisConstruct.LayerPoint(ShadeLayNum); } } else if (thisConstruct.TotLayers == 7) { - if (state.dataMaterial->Material(thisConstruct.LayerPoint(5))->group == Material::Group::WindowBlind) { + if (s_mat->materials(thisConstruct.LayerPoint(5))->group == Material::Group::Blind) { BGBlind = true; ShadeLayNum = 5; - BlNum = - dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(ShadeLayNum)))->BlindDataPtr; + BlNum = thisConstruct.LayerPoint(ShadeLayNum); } } @@ -462,7 +460,8 @@ namespace Window { if (IntShade || ExtShade || ExtScreen) { ShadeLayPtr = thisConstruct.LayerPoint(ShadeLayNum); - auto const *matShade = state.dataMaterial->Material(ShadeLayPtr); + auto const *matShade = dynamic_cast(s_mat->materials(ShadeLayPtr)); + assert(matShade != nullptr); if (ExtScreen) { auto const *matScreen = dynamic_cast(matShade); assert(matScreen != nullptr); @@ -473,9 +472,9 @@ namespace Window { EpsShIR = matShade->AbsorpThermal; RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); if (ExtShade || ExtScreen) { // Exterior shade or screen - EpsGlIR = state.dataMaterial->Material(thisConstruct.LayerPoint(2))->AbsorpThermalFront; + EpsGlIR = s_mat->materials(thisConstruct.LayerPoint(2))->AbsorpThermalFront; } else { // Interior shade - EpsGlIR = state.dataMaterial->Material(thisConstruct.LayerPoint(TotLay - 1))->AbsorpThermalBack; + EpsGlIR = s_mat->materials(thisConstruct.LayerPoint(TotLay - 1))->AbsorpThermalBack; } RhoGlIR = max(0.0, 1.0 - EpsGlIR); thisConstruct.ShadeAbsorpThermal = EpsShIR * (1.0 + TauShIR * RhoGlIR / (1.0 - RhoShIR * RhoGlIR)); @@ -519,26 +518,27 @@ namespace Window { wm->LayerNum[IGlass - 1] = LayNum; LayPtr = thisConstruct.LayerPoint(LayNum); - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(LayPtr)); - assert(thisMaterial != nullptr); - SpecDataNum = thisMaterial->GlassSpectralDataPtr; + auto *matGlass = dynamic_cast(s_mat->materials(LayPtr)); + assert(matGlass != nullptr); + SpecDataNum = matGlass->GlassSpectralDataPtr; if (SpecDataNum != 0) { if (!wm->BGFlag) AllGlassIsSpectralAverage = false; + auto const &specData = s_mat->SpectralData(SpecDataNum); // Get the spectral data for the transmittance, front reflectance and // back reflectance (all at normal incidence) for this layer. // In this case, "front" means incident from the outside and "back" // means incident from the inside. - numptDAT = state.dataHeatBal->SpectralData(SpecDataNum).NumOfWavelengths; + numptDAT = specData.NumOfWavelengths; numpt[IGlass - 1] = numptDAT; for (int ILam = 1; ILam <= numptDAT; ++ILam) { - wlt[IGlass - 1][ILam - 1] = state.dataHeatBal->SpectralData(SpecDataNum).WaveLength(ILam); - t[IGlass - 1][ILam - 1] = state.dataHeatBal->SpectralData(SpecDataNum).Trans(ILam); + wlt[IGlass - 1][ILam - 1] = specData.WaveLength(ILam); + t[IGlass - 1][ILam - 1] = specData.Trans(ILam); if ((IGlass == 1 || (IGlass == 2 && StormWinConst)) && (!wm->BGFlag)) - t[IGlass - 1][ILam - 1] *= thisMaterial->GlassTransDirtFactor; - rff[IGlass - 1][ILam - 1] = state.dataHeatBal->SpectralData(SpecDataNum).ReflFront(ILam); - rbb[IGlass - 1][ILam - 1] = state.dataHeatBal->SpectralData(SpecDataNum).ReflBack(ILam); + t[IGlass - 1][ILam - 1] *= matGlass->GlassTransDirtFactor; + rff[IGlass - 1][ILam - 1] = specData.ReflFront(ILam); + rbb[IGlass - 1][ILam - 1] = specData.ReflBack(ILam); } // If there is spectral data for between-glass shades or blinds, calc the average spectral properties for use. @@ -548,7 +548,7 @@ namespace Window { state, format( "Window glazing material \"{}\" was defined with full spectral data and has been converted to average spectral data", - thisMaterial->Name)); + matGlass->Name)); ShowContinueError( state, format("due to its use with between-glass shades or blinds of the window construction \"{}\".", thisConstruct.Name)); @@ -570,30 +570,32 @@ namespace Window { wm->tmpReflectVisBeamBack = visibleSpectrumAverage(state, rbb[0]); // set this material to average spectral data - thisMaterial->GlassSpectralDataPtr = 0; - thisMaterial->Trans = wm->tmpTrans; - thisMaterial->TransVis = wm->tmpTransVis; - thisMaterial->ReflectSolBeamFront = wm->tmpReflectSolBeamFront; - thisMaterial->ReflectSolBeamBack = wm->tmpReflectSolBeamBack; - thisMaterial->ReflectVisBeamFront = wm->tmpReflectVisBeamFront; - thisMaterial->ReflectVisBeamBack = wm->tmpReflectVisBeamBack; + matGlass->GlassSpectralDataPtr = 0; + matGlass->Trans = wm->tmpTrans; + matGlass->TransVis = wm->tmpTransVis; + matGlass->ReflectSolBeamFront = wm->tmpReflectSolBeamFront; + matGlass->ReflectSolBeamBack = wm->tmpReflectSolBeamBack; + matGlass->ReflectVisBeamFront = wm->tmpReflectVisBeamFront; + matGlass->ReflectVisBeamBack = wm->tmpReflectVisBeamBack; SpecDataNum = 0; } } - if (SpecDataNum == 0 && !thisMaterial->GlassSpectralAndAngle) { // No spectral data for this layer; use spectral average values + // No spectral data for this layer; use spectral average values + if (SpecDataNum == 0 && matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { lquasi = true; numpt[IGlass - 1] = 2; - t[IGlass - 1][0] = thisMaterial->Trans; - if (IGlass == 1 || (IGlass == 2 && StormWinConst)) t[IGlass - 1][0] *= thisMaterial->GlassTransDirtFactor; - t[IGlass - 1][1] = thisMaterial->TransVis; - if (IGlass == 1 || (IGlass == 2 && StormWinConst)) t[IGlass - 1][1] *= thisMaterial->GlassTransDirtFactor; - rff[IGlass - 1][0] = thisMaterial->ReflectSolBeamFront; - rbb[IGlass - 1][0] = thisMaterial->ReflectSolBeamBack; - rff[IGlass - 1][1] = thisMaterial->ReflectVisBeamFront; - rbb[IGlass - 1][1] = thisMaterial->ReflectVisBeamBack; + t[IGlass - 1][0] = matGlass->Trans; + if (IGlass == 1 || (IGlass == 2 && StormWinConst)) t[IGlass - 1][0] *= matGlass->GlassTransDirtFactor; + t[IGlass - 1][1] = matGlass->TransVis; + if (IGlass == 1 || (IGlass == 2 && StormWinConst)) t[IGlass - 1][1] *= matGlass->GlassTransDirtFactor; + rff[IGlass - 1][0] = matGlass->ReflectSolBeamFront; + rbb[IGlass - 1][0] = matGlass->ReflectSolBeamBack; + rff[IGlass - 1][1] = matGlass->ReflectVisBeamFront; + rbb[IGlass - 1][1] = matGlass->ReflectVisBeamBack; } - if (thisMaterial->GlassSpectralAndAngle) { + + if (matGlass->windowOpticalData == Window::OpticalDataModel::SpectralAndAngle) { if (!wm->BGFlag) AllGlassIsSpectralAverage = false; numptDAT = wm->wle.size(); numpt[IGlass - 1] = numptDAT; @@ -602,7 +604,7 @@ namespace Window { ShowWarningError(state, format("Window glazing material \"{}\" was defined with full spectral and angular data and has been " "converted to average spectral data", - thisMaterial->Name)); + matGlass->Name)); ShowContinueError( state, format("due to its use with between-glass shades or blinds of the window construction \"{}\".", thisConstruct.Name)); @@ -617,9 +619,9 @@ namespace Window { for (int ILam = 1; ILam <= (int)wm->wle.size(); ++ILam) { Real64 lam = wm->wle[ILam - 1]; wlt[IGlass - 1][ILam - 1] = lam; - t[IGlass - 1][ILam - 1] = Curve::CurveValue(state, thisMaterial->GlassSpecAngTransDataPtr, 0.0, lam); - rff[IGlass - 1][ILam - 1] = Curve::CurveValue(state, thisMaterial->GlassSpecAngFRefleDataPtr, 0.0, lam); - rbb[IGlass - 1][ILam - 1] = Curve::CurveValue(state, thisMaterial->GlassSpecAngBRefleDataPtr, 0.0, lam); + t[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, 0.0, lam); + rff[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, 0.0, lam); + rbb[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, 0.0, lam); } wm->tmpTrans = solarSpectrumAverage(state, t[0]); wm->tmpReflectSolBeamFront = solarSpectrumAverage(state, rff[0]); @@ -631,13 +633,13 @@ namespace Window { wm->tmpReflectVisBeamBack = visibleSpectrumAverage(state, rbb[0]); // set this material to average spectral data - thisMaterial->GlassSpectralAndAngle = false; - thisMaterial->Trans = wm->tmpTrans; - thisMaterial->TransVis = wm->tmpTransVis; - thisMaterial->ReflectSolBeamFront = wm->tmpReflectSolBeamFront; - thisMaterial->ReflectSolBeamBack = wm->tmpReflectSolBeamBack; - thisMaterial->ReflectVisBeamFront = wm->tmpReflectVisBeamFront; - thisMaterial->ReflectVisBeamBack = wm->tmpReflectVisBeamBack; + matGlass->windowOpticalData = Window::OpticalDataModel::SpectralAverage; + matGlass->Trans = wm->tmpTrans; + matGlass->TransVis = wm->tmpTransVis; + matGlass->ReflectSolBeamFront = wm->tmpReflectSolBeamFront; + matGlass->ReflectSolBeamBack = wm->tmpReflectSolBeamBack; + matGlass->ReflectVisBeamFront = wm->tmpReflectVisBeamFront; + matGlass->ReflectVisBeamBack = wm->tmpReflectVisBeamBack; SpecDataNum = 0; } } @@ -668,9 +670,9 @@ namespace Window { // from properties at normal incidence for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { LayPtr = thisConstruct.LayerPoint(wm->LayerNum[IGlass - 1]); - auto *thisMaterial = dynamic_cast(state.dataMaterial->Material(LayPtr)); - assert(thisMaterial != nullptr); - if (!thisMaterial->GlassSpectralAndAngle) { + auto *matGlass = dynamic_cast(s_mat->materials(LayPtr)); + assert(matGlass != nullptr); + if (matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { for (int ILam = 1; ILam <= numpt[IGlass - 1]; ++ILam) { TransAndReflAtPhi(CosPhi, t[IGlass - 1][ILam - 1], @@ -687,9 +689,9 @@ namespace Window { for (int ILam = 1; ILam <= (int)wm->wle.size(); ++ILam) { Real64 lam = wm->wle[ILam - 1]; wlt[IGlass - 1][ILam - 1] = lam; - tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, thisMaterial->GlassSpecAngTransDataPtr, Phi, lam); - rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, thisMaterial->GlassSpecAngFRefleDataPtr, Phi, lam); - rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, thisMaterial->GlassSpecAngBRefleDataPtr, Phi, lam); + tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, Phi, lam); + rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, Phi, lam); + rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, Phi, lam); } } // For use with between-glass shade/blind, save angular properties of isolated glass @@ -813,44 +815,42 @@ namespace Window { } wm->LayerNum[IGlass - 1] = LayNum; LayPtr = thisConstruct.LayerPoint(LayNum); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(LayPtr)); - assert(thisMaterial != nullptr); - - SpecDataNum = thisMaterial->GlassSpectralDataPtr; - if (SpecDataNum != 0) { + auto const *matGlass = dynamic_cast(s_mat->materials(LayPtr)); + assert(matGlass != nullptr); + if (matGlass->GlassSpectralDataPtr != 0) { + auto const &specData = s_mat->SpectralData(matGlass->GlassSpectralDataPtr); // Get the spectral data for the transmittance, front reflectance and // back reflectance (all at normal incidence) for this layer. // In this case, "front" means incident from the inside and "back" // means incident from the outside. - numptDAT = state.dataHeatBal->SpectralData(SpecDataNum).NumOfWavelengths; + numptDAT = specData.NumOfWavelengths; numpt[IGlass - 1] = numptDAT; for (int ILam = 1; ILam <= numptDAT; ++ILam) { - wlt[IGlass - 1][ILam - 1] = state.dataHeatBal->SpectralData(SpecDataNum).WaveLength(ILam); - t[IGlass - 1][ILam - 1] = state.dataHeatBal->SpectralData(SpecDataNum).Trans(ILam); - if (IGlass == NGlass || (IGlass == (NGlass - 1) && StormWinConst)) - t[IGlass - 1][ILam - 1] *= thisMaterial->GlassTransDirtFactor; - rff[IGlass - 1][ILam - 1] = state.dataHeatBal->SpectralData(SpecDataNum).ReflBack(ILam); - rbb[IGlass - 1][ILam - 1] = state.dataHeatBal->SpectralData(SpecDataNum).ReflFront(ILam); + wlt[IGlass - 1][ILam - 1] = specData.WaveLength(ILam); + t[IGlass - 1][ILam - 1] = specData.Trans(ILam); + if (IGlass == NGlass || (IGlass == (NGlass - 1) && StormWinConst)) t[IGlass - 1][ILam - 1] *= matGlass->GlassTransDirtFactor; + rff[IGlass - 1][ILam - 1] = specData.ReflBack(ILam); + rbb[IGlass - 1][ILam - 1] = specData.ReflFront(ILam); } - } else { // No spectral data for this layer; use spectral average values - if (!thisMaterial->GlassSpectralAndAngle) { - lquasi = true; - numpt[IGlass - 1] = 2; - t[IGlass - 1][0] = thisMaterial->Trans; - if (IGlass == NGlass || (IGlass == (NGlass - 1) && StormWinConst)) t[IGlass - 1][0] *= thisMaterial->GlassTransDirtFactor; - t[IGlass - 1][1] = thisMaterial->TransVis; - if (IGlass == NGlass || (IGlass == (NGlass - 1) && StormWinConst)) t[IGlass - 1][1] *= thisMaterial->GlassTransDirtFactor; - rff[IGlass - 1][0] = thisMaterial->ReflectSolBeamBack; - rbb[IGlass - 1][0] = thisMaterial->ReflectSolBeamFront; - rff[IGlass - 1][1] = thisMaterial->ReflectVisBeamBack; - rbb[IGlass - 1][1] = thisMaterial->ReflectVisBeamFront; - } - } - if (thisMaterial->GlassSpectralAndAngle) { + // No spectral data for this layer; use spectral average values + } else if (matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { + lquasi = true; + numpt[IGlass - 1] = 2; + t[IGlass - 1][0] = matGlass->Trans; + if (IGlass == NGlass || (IGlass == (NGlass - 1) && StormWinConst)) t[IGlass - 1][0] *= matGlass->GlassTransDirtFactor; + t[IGlass - 1][1] = matGlass->TransVis; + if (IGlass == NGlass || (IGlass == (NGlass - 1) && StormWinConst)) t[IGlass - 1][1] *= matGlass->GlassTransDirtFactor; + rff[IGlass - 1][0] = matGlass->ReflectSolBeamBack; + rbb[IGlass - 1][0] = matGlass->ReflectSolBeamFront; + rff[IGlass - 1][1] = matGlass->ReflectVisBeamBack; + rbb[IGlass - 1][1] = matGlass->ReflectVisBeamFront; + + // Using SpectralAndAngle here + } else { numptDAT = wm->wle.size(); numpt[IGlass - 1] = numptDAT; } @@ -870,9 +870,9 @@ namespace Window { // from properties at normal incidence for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { LayPtr = thisConstruct.LayerPoint(wm->LayerNum[IGlass - 1]); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(LayPtr)); - assert(thisMaterial != nullptr); - if (!thisMaterial->GlassSpectralAndAngle) { + auto const *matGlass = dynamic_cast(s_mat->materials(LayPtr)); + assert(matGlass != nullptr); + if (matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { for (int ILam = 1; ILam <= numpt[IGlass - 1]; ++ILam) { TransAndReflAtPhi(CosPhi, @@ -886,13 +886,14 @@ namespace Window { wm->SimpleGlazingSHGC, wm->SimpleGlazingU); } + } else { for (int ILam = 1; ILam <= (int)wm->wle.size(); ++ILam) { Real64 lam = wm->wle[ILam - 1]; wlt[IGlass - 1][ILam - 1] = lam; - tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, thisMaterial->GlassSpecAngTransDataPtr, Phi, lam); - rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, thisMaterial->GlassSpecAngFRefleDataPtr, Phi, lam); - rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, thisMaterial->GlassSpecAngBRefleDataPtr, Phi, lam); + tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, Phi, lam); + rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, Phi, lam); + rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, Phi, lam); } } } @@ -932,494 +933,509 @@ namespace Window { // and correct the system glass layer absorptances for the effect of reflection // and transmission by shade, screen or blind. Get system reflectance (front and back, // solar and visible) - - if (ShadeOn || BlindOn || ScreenOn) { - - // Solar and visible properties of isolated shade or blind - // (Note: for shades or screen we go through the following loop over slat angles only once.) - - Real64 const tsolDiff_2(pow_2(tsolDiff)); - Real64 const tvisDiff_2(pow_2(tvisDiff)); - for (int ISlatAng = 1; ISlatAng <= Material::MaxSlatAngs; ++ISlatAng) { - - if (ShadeOn) { - auto const *thisMaterialSh = - dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(ShadeLayNum))); - assert(thisMaterialSh != nullptr); - ShadeAbs = thisMaterialSh->AbsorpSolar; - ShadeTrans = thisMaterialSh->Trans; - ShadeTransVis = thisMaterialSh->TransVis; - ShadeRefl = thisMaterialSh->ReflectShade; - ShadeReflVis = thisMaterialSh->ReflectShadeVis; - rsh = ShadeRefl; - rshv = ShadeReflVis; - tsh = ShadeTrans; - tshv = ShadeTransVis; - ash = ShadeAbs; - } else if (IntBlind || ExtBlind) { - auto const &blind = state.dataMaterial->Blind(BlNum); - ShadeTrans = blind.SolFrontDiffDiffTrans(ISlatAng); - ShadeTransGnd = blind.SolFrontDiffDiffTransGnd(ISlatAng); - ShadeTransSky = blind.SolFrontDiffDiffTransSky(ISlatAng); - ShadeTransVis = blind.VisFrontDiffDiffTrans(ISlatAng); - if (IntBlind) { // Interior blind - ShadeAbs = blind.SolFrontDiffAbs(ISlatAng); - ShadeRefl = blind.SolFrontDiffDiffRefl(ISlatAng); - ShadeReflGnd = blind.SolFrontDiffDiffReflGnd(ISlatAng); - ShadeReflSky = blind.SolFrontDiffDiffReflSky(ISlatAng); - ShadeReflVis = blind.VisFrontDiffDiffRefl(ISlatAng); - } else { // Exterior blind - ShadeAbs = blind.SolBackDiffAbs(ISlatAng); - ShadeRefl = blind.SolBackDiffDiffRefl(ISlatAng); - ShadeReflVis = blind.VisBackDiffDiffRefl(ISlatAng); - } - } else if (BGBlind) { - auto const &blind = state.dataMaterial->Blind(BlNum); - tsh = blind.SolFrontDiffDiffTrans(ISlatAng); - tshGnd = blind.SolFrontDiffDiffTransGnd(ISlatAng); - tshSky = blind.SolFrontDiffDiffTransSky(ISlatAng); - tshv = blind.VisFrontDiffDiffTrans(ISlatAng); - rfsh = blind.SolFrontDiffDiffRefl(ISlatAng); - rfshGnd = blind.SolFrontDiffDiffReflGnd(ISlatAng); - rfshSky = blind.SolFrontDiffDiffReflSky(ISlatAng); - rfshv = blind.VisFrontDiffDiffRefl(ISlatAng); - rbsh = blind.SolBackDiffDiffRefl(ISlatAng); - rbshv = blind.VisBackDiffDiffRefl(ISlatAng); - afsh = blind.SolFrontDiffAbs(ISlatAng); - afshGnd = blind.SolFrontDiffAbsGnd(ISlatAng); - afshSky = blind.SolFrontDiffAbsSky(ISlatAng); - absh = blind.SolBackDiffAbs(ISlatAng); - } else if (ScreenOn) { - // diffuse screen properties are calculated during initialization (quarter-hemispherical integration of beam properties) - auto const *matScreen = - dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(ShadeLayNum))); - assert(matScreen != nullptr); - - ShadeAbs = matScreen->DfAbs; - ShadeTrans = matScreen->DfTrans; - ShadeTransVis = matScreen->DfTransVis; - ShadeRefl = matScreen->DfRef; - ShadeReflVis = matScreen->DfRefVis; - rsh = ShadeRefl; - rshv = ShadeReflVis; - tsh = ShadeTrans; - tshv = ShadeTransVis; - ash = ShadeAbs; + auto &constr = thisConstruct; + + // Solar and visible properties of isolated shade or blind + // (Note: for shades or screen we go through the following loop over slat angles only once.) + + Real64 const tsolDiff_2(pow_2(tsolDiff)); + Real64 const tvisDiff_2(pow_2(tvisDiff)); + + if (IntShade) { + auto const *matSh = dynamic_cast(s_mat->materials(constr.LayerPoint(ShadeLayNum))); + assert(matSh != nullptr); + ShadeAbs = matSh->AbsorpSolar; + ShadeTrans = matSh->Trans; + ShadeTransVis = matSh->TransVis; + ShadeRefl = matSh->ReflectShade; + ShadeReflVis = matSh->ReflectShadeVis; + rsh = ShadeRefl; + rshv = ShadeReflVis; + tsh = ShadeTrans; + tshv = ShadeTransVis; + ash = ShadeAbs; + + // Correction factors for inter-reflections between glass and shading device + ShadeReflFac = 1.0 / (1.0 - ShadeRefl * constr.ReflectSolDiffBack); + ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffBack); + + // Front incident solar, beam, interior shade + for (int IPhi = 1; IPhi <= 10; ++IPhi) { + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + solabsPhi(IGlass, IPhi) += tsolPhi(IPhi) * ShadeRefl * ShadeReflFac * constr.AbsDiffBack(IGlass); } + solabsShadePhi(IPhi) = tsolPhi(IPhi) * ShadeReflFac * ShadeAbs; + tsolPhi(IPhi) *= ShadeReflFac * ShadeTrans; + tvisPhi(IPhi) *= ShadeReflFacVis * ShadeTransVis; + } - // Correction factors for inter-reflections between glass and shading device + // Front incident solar, diffuse, interior shade + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + constr.AbsDiff(IGlass) += tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); + } - if (ExtShade || ExtBlind || ExtScreen) { - ShadeReflFac = 1.0 / (1.0 - ShadeRefl * thisConstruct.ReflectSolDiffFront); - ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * thisConstruct.ReflectVisDiffFront); - } else if (IntShade || IntBlind) { - ShadeReflFac = 1.0 / (1.0 - ShadeRefl * thisConstruct.ReflectSolDiffBack); - ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * thisConstruct.ReflectVisDiffBack); - } + constr.AbsDiffShade = tsolDiff * ShadeReflFac * ShadeAbs; + constr.TransDiff = tsolDiff * ShadeReflFac * ShadeTrans; + constr.TransDiffVis = tvisDiff * ShadeReflFacVis * ShadeTransVis; + constr.ReflectSolDiffFront += tsolDiff_2 * ShadeRefl * ShadeReflFac; + constr.ReflectVisDiffFront += tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; - if (ExtShade || ExtBlind || ExtScreen) { // Exterior shade or blind + // Back incident solar, diffuse, interior shade - // Front incident solar, beam, exterior shade, screen or blind + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + constr.AbsDiffBack(IGlass) *= ShadeTrans * ShadeReflFac; + } - if (ExtShade) { - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - solabsPhi(IGlass, IPhi) = ShadeTrans * solabsDiff(IGlass) * ShadeReflFac; - } - tsolPhi(IPhi) = ShadeTrans * ShadeReflFac * tsolDiff; - tvisPhi(IPhi) = ShadeTransVis * ShadeReflFacVis * tvisDiff; - solabsShadePhi(IPhi) = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * thisConstruct.ReflectSolDiffFront); - } - } + constr.AbsDiffBackShade = ShadeAbs * (1 + ShadeTrans * ShadeReflFac * constr.ReflectSolDiffBack); + constr.ReflectSolDiffBack = ShadeRefl + pow_2(ShadeTrans) * constr.ReflectSolDiffBack * ShadeReflFac; + constr.ReflectVisDiffBack = ShadeReflVis + pow_2(ShadeTransVis) * constr.ReflectVisDiffBack * ShadeReflFacVis; + + // Exterior Shade + } else if (ExtShade) { + auto const *matSh = dynamic_cast(s_mat->materials(constr.LayerPoint(ShadeLayNum))); + assert(matSh != nullptr); + ShadeAbs = matSh->AbsorpSolar; + ShadeTrans = matSh->Trans; + ShadeTransVis = matSh->TransVis; + ShadeRefl = matSh->ReflectShade; + ShadeReflVis = matSh->ReflectShadeVis; + rsh = ShadeRefl; + rshv = ShadeReflVis; + tsh = ShadeTrans; + tshv = ShadeTransVis; + ash = ShadeAbs; + + // Correction factors for inter-reflections between glass and shading device + ShadeReflFac = 1.0 / (1.0 - ShadeRefl * constr.ReflectSolDiffFront); + ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffFront); + + for (int IPhi = 1; IPhi <= 10; ++IPhi) { + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + solabsPhi(IGlass, IPhi) = ShadeTrans * solabsDiff(IGlass) * ShadeReflFac; + } + tsolPhi(IPhi) = ShadeTrans * ShadeReflFac * tsolDiff; + tvisPhi(IPhi) = ShadeTransVis * ShadeReflFacVis * tvisDiff; + solabsShadePhi(IPhi) = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * constr.ReflectSolDiffFront); + } - // Front incident solar, diffuse, exterior shade/screen/blind + // Front incident solar, diffuse, exterior shade/screen/blind + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + constr.AbsDiff(IGlass) = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); + } - for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - if (ExtBlind) { - thisConstruct.BlAbsDiff(ISlatAng, IGlass) = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); - thisConstruct.BlAbsDiffGnd(ISlatAng, IGlass) = ShadeTransGnd * ShadeReflFac * solabsDiff(IGlass); - thisConstruct.BlAbsDiffSky(ISlatAng, IGlass) = ShadeTransSky * ShadeReflFac * solabsDiff(IGlass); - } - if (ExtShade || ExtScreen) thisConstruct.AbsDiff(IGlass) = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); - } - if (ExtBlind) { - auto const &blind = state.dataMaterial->Blind(BlNum); - thisConstruct.AbsDiffBlind(ISlatAng) = - blind.SolFrontDiffAbs(ISlatAng) + ShadeTrans * ShadeReflFac * thisConstruct.ReflectSolDiffFront * ShadeAbs; - thisConstruct.AbsDiffBlindGnd(ISlatAng) = - blind.SolFrontDiffAbsGnd(ISlatAng) + ShadeTransGnd * ShadeReflFac * thisConstruct.ReflectSolDiffFront * ShadeAbs; - thisConstruct.AbsDiffBlindSky(ISlatAng) = - blind.SolFrontDiffAbsSky(ISlatAng) + ShadeTransSky * ShadeReflFac * thisConstruct.ReflectSolDiffFront * ShadeAbs; - thisConstruct.BlTransDiff(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTrans; - thisConstruct.BlTransDiffGnd(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransGnd; - thisConstruct.BlTransDiffSky(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransSky; - thisConstruct.BlTransDiffVis(ISlatAng) = tvisDiff * ShadeReflFacVis * ShadeTransVis; - thisConstruct.BlReflectSolDiffFront(ISlatAng) = - ShadeRefl + pow_2(ShadeTrans) * thisConstruct.ReflectSolDiffFront * ShadeReflFac; - thisConstruct.BlReflectVisDiffFront(ISlatAng) = - ShadeReflVis + pow_2(ShadeTransVis) * thisConstruct.ReflectVisDiffFront * ShadeReflFacVis; - } - if (ExtShade || ExtScreen) { - thisConstruct.AbsDiffShade = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * thisConstruct.ReflectSolDiffFront); - thisConstruct.TransDiff = tsolDiff * ShadeReflFac * ShadeTrans; - thisConstruct.TransDiffVis = tvisDiff * ShadeReflFacVis * ShadeTransVis; - thisConstruct.ReflectSolDiffFront = ShadeRefl + pow_2(ShadeTrans) * thisConstruct.ReflectSolDiffFront * ShadeReflFac; - thisConstruct.ReflectVisDiffFront = - ShadeReflVis + pow_2(ShadeTransVis) * thisConstruct.ReflectVisDiffFront * ShadeReflFacVis; - } + // Front incident solar, diffuse, exterior shade/screen + constr.AbsDiffShade = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * constr.ReflectSolDiffFront); + constr.TransDiff = tsolDiff * ShadeReflFac * ShadeTrans; + constr.TransDiffVis = tvisDiff * ShadeReflFacVis * ShadeTransVis; + constr.ReflectSolDiffFront = ShadeRefl + pow_2(ShadeTrans) * constr.ReflectSolDiffFront * ShadeReflFac; + constr.ReflectVisDiffFront = ShadeReflVis + pow_2(ShadeTransVis) * constr.ReflectVisDiffFront * ShadeReflFacVis; - // Back incident solar, diffuse, exterior shade/blind + // Back incident solar, diffuse, exterior shade/screen + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + constr.AbsDiffBack(IGlass) += tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); + } + constr.AbsDiffBackShade = tsolDiff * ShadeReflFac * ShadeAbs; + constr.ReflectSolDiffBack += tsolDiff_2 * ShadeRefl * ShadeReflFac; + constr.ReflectVisDiffBack += tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; + + // Between-glass shade + } else if (BGShade) { + auto const *matSh = dynamic_cast(s_mat->materials(constr.LayerPoint(ShadeLayNum))); + assert(matSh != nullptr); + ShadeAbs = matSh->AbsorpSolar; + ShadeTrans = matSh->Trans; + ShadeTransVis = matSh->TransVis; + ShadeRefl = matSh->ReflectShade; + ShadeReflVis = matSh->ReflectShadeVis; + rsh = ShadeRefl; + rshv = ShadeReflVis; + tsh = ShadeTrans; + tshv = ShadeTransVis; + ash = ShadeAbs; + + // Between-glass shade/blind; assumed to be between glass #2 and glass #3 + tsh2 = pow_2(tsh); + tshv2 = pow_2(tshv); + td1 = constr.tBareSolDiff(1); + td2 = constr.tBareSolDiff(2); + td1v = constr.tBareVisDiff(1); + td2v = constr.tBareVisDiff(2); + afd1 = constr.afBareSolDiff(1); + afd2 = constr.afBareSolDiff(2); + abd1 = constr.abBareSolDiff(1); + abd2 = constr.abBareSolDiff(2); + rb1 = constr.rbBareSolDiff(1); + rb2 = constr.rbBareSolDiff(2); + rb1v = constr.rbBareVisDiff(1); + rb2v = constr.rbBareVisDiff(2); + rf1 = constr.rfBareSolDiff(1); + rf2 = constr.rfBareSolDiff(2); + rf1v = constr.rfBareVisDiff(1); + rf2v = constr.rfBareVisDiff(2); + + if (NGlass == 2) { + + // Front incident solar, beam, between-glass shade, NGlass = 2 + + for (int IPhi = 1; IPhi <= 10; ++IPhi) { + t1 = tBareSolPhi(1, IPhi); + t1v = tBareVisPhi(1, IPhi); + af1 = afBareSolPhi(1, IPhi); + ab1 = abBareSolPhi(1, IPhi); + tsolPhi(IPhi) = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * td2; + tvisPhi(IPhi) = t1v * (tshv + rshv * rb1v * tshv + tshv * rf2v * rshv) * td2v; + solabsShadePhi(IPhi) = t1 * (ash + rsh * rb1 + tsh * rf2) * ash; + solabsPhi(1, IPhi) = af1 + t1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * abd1; + solabsPhi(2, IPhi) = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; + } // End of loop over incidence angles + + // Front incident solar, diffuse, between-glass shade, NGlass = 2 + + constr.TransDiff = td1 * (tsh + rsh * rb1 * tsh + tsh * rb2 * rsh) * td2; + constr.TransDiffVis = td1v * (tshv + rshv * rb1v * tshv + tshv * rb2v * rshv) * td2v; + constr.AbsDiffShade = td1 * (ash + rsh * rb1 * ash + tsh * rf2 * ash); + constr.AbsDiff(1) = afd1 + td1 * (rsh + tsh * rb2 * tsh) * abd1; + constr.AbsDiff(2) = td1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; + constr.ReflectSolDiffFront = rf1 + td1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * td1; + constr.ReflectVisDiffFront = rf1v + td1v * (rshv + rshv * rb1v * rshv + tshv * rf2v * tshv) * td1v; + + // Back incident solar, diffuse, between-glass shade, NGlass = 2 + + constr.AbsDiffBackShade = td2 * (ash + rsh * rf2 * ash + tsh * rb1 * ash); + constr.AbsDiffBack(1) = td2 * (tsh + rsh * rf2 * tsh + tsh * rb1 * rsh) * abd1; + constr.AbsDiffBack(2) = abd2 + td2 * (rsh + rsh * rf2 * rsh + tsh * rb1 * tsh) * afd2; + constr.ReflectSolDiffBack = rb2 + td2 * (rsh + rsh * rf2 * rsh + tsh * rb1 * tsh) * td2; + constr.ReflectVisDiffBack = rb2v + td2v * (rshv + rshv * rf2v * rshv + tshv * rb1v * tshv) * td2v; + + } else if (NGlass == 3) { + + td3 = constr.tBareSolDiff(3); + td3v = constr.tBareVisDiff(3); + afd3 = constr.afBareSolDiff(3); + abd3 = constr.abBareSolDiff(3); + rb3 = constr.rbBareSolDiff(3); + rb3v = constr.rbBareVisDiff(3); + rf3 = constr.rfBareSolDiff(3); + rf3v = constr.rfBareVisDiff(3); + + // Front incident solar, beam, between-glass shade, NGlass = 3 + + for (int IPhi = 1; IPhi <= 10; ++IPhi) { + t1 = tBareSolPhi(1, IPhi); + t1v = tBareVisPhi(1, IPhi); + t2 = tBareSolPhi(2, IPhi); + t2v = tBareVisPhi(2, IPhi); + af1 = afBareSolPhi(1, IPhi); + af2 = afBareSolPhi(2, IPhi); + ab1 = abBareSolPhi(1, IPhi); + ab2 = abBareSolPhi(2, IPhi); + rbmf2 = max(0.0, 1.0 - (t2 + af2)); + + tsolPhi(IPhi) = t1 * t2 * (tsh + tsh * rf3 * rsh + rsh * td2 * rb1 * td2 * tsh + rsh * rb2 * tsh) * td3; + tvisPhi(IPhi) = t1v * t2v * (tshv + tshv * rf3v * rshv + rshv * td2v * rb1v * td2v * tshv + rshv * rb2v * tshv) * td3v; + solabsShadePhi(IPhi) = t1 * t2 * (1 + rsh * td2 * rb1 * td2 + rsh * rb2) * ash; + solabsPhi(1, IPhi) = af1 + rbmf2 * ab1 + t1 * t2 * rsh * (1 + rf3 * tsh + rb2 * rsh + td2 * rb1 * td2 * rsh) * td2 * abd1; + solabsPhi(2, IPhi) = t1 * af2 + t1 * t2 * ((rsh + tsh * rf3 * tsh + rsh * rb2 * rsh) * abd2 + rsh * td2 * rb1 * afd2); + solabsPhi(3, IPhi) = t1 * t2 * (tsh + rsh * (rb2 * tsh + td2 * rb2 * td2 * tsh + rf3 * rsh)) * afd3; + } // End of loop over incidence angle + + // Front incident solar, diffuse, between-glass shade, NGlass = 3 + + constr.TransDiff = td1 * td2 * (tsh + rsh * td2 * rb1 * td2 * tsh + rsh * rb2 * tsh + tsh * rf3 * rsh) * td3; + constr.TransDiffVis = td1v * td2v * (tshv + rshv * td2v * rb1v * td2v * tshv + rshv * rb2v * tshv + tshv * rf3v * rshv) * td3v; + constr.AbsDiffShade = td1 * td2 * (ash * (1 + rsh * td2 * rb1 * td2 + rsh * rb2 * ash) + tsh * rf3 * ash); + constr.AbsDiff(1) = + afd1 + td1 * (rf2 + td2 * (rsh + rsh * rb2 * rsh + tsh * rf3 * tsh + rsh * td2 * rb1 * td2 * rsh) * td2) * abd1; + constr.AbsDiff(2) = td1 * (afd2 + td2 * (rsh + rsh * rb2 * rsh + tsh * rf3 * tsh) * abd2); + constr.AbsDiff(3) = td1 * td2 * (tsh + rsh * rb2 * tsh + rsh * td2 * rb1 * td2 * tsh + tsh * rf3 * rsh) * afd3; + constr.ReflectSolDiffFront = + rf1 + td1 * rf2 * td1 + td1 * td2 * (rsh + tsh * rf3 * tsh + rsh * rb2 * rsh + rsh * td2 * rb1 * td2 * rsh) * td2 * td1; + constr.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 + + constr.AbsDiffBackShade = td3 * ((1 + rsh * rf3) * ash + (tsh * td2 * rb1 * td2 + tsh * rb2) * ash); + constr.AbsDiffBack(1) = td3 * (tsh + rsh * rf3 * tsh + tsh * rb2 * rsh + tsh * td2 * rb1 * td2 * rsh) * td2 * abd1; + constr.AbsDiffBack(2) = td3 * ((tsh + rsh * rf3 * tsh) * abd2 + (tsh * td2 * rb1 * td2 + tsh * rb2) * afd2); + constr.AbsDiffBack(3) = abd3 + td3 * (rsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * afd3; + constr.ReflectSolDiffBack = rb3 + td3 * (rsh + rsh * rf3 * rsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * td3; + constr.ReflectVisDiffBack = + rb3v + td3v * (rshv + rshv * rf3 * rshv + tshv * rb2v * tshv + tshv * td2v * rb1v * td2v * tshv) * td3v; + + } // End of check if NGlass = 3 + + // Interior blind + } else if (IntBlind) { + auto const *matBlind = dynamic_cast(s_mat->materials(BlNum)); + + for (int iSlatAng = 0; iSlatAng < Material::MaxSlatAngs; ++iSlatAng) { + auto const &btar = matBlind->TARs[iSlatAng]; + ShadeTrans = btar.Sol.Ft.Df.Tra; + ShadeTransGnd = btar.Sol.Ft.Df.TraGnd; + ShadeTransSky = btar.Sol.Ft.Df.TraSky; + ShadeTransVis = btar.Vis.Ft.Df.Tra; + ShadeAbs = btar.Sol.Ft.Df.Abs; + ShadeRefl = btar.Sol.Ft.Df.Ref; + ShadeReflGnd = btar.Sol.Ft.Df.RefGnd; + ShadeReflSky = btar.Sol.Ft.Df.RefSky; + ShadeReflVis = btar.Vis.Ft.Df.Ref; - if (ExtBlind) { - for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - thisConstruct.BlAbsDiffBack(ISlatAng, IGlass) = - thisConstruct.AbsDiffBack(IGlass) + tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); - } - thisConstruct.AbsDiffBackBlind(ISlatAng) = tsolDiff * ShadeReflFac * ShadeAbs; - thisConstruct.BlReflectSolDiffBack(ISlatAng) = thisConstruct.ReflectSolDiffBack + tsolDiff_2 * ShadeRefl * ShadeReflFac; - thisConstruct.BlReflectVisDiffBack(ISlatAng) = - thisConstruct.ReflectVisDiffBack + tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; - } - if (ExtShade || ExtScreen) { - for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - thisConstruct.AbsDiffBack(IGlass) += tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); - } - thisConstruct.AbsDiffBackShade = tsolDiff * ShadeReflFac * ShadeAbs; - thisConstruct.ReflectSolDiffBack += tsolDiff_2 * ShadeRefl * ShadeReflFac; - thisConstruct.ReflectVisDiffBack += tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; - } + // Correction factors for inter-reflections between glass and shading device + ShadeReflFac = 1.0 / (1.0 - ShadeRefl * thisConstruct.ReflectSolDiffBack); + ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * thisConstruct.ReflectVisDiffBack); + + // Front incident solar, diffuse, interior blind + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + auto &dfAbs = constr.layerSlatBlindDfAbs(IGlass)[iSlatAng]; + dfAbs.Sol.Ft.Df.Abs = constr.AbsDiff(IGlass) + tsolDiff * ShadeRefl * ShadeReflFac * constr.AbsDiffBack(IGlass); + dfAbs.Sol.Ft.Df.AbsGnd = constr.AbsDiff(IGlass) + tsolDiff * ShadeReflGnd * ShadeReflFac * constr.AbsDiffBack(IGlass); + dfAbs.Sol.Ft.Df.AbsSky = constr.AbsDiff(IGlass) + tsolDiff * ShadeReflSky * ShadeReflFac * constr.AbsDiffBack(IGlass); + } - } // End check if exterior shade, screen or blind + auto &cbtar = constr.blindTARs[iSlatAng]; - if (IntShade || IntBlind) { // Interior shade or blind + cbtar.Sol.Ft.Df.Abs = tsolDiff * ShadeReflFac * ShadeAbs; + cbtar.Sol.Ft.Df.AbsGnd = tsolDiff * ShadeReflFac * btar.Sol.Ft.Df.AbsGnd; + cbtar.Sol.Ft.Df.AbsSky = tsolDiff * ShadeReflFac * btar.Sol.Ft.Df.AbsSky; + cbtar.Sol.Ft.Df.Tra = tsolDiff * ShadeReflFac * ShadeTrans; + cbtar.Sol.Ft.Df.TraGnd = tsolDiff * ShadeReflFac * ShadeTransGnd; + cbtar.Sol.Ft.Df.TraSky = tsolDiff * ShadeReflFac * ShadeTransSky; + cbtar.Vis.Ft.Df.Tra = tvisDiff * ShadeReflFacVis * ShadeTransVis; + cbtar.Sol.Ft.Df.Ref = constr.ReflectSolDiffFront + tsolDiff_2 * ShadeRefl * ShadeReflFac; + cbtar.Vis.Ft.Df.Ref = constr.ReflectVisDiffFront + tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; - // Front incident solar, beam, interior shade + // Back incident solar, diffuse, interior blind - if (IntShade) { - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - solabsPhi(IGlass, IPhi) += tsolPhi(IPhi) * ShadeRefl * ShadeReflFac * thisConstruct.AbsDiffBack(IGlass); - } - solabsShadePhi(IPhi) = tsolPhi(IPhi) * ShadeReflFac * ShadeAbs; - tsolPhi(IPhi) *= ShadeReflFac * ShadeTrans; - tvisPhi(IPhi) *= ShadeReflFacVis * ShadeTransVis; - } - } // End of check if interior shade - - // Front incident solar, diffuse, interior blind - - if (IntBlind) { - for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - thisConstruct.BlAbsDiff(ISlatAng, IGlass) = - thisConstruct.AbsDiff(IGlass) + tsolDiff * ShadeRefl * ShadeReflFac * thisConstruct.AbsDiffBack(IGlass); - thisConstruct.BlAbsDiffGnd(ISlatAng, IGlass) = - thisConstruct.AbsDiff(IGlass) + tsolDiff * ShadeReflGnd * ShadeReflFac * thisConstruct.AbsDiffBack(IGlass); - thisConstruct.BlAbsDiffSky(ISlatAng, IGlass) = - thisConstruct.AbsDiff(IGlass) + tsolDiff * ShadeReflSky * ShadeReflFac * thisConstruct.AbsDiffBack(IGlass); - } + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + auto &dfAbs = constr.layerSlatBlindDfAbs(IGlass)[iSlatAng]; + dfAbs.Sol.Bk.Df.Abs = constr.AbsDiffBack(IGlass) * ShadeTrans * ShadeReflFac; + } - auto const &blind = state.dataMaterial->Blind(BlNum); - thisConstruct.AbsDiffBlind(ISlatAng) = tsolDiff * ShadeReflFac * ShadeAbs; - thisConstruct.AbsDiffBlindGnd(ISlatAng) = tsolDiff * ShadeReflFac * blind.SolFrontDiffAbsGnd(ISlatAng); - thisConstruct.AbsDiffBlindSky(ISlatAng) = tsolDiff * ShadeReflFac * blind.SolFrontDiffAbsSky(ISlatAng); - thisConstruct.BlTransDiff(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTrans; - thisConstruct.BlTransDiffGnd(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransGnd; - thisConstruct.BlTransDiffSky(ISlatAng) = tsolDiff * ShadeReflFac * ShadeTransSky; - thisConstruct.BlTransDiffVis(ISlatAng) = tvisDiff * ShadeReflFacVis * ShadeTransVis; - thisConstruct.BlReflectSolDiffFront(ISlatAng) = thisConstruct.ReflectSolDiffFront + tsolDiff_2 * ShadeRefl * ShadeReflFac; - thisConstruct.BlReflectVisDiffFront(ISlatAng) = - thisConstruct.ReflectVisDiffFront + tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; - - // Back incident solar, diffuse, interior blind - - for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - thisConstruct.BlAbsDiffBack(ISlatAng, IGlass) = thisConstruct.AbsDiffBack(IGlass) * ShadeTrans * ShadeReflFac; - } + cbtar.Sol.Bk.Df.Abs = btar.Sol.Bk.Df.Abs + ShadeTrans * ShadeReflFac * constr.ReflectSolDiffBack * ShadeAbs; + cbtar.Sol.Bk.Df.Ref = btar.Sol.Bk.Df.Ref + pow_2(ShadeTrans) * constr.ReflectSolDiffBack * ShadeReflFac; + cbtar.Vis.Bk.Df.Ref = btar.Vis.Bk.Df.Ref + pow_2(ShadeTransVis) * constr.ReflectVisDiffBack * ShadeReflFacVis; + } - thisConstruct.AbsDiffBackBlind(ISlatAng) = - blind.SolBackDiffAbs(ISlatAng) + ShadeTrans * ShadeReflFac * thisConstruct.ReflectSolDiffBack * ShadeAbs; - thisConstruct.BlReflectSolDiffBack(ISlatAng) = - blind.SolBackDiffDiffRefl(ISlatAng) + pow_2(ShadeTrans) * thisConstruct.ReflectSolDiffBack * ShadeReflFac; - thisConstruct.BlReflectVisDiffBack(ISlatAng) = - blind.VisBackDiffDiffRefl(ISlatAng) + pow_2(ShadeTransVis) * thisConstruct.ReflectVisDiffBack * ShadeReflFacVis; - } // End of check if interior blind + // Exterior blind + } else if (ExtBlind) { + auto const *matBlind = dynamic_cast(s_mat->materials(BlNum)); - // Front incident solar, diffuse, interior shade + for (int iSlatAng = 0; iSlatAng < Material::MaxSlatAngs; ++iSlatAng) { + auto const &btar = matBlind->TARs[iSlatAng]; + ShadeTrans = btar.Sol.Ft.Df.Tra; + ShadeTransGnd = btar.Sol.Ft.Df.TraGnd; + ShadeTransSky = btar.Sol.Ft.Df.TraSky; + ShadeTransVis = btar.Vis.Ft.Df.Tra; + ShadeAbs = btar.Sol.Bk.Df.Abs; + ShadeRefl = btar.Sol.Bk.Df.Ref; + ShadeReflVis = btar.Vis.Bk.Df.Ref; - if (IntShade) { - for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - thisConstruct.AbsDiff(IGlass) += tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); - } + // Correction factors for inter-reflections between glass and shading device + ShadeReflFac = 1.0 / (1.0 - ShadeRefl * constr.ReflectSolDiffFront); + ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffFront); + + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + auto &dfAbs = constr.layerSlatBlindDfAbs(IGlass)[iSlatAng]; + dfAbs.Sol.Ft.Df.Abs = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); + dfAbs.Sol.Ft.Df.AbsGnd = ShadeTransGnd * ShadeReflFac * solabsDiff(IGlass); + dfAbs.Sol.Ft.Df.AbsSky = ShadeTransSky * ShadeReflFac * solabsDiff(IGlass); + } - thisConstruct.AbsDiffShade = tsolDiff * ShadeReflFac * ShadeAbs; - thisConstruct.TransDiff = tsolDiff * ShadeReflFac * ShadeTrans; - thisConstruct.TransDiffVis = tvisDiff * ShadeReflFacVis * ShadeTransVis; - thisConstruct.ReflectSolDiffFront += tsolDiff_2 * ShadeRefl * ShadeReflFac; - thisConstruct.ReflectVisDiffFront += tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; + auto &cbtar = constr.blindTARs[iSlatAng]; + cbtar.Sol.Ft.Df.Abs = btar.Sol.Ft.Df.Abs + ShadeTrans * ShadeReflFac * thisConstruct.ReflectSolDiffFront * ShadeAbs; + cbtar.Sol.Ft.Df.AbsGnd = btar.Sol.Ft.Df.AbsGnd + ShadeTransGnd * ShadeReflFac * thisConstruct.ReflectSolDiffFront * ShadeAbs; + cbtar.Sol.Ft.Df.AbsSky = btar.Sol.Ft.Df.AbsSky + ShadeTransSky * ShadeReflFac * thisConstruct.ReflectSolDiffFront * ShadeAbs; + cbtar.Sol.Ft.Df.Tra = tsolDiff * ShadeReflFac * ShadeTrans; + cbtar.Sol.Ft.Df.TraGnd = tsolDiff * ShadeReflFac * ShadeTransGnd; + cbtar.Sol.Ft.Df.TraSky = tsolDiff * ShadeReflFac * ShadeTransSky; + cbtar.Vis.Ft.Df.Tra = tvisDiff * ShadeReflFacVis * ShadeTransVis; + cbtar.Sol.Ft.Df.Ref = ShadeRefl + pow_2(ShadeTrans) * thisConstruct.ReflectSolDiffFront * ShadeReflFac; + cbtar.Vis.Ft.Df.Ref = ShadeReflVis + pow_2(ShadeTransVis) * thisConstruct.ReflectVisDiffFront * ShadeReflFacVis; + + // Back incident solar, diffuse, exterior shade/blind + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + auto &dfAbs = constr.layerSlatBlindDfAbs(IGlass)[iSlatAng]; + dfAbs.Sol.Bk.Df.Abs = constr.AbsDiffBack(IGlass) + tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); + } - // Back incident solar, diffuse, interior shade + cbtar.Sol.Bk.Df.Abs = tsolDiff * ShadeReflFac * ShadeAbs; + cbtar.Sol.Bk.Df.Ref = constr.ReflectSolDiffBack + tsolDiff_2 * ShadeRefl * ShadeReflFac; + cbtar.Vis.Bk.Df.Ref = constr.ReflectVisDiffBack + tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; + } - for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - thisConstruct.AbsDiffBack(IGlass) *= ShadeTrans * ShadeReflFac; - } + // Between-glass blind + } else if (BGBlind) { + auto const *matBlind = dynamic_cast(s_mat->materials(BlNum)); + assert(matBlind != nullptr); + + // Between-glass shade/blind; assumed to be between glass #2 and glass #3 + tsh2 = pow_2(tsh); + tshv2 = pow_2(tshv); + td1 = constr.tBareSolDiff(1); + td2 = constr.tBareSolDiff(2); + td1v = constr.tBareVisDiff(1); + td2v = constr.tBareVisDiff(2); + afd1 = constr.afBareSolDiff(1); + afd2 = constr.afBareSolDiff(2); + abd1 = constr.abBareSolDiff(1); + abd2 = constr.abBareSolDiff(2); + rb1 = constr.rbBareSolDiff(1); + rb2 = constr.rbBareSolDiff(2); + rb1v = constr.rbBareVisDiff(1); + rb2v = constr.rbBareVisDiff(2); + rf1 = constr.rfBareSolDiff(1); + rf2 = constr.rfBareSolDiff(2); + rf1v = constr.rfBareVisDiff(1); + rf2v = constr.rfBareVisDiff(2); + + for (int iSlatAng = 0; iSlatAng < Material::MaxSlatAngs; ++iSlatAng) { + auto const &btar = matBlind->TARs[iSlatAng]; + tsh = btar.Sol.Ft.Df.Tra; + tshGnd = btar.Sol.Ft.Df.TraGnd; + tshSky = btar.Sol.Ft.Df.TraSky; + tshv = btar.Vis.Ft.Df.Tra; + rfsh = btar.Sol.Ft.Df.Ref; + rfshGnd = btar.Sol.Ft.Df.RefGnd; + rfshSky = btar.Sol.Ft.Df.RefSky; + rfshv = btar.Vis.Ft.Df.Ref; + rbsh = btar.Sol.Bk.Df.Ref; + rbshv = btar.Vis.Bk.Df.Ref; + afsh = btar.Sol.Ft.Df.Abs; + afshGnd = btar.Sol.Ft.Df.AbsGnd; + afshSky = btar.Sol.Ft.Df.AbsSky; + absh = btar.Sol.Bk.Df.Abs; + + auto &cbtar = constr.blindTARs[iSlatAng]; + if (NGlass == 2) { + // Front incident solar, diffuse, between-glass blind, NGlass = 2 + auto &dfAbs1 = constr.layerSlatBlindDfAbs(1)[iSlatAng]; + auto &dfAbs2 = constr.layerSlatBlindDfAbs(2)[iSlatAng]; + dfAbs1.Sol.Ft.Df.Abs = afd1 + td1 * (rfsh + rfsh * rb1 * rfsh + tsh * rb2 * tsh) * abd1; + dfAbs1.Sol.Ft.Df.AbsGnd = afd1 + td1 * (rfshGnd + rfshGnd * rb1 * rfshGnd + tshGnd * rb2 * tsh) * abd1; + dfAbs1.Sol.Ft.Df.AbsSky = afd1 + td1 * (rfshSky + rfshSky * rb1 * rfshSky + tshSky * rb2 * tsh) * abd1; + dfAbs2.Sol.Ft.Df.Abs = td1 * (tsh + rfsh * rb1 * tsh + tsh * rf2 * rbsh) * afd2; + dfAbs2.Sol.Ft.Df.AbsGnd = td1 * (tshGnd + rfshGnd * rb1 * tsh + tshGnd * rf2 * rbsh) * afd2; + dfAbs2.Sol.Ft.Df.AbsSky = td1 * (tshSky + rfshSky * rb1 * tsh + tshSky * rf2 * rbsh) * afd2; + cbtar.Sol.Ft.Df.Abs = td1 * (afsh + rfsh * rb1 * afsh + tsh * rf2 * absh); + cbtar.Sol.Ft.Df.AbsGnd = td1 * (afshGnd + rfsh * rb1 * afsh + tshGnd * rf2 * absh); + cbtar.Sol.Ft.Df.AbsSky = td1 * (afshSky + rfsh * rb1 * afsh + tshSky * rf2 * absh); + cbtar.Sol.Ft.Df.Tra = td1 * (tsh + rfsh * rb1 * tsh + tsh * rb2 * rbsh) * td2; + cbtar.Sol.Ft.Df.TraGnd = td1 * (tshGnd + rfsh * rb1 * tshGnd + tshGnd * rb2 * rbsh) * td2; + cbtar.Sol.Ft.Df.TraSky = td1 * (tshSky + rfsh * rb1 * tshSky + tshSky * rb2 * rbsh) * td2; + cbtar.Vis.Ft.Df.Tra = td1v * (tshv + rfshv * rb1v * tshv + tshv * rb2v * rbshv) * td2v; + cbtar.Sol.Ft.Df.Ref = rf1 + td1 * (rfsh + rfsh * rb1 * rfsh + tsh * rf2 * tsh) * td1; + cbtar.Vis.Ft.Df.Ref = rf1v + td1v * (rfshv + rfshv * rb1v * rfshv + tshv * rf2v * tshv) * td1v; + + // Back incident solar, diffuse, between-glass blind, NGlass = 2 + + dfAbs1.Sol.Bk.Df.Abs = td2 * (tsh + rbsh * rf2 * tsh + tsh * rb1 * rfsh) * abd1; + dfAbs2.Sol.Bk.Df.Abs = abd2 + td2 * (rbsh + rbsh * rf2 * rbsh + tsh * rb1 * tsh) * afd2; + cbtar.Sol.Bk.Df.Abs = td2 * (absh + rbsh * rf2 * absh + tsh * rb1 * afsh); + cbtar.Sol.Bk.Df.Ref = rb2 + td2 * (rbsh + rbsh * rf2 * rbsh + tsh * rb1 * tsh) * td2; + cbtar.Vis.Bk.Df.Ref = rb2v + td2v * (rbshv + rbshv * rf2v * rbshv + tshv * rb1v * tshv) * td2v; + + } else if (NGlass == 3) { + auto &dfAbs1 = constr.layerSlatBlindDfAbs(1)[iSlatAng]; + auto &dfAbs2 = constr.layerSlatBlindDfAbs(2)[iSlatAng]; + auto &dfAbs3 = constr.layerSlatBlindDfAbs(3)[iSlatAng]; + td3 = constr.tBareSolDiff(3); + td3v = constr.tBareVisDiff(3); + afd3 = constr.afBareSolDiff(3); + abd3 = constr.abBareSolDiff(3); + rb3 = constr.rbBareSolDiff(3); + rb3v = constr.rbBareVisDiff(3); + rf3 = constr.rfBareSolDiff(3); + rf3v = constr.rfBareVisDiff(3); + + // Front incident solar, diffuse, between-glass blind, NGlass = 3 + + dfAbs1.Sol.Ft.Df.Abs = + afd1 + td1 * (rf2 + td2 * (rfsh + rfsh * rb2 * rfsh + tsh * rf3 * tsh + rfsh * td2 * rb1 * td2 * rfsh) * td2) * abd1; + dfAbs1.Sol.Ft.Df.AbsGnd = + afd1 + + td1 * (rf2 + td2 * (rfshGnd + rfshGnd * rb2 * rfsh + tshGnd * rf3 * tsh + rfshGnd * td2 * rb1 * td2 * rfsh) * td2) * abd1; + dfAbs1.Sol.Ft.Df.AbsSky = + afd1 + + td1 * (rf2 + td2 * (rfshSky + rfshSky * rb2 * rfsh + tshSky * rf3 * tsh + rfshSky * td2 * rb1 * td2 * rfsh) * td2) * abd1; + dfAbs2.Sol.Ft.Df.Abs = td1 * (afd2 + td2 * (rfsh + rfsh * rb2 * rfsh + tsh * rf3 * tsh) * abd2); + dfAbs2.Sol.Ft.Df.AbsGnd = td1 * (afd2 + td2 * (rfshGnd + rfshGnd * rb2 * rfsh + tshGnd * rf3 * tsh) * abd2); + dfAbs2.Sol.Ft.Df.AbsSky = td1 * (afd2 + td2 * (rfshSky + rfshSky * rb2 * rfsh + tshSky * rf3 * tsh) * abd2); + dfAbs3.Sol.Ft.Df.Abs = td1 * td2 * (tsh + rfsh * rb2 * tsh + rfsh * td2 * rb1 * td2 * tsh + tsh * rf3 * rbsh) * afd3; + dfAbs3.Sol.Ft.Df.AbsGnd = + td1 * td2 * (tshGnd + rfshGnd * rb2 * tsh + rfshGnd * td2 * rb1 * td2 * tsh + tshGnd * rf3 * rbsh) * afd3; + dfAbs3.Sol.Ft.Df.AbsSky = + td1 * td2 * (tshSky + rfshSky * rb2 * tsh + rfshSky * td2 * rb1 * td2 * tsh + tshSky * rf3 * rbsh) * afd3; + cbtar.Sol.Ft.Df.Abs = td1 * td2 * (afsh * (1 + rfsh * td2 * rb1 * td2) + rfsh * rb2 * afsh + tsh * rf3 * absh); + cbtar.Sol.Ft.Df.AbsGnd = td1 * td2 * (afshGnd + afsh * rfsh * (td2 * rb1 * td2 + rb2) + tshGnd * rf3 * absh); + cbtar.Sol.Ft.Df.AbsSky = td1 * td2 * (afshSky + afsh * rfsh * (td2 * rb1 * td2 + rb2) + tshSky * rf3 * absh); + cbtar.Sol.Ft.Df.Tra = td1 * td2 * (tsh + rfsh * td2 * rb1 * td2 * tsh + rfsh * rb2 * tsh + tsh * rf3 * rbsh) * td3; + cbtar.Sol.Ft.Df.TraGnd = + td1 * td2 * (tshGnd + rfsh * td2 * rb1 * td2 * tshGnd + rfsh * rb2 * tshGnd + tshGnd * rf3 * rbsh) * td3; + cbtar.Sol.Ft.Df.TraSky = + td1 * td2 * (tshSky + rfsh * td2 * rb1 * td2 * tshSky + rfsh * rb2 * tshSky + tshSky * rf3 * rbsh) * td3; + cbtar.Vis.Ft.Df.Tra = + td1v * td2v * (tshv + rfshv * td2v * rb1v * td2v * tshv + rfshv * rb2v * tshv + tshv * rf3v * rbshv) * td3v; + cbtar.Sol.Ft.Df.Ref = rf1 + td1 * rf2 * td1 + + td1 * td2 * (rfsh + tsh * rf3 * tsh + rfsh * rb2 * rfsh + rfsh * td2 * rb1 * td2 * rfsh) * td2 * td1; + cbtar.Vis.Ft.Df.Ref = + 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 + + dfAbs1.Sol.Bk.Df.Abs = td3 * (tsh + rbsh * rf3 * tsh + tsh * rb2 * rfsh + tsh * td2 * rb1 * td2 * rfsh) * td2 * abd1; + dfAbs2.Sol.Bk.Df.Abs = td3 * ((tsh + rbsh * rf3 * tsh) * abd2 + (tsh * td2 * rb1 * td2 + tsh * rb2) * afd2); + dfAbs3.Sol.Bk.Df.Abs = abd3 + td3 * (rbsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * afd3; + cbtar.Sol.Bk.Df.Abs = td3 * ((1 + rbsh * rf3) * absh + (tsh * td2 * rb1 * td2 + tsh * rb2) * afsh); + cbtar.Sol.Bk.Df.Ref = rb3 + td3 * (rbsh + rbsh * rf3 * rbsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * td3; + cbtar.Vis.Bk.Df.Ref = + rb3v + td3v * (rbshv + rbshv * rf3v * rbshv + tshv * rb2v * tshv + tshv * td2v * rb1v * td2v * tshv) * td3v; + } // if (NGlass == 3) + } // for (iSlatAng) + + // Exterior screen + } else if (ExtScreen) { + // diffuse screen properties are calculated during initialization (quarter-hemispherical integration of beam properties) + auto const *matScreen = dynamic_cast(s_mat->materials(thisConstruct.LayerPoint(ShadeLayNum))); + assert(matScreen != nullptr); - thisConstruct.AbsDiffBackShade = ShadeAbs * (1 + ShadeTrans * ShadeReflFac * thisConstruct.ReflectSolDiffBack); - thisConstruct.ReflectSolDiffBack = ShadeRefl + pow_2(ShadeTrans) * thisConstruct.ReflectSolDiffBack * ShadeReflFac; - thisConstruct.ReflectVisDiffBack = - ShadeReflVis + pow_2(ShadeTransVis) * thisConstruct.ReflectVisDiffBack * ShadeReflFacVis; - } // End of check if interior shade - - } // End check if interior shade or blind - - if (BGShade || BGBlind) { // Between-glass shade/blind; assumed to be between glass #2 and glass #3 - - tsh2 = pow_2(tsh); - tshv2 = pow_2(tshv); - td1 = thisConstruct.tBareSolDiff(1); - td2 = thisConstruct.tBareSolDiff(2); - td1v = thisConstruct.tBareVisDiff(1); - td2v = thisConstruct.tBareVisDiff(2); - afd1 = thisConstruct.afBareSolDiff(1); - afd2 = thisConstruct.afBareSolDiff(2); - abd1 = thisConstruct.abBareSolDiff(1); - abd2 = thisConstruct.abBareSolDiff(2); - rb1 = thisConstruct.rbBareSolDiff(1); - rb2 = thisConstruct.rbBareSolDiff(2); - rb1v = thisConstruct.rbBareVisDiff(1); - rb2v = thisConstruct.rbBareVisDiff(2); - rf1 = thisConstruct.rfBareSolDiff(1); - rf2 = thisConstruct.rfBareSolDiff(2); - rf1v = thisConstruct.rfBareVisDiff(1); - rf2v = thisConstruct.rfBareVisDiff(2); - - if (BGShade) { - if (NGlass == 2) { - - // Front incident solar, beam, between-glass shade, NGlass = 2 - - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - t1 = tBareSolPhi(1, IPhi); - t1v = tBareVisPhi(1, IPhi); - af1 = afBareSolPhi(1, IPhi); - ab1 = abBareSolPhi(1, IPhi); - tsolPhi(IPhi) = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * td2; - tvisPhi(IPhi) = t1v * (tshv + rshv * rb1v * tshv + tshv * rf2v * rshv) * td2v; - solabsShadePhi(IPhi) = t1 * (ash + rsh * rb1 + tsh * rf2) * ash; - solabsPhi(1, IPhi) = af1 + t1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * abd1; - solabsPhi(2, IPhi) = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; - } // End of loop over incidence angles - - // Front incident solar, diffuse, between-glass shade, NGlass = 2 - - thisConstruct.TransDiff = td1 * (tsh + rsh * rb1 * tsh + tsh * rb2 * rsh) * td2; - thisConstruct.TransDiffVis = td1v * (tshv + rshv * rb1v * tshv + tshv * rb2v * rshv) * td2v; - thisConstruct.AbsDiffShade = td1 * (ash + rsh * rb1 * ash + tsh * rf2 * ash); - thisConstruct.AbsDiff(1) = afd1 + td1 * (rsh + tsh * rb2 * tsh) * abd1; - thisConstruct.AbsDiff(2) = td1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; - thisConstruct.ReflectSolDiffFront = rf1 + td1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * td1; - thisConstruct.ReflectVisDiffFront = rf1v + td1v * (rshv + rshv * rb1v * rshv + tshv * rf2v * tshv) * td1v; - - // Back incident solar, diffuse, between-glass shade, NGlass = 2 - - thisConstruct.AbsDiffBackShade = td2 * (ash + rsh * rf2 * ash + tsh * rb1 * ash); - thisConstruct.AbsDiffBack(1) = td2 * (tsh + rsh * rf2 * tsh + tsh * rb1 * rsh) * abd1; - thisConstruct.AbsDiffBack(2) = abd2 + td2 * (rsh + rsh * rf2 * rsh + tsh * rb1 * tsh) * afd2; - thisConstruct.ReflectSolDiffBack = rb2 + td2 * (rsh + rsh * rf2 * rsh + tsh * rb1 * tsh) * td2; - thisConstruct.ReflectVisDiffBack = rb2v + td2v * (rshv + rshv * rf2v * rshv + tshv * rb1v * tshv) * td2v; - - } // End of check if NGlass = 2 - - if (NGlass == 3) { - - td3 = thisConstruct.tBareSolDiff(3); - td3v = thisConstruct.tBareVisDiff(3); - afd3 = thisConstruct.afBareSolDiff(3); - abd3 = thisConstruct.abBareSolDiff(3); - rb3 = thisConstruct.rbBareSolDiff(3); - rb3v = thisConstruct.rbBareVisDiff(3); - rf3 = thisConstruct.rfBareSolDiff(3); - rf3v = thisConstruct.rfBareVisDiff(3); - - // Front incident solar, beam, between-glass shade, NGlass = 3 - - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - t1 = tBareSolPhi(1, IPhi); - t1v = tBareVisPhi(1, IPhi); - t2 = tBareSolPhi(2, IPhi); - t2v = tBareVisPhi(2, IPhi); - af1 = afBareSolPhi(1, IPhi); - af2 = afBareSolPhi(2, IPhi); - ab1 = abBareSolPhi(1, IPhi); - ab2 = abBareSolPhi(2, IPhi); - rbmf2 = max(0.0, 1.0 - (t2 + af2)); - - tsolPhi(IPhi) = t1 * t2 * (tsh + tsh * rf3 * rsh + rsh * td2 * rb1 * td2 * tsh + rsh * rb2 * tsh) * td3; - tvisPhi(IPhi) = - t1v * t2v * (tshv + tshv * rf3v * rshv + rshv * td2v * rb1v * td2v * tshv + rshv * rb2v * tshv) * td3v; - solabsShadePhi(IPhi) = t1 * t2 * (1 + rsh * td2 * rb1 * td2 + rsh * rb2) * ash; - solabsPhi(1, IPhi) = - af1 + rbmf2 * ab1 + t1 * t2 * rsh * (1 + rf3 * tsh + rb2 * rsh + td2 * rb1 * td2 * rsh) * td2 * abd1; - solabsPhi(2, IPhi) = - t1 * af2 + t1 * t2 * ((rsh + tsh * rf3 * tsh + rsh * rb2 * rsh) * abd2 + rsh * td2 * rb1 * afd2); - solabsPhi(3, IPhi) = t1 * t2 * (tsh + rsh * (rb2 * tsh + td2 * rb2 * td2 * tsh + rf3 * rsh)) * afd3; - } // End of loop over incidence angle - - // Front incident solar, diffuse, between-glass shade, NGlass = 3 - - thisConstruct.TransDiff = td1 * td2 * (tsh + rsh * td2 * rb1 * td2 * tsh + rsh * rb2 * tsh + tsh * rf3 * rsh) * td3; - thisConstruct.TransDiffVis = - td1v * td2v * (tshv + rshv * td2v * rb1v * td2v * tshv + rshv * rb2v * tshv + tshv * rf3v * rshv) * td3v; - thisConstruct.AbsDiffShade = td1 * td2 * (ash * (1 + rsh * td2 * rb1 * td2 + rsh * rb2 * ash) + tsh * rf3 * ash); - thisConstruct.AbsDiff(1) = - afd1 + td1 * (rf2 + td2 * (rsh + rsh * rb2 * rsh + tsh * rf3 * tsh + rsh * td2 * rb1 * td2 * rsh) * td2) * abd1; - thisConstruct.AbsDiff(2) = td1 * (afd2 + td2 * (rsh + rsh * rb2 * rsh + tsh * rf3 * tsh) * abd2); - thisConstruct.AbsDiff(3) = td1 * td2 * (tsh + rsh * rb2 * tsh + rsh * td2 * rb1 * td2 * tsh + tsh * rf3 * rsh) * afd3; - thisConstruct.ReflectSolDiffFront = - rf1 + td1 * rf2 * td1 + - td1 * td2 * (rsh + tsh * rf3 * tsh + rsh * rb2 * rsh + rsh * td2 * rb1 * td2 * rsh) * td2 * td1; - thisConstruct.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 - - thisConstruct.AbsDiffBackShade = td3 * ((1 + rsh * rf3) * ash + (tsh * td2 * rb1 * td2 + tsh * rb2) * ash); - thisConstruct.AbsDiffBack(1) = - td3 * (tsh + rsh * rf3 * tsh + tsh * rb2 * rsh + tsh * td2 * rb1 * td2 * rsh) * td2 * abd1; - thisConstruct.AbsDiffBack(2) = td3 * ((tsh + rsh * rf3 * tsh) * abd2 + (tsh * td2 * rb1 * td2 + tsh * rb2) * afd2); - thisConstruct.AbsDiffBack(3) = abd3 + td3 * (rsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * afd3; - thisConstruct.ReflectSolDiffBack = - rb3 + td3 * (rsh + rsh * rf3 * rsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * td3; - thisConstruct.ReflectVisDiffBack = - rb3v + td3v * (rshv + rshv * rf3 * rshv + tshv * rb2v * tshv + tshv * td2v * rb1v * td2v * tshv) * td3v; - - } // End of check if NGlass = 3 - - } // End of check if between-glass shade - - if (BGBlind) { - - if (NGlass == 2) { - - // Front incident solar, diffuse, between-glass blind, NGlass = 2 - - thisConstruct.BlAbsDiff(ISlatAng, 1) = afd1 + td1 * (rfsh + rfsh * rb1 * rfsh + tsh * rb2 * tsh) * abd1; - thisConstruct.BlAbsDiffGnd(ISlatAng, 1) = - afd1 + td1 * (rfshGnd + rfshGnd * rb1 * rfshGnd + tshGnd * rb2 * tsh) * abd1; - thisConstruct.BlAbsDiffSky(ISlatAng, 1) = - afd1 + td1 * (rfshSky + rfshSky * rb1 * rfshSky + tshSky * rb2 * tsh) * abd1; - thisConstruct.BlAbsDiff(ISlatAng, 2) = td1 * (tsh + rfsh * rb1 * tsh + tsh * rf2 * rbsh) * afd2; - thisConstruct.BlAbsDiffGnd(ISlatAng, 2) = td1 * (tshGnd + rfshGnd * rb1 * tsh + tshGnd * rf2 * rbsh) * afd2; - thisConstruct.BlAbsDiffSky(ISlatAng, 2) = td1 * (tshSky + rfshSky * rb1 * tsh + tshSky * rf2 * rbsh) * afd2; - thisConstruct.AbsDiffBlind(ISlatAng) = td1 * (afsh + rfsh * rb1 * afsh + tsh * rf2 * absh); - thisConstruct.AbsDiffBlindGnd(ISlatAng) = td1 * (afshGnd + rfsh * rb1 * afsh + tshGnd * rf2 * absh); - thisConstruct.AbsDiffBlindSky(ISlatAng) = td1 * (afshSky + rfsh * rb1 * afsh + tshSky * rf2 * absh); - thisConstruct.BlTransDiff(ISlatAng) = td1 * (tsh + rfsh * rb1 * tsh + tsh * rb2 * rbsh) * td2; - thisConstruct.BlTransDiffGnd(ISlatAng) = td1 * (tshGnd + rfsh * rb1 * tshGnd + tshGnd * rb2 * rbsh) * td2; - thisConstruct.BlTransDiffSky(ISlatAng) = td1 * (tshSky + rfsh * rb1 * tshSky + tshSky * rb2 * rbsh) * td2; - thisConstruct.BlTransDiffVis(ISlatAng) = td1v * (tshv + rfshv * rb1v * tshv + tshv * rb2v * rbshv) * td2v; - thisConstruct.BlReflectSolDiffFront(ISlatAng) = rf1 + td1 * (rfsh + rfsh * rb1 * rfsh + tsh * rf2 * tsh) * td1; - thisConstruct.BlReflectVisDiffFront(ISlatAng) = - rf1v + td1v * (rfshv + rfshv * rb1v * rfshv + tshv * rf2v * tshv) * td1v; - - // Back incident solar, diffuse, between-glass blind, NGlass = 2 - - thisConstruct.BlAbsDiffBack(ISlatAng, 1) = td2 * (tsh + rbsh * rf2 * tsh + tsh * rb1 * rfsh) * abd1; - thisConstruct.BlAbsDiffBack(ISlatAng, 2) = abd2 + td2 * (rbsh + rbsh * rf2 * rbsh + tsh * rb1 * tsh) * afd2; - thisConstruct.AbsDiffBackBlind(ISlatAng) = td2 * (absh + rbsh * rf2 * absh + tsh * rb1 * afsh); - thisConstruct.BlReflectSolDiffBack(ISlatAng) = rb2 + td2 * (rbsh + rbsh * rf2 * rbsh + tsh * rb1 * tsh) * td2; - thisConstruct.BlReflectVisDiffBack(ISlatAng) = - rb2v + td2v * (rbshv + rbshv * rf2v * rbshv + tshv * rb1v * tshv) * td2v; - - } // End of check if NGlass = 2 - - if (NGlass == 3) { - - td3 = thisConstruct.tBareSolDiff(3); - td3v = thisConstruct.tBareVisDiff(3); - afd3 = thisConstruct.afBareSolDiff(3); - abd3 = thisConstruct.abBareSolDiff(3); - rb3 = thisConstruct.rbBareSolDiff(3); - rb3v = thisConstruct.rbBareVisDiff(3); - rf3 = thisConstruct.rfBareSolDiff(3); - rf3v = thisConstruct.rfBareVisDiff(3); - - // Front incident solar, diffuse, between-glass blind, NGlass = 3 - - thisConstruct.BlAbsDiff(ISlatAng, 1) = - afd1 + - td1 * (rf2 + td2 * (rfsh + rfsh * rb2 * rfsh + tsh * rf3 * tsh + rfsh * td2 * rb1 * td2 * rfsh) * td2) * abd1; - thisConstruct.BlAbsDiffGnd(ISlatAng, 1) = - afd1 + - td1 * - (rf2 + td2 * (rfshGnd + rfshGnd * rb2 * rfsh + tshGnd * rf3 * tsh + rfshGnd * td2 * rb1 * td2 * rfsh) * td2) * - abd1; - thisConstruct.BlAbsDiffSky(ISlatAng, 1) = - afd1 + - td1 * - (rf2 + td2 * (rfshSky + rfshSky * rb2 * rfsh + tshSky * rf3 * tsh + rfshSky * td2 * rb1 * td2 * rfsh) * td2) * - abd1; - thisConstruct.BlAbsDiff(ISlatAng, 2) = td1 * (afd2 + td2 * (rfsh + rfsh * rb2 * rfsh + tsh * rf3 * tsh) * abd2); - thisConstruct.BlAbsDiffGnd(ISlatAng, 2) = - td1 * (afd2 + td2 * (rfshGnd + rfshGnd * rb2 * rfsh + tshGnd * rf3 * tsh) * abd2); - thisConstruct.BlAbsDiffSky(ISlatAng, 2) = - td1 * (afd2 + td2 * (rfshSky + rfshSky * rb2 * rfsh + tshSky * rf3 * tsh) * abd2); - thisConstruct.BlAbsDiff(ISlatAng, 3) = - td1 * td2 * (tsh + rfsh * rb2 * tsh + rfsh * td2 * rb1 * td2 * tsh + tsh * rf3 * rbsh) * afd3; - thisConstruct.BlAbsDiffGnd(ISlatAng, 3) = - td1 * td2 * (tshGnd + rfshGnd * rb2 * tsh + rfshGnd * td2 * rb1 * td2 * tsh + tshGnd * rf3 * rbsh) * afd3; - thisConstruct.BlAbsDiffSky(ISlatAng, 3) = - td1 * td2 * (tshSky + rfshSky * rb2 * tsh + rfshSky * td2 * rb1 * td2 * tsh + tshSky * rf3 * rbsh) * afd3; - thisConstruct.AbsDiffBlind(ISlatAng) = - td1 * td2 * (afsh * (1 + rfsh * td2 * rb1 * td2) + rfsh * rb2 * afsh + tsh * rf3 * absh); - thisConstruct.AbsDiffBlindGnd(ISlatAng) = - td1 * td2 * (afshGnd + afsh * rfsh * (td2 * rb1 * td2 + rb2) + tshGnd * rf3 * absh); - thisConstruct.AbsDiffBlindSky(ISlatAng) = - td1 * td2 * (afshSky + afsh * rfsh * (td2 * rb1 * td2 + rb2) + tshSky * rf3 * absh); - thisConstruct.BlTransDiff(ISlatAng) = - td1 * td2 * (tsh + rfsh * td2 * rb1 * td2 * tsh + rfsh * rb2 * tsh + tsh * rf3 * rbsh) * td3; - thisConstruct.BlTransDiffGnd(ISlatAng) = - td1 * td2 * (tshGnd + rfsh * td2 * rb1 * td2 * tshGnd + rfsh * rb2 * tshGnd + tshGnd * rf3 * rbsh) * td3; - thisConstruct.BlTransDiffSky(ISlatAng) = - td1 * td2 * (tshSky + rfsh * td2 * rb1 * td2 * tshSky + rfsh * rb2 * tshSky + tshSky * rf3 * rbsh) * td3; - thisConstruct.BlTransDiffVis(ISlatAng) = - td1v * td2v * (tshv + rfshv * td2v * rb1v * td2v * tshv + rfshv * rb2v * tshv + tshv * rf3v * rbshv) * td3v; - thisConstruct.BlReflectSolDiffFront(ISlatAng) = - rf1 + td1 * rf2 * td1 + - td1 * td2 * (rfsh + tsh * rf3 * tsh + rfsh * rb2 * rfsh + rfsh * td2 * rb1 * td2 * rfsh) * td2 * td1; - thisConstruct.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 - - thisConstruct.BlAbsDiffBack(ISlatAng, 1) = - td3 * (tsh + rbsh * rf3 * tsh + tsh * rb2 * rfsh + tsh * td2 * rb1 * td2 * rfsh) * td2 * abd1; - thisConstruct.BlAbsDiffBack(ISlatAng, 2) = - td3 * ((tsh + rbsh * rf3 * tsh) * abd2 + (tsh * td2 * rb1 * td2 + tsh * rb2) * afd2); - thisConstruct.BlAbsDiffBack(ISlatAng, 3) = abd3 + td3 * (rbsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * afd3; - thisConstruct.AbsDiffBackBlind(ISlatAng) = - td3 * ((1 + rbsh * rf3) * absh + (tsh * td2 * rb1 * td2 + tsh * rb2) * afsh); - thisConstruct.BlReflectSolDiffBack(ISlatAng) = - rb3 + td3 * (rbsh + rbsh * rf3 * rbsh + tsh * rb2 * tsh + tsh * td2 * rb1 * td2 * tsh) * td3; - thisConstruct.BlReflectVisDiffBack(ISlatAng) = - rb3v + td3v * (rbshv + rbshv * rf3v * rbshv + tshv * rb2v * tshv + tshv * td2v * rb1v * td2v * tshv) * td3v; - - } // End of check if NGlass = 3 - - } // End of check if between-glass blind - - } // End of check if between-glass shade or blind - - // Continue loop over slat angles only for blinds with variable slat angle - if (ShadeOn || ScreenOn) break; - if (BlindOn) { - auto const &blind = state.dataMaterial->Blind(BlNum); - if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) break; - } - } // End of slat angle loop - } // End of check if construction has a shade or blind + ShadeAbs = matScreen->DfAbs; + ShadeTrans = matScreen->DfTrans; + ShadeTransVis = matScreen->DfTransVis; + ShadeRefl = matScreen->DfRef; + ShadeReflVis = matScreen->DfRefVis; + rsh = ShadeRefl; + rshv = ShadeReflVis; + tsh = ShadeTrans; + tshv = ShadeTransVis; + ash = ShadeAbs; + + // Correction factors for inter-reflections between glass and shading device + ShadeReflFac = 1.0 / (1.0 - ShadeRefl * constr.ReflectSolDiffFront); + ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffFront); + + // Front incident solar, diffuse, exterior shade/screen/blind + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + constr.AbsDiff(IGlass) = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); + } + + // Front incident solar, diffuse, exterior shade/screen + constr.AbsDiffShade = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * constr.ReflectSolDiffFront); + constr.TransDiff = tsolDiff * ShadeReflFac * ShadeTrans; + constr.TransDiffVis = tvisDiff * ShadeReflFacVis * ShadeTransVis; + constr.ReflectSolDiffFront = ShadeRefl + pow_2(ShadeTrans) * constr.ReflectSolDiffFront * ShadeReflFac; + constr.ReflectVisDiffFront = ShadeReflVis + pow_2(ShadeTransVis) * constr.ReflectVisDiffFront * ShadeReflFacVis; + + // Back incident solar, diffuse, exterior shade/screen + for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { + constr.AbsDiffBack(IGlass) += tsolDiff * ShadeRefl * ShadeReflFac * solabsDiff(IGlass); + } + constr.AbsDiffBackShade = tsolDiff * ShadeReflFac * ShadeAbs; + constr.ReflectSolDiffBack += tsolDiff_2 * ShadeRefl * ShadeReflFac; + constr.ReflectVisDiffBack += tvisDiff_2 * ShadeReflVis * ShadeReflFacVis; + } // if (ExtScreen) // Curve fits to get solar transmittance, reflectance, layer absorptance and // visible transmittance as polynomials in cosine of incidence angle @@ -1471,76 +1487,66 @@ namespace Window { // interior blind/shade is deployed. // Loop for ordinary windows - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto const &surf = state.dataSurface->Surface(SurfNum); + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + auto const &surf = s_surf->Surface(SurfNum); if (!surf.HeatTransSurf) continue; if (!state.dataConstruction->Construct(surf.Construction).TypeIsWindow) continue; - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) continue; // Irrelevant for Complex Fen - if (state.dataConstruction->Construct(surf.Construction).WindowTypeEQL) continue; // not required + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) continue; // Irrelevant for Complex Fen + if (state.dataConstruction->Construct(surf.Construction).WindowTypeEQL) continue; // not required + ConstrNumSh = surf.activeShadedConstruction; if (ConstrNumSh == 0) continue; TotLay = state.dataConstruction->Construct(ConstrNumSh).TotLayers; - IntShade = false; - IntBlind = false; - auto const *thisMaterial = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay))); - assert(thisMaterial != nullptr); - if (thisMaterial->group == Material::Group::Shade) { - IntShade = true; - ShadeLayPtr = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay); - } - if (thisMaterial->group == Material::Group::WindowBlind) { - IntBlind = true; - BlNum = thisMaterial->BlindDataPtr; - } - if (IntShade || IntBlind) { - for (int ISlatAng = 1; ISlatAng <= Material::MaxSlatAngs; ++ISlatAng) { - if (IntShade || IntBlind) { - EpsGlIR = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay - 1))) - ->AbsorpThermalBack; - RhoGlIR = 1 - EpsGlIR; - } - if (IntShade) { - auto const *thisMaterialShade = dynamic_cast(state.dataMaterial->Material(ShadeLayPtr)); - TauShIR = thisMaterialShade->TransThermal; - EpsShIR = thisMaterialShade->AbsorpThermal; - RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); - state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[1] = - EpsShIR * (1.0 + RhoGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR)); - state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[1] = EpsGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR); - } - if (IntBlind) { - auto const &blind = state.dataMaterial->Blind(BlNum); - TauShIR = blind.IRFrontTrans(ISlatAng); - EpsShIR = blind.IRBackEmiss(ISlatAng); - RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); - state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[ISlatAng] = - EpsShIR * (1.0 + RhoGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR)); - state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[ISlatAng] = EpsGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR); - } - // Loop over remaining slat angles only if blind with movable slats - if (IntShade) break; // Loop over remaining slat angles only if blind - if (IntBlind) { - auto const &blind = state.dataMaterial->Blind(BlNum); + auto &surfShade = s_surf->surfShades(SurfNum); - if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) break; - } - } // End of slat angle loop - } // End of check if interior shade or interior blind - } // End of surface loop + auto const *mat = s_mat->materials(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay)); + auto const *matFen = dynamic_cast(mat); + assert(matFen != nullptr); - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto const &surf = state.dataSurface->Surface(SurfNum); + if (mat->group == Material::Group::Shade) { + Real64 EpsGlIR = s_mat->materials(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay - 1))->AbsorpThermalBack; + Real64 RhoGlIR = 1 - EpsGlIR; + Real64 TauShIR = matFen->TransThermal; + Real64 EpsShIR = matFen->AbsorpThermal; + Real64 RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); + surfShade.effShadeEmi = EpsShIR * (1.0 + RhoGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR)); + surfShade.effGlassEmi = EpsGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR); + + } else if (mat->group == Material::Group::Blind) { + auto const *matBlind = dynamic_cast(mat); + assert(matBlind != nullptr); + surfShade.glass.epsIR = s_mat->materials(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay - 1))->AbsorpThermalBack; + surfShade.glass.rhoIR = 1 - surfShade.glass.epsIR; + + // surfShade.blind has not been initialized yet + surfShade.blind.slatAngDeg = matBlind->SlatAngle; + surfShade.blind.slatAng = surfShade.blind.slatAngDeg * Constant::DegToRad; + + Material::GetSlatIndicesInterpFac( + surfShade.blind.slatAng, surfShade.blind.slatAngIdxLo, surfShade.blind.slatAngIdxHi, surfShade.blind.slatAngInterpFac); + surfShade.blind.TAR.interpSlatAng( + matBlind->TARs[surfShade.blind.slatAngIdxLo], matBlind->TARs[surfShade.blind.slatAngIdxHi], surfShade.blind.slatAngInterpFac); + + Real64 TauShIR = surfShade.blind.TAR.IR.Ft.Tra; + Real64 EpsShIR = surfShade.blind.TAR.IR.Bk.Emi; + Real64 RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); + surfShade.effShadeEmi = EpsShIR * (1.0 + surfShade.glass.rhoIR * TauShIR / (1.0 - surfShade.glass.rhoIR * RhoShIR)); + surfShade.effGlassEmi = surfShade.glass.epsIR * TauShIR / (1.0 - surfShade.glass.rhoIR * RhoShIR); + + } // End of check if interior shade or interior blind + } // End of surface loop + + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + auto const &surf = s_surf->Surface(SurfNum); if (surf.Construction <= 0) continue; auto const &construct = state.dataConstruction->Construct(surf.Construction); if (!construct.TypeIsWindow) continue; // Total thickness of glazing system (used in calculation of inside reveal reflection/absorption - state.dataSurface->SurfWinTotGlazingThickness(SurfNum) = 0.0; + s_surf->SurfWinTotGlazingThickness(SurfNum) = 0.0; for (int LayNum = 1; LayNum <= construct.TotLayers; ++LayNum) { - state.dataSurface->SurfWinTotGlazingThickness(SurfNum) += state.dataMaterial->Material(construct.LayerPoint(LayNum))->Thickness; + s_surf->SurfWinTotGlazingThickness(SurfNum) += s_mat->materials(construct.LayerPoint(LayNum))->Thickness; } // Sine and cosine of azimuth and tilt // SurfaceWindow(SurfNum)%SinAzim = Surface(SurfNum)%SinAzim @@ -1573,9 +1579,9 @@ namespace Window { W21 = W1 - W2; W23 = W3 - W2; if (Rectangle) { - state.dataSurface->SurfaceWindow(SurfNum).WinCenter = W2 + (W23 + W21) / 2.0; + s_surf->SurfaceWindow(SurfNum).WinCenter = W2 + (W23 + W21) / 2.0; } else if (Triangle) { - state.dataSurface->SurfaceWindow(SurfNum).WinCenter = W2 + (W23 + W21) / 3.0; + s_surf->SurfaceWindow(SurfNum).WinCenter = W2 + (W23 + W21) / 3.0; } } // End of surface loop @@ -1589,7 +1595,6 @@ namespace Window { // Initializes variables used in the window optical and thermal calculation. int ConstrNum; // Construction number - int FrDivNum; // Pointer to frame/divider Real64 FrWidth; // Window frame width {m} Real64 FrEdgeWidth; // Frame edge width {m} Real64 DivWidth; // Window divider width {m} @@ -1602,7 +1607,8 @@ namespace Window { int MatNum; // Material number int DifOverrideCount; // Count the number of SolarDiffusing material overrides - auto &wm = state.dataWindowManager; + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; for (int ConstrNum = 1; ConstrNum <= state.dataHeatBal->TotConstructs; ++ConstrNum) { auto &thisConstruct = state.dataConstruction->Construct(ConstrNum); @@ -1630,31 +1636,14 @@ namespace Window { } } - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - // For a window with shading device, get number of shaded construction and, if window - // has a blind (interior, exterior or between glass), get blind data pointer. - auto const &surf = state.dataSurface->Surface(SurfNum); - if (surf.HasShadeControl) { - for (int winShadCtrl : surf.windowShadingControlList) { - WinShadingType ShadingType = state.dataSurface->WindowShadingControl(winShadCtrl).ShadingType; - if (ShadingType == WinShadingType::ExtScreen) { - // Count number of exterior window screens, initialize in InitGlassOpticalCalculations after returning - // from this subroutine. The blind structure is initialized first and then the screen structure is initialized. - ++state.dataHeatBal->NumScreens; - break; // only need to find the first window shading control since they should be identical - } - } - } - } - // Set some static exterior-window frame and divider SurfaceWindow values // from values in FrameDivider derived type - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto const &surf = state.dataSurface->Surface(SurfNum); + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + auto const &surf = s_surf->Surface(SurfNum); if (surf.FrameDivider == 0) continue; - auto &surfWin = state.dataSurface->SurfaceWindow(SurfNum); - auto const &frdiv = state.dataSurface->FrameDivider(surf.FrameDivider); + auto &surfWin = s_surf->SurfaceWindow(SurfNum); + auto const &frdiv = s_surf->FrameDivider(surf.FrameDivider); FrWidth = frdiv.FrameWidth; GlHeight = surf.Height; @@ -1662,73 +1651,69 @@ namespace Window { NumVertDividers = frdiv.VertDividers; NumHorDividers = frdiv.HorDividers; BaseSurfNum = surf.BaseSurf; - state.dataSurface->SurfWinFrameConductance(SurfNum) = frdiv.FrameConductance; - state.dataSurface->SurfWinFrameSolAbsorp(SurfNum) = frdiv.FrameSolAbsorp; - state.dataSurface->SurfWinFrameVisAbsorp(SurfNum) = frdiv.FrameVisAbsorp; - state.dataSurface->SurfWinFrameEmis(SurfNum) = frdiv.FrameEmis; - state.dataSurface->SurfWinFrEdgeToCenterGlCondRatio(SurfNum) = frdiv.FrEdgeToCenterGlCondRatio; - state.dataSurface->SurfWinDividerType(SurfNum) = DataSurfaces::FrameDividerType::DividedLite; + s_surf->SurfWinFrameConductance(SurfNum) = frdiv.FrameConductance; + s_surf->SurfWinFrameSolAbsorp(SurfNum) = frdiv.FrameSolAbsorp; + s_surf->SurfWinFrameVisAbsorp(SurfNum) = frdiv.FrameVisAbsorp; + s_surf->SurfWinFrameEmis(SurfNum) = frdiv.FrameEmis; + s_surf->SurfWinFrEdgeToCenterGlCondRatio(SurfNum) = frdiv.FrEdgeToCenterGlCondRatio; + s_surf->SurfWinDividerType(SurfNum) = DataSurfaces::FrameDividerType::DividedLite; if (frdiv.DividerType == DataSurfaces::FrameDividerType::Suspended) - state.dataSurface->SurfWinDividerType(SurfNum) = DataSurfaces::FrameDividerType::Suspended; + s_surf->SurfWinDividerType(SurfNum) = DataSurfaces::FrameDividerType::Suspended; DivWidth = frdiv.DividerWidth; - state.dataSurface->SurfWinDividerConductance(SurfNum) = frdiv.DividerConductance; - state.dataSurface->SurfWinDividerSolAbsorp(SurfNum) = frdiv.DividerSolAbsorp; - state.dataSurface->SurfWinDividerVisAbsorp(SurfNum) = frdiv.DividerVisAbsorp; - state.dataSurface->SurfWinDividerEmis(SurfNum) = frdiv.DividerEmis; - state.dataSurface->SurfWinDivEdgeToCenterGlCondRatio(SurfNum) = frdiv.DivEdgeToCenterGlCondRatio; - - state.dataSurface->SurfWinOutsideRevealSolAbs(SurfNum) = frdiv.OutsideRevealSolAbs; - state.dataSurface->SurfWinInsideSillDepth(SurfNum) = frdiv.InsideSillDepth; - state.dataSurface->SurfWinInsideReveal(SurfNum) = frdiv.InsideReveal; - state.dataSurface->SurfWinInsideSillSolAbs(SurfNum) = frdiv.InsideSillSolAbs; - state.dataSurface->SurfWinInsideRevealSolAbs(SurfNum) = frdiv.InsideRevealSolAbs; + s_surf->SurfWinDividerConductance(SurfNum) = frdiv.DividerConductance; + s_surf->SurfWinDividerSolAbsorp(SurfNum) = frdiv.DividerSolAbsorp; + s_surf->SurfWinDividerVisAbsorp(SurfNum) = frdiv.DividerVisAbsorp; + s_surf->SurfWinDividerEmis(SurfNum) = frdiv.DividerEmis; + s_surf->SurfWinDivEdgeToCenterGlCondRatio(SurfNum) = frdiv.DivEdgeToCenterGlCondRatio; + + s_surf->SurfWinOutsideRevealSolAbs(SurfNum) = frdiv.OutsideRevealSolAbs; + s_surf->SurfWinInsideSillDepth(SurfNum) = frdiv.InsideSillDepth; + s_surf->SurfWinInsideReveal(SurfNum) = frdiv.InsideReveal; + s_surf->SurfWinInsideSillSolAbs(SurfNum) = frdiv.InsideSillSolAbs; + s_surf->SurfWinInsideRevealSolAbs(SurfNum) = frdiv.InsideRevealSolAbs; FrEdgeWidth = frdiv.FrameEdgeWidth; DivEdgeWidth = frdiv.DividerEdgeWidth; - state.dataSurface->SurfWinFrameEdgeArea(SurfNum) = + s_surf->SurfWinFrameEdgeArea(SurfNum) = 2 * FrEdgeWidth * (GlHeight - FrEdgeWidth - NumHorDividers * DivWidth + GlWidth - FrEdgeWidth - NumVertDividers * DivWidth); - state.dataSurface->SurfWinDividerEdgeArea(SurfNum) = + s_surf->SurfWinDividerEdgeArea(SurfNum) = 2 * DivEdgeWidth * (NumHorDividers * (GlWidth - 2 * FrEdgeWidth) + NumVertDividers * (GlHeight - 2 * FrEdgeWidth)) - NumHorDividers * NumVertDividers * (4 * pow_2(DivEdgeWidth) + 4 * FrEdgeWidth * DivWidth); - surfWin.centerGlassArea = - surf.Area - state.dataSurface->SurfWinFrameEdgeArea(SurfNum) - state.dataSurface->SurfWinDividerEdgeArea(SurfNum); + surfWin.centerGlassArea = surf.Area - s_surf->SurfWinFrameEdgeArea(SurfNum) - s_surf->SurfWinDividerEdgeArea(SurfNum); surfWin.edgeGlassCorrFac = - (state.dataSurface->SurfWinFrameEdgeArea(SurfNum) * state.dataSurface->SurfWinFrEdgeToCenterGlCondRatio(SurfNum) + - state.dataSurface->SurfWinDividerEdgeArea(SurfNum) * state.dataSurface->SurfWinDivEdgeToCenterGlCondRatio(SurfNum) + - surfWin.centerGlassArea) / - (state.dataSurface->SurfWinFrameEdgeArea(SurfNum) + state.dataSurface->SurfWinDividerEdgeArea(SurfNum) + surfWin.centerGlassArea); + (s_surf->SurfWinFrameEdgeArea(SurfNum) * s_surf->SurfWinFrEdgeToCenterGlCondRatio(SurfNum) + + s_surf->SurfWinDividerEdgeArea(SurfNum) * s_surf->SurfWinDivEdgeToCenterGlCondRatio(SurfNum) + surfWin.centerGlassArea) / + (s_surf->SurfWinFrameEdgeArea(SurfNum) + s_surf->SurfWinDividerEdgeArea(SurfNum) + surfWin.centerGlassArea); } // for (SurfNum) // Set SolarDiffusing to true for exterior windows that have a construction with an innermost diffusing glass layer DifOverrideCount = 0; - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto const &surf = state.dataSurface->Surface(SurfNum); - state.dataSurface->SurfWinSolarDiffusing(SurfNum) = false; - if (surf.Class != SurfaceClass::Window || surf.ExtBoundCond != ExternalEnvironment || - state.dataSurface->SurfWinStormWinConstr(SurfNum) != 0) + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + auto const &surf = s_surf->Surface(SurfNum); + s_surf->SurfWinSolarDiffusing(SurfNum) = false; + if (surf.Class != SurfaceClass::Window || surf.ExtBoundCond != ExternalEnvironment || s_surf->SurfWinStormWinConstr(SurfNum) != 0) continue; ConstrNum = surf.Construction; MatNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(state.dataConstruction->Construct(ConstrNum).TotLayers); - auto const *thisMaterial = dynamic_cast(state.dataMaterial->Material(MatNum)); - assert(thisMaterial != nullptr); + auto const *mat = s_mat->materials(MatNum); + if (mat->group != Material::Group::Glass) continue; - if (!thisMaterial->SolarDiffusing) continue; + if (!dynamic_cast(mat)->SolarDiffusing) continue; if (!surf.HasShadeControl) { - state.dataSurface->SurfWinSolarDiffusing(SurfNum) = true; - } else { // There is a shading control - if (state.dataSurface->WindowShadingControl(surf.activeWindowShadingControl).ShadingType == WinShadingType::SwitchableGlazing) { - state.dataSurface->SurfWinSolarDiffusing(SurfNum) = true; - } else { - state.dataSurface->SurfWinSolarDiffusing(SurfNum) = false; - ++DifOverrideCount; - if (state.dataGlobal->DisplayExtraWarnings) { - ShowWarningError(state, - format("W5InitGlassParameters: Window=\"{}\" has interior material with Solar Diffusing=Yes, but " - "existing Window Shading Device sets Diffusing=No.", - surf.Name)); - } + s_surf->SurfWinSolarDiffusing(SurfNum) = true; + // There is a shading control + } else if (s_surf->WindowShadingControl(surf.activeWindowShadingControl).ShadingType == WinShadingType::SwitchableGlazing) { + s_surf->SurfWinSolarDiffusing(SurfNum) = true; + } else { + s_surf->SurfWinSolarDiffusing(SurfNum) = false; + ++DifOverrideCount; + if (state.dataGlobal->DisplayExtraWarnings) { + ShowWarningError(state, + format("W5InitGlassParameters: Window=\"{}\" has interior material with Solar Diffusing=Yes, but " + "existing Window Shading Device sets Diffusing=No.", + surf.Name)); } } } // for (SurfNum) @@ -2091,16 +2076,13 @@ namespace Window { // SUBROUTINE ARGUMENT DEFINITIONS: // (temperature of innermost face) [C] - int BlNum; // Window blind number int SurfNumAdj; // An interzone surface's number in the adjacent zone int ZoneNumAdj; // An interzone surface's adjacent zone number int TotLay; // Total number of layers in a construction // (sum of solid layers and gap layers) int TotGlassLay; // Total number of glass layers in a construction - int Lay; // Layer number int LayPtr; // Material number for a layer WinShadingType ShadeFlag; // Flag indicating whether shade or blind is on, and shade/blind position - int k; // Layer counter // REAL(r64) :: tsky ! Sky temperature [K] int ShadeLayPtr; // Material number corresponding to a shade layer Real64 dth1; // Temperature difference across glass layers [K] @@ -2122,25 +2104,21 @@ namespace Window { Real64 locTCSpecTemp; // The temperature corresponding to the specified optical properties of the TC layer Real64 locTCLayerTemp; // TC layer temperature at each time step. C + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; auto &wm = state.dataWindowManager; - Real64 dT0(0.0); - Real64 dT1(0.0); Real64 SurfOutsideEmiss; // temporary for result of outside surface emissivity Real64 Tsout; // temporary for result of outside surface temp in Kelvin int temp; - Array1D deltaTemp(100, 0.0); - Array1D_int iMinDT(1, 0); - Array1D_int IDConst(100, 0); - // Shorthand references - auto &window = state.dataSurface->SurfaceWindow(SurfNum); - auto &surface = state.dataSurface->Surface(SurfNum); - int ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(surface.Zone); + auto &surf = s_surf->Surface(SurfNum); + auto &surfWin = s_surf->SurfaceWindow(SurfNum); + int ConstrNum = s_surf->SurfActiveConstruction(SurfNum); + auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(surf.Zone); - if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { + if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { temp = 0; @@ -2148,12 +2126,13 @@ namespace Window { CalcComplexWindowThermal( state, SurfNum, temp, HextConvCoeff, SurfInsideTemp, SurfOutsideTemp, SurfOutsideEmiss, DataBSDFWindow::Condition::Invalid); - TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; - wm->ngllayer = state.dataConstruction->Construct(ConstrNum).TotSolidLayers; // Simon: This is necessary to keep for frame calculations + auto &constr = state.dataConstruction->Construct(ConstrNum); + TotGlassLay = constr.TotGlassLayers; + wm->ngllayer = constr.TotSolidLayers; // Simon: This is necessary to keep for frame calculations // Simon: need to transfer surface temperatures because of frames calculation - for (int i = 1; i <= 2 * state.dataConstruction->Construct(ConstrNum).TotSolidLayers; ++i) { - wm->thetas[i - 1] = window.thetaFace[i]; + for (int i = 1; i <= 2 * constr.TotSolidLayers; ++i) { + wm->thetas[i - 1] = surfWin.thetaFace[i]; } wm->hcout = HextConvCoeff; wm->hcin = state.dataHeatBalSurf->SurfHConvInt(SurfNum); @@ -2161,100 +2140,83 @@ namespace Window { // This is code repeating and it is necessary to calculate report variables. Do not know // how to solve this in more elegant way :( - if (surface.ExtWind) { // Window is exposed to wind (and possibly rain) + if (surf.ExtWind) { // Window is exposed to wind (and possibly rain) if (state.dataEnvrn->IsRain) { // Raining: since wind exposed, outside window surface gets wet - wm->tout = state.dataSurface->SurfOutWetBulbTemp(SurfNum) + Constant::Kelvin; + wm->tout = s_surf->SurfOutWetBulbTemp(SurfNum) + Constant::Kelvin; } else { // Dry - wm->tout = state.dataSurface->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; + wm->tout = s_surf->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; } } else { // Window not exposed to wind - wm->tout = state.dataSurface->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; + wm->tout = s_surf->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; } wm->Ebout = Constant::StefanBoltzmann * pow_4(wm->tout); - wm->Outir = surface.ViewFactorSkyIR * - (state.dataSurface->SurfAirSkyRadSplit(SurfNum) * Constant::StefanBoltzmann * pow_4(state.dataEnvrn->SkyTempKelvin) + - (1.0 - state.dataSurface->SurfAirSkyRadSplit(SurfNum)) * wm->Ebout) + - surface.ViewFactorGroundIR * wm->Ebout; + wm->Outir = + surf.ViewFactorSkyIR * (s_surf->SurfAirSkyRadSplit(SurfNum) * Constant::StefanBoltzmann * pow_4(state.dataEnvrn->SkyTempKelvin) + + (1.0 - s_surf->SurfAirSkyRadSplit(SurfNum)) * wm->Ebout) + + surf.ViewFactorGroundIR * wm->Ebout; - } else if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { + } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { EQLWindowSurfaceHeatBalance( state, SurfNum, HextConvCoeff, SurfInsideTemp, SurfOutsideTemp, SurfOutsideEmiss, DataBSDFWindow::Condition::Invalid); wm->hcout = HextConvCoeff; // Required for report variables calculations. - if (surface.ExtWind) { // Window is exposed to wind (and possibly rain) + if (surf.ExtWind) { // Window is exposed to wind (and possibly rain) if (state.dataEnvrn->IsRain) { // Raining: since wind exposed, outside window surface gets wet - wm->tout = state.dataSurface->SurfOutWetBulbTemp(SurfNum) + Constant::Kelvin; + wm->tout = s_surf->SurfOutWetBulbTemp(SurfNum) + Constant::Kelvin; } else { // Dry - wm->tout = state.dataSurface->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; + wm->tout = s_surf->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; } } else { // Window not exposed to wind - wm->tout = state.dataSurface->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; + wm->tout = s_surf->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; } } else { // regular window, not BSDF, not EQL Window // Added for thermochromic windows - wm->locTCFlag = (state.dataConstruction->Construct(ConstrNum).TCFlag == 1); + auto &constr = state.dataConstruction->Construct(ConstrNum); + wm->locTCFlag = (constr.isTCWindow); if (wm->locTCFlag) { - auto const *thisMaterial = - dynamic_cast(state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).TCLayer)); - assert(thisMaterial != nullptr); - locTCSpecTemp = thisMaterial->SpecTemp; - state.dataSurface->SurfWinSpecTemp(SurfNum) = locTCSpecTemp; + locTCSpecTemp = constr.specTemp; + s_surf->SurfWinSpecTemp(SurfNum) = locTCSpecTemp; // Check to see whether needs to switch to a new TC window construction - locTCLayerTemp = state.dataSurface->SurfWinTCLayerTemp(SurfNum); - dT0 = std::abs(locTCLayerTemp - locTCSpecTemp); + locTCLayerTemp = s_surf->SurfWinTCLayerTemp(SurfNum); + Real64 dT0 = std::abs(locTCLayerTemp - locTCSpecTemp); if (dT0 >= 1) { + // Find the TC construction that is closed to the TCLayerTemp - int i = 0; - deltaTemp = 0.0; - IDConst = 0; - for (int k = 1; k <= state.dataHeatBal->TotConstructs; ++k) { - if (state.dataConstruction->Construct(k).TCMasterConst == state.dataConstruction->Construct(ConstrNum).TCMasterConst) { - dT1 = std::abs(locTCLayerTemp - dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(k).TCLayer)) - ->SpecTemp); - if (dT1 < dT0) { - ++i; - deltaTemp(i) = dT1; - IDConst(i) = k; - } + auto const &constrTCMaster = state.dataConstruction->Construct(constr.TCMasterConstrNum); + + for (int iTCConstr = 1; iTCConstr <= constrTCMaster.numTCChildConstrs; ++iTCConstr) { + Real64 dT1 = std::abs(locTCLayerTemp - constrTCMaster.TCChildConstrs(iTCConstr).specTemp); + + if (dT1 < dT0) { + surf.Construction = s_surf->SurfActiveConstruction(SurfNum) = constrTCMaster.TCChildConstrs(iTCConstr).constrNum; + s_surf->SurfWinSpecTemp(SurfNum) = constrTCMaster.TCChildConstrs(iTCConstr).specTemp; + dT0 = dT1; } } - if (i >= 1) { - // Find the closest item - iMinDT = minloc(deltaTemp, deltaTemp > 0.0); - // Use the new TC window construction - ConstrNum = IDConst(iMinDT(1)); - surface.Construction = ConstrNum; - state.dataSurface->SurfActiveConstruction(SurfNum) = ConstrNum; - state.dataSurface->SurfWinSpecTemp(SurfNum) = - dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).TCLayer)) - ->SpecTemp; - } } } // end new TC code - TotLay = state.dataConstruction->Construct(ConstrNum).TotLayers; - TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; + TotLay = constr.TotLayers; + TotGlassLay = constr.TotGlassLayers; wm->ngllayer = TotGlassLay; wm->nglface = 2 * wm->ngllayer; - ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); - wm->tilt = surface.Tilt; + ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); + wm->tilt = surf.Tilt; wm->tiltr = wm->tilt * Constant::DegToRadians; - SurfNumAdj = surface.ExtBoundCond; + SurfNumAdj = surf.ExtBoundCond; wm->hcin = state.dataHeatBalSurf->SurfHConvInt(SurfNum); // Room-side surface convective film conductance - Real64 RefAirTemp = state.dataSurface->Surface(SurfNum).getInsideAirTemperature(state, SurfNum); + Real64 RefAirTemp = s_surf->Surface(SurfNum).getInsideAirTemperature(state, SurfNum); state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = RefAirTemp; wm->tin = RefAirTemp + Constant::Kelvin; // Inside air temperature // Reset hcin if necessary since too small a value sometimes causes non-convergence // of window layer heat balance solution. - if (state.dataSurface->surfIntConv(SurfNum).model == Convect::HcInt::SetByZone) { + if (s_surf->surfIntConv(SurfNum).model == Convect::HcInt::SetByZone) { // may be redundent now, check is also in HeatBalanceConvectionCoeffs.cc if (wm->hcin <= state.dataHeatBal->LowHConvLimit) { // hcin = 3.076d0 !BG this is rather high value and abrupt change. changed to set to lower limit @@ -2264,7 +2226,7 @@ namespace Window { } // IR incident on window from zone surfaces and high-temp radiant sources - wm->Rmir = state.dataSurface->SurfWinIRfromParentZone(SurfNum) + state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(SurfNum); + wm->Rmir = s_surf->SurfWinIRfromParentZone(SurfNum) + state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(SurfNum); // Short-wave radiation (from interior and exterior solar and zone lights) // absorbed at each face. Assumes equal split between faces of short-wave absorbed in glass layer. @@ -2307,9 +2269,9 @@ namespace Window { // and glass 2, gap 2 is between glass 2 and blind/shade, and gap 3 is between // blind/shade and glass 3. - int IConst = ConstrNum; + int IConst = surf.Construction; if (ANY_SHADE_SCREEN(ShadeFlag) || ANY_BLIND(ShadeFlag)) { - IConst = state.dataSurface->SurfWinActiveShadedConstruction(SurfNum); + IConst = s_surf->SurfWinActiveShadedConstruction(SurfNum); } TotLay = state.dataConstruction->Construct(IConst).TotLayers; int IGlass = 0; @@ -2319,19 +2281,20 @@ namespace Window { for (int Lay = 1; Lay <= TotLay; ++Lay) { LayPtr = state.dataConstruction->Construct(IConst).LayerPoint(Lay); - auto const *mat = state.dataMaterial->Material(LayPtr); + auto const *mat = s_mat->materials(LayPtr); - if ((mat->group == Material::Group::WindowGlass) || (mat->group == Material::Group::WindowSimpleGlazing)) { + if (mat->group == Material::Group::Glass || mat->group == Material::Group::GlassSimple) { ++IGlass; - wm->thick[IGlass - 1] = mat->Thickness; - wm->scon[IGlass - 1] = mat->Conductivity / mat->Thickness; - wm->emis[2 * IGlass - 2] = mat->AbsorpThermalFront; - wm->emis[2 * IGlass - 1] = mat->AbsorpThermalBack; - wm->tir[2 * IGlass - 2] = mat->TransThermal; - wm->tir[2 * IGlass - 1] = mat->TransThermal; - } - - if (mat->group == Material::Group::Shade || mat->group == Material::Group::WindowBlind || mat->group == Material::Group::Screen) { + auto const *matGlass = dynamic_cast(mat); + assert(matGlass != nullptr); + wm->thick[IGlass - 1] = matGlass->Thickness; + wm->scon[IGlass - 1] = matGlass->Conductivity / matGlass->Thickness; + wm->emis[2 * IGlass - 2] = matGlass->AbsorpThermalFront; + wm->emis[2 * IGlass - 1] = matGlass->AbsorpThermalBack; + wm->tir[2 * IGlass - 2] = matGlass->TransThermal; + wm->tir[2 * IGlass - 1] = matGlass->TransThermal; + + } else if (mat->group == Material::Group::Shade || mat->group == Material::Group::Blind || mat->group == Material::Group::Screen) { if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) ShadeLayPtr = state.dataConstruction->Construct(IConst).LayerPoint(state.dataConstruction->Construct(IConst).TotLayers); if (ANY_EXTERIOR_SHADE_BLIND_SCREEN(ShadeFlag)) ShadeLayPtr = state.dataConstruction->Construct(IConst).LayerPoint(1); @@ -2339,13 +2302,14 @@ namespace Window { ShadeLayPtr = state.dataConstruction->Construct(IConst).LayerPoint(3); if (TotGlassLay == 3) ShadeLayPtr = state.dataConstruction->Construct(IConst).LayerPoint(5); } - auto const *matShade = state.dataMaterial->Material(ShadeLayPtr); + auto const *matShade = dynamic_cast(s_mat->materials(ShadeLayPtr)); assert(matShade != nullptr); + if (ANY_SHADE_SCREEN(ShadeFlag)) { // Shade or screen on - if (state.dataGlobal - ->AnyEnergyManagementSystemInModel) { // check to make sure the user hasn't messed up the shade control values - if (matShade->group == Material::Group::WindowBlind) { + if (state.dataGlobal->AnyEnergyManagementSystemInModel) { + // check to make sure the user hasn't messed up the shade control values + if (matShade->group == Material::Group::Blind) { ShowSevereError( state, format("CalcWindowHeatBalance: ShadeFlag indicates Shade but Blind=\"{}\" is being used.", matShade->Name)); @@ -2355,6 +2319,7 @@ namespace Window { } wm->thick[TotGlassLay] = matShade->Thickness; wm->scon[TotGlassLay] = matShade->Conductivity / matShade->Thickness; + if (ShadeFlag == WinShadingType::ExtScreen) { auto const *matScreen = dynamic_cast(matShade); assert(matScreen != nullptr); @@ -2369,8 +2334,8 @@ namespace Window { wm->emis[wm->nglface + 1] = matShade->AbsorpThermal; } else { - if (state.dataGlobal - ->AnyEnergyManagementSystemInModel) { // check to make sure the user hasn't messed up the shade control values + if (state.dataGlobal->AnyEnergyManagementSystemInModel) { + // check to make sure the user hasn't messed up the shade control values if (matShade->group == Material::Group::Shade || matShade->group == Material::Group::Screen) { ShowSevereError(state, format("CalcWindowHeatBalance: ShadeFlag indicates Blind but Shade/Screen=\"{}\" is being used.", @@ -2379,33 +2344,23 @@ namespace Window { ShowFatalError(state, "Preceding condition terminates program."); } } + // Blind on - BlNum = state.dataSurface->SurfWinBlindNumber(SurfNum); - auto const &blind = state.dataMaterial->Blind(BlNum); - wm->thick[TotGlassLay] = blind.SlatThickness; - wm->scon[TotGlassLay] = blind.SlatConductivity / blind.SlatThickness; - - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - int slatAngIndex = state.dataSurface->SurfWinSlatsAngIndex(SurfNum); - int slatAngIndex2 = std::min(Material::MaxSlatAngs, slatAngIndex + 1); - - Real64 interpFac = state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum); - wm->emis[wm->nglface] = General::Interp(blind.IRFrontEmiss(slatAngIndex), blind.IRFrontEmiss(slatAngIndex2), interpFac); - wm->emis[wm->nglface + 1] = General::Interp(blind.IRBackEmiss(slatAngIndex), blind.IRBackEmiss(slatAngIndex2), interpFac); - wm->tir[wm->nglface] = General::Interp(blind.IRFrontTrans(slatAngIndex), blind.IRFrontTrans(slatAngIndex2), interpFac); - wm->tir[wm->nglface + 1] = General::Interp(blind.IRBackTrans(slatAngIndex), blind.IRBackTrans(slatAngIndex2), interpFac); - } else { - wm->emis[wm->nglface] = blind.IRFrontEmiss(1); - wm->emis[wm->nglface + 1] = blind.IRBackEmiss(1); - wm->tir[wm->nglface] = blind.IRFrontTrans(1); - wm->tir[wm->nglface + 1] = blind.IRBackTrans(1); - } + auto &surfShade = s_surf->surfShades(SurfNum); + auto const *matBlind = dynamic_cast(s_mat->materials(surfShade.blind.matNum)); + assert(matBlind != nullptr); + wm->thick[TotGlassLay] = matBlind->SlatThickness; + wm->scon[TotGlassLay] = matBlind->SlatConductivity / matBlind->SlatThickness; + + wm->emis[wm->nglface] = surfShade.blind.TAR.IR.Ft.Emi; + wm->emis[wm->nglface + 1] = surfShade.blind.TAR.IR.Bk.Emi; + wm->tir[wm->nglface] = surfShade.blind.TAR.IR.Ft.Tra; + wm->tir[wm->nglface + 1] = surfShade.blind.TAR.IR.Bk.Tra; } - } - if (mat->group == Material::Group::WindowGas || mat->group == Material::Group::WindowGasMixture) { + } else if (mat->group == Material::Group::Gas || mat->group == Material::Group::GasMixture) { ++IGap; - auto const *matGas = dynamic_cast(state.dataMaterial->Material(LayPtr)); + auto const *matGas = dynamic_cast(s_mat->materials(LayPtr)); assert(matGas != nullptr); wm->gaps[IGap - 1].width = matGas->Thickness; wm->gaps[IGap - 1].numGases = matGas->numGases; @@ -2421,14 +2376,7 @@ namespace Window { // Interior or exterior blind, shade or screen is on. // Fill gap between blind/shade and adjacent glass with air properties. ++IGap; - if (ShadeFlag == WinShadingType::IntShade || ShadeFlag == WinShadingType::ExtShade) // Interior or exterior shade - wm->gaps[IGap - 1].width = - dynamic_cast(state.dataMaterial->Material(ShadeLayPtr))->WinShadeToGlassDist; - else if (ShadeFlag == WinShadingType::ExtScreen) { - wm->gaps[IGap - 1].width = dynamic_cast(state.dataMaterial->Material(ShadeLayPtr))->toGlassDist; - } else { // Interior or exterior blind - wm->gaps[IGap - 1].width = state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).BlindToGlassDist; - } + wm->gaps[IGap - 1].width = dynamic_cast(s_mat->materials(ShadeLayPtr))->toGlassDist; wm->gaps[IGap - 1].numGases = 1; wm->gaps[IGap - 1].gases[0] = Material::gases[(int)Material::GasType::Air]; @@ -2444,8 +2392,8 @@ namespace Window { if (SurfNumAdj > 0) { // Interzone window - ZoneNumAdj = state.dataSurface->Surface(SurfNumAdj).Zone; - Real64 RefAirTemp = state.dataSurface->Surface(SurfNumAdj).getInsideAirTemperature(state, SurfNumAdj); + ZoneNumAdj = s_surf->Surface(SurfNumAdj).Zone; + Real64 RefAirTemp = s_surf->Surface(SurfNumAdj).getInsideAirTemperature(state, SurfNumAdj); state.dataHeatBal->SurfTempEffBulkAir(SurfNumAdj) = RefAirTemp; wm->tout = RefAirTemp + Constant::Kelvin; // outside air temperature @@ -2455,31 +2403,31 @@ namespace Window { // The IR radiance of this window's "exterior" surround is the IR radiance // from surfaces and high-temp radiant sources in the adjacent zone - wm->Outir = state.dataSurface->SurfWinIRfromParentZone(SurfNumAdj) + state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(SurfNumAdj); + wm->Outir = s_surf->SurfWinIRfromParentZone(SurfNumAdj) + state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(SurfNumAdj); } else { // Exterior window (Ext BoundCond = 0) // Calculate LWR from surrounding surfaces if defined for an exterior window OutSrdIR = 0; if (state.dataGlobal->AnyLocalEnvironmentsInModel) { - if (state.dataSurface->Surface(SurfNum).SurfHasSurroundingSurfProperty) { - SrdSurfTempAbs = surface.SrdSurfTemp + Constant::Kelvin; - OutSrdIR = Constant::StefanBoltzmann * surface.ViewFactorSrdSurfs * pow_4(SrdSurfTempAbs); + if (s_surf->Surface(SurfNum).SurfHasSurroundingSurfProperty) { + SrdSurfTempAbs = surf.SrdSurfTemp + Constant::Kelvin; + OutSrdIR = Constant::StefanBoltzmann * surf.ViewFactorSrdSurfs * pow_4(SrdSurfTempAbs); } } - if (surface.ExtWind) { // Window is exposed to wind (and possibly rain) + if (surf.ExtWind) { // Window is exposed to wind (and possibly rain) if (state.dataEnvrn->IsRain) { // Raining: since wind exposed, outside window surface gets wet - wm->tout = state.dataSurface->SurfOutWetBulbTemp(SurfNum) + Constant::Kelvin; + wm->tout = s_surf->SurfOutWetBulbTemp(SurfNum) + Constant::Kelvin; } else { // Dry - wm->tout = state.dataSurface->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; + wm->tout = s_surf->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; } } else { // Window not exposed to wind - wm->tout = state.dataSurface->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; + wm->tout = s_surf->SurfOutDryBulbTemp(SurfNum) + Constant::Kelvin; } wm->Ebout = Constant::StefanBoltzmann * pow_4(wm->tout); - wm->Outir = surface.ViewFactorSkyIR * - (state.dataSurface->SurfAirSkyRadSplit(SurfNum) * Constant::StefanBoltzmann * pow_4(state.dataEnvrn->SkyTempKelvin) + - (1.0 - state.dataSurface->SurfAirSkyRadSplit(SurfNum)) * wm->Ebout) + - surface.ViewFactorGroundIR * wm->Ebout + OutSrdIR; + wm->Outir = + surf.ViewFactorSkyIR * (s_surf->SurfAirSkyRadSplit(SurfNum) * Constant::StefanBoltzmann * pow_4(state.dataEnvrn->SkyTempKelvin) + + (1.0 - s_surf->SurfAirSkyRadSplit(SurfNum)) * wm->Ebout) + + surf.ViewFactorGroundIR * wm->Ebout + OutSrdIR; } // Factors used in window layer temperature solution @@ -2503,7 +2451,9 @@ namespace Window { wm->thetas = {0.0}; wm->thetasPrev = {0.0}; +#ifdef GET_OUT wm->fvec = {0.0}; +#endif // GET_OUT // Calculate window face temperatures @@ -2517,21 +2467,12 @@ namespace Window { dth4 = wm->thetas[7] - wm->thetas[6]; if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) { + auto const &surfShade = s_surf->surfShades(SurfNum); SurfInsideTemp = wm->thetas[2 * wm->ngllayer + 1] - Constant::Kelvin; - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - EffShBlEmiss = - General::Interp(window.EffShBlindEmiss[state.dataSurface->SurfWinSlatsAngIndex(SurfNum)], - window.EffShBlindEmiss[std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1)], - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - EffGlEmiss = - General::Interp(window.EffGlassEmiss[state.dataSurface->SurfWinSlatsAngIndex(SurfNum)], - window.EffGlassEmiss[std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1)], - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - } else { - EffShBlEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[1]; - EffGlEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[1]; - } - state.dataSurface->SurfWinEffInsSurfTemp(SurfNum) = + EffShBlEmiss = surfShade.effShadeEmi; + EffGlEmiss = surfShade.effGlassEmi; + + s_surf->SurfWinEffInsSurfTemp(SurfNum) = (EffShBlEmiss * SurfInsideTemp + EffGlEmiss * (wm->thetas[2 * wm->ngllayer - 1] - Constant::Kelvin)) / (EffShBlEmiss + EffGlEmiss); } else { @@ -2549,49 +2490,46 @@ namespace Window { // Save temperatures for use next time step for (int k = 1; k <= wm->nglfacep; ++k) { - window.thetaFace[k] = wm->thetas[k - 1]; + surfWin.thetaFace[k] = wm->thetas[k - 1]; } // Added TH 12/23/2008 for thermochromic windows to save the current TC layer temperature if (wm->locTCFlag) { - state.dataSurface->SurfWinTCLayerTemp(SurfNum) = (wm->thetas[2 * state.dataConstruction->Construct(ConstrNum).TCGlassID - 2] + - wm->thetas[2 * state.dataConstruction->Construct(ConstrNum).TCGlassID - 1]) / - 2 - - Constant::Kelvin; // degree C + s_surf->SurfWinTCLayerTemp(SurfNum) = + (wm->thetas[2 * constr.TCGlassNum - 2] + wm->thetas[2 * constr.TCGlassNum - 1]) / 2 - Constant::Kelvin; // 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 (!state.dataConstruction->Construct(surface.Construction).WindowTypeEQL) { + if (!state.dataConstruction->Construct(surf.Construction).WindowTypeEQL) { InsideGlassTemp = wm->thetas[2 * wm->ngllayer - 1] - Constant::Kelvin; RoomHumRat = thisZoneHB.airHumRat; RoomDewPoint = PsyTdpFnWPb(state, RoomHumRat, state.dataEnvrn->OutBaroPress); - state.dataSurface->SurfWinInsideGlassCondensationFlag(SurfNum) = 0; - if (InsideGlassTemp < RoomDewPoint) state.dataSurface->SurfWinInsideGlassCondensationFlag(SurfNum) = 1; + s_surf->SurfWinInsideGlassCondensationFlag(SurfNum) = 0; + if (InsideGlassTemp < RoomDewPoint) s_surf->SurfWinInsideGlassCondensationFlag(SurfNum) = 1; // If airflow window, is there condensation on either glass face of the airflow gap? - if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0) { + if (s_surf->SurfWinAirflowThisTS(SurfNum) > 0.0) { Tleft = wm->thetas[2 * wm->ngllayer - 3] - Constant::Kelvin; Tright = wm->thetas[2 * wm->ngllayer - 2] - Constant::Kelvin; - if (state.dataSurface->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { - if (Tleft < RoomDewPoint || Tright < RoomDewPoint) state.dataSurface->SurfWinInsideGlassCondensationFlag(SurfNum) = 1; - } else if (state.dataSurface->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Outdoor) { + if (s_surf->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { + if (Tleft < RoomDewPoint || Tright < RoomDewPoint) s_surf->SurfWinInsideGlassCondensationFlag(SurfNum) = 1; + } else if (s_surf->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Outdoor) { if (Tleft < state.dataEnvrn->OutDewPointTemp || Tright < state.dataEnvrn->OutDewPointTemp) - state.dataSurface->SurfWinInsideGlassCondensationFlag(SurfNum) = 1; + s_surf->SurfWinInsideGlassCondensationFlag(SurfNum) = 1; } } // Do frame and divider calculation - if (state.dataSurface->SurfWinFrameArea(SurfNum) > 0.0 || state.dataSurface->SurfWinDividerArea(SurfNum) > 0.0) + if (s_surf->SurfWinFrameArea(SurfNum) > 0.0 || s_surf->SurfWinDividerArea(SurfNum) > 0.0) CalcWinFrameAndDividerTemps(state, SurfNum, wm->tout, wm->tin, wm->hcout, wm->hcin, wm->Outir, ConstrNum); - if (state.dataSurface->SurfWinFrameArea(SurfNum) > 0.0) { - state.dataSurface->SurfWinInsideFrameCondensationFlag(SurfNum) = 0; - if (state.dataSurface->SurfWinFrameTempIn(SurfNum) < RoomDewPoint) state.dataSurface->SurfWinInsideFrameCondensationFlag(SurfNum) = 1; + if (s_surf->SurfWinFrameArea(SurfNum) > 0.0) { + s_surf->SurfWinInsideFrameCondensationFlag(SurfNum) = 0; + if (s_surf->SurfWinFrameTempIn(SurfNum) < RoomDewPoint) s_surf->SurfWinInsideFrameCondensationFlag(SurfNum) = 1; } - if (state.dataSurface->SurfWinDividerArea(SurfNum) > 0.0) { - state.dataSurface->SurfWinInsideDividerCondensationFlag(SurfNum) = 0; - if (state.dataSurface->SurfWinDividerTempIn(SurfNum) < RoomDewPoint) - state.dataSurface->SurfWinInsideDividerCondensationFlag(SurfNum) = 1; + if (s_surf->SurfWinDividerArea(SurfNum) > 0.0) { + s_surf->SurfWinInsideDividerCondensationFlag(SurfNum) = 0; + if (s_surf->SurfWinDividerTempIn(SurfNum) < RoomDewPoint) s_surf->SurfWinInsideDividerCondensationFlag(SurfNum) = 1; } } // update exterior environment surface heat loss reporting @@ -2604,19 +2542,19 @@ namespace Window { Real64 rad_out_lw_srd_per_area = 0; if (state.dataGlobal->AnyLocalEnvironmentsInModel) { - if (state.dataSurface->Surface(SurfNum).SurfHasSurroundingSurfProperty) { + if (surf.SurfHasSurroundingSurfProperty) { // update SurfHSrdSurfExt if the windows has exterior shade or blind state.dataHeatBalSurf->SurfHSrdSurfExt(SurfNum) = Convect::SurroundingSurfacesRadCoeffAverage(state, SurfNum, Tsout, SurfOutsideEmiss); - rad_out_lw_srd_per_area = state.dataHeatBalSurf->SurfHSrdSurfExt(SurfNum) * (surface.SrdSurfTemp - SurfOutsideTemp); + rad_out_lw_srd_per_area = state.dataHeatBalSurf->SurfHSrdSurfExt(SurfNum) * (surf.SrdSurfTemp - SurfOutsideTemp); } } Real64 const rad_out_air_per_area = - -emiss_sigma_product * (1.0 - state.dataSurface->SurfAirSkyRadSplit(SurfNum)) * surface.ViewFactorSkyIR * (Tsout_4 - Tout_4); - Real64 const rad_out_ground_per_area = -emiss_sigma_product * surface.ViewFactorGroundIR * (Tsout_4 - Tout_4); - Real64 const rad_out_sky_per_area = -emiss_sigma_product * state.dataSurface->SurfAirSkyRadSplit(SurfNum) * surface.ViewFactorSkyIR * - (Tsout_4 - pow_4(state.dataEnvrn->SkyTempKelvin)); + -emiss_sigma_product * (1.0 - s_surf->SurfAirSkyRadSplit(SurfNum)) * surf.ViewFactorSkyIR * (Tsout_4 - Tout_4); + Real64 const rad_out_ground_per_area = -emiss_sigma_product * surf.ViewFactorGroundIR * (Tsout_4 - Tout_4); + Real64 const rad_out_sky_per_area = + -emiss_sigma_product * s_surf->SurfAirSkyRadSplit(SurfNum) * surf.ViewFactorSkyIR * (Tsout_4 - pow_4(state.dataEnvrn->SkyTempKelvin)); Real64 const rad_out_per_area = rad_out_air_per_area + rad_out_sky_per_area + rad_out_ground_per_area + rad_out_lw_srd_per_area; state.dataHeatBalSurf->SurfHAirExt(SurfNum) = rad_out_air_per_area / (Tsout - wm->tout); @@ -2626,6 +2564,7 @@ namespace Window { //**************************************************************************** +#ifdef GET_OUT void WindowHeatBalanceEquations(EnergyPlusData &state, int const SurfNum) // Surface number { @@ -2650,7 +2589,9 @@ namespace Window { Real64 thetas_6_7_4; auto &wm = state.dataWindowManager; - auto const &surfWin = state.dataSurface->SurfaceWindow(SurfNum); + auto &s_surf = state.dataSurface; + + auto const &surfWin = s_surf->SurfaceWindow(SurfNum); // Have to zero fvec each time since LUdecompostion and LUsolution may // add values to this array in unexpected places @@ -2739,6 +2680,7 @@ namespace Window { } break; } // switch } // WindowHeatBalanceEquations() +#endif // GET_OUT //**************************************************************************** @@ -2930,7 +2872,9 @@ namespace Window { Array1D hgap(maxGlassLayers); // Gap gas conductance (W/m2-K) - auto const &surfWin = state.dataSurface->SurfaceWindow(SurfNum); + auto &s_surf = state.dataSurface; + + auto const &surfWin = s_surf->SurfaceWindow(SurfNum); if (nglasslayer == 1) { Bface(1) = wm->Outir * wm->emis[0] + wm->hcout * wm->tout + wm->AbsRadGlassFace[0]; @@ -3007,7 +2951,7 @@ namespace Window { Aface(3, 4) = -wm->scon[1]; Aface(4, 4) = hr(4) + wm->scon[1] + wm->hcin; - if (!ANY_BETWEENGLASS_SHADE_BLIND(ShadeFlag) && state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0) { + if (!ANY_BETWEENGLASS_SHADE_BLIND(ShadeFlag) && s_surf->SurfWinAirflowThisTS(SurfNum) > 0.0) { Bface(2) = wm->AbsRadGlassFace[1] + hcvAirflowGap * TAirflowGapNew; Bface(3) = wm->AbsRadGlassFace[2] + hcvAirflowGap * TAirflowGapNew; Aface(2, 2) = wm->scon[0] + hcvAirflowGap - wm->A23P * hr(2); @@ -3127,7 +3071,7 @@ namespace Window { Aface(5, 6) = -wm->scon[2]; Aface(6, 6) = hr(6) + wm->scon[2] + wm->hcin; - if (!ANY_BETWEENGLASS_SHADE_BLIND(ShadeFlag) && state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0) { + if (!ANY_BETWEENGLASS_SHADE_BLIND(ShadeFlag) && s_surf->SurfWinAirflowThisTS(SurfNum) > 0.0) { Bface(4) = wm->AbsRadGlassFace[3] + hcvAirflowGap * TAirflowGapNew; Bface(5) = wm->AbsRadGlassFace[4] + hcvAirflowGap * TAirflowGapNew; Aface(4, 4) = wm->scon[1] + hcvAirflowGap - wm->A45P * hr(4); @@ -3423,16 +3367,18 @@ namespace Window { Array1D Bface(2 * maxGlassLayers); // Coefficient in equation Aface*thetas = Bface Array1D_int indx(2 * maxGlassLayers); // Vector of row permutations in LU decomposition + auto &s_surf = state.dataSurface; + wm->nglfacep = wm->nglface; - ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); - ZoneNum = state.dataSurface->Surface(SurfNum).Zone; + ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); + ZoneNum = s_surf->Surface(SurfNum).Zone; AbsRadShadeFace = 0.0; if (ANY_SHADE_SCREEN(ShadeFlag) || ANY_BLIND(ShadeFlag)) { wm->nglfacep = wm->nglface + 2; AbsRadShadeFace(1) = DataSurfaces::AbsFrontSide(state, SurfNum); AbsRadShadeFace(2) = DataSurfaces::AbsBackSide(state, SurfNum); - if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) AbsRadShadeFace(2) += state.dataSurface->SurfWinIntLWAbsByShade(SurfNum); + if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) AbsRadShadeFace(2) += s_surf->SurfWinIntLWAbsByShade(SurfNum); sconsh = wm->scon[wm->ngllayer]; TauShIR = wm->tir[wm->nglface]; EpsShIR1 = wm->emis[wm->nglface]; @@ -3469,9 +3415,9 @@ namespace Window { } // call for new interior film coeff (since it is temperature dependent) if using Detailed inside coef model - if (((state.dataSurface->surfIntConv(SurfNum).model == Convect::HcInt::SetByZone) && + if (((s_surf->surfIntConv(SurfNum).model == Convect::HcInt::SetByZone) && (state.dataHeatBal->Zone(ZoneNum).IntConvAlgo == Convect::HcInt::ASHRAETARP)) || - (state.dataSurface->surfIntConv(SurfNum).model == Convect::HcInt::ASHRAETARP)) { + (s_surf->surfIntConv(SurfNum).model == Convect::HcInt::ASHRAETARP)) { // coef model is "detailed" and not prescribed by user // need to find inside face index, varies with shade/blind etc. if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) { @@ -3491,8 +3437,7 @@ namespace Window { // effective gap air temperature, velocity of air in gap and gap outlet temperature. if (ANY_EXTERIOR_SHADE_BLIND_SCREEN(ShadeFlag) || ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) { - ExtOrIntShadeNaturalFlow( - state, SurfNum, iter, VGap, TGapNew, TGapOutlet, hcv, state.dataSurface->SurfWinConvHeatFlowNatural(SurfNum)); + ExtOrIntShadeNaturalFlow(state, SurfNum, iter, VGap, TGapNew, TGapOutlet, hcv, s_surf->SurfWinConvHeatFlowNatural(SurfNum)); if (iter >= 1) { hcv = 0.5 * (hcvPrev + hcv); VGap = 0.5 * (VGapPrev + VGap); @@ -3507,17 +3452,17 @@ namespace Window { // get glass-to-air forced convection heat transfer coefficient, average gap air temperature, and // convective heat flow from gap. - if (!ANY_BETWEENGLASS_SHADE_BLIND(ShadeFlag) && state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0) { + if (!ANY_BETWEENGLASS_SHADE_BLIND(ShadeFlag) && s_surf->SurfWinAirflowThisTS(SurfNum) > 0.0) { BetweenGlassForcedFlow(state, SurfNum, iter, VAirflowGap, TAirflowGapNew, TAirflowGapOutlet, hcvAirflowGap, ConvHeatFlowForced); } // If between-glass shade or blind is present, get convective heat transfer - // coefficients from glass and shade/blind to the two gaps on either side of the shade/blind. + // coefficients from glass and shade/blind to the two gaps on either side of the shade/matBlind-> // Also get average gas temperature in the two gaps, and, for airflow window, the sum of the // convective heat flows from the gaps. if (ANY_BETWEENGLASS_SHADE_BLIND(ShadeFlag)) { - if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) == 0.0) { // Natural convection in gaps + if (s_surf->SurfWinAirflowThisTS(SurfNum) == 0.0) { // Natural convection in gaps BetweenGlassShadeNaturalFlow(state, SurfNum, iter, VGap, TGapNewBG, hcvBG); } else { // Forced convection in gaps BetweenGlassShadeForcedFlow(state, SurfNum, iter, VGap, TGapNewBG, TAirflowGapOutlet, hcvBG, ConvHeatFlowForced); @@ -3569,7 +3514,7 @@ namespace Window { errtemp /= wm->nglfacep; } - state.dataSurface->SurfWinWindowCalcIterationsRep(SurfNum) = iter; + s_surf->SurfWinWindowCalcIterationsRep(SurfNum) = iter; // We have reached iteration limit or we have converged. If we have reached the // iteration limit the following test relaxes the convergence tolerance. @@ -3582,7 +3527,7 @@ namespace Window { // For interior shade, add convective gain from glass/shade gap air flow to zone convective gain; // For all cases, get total window heat gain for reporting. See CalcWinFrameAndDividerTemps for // contribution of frame and divider. - // IncidentSolar = state.dataSurface->Surface(SurfNum).Area * state.dataHeatBal->SurfQRadSWOutIncident(SurfNum); + // IncidentSolar = s_surf->Surface(SurfNum).Area * state.dataHeatBal->SurfQRadSWOutIncident(SurfNum); if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag)) { // Interior shade or blind // Window heat gain from glazing and shade/blind to zone. Consists of transmitted solar, convection @@ -3590,55 +3535,50 @@ namespace Window { // zone from the glass adjacent to the shade/blind (zero if shade/blind IR transmittance is zero). // Following assumes glazed area = window area (i.e., dividers ignored) in calculating // IR to zone from glass when interior shade/blind is present. - ShadeArea = state.dataSurface->Surface(SurfNum).Area + state.dataSurface->SurfWinDividerArea(SurfNum); + ShadeArea = s_surf->Surface(SurfNum).Area + s_surf->SurfWinDividerArea(SurfNum); // CondHeatGainShade = ShadeArea * sconsh * // (wm->thetas(wm->nglfacep - 1) - // wm->thetas[wm->nglfacep-1]); - state.dataSurface->SurfWinGainIRShadeToZoneRep(SurfNum) = + s_surf->SurfWinGainIRShadeToZoneRep(SurfNum) = ShadeArea * EpsShIR2 * (Constant::StefanBoltzmann * pow_4(wm->thetas[wm->nglfacep - 1]) - wm->Rmir) + EpsShIR1 * (Constant::StefanBoltzmann * pow_4(wm->thetas[wm->nglfacep - 2]) - wm->Rmir) * RhoGlIR2 * TauShIR / ShGlReflFacIR; - state.dataSurface->SurfWinGainIRGlazToZoneRep(SurfNum) = - ShadeArea * (wm->emis[2 * wm->ngllayer - 1] * TauShIR / ShGlReflFacIR) * - (Constant::StefanBoltzmann * pow_4(wm->thetas[2 * wm->ngllayer - 1]) - wm->Rmir); - state.dataSurface->SurfWinGainConvShadeToZoneRep(SurfNum) = ShadeArea * wm->hcin * (wm->thetas[wm->nglfacep - 1] - wm->tin); - state.dataSurface->SurfWinHeatGain(SurfNum) = - state.dataSurface->SurfWinTransSolar(SurfNum) + state.dataSurface->SurfWinConvHeatFlowNatural(SurfNum) + - state.dataSurface->SurfWinGainConvShadeToZoneRep(SurfNum) + state.dataSurface->SurfWinGainIRGlazToZoneRep(SurfNum) + - state.dataSurface->SurfWinGainIRShadeToZoneRep(SurfNum); + s_surf->SurfWinGainIRGlazToZoneRep(SurfNum) = ShadeArea * (wm->emis[2 * wm->ngllayer - 1] * TauShIR / ShGlReflFacIR) * + (Constant::StefanBoltzmann * pow_4(wm->thetas[2 * wm->ngllayer - 1]) - wm->Rmir); + s_surf->SurfWinGainConvShadeToZoneRep(SurfNum) = ShadeArea * wm->hcin * (wm->thetas[wm->nglfacep - 1] - wm->tin); + s_surf->SurfWinHeatGain(SurfNum) = s_surf->SurfWinTransSolar(SurfNum) + s_surf->SurfWinConvHeatFlowNatural(SurfNum) + + s_surf->SurfWinGainConvShadeToZoneRep(SurfNum) + s_surf->SurfWinGainIRGlazToZoneRep(SurfNum) + + s_surf->SurfWinGainIRShadeToZoneRep(SurfNum); } else { // Interior shade or blind not present; innermost layer is glass - // CondHeatGainGlass = state.dataSurface->Surface(SurfNum).Area * wm->scon(wm->ngllayer) * + // CondHeatGainGlass = s_surf->Surface(SurfNum).Area * wm->scon(wm->ngllayer) * // (wm->thetas(2 * wm->ngllayer - 1) - // wm->thetas[2 * wm->ngllayer - 1]); - state.dataSurface->SurfWinGainIRGlazToZoneRep(SurfNum) = - state.dataSurface->Surface(SurfNum).Area * wm->emis[2 * wm->ngllayer - 1] * - (Constant::StefanBoltzmann * pow_4(wm->thetas[2 * wm->ngllayer - 1]) - wm->Rmir); - state.dataSurface->SurfWinGainConvGlazToZoneRep(SurfNum) = - state.dataSurface->Surface(SurfNum).Area * wm->hcin * (wm->thetas[2 * wm->ngllayer - 1] - wm->tin); - state.dataSurface->SurfWinHeatGain(SurfNum) = state.dataSurface->SurfWinTransSolar(SurfNum) + - state.dataSurface->SurfWinGainConvGlazToZoneRep(SurfNum) + - state.dataSurface->SurfWinGainIRGlazToZoneRep(SurfNum); + s_surf->SurfWinGainIRGlazToZoneRep(SurfNum) = s_surf->Surface(SurfNum).Area * wm->emis[2 * wm->ngllayer - 1] * + (Constant::StefanBoltzmann * pow_4(wm->thetas[2 * wm->ngllayer - 1]) - wm->Rmir); + s_surf->SurfWinGainConvGlazToZoneRep(SurfNum) = + s_surf->Surface(SurfNum).Area * wm->hcin * (wm->thetas[2 * wm->ngllayer - 1] - wm->tin); + s_surf->SurfWinHeatGain(SurfNum) = + s_surf->SurfWinTransSolar(SurfNum) + s_surf->SurfWinGainConvGlazToZoneRep(SurfNum) + s_surf->SurfWinGainIRGlazToZoneRep(SurfNum); } // Add convective heat gain from airflow window // Note: effect of fan heat on gap outlet temperature is neglected since fan power (based // on pressure drop through the gap) is extremely small - state.dataSurface->SurfWinGapConvHtFlowRep(SurfNum) = 0.0; - state.dataSurface->SurfWinGapConvHtFlowRepEnergy(SurfNum) = 0.0; - TotAirflowGap = state.dataSurface->SurfWinAirflowThisTS(SurfNum) * state.dataSurface->Surface(SurfNum).Width; + s_surf->SurfWinGapConvHtFlowRep(SurfNum) = 0.0; + s_surf->SurfWinGapConvHtFlowRepEnergy(SurfNum) = 0.0; + TotAirflowGap = s_surf->SurfWinAirflowThisTS(SurfNum) * s_surf->Surface(SurfNum).Width; TAirflowGapOutletC = TAirflowGapOutlet - Constant::Kelvin; - state.dataSurface->SurfWinTAirflowGapOutlet(SurfNum) = TAirflowGapOutletC; - if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0) { - state.dataSurface->SurfWinGapConvHtFlowRep(SurfNum) = ConvHeatFlowForced; - state.dataSurface->SurfWinGapConvHtFlowRepEnergy(SurfNum) = - state.dataSurface->SurfWinGapConvHtFlowRep(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinTAirflowGapOutlet(SurfNum) = TAirflowGapOutletC; + if (s_surf->SurfWinAirflowThisTS(SurfNum) > 0.0) { + s_surf->SurfWinGapConvHtFlowRep(SurfNum) = ConvHeatFlowForced; + s_surf->SurfWinGapConvHtFlowRepEnergy(SurfNum) = s_surf->SurfWinGapConvHtFlowRep(SurfNum) * state.dataGlobal->TimeStepZoneSec; // Add heat from gap airflow to zone air if destination is inside air; save the heat gain to return // air in case it needs to be sent to the zone (due to no return air determined in HVAC simulation) - if (state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Indoor || - state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Return) { + if (s_surf->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Indoor || + s_surf->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Return) { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - if (state.dataSurface->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { + if (s_surf->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { InletAirHumRat = thisZoneHB.airHumRat; } else { // AirflowSource = outside air InletAirHumRat = state.dataEnvrn->OutHumRat; @@ -3646,10 +3586,9 @@ namespace Window { Real64 ZoneTemp = thisZoneHB.MAT; // this should be Tin (account for different reference temps) CpAirOutlet = PsyCpAirFnW(InletAirHumRat); CpAirZone = PsyCpAirFnW(thisZoneHB.airHumRat); - state.dataSurface->SurfWinRetHeatGainToZoneAir(SurfNum) = - TotAirflowGap * (CpAirOutlet * (TAirflowGapOutletC)-CpAirZone * ZoneTemp); - if (state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Indoor) { - state.dataSurface->SurfWinHeatGain(SurfNum) += state.dataSurface->SurfWinRetHeatGainToZoneAir(SurfNum); + s_surf->SurfWinRetHeatGainToZoneAir(SurfNum) = TotAirflowGap * (CpAirOutlet * (TAirflowGapOutletC)-CpAirZone * ZoneTemp); + if (s_surf->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Indoor) { + s_surf->SurfWinHeatGain(SurfNum) += s_surf->SurfWinRetHeatGainToZoneAir(SurfNum); } } // For AirflowDestination = ReturnAir in a controlled (i.e., conditioned) zone with return air, see CalcZoneLeavingConditions @@ -3658,8 +3597,8 @@ namespace Window { // Correct WinHeatGain for interior diffuse shortwave (solar and shortwave from lights) transmitted // back out window - int const ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); - int const ConstrNumSh = state.dataSurface->SurfWinActiveShadedConstruction(SurfNum); + int const ConstrNum = s_surf->SurfActiveConstruction(SurfNum); + int const ConstrNumSh = s_surf->SurfWinActiveShadedConstruction(SurfNum); Real64 reflDiff = 0.0; // Diffuse shortwave back reflectance if (NOT_SHADED(ShadeFlag)) { @@ -3667,62 +3606,52 @@ namespace Window { } else if (ANY_SHADE_SCREEN(ShadeFlag)) { reflDiff = state.dataConstruction->Construct(ConstrNumSh).ReflectSolDiffBack; } else if (ANY_BLIND(ShadeFlag)) { - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - reflDiff = General::Interp( - state.dataConstruction->Construct(ConstrNumSh).BlReflectSolDiffBack(state.dataSurface->SurfWinSlatsAngIndex(SurfNum)), - state.dataConstruction->Construct(ConstrNumSh) - .BlTransDiff(std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1)), - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - } else { - reflDiff = state.dataConstruction->Construct(ConstrNumSh).BlReflectSolDiffBack(1); - } + auto const &surfShade = s_surf->surfShades(SurfNum); + auto const &constrSh = state.dataConstruction->Construct(ConstrNumSh); + reflDiff = Interp(constrSh.blindTARs[surfShade.blind.slatAngIdxLo].Sol.Bk.Df.Ref, + constrSh.blindTARs[surfShade.blind.slatAngIdxHi].Sol.Bk.Df.Ref, + surfShade.blind.slatAngInterpFac); } else if (ShadeFlag == WinShadingType::SwitchableGlazing) { - reflDiff = InterpSw(state.dataSurface->SurfWinSwitchingFactor(SurfNum), + reflDiff = InterpSw(s_surf->SurfWinSwitchingFactor(SurfNum), state.dataConstruction->Construct(ConstrNum).ReflectSolDiffBack, state.dataConstruction->Construct(ConstrNumSh).ReflectSolDiffBack); } // shouldn't this be + outward flowing fraction of absorbed SW? -- do not know whose comment this is? LKL (9/2012) - state.dataSurface->SurfWinLossSWZoneToOutWinRep(SurfNum) = - state.dataHeatBal->EnclSolQSWRad(state.dataSurface->Surface(SurfNum).SolarEnclIndex) * state.dataSurface->Surface(SurfNum).Area * - (1 - reflDiff) + + s_surf->SurfWinLossSWZoneToOutWinRep(SurfNum) = + state.dataHeatBal->EnclSolQSWRad(s_surf->Surface(SurfNum).SolarEnclIndex) * s_surf->Surface(SurfNum).Area * (1 - reflDiff) + state.dataHeatBalSurf->SurfWinInitialBeamSolInTrans(SurfNum); - state.dataSurface->SurfWinHeatGain(SurfNum) -= - (state.dataSurface->SurfWinLossSWZoneToOutWinRep(SurfNum) + - state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(SurfNum) * state.dataSurface->Surface(SurfNum).Area); + s_surf->SurfWinHeatGain(SurfNum) -= (s_surf->SurfWinLossSWZoneToOutWinRep(SurfNum) + + state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(SurfNum) * s_surf->Surface(SurfNum).Area); if (ANY_SHADE_SCREEN(ShadeFlag) || ANY_BLIND(ShadeFlag)) { - state.dataSurface->SurfWinShadingAbsorbedSolar(SurfNum) = - (state.dataSurface->SurfWinExtBeamAbsByShade(SurfNum) + state.dataSurface->SurfWinExtDiffAbsByShade(SurfNum)) * - (state.dataSurface->Surface(SurfNum).Area + state.dataSurface->SurfWinDividerArea(SurfNum)); - state.dataSurface->SurfWinShadingAbsorbedSolarEnergy(SurfNum) = - state.dataSurface->SurfWinShadingAbsorbedSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; + s_surf->SurfWinShadingAbsorbedSolar(SurfNum) = + (s_surf->SurfWinExtBeamAbsByShade(SurfNum) + s_surf->SurfWinExtDiffAbsByShade(SurfNum)) * + (s_surf->Surface(SurfNum).Area + s_surf->SurfWinDividerArea(SurfNum)); + s_surf->SurfWinShadingAbsorbedSolarEnergy(SurfNum) = s_surf->SurfWinShadingAbsorbedSolar(SurfNum) * state.dataGlobal->TimeStepZoneSec; } if (state.dataEnvrn->SunIsUp) { - state.dataSurface->SurfWinSysSolTransmittance(SurfNum) = - state.dataSurface->SurfWinTransSolar(SurfNum) / - (state.dataHeatBal->SurfQRadSWOutIncident(SurfNum) * - (state.dataSurface->Surface(SurfNum).Area + state.dataSurface->SurfWinDividerArea(SurfNum)) + + s_surf->SurfWinSysSolTransmittance(SurfNum) = + s_surf->SurfWinTransSolar(SurfNum) / + (state.dataHeatBal->SurfQRadSWOutIncident(SurfNum) * (s_surf->Surface(SurfNum).Area + s_surf->SurfWinDividerArea(SurfNum)) + 0.0001); - state.dataSurface->SurfWinSysSolAbsorptance(SurfNum) = - (state.dataHeatBal->SurfWinQRadSWwinAbsTot(SurfNum) + state.dataSurface->SurfWinShadingAbsorbedSolar(SurfNum)) / - (state.dataHeatBal->SurfQRadSWOutIncident(SurfNum) * - (state.dataSurface->Surface(SurfNum).Area + state.dataSurface->SurfWinDividerArea(SurfNum)) + + s_surf->SurfWinSysSolAbsorptance(SurfNum) = + (state.dataHeatBal->SurfWinQRadSWwinAbsTot(SurfNum) + s_surf->SurfWinShadingAbsorbedSolar(SurfNum)) / + (state.dataHeatBal->SurfQRadSWOutIncident(SurfNum) * (s_surf->Surface(SurfNum).Area + s_surf->SurfWinDividerArea(SurfNum)) + 0.0001); - state.dataSurface->SurfWinSysSolReflectance(SurfNum) = - 1.0 - state.dataSurface->SurfWinSysSolTransmittance(SurfNum) - state.dataSurface->SurfWinSysSolAbsorptance(SurfNum); + s_surf->SurfWinSysSolReflectance(SurfNum) = + 1.0 - s_surf->SurfWinSysSolTransmittance(SurfNum) - s_surf->SurfWinSysSolAbsorptance(SurfNum); } else { - state.dataSurface->SurfWinSysSolTransmittance(SurfNum) = 0.0; - state.dataSurface->SurfWinSysSolAbsorptance(SurfNum) = 0.0; - state.dataSurface->SurfWinSysSolReflectance(SurfNum) = 0.0; + s_surf->SurfWinSysSolTransmittance(SurfNum) = 0.0; + s_surf->SurfWinSysSolAbsorptance(SurfNum) = 0.0; + s_surf->SurfWinSysSolReflectance(SurfNum) = 0.0; } // Save hcv for use in divider calc with interior or exterior shade (see CalcWinFrameAndDividerTemps) - if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag) || ANY_EXTERIOR_SHADE_BLIND_SCREEN(ShadeFlag)) - state.dataSurface->SurfWinConvCoeffWithShade(SurfNum) = hcv; + if (ANY_INTERIOR_SHADE_BLIND(ShadeFlag) || ANY_EXTERIOR_SHADE_BLIND_SCREEN(ShadeFlag)) s_surf->SurfWinConvCoeffWithShade(SurfNum) = hcv; } else { // No convergence after MaxIterations even with relaxed error tolerance - ShowSevereError(state, format("Convergence error in SolveForWindowTemperatures for window {}", state.dataSurface->Surface(SurfNum).Name)); + ShowSevereError(state, format("Convergence error in SolveForWindowTemperatures for window {}", s_surf->Surface(SurfNum).Name)); ShowContinueErrorTimeStamp(state, ""); if (state.dataGlobal->DisplayExtraWarnings) { @@ -3736,9 +3665,9 @@ namespace Window { } } - ShowFatalError(state, - format("Program halted because of convergence error in SolveForWindowTemperatures for window {}", - state.dataSurface->Surface(SurfNum).Name)); + ShowFatalError( + state, + format("Program halted because of convergence error in SolveForWindowTemperatures for window {}", s_surf->Surface(SurfNum).Name)); } } // SolveForWindowTemperatures() @@ -3816,15 +3745,19 @@ namespace Window { Real64 pr; // glass-shade/blind gap Prandtl number Real64 nu; // glass-shade/blind gap Nusselt number WinShadingType ShadeFlag; // Shading flag - int BlNum; // Blind number + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; auto &wm = state.dataWindowManager; + + auto &surf = s_surf->Surface(SurfNum); + // Air properties // Dens dDens/dT Con dCon/dT Vis dVis/dT Prandtl dPrandtl/dT // DATA AirProps / 1.29, -0.4d-2, 2.41d-2, 7.6d-5, 1.73d-5, 1.0d-7, 0.72, 1.8d-3 / - ConstrNumSh = state.dataSurface->SurfWinActiveShadedConstruction(SurfNum); - ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); + ConstrNumSh = s_surf->SurfWinActiveShadedConstruction(SurfNum); + ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); nglassfaces = 2 * state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; TotGaps = state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; @@ -3855,7 +3788,7 @@ namespace Window { // For near-horizontal windows (i.e., no more than 5 deg from horizontal) assume // there is no air flow thru gap - if (std::abs(state.dataSurface->Surface(SurfNum).SinTilt) < 0.0872) { + if (std::abs(surf.SinTilt) < 0.0872) { VGap = 0.0; hcv = 2.0 * hGapStill; QConvGap = 0.0; @@ -3864,41 +3797,22 @@ namespace Window { return; } - GapHeight = state.dataSurface->Surface(SurfNum).Height; - - if (ShadeFlag == WinShadingType::IntShade || ShadeFlag == WinShadingType::ExtShade) { - auto const *matShade = dynamic_cast(state.dataMaterial->Material(MatNumSh)); - assert(matShade != nullptr); - // Shade or Screen on - GapDepth = matShade->WinShadeToGlassDist; - AGap = GapDepth * state.dataSurface->Surface(SurfNum).Width; - ATopGap = matShade->WinShadeTopOpeningMult * AGap; - ABotGap = matShade->WinShadeBottomOpeningMult * AGap; - ALeftGap = matShade->WinShadeLeftOpeningMult * GapHeight * GapDepth; - ARightGap = matShade->WinShadeRightOpeningMult * GapHeight * GapDepth; - AHolesGap = matShade->WinShadeAirFlowPermeability * GapHeight * state.dataSurface->Surface(SurfNum).Width; - } else if (ShadeFlag == WinShadingType::ExtScreen) { - auto const *matScreen = dynamic_cast(state.dataMaterial->Material(MatNumSh)); - assert(matScreen != nullptr); - // Shade or Screen on - GapDepth = matScreen->toGlassDist; - AGap = GapDepth * state.dataSurface->Surface(SurfNum).Width; - ATopGap = matScreen->topOpeningMult * AGap; - ABotGap = matScreen->bottomOpeningMult * AGap; - ALeftGap = matScreen->leftOpeningMult * GapHeight * GapDepth; - ARightGap = matScreen->rightOpeningMult * GapHeight * GapDepth; - AHolesGap = matScreen->airFlowPermeability * GapHeight * state.dataSurface->Surface(SurfNum).Width; + GapHeight = surf.Height; + + auto const *matShadingDevice = dynamic_cast(s_mat->materials(MatNumSh)); + assert(matShadingDevice != nullptr); + + GapDepth = matShadingDevice->toGlassDist; + AGap = GapDepth * surf.Width; + ATopGap = matShadingDevice->topOpeningMult * AGap; + ABotGap = matShadingDevice->bottomOpeningMult * AGap; + ALeftGap = matShadingDevice->leftOpeningMult * GapHeight * GapDepth; + ARightGap = matShadingDevice->rightOpeningMult * GapHeight * GapDepth; + // For blinds, airFlowPermeability depends on slat angle which is a property of the surface, not the material + if (matShadingDevice->group == Material::Group::Blind) { + AHolesGap = s_surf->surfShades(SurfNum).blind.airFlowPermeability * GapHeight * surf.Width; } else { - // Blind on - BlNum = state.dataSurface->SurfWinBlindNumber(SurfNum); - auto const &blind = state.dataMaterial->Blind(BlNum); - GapDepth = blind.BlindToGlassDist; - AGap = GapDepth * state.dataSurface->Surface(SurfNum).Width; - ATopGap = blind.BlindTopOpeningMult * AGap; - ABotGap = blind.BlindBottomOpeningMult * AGap; - ALeftGap = blind.BlindLeftOpeningMult * GapHeight * GapDepth; - ARightGap = blind.BlindRightOpeningMult * GapHeight * GapDepth; - AHolesGap = state.dataSurface->SurfWinBlindAirFlowPermeability(SurfNum) * GapHeight * state.dataSurface->Surface(SurfNum).Width; + AHolesGap = matShadingDevice->airFlowPermeability * GapHeight * surf.Width; } RhoAir = wm->AirProps[0] + wm->AirProps[1] * (TGapOld - Constant::Kelvin); @@ -3927,7 +3841,7 @@ namespace Window { Zoutlet = pow_2(AGap / (0.6 * AEqOutlet + 0.000001) - 1.0); AVGap = 0.5 * RhoAir * (1 + Zinlet + Zoutlet); RhoTRef = wm->AirProps[0] * Constant::Kelvin; - CVGap = RhoTRef * 9.81 * GapHeight * state.dataSurface->Surface(SurfNum).SinTilt * (TGapOld - TGapInlet) / (TGapOld * TGapInlet); + CVGap = RhoTRef * 9.81 * GapHeight * s_surf->Surface(SurfNum).SinTilt * (TGapOld - TGapInlet) / (TGapOld * TGapInlet); // Solution of quadratic equation in VGap VGap = (std::sqrt(pow_2(BVGap) + std::abs(4.0 * AVGap * CVGap)) - BVGap) / (2.0 * AVGap); @@ -3949,8 +3863,7 @@ namespace Window { QConvGap = RhoAir * AGap * VGap * 1008.0 * (TGapOutlet - TGapInlet); // Exclude convection to gap due to divider, if present; divider convection handled // separately in CalcWinFrameAndDividerTemps - QConvGap *= 0.5 * (1.0 + state.dataSurface->Surface(SurfNum).Area / - (state.dataSurface->Surface(SurfNum).Area + state.dataSurface->SurfWinDividerArea(SurfNum))); + QConvGap *= 0.5 * (1.0 + s_surf->Surface(SurfNum).Area / (s_surf->Surface(SurfNum).Area + s_surf->SurfWinDividerArea(SurfNum))); } } @@ -4031,13 +3944,16 @@ namespace Window { Real64 pr; // Gap gas Prandtl number Real64 nu; // Gap gas Nusselt number WinShadingType ShadeFlag; // Shading flag - int BlNum; // Blind number int IGapInc; // Gap increment (0 or 1) auto &wm = state.dataWindowManager; + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; + + auto &surf = s_surf->Surface(SurfNum); - ConstrNumSh = state.dataSurface->Surface(SurfNum).activeShadedConstruction; - ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); + ConstrNumSh = surf.activeShadedConstruction; + ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); nglassfaces = 2 * state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers; if (state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers == 2) { // Double glazing @@ -4055,7 +3971,8 @@ namespace Window { TShadeFace(IGap) = wm->thetas[IGap + 5]; } } - auto const *thisMaterialShade = dynamic_cast(state.dataMaterial->Material(MatNumSh)); + + auto const *matShadingDevice = dynamic_cast(s_mat->materials(MatNumSh)); for (int IGap = 1; IGap <= 2; ++IGap) { TAve(IGap) = 0.5 * (TGlassFace(IGap) + TShadeFace(IGap)); @@ -4073,7 +3990,7 @@ namespace Window { // For near-horizontal windows (i.e., no more than 5 deg from horizontal) assume // there is no air flow thru gap - if (std::abs(state.dataSurface->Surface(SurfNum).SinTilt) < 0.0872) { + if (std::abs(s_surf->Surface(SurfNum).SinTilt) < 0.0872) { VGap = 0.0; for (int IGap = 1; IGap <= 2; ++IGap) { hcv(IGap) = 2.0 * hGapStill(IGap); @@ -4082,26 +3999,19 @@ namespace Window { return; } - GapHeight = state.dataSurface->Surface(SurfNum).Height; + GapHeight = s_surf->Surface(SurfNum).Height; GapDepth = wm->gaps[IGapInc].width; - AGap = GapDepth * state.dataSurface->Surface(SurfNum).Width; - - if (ShadeFlag == WinShadingType::BGShade) { - // Shade on - ATopGap = thisMaterialShade->WinShadeTopOpeningMult * AGap; - ABotGap = thisMaterialShade->WinShadeBottomOpeningMult * AGap; - ALeftGap = thisMaterialShade->WinShadeLeftOpeningMult * GapHeight * GapDepth; - ARightGap = thisMaterialShade->WinShadeRightOpeningMult * GapHeight * GapDepth; - AHolesGap = thisMaterialShade->WinShadeAirFlowPermeability * GapHeight * state.dataSurface->Surface(SurfNum).Width; + AGap = GapDepth * s_surf->Surface(SurfNum).Width; + + ATopGap = matShadingDevice->topOpeningMult * AGap; + ABotGap = matShadingDevice->bottomOpeningMult * AGap; + ALeftGap = matShadingDevice->leftOpeningMult * GapHeight * GapDepth; + ARightGap = matShadingDevice->rightOpeningMult * GapHeight * GapDepth; + // For blinds, airFlowPermeability depends on slat angle which is a property of the surface, not the material + if (matShadingDevice->group == Material::Group::Blind) { + AHolesGap = s_surf->surfShades(SurfNum).blind.airFlowPermeability * GapHeight * surf.Width; } else { - // Blind on - BlNum = state.dataSurface->SurfWinBlindNumber(SurfNum); - auto const &blind = state.dataMaterial->Blind(BlNum); - ATopGap = blind.BlindTopOpeningMult * AGap; - ABotGap = blind.BlindBottomOpeningMult * AGap; - ALeftGap = blind.BlindLeftOpeningMult * GapHeight * GapDepth; - ARightGap = blind.BlindRightOpeningMult * GapHeight * GapDepth; - AHolesGap = state.dataSurface->SurfWinBlindAirFlowPermeability(SurfNum) * GapHeight * state.dataSurface->Surface(SurfNum).Width; + AHolesGap = matShadingDevice->airFlowPermeability * GapHeight * surf.Width; } for (int IGap = 1; IGap <= 2; ++IGap) { @@ -4126,7 +4036,7 @@ namespace Window { AVGap = 0.5 * (RhoGas(1) + RhoGas(2)) * (1.0 + Zinlet + Zoutlet); WindowGasPropertiesAtTemp(state, Constant::Kelvin, 1 + IGapInc, RhoGasZero, ViscGasZero); RhoTRef = RhoGasZero * Constant::Kelvin; - CVGap = RhoTRef * 9.81 * GapHeight * state.dataSurface->Surface(SurfNum).SinTilt * (TGapOld(1) - TGapOld(2)) / (TGapOld(1) * TGapOld(2)); + CVGap = RhoTRef * 9.81 * GapHeight * s_surf->Surface(SurfNum).SinTilt * (TGapOld(1) - TGapOld(2)) / (TGapOld(1) * TGapOld(2)); // Solution of quadratic equation in VGap @@ -4218,16 +4128,20 @@ namespace Window { // Dens dDens/dT Con dCon/dT Vis dVis/dT Prandtl dPrandtl/dT // DATA AirProps / 1.29, -0.4d-2, 2.41d-2, 7.6d-5, 1.73d-5, 1.0d-7, 0.72, 1.8d-3 / + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; auto &wm = state.dataWindowManager; - ConstrNum = state.dataSurface->Surface(SurfNum).Construction; + auto &surf = s_surf->Surface(SurfNum); + + ConstrNum = surf.Construction; NGlass = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; TGlassFace1 = wm->thetas[2 * NGlass - 3]; TGlassFace2 = wm->thetas[2 * NGlass - 2]; GapNum = NGlass - 1; TAve = 0.5 * (TGlassFace1 + TGlassFace2); - if (state.dataSurface->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { + if (s_surf->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { TGapInlet = wm->tin; // Source is inside air } else { TGapInlet = wm->tout; // Source is outside air @@ -4243,10 +4157,10 @@ namespace Window { WindowGasConductance(state, TGlassFace1, TGlassFace2, GapNum, con, pr, gr); NusseltNumber(state, SurfNum, TGlassFace1, TGlassFace2, GapNum, gr, pr, nu); hGapStill = con / wm->gaps[GapNum - 1].width * nu; - GapHeight = state.dataSurface->Surface(SurfNum).Height; - GapDepth = state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(2 * NGlass - 2))->Thickness; - AGap = GapDepth * state.dataSurface->Surface(SurfNum).Width; - VGap = state.dataSurface->SurfWinAirflowThisTS(SurfNum) / GapDepth; + GapHeight = surf.Height; + GapDepth = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(2 * NGlass - 2))->Thickness; + AGap = GapDepth * surf.Width; + VGap = s_surf->SurfWinAirflowThisTS(SurfNum) / GapDepth; hcv = 2.0 * hGapStill + 4.0 * VGap; RhoAir = wm->AirProps[0] + wm->AirProps[1] * (TGapOld - Constant::Kelvin); GapHeightChar = RhoAir * 1008.0 * GapDepth * VGap / (2.0 * hcv); @@ -4329,14 +4243,15 @@ namespace Window { int IGapInc; // Gap increment; =0, double glass, =1, triple glass // REAL(r64) :: AirProps(8) ! Air properties + auto &s_surf = state.dataSurface; auto &wm = state.dataWindowManager; // Air properties // Dens dDens/dT Con dCon/dT Vis dVis/dT Prandtl dPrandtl/dT // DATA AirProps / 1.29, -0.4d-2, 2.41d-2, 7.6d-5, 1.73d-5, 1.0d-7, 0.72, 1.8d-3 / - ConstrNumSh = state.dataSurface->Surface(SurfNum).activeShadedConstruction; - ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); + ConstrNumSh = s_surf->Surface(SurfNum).activeShadedConstruction; + ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); if (state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers == 2) { // Double glazing MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(3); @@ -4354,17 +4269,17 @@ namespace Window { } } - if (state.dataSurface->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { + if (s_surf->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { TGapInlet = wm->tin; } else { TGapInlet = wm->tout; } - GapHeight = state.dataSurface->Surface(SurfNum).Height; + GapHeight = s_surf->Surface(SurfNum).Height; GapDepth = wm->gaps[IGapInc].width; - AGap = GapDepth * state.dataSurface->Surface(SurfNum).Width; + AGap = GapDepth * s_surf->Surface(SurfNum).Width; // Factor of 2 below assumes gaps on either side of shade/blind have same depth - VGap = state.dataSurface->SurfWinAirflowThisTS(SurfNum) / (2.0 * GapDepth); + VGap = s_surf->SurfWinAirflowThisTS(SurfNum) / (2.0 * GapDepth); for (int IGap = 1; IGap <= 2; ++IGap) { TAve(IGap) = 0.5 * (TGlassFace(IGap) + TShadeFace(IGap)); @@ -4483,7 +4398,7 @@ namespace Window { //************************************************************************** - void LUsolution(EnergyPlusData &state, + void LUsolution([[maybe_unused]] EnergyPlusData &state, Array2 const &a, // Matrix and vector in a.x = b; int const n, // Dimension of a and b Array1D_int const &indx, // Vector of row permutations @@ -4835,10 +4750,11 @@ namespace Window { // current time step value, nglface, if storm window was // added or removed during the current time step). + auto &s_surf = state.dataSurface; auto &wm = state.dataWindowManager; - StormWinFlagPrevDay = state.dataSurface->SurfWinStormWinFlagPrevDay(SurfNum); - StormWinFlagThisDay = state.dataSurface->SurfWinStormWinFlag(SurfNum); + StormWinFlagPrevDay = s_surf->SurfWinStormWinFlagPrevDay(SurfNum); + StormWinFlagThisDay = s_surf->SurfWinStormWinFlag(SurfNum); if (state.dataGlobal->BeginEnvrnFlag || (StormWinFlagThisDay != StormWinFlagPrevDay)) { @@ -4874,17 +4790,17 @@ namespace Window { } else { // Use previous time step values for (int i = 1; i <= wm->nglface; ++i) { - wm->thetas[i - 1] = state.dataSurface->SurfaceWindow(SurfNum).thetaFace[i]; + wm->thetas[i - 1] = s_surf->SurfaceWindow(SurfNum).thetaFace[i]; } } // Initialize face temperatures of shade or blind, if present - ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); - if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinExtIntShadePrevTS(SurfNum)) || - state.dataSurface->SurfWinExtIntShadePrevTS(SurfNum) == WinShadingType::ExtShade || - state.dataSurface->SurfWinExtIntShadePrevTS(SurfNum) == WinShadingType::ExtBlind || - ANY_BETWEENGLASS_SHADE_BLIND(state.dataSurface->SurfWinExtIntShadePrevTS(SurfNum))) { + ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); + if (ANY_INTERIOR_SHADE_BLIND(s_surf->SurfWinExtIntShadePrevTS(SurfNum)) || + s_surf->SurfWinExtIntShadePrevTS(SurfNum) == WinShadingType::ExtShade || + s_surf->SurfWinExtIntShadePrevTS(SurfNum) == WinShadingType::ExtBlind || + ANY_BETWEENGLASS_SHADE_BLIND(s_surf->SurfWinExtIntShadePrevTS(SurfNum))) { // Shade or blind is on during the previous TS; use previous-TS values of shade/blind face temps. // Note that if shade or blind is NOT on in the current TS the following two // temperature values, although calculated here, are not used. The shade/blind face numbers @@ -4893,8 +4809,8 @@ namespace Window { nglfacePrevDay = wm->nglface; if (StormWinFlagPrevDay == 0 && StormWinFlagThisDay == 1) nglfacePrevDay = wm->nglface - 2; if (StormWinFlagPrevDay == 1 && StormWinFlagThisDay == 0) nglfacePrevDay = wm->nglface + 2; - wm->thetas[wm->nglface] = state.dataSurface->SurfaceWindow(SurfNum).thetaFace[nglfacePrevDay + 1]; - wm->thetas[wm->nglface + 1] = state.dataSurface->SurfaceWindow(SurfNum).thetaFace[nglfacePrevDay + 2]; + wm->thetas[wm->nglface] = s_surf->SurfaceWindow(SurfNum).thetaFace[nglfacePrevDay + 1]; + wm->thetas[wm->nglface + 1] = s_surf->SurfaceWindow(SurfNum).thetaFace[nglfacePrevDay + 2]; } else { // No shade or blind previous time step; guess starting values of shade/blind // taking into account short- and long-wave radiation (from solar, lights and zone equipment) @@ -4974,10 +4890,11 @@ namespace Window { Real64 g; Real64 ang; + auto &s_surf = state.dataSurface; auto &wm = state.dataWindowManager; if (SurfNum > 0) { - asp = state.dataSurface->Surface(SurfNum).Height / wm->gaps[IGap - 1].width; + asp = s_surf->Surface(SurfNum).Height / wm->gaps[IGap - 1].width; } else { // SurfNum = 0 when NusseltNumber is called from CalcNominalWindowCond, which applies to a // particular construction. So window height is not known and we assume 5 ft (1.524 m) asp = 1.524 / wm->gaps[IGap - 1].width; @@ -5804,92 +5721,6 @@ namespace Window { //************************************************************************************* - Real64 DiffuseAverageProfAngGnd(Array1S const Property) // Property value vs. profile angle - { - - // FUNCTION INFORMATION: - // AUTHOR Fred Winkelmann - // DATE WRITTEN January 2004 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // Calculates diffuse average of Property, such as blind transmittance, over profile angles - // corresponding to (upgoing) radiation from the ground. - - // METHODOLOGY EMPLOYED: - // Integration by Simpson's rule assuming uniform radiance distribution. - - // Return value - Real64 DiffuseAverageProfAngGnd; - - Real64 Phi; // Profile angle (radians) - Real64 DPhi; // Phi increment - Real64 Sum; // Sums - Real64 SumDenom; - - Sum = 0.0; - SumDenom = 0.0; - DPhi = 5.0 * Constant::DegToRadians; - - // Integrate from -90 to 0 deg - for (int IPhi = 1; IPhi <= (Material::MaxProfAngs / 2); ++IPhi) { - Phi = -Constant::PiOvr2 + (IPhi - 0.5) * DPhi; - Sum += std::cos(Phi) * DPhi * InterpProfAng(Phi, Property); - SumDenom += std::cos(Phi) * DPhi; - } - - DiffuseAverageProfAngGnd = Sum / SumDenom; - if (DiffuseAverageProfAngGnd < 0.0) DiffuseAverageProfAngGnd = 0.0; - - return DiffuseAverageProfAngGnd; - } // DiffuseAverageProfAngGnd() - - //************************************************************************************* - - Real64 DiffuseAverageProfAngSky(Array1S const Property) // Property value vs. profile angle - { - - // FUNCTION INFORMATION: - // AUTHOR Fred Winkelmann - // DATE WRITTEN January 2004 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // Calculates diffuse average of Property, such as blind transmittance, over profile angles - // corresponding to (downgoing) radiation from the sky. - - // METHODOLOGY EMPLOYED: - // Integration by Simpson's rule assuming uniform radiance distribution. - - // Return value - Real64 DiffuseAverageProfAngSky; - - Real64 Phi; // Profile angle (radians) - Real64 DPhi; // Phi increment - Real64 Sum; // Sums - Real64 SumDenom; - - Sum = 0.0; - SumDenom = 0.0; - DPhi = 5.0 * Constant::DegToRadians; - - // Integrate from 0 to 90 deg - for (int IPhi = (Material::MaxProfAngs / 2) + 1; IPhi <= Material::MaxProfAngs - 1; ++IPhi) { - Phi = -Constant::PiOvr2 + (IPhi - 0.5) * DPhi; - Sum += std::cos(Phi) * DPhi * InterpProfAng(Phi, Property); - SumDenom += std::cos(Phi) * DPhi; - } - - DiffuseAverageProfAngSky = Sum / SumDenom; - if (DiffuseAverageProfAngSky < 0.0) DiffuseAverageProfAngSky = 0.0; - - return DiffuseAverageProfAngSky; - } // DiffuseAverageProfAngSky() - - //************************************************************************************* - void CalcWinFrameAndDividerTemps(EnergyPlusData &state, int const SurfNum, // Surface number Real64 const tout, // Outside air temperature (K) @@ -5960,156 +5791,147 @@ namespace Window { Real64 DividerHeatGain; // Heat gain to zone from divider (W) // Real64 DividerHeatTransfer; // Heat transfer through divider (W) - auto const &surfWin = state.dataSurface->SurfaceWindow(SurfNum); + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; - TInRad = root_4(state.dataSurface->SurfWinIRfromParentZone(SurfNum) / Constant::StefanBoltzmann); + auto const &surfWin = s_surf->SurfaceWindow(SurfNum); + + TInRad = root_4(s_surf->SurfWinIRfromParentZone(SurfNum) / Constant::StefanBoltzmann); TOutRad = root_4(Outir / Constant::StefanBoltzmann); - ShadeFlag = state.dataSurface->SurfWinShadingFlag(SurfNum); - FrDivNum = state.dataSurface->Surface(SurfNum).FrameDivider; + ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); + FrDivNum = s_surf->Surface(SurfNum).FrameDivider; auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); TotLayers = thisConstruct.TotLayers; TotGlassLayers = thisConstruct.TotSolidLayers; - EmisGlassOut = dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(1)))->AbsorpThermalFront; - EmisGlassIn = - dynamic_cast(state.dataMaterial->Material(thisConstruct.LayerPoint(TotLayers)))->AbsorpThermalBack; + EmisGlassOut = s_mat->materials(thisConstruct.LayerPoint(1))->AbsorpThermalFront; + EmisGlassIn = s_mat->materials(thisConstruct.LayerPoint(TotLayers))->AbsorpThermalBack; FrameHeatGain = 0.0; DividerHeatGain = 0.0; - state.dataSurface->SurfWinFrameHeatGain(SurfNum) = 0.0; - state.dataSurface->SurfWinFrameHeatLoss(SurfNum) = 0.0; - state.dataSurface->SurfWinDividerHeatGain(SurfNum) = 0.0; - state.dataSurface->SurfWinDividerHeatLoss(SurfNum) = 0.0; + s_surf->SurfWinFrameHeatGain(SurfNum) = 0.0; + s_surf->SurfWinFrameHeatLoss(SurfNum) = 0.0; + s_surf->SurfWinDividerHeatGain(SurfNum) = 0.0; + s_surf->SurfWinDividerHeatLoss(SurfNum) = 0.0; - if (state.dataSurface->SurfWinFrameArea(SurfNum) > 0.0) { + if (s_surf->SurfWinFrameArea(SurfNum) > 0.0) { // Window has a frame. Note that if a shade, screen or blind is present it covers only the glazed part of the // window and is assumed not to shadow long- or short-wave radiation incident on the frame elements. - ProjCorrFrOut = state.dataSurface->SurfWinProjCorrFrOut(SurfNum); - ProjCorrFrIn = state.dataSurface->SurfWinProjCorrFrIn(SurfNum); + ProjCorrFrOut = s_surf->SurfWinProjCorrFrOut(SurfNum); + ProjCorrFrIn = s_surf->SurfWinProjCorrFrIn(SurfNum); TOutRadFr = TOutRad * root_4((1.0 + 0.5 * ProjCorrFrOut) / (1.0 + ProjCorrFrOut)); TInRadFr = TInRad * root_4((1.0 + 0.5 * ProjCorrFrIn) / (1.0 + ProjCorrFrIn)); - FrameCon = state.dataSurface->SurfWinFrameConductance(SurfNum); - HInRad = 0.5 * state.dataSurface->SurfWinFrameEmis(SurfNum) * Constant::StefanBoltzmann * - pow_3(TInRadFr + state.dataSurface->SurfWinFrameTempIn(SurfNum) + Constant::Kelvin); + FrameCon = s_surf->SurfWinFrameConductance(SurfNum); + HInRad = 0.5 * s_surf->SurfWinFrameEmis(SurfNum) * Constant::StefanBoltzmann * + pow_3(TInRadFr + s_surf->SurfWinFrameTempIn(SurfNum) + Constant::Kelvin); HInConvFr = HInConv; - HOutRad = 0.5 * state.dataSurface->SurfWinFrameEmis(SurfNum) * Constant::StefanBoltzmann * - pow_3(TOutRadFr + state.dataSurface->SurfWinFrameTempSurfOut(SurfNum) + Constant::Kelvin); + HOutRad = 0.5 * s_surf->SurfWinFrameEmis(SurfNum) * Constant::StefanBoltzmann * + pow_3(TOutRadFr + s_surf->SurfWinFrameTempSurfOut(SurfNum) + Constant::Kelvin); HOutConvFr = HOutConv; - auto const &frdiv = state.dataSurface->FrameDivider(FrDivNum); + auto const &frdiv = s_surf->FrameDivider(FrDivNum); if (frdiv.FrameProjectionOut > 0.0) { HOutRad *= (1.0 + ProjCorrFrOut); HOutConvFr = HOutConv * (1.0 + ProjCorrFrOut); // Add long-wave from outside window surface absorbed by frame outside projection - state.dataSurface->SurfWinFrameQRadOutAbs(SurfNum) += 0.5 * state.dataSurface->SurfWinProjCorrFrOut(SurfNum) * frdiv.FrameEmis * - EmisGlassOut * Constant::StefanBoltzmann * pow_4(surfWin.thetaFace[1]); + s_surf->SurfWinFrameQRadOutAbs(SurfNum) += 0.5 * s_surf->SurfWinProjCorrFrOut(SurfNum) * frdiv.FrameEmis * EmisGlassOut * + Constant::StefanBoltzmann * pow_4(surfWin.thetaFace[1]); } if (frdiv.FrameProjectionIn > 0.0) { HInRad *= (1.0 + ProjCorrFrIn); HInConvFr = HInConv * (1.0 + ProjCorrFrIn); // Add long-wave from inside window surface absorbed by frame inside projection - state.dataSurface->SurfWinFrameQRadInAbs(SurfNum) += 0.5 * state.dataSurface->SurfWinProjCorrFrIn(SurfNum) * frdiv.FrameEmis * - EmisGlassIn * Constant::StefanBoltzmann * - pow_4(surfWin.thetaFace[2 * TotGlassLayers]); + s_surf->SurfWinFrameQRadInAbs(SurfNum) += 0.5 * s_surf->SurfWinProjCorrFrIn(SurfNum) * frdiv.FrameEmis * EmisGlassIn * + Constant::StefanBoltzmann * pow_4(surfWin.thetaFace[2 * TotGlassLayers]); } - Afac = (HOutRad * TOutRadFr + HOutConvFr * tout + state.dataSurface->SurfWinFrameQRadOutAbs(SurfNum)) / (HOutRad + FrameCon + HOutConvFr); + Afac = (HOutRad * TOutRadFr + HOutConvFr * tout + s_surf->SurfWinFrameQRadOutAbs(SurfNum)) / (HOutRad + FrameCon + HOutConvFr); Bfac = FrameCon / (HOutRad + FrameCon + HOutConvFr); - Dfac = (HInRad * TInRadFr + HInConvFr * tin + state.dataSurface->SurfWinFrameQRadInAbs(SurfNum)) / (HInRad + FrameCon + HInConvFr); + Dfac = (HInRad * TInRadFr + HInConvFr * tin + s_surf->SurfWinFrameQRadInAbs(SurfNum)) / (HInRad + FrameCon + HInConvFr); Efac = FrameCon / (HInRad + FrameCon + HInConvFr); - state.dataSurface->SurfWinFrameTempIn(SurfNum) = (Dfac + Efac * Afac) / (1.0 - Efac * Bfac) - Constant::Kelvin; - state.dataSurface->SurfWinFrameTempSurfOut(SurfNum) = - Afac + Bfac * (state.dataSurface->SurfWinFrameTempIn(SurfNum) + Constant::Kelvin) - Constant::Kelvin; + s_surf->SurfWinFrameTempIn(SurfNum) = (Dfac + Efac * Afac) / (1.0 - Efac * Bfac) - Constant::Kelvin; + s_surf->SurfWinFrameTempSurfOut(SurfNum) = Afac + Bfac * (s_surf->SurfWinFrameTempIn(SurfNum) + Constant::Kelvin) - Constant::Kelvin; // Heat gain to zone from frame - // FrameHeatTransfer = state.dataSurface->SurfWinFrameArea(SurfNum) * FrameCon * - // (state.dataSurface->SurfWinFrameTempSurfOut(SurfNum) - state.dataSurface->SurfWinFrameTempIn(SurfNum)); - FrameHeatGain = state.dataSurface->SurfWinFrameArea(SurfNum) * (1.0 + state.dataSurface->SurfWinProjCorrFrIn(SurfNum)) * - (HInConvFr * (state.dataSurface->SurfWinFrameTempIn(SurfNum) + Constant::Kelvin - tin)); + // FrameHeatTransfer = s_surf->SurfWinFrameArea(SurfNum) * FrameCon * + // (s_surf->SurfWinFrameTempSurfOut(SurfNum) - s_surf->SurfWinFrameTempIn(SurfNum)); + FrameHeatGain = s_surf->SurfWinFrameArea(SurfNum) * (1.0 + s_surf->SurfWinProjCorrFrIn(SurfNum)) * + (HInConvFr * (s_surf->SurfWinFrameTempIn(SurfNum) + Constant::Kelvin - tin)); if (FrameHeatGain > 0.0) { - state.dataSurface->SurfWinFrameHeatGain(SurfNum) = FrameHeatGain; + s_surf->SurfWinFrameHeatGain(SurfNum) = FrameHeatGain; } else { - state.dataSurface->SurfWinFrameHeatLoss(SurfNum) = std::abs(FrameHeatGain); + s_surf->SurfWinFrameHeatLoss(SurfNum) = std::abs(FrameHeatGain); } - state.dataSurface->SurfWinHeatGain(SurfNum) += FrameHeatGain; - state.dataSurface->SurfWinGainFrameDividerToZoneRep(SurfNum) = FrameHeatGain; + s_surf->SurfWinHeatGain(SurfNum) += FrameHeatGain; + s_surf->SurfWinGainFrameDividerToZoneRep(SurfNum) = FrameHeatGain; } // End of check if window has a frame - if (state.dataSurface->SurfWinDividerArea(SurfNum) > 0.0 && state.dataSurface->SurfWinStormWinFlag(SurfNum) < 1) { + if (s_surf->SurfWinDividerArea(SurfNum) > 0.0 && s_surf->SurfWinStormWinFlag(SurfNum) < 1) { // Window has divider. Note that if the window has a storm window layer in place (StormWinFlag = 1) // the divider heat transfer calculation is not done. - DivType = state.dataSurface->SurfWinDividerType(SurfNum); - DivCon = state.dataSurface->SurfWinDividerConductance(SurfNum); + DivType = s_surf->SurfWinDividerType(SurfNum); + DivCon = s_surf->SurfWinDividerConductance(SurfNum); if (DivType == DataSurfaces::FrameDividerType::DividedLite) { // Divided lite - DivEmisIn = state.dataSurface->SurfWinDividerEmis(SurfNum); + DivEmisIn = s_surf->SurfWinDividerEmis(SurfNum); DivEmisOut = DivEmisIn; } else { // Suspended (between-glass) divider - DivEmisOut = state.dataMaterial->Material(thisConstruct.LayerPoint(1))->AbsorpThermalFront; - DivEmisIn = state.dataMaterial->Material(thisConstruct.LayerPoint(thisConstruct.TotLayers))->AbsorpThermalBack; - } - - TOutRadDiv = TOutRad * root_4((1.0 + state.dataSurface->SurfWinProjCorrDivOut(SurfNum)) / - (1.0 + 2.0 * state.dataSurface->SurfWinProjCorrDivOut(SurfNum))); - TInRadDiv = TInRad * root_4((1.0 + state.dataSurface->SurfWinProjCorrDivIn(SurfNum)) / - (1.0 + 2.0 * state.dataSurface->SurfWinProjCorrDivIn(SurfNum))); - HInRad = - 0.5 * DivEmisIn * Constant::StefanBoltzmann * pow_3(TInRadDiv + state.dataSurface->SurfWinDividerTempIn(SurfNum) + Constant::Kelvin); - HOutRad = 0.5 * DivEmisOut * Constant::StefanBoltzmann * - pow_3(TOutRadDiv + state.dataSurface->SurfWinDividerTempSurfOut(SurfNum) + Constant::Kelvin); + DivEmisOut = s_mat->materials(thisConstruct.LayerPoint(1))->AbsorpThermalFront; + DivEmisIn = s_mat->materials(thisConstruct.LayerPoint(thisConstruct.TotLayers))->AbsorpThermalBack; + } + + TOutRadDiv = TOutRad * root_4((1.0 + s_surf->SurfWinProjCorrDivOut(SurfNum)) / (1.0 + 2.0 * s_surf->SurfWinProjCorrDivOut(SurfNum))); + TInRadDiv = TInRad * root_4((1.0 + s_surf->SurfWinProjCorrDivIn(SurfNum)) / (1.0 + 2.0 * s_surf->SurfWinProjCorrDivIn(SurfNum))); + HInRad = 0.5 * DivEmisIn * Constant::StefanBoltzmann * pow_3(TInRadDiv + s_surf->SurfWinDividerTempIn(SurfNum) + Constant::Kelvin); + HOutRad = + 0.5 * DivEmisOut * Constant::StefanBoltzmann * pow_3(TOutRadDiv + s_surf->SurfWinDividerTempSurfOut(SurfNum) + Constant::Kelvin); HOutConvDiv = HOutConv; - auto const &frdiv = state.dataSurface->FrameDivider(FrDivNum); + auto const &frdiv = s_surf->FrameDivider(FrDivNum); if (frdiv.DividerProjectionOut > 0.0) { - HOutRad *= (1.0 + 2.0 * state.dataSurface->SurfWinProjCorrDivOut(SurfNum)); - if (state.dataSurface->SurfWinShadingFlag(SurfNum) == WinShadingType::ExtShade) - HOutConvDiv = state.dataSurface->SurfWinConvCoeffWithShade(SurfNum); - HOutConvDiv *= (1.0 + 2.0 * state.dataSurface->SurfWinProjCorrDivOut(SurfNum)); + HOutRad *= (1.0 + 2.0 * s_surf->SurfWinProjCorrDivOut(SurfNum)); + if (s_surf->SurfWinShadingFlag(SurfNum) == WinShadingType::ExtShade) HOutConvDiv = s_surf->SurfWinConvCoeffWithShade(SurfNum); + HOutConvDiv *= (1.0 + 2.0 * s_surf->SurfWinProjCorrDivOut(SurfNum)); // Add long-wave from outside window surface absorbed by divider outside projection - state.dataSurface->SurfWinDividerQRadOutAbs(SurfNum) += state.dataSurface->SurfWinProjCorrDivOut(SurfNum) * frdiv.DividerEmis * - EmisGlassOut * Constant::StefanBoltzmann * pow_4(surfWin.thetaFace[1]); + s_surf->SurfWinDividerQRadOutAbs(SurfNum) += s_surf->SurfWinProjCorrDivOut(SurfNum) * frdiv.DividerEmis * EmisGlassOut * + Constant::StefanBoltzmann * pow_4(surfWin.thetaFace[1]); } HInConvDiv = HInConv; if (frdiv.DividerProjectionIn > 0.0) { - HInRad *= (1.0 + 2.0 * state.dataSurface->SurfWinProjCorrDivIn(SurfNum)); - if (state.dataSurface->SurfWinShadingFlag(SurfNum) == WinShadingType::IntShade) - HInConvDiv = state.dataSurface->SurfWinConvCoeffWithShade(SurfNum); - HInConvDiv *= (1.0 + 2.0 * state.dataSurface->SurfWinProjCorrDivIn(SurfNum)); + HInRad *= (1.0 + 2.0 * s_surf->SurfWinProjCorrDivIn(SurfNum)); + if (s_surf->SurfWinShadingFlag(SurfNum) == WinShadingType::IntShade) HInConvDiv = s_surf->SurfWinConvCoeffWithShade(SurfNum); + HInConvDiv *= (1.0 + 2.0 * s_surf->SurfWinProjCorrDivIn(SurfNum)); // Add long-wave from inside window surface absorbed by divider inside projection - state.dataSurface->SurfWinDividerQRadInAbs(SurfNum) += state.dataSurface->SurfWinProjCorrDivIn(SurfNum) * frdiv.DividerEmis * - EmisGlassIn * Constant::StefanBoltzmann * - pow_4(surfWin.thetaFace[2 * TotGlassLayers]); + s_surf->SurfWinDividerQRadInAbs(SurfNum) += s_surf->SurfWinProjCorrDivIn(SurfNum) * frdiv.DividerEmis * EmisGlassIn * + Constant::StefanBoltzmann * pow_4(surfWin.thetaFace[2 * TotGlassLayers]); } - Afac = - (HOutRad * TOutRadDiv + HOutConvDiv * tout + state.dataSurface->SurfWinDividerQRadOutAbs(SurfNum)) / (HOutRad + DivCon + HOutConvDiv); + Afac = (HOutRad * TOutRadDiv + HOutConvDiv * tout + s_surf->SurfWinDividerQRadOutAbs(SurfNum)) / (HOutRad + DivCon + HOutConvDiv); Bfac = DivCon / (HOutRad + DivCon + HOutConvDiv); - Dfac = (HInRad * TInRadDiv + HInConvDiv * tin + state.dataSurface->SurfWinDividerQRadInAbs(SurfNum)) / (HInRad + DivCon + HInConvDiv); + Dfac = (HInRad * TInRadDiv + HInConvDiv * tin + s_surf->SurfWinDividerQRadInAbs(SurfNum)) / (HInRad + DivCon + HInConvDiv); Efac = DivCon / (HInRad + DivCon + HInConvDiv); - state.dataSurface->SurfWinDividerTempIn(SurfNum) = (Dfac + Efac * Afac) / (1 - Efac * Bfac) - Constant::Kelvin; - state.dataSurface->SurfWinDividerTempSurfOut(SurfNum) = - Afac + Bfac * (state.dataSurface->SurfWinDividerTempIn(SurfNum) + Constant::Kelvin) - Constant::Kelvin; + s_surf->SurfWinDividerTempIn(SurfNum) = (Dfac + Efac * Afac) / (1 - Efac * Bfac) - Constant::Kelvin; + s_surf->SurfWinDividerTempSurfOut(SurfNum) = Afac + Bfac * (s_surf->SurfWinDividerTempIn(SurfNum) + Constant::Kelvin) - Constant::Kelvin; // Contribution of divider to window heat gain - // ProjCorrWinHeatGain = 1.0 + 2.0 * state.dataSurface->SurfWinProjCorrDivIn(SurfNum); + // ProjCorrWinHeatGain = 1.0 + 2.0 * s_surf->SurfWinProjCorrDivIn(SurfNum); - DividerHeatGain = state.dataSurface->SurfWinDividerArea(SurfNum) * (1.0 + state.dataSurface->SurfWinProjCorrDivIn(SurfNum)) * - (HInConvDiv * (state.dataSurface->SurfWinDividerTempIn(SurfNum) + Constant::Kelvin - tin)); - // DividerHeatTransfer = state.dataSurface->SurfWinDividerArea(SurfNum) * DivCon * - // (state.dataSurface->SurfWinDividerTempSurfOut(SurfNum) - state.dataSurface->SurfWinDividerTempIn(SurfNum)); + DividerHeatGain = s_surf->SurfWinDividerArea(SurfNum) * (1.0 + s_surf->SurfWinProjCorrDivIn(SurfNum)) * + (HInConvDiv * (s_surf->SurfWinDividerTempIn(SurfNum) + Constant::Kelvin - tin)); + // DividerHeatTransfer = s_surf->SurfWinDividerArea(SurfNum) * DivCon * + // (s_surf->SurfWinDividerTempSurfOut(SurfNum) - s_surf->SurfWinDividerTempIn(SurfNum)); if (DividerHeatGain > 0.0) { - state.dataSurface->SurfWinDividerHeatGain(SurfNum) = DividerHeatGain; + s_surf->SurfWinDividerHeatGain(SurfNum) = DividerHeatGain; } else { - state.dataSurface->SurfWinDividerHeatLoss(SurfNum) = std::abs(DividerHeatGain); + s_surf->SurfWinDividerHeatLoss(SurfNum) = std::abs(DividerHeatGain); } - state.dataSurface->SurfWinHeatGain(SurfNum) += DividerHeatGain; - state.dataSurface->SurfWinGainFrameDividerToZoneRep(SurfNum) += DividerHeatGain; + s_surf->SurfWinHeatGain(SurfNum) += DividerHeatGain; + s_surf->SurfWinGainFrameDividerToZoneRep(SurfNum) += DividerHeatGain; // If interior shade is present it is assumed that both the convective and IR radiative gain // from the inside surface of the divider goes directly into the zone air -- i.e., the IR radiative // interaction between divider and shade is ignored due to the difficulty of calculating this interaction // at the same time that the interaction between glass and shade is calculated. - if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinShadingFlag(SurfNum))) - state.dataSurface->SurfWinDividerHeatGain(SurfNum) = DividerHeatGain; - // DivTempOut = state.dataSurface->SurfWinDividerTempSurfOut(SurfNum) + Constant::Kelvin; + if (ANY_INTERIOR_SHADE_BLIND(s_surf->SurfWinShadingFlag(SurfNum))) s_surf->SurfWinDividerHeatGain(SurfNum) = DividerHeatGain; + // DivTempOut = s_surf->SurfWinDividerTempSurfOut(SurfNum) + Constant::Kelvin; } // End of check if window has dividers } // CalcWinFrameAndDividerTemps() @@ -6142,6 +5964,7 @@ namespace Window { // PURPOSE OF THIS SUBROUTINE: // Calculates nominal center-of-glass U-value and solar heat gain coefficient // (SHGC) of a window construction for ASHRAE winter and summer conditions. + // This function is just for reporting // Winter: // Inside air temperature = 21.C (69.80F) // Outside air temperature = -18C (-.4F) @@ -6198,7 +6021,6 @@ namespace Window { int TotLay; // Total number of layers in a construction // (sum of solid layers and gap layers) int TotGlassLay; // Total number of glass layers in a construction - int Lay; // Layer number int LayPtr; // Material number for a layer Real64 BeamSolarInc; // Incident beam radiation at zero angle of incidence (W/m2) @@ -6218,11 +6040,8 @@ namespace Window { int MatShade; // Material number of shade layer Array1D AbsBeamNorm(maxGlassLayers); // Beam absorptance at normal incidence for each glass layer Real64 AbsBeamShadeNorm; // Shade solar absorptance at normal incidence - int ConstrNum1; // Construction counter int ConstrNumBare; // Construction without shading device int BlNum; // Blind number - int ScNum; // Screen number - bool VarSlats; // True if slats in blind are variable angle Real64 SlatAng; // Slat angle (rad) int LayPtrSh; // Layer pointer of blind Real64 TBmBm; // Bare glass normal incidence beam-beam transmittance @@ -6264,6 +6083,8 @@ namespace Window { Real64 TDifVis; Real64 AGlDiffBack; // Back diffuse solar absorptance of a glass layer + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; auto &wm = state.dataWindowManager; // Autodesk:Uninit Initialize variables used uninitialized // Rbare = 0.0; // Autodesk:Uninit Force default initialization @@ -6318,36 +6139,36 @@ namespace Window { ShadeRes = 0.0; MatOutside = state.dataConstruction->Construct(ConstrNum).LayerPoint(1); MatInside = state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLay); - if (state.dataMaterial->Material(MatOutside)->group == Material::Group::Shade) { // Exterior shade present + if (s_mat->materials(MatOutside)->group == Material::Group::Shade) { // Exterior shade present MatShade = MatOutside; ShadeFlag = WinShadingType::ExtShade; // Set glazing outside convection coefficient to Window 4 still-air value wm->hcout = 12.25; - } else if (state.dataMaterial->Material(MatOutside)->group == Material::Group::Screen) { // Exterior screen present + } else if (s_mat->materials(MatOutside)->group == Material::Group::Screen) { // Exterior screen present MatShade = MatOutside; ShadeFlag = WinShadingType::ExtScreen; wm->hcout = 12.25; - } else if (state.dataMaterial->Material(MatOutside)->group == Material::Group::WindowBlind) { // Exterior blind present + } else if (s_mat->materials(MatOutside)->group == Material::Group::Blind) { // Exterior blind present MatShade = MatOutside; ShadeFlag = WinShadingType::ExtBlind; - BlNum = dynamic_cast(state.dataMaterial->Material(MatShade))->BlindDataPtr; + BlNum = MatOutside; wm->hcout = 12.25; - } else if (state.dataMaterial->Material(MatInside)->group == Material::Group::Shade) { // Interior shade present + } else if (s_mat->materials(MatInside)->group == Material::Group::Shade) { // Interior shade present MatShade = MatInside; ShadeFlag = WinShadingType::IntShade; - } else if (state.dataMaterial->Material(MatInside)->group == Material::Group::WindowBlind) { // Interior blind present + } else if (s_mat->materials(MatInside)->group == Material::Group::Blind) { // Interior blind present MatShade = MatInside; - BlNum = dynamic_cast(state.dataMaterial->Material(MatShade))->BlindDataPtr; + BlNum = MatShade; ShadeFlag = WinShadingType::IntBlind; } else if (TotGlassLay == 2) { - if (state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3))->group == Material::Group::Shade) + if (s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(3))->group == Material::Group::Shade) ShadeFlag = WinShadingType::BGShade; - if (state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3))->group == Material::Group::WindowBlind) + if (s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(3))->group == Material::Group::Blind) ShadeFlag = WinShadingType::BGBlind; } else if (TotGlassLay == 3) { - if (state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5))->group == Material::Group::Shade) + if (s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(5))->group == Material::Group::Shade) ShadeFlag = WinShadingType::BGShade; - if (state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5))->group == Material::Group::WindowBlind) + if (s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(5))->group == Material::Group::Blind) ShadeFlag = WinShadingType::BGBlind; } @@ -6393,10 +6214,11 @@ namespace Window { auto const &constructBare = state.dataConstruction->Construct(ConstrNumBare); TBmBm = POLYF(1.0, constructBare.TransSolBeamCoef); TBmBmVis = POLYF(1.0, constructBare.TransVisBeamCoef); + if (ShadeFlag == WinShadingType::ExtScreen) { // 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 - auto const *matScreen = dynamic_cast(state.dataMaterial->Material(MatShade)); + auto const *matScreen = dynamic_cast(s_mat->materials(MatShade)); assert(matScreen != nullptr); auto const &btar = matScreen->btars[0][0]; TScBmBm = btar.BmTrans; @@ -6417,48 +6239,64 @@ namespace Window { TScBmDif * TDif / (1 - RGlDiffFront * RScDifBack); TVisNorm = TScBmBmVis * (TBmBmVis + TDifVis * RGlFrontVis * RScBackVis / (1 - RGlDiffFrontVis * RScDifBackVis)) + TScBmDifVis * TDifVis / (1 - RGlDiffFrontVis * RScDifBackVis); - } else { - auto const &blind = state.dataMaterial->Blind(BlNum); - VarSlats = false; - if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Variable) VarSlats = true; - SlatAng = blind.SlatAngle * Constant::DegToRadians; - TBlBmBm = BlindBeamBeamTrans(0.0, SlatAng, blind.SlatWidth, blind.SlatSeparation, blind.SlatThickness); + + } else { // Blind + auto const *matBlind = dynamic_cast(s_mat->materials(BlNum)); + assert(matBlind != nullptr); + + SlatAng = matBlind->SlatAngle * Constant::DegToRad; + Real64 ProfAng = 0.0; + + int slatIdxLo, slatIdxHi; + Real64 slatInterpFac; + Material::GetSlatIndicesInterpFac(SlatAng, slatIdxLo, slatIdxHi, slatInterpFac); + Material::BlindTraAbsRef blindTAR; + // This interpolates all blind properties. No need to interpolate them one-by-one + blindTAR.interpSlatAng(matBlind->TARs[slatIdxLo], matBlind->TARs[slatIdxHi], slatInterpFac); + + int profIdxLo, profIdxHi; + Material::GetProfIndices(ProfAng, profIdxLo, profIdxHi); + + assert(profIdxLo == (Material::MaxProfAngs / 2) + 1); // Should be true for ProfAng == 0.0 + + TBlBmBm = matBlind->BeamBeamTrans(0.0, SlatAng); TBmBmBl = TBmBm * TBlBmBm; TBmBmBlVis = TBmBmVis * TBlBmBm; - TBlBmDif = InterpProfSlatAng(0.0, SlatAng, VarSlats, blind.SolFrontBeamDiffTrans); - TBlBmDifVis = InterpProfSlatAng(0.0, SlatAng, VarSlats, blind.VisFrontBeamDiffTrans); + TBlBmDif = blindTAR.Sol.Ft.Bm[profIdxLo].DfTra; + TBlBmDifVis = blindTAR.Vis.Ft.Bm[profIdxLo].DfTra; TDif = constructBare.TransDiff; TDifVis = constructBare.TransDiffVis; if (ShadeFlag == WinShadingType::IntBlind) { RGlDiffBack = constructBare.ReflectSolDiffBack; RGlDiffBackVis = constructBare.ReflectVisDiffBack; - RhoBlFront = InterpProfSlatAng(0.0, SlatAng, VarSlats, blind.SolFrontBeamDiffRefl); - RhoBlFrontVis = InterpProfSlatAng(0.0, SlatAng, VarSlats, blind.VisFrontBeamDiffRefl); - AbsBlFront = InterpProfSlatAng(0.0, SlatAng, VarSlats, blind.SolFrontBeamAbs); - RhoBlDiffFront = InterpSlatAng(SlatAng, VarSlats, blind.SolFrontDiffDiffRefl); - RhoBlDiffFrontVis = InterpSlatAng(SlatAng, VarSlats, blind.VisFrontDiffDiffRefl); - AbsBlDiffFront = InterpSlatAng(SlatAng, VarSlats, blind.SolFrontDiffAbs); + RhoBlFront = blindTAR.Sol.Ft.Bm[profIdxLo].DfRef; + RhoBlFrontVis = blindTAR.Vis.Ft.Bm[profIdxLo].DfRef; + AbsBlFront = blindTAR.Sol.Ft.Bm[profIdxLo].Abs; + RhoBlDiffFront = blindTAR.Sol.Ft.Df.Ref; + RhoBlDiffFrontVis = blindTAR.Vis.Ft.Df.Ref; + AbsBlDiffFront = blindTAR.Sol.Ft.Df.Abs; AbsBeamShadeNorm = TBmBm * (AbsBlFront + RhoBlFront * RGlDiffBack * AbsBlDiffFront / (1.0 - RhoBlDiffFront * RGlDiffBack)); - TBlDifDif = InterpSlatAng(SlatAng, VarSlats, blind.SolFrontDiffDiffTrans); - TBlDifDifVis = InterpSlatAng(SlatAng, VarSlats, blind.VisFrontDiffDiffTrans); + TBlDifDif = blindTAR.Sol.Ft.Df.Tra; + TBlDifDifVis = blindTAR.Vis.Ft.Df.Tra; TSolNorm = TBmBm * (TBlBmBm + TBlBmDif + TBlDifDif * RhoBlFront * RGlDiffBack / (1.0 - RhoBlDiffFront * RGlDiffBack)); // use of TBlBmBm here is correct, visible and IR transmittance are the same (reference deleted CR6925 on 3/20/2006) TVisNorm = TBmBmVis * (TBlBmBm + TBlBmDifVis + TBlDifDifVis * RhoBlFrontVis * RGlDiffBackVis / (1.0 - RhoBlDiffFrontVis * RGlDiffBackVis)); - } // (IntBlind) - if (ShadeFlag == WinShadingType::ExtBlind) { - TBlBmBm = BlindBeamBeamTrans(0.0, SlatAng, blind.SlatWidth, blind.SlatSeparation, blind.SlatThickness); + + } else if (ShadeFlag == WinShadingType::ExtBlind) { RGlFront = POLYF(1.0, constructBare.ReflSolBeamFrontCoef); RGlFrontVis = POLYF(1.0, constructBare.ReflSolBeamFrontCoef); - AbsBlFront = InterpProfSlatAng(0.0, SlatAng, VarSlats, blind.SolFrontBeamAbs); - AbsBlBack = InterpProfSlatAng(0.0, SlatAng, VarSlats, blind.SolBackBeamAbs); - AbsBlDiffBack = InterpSlatAng(SlatAng, VarSlats, blind.SolBackDiffAbs); + AbsBlFront = blindTAR.Sol.Ft.Bm[profIdxLo].Abs; + AbsBlBack = blindTAR.Sol.Bk.Bm[profIdxLo].Abs; + AbsBlDiffBack = blindTAR.Sol.Bk.Df.Abs; RGlDiffFront = constructBare.ReflectSolDiffFront; RGlDiffFrontVis = constructBare.ReflectVisDiffFront; - RhoBlDiffBack = InterpSlatAng(SlatAng, VarSlats, blind.SolBackDiffDiffRefl); - RhoBlDiffBackVis = InterpSlatAng(SlatAng, VarSlats, blind.VisBackDiffDiffRefl); - RhoBlBack = InterpProfSlatAng(0.0, SlatAng, VarSlats, blind.SolBackBeamDiffRefl); - RhoBlBackVis = InterpProfSlatAng(0.0, SlatAng, VarSlats, blind.VisBackBeamDiffRefl); + + RhoBlDiffBack = blindTAR.Sol.Bk.Df.Ref; + RhoBlDiffBackVis = blindTAR.Vis.Bk.Df.Ref; + RhoBlBack = blindTAR.Sol.Bk.Bm[profIdxLo].DfRef; + RhoBlBackVis = blindTAR.Vis.Bk.Bm[profIdxLo].DfRef; + AbsBeamShadeNorm = AbsBlFront + AbsBlBack * RGlFront * TBlBmBm + (AbsBlDiffBack * RGlDiffFront / (1.0 - RhoBlDiffBack * RGlDiffFront)) * (RGlFront * TBlBmBm * RhoBlBack + TBlBmDif); @@ -6488,19 +6326,19 @@ namespace Window { for (int Lay = 1; Lay <= TotLay; ++Lay) { LayPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); - auto const *mat = state.dataMaterial->Material(LayPtr); + auto const *mat = s_mat->materials(LayPtr); - if ((mat->group == Material::Group::WindowGlass) || (mat->group == Material::Group::WindowSimpleGlazing)) { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); + if ((mat->group == Material::Group::Glass) || (mat->group == Material::Group::GlassSimple)) { + auto const *matGlass = dynamic_cast(mat); + assert(matGlass != nullptr); ++IGlass; - wm->thick[IGlass - 1] = thisMaterial->Thickness; - wm->scon[IGlass - 1] = thisMaterial->Conductivity / thisMaterial->Thickness; - wm->emis[2 * IGlass - 2] = thisMaterial->AbsorpThermalFront; - wm->emis[2 * IGlass - 1] = thisMaterial->AbsorpThermalBack; - wm->tir[2 * IGlass - 2] = thisMaterial->TransThermal; - wm->tir[2 * IGlass - 1] = thisMaterial->TransThermal; + wm->thick[IGlass - 1] = matGlass->Thickness; + wm->scon[IGlass - 1] = matGlass->Conductivity / matGlass->Thickness; + wm->emis[2 * IGlass - 2] = matGlass->AbsorpThermalFront; + wm->emis[2 * IGlass - 1] = matGlass->AbsorpThermalBack; + wm->tir[2 * IGlass - 2] = matGlass->TransThermal; + wm->tir[2 * IGlass - 1] = matGlass->TransThermal; AbsBeamNorm(IGlass) = POLYF(1.0, state.dataConstruction->Construct(ConstrNum).AbsBeamCoef(IGlass)); if (ShadeFlag == WinShadingType::IntBlind) { // Interior blind on auto const &constructBare = state.dataConstruction->Construct(ConstrNumBare); @@ -6521,16 +6359,11 @@ namespace Window { wm->AbsRadGlassFace[2 * IGlass - 2] = 0.5 * BeamSolarInc * AbsBeamNorm(IGlass); wm->AbsRadGlassFace[2 * IGlass - 1] = 0.5 * BeamSolarInc * AbsBeamNorm(IGlass); } - if (mat->group == Material::Group::WindowGas || mat->group == Material::Group::WindowGasMixture || + if (mat->group == Material::Group::Gas || mat->group == Material::Group::GasMixture || mat->group == Material::Group::ComplexWindowGap) { // Gap layer ++IGap; - // Simon: Need to re-reference gas data in casee of complex fenestration gap - if (mat->group == Material::Group::ComplexWindowGap) { - auto const *matCW = dynamic_cast(mat); - assert(matCW != nullptr); - LayPtr = matCW->GasPointer; - } - auto const *matGas = dynamic_cast(state.dataMaterial->Material(LayPtr)); + + auto const *matGas = dynamic_cast(mat); assert(matGas != nullptr); wm->gaps[IGap - 1].width = matGas->Thickness; wm->gaps[IGap - 1].numGases = matGas->numGases; @@ -6568,7 +6401,10 @@ namespace Window { // Get center-of-glass conductance and solar heat gain coefficient // including inside and outside air films - Real64 inputU = state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(1))->SimpleWindowUfactor; + auto const *mat = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)); + Real64 inputU = (mat->group == Material::Group::Glass || mat->group == Material::Group::GlassSimple) + ? dynamic_cast(mat)->SimpleWindowUfactor + : 0.0; // Calculate the NominalConductance glazing only (before adjusted) EvalNominalWindowCond(state, AbsBeamShadeNorm, AbsBeamNorm, hgap, NominalConductance, SHGC, TSolNorm); @@ -6609,8 +6445,8 @@ namespace Window { int const firstSurfWin = thisSpace.WindowSurfaceFirst; int const lastSurfWin = thisSpace.WindowSurfaceLast; for (int SurfNum = firstSurfWin; SurfNum <= lastSurfWin; ++SurfNum) { - if (state.dataSurface->Surface(SurfNum).ExtBoundCond == ExternalEnvironment) { - int ConstrNum2 = state.dataSurface->Surface(SurfNum).Construction; + if (s_surf->Surface(SurfNum).ExtBoundCond == ExternalEnvironment) { + int ConstrNum2 = s_surf->Surface(SurfNum).Construction; state.dataHeatBalSurf->SurfWinCoeffAdjRatio(SurfNum) = state.dataHeatBal->CoeffAdjRatio(ConstrNum2); } } @@ -6932,13 +6768,9 @@ namespace Window { using WindowComplexManager::CalcComplexWindowThermal; using WindowComplexManager::UpdateComplexWindows; - static Array1D_string const Roughness({0, 5}, {"VeryRough", "Rough", "MediumRough", "MediumSmooth", "Smooth", "VerySmooth"}); - Real64 TempVar(0.0); // just temporary usage for complex fenestration - int ThisNum; int Layer; - int BlNum; // Blind number Real64 NominalConductanceWinter; // Nominal center-of-glass conductance of a window construction // for ASHRAE winter conditions (W/m2-K): // Inside air temperature = 21.1C (70F) @@ -6960,8 +6792,8 @@ namespace Window { std::string SolarDiffusing; // 'Yes' if glass is solar diffusing; otherwise 'No' (clear glass) std::string SpectralDataName; std::string OpticalDataType; - std::string SlateOrientation; + auto &s_mat = state.dataMaterial; auto &wm = state.dataWindowManager; ScanForReports(state, "Constructions", wm->DoReport, "Constructions"); @@ -6985,7 +6817,7 @@ namespace Window { "! ,Construction Name,Index,#Layers,Roughness,Conductance {W/m2-K},Conductance (Before Adjusted) {W/m2-K}," "Convection Coefficient Adjustment Ratio,SHGC," "Solar Transmittance at Normal Incidence,Visible Transmittance at Normal Incidence"); - if ((state.dataHeatBal->TotSimpleWindow > 0) || (state.dataHeatBal->W5GlsMat > 0) || (state.dataHeatBal->W5GlsMatAlt > 0)) + if ((s_mat->NumSimpleWindows > 0) || (s_mat->NumW5Glazings > 0) || (s_mat->NumW5AltGlazings > 0)) print(state.files.eio, "{}\n", "! , Material Name, Optical Data Type, Spectral Data Set Name, " @@ -6993,20 +6825,20 @@ namespace Window { "Transmittance, Front Visible Reflectance,Back Visible Reflectance,Infrared Transmittance, " "Front Thermal Emissivity, Back Thermal Emissivity,Conductivity {W/m-K},Dirt Factor,Solar " "Diffusing"); - if ((state.dataHeatBal->W5GasMat > 0) || (state.dataHeatBal->W5GasMatMixture > 0)) + if ((s_mat->NumW5Gases > 0) || (s_mat->NumW5GasMixtures > 0)) print(state.files.eio, "{}\n", "! ,Material Name,GasType,Thickness {m}"); - if (state.dataHeatBal->TotShades > 0) + if (s_mat->NumShades > 0) print(state.files.eio, "{}\n", "! ,Material Name,Thickness {m},Conductivity {W/m-K},Thermal " "Absorptance,Transmittance,Visible Transmittance,Shade Reflectance"); - if (state.dataHeatBal->TotScreens > 0) + if (s_mat->NumScreens > 0) print(state.files.eio, "{}\n", "! ,Material Name,Thickness {m},Conductivity {W/m-K},Thermal " "Absorptance,Transmittance,Reflectance,Visible Reflectance,Diffuse Reflectance,Diffuse Visible " "Reflectance,Screen Material Diameter To Spacing Ratio,Screen To GlassDistance {m}"); - if (state.dataHeatBal->TotBlinds > 0) + if (s_mat->NumBlinds > 0) print(state.files.eio, "{}\n", "! ,Material Name,Slat Width {m},Slat Separation {m},Slat Thickness " @@ -7024,7 +6856,7 @@ namespace Window { "{}\n", "! ,Construction Name,Index,#Layers,U-factor {W/m2-K},SHGC, " "Solar Transmittance at Normal Incidence"); - if (state.dataHeatBal->W5GlsMatEQL > 0) + if (s_mat->NumEQLGlazings > 0) print(state.files.eio, "{}\n", "! , Material Name, Optical Data Type, Spectral Data " @@ -7035,16 +6867,16 @@ namespace Window { "Solar Transmittance, Front Side Diffuse-Diffuse Solar Reflectance, Back Side Diffuse-Diffuse " "Solar Reflectance, Infrared Transmittance, Front Side Infrared Emissivity, Back Side Infrared " "Emissivity"); - if (state.dataHeatBal->TotShadesEQL > 0) + if (s_mat->NumEQLShades > 0) print(state.files.eio, "{}\n", "! , Material Name, Front Side Beam-Beam Solar " "Transmittance, Back Side Beam-Beam Solar Transmittance, Front Side Beam-Diffuse Solar " - "Transmittance, Back Side Beam-Diffuse Solar Transmittance, , Front Side Beam-Diffuse Solar " + "Transmittance, Back Side Beam-Diffuse Solar Transmittance, Front Side Beam-Diffuse Solar " "Reflectance, Back Side Beam-Diffuse Solar Reflectance, Infrared Transmittance, Front Side " "Infrared Emissivity, Back Side Infrared Emissivity"); - if (state.dataHeatBal->TotDrapesEQL > 0) + if (s_mat->NumEQLDrapes > 0) print(state.files.eio, "{}\n", "! , Material Name, Front Side Beam-Beam Solar " @@ -7054,7 +6886,7 @@ namespace Window { "Infrared Emissivity, Back Side Infrared Emissivity, Width of Pleated Fabric, Length of Pleated " "Fabric"); - if (state.dataHeatBal->TotBlindsEQL > 0) + if (s_mat->NumEQLBlinds > 0) print(state.files.eio, "{}\n", "! , Material Name, Slat Orientation, Slat Width, Slat " @@ -7064,14 +6896,14 @@ namespace Window { "Front Side Slat Diffuse-Diffuse Solar Reflectance, Back Side Slat Diffuse-Diffuse Solar " "Reflectance, Infrared Transmittance, Front Side Infrared Emissivity, Back Side Infrared " "Emissivity, Slat Angle Control"); - if (state.dataHeatBal->TotScreensEQL > 0) + if (s_mat->NumEQLScreens > 0) print(state.files.eio, "{}\n", "! , Material Name, Screen Beam-Beam Solar " "Transmittance, Screen Beam-Diffuse Solar Transmittance, Screen Beam-Diffuse Solar Reflectance, " "Screen Infrared Transmittance, Screen Infrared Emissivity, Screen Wire Spacing, Screen Wire " "Diameter"); - if (state.dataHeatBal->W5GapMatEQL > 0) + if (s_mat->NumEQLGaps > 0) print(state.files.eio, "{}\n", "! , Material Name, GasType, Gap Thickness {m}, Gap Vent Type"); for (int ThisNum = 1; ThisNum <= state.dataHeatBal->TotConstructs; ++ThisNum) { @@ -7149,7 +6981,7 @@ namespace Window { construct.Name, ThisNum, construct.TotLayers, - Roughness(static_cast(construct.OutsideRoughness)), + Material::surfaceRoughnessNames[(int)construct.OutsideRoughness], NominalConductanceWinter, state.dataHeatBal->NominalUBeforeAdjusted(ThisNum), state.dataHeatBal->CoeffAdjRatio(ThisNum), @@ -7161,49 +6993,51 @@ namespace Window { for (int i = 1; i <= construct.TotLayers; ++i) { Layer = construct.LayerPoint(i); - auto const *mat = state.dataMaterial->Material(Layer); + auto const *mat = s_mat->materials(Layer); switch (mat->group) { - case Material::Group::WindowGas: { + + case Material::Group::Gas: { auto const *matGas = dynamic_cast(mat); assert(matGas != nullptr); static constexpr std::string_view Format_702(" WindowMaterial:Gas,{},{},{:.3R}\n"); print(state.files.eio, Format_702, matGas->Name, Material::gasTypeNames[(int)matGas->gases[0].type], matGas->Thickness); //! fw CASE(WindowGasMixture) } break; + case Material::Group::Shade: { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); + auto const *matShade = dynamic_cast(mat); + assert(matShade != nullptr); static constexpr std::string_view Format_703(" WindowMaterial:Shade,,{},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R}\n"); print(state.files.eio, Format_703, - thisMaterial->Name, - thisMaterial->Thickness, - thisMaterial->Conductivity, - thisMaterial->AbsorpThermal, - thisMaterial->Trans, - thisMaterial->TransVis, - thisMaterial->ReflectShade); + matShade->Name, + matShade->Thickness, + matShade->Conductivity, + matShade->AbsorpThermal, + matShade->Trans, + matShade->TransVis, + matShade->ReflectShade); } break; - case Material::Group::WindowBlind: { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); - BlNum = thisMaterial->BlindDataPtr; - auto const &blind = state.dataMaterial->Blind(BlNum); + + case Material::Group::Blind: { + auto const *matBlind = dynamic_cast(mat); + static constexpr std::string_view Format_704( " WindowMaterial:Blind,{},{:.4R},{:.4R},{:.4R},{:.3R},{:.3R},{:.3R},{:.3R}\n"); print(state.files.eio, Format_704, - thisMaterial->Name, - blind.SlatWidth, - blind.SlatSeparation, - blind.SlatThickness, - blind.SlatAngle, - blind.SlatTransSolBeamDiff, - blind.SlatFrontReflSolBeamDiff, - blind.BlindToGlassDist); + matBlind->Name, + matBlind->SlatWidth, + matBlind->SlatSeparation, + matBlind->SlatThickness, + matBlind->SlatAngle, + matBlind->slatTAR.Sol.Ft.Bm[0].DfTra, + matBlind->slatTAR.Sol.Ft.Bm[0].DfRef, + matBlind->toGlassDist); } break; + case Material::Group::Screen: { auto const *matScreen = dynamic_cast(mat); assert(matScreen != nullptr); @@ -7227,49 +7061,50 @@ namespace Window { matScreen->diameterToSpacingRatio, matScreen->toGlassDist); } break; - case Material::Group::WindowGlass: - case Material::Group::WindowSimpleGlazing: { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); + + case Material::Group::Glass: + case Material::Group::GlassSimple: { + auto const *matGlass = dynamic_cast(mat); + assert(matGlass != nullptr); SolarDiffusing = "No"; - if (thisMaterial->SolarDiffusing) SolarDiffusing = "Yes"; - OpticalDataType = "SpectralAverage"; - SpectralDataName = ""; - if (thisMaterial->GlassSpectralDataPtr > 0) { - OpticalDataType = "Spectral"; - SpectralDataName = state.dataHeatBal->SpectralData(thisMaterial->GlassSpectralDataPtr).Name; - } - if (thisMaterial->GlassSpectralAndAngle) { - OpticalDataType = "SpectralAndAngle"; - SpectralDataName = state.dataCurveManager->PerfCurve(thisMaterial->GlassSpecAngTransDataPtr)->Name + ", " + - state.dataCurveManager->PerfCurve(thisMaterial->GlassSpecAngFRefleDataPtr)->Name + ", " + - state.dataCurveManager->PerfCurve(thisMaterial->GlassSpecAngBRefleDataPtr)->Name; + if (matGlass->SolarDiffusing) SolarDiffusing = "Yes"; + + if (matGlass->windowOpticalData == Window::OpticalDataModel::Spectral) { + SpectralDataName = s_mat->SpectralData(matGlass->GlassSpectralDataPtr).Name; + } else if (matGlass->windowOpticalData == Window::OpticalDataModel::SpectralAndAngle) { + SpectralDataName = state.dataCurveManager->PerfCurve(matGlass->GlassSpecAngTransDataPtr)->Name + ", " + + state.dataCurveManager->PerfCurve(matGlass->GlassSpecAngFRefleDataPtr)->Name + ", " + + state.dataCurveManager->PerfCurve(matGlass->GlassSpecAngBRefleDataPtr)->Name; + } else { + SpectralDataName = ""; } + static constexpr std::string_view Format_707( " WindowMaterial:Glazing,{},{},{},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{" ":.5R},{:.5R},{:.5R},{:.5R},{:.5R},{}\n"); print(state.files.eio, Format_707, - thisMaterial->Name, - OpticalDataType, + matGlass->Name, + Window::opticalDataModelNames[(int)matGlass->windowOpticalData], SpectralDataName, - thisMaterial->Thickness, - thisMaterial->Trans, - thisMaterial->ReflectSolBeamFront, - thisMaterial->ReflectSolBeamBack, - thisMaterial->TransVis, - thisMaterial->ReflectVisBeamFront, - thisMaterial->ReflectVisBeamBack, - thisMaterial->TransThermal, - thisMaterial->AbsorpThermalFront, - thisMaterial->AbsorpThermalBack, - thisMaterial->Conductivity, - thisMaterial->GlassTransDirtFactor, + matGlass->Thickness, + matGlass->Trans, + matGlass->ReflectSolBeamFront, + matGlass->ReflectSolBeamBack, + matGlass->TransVis, + matGlass->ReflectVisBeamFront, + matGlass->ReflectVisBeamBack, + matGlass->TransThermal, + matGlass->AbsorpThermalFront, + matGlass->AbsorpThermalBack, + matGlass->Conductivity, + matGlass->GlassTransDirtFactor, SolarDiffusing); } break; - case Material::Group::GlassEquivalentLayer: { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); + + case Material::Group::GlassEQL: { + auto const *matEQL = dynamic_cast(mat); + assert(matEQL != nullptr); OpticalDataType = "SpectralAverage"; SpectralDataName = ""; static constexpr std::string_view Format_708( @@ -7277,113 +7112,115 @@ namespace Window { ",{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R}\n"); print(state.files.eio, Format_708, - thisMaterial->Name, + matEQL->Name, OpticalDataType, SpectralDataName, - thisMaterial->TausFrontBeamBeam, - thisMaterial->TausBackBeamBeam, - thisMaterial->ReflFrontBeamBeam, - thisMaterial->ReflBackBeamBeam, - thisMaterial->TausFrontBeamDiff, - thisMaterial->TausBackBeamDiff, - thisMaterial->ReflFrontBeamDiff, - thisMaterial->ReflBackBeamDiff, - thisMaterial->TausDiffDiff, - thisMaterial->ReflFrontDiffDiff, - thisMaterial->ReflBackDiffDiff, - thisMaterial->TausThermal, - thisMaterial->EmissThermalFront, - thisMaterial->EmissThermalBack); + matEQL->TAR.Sol.Ft.Bm[0].BmTra, + matEQL->TAR.Sol.Bk.Bm[0].BmTra, + matEQL->TAR.Sol.Ft.Bm[0].BmRef, + matEQL->TAR.Sol.Bk.Bm[0].BmRef, + matEQL->TAR.Sol.Ft.Bm[0].DfTra, + matEQL->TAR.Sol.Bk.Bm[0].DfTra, + matEQL->TAR.Sol.Ft.Bm[0].DfRef, + matEQL->TAR.Sol.Bk.Bm[0].DfRef, + matEQL->TAR.Sol.Ft.Df.Tra, + matEQL->TAR.Sol.Ft.Df.Ref, + matEQL->TAR.Sol.Bk.Df.Ref, + matEQL->TAR.IR.Ft.Tra, + matEQL->TAR.IR.Ft.Emi, + matEQL->TAR.IR.Bk.Emi); } break; - case Material::Group::ShadeEquivalentLayer: { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); + + case Material::Group::ShadeEQL: { + auto const *matEQL = dynamic_cast(mat); + assert(matEQL != nullptr); static constexpr std::string_view Format_709( " WindowMaterial:Shade:EquivalentLayer,{},{:.4R},{:.4R},{:.4R},{:.4R},{:.4R},{:.4R},{:.4R},{:.4R},{:.4R}\n"); print(state.files.eio, Format_709, - thisMaterial->Name, - thisMaterial->TausFrontBeamBeam, - thisMaterial->TausBackBeamBeam, - thisMaterial->TausFrontBeamDiff, - thisMaterial->TausBackBeamDiff, - thisMaterial->ReflFrontBeamDiff, - thisMaterial->ReflBackBeamDiff, - thisMaterial->TausThermal, - thisMaterial->EmissThermalFront, - thisMaterial->EmissThermalBack); + matEQL->Name, + matEQL->TAR.Sol.Ft.Bm[0].BmTra, + matEQL->TAR.Sol.Bk.Bm[0].BmTra, + matEQL->TAR.Sol.Ft.Bm[0].DfTra, + matEQL->TAR.Sol.Bk.Bm[0].DfTra, + matEQL->TAR.Sol.Ft.Bm[0].DfRef, + matEQL->TAR.Sol.Bk.Bm[0].DfRef, + matEQL->TAR.IR.Ft.Tra, + matEQL->TAR.IR.Ft.Emi, + matEQL->TAR.IR.Bk.Emi); } break; - case Material::Group::DrapeEquivalentLayer: { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); + + case Material::Group::DrapeEQL: { + auto const *matEQL = dynamic_cast(mat); + assert(matEQL != nullptr); static constexpr std::string_view Format_710( " WindowMaterial:Drape:EquivalentLayer,{},{:.4R},{:.4R},{:.4R},{:.4R},{:.4R},{:.4R}," "{:.4R},{:.4R},{:.5R},{:.5R}\n"); print(state.files.eio, Format_710, - thisMaterial->Name, - thisMaterial->TausFrontBeamBeam, - thisMaterial->TausFrontBeamDiff, - thisMaterial->TausBackBeamDiff, - thisMaterial->ReflFrontBeamDiff, - thisMaterial->ReflBackBeamDiff, - thisMaterial->TausThermal, - thisMaterial->EmissThermalFront, - thisMaterial->EmissThermalBack, - thisMaterial->PleatedDrapeWidth, - thisMaterial->PleatedDrapeLength); + matEQL->Name, + matEQL->TAR.Sol.Ft.Bm[0].BmTra, + matEQL->TAR.Sol.Ft.Bm[0].DfTra, + matEQL->TAR.Sol.Bk.Bm[0].DfTra, + matEQL->TAR.Sol.Ft.Bm[0].DfRef, + matEQL->TAR.Sol.Bk.Bm[0].DfRef, + matEQL->TAR.IR.Ft.Tra, + matEQL->TAR.IR.Ft.Emi, + matEQL->TAR.IR.Bk.Emi, + matEQL->pleatedWidth, + matEQL->pleatedLength); } break; - case Material::Group::ScreenEquivalentLayer: { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); + + case Material::Group::ScreenEQL: { + auto const *matEQL = dynamic_cast(mat); + assert(matEQL != nullptr); static constexpr std::string_view Format_711( " WindowMaterial:Screen:EquivalentLayer,{},{:.4R},{:.4R},{:.4R},{:.4R},{:.4R},{:.4R}" ",{:.4R},{:.4R},{:.5R},{:.5R}\n"); print(state.files.eio, Format_711, - thisMaterial->Name, - thisMaterial->TausFrontBeamBeam, - thisMaterial->TausFrontBeamDiff, - thisMaterial->TausBackBeamDiff, - thisMaterial->ReflFrontBeamDiff, - thisMaterial->ReflBackBeamDiff, - thisMaterial->TausThermal, - thisMaterial->EmissThermalFront, - thisMaterial->EmissThermalBack, - thisMaterial->ScreenWireSpacing, - thisMaterial->ScreenWireDiameter); + matEQL->Name, + matEQL->TAR.Sol.Ft.Bm[0].BmTra, + matEQL->TAR.Sol.Ft.Bm[0].DfTra, + matEQL->TAR.Sol.Bk.Bm[0].DfTra, + matEQL->TAR.Sol.Ft.Bm[0].DfRef, + matEQL->TAR.Sol.Bk.Bm[0].DfRef, + matEQL->TAR.IR.Ft.Tra, + matEQL->TAR.IR.Ft.Emi, + matEQL->TAR.IR.Bk.Emi, + matEQL->wireSpacing, + matEQL->wireDiameter); } break; - case Material::Group::BlindEquivalentLayer: { - auto const *thisMaterial = dynamic_cast(mat); - assert(thisMaterial != nullptr); - SlateOrientation = "Horizontal"; - if (thisMaterial->SlatOrientation == DataWindowEquivalentLayer::Orientation::Vertical) { - SlateOrientation = "Vertical"; - } + + case Material::Group::BlindEQL: { + auto const *matEQL = dynamic_cast(mat); + assert(matEQL != nullptr); + // Formats static constexpr std::string_view Format_712( " WindowMaterial:Blind:EquivalentLayer,{},{},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:." "5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R},{:.5R}"); print(state.files.eio, Format_712, - thisMaterial->Name, - SlateOrientation, - thisMaterial->SlatWidth, - thisMaterial->SlatSeparation, - thisMaterial->SlatCrown, - thisMaterial->SlatAngle, - thisMaterial->TausFrontBeamDiff, - thisMaterial->TausBackBeamDiff, - thisMaterial->ReflFrontBeamDiff, - thisMaterial->ReflBackBeamDiff, - thisMaterial->TausDiffDiff, - thisMaterial->ReflFrontDiffDiff, - thisMaterial->ReflBackDiffDiff, - thisMaterial->TausThermal, - thisMaterial->EmissThermalFront, - thisMaterial->EmissThermalBack); + matEQL->Name, + DataWindowEquivalentLayer::orientationNames[(int)matEQL->SlatOrientation], + matEQL->SlatWidth, + matEQL->SlatSeparation, + matEQL->SlatCrown, + matEQL->SlatAngle, + matEQL->TAR.Sol.Ft.Bm[0].DfTra, + matEQL->TAR.Sol.Bk.Bm[0].DfTra, + matEQL->TAR.Sol.Ft.Bm[0].DfRef, + matEQL->TAR.Sol.Bk.Bm[0].DfRef, + matEQL->TAR.Sol.Ft.Df.Tra, + matEQL->TAR.Sol.Ft.Df.Ref, + matEQL->TAR.Sol.Bk.Df.Ref, + matEQL->TAR.IR.Ft.Tra, + matEQL->TAR.IR.Ft.Emi, + matEQL->TAR.IR.Bk.Emi); } break; - case Material::Group::GapEquivalentLayer: { + + case Material::Group::WindowGapEQL: { auto const *matGas = dynamic_cast(mat); assert(matGas != nullptr); static constexpr std::string_view Format_713(" WindowMaterial:Gap:EquivalentLayer,{},{},{:.3R},{}\n"); @@ -7394,6 +7231,7 @@ namespace Window { matGas->Thickness, Material::gapVentTypeNames[(int)matGas->gapVentType]); } break; + default: break; } @@ -7464,141 +7302,157 @@ namespace Window { Array1D sun_el_deg(Material::MaxProfAngs); // Solar profile angle (deg) corresponding to sun_el values Real64 bld_el; // Slat angle (elevation of slat normal vector in plane // perpendicular to window and containing the slat normal vector) (radians) - int IProfAng; // Profile angle index - for (int BlindNum = 1; BlindNum <= state.dataHeatBal->TotBlinds; ++BlindNum) { - auto &blind = state.dataMaterial->Blind(BlindNum); + auto &s_mat = state.dataMaterial; + + for (auto *mat : s_mat->materials) { + if (mat->group != Material::Group::Blind) continue; - bld_pr(2) = blind.SlatWidth; - bld_pr(3) = blind.SlatSeparation; + auto *matBlind = dynamic_cast(mat); + assert(matBlind != nullptr); + + bld_pr(2) = matBlind->SlatWidth; + bld_pr(3) = matBlind->SlatSeparation; for (int ISolVis = 1; ISolVis <= 2; ++ISolVis) { if (ISolVis == 1) { // For solar calculation bld_pr(4) = 0.0; bld_pr(5) = 0.0; bld_pr(6) = 0.0; - bld_pr(7) = blind.SlatTransSolBeamDiff; - bld_pr(8) = blind.SlatFrontReflSolBeamDiff; - bld_pr(9) = blind.SlatBackReflSolBeamDiff; - bld_pr(10) = blind.SlatTransSolDiffDiff; - bld_pr(11) = blind.SlatFrontReflSolDiffDiff; - bld_pr(12) = blind.SlatBackReflSolDiffDiff; + bld_pr(7) = matBlind->slatTAR.Sol.Ft.Bm[0].DfTra; + bld_pr(8) = matBlind->slatTAR.Sol.Ft.Bm[0].DfRef; + bld_pr(9) = matBlind->slatTAR.Sol.Bk.Bm[0].DfRef; + bld_pr(10) = matBlind->slatTAR.Sol.Ft.Df.Tra; + bld_pr(11) = matBlind->slatTAR.Sol.Ft.Df.Ref; + bld_pr(12) = matBlind->slatTAR.Sol.Bk.Df.Ref; } else { // For visible calculation bld_pr(4) = 0.0; bld_pr(5) = 0.0; bld_pr(6) = 0.0; - bld_pr(7) = blind.SlatTransVisBeamDiff; - bld_pr(8) = blind.SlatFrontReflVisBeamDiff; - bld_pr(9) = blind.SlatBackReflVisBeamDiff; - bld_pr(10) = blind.SlatTransVisDiffDiff; - bld_pr(11) = blind.SlatFrontReflVisDiffDiff; - bld_pr(12) = blind.SlatBackReflVisDiffDiff; + bld_pr(7) = matBlind->slatTAR.Vis.Ft.Bm[0].DfTra; + bld_pr(8) = matBlind->slatTAR.Vis.Ft.Bm[0].DfRef; + bld_pr(9) = matBlind->slatTAR.Vis.Bk.Bm[0].DfRef; + bld_pr(10) = matBlind->slatTAR.Vis.Ft.Df.Tra; + bld_pr(11) = matBlind->slatTAR.Vis.Ft.Df.Ref; + bld_pr(12) = matBlind->slatTAR.Vis.Bk.Df.Ref; } // For IR calculation - bld_pr(13) = blind.SlatTransIR; - bld_pr(14) = blind.SlatFrontEmissIR; - bld_pr(15) = blind.SlatBackEmissIR; + bld_pr(13) = matBlind->slatTAR.IR.Ft.Tra; + bld_pr(14) = matBlind->slatTAR.IR.Ft.Emi; + bld_pr(15) = matBlind->slatTAR.IR.Bk.Emi; // Calculate diffuse properties of blind. If blind has variable slat angle, & // vary slat angle from 0 to 180 deg in 10-deg steps (for Material::MaxSlatAngs = 19). // If blind has fixed slat angle, calculate properties at that angle only. - for (int ISlatAng = 1; ISlatAng <= Material::MaxSlatAngs; ++ISlatAng) { + for (int iSlatAng = 0; iSlatAng < Material::MaxSlatAngs; ++iSlatAng) { + + auto &btar = matBlind->TARs[iSlatAng]; st_lay = 0.0; - if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) { - bld_el = blind.SlatAngle * Constant::DegToRadians; - } else { // Variable slat angle - bld_el = (Constant::Pi / (Material::MaxSlatAngs - 1)) * (ISlatAng - 1); // 0 <= bld_el <= 180 deg - } - BlindOpticsDiffuse(state, BlindNum, ISolVis, bld_pr, bld_el, st_lay); + bld_el = Material::dSlatAng * iSlatAng; // 0 <= bld_el <= 180 deg + + BlindOpticsDiffuse(state, matBlind->Num, ISolVis, bld_pr, bld_el, st_lay); if (ISolVis == 1) { // Fill blind diffuse solar and IR properties - blind.SolFrontDiffDiffTrans(ISlatAng) = st_lay(9); - blind.SolFrontDiffDiffRefl(ISlatAng) = st_lay(10); - blind.SolBackDiffDiffTrans(ISlatAng) = st_lay(11); - blind.SolBackDiffDiffRefl(ISlatAng) = st_lay(12); - blind.SolFrontDiffAbs(ISlatAng) = max(0.0, 1.0 - st_lay(9) - st_lay(10)); - blind.SolBackDiffAbs(ISlatAng) = max(0.0, 1.0 - st_lay(11) - st_lay(12)); - blind.IRFrontTrans(ISlatAng) = st_lay(13); - blind.IRFrontEmiss(ISlatAng) = st_lay(14); - blind.IRBackTrans(ISlatAng) = st_lay(13); - blind.IRBackEmiss(ISlatAng) = st_lay(15); + btar.Sol.Ft.Df.Tra = st_lay(9); + btar.Sol.Ft.Df.Ref = st_lay(10); + btar.Sol.Bk.Df.Tra = st_lay(11); + btar.Sol.Bk.Df.Ref = st_lay(12); + btar.Sol.Ft.Df.Abs = max(0.0, 1.0 - st_lay(9) - st_lay(10)); + btar.Sol.Bk.Df.Abs = max(0.0, 1.0 - st_lay(11) - st_lay(12)); + btar.IR.Ft.Tra = st_lay(13); + btar.IR.Ft.Emi = st_lay(14); + btar.IR.Bk.Tra = st_lay(13); + btar.IR.Bk.Emi = st_lay(15); } else { // Fill blind diffuse visible properties - blind.VisFrontDiffDiffTrans(ISlatAng) = st_lay(9); - blind.VisFrontDiffDiffRefl(ISlatAng) = st_lay(10); - blind.VisBackDiffDiffTrans(ISlatAng) = st_lay(11); - blind.VisBackDiffDiffRefl(ISlatAng) = st_lay(12); + btar.Vis.Ft.Df.Tra = st_lay(9); + btar.Vis.Ft.Df.Ref = st_lay(10); + btar.Vis.Bk.Df.Tra = st_lay(11); + btar.Vis.Bk.Df.Ref = st_lay(12); } - if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) break; - } // End of slat angle loop - - // Calculate beam properties of blind. Vary profile angle from -90 to +90 deg in 5-deg steps. - // If blind has variable slat angle, vary slat angle from 0 to 180 deg in 10-deg steps - // (for Material::MaxSlatAngs = 19). If blind has fixed slat angle, calculate properties at that angle only. + // If blind has variable slat angle, vary slat angle from 0 to 180 deg in 10-deg steps + // (for Material::MaxSlatAngs = 19). If blind has fixed slat angle, calculate properties at that angle only. - for (int IProfAng = 1; IProfAng <= Material::MaxProfAngs; ++IProfAng) { - sun_el = -Constant::Pi / 2.0 + (Constant::Pi / 36.0) * (IProfAng - 1); - sun_el_deg(IProfAng) = 57.2958 * sun_el; - - for (int ISlatAng = 1; ISlatAng <= Material::MaxSlatAngs; ++ISlatAng) { - st_lay = 0.0; - if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) { - bld_el = blind.SlatAngle * Constant::DegToRadians; - } else { // Variable slat angle - bld_el = (Constant::Pi / (Material::MaxSlatAngs - 1)) * (ISlatAng - 1); // 0 <= bld_el <= 180 deg - } + for (int IProfAng = 1; IProfAng <= Material::MaxProfAngs; ++IProfAng) { + sun_el = -Constant::Pi / 2.0 + (Constant::Pi / 36.0) * (IProfAng - 1); + sun_el_deg(IProfAng) = 57.2958 * sun_el; // Beam solar-optical properties of blind for given profile angle and slat angle - BlindOpticsBeam(state, BlindNum, bld_pr, bld_el, sun_el, st_lay); + BlindOpticsBeam(state, matBlind->Num, bld_pr, bld_el, sun_el, st_lay); if (ISolVis == 1) { // Fill blind beam solar properties - blind.SolFrontBeamBeamTrans(ISlatAng, IProfAng) = st_lay(1); - blind.SolFrontBeamBeamRefl(ISlatAng, IProfAng) = st_lay(2); - blind.SolBackBeamBeamTrans(ISlatAng, IProfAng) = st_lay(3); - blind.SolBackBeamBeamRefl(ISlatAng, IProfAng) = st_lay(4); - blind.SolFrontBeamDiffTrans(ISlatAng, IProfAng) = st_lay(5); - blind.SolFrontBeamDiffRefl(ISlatAng, IProfAng) = st_lay(6); - blind.SolBackBeamDiffTrans(ISlatAng, IProfAng) = st_lay(7); - blind.SolBackBeamDiffRefl(ISlatAng, IProfAng) = st_lay(8); - blind.SolFrontBeamAbs(ISlatAng, IProfAng) = max(0.0, 1.0 - st_lay(6) - st_lay(1) - st_lay(5)); - blind.SolBackBeamAbs(ISlatAng, IProfAng) = max(0.0, 1.0 - st_lay(7) - st_lay(3) - st_lay(8)); + btar.Sol.Ft.Bm[IProfAng].BmTra = st_lay(1); + btar.Sol.Ft.Bm[IProfAng].BmRef = st_lay(2); + btar.Sol.Bk.Bm[IProfAng].BmTra = st_lay(3); + btar.Sol.Bk.Bm[IProfAng].BmRef = st_lay(4); + btar.Sol.Ft.Bm[IProfAng].DfTra = st_lay(5); + btar.Sol.Ft.Bm[IProfAng].DfRef = st_lay(6); + btar.Sol.Bk.Bm[IProfAng].DfTra = st_lay(7); + btar.Sol.Bk.Bm[IProfAng].DfRef = st_lay(8); + btar.Sol.Ft.Bm[IProfAng].Abs = max(0.0, 1.0 - st_lay(6) - st_lay(1) - st_lay(5)); + btar.Sol.Bk.Bm[IProfAng].Abs = max(0.0, 1.0 - st_lay(7) - st_lay(3) - st_lay(8)); } else { // Fill blind beam visible properties - blind.VisFrontBeamBeamTrans(ISlatAng, IProfAng) = st_lay(1); - blind.VisFrontBeamBeamRefl(ISlatAng, IProfAng) = st_lay(2); - blind.VisBackBeamBeamTrans(ISlatAng, IProfAng) = st_lay(3); - blind.VisBackBeamBeamRefl(ISlatAng, IProfAng) = st_lay(4); - blind.VisFrontBeamDiffTrans(ISlatAng, IProfAng) = st_lay(5); - blind.VisFrontBeamDiffRefl(ISlatAng, IProfAng) = st_lay(6); - blind.VisBackBeamDiffTrans(ISlatAng, IProfAng) = st_lay(7); - blind.VisBackBeamDiffRefl(ISlatAng, IProfAng) = st_lay(8); + btar.Vis.Ft.Bm[IProfAng].BmTra = st_lay(1); + btar.Vis.Ft.Bm[IProfAng].BmRef = st_lay(2); + btar.Vis.Bk.Bm[IProfAng].BmTra = st_lay(3); + btar.Vis.Bk.Bm[IProfAng].BmRef = st_lay(4); + btar.Vis.Ft.Bm[IProfAng].DfTra = st_lay(5); + btar.Vis.Ft.Bm[IProfAng].DfRef = st_lay(6); + btar.Vis.Bk.Bm[IProfAng].DfTra = st_lay(7); + btar.Vis.Bk.Bm[IProfAng].DfRef = st_lay(8); } - - if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) break; } // End of loop over slat angles } // End of loop over profile angles if (ISolVis == 1) { - for (int ISlatAng = 1; ISlatAng <= Material::MaxSlatAngs; ++ISlatAng) { - blind.SolFrontDiffDiffTransGnd(ISlatAng) = - DiffuseAverageProfAngGnd(blind.SolFrontBeamBeamTrans(ISlatAng, {1, Material::MaxProfAngs})) + - DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffTrans(ISlatAng, {1, Material::MaxProfAngs})); - blind.SolFrontDiffDiffTransSky(ISlatAng) = - DiffuseAverageProfAngSky(blind.SolFrontBeamBeamTrans(ISlatAng, {1, Material::MaxProfAngs})) + - DiffuseAverageProfAngSky(blind.SolFrontBeamDiffTrans(ISlatAng, {1, Material::MaxProfAngs})); - blind.SolFrontDiffAbsGnd(ISlatAng) = DiffuseAverageProfAngGnd(blind.SolFrontBeamAbs(ISlatAng, {1, Material::MaxProfAngs})); - blind.SolFrontDiffAbsSky(ISlatAng) = DiffuseAverageProfAngSky(blind.SolFrontBeamAbs(ISlatAng, {1, Material::MaxProfAngs})); - blind.SolFrontDiffDiffReflGnd(ISlatAng) = - DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffRefl(ISlatAng, {1, Material::MaxProfAngs})); - blind.SolFrontDiffDiffReflSky(ISlatAng) = - DiffuseAverageProfAngSky(blind.SolFrontBeamDiffRefl(ISlatAng, {1, Material::MaxProfAngs})); - - // TH 2/17/2010. Added. Loop only for movable slat blinds - if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) break; - } + + for (int iSlatAng = 0; iSlatAng < Material::MaxSlatAngs; ++iSlatAng) { + auto &btar = matBlind->TARs[iSlatAng]; + + Real64 sumDenom = 0.0, sumTra1 = 0.0, sumTra2 = 0.0, sumRef = 0.0, sumAbs = 0.0; + + // Integrate from -90 to 0 deg + for (int IPhi = 1; IPhi <= 18; ++IPhi) { + auto const &btargs = btar.Sol.Ft.Bm[IPhi]; + auto const &btargs1 = btar.Sol.Ft.Bm[IPhi + 1]; + + Real64 denom = Material::dProfAng * std::cos(-Constant::PiOvr2 + (IPhi - 0.5) * Material::dProfAng); + sumDenom += denom; + // Why adding beam transmittance here? + sumTra1 += denom * (btargs.BmTra + btargs1.BmTra) * 0.5; + sumTra2 += denom * (btargs.DfTra + btargs1.DfTra) * 0.5; + sumRef += denom * (btargs.DfRef + btargs1.DfRef) * 0.5; + sumAbs += denom * (btargs.Abs + btargs1.Abs) * 0.5; + } + + btar.Sol.Ft.Df.TraGnd = std::max(0.0, sumTra1 / sumDenom) + std::max(0.0, sumTra2 / sumDenom); + btar.Sol.Ft.Df.RefGnd = std::max(0.0, sumRef / sumDenom); + btar.Sol.Ft.Df.AbsGnd = std::max(0.0, sumAbs / sumDenom); + + sumDenom = sumTra1 = sumTra2 = sumRef = sumAbs = 0.0; + + // Integrate from -90 to 0 deg + for (int IPhi = 19; IPhi <= Material::MaxProfAngs - 1; ++IPhi) { + auto const &btargs = btar.Sol.Ft.Bm[IPhi]; + auto const &btargs1 = btar.Sol.Ft.Bm[IPhi + 1]; + + Real64 denom = Material::dProfAng * std::cos(-Constant::PiOvr2 + (IPhi - 0.5) * Material::dProfAng); + sumDenom += denom; + // Why adding beam transmittance here? + sumTra1 += denom * (btargs.BmTra + btargs1.BmTra) * 0.5; + sumTra2 += denom * (btargs.DfTra + btargs1.DfTra) * 0.5; + sumRef += denom * (btargs.DfRef + btargs1.DfRef) * 0.5; + sumAbs += denom * (btargs.Abs + btargs1.Abs) * 0.5; + } + + btar.Sol.Ft.Df.TraSky = std::max(0.0, sumTra1 / sumDenom) + std::max(0.0, sumTra2 / sumDenom); + btar.Sol.Ft.Df.RefSky = std::max(0.0, sumRef / sumDenom); + btar.Sol.Ft.Df.AbsSky = std::max(0.0, sumAbs / sumDenom); + } // for (iSlatAng) } } // End of loop over solar vs. visible properties @@ -7637,7 +7491,6 @@ namespace Window { Real64 SumReflect; // Integration variable for reflectance Real64 SumReflectVis; // Integration variable for visible reflectance Real64 SumArea; // Integration variable for area of quarter hemisphere - bool FoundMaterial; // Flag to avoid printing screen transmittance data multiple times when Material:WindowScreen // is used on multiple surfaces bool PrintTransMap; // Flag used to print transmittance map @@ -7654,6 +7507,9 @@ namespace Window { Array2D relativeAzimuth; // Relative azimuth angle of sun with respect to surface outward normal Array2D relativeAltitude; // Relative altitude angle of sun with respect to surface outward normal + auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; + relativeAzimuth.allocate(N, M); relativeAltitude.allocate(N, M); @@ -7682,18 +7538,18 @@ namespace Window { PrintTransMap = false; - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto const &surf = state.dataSurface->Surface(SurfNum); + for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { + auto const &surf = s_surf->Surface(SurfNum); if (!surf.HasShadeControl) continue; - if (state.dataSurface->WindowShadingControl(surf.activeWindowShadingControl).ShadingType != WinShadingType::ExtScreen) continue; + if (s_surf->WindowShadingControl(surf.activeWindowShadingControl).ShadingType != WinShadingType::ExtScreen) continue; ConstrNumSh = surf.activeShadedConstruction; MatNum = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1); - auto *matScreen = dynamic_cast(state.dataMaterial->Material(MatNum)); + auto *matScreen = dynamic_cast(s_mat->materials(MatNum)); assert(matScreen != nullptr); - state.dataSurface->SurfaceWindow(SurfNum).screenNum = MatNum; + s_surf->SurfaceWindow(SurfNum).screenNum = MatNum; if (matScreen->isUsed) continue; // Has already been initalized @@ -7773,7 +7629,7 @@ namespace Window { auto screenCsvFile = state.files.screenCsv.open(state, "CalcWindowScreenComponents", state.files.outputControl.screen); // WRITE(ScreenTransUnitNo,*)' ' - for (auto *mat : state.dataMaterial->Material) { + for (auto *mat : s_mat->materials) { if (mat->group != Material::Group::Screen) continue; if (!mat->isUsed) continue; @@ -7801,7 +7657,7 @@ namespace Window { Real64 phi = ip * screen->mapDegResolution * Constant::DegToRad; Real64 theta = it * screen->mapDegResolution * Constant::DegToRad; int ip1, ip2, it1, it2; - General::BilinearInterpCoeffs coeffs; + BilinearInterpCoeffs coeffs; Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); GetBilinearInterpCoeffs( phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); @@ -7833,7 +7689,7 @@ namespace Window { Real64 phi = ip * screen->mapDegResolution * Constant::DegToRad; Real64 theta = it * screen->mapDegResolution * Constant::DegToRad; int ip1, ip2, it1, it2; - General::BilinearInterpCoeffs coeffs; + BilinearInterpCoeffs coeffs; Material::GetPhiThetaIndices(phi, theta, screen->dPhi, screen->dTheta, ip1, ip2, it1, it2); GetBilinearInterpCoeffs( phi, theta, ip1 * screen->dPhi, ip2 * screen->dPhi, it1 * screen->dTheta, it2 * screen->dTheta, coeffs); @@ -7899,8 +7755,6 @@ namespace Window { Array1D fEdgeA(2); // Average slat edge correction factor for upper and lower quadrants // seen by window blind Real64 gamma; // phib - phis - int Iphis; // Source elevation counter - int IUpDown; // =1 for source in upper quadrant, =2 for source in lower quadrant Real64 fEdge; // Slat edge correction factor Real64 fEdge1; Array1D j(6); // Slat section radiosity vector @@ -7909,11 +7763,9 @@ namespace Window { Array2D F(6, 6); // View factor array Array2D X(4, 4); // Exchange matrix Array2D Xinv(4, 4); // Inverse of exchange matrix - int k; // Array indices - int m; - Array1D_int indx(4); // LU decomposition indices - Real64 BlindIRreflFront; // Blind front IR reflectance - Real64 BlindIRreflBack; // Blind back IR reflectance + Array1D_int indx(4); // LU decomposition indices + Real64 BlindIRreflFront; // Blind front IR reflectance + Real64 BlindIRreflBack; // Blind back IR reflectance // The slat input properties are: // c(1) 0. (unused) @@ -7954,7 +7806,8 @@ namespace Window { // p(15) IR emissivity back // p(16) 0.0 (unused) - auto &blind = state.dataMaterial->Blind(BlindNum); + auto &s_mat = state.dataMaterial; + auto *matBlind = dynamic_cast(s_mat->materials(BlindNum)); // Calculate view factors between slat sections (slat is divided longitudinally into two equal parts) ViewFac(c(2), c(3), b_el, Constant::PiOvr2, F); @@ -8018,8 +7871,8 @@ namespace Window { if (std::abs(std::sin(gamma)) > 0.01) { if ((phib > 0.0 && phib <= Constant::PiOvr2 && phis <= phib) || (phib > Constant::PiOvr2 && phib <= Constant::Pi && phis > -(Constant::Pi - phib))) { - fEdge1 = blind.SlatThickness * std::abs(std::sin(gamma)) / - ((blind.SlatSeparation + blind.SlatThickness / std::abs(std::sin(phib))) * std::cos(phis)); + fEdge1 = matBlind->SlatThickness * std::abs(std::sin(gamma)) / + ((matBlind->SlatSeparation + matBlind->SlatThickness / std::abs(std::sin(phib))) * std::cos(phis)); } fEdgeSource(Iphis) = min(1.0, std::abs(fEdge1)); } @@ -8299,7 +8152,8 @@ namespace Window { Real64 fEdge1; Array1D_int indx(4); // Indices for LU decomposition - auto const &blind = state.dataMaterial->Blind(BlindNum); + auto &s_mat = state.dataMaterial; + auto const *matBlind = dynamic_cast(s_mat->materials(BlindNum)); p = 0.0; @@ -8334,8 +8188,8 @@ namespace Window { if (std::abs(std::sin(gamma)) > 0.01) { if ((phib > 0.0 && phib <= Constant::PiOvr2 && phis <= phib) || (phib > Constant::PiOvr2 && phib <= Constant::Pi && phis > -(Constant::Pi - phib))) { - fEdge1 = blind.SlatThickness * std::abs(std::sin(gamma)) / - ((blind.SlatSeparation + blind.SlatThickness / std::abs(std::sin(phib))) * std::cos(phis)); + fEdge1 = matBlind->SlatThickness * std::abs(std::sin(gamma)) / + ((matBlind->SlatSeparation + matBlind->SlatThickness / std::abs(std::sin(phib))) * std::cos(phis)); } fEdge = min(1.0, std::abs(fEdge1)); } @@ -8343,7 +8197,7 @@ namespace Window { // Direct-to-direct transmittance (portion of beam that passes between slats without // without touching them - p(1 + i) = BlindBeamBeamTrans(phis, phib, blind.SlatWidth, blind.SlatSeparation, blind.SlatThickness); + p(1 + i) = matBlind->BeamBeamTrans(phis, phib); // Direct-to-direct reflectance; this is zero for now since all reflection is assumed to be diffuse. p(2 + i) = 0.0; @@ -8409,165 +8263,6 @@ namespace Window { } // End of loop over front and back side properties of blind } // BlindOpticsBeam() - Real64 InterpProfAng(Real64 const ProfAng, // Profile angle (rad) - Array1S const PropArray // Array of blind properties - ) - { - - // SUBROUTINE INFORMATION: - // AUTHOR Fred Winkelmann - // DATE WRITTEN May 2001 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // Does profile-angle interpolation of window blind solar-thermal properties - - // METHODOLOGY EMPLOYED: - // Linear interpolation. - - // DeltaAng = Pi/36 - if (ProfAng > Constant::PiOvr2 || ProfAng < -Constant::PiOvr2) { - return 0.0; - } else { - Real64 constexpr DeltaAngRad(Constant::Pi / 36.0); // Profile angle increment (rad) - int IAlpha = 1 + int((ProfAng + Constant::PiOvr2) / DeltaAngRad); // Profile angle index - Real64 InterpFac = (ProfAng - (-Constant::PiOvr2 + DeltaAngRad * (IAlpha - 1))) / DeltaAngRad; // Interpolation factor - return (1.0 - InterpFac) * PropArray(IAlpha) + InterpFac * PropArray(IAlpha + 1); - } - } // InterpProfAng() - - Real64 InterpSlatAng(Real64 const SlatAng, // Slat angle (rad) - bool const VarSlats, // True if slat angle is variable - Array1S const PropArray // Array of blind properties as function of slat angle - ) - { - - // SUBROUTINE INFORMATION: - // AUTHOR Fred Winkelmann - // DATE WRITTEN Dec 2001 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // Does slat-angle interpolation of window blind solar-thermal properties that - // do not depend on profile angle - - // METHODOLOGY EMPLOYED: - // Linear interpolation. - - if (VarSlats) { // Variable-angle slats - Real64 SlatAng1 = std::clamp(SlatAng, 0.0, Constant::Pi); - static Real64 constexpr DeltaAng(Constant::Pi / (double(Material::MaxSlatAngs) - 1.0)); - static Real64 constexpr DeltaAng_inv((double(Material::MaxSlatAngs) - 1.0) / Constant::Pi); - int IBeta = 1 + int(SlatAng1 * DeltaAng_inv); // Slat angle index - Real64 InterpFac = (SlatAng1 - DeltaAng * (IBeta - 1)) * DeltaAng_inv; // Interpolation factor - return PropArray(IBeta) + InterpFac * (PropArray(min(Material::MaxSlatAngs, IBeta + 1)) - PropArray(IBeta)); - } else { // Fixed-angle slats or shade - return PropArray(1); - } - } // InterpSlatAng() - - Real64 InterpProfSlatAng(Real64 const ProfAng, // Profile angle (rad) - Real64 const SlatAng, // Slat angle (rad) - bool const VarSlats, // True if variable-angle slats - Array2A const PropArray // Array of blind properties - ) - { - - // SUBROUTINE INFORMATION: - // AUTHOR Fred Winkelmann - // DATE WRITTEN Dec 2001 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // Does simultaneous profile-angle and slat-angle interpolation of window - // blind solar-thermal properties that depend on profile angle and slat angle - - // METHODOLOGY EMPLOYED: - // Linear interpolation. - - // Argument array dimensioning - PropArray.dim(Material::MaxSlatAngs, Material::MaxProfAngs); - - Real64 SlatAng1 = std::clamp(SlatAng, 0.0, Constant::Pi); - - // This is not correct, fixed 2/17/2010 - // ProfAng1 = MIN(MAX(SlatAng,-PiOvr2),PiOvr2) - Real64 ProfAng1 = std::clamp(ProfAng, -Constant::PiOvr2, Constant::PiOvr2); - - Real64 constexpr DeltaProfAng(Constant::Pi / 36.0); - int IAlpha = int((ProfAng1 + Constant::PiOvr2) / DeltaProfAng) + 1; // Profile angle index - Real64 ProfAngRatio = (ProfAng1 + Constant::PiOvr2 - (IAlpha - 1) * DeltaProfAng) / DeltaProfAng; // Profile angle interpolation factor - - Real64 Val1; - Real64 Val2; - if (VarSlats) { // Variable-angle slats: interpolate in profile angle and slat angle - Real64 constexpr DeltaSlatAng(Constant::Pi / (double(Material::MaxSlatAngs) - 1.0)); - int IBeta = int(SlatAng1 / DeltaSlatAng) + 1; // Slat angle index - Real64 SlatAngRatio = (SlatAng1 - (IBeta - 1) * DeltaSlatAng) / DeltaSlatAng; // Slat angle interpolation factor - Val1 = PropArray(IBeta, IAlpha); // Property values at points enclosing the given ProfAngle and SlatAngle - Val2 = PropArray(min(Material::MaxSlatAngs, IBeta + 1), IAlpha); - Real64 Val3 = PropArray(IBeta, min(Material::MaxProfAngs, IAlpha + 1)); - Real64 Val4 = PropArray(min(Material::MaxSlatAngs, IBeta + 1), min(Material::MaxProfAngs, IAlpha + 1)); - Real64 ValA = Val1 + SlatAngRatio * (Val2 - Val1); // Property values at given SlatAngle to be interpolated in profile angle - Real64 ValB = Val3 + SlatAngRatio * (Val4 - Val3); - return ValA + ProfAngRatio * (ValB - ValA); - } else { // Fixed-angle slats: interpolate only in profile angle - Val1 = PropArray(1, IAlpha); - Val2 = PropArray(1, min(Material::MaxProfAngs, IAlpha + 1)); - return Val1 + ProfAngRatio * (Val2 - Val1); - } - } // InterpProfSlatAng() - - Real64 BlindBeamBeamTrans(Real64 const ProfAng, // Solar profile angle (rad) - Real64 const SlatAng, // Slat angle (rad) - Real64 const SlatWidth, // Slat width (m) - Real64 const SlatSeparation, // Slat separation (distance between surfaces of adjacent slats) (m) - Real64 const SlatThickness // Slat thickness (m) - ) - { - - // FUNCTION INFORMATION: - // AUTHOR Fred Winkelmann - // DATE WRITTEN Jan 2002 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // Calculates beam-to-beam transmittance of a window blind - - // METHODOLOGY EMPLOYED: - // Based on solar profile angle and slat geometry - - Real64 CosProfAng = std::cos(ProfAng); // Cosine of profile angle - Real64 gamma = SlatAng - ProfAng; - Real64 wbar = SlatSeparation; - if (CosProfAng != 0.0) wbar = SlatWidth * std::cos(gamma) / CosProfAng; - Real64 BlindBeamBeamTrans = max(0.0, 1.0 - std::abs(wbar / SlatSeparation)); - - if (BlindBeamBeamTrans > 0.0) { - - // Correction factor that accounts for finite thickness of slats. It is used to modify the - // blind transmittance to account for reflection and absorption by the slat edges. - // fEdge is ratio of area subtended by edge of slat to area between tops of adjacent slats. - - Real64 fEdge = 0.0; // Slat edge correction factor - Real64 fEdge1 = 0.0; - if (std::abs(std::sin(gamma)) > 0.01) { - if ((SlatAng > 0.0 && SlatAng <= Constant::PiOvr2 && ProfAng <= SlatAng) || - (SlatAng > Constant::PiOvr2 && SlatAng <= Constant::Pi && ProfAng > -(Constant::Pi - SlatAng))) - fEdge1 = - SlatThickness * std::abs(std::sin(gamma)) / ((SlatSeparation + SlatThickness / std::abs(std::sin(SlatAng))) * CosProfAng); - fEdge = min(1.0, std::abs(fEdge1)); - } - BlindBeamBeamTrans *= (1.0 - fEdge); - } - - return BlindBeamBeamTrans; - } // BlindBeamBeamTrans() - //******************************************************************************************** void ViewFac(Real64 const s, // Slat width (m) @@ -8750,8 +8445,6 @@ namespace Window { int iSolarSpectrum(0); int iVisibleSpectrum(0); int NumSiteSpectrum(0); - int Loop; - int iTmp; auto &wm = state.dataWindowManager; diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index b455e9ca144..23936c62ea8 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -139,7 +139,9 @@ namespace Window { Real64 &SurfOutsideTemp // Outside surface temperature (C) ); +#ifdef GET_OUT void WindowHeatBalanceEquations(EnergyPlusData &state, int SurfNum); // Surface number +#endif // GET_OUT void GetHeatBalanceEqCoefMatrixSimple(EnergyPlusData &state, int nglasslayer, // Number of glass layers @@ -356,40 +358,6 @@ namespace Window { Array1A p // Blind properties (equivalent to ST_LAY) ); - Real64 InterpProfAng(Real64 ProfAng, // Profile angle (rad) - Array1S PropArray // Array of blind properties - ); - - Real64 InterpSlatAng(Real64 SlatAng, // Slat angle (rad) - bool VarSlats, // True if slat angle is variable - Array1S PropArray // Array of blind properties as function of slat angle - ); - - Real64 InterpProfSlatAng(Real64 ProfAng, // Profile angle (rad) - Real64 SlatAng, // Slat angle (rad) - bool VarSlats, // True if variable-angle slats - Array2A PropArray // Array of blind properties - ); - - Real64 BlindBeamBeamTrans(Real64 ProfAng, // Solar profile angle (rad) - Real64 SlatAng, // Slat angle (rad) - Real64 SlatWidth, // Slat width (m) - Real64 SlatSeparation, // Slat separation (distance between surfaces of adjacent slats) (m) - Real64 SlatThickness // Slat thickness (m) - ); - - constexpr Real64 InterpProfSlat(Real64 const SlatLower, - Real64 const SlatUpper, - Real64 const ProfLower, - Real64 const ProfUpper, - Real64 const SlatInterpFac, - Real64 const ProfInterpFac) - { - Real64 ValA = SlatLower + SlatInterpFac * (SlatUpper - SlatLower); - Real64 ValB = ProfLower + SlatInterpFac * (ProfUpper - ProfLower); - return ValA + ProfInterpFac * (ValB - ValA); - } - inline Real64 InterpSw(Real64 const SwitchFac, // Switching factor: 0.0 if glazing is unswitched, = 1.0 if fully switched Real64 const A, // Glazing property in unswitched state Real64 const B // Glazing property in fully switched state @@ -512,7 +480,9 @@ struct WindowManagerData : BaseGlobalStruct 0.0}; // Solar radiation and IR radiation from internal gains absorbed by glass face std::array thetas = {0.0}; // Glass surface temperatures (K) std::array thetasPrev = {0.0}; // Previous-iteration glass surface temperatures (K) - std::array fvec = {0.0}; // Glass face heat balance function +#ifdef GET_OUT + std::array fvec = {0.0}; // Glass face heat balance function +#endif // GET_OUT std::array hrgap = {0.0}; // Radiative gap conductance @@ -583,7 +553,9 @@ struct WindowManagerData : BaseGlobalStruct this->AbsRadGlassFace = {0.0}; this->thetas = {0.0}; this->thetasPrev = {0.0}; +#ifdef GET_OUT this->fvec = {0.0}; +#endif // GET_OUT this->hrgap = {0.0}; this->A23P = 0.0; this->A32P = 0.0; diff --git a/src/EnergyPlus/WindowManagerExteriorData.cc b/src/EnergyPlus/WindowManagerExteriorData.cc index 8f5dbb8a271..b40bd35e9e8 100644 --- a/src/EnergyPlus/WindowManagerExteriorData.cc +++ b/src/EnergyPlus/WindowManagerExteriorData.cc @@ -161,9 +161,12 @@ namespace Window { // PURPOSE OF THIS SUBROUTINE: // Reads spectral data value + + auto &s_mat = state.dataMaterial; + assert(t_SampleDataPtr != 0); // It must not be called for zero value std::shared_ptr aSampleData = std::make_shared(); - auto spectralData = state.dataHeatBal->SpectralData(t_SampleDataPtr); // (AUTO_OK_OBJ) + auto spectralData = s_mat->SpectralData(t_SampleDataPtr); // (AUTO_OK_OBJ) int numOfWl = spectralData.NumOfWavelengths; for (int i = 1; i <= numOfWl; ++i) { Real64 wl = spectralData.WaveLength(i); @@ -177,7 +180,7 @@ namespace Window { } /////////////////////////////////////////////////////////////////////////////// - std::shared_ptr CWCESpecturmProperties::getSpectralSample(Material::MaterialChild const &t_MaterialProperties) + std::shared_ptr CWCESpecturmProperties::getSpectralSample(Material::MaterialGlass const &t_MaterialProperties) { Real64 Tsol = t_MaterialProperties.Trans; Real64 Rfsol = t_MaterialProperties.ReflectSolBeamFront; diff --git a/src/EnergyPlus/WindowManagerExteriorData.hh b/src/EnergyPlus/WindowManagerExteriorData.hh index a193477c646..33bef56946f 100644 --- a/src/EnergyPlus/WindowManagerExteriorData.hh +++ b/src/EnergyPlus/WindowManagerExteriorData.hh @@ -130,7 +130,7 @@ namespace Window { { public: static std::shared_ptr getSpectralSample(EnergyPlusData &state, int const t_SampleDataPtr); - static std::shared_ptr getSpectralSample(Material::MaterialChild const &t_MaterialProperties); + static std::shared_ptr getSpectralSample(Material::MaterialGlass const &t_MaterialProperties); static FenestrationCommon::CSeries getDefaultSolarRadiationSpectrum(EnergyPlusData &state); static FenestrationCommon::CSeries getDefaultVisiblePhotopicResponse(EnergyPlusData &state); }; diff --git a/src/EnergyPlus/WindowManagerExteriorOptical.cc b/src/EnergyPlus/WindowManagerExteriorOptical.cc index f30aa1fdf76..08aad20aa49 100644 --- a/src/EnergyPlus/WindowManagerExteriorOptical.cc +++ b/src/EnergyPlus/WindowManagerExteriorOptical.cc @@ -73,7 +73,7 @@ using namespace DataSurfaces; using namespace DataHeatBalance; namespace Window { - std::shared_ptr getBSDFLayer(EnergyPlusData &state, const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + std::shared_ptr getBSDFLayer(EnergyPlusData &state, const Material::MaterialBase *t_Material, const WavelengthRange t_Range) { // SUBROUTINE INFORMATION: // AUTHOR Simon Vidanovic @@ -85,19 +85,19 @@ namespace Window { // BSDF will be created in different ways that is based on material type std::shared_ptr aFactory = nullptr; - if (t_Material.group == Material::Group::WindowGlass) { + if (t_Material->group == Material::Group::Glass) { aFactory = std::make_shared(t_Material, t_Range); - } else if (t_Material.group == Material::Group::WindowBlind) { + } else if (t_Material->group == Material::Group::Blind) { aFactory = std::make_shared(t_Material, t_Range); - } else if (t_Material.group == Material::Group::Screen) { + } else if (t_Material->group == Material::Group::Screen) { aFactory = std::make_shared(t_Material, t_Range); - } else if (t_Material.group == Material::Group::Shade) { + } else if (t_Material->group == Material::Group::Shade) { aFactory = std::make_shared(t_Material, t_Range); } return aFactory->getBSDFLayer(state); } - CScatteringLayer getScatteringLayer(EnergyPlusData &state, const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CScatteringLayer getScatteringLayer(EnergyPlusData &state, const Material::MaterialBase *t_Material, const WavelengthRange t_Range) { // SUBROUTINE INFORMATION: // AUTHOR Simon Vidanovic @@ -110,13 +110,13 @@ namespace Window { // Scattering will be created in different ways that is based on material type std::shared_ptr aFactory = nullptr; - if (t_Material.group == Material::Group::WindowGlass || t_Material.group == Material::Group::WindowSimpleGlazing) { + if (t_Material->group == Material::Group::Glass || t_Material->group == Material::Group::GlassSimple) { aFactory = std::make_shared(t_Material, t_Range); - } else if (t_Material.group == Material::Group::WindowBlind) { + } else if (t_Material->group == Material::Group::Blind) { aFactory = std::make_shared(t_Material, t_Range); - } else if (t_Material.group == Material::Group::Screen) { + } else if (t_Material->group == Material::Group::Screen) { aFactory = std::make_shared(t_Material, t_Range); - } else if (t_Material.group == Material::Group::Shade) { + } else if (t_Material->group == Material::Group::Shade) { aFactory = std::make_shared(t_Material, t_Range); } return aFactory->getLayer(state); @@ -176,33 +176,32 @@ namespace Window { // Calculate optical properties of blind-type layers entered with MATERIAL:WindowBlind // Calculation from this is used for IR properties. Need to make sure that properties // are calculated with new WCE optical engine (for both blinds and screens) - if (state.dataHeatBal->TotBlinds > 0) CalcWindowBlindProperties(state); + auto &s_mat = state.dataMaterial; + + if (s_mat->NumBlinds > 0) CalcWindowBlindProperties(state); // Initialize SurfaceScreen structure - state.dataHeatBal->NumScreens = state.dataHeatBal->TotScreens; - if (state.dataHeatBal->NumScreens > 0) CalcWindowScreenProperties(state); + if (s_mat->NumScreens > 0) CalcWindowScreenProperties(state); auto &aWinConstSimp = CWindowConstructionsSimplified::instance(state); for (int ConstrNum = 1; ConstrNum <= state.dataHeatBal->TotConstructs; ++ConstrNum) { auto &construction = state.dataConstruction->Construct(ConstrNum); if (construction.isGlazingConstruction(state)) { for (int LayNum = 1; LayNum <= construction.TotLayers; ++LayNum) { - auto *materialBase(state.dataMaterial->Material(construction.LayerPoint(LayNum))); - auto *material = dynamic_cast(materialBase); - assert(material != nullptr); - if (material->group != Material::Group::WindowGas && material->group != Material::Group::WindowGasMixture && - material->group != Material::Group::ComplexWindowGap && material->group != Material::Group::ComplexWindowShade) { + auto const *mat = s_mat->materials(construction.LayerPoint(LayNum)); + if (mat->group != Material::Group::Gas && mat->group != Material::Group::GasMixture && + mat->group != Material::Group::ComplexWindowGap && mat->group != Material::Group::ComplexShade) { // This is necessary because rest of EnergyPlus code relies on TransDiff property // of construction. It will basically trigger Window optical calculations if this // property is >0. construction.TransDiff = 0.1; WavelengthRange aRange = WavelengthRange::Solar; - auto aSolarLayer = getScatteringLayer(state, *material, aRange); // (AUTO_OK_OBJ) + auto aSolarLayer = getScatteringLayer(state, mat, aRange); // (AUTO_OK_OBJ) aWinConstSimp.pushLayer(aRange, ConstrNum, aSolarLayer); aRange = WavelengthRange::Visible; - auto aVisibleLayer = getScatteringLayer(state, *material, aRange); // (AUTO_OK_OBJ) + auto aVisibleLayer = getScatteringLayer(state, mat, aRange); // (AUTO_OK_OBJ) aWinConstSimp.pushLayer(aRange, ConstrNum, aVisibleLayer); } } @@ -214,65 +213,52 @@ namespace Window { // interior blind/shade is deployed. for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (!state.dataSurface->Surface(SurfNum).HeatTransSurf) continue; - if (!state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).TypeIsWindow) continue; + auto &surf = state.dataSurface->Surface(SurfNum); + auto &surfShade = state.dataSurface->surfShades(SurfNum); + + if (!surf.HeatTransSurf) continue; + if (!state.dataConstruction->Construct(surf.Construction).TypeIsWindow) continue; if (state.dataSurface->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) continue; // Irrelevant for Complex Fen - if (state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).WindowTypeEQL) continue; // not required - int ConstrNumSh = state.dataSurface->Surface(SurfNum).activeShadedConstruction; - if (ConstrNumSh == 0) continue; - int TotLay = state.dataConstruction->Construct(ConstrNumSh).TotLayers; - bool IntShade = false; - bool IntBlind = false; - int ShadeLayPtr = 0; - int BlNum = 0; - auto const *thisMaterial = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay))); - assert(thisMaterial != nullptr); - if (thisMaterial->group == Material::Group::Shade) { - IntShade = true; - ShadeLayPtr = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay); - } - if (thisMaterial->group == Material::Group::WindowBlind) { - IntBlind = true; - BlNum = thisMaterial->BlindDataPtr; - } + if (state.dataConstruction->Construct(surf.Construction).WindowTypeEQL) continue; // not required + + if (surf.activeShadedConstruction == 0) continue; + auto &constrSh = state.dataConstruction->Construct(surf.activeShadedConstruction); + int TotLay = constrSh.TotLayers; + auto const *mat = s_mat->materials(constrSh.LayerPoint(TotLay)); + + if (mat->group == Material::Group::Shade) { + auto const *matShade = dynamic_cast(mat); + Real64 EpsGlIR = s_mat->materials(constrSh.LayerPoint(TotLay - 1))->AbsorpThermalBack; + Real64 RhoGlIR = 1 - EpsGlIR; + Real64 TauShIR = matShade->TransThermal; + Real64 EpsShIR = matShade->AbsorpThermal; + Real64 RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); + surfShade.effShadeEmi = EpsShIR * (1.0 + RhoGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR)); + surfShade.effGlassEmi = EpsGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR); + + } else if (mat->group == Material::Group::Blind) { + Real64 EpsGlIR = s_mat->materials(constrSh.LayerPoint(TotLay - 1))->AbsorpThermalBack; + Real64 RhoGlIR = 1 - EpsGlIR; + + auto const *matBlind = dynamic_cast(mat); + for (int iSlatAng = 0; iSlatAng < Material::MaxSlatAngs; ++iSlatAng) { + auto const &btar = matBlind->TARs[iSlatAng]; + Real64 TauShIR = btar.IR.Ft.Tra; + Real64 EpsShIR = btar.IR.Ft.Emi; + Real64 RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); + constrSh.effShadeBlindEmi[iSlatAng] = EpsShIR * (1.0 + RhoGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR)); + constrSh.effGlassEmi[iSlatAng] = EpsGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR); + } - if (IntShade || IntBlind) { - for (int ISlatAng = 1; ISlatAng <= Material::MaxSlatAngs; ++ISlatAng) { - Real64 EpsGlIR = 0.0; - Real64 RhoGlIR = 0.0; - if (IntShade || IntBlind) { - EpsGlIR = dynamic_cast( - state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay - 1))) - ->AbsorpThermalBack; - RhoGlIR = 1 - EpsGlIR; - } - if (IntShade) { - auto const *thisMaterialShade = dynamic_cast(state.dataMaterial->Material(ShadeLayPtr)); - Real64 TauShIR = thisMaterialShade->TransThermal; - Real64 EpsShIR = thisMaterialShade->AbsorpThermal; - Real64 RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); - state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[1] = - EpsShIR * (1.0 + RhoGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR)); - state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[1] = EpsGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR); - } - if (IntBlind) { - Real64 TauShIR = state.dataMaterial->Blind(BlNum).IRFrontTrans(ISlatAng); - Real64 EpsShIR = state.dataMaterial->Blind(BlNum).IRBackEmiss(ISlatAng); - Real64 RhoShIR = max(0.0, 1.0 - TauShIR - EpsShIR); - state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[ISlatAng] = - EpsShIR * (1.0 + RhoGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR)); - state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[ISlatAng] = EpsGlIR * TauShIR / (1.0 - RhoGlIR * RhoShIR); - } - // Loop over remaining slat angles only if blind with movable slats - if (IntShade) break; // Loop over remaining slat angles only if blind - if (IntBlind) { - if (state.dataMaterial->Blind(BlNum).SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) break; - } - } // End of slat angle loop - } // End of check if interior shade or interior blind - } // End of surface loop - } + surfShade.effShadeEmi = Interp(constrSh.effShadeBlindEmi[surfShade.blind.slatAngIdxLo], + constrSh.effShadeBlindEmi[surfShade.blind.slatAngIdxHi], + surfShade.blind.slatAngInterpFac); + surfShade.effGlassEmi = Interp(constrSh.effGlassEmi[surfShade.blind.slatAngIdxLo], + constrSh.effGlassEmi[surfShade.blind.slatAngIdxHi], + surfShade.blind.slatAngInterpFac); + } // End of check if interior shade or interior blind + } // End of surface loop + } // InitWCE_SimplifiedOpticalData() Real64 GetSolarTransDirectHemispherical(EnergyPlusData &state, int ConstrNum) { @@ -293,7 +279,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEMaterialFactory /////////////////////////////////////////////////////////////////////////////// - CWCEMaterialFactory::CWCEMaterialFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCEMaterialFactory::CWCEMaterialFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : m_MaterialProperties(t_Material), m_Range(t_Range), m_Initialized(false) { } @@ -310,17 +296,20 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCESpecularMaterialsFactory /////////////////////////////////////////////////////////////////////////////// - CWCESpecularMaterialsFactory::CWCESpecularMaterialsFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCESpecularMaterialsFactory::CWCESpecularMaterialsFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : CWCEMaterialFactory(t_Material, t_Range) { } void CWCESpecularMaterialsFactory::init(EnergyPlusData &state) { - if (m_MaterialProperties.GlassSpectralDataPtr > 0) { + auto const *matGlass = dynamic_cast(m_MaterialProperties); + assert(matGlass != nullptr); + + if (matGlass->GlassSpectralDataPtr > 0) { auto aSolarSpectrum = CWCESpecturmProperties::getDefaultSolarRadiationSpectrum(state); // (AUTO_OK_OBJ) std::shared_ptr aSampleData = nullptr; - aSampleData = CWCESpecturmProperties::getSpectralSample(state, m_MaterialProperties.GlassSpectralDataPtr); + aSampleData = CWCESpecturmProperties::getSpectralSample(state, matGlass->GlassSpectralDataPtr); auto aSample = std::make_shared(aSampleData, aSolarSpectrum); // (AUTO_OK_SHARED_PTR) @@ -330,27 +319,21 @@ namespace Window { Real64 highLambda = aRange.maxLambda(); // Do not apply detector data if we do not have spectral data. This will only cause more inaccurate results at the end. (Simon) - if (m_Range == WavelengthRange::Visible && m_MaterialProperties.GlassSpectralDataPtr != 0) { + if (m_Range == WavelengthRange::Visible && matGlass->GlassSpectralDataPtr != 0) { const auto aPhotopicResponse = CWCESpecturmProperties::getDefaultVisiblePhotopicResponse(state); // (AUTO_OK_OBJ) aSample->setDetectorData(aPhotopicResponse); } - Real64 thickness = m_MaterialProperties.Thickness; + Real64 thickness = matGlass->Thickness; m_Material = std::make_shared(aSample, thickness, aType, lowLambda, highLambda); } else { if (m_Range == WavelengthRange::Solar) { - m_Material = std::make_shared(m_MaterialProperties.Trans, - m_MaterialProperties.Trans, - m_MaterialProperties.ReflectSolBeamFront, - m_MaterialProperties.ReflectSolBeamBack, - m_Range); + m_Material = std::make_shared( + matGlass->Trans, matGlass->Trans, matGlass->ReflectSolBeamFront, matGlass->ReflectSolBeamBack, m_Range); } if (m_Range == WavelengthRange::Visible) { - m_Material = std::make_shared(m_MaterialProperties.TransVis, - m_MaterialProperties.TransVis, - m_MaterialProperties.ReflectVisBeamFront, - m_MaterialProperties.ReflectVisBeamBack, - m_Range); + m_Material = std::make_shared( + matGlass->TransVis, matGlass->TransVis, matGlass->ReflectVisBeamFront, matGlass->ReflectVisBeamBack, m_Range); } } } @@ -358,7 +341,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEMaterialDualBandFactory /////////////////////////////////////////////////////////////////////////////// - CWCEMaterialDualBandFactory::CWCEMaterialDualBandFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCEMaterialDualBandFactory::CWCEMaterialDualBandFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : CWCEMaterialFactory(t_Material, t_Range) { } @@ -379,43 +362,41 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEVenetianBlindMaterialsFactory /////////////////////////////////////////////////////////////////////////////// - CWCEVenetianBlindMaterialsFactory::CWCEVenetianBlindMaterialsFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCEVenetianBlindMaterialsFactory::CWCEVenetianBlindMaterialsFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : CWCEMaterialDualBandFactory(t_Material, t_Range) { } - std::shared_ptr CWCEVenetianBlindMaterialsFactory::createVisibleRangeMaterial(EnergyPlusData &state) + std::shared_ptr CWCEVenetianBlindMaterialsFactory::createVisibleRangeMaterial([[maybe_unused]] EnergyPlusData &state) { - int blindDataPtr = m_MaterialProperties.BlindDataPtr; - assert(blindDataPtr > 0); - auto &blind = state.dataMaterial->Blind(blindDataPtr); + auto const *matBlind = dynamic_cast(m_MaterialProperties); + assert(matBlind != nullptr); CWavelengthRange aRange(WavelengthRange::Visible); Real64 lowLambda = aRange.minLambda(); Real64 highLambda = aRange.maxLambda(); - Real64 Tf = blind.SlatTransVisDiffDiff; - Real64 Tb = blind.SlatTransVisDiffDiff; - Real64 Rf = blind.SlatFrontReflVisDiffDiff; - Real64 Rb = blind.SlatBackReflVisDiffDiff; + Real64 Tf = matBlind->slatTAR.Vis.Ft.Df.Tra; + Real64 Tb = matBlind->slatTAR.Vis.Ft.Df.Tra; + Real64 Rf = matBlind->slatTAR.Vis.Ft.Df.Ref; + Real64 Rb = matBlind->slatTAR.Vis.Bk.Df.Ref; return std::make_shared(Tf, Tb, Rf, Rb, lowLambda, highLambda); } std::shared_ptr CWCEVenetianBlindMaterialsFactory::createSolarRangeMaterial([[maybe_unused]] EnergyPlusData &state) { - int blindDataPtr = m_MaterialProperties.BlindDataPtr; - assert(blindDataPtr > 0); - auto &blind = state.dataMaterial->Blind(blindDataPtr); + auto const *matBlind = dynamic_cast(m_MaterialProperties); + assert(matBlind != nullptr); CWavelengthRange aRange(WavelengthRange::Solar); Real64 lowLambda = aRange.minLambda(); Real64 highLambda = aRange.maxLambda(); - Real64 Tf = blind.SlatTransSolDiffDiff; - Real64 Tb = blind.SlatTransSolDiffDiff; - Real64 Rf = blind.SlatFrontReflSolDiffDiff; - Real64 Rb = blind.SlatBackReflSolDiffDiff; + Real64 Tf = matBlind->slatTAR.Sol.Ft.Df.Tra; + Real64 Tb = matBlind->slatTAR.Sol.Ft.Df.Tra; + Real64 Rf = matBlind->slatTAR.Sol.Ft.Df.Ref; + Real64 Rb = matBlind->slatTAR.Sol.Bk.Df.Ref; return std::make_shared(Tf, Tb, Rf, Rb, lowLambda, highLambda); } @@ -423,7 +404,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEScreenMaterialsFactory /////////////////////////////////////////////////////////////////////////////// - CWCEScreenMaterialsFactory::CWCEScreenMaterialsFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCEScreenMaterialsFactory::CWCEScreenMaterialsFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : CWCEMaterialDualBandFactory(t_Material, t_Range) { // Current EnergyPlus model does not support material transmittance different from zero. @@ -432,28 +413,32 @@ namespace Window { std::shared_ptr CWCEScreenMaterialsFactory::createVisibleRangeMaterial([[maybe_unused]] EnergyPlusData &state) { + auto const *matShade = dynamic_cast(m_MaterialProperties); + assert(matShade != nullptr); CWavelengthRange aRange(WavelengthRange::Visible); Real64 lowLambda = aRange.minLambda(); Real64 highLambda = aRange.maxLambda(); Real64 Tf = 0.0; Real64 Tb = 0.0; - Real64 Rf = m_MaterialProperties.ReflectShadeVis; - Real64 Rb = m_MaterialProperties.ReflectShadeVis; + Real64 Rf = matShade->ReflectShadeVis; + Real64 Rb = matShade->ReflectShadeVis; return std::make_shared(Tf, Tb, Rf, Rb, lowLambda, highLambda); } std::shared_ptr CWCEScreenMaterialsFactory::createSolarRangeMaterial([[maybe_unused]] EnergyPlusData &state) { + auto const *matShade = dynamic_cast(m_MaterialProperties); + assert(matShade != nullptr); CWavelengthRange aRange(WavelengthRange::Solar); Real64 lowLambda = aRange.minLambda(); Real64 highLambda = aRange.maxLambda(); Real64 Tf = 0.0; Real64 Tb = 0.0; - Real64 Rf = m_MaterialProperties.ReflectShade; - Real64 Rb = m_MaterialProperties.ReflectShade; + Real64 Rf = matShade->ReflectShade; + Real64 Rb = matShade->ReflectShade; return std::make_shared(Tf, Tb, Rf, Rb, lowLambda, highLambda); } @@ -461,35 +446,39 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEDiffuseShadeMaterialsFactory /////////////////////////////////////////////////////////////////////////////// - CWCEDiffuseShadeMaterialsFactory::CWCEDiffuseShadeMaterialsFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCEDiffuseShadeMaterialsFactory::CWCEDiffuseShadeMaterialsFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : CWCEMaterialDualBandFactory(t_Material, t_Range) { } std::shared_ptr CWCEDiffuseShadeMaterialsFactory::createVisibleRangeMaterial([[maybe_unused]] EnergyPlusData &state) { + auto const *matShade = dynamic_cast(m_MaterialProperties); + assert(matShade != nullptr); CWavelengthRange aRange(WavelengthRange::Visible); Real64 lowLambda = aRange.minLambda(); Real64 highLambda = aRange.maxLambda(); - Real64 Tf = m_MaterialProperties.TransVis; - Real64 Tb = m_MaterialProperties.TransVis; - Real64 Rf = m_MaterialProperties.ReflectShadeVis; - Real64 Rb = m_MaterialProperties.ReflectShadeVis; + Real64 Tf = matShade->TransVis; + Real64 Tb = matShade->TransVis; + Real64 Rf = matShade->ReflectShadeVis; + Real64 Rb = matShade->ReflectShadeVis; return std::make_shared(Tf, Tb, Rf, Rb, lowLambda, highLambda); } std::shared_ptr CWCEDiffuseShadeMaterialsFactory::createSolarRangeMaterial([[maybe_unused]] EnergyPlusData &state) { + auto const *matShade = dynamic_cast(m_MaterialProperties); + assert(matShade != nullptr); CWavelengthRange aRange(WavelengthRange::Solar); Real64 lowLambda = aRange.minLambda(); Real64 highLambda = aRange.maxLambda(); - Real64 Tf = m_MaterialProperties.Trans; - Real64 Tb = m_MaterialProperties.Trans; - Real64 Rf = m_MaterialProperties.ReflectShade; - Real64 Rb = m_MaterialProperties.ReflectShade; + Real64 Tf = matShade->Trans; + Real64 Tb = matShade->Trans; + Real64 Rf = matShade->ReflectShade; + Real64 Rb = matShade->ReflectShade; return std::make_shared(Tf, Tb, Rf, Rb, lowLambda, highLambda); } @@ -497,7 +486,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCECellFactory /////////////////////////////////////////////////////////////////////////////// - IWCECellDescriptionFactory::IWCECellDescriptionFactory(const Material::MaterialChild &t_Material) : m_Material(t_Material) + IWCECellDescriptionFactory::IWCECellDescriptionFactory(const Material::MaterialBase *t_Material) : m_Material(t_Material) { } @@ -505,7 +494,7 @@ namespace Window { // CWCESpecularCellFactory /////////////////////////////////////////////////////////////////////////////// - CWCESpecularCellFactory::CWCESpecularCellFactory(const Material::MaterialChild &t_Material) : IWCECellDescriptionFactory(t_Material) + CWCESpecularCellFactory::CWCESpecularCellFactory(const Material::MaterialBase *t_Material) : IWCECellDescriptionFactory(t_Material) { } @@ -517,36 +506,35 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEVenetianBlindCellFactory /////////////////////////////////////////////////////////////////////////////// - CWCEVenetianBlindCellFactory::CWCEVenetianBlindCellFactory(const Material::MaterialChild &t_Material) : IWCECellDescriptionFactory(t_Material) + CWCEVenetianBlindCellFactory::CWCEVenetianBlindCellFactory(const Material::MaterialBase *t_Material) : IWCECellDescriptionFactory(t_Material) { } std::shared_ptr CWCEVenetianBlindCellFactory::getCellDescription([[maybe_unused]] EnergyPlusData &state) { - const int blindDataPtr = m_Material.BlindDataPtr; - assert(blindDataPtr > 0); - auto &blind = state.dataMaterial->Blind(blindDataPtr); + auto *matBlind = dynamic_cast(m_Material); + assert(matBlind != nullptr); - Real64 slatWidth = blind.SlatWidth; - Real64 slatSpacing = blind.SlatSeparation; - Real64 slatTiltAngle = 90.0 - blind.SlatAngle; // Need to convert to WCE system - Real64 curvatureRadius = 0.0; // No curvature radius in current IDF definition - size_t numOfSlatSegments = 5; // Number of segments to use in venetian calculations + Real64 slatWidth = matBlind->SlatWidth; + Real64 slatSpacing = matBlind->SlatSeparation; + Real64 slatTiltAngle = 90.0 - matBlind->SlatAngle; // Need to convert to WCE system + Real64 curvatureRadius = 0.0; // No curvature radius in current IDF definition + size_t numOfSlatSegments = 5; // Number of segments to use in venetian calculations return std::make_shared(slatWidth, slatSpacing, slatTiltAngle, curvatureRadius, numOfSlatSegments); } /////////////////////////////////////////////////////////////////////////////// // CWCEScreenCellFactory /////////////////////////////////////////////////////////////////////////////// - CWCEScreenCellFactory::CWCEScreenCellFactory(const Material::MaterialChild &t_Material) : IWCECellDescriptionFactory(t_Material) + CWCEScreenCellFactory::CWCEScreenCellFactory(const Material::MaterialBase *t_Material) : IWCECellDescriptionFactory(t_Material) { } std::shared_ptr CWCEScreenCellFactory::getCellDescription([[maybe_unused]] EnergyPlusData &state) { - Real64 diameter = m_Material.Thickness; // Thickness in this case is diameter + Real64 diameter = m_Material->Thickness; // Thickness in this case is diameter // ratio is not saved withing material but rather calculated from transmittance - const Real64 ratio = 1.0 - sqrt(m_Material.Trans); + const Real64 ratio = 1.0 - sqrt(dynamic_cast(m_Material)->Trans); Real64 spacing = diameter / ratio; return std::make_shared(diameter, spacing); } @@ -554,7 +542,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEDiffuseShadeCellFactory /////////////////////////////////////////////////////////////////////////////// - CWCEDiffuseShadeCellFactory::CWCEDiffuseShadeCellFactory(const Material::MaterialChild &t_Material) : IWCECellDescriptionFactory(t_Material) + CWCEDiffuseShadeCellFactory::CWCEDiffuseShadeCellFactory(const Material::MaterialBase *t_Material) : IWCECellDescriptionFactory(t_Material) { } @@ -566,7 +554,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEBSDFLayerFactory /////////////////////////////////////////////////////////////////////////////// - CWCELayerFactory::CWCELayerFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCELayerFactory::CWCELayerFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : m_Material(t_Material), m_Range(t_Range), m_BSDFInitialized(false), m_SimpleInitialized(false), m_MaterialFactory(nullptr) { } @@ -614,7 +602,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCESpecularLayerFactory /////////////////////////////////////////////////////////////////////////////// - CWCESpecularLayerFactory::CWCESpecularLayerFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCESpecularLayerFactory::CWCESpecularLayerFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : CWCELayerFactory(t_Material, t_Range) { m_CellFactory = std::make_shared(t_Material); @@ -628,7 +616,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEVenetianBlindLayerFactory /////////////////////////////////////////////////////////////////////////////// - CWCEVenetianBlindLayerFactory::CWCEVenetianBlindLayerFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCEVenetianBlindLayerFactory::CWCEVenetianBlindLayerFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : CWCELayerFactory(t_Material, t_Range) { m_CellFactory = std::make_shared(t_Material); @@ -642,7 +630,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEScreenLayerFactory /////////////////////////////////////////////////////////////////////////////// - CWCEScreenLayerFactory::CWCEScreenLayerFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCEScreenLayerFactory::CWCEScreenLayerFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : CWCELayerFactory(t_Material, t_Range) { m_CellFactory = std::make_shared(t_Material); @@ -656,7 +644,7 @@ namespace Window { /////////////////////////////////////////////////////////////////////////////// // CWCEDiffuseShadeLayerFactory /////////////////////////////////////////////////////////////////////////////// - CWCEDiffuseShadeLayerFactory::CWCEDiffuseShadeLayerFactory(const Material::MaterialChild &t_Material, const WavelengthRange t_Range) + CWCEDiffuseShadeLayerFactory::CWCEDiffuseShadeLayerFactory(const Material::MaterialBase *t_Material, const WavelengthRange t_Range) : CWCELayerFactory(t_Material, t_Range) { m_CellFactory = std::make_shared(t_Material); diff --git a/src/EnergyPlus/WindowManagerExteriorOptical.hh b/src/EnergyPlus/WindowManagerExteriorOptical.hh index c3b93fe56cf..bbb3e0c0de2 100644 --- a/src/EnergyPlus/WindowManagerExteriorOptical.hh +++ b/src/EnergyPlus/WindowManagerExteriorOptical.hh @@ -60,7 +60,6 @@ namespace EnergyPlus { namespace DataHeatBalance { struct MaterialBase; - struct MaterialChild; } // namespace DataHeatBalance } // namespace EnergyPlus @@ -82,10 +81,10 @@ namespace Window { Real64 GetVisibleTransDirectHemispherical(EnergyPlusData &state, int ConstrNum); std::shared_ptr - getBSDFLayer(EnergyPlusData &state, const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + getBSDFLayer(EnergyPlusData &state, const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); SingleLayerOptics::CScatteringLayer - getScatteringLayer(EnergyPlusData &state, const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + getScatteringLayer(EnergyPlusData &state, const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); /////////////////////////////////////////////////////////////////////////////// // CWCEMaterialFactory @@ -94,14 +93,14 @@ namespace Window { { public: virtual ~CWCEMaterialFactory() = default; - CWCEMaterialFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCEMaterialFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); std::shared_ptr getMaterial(EnergyPlusData &state); protected: virtual void init(EnergyPlusData &state) = 0; std::shared_ptr m_Material; - Material::MaterialChild m_MaterialProperties; + Material::MaterialBase const *m_MaterialProperties; FenestrationCommon::WavelengthRange m_Range; bool m_Initialized; }; @@ -112,7 +111,7 @@ namespace Window { class CWCESpecularMaterialsFactory : public CWCEMaterialFactory { public: - CWCESpecularMaterialsFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCESpecularMaterialsFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); private: void init(EnergyPlusData &state) override; @@ -126,7 +125,7 @@ namespace Window { // Common interface class for devices with materials defined over visible and solar range. // It is mainly intended from shading devices. public: - CWCEMaterialDualBandFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCEMaterialDualBandFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); protected: void init([[maybe_unused]] EnergyPlusData &state) override; @@ -140,7 +139,7 @@ namespace Window { class CWCEVenetianBlindMaterialsFactory : public CWCEMaterialDualBandFactory { public: - CWCEVenetianBlindMaterialsFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCEVenetianBlindMaterialsFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); private: std::shared_ptr createVisibleRangeMaterial(EnergyPlusData &state) override; @@ -153,7 +152,7 @@ namespace Window { class CWCEScreenMaterialsFactory : public CWCEMaterialDualBandFactory { public: - CWCEScreenMaterialsFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCEScreenMaterialsFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); private: std::shared_ptr createVisibleRangeMaterial(EnergyPlusData &state) override; @@ -166,7 +165,7 @@ namespace Window { class CWCEDiffuseShadeMaterialsFactory : public CWCEMaterialDualBandFactory { public: - CWCEDiffuseShadeMaterialsFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCEDiffuseShadeMaterialsFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); private: std::shared_ptr createVisibleRangeMaterial(EnergyPlusData &state) override; @@ -180,12 +179,12 @@ namespace Window { { public: virtual ~IWCECellDescriptionFactory() = default; - IWCECellDescriptionFactory(const Material::MaterialChild &t_Material); + IWCECellDescriptionFactory(const Material::MaterialBase *t_Material); virtual std::shared_ptr getCellDescription(EnergyPlusData &state) = 0; protected: - Material::MaterialChild m_Material; + Material::MaterialBase const *m_Material; }; /////////////////////////////////////////////////////////////////////////////// @@ -194,7 +193,7 @@ namespace Window { class CWCESpecularCellFactory : public IWCECellDescriptionFactory { public: - explicit CWCESpecularCellFactory(const Material::MaterialChild &t_Material); + explicit CWCESpecularCellFactory(const Material::MaterialBase *t_Material); std::shared_ptr getCellDescription(EnergyPlusData &state) override; }; @@ -205,7 +204,7 @@ namespace Window { class CWCEVenetianBlindCellFactory : public IWCECellDescriptionFactory { public: - CWCEVenetianBlindCellFactory(const Material::MaterialChild &t_Material); + CWCEVenetianBlindCellFactory(const Material::MaterialBase *t_Material); std::shared_ptr getCellDescription(EnergyPlusData &state) override; }; @@ -216,7 +215,7 @@ namespace Window { class CWCEScreenCellFactory : public IWCECellDescriptionFactory { public: - CWCEScreenCellFactory(const Material::MaterialChild &t_Material); + CWCEScreenCellFactory(const Material::MaterialBase *t_Material); std::shared_ptr getCellDescription(EnergyPlusData &state) override; }; @@ -227,7 +226,7 @@ namespace Window { class CWCEDiffuseShadeCellFactory : public IWCECellDescriptionFactory { public: - CWCEDiffuseShadeCellFactory(const Material::MaterialChild &t_Material); + CWCEDiffuseShadeCellFactory(const Material::MaterialBase *t_Material); std::shared_ptr getCellDescription(EnergyPlusData &state) override; }; @@ -239,7 +238,7 @@ namespace Window { { public: virtual ~CWCELayerFactory() = default; - CWCELayerFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCELayerFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); std::shared_ptr getBSDFLayer(EnergyPlusData &state); SingleLayerOptics::CScatteringLayer getLayer(EnergyPlusData &state); @@ -251,7 +250,7 @@ namespace Window { virtual void createMaterialFactory() = 0; std::shared_ptr getCellDescription(EnergyPlusData &state) const; - const Material::MaterialChild m_Material; + const Material::MaterialBase *m_Material; const FenestrationCommon::WavelengthRange m_Range; bool m_BSDFInitialized; bool m_SimpleInitialized; @@ -268,7 +267,7 @@ namespace Window { class CWCESpecularLayerFactory : public CWCELayerFactory { public: - CWCESpecularLayerFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCESpecularLayerFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); private: void createMaterialFactory() override; @@ -280,7 +279,7 @@ namespace Window { class CWCEVenetianBlindLayerFactory : public CWCELayerFactory { public: - CWCEVenetianBlindLayerFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCEVenetianBlindLayerFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); private: void createMaterialFactory() override; @@ -292,7 +291,7 @@ namespace Window { class CWCEScreenLayerFactory : public CWCELayerFactory { public: - CWCEScreenLayerFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCEScreenLayerFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); private: void createMaterialFactory() override; @@ -304,7 +303,7 @@ namespace Window { class CWCEDiffuseShadeLayerFactory : public CWCELayerFactory { public: - CWCEDiffuseShadeLayerFactory(const Material::MaterialChild &t_Material, const FenestrationCommon::WavelengthRange t_Range); + CWCEDiffuseShadeLayerFactory(const Material::MaterialBase *t_Material, const FenestrationCommon::WavelengthRange t_Range); private: void createMaterialFactory() override; diff --git a/src/EnergyPlus/WindowManagerExteriorThermal.cc b/src/EnergyPlus/WindowManagerExteriorThermal.cc index ec5187dcb35..d4b1883ff26 100644 --- a/src/EnergyPlus/WindowManagerExteriorThermal.cc +++ b/src/EnergyPlus/WindowManagerExteriorThermal.cc @@ -91,17 +91,17 @@ namespace Window { // Main wrapper routine to pick-up data from EnergyPlus and then call Windows-CalcEngine routines // to obtain results - auto &window = state.dataSurface->SurfaceWindow(SurfNum); - auto &surface = state.dataSurface->Surface(SurfNum); - int ConstrNum = surface.Construction; + auto &surf = state.dataSurface->Surface(SurfNum); + auto &surfWin = state.dataSurface->SurfaceWindow(SurfNum); + int ConstrNum = surf.Construction; auto &construction = state.dataConstruction->Construct(ConstrNum); constexpr Real64 solutionTolerance = 0.02; // Tarcog thermal system for solving heat transfer through the window - int activeConstrNum = CWCEHeatTransferFactory::getActiveConstructionNumber(state, surface, SurfNum); - auto aFactory = CWCEHeatTransferFactory(state, surface, SurfNum, activeConstrNum); // (AUTO_OK) - auto aSystem = aFactory.getTarcogSystem(state, HextConvCoeff); // (AUTO_OK_SPTR) + int activeConstrNum = CWCEHeatTransferFactory::getActiveConstructionNumber(state, surf, SurfNum); + auto aFactory = CWCEHeatTransferFactory(state, surf, SurfNum, activeConstrNum); // (AUTO_OK) + auto aSystem = aFactory.getTarcogSystem(state, HextConvCoeff); // (AUTO_OK_SPTR) aSystem->setTolerance(solutionTolerance); // get previous timestep temperatures solution for faster iterations @@ -140,21 +140,10 @@ namespace Window { } SurfInsideTemp = aTemp - Constant::Kelvin; if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinShadingFlag(SurfNum))) { - Real64 EffShBlEmiss; - Real64 EffGlEmiss; - if (state.dataSurface->SurfWinMovableSlats(SurfNum)) { - EffShBlEmiss = - General::Interp(window.EffShBlindEmiss[state.dataSurface->SurfWinSlatsAngIndex(SurfNum)], - window.EffShBlindEmiss[std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1)], - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - EffGlEmiss = - General::Interp(window.EffGlassEmiss[state.dataSurface->SurfWinSlatsAngIndex(SurfNum)], - window.EffGlassEmiss[std::min(Material::MaxSlatAngs, state.dataSurface->SurfWinSlatsAngIndex(SurfNum) + 1)], - state.dataSurface->SurfWinSlatsAngInterpFac(SurfNum)); - } else { - EffShBlEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffShBlindEmiss[1]; - EffGlEmiss = state.dataSurface->SurfaceWindow(SurfNum).EffGlassEmiss[1]; - } + auto const &surfShade = state.dataSurface->surfShades(SurfNum); + Real64 EffShBlEmiss = surfShade.effShadeEmi; + Real64 EffGlEmiss = surfShade.effGlassEmi; + state.dataSurface->SurfWinEffInsSurfTemp(SurfNum) = (EffShBlEmiss * SurfInsideTemp + EffGlEmiss * (state.dataWindowManager->thetas[2 * totSolidLayers - 3] - Constant::Kelvin)) / (EffShBlEmiss + EffGlEmiss); @@ -163,6 +152,7 @@ namespace Window { state.dataHeatBalSurf->SurfHConvInt(SurfNum) = aSystem->getHc(Tarcog::ISO15099::Environment::Indoor); if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinShadingFlag(SurfNum)) || aFactory.isInteriorShade()) { + auto &surfShade = state.dataSurface->surfShades(SurfNum); // It is not clear why EnergyPlus keeps this interior calculations separately for interior shade. This does create different // solution from heat transfer from tarcog itself. Need to confirm with LBNL team about this approach. Note that heat flow // through shade (consider case when openings are zero) is different from heat flow obtained by these equations. Will keep @@ -192,7 +182,7 @@ namespace Window { Real64 NetIRHeatGainGlass = ShadeArea * (glassEmiss * TauShIR / ShGlReflFacIR) * (Constant::StefanBoltzmann * pow(state.dataWindowManager->thetas[state.dataWindowManager->nglface - 1], 4) - rmir); - Real64 tind = surface.getInsideAirTemperature(state, SurfNum) + Constant::Kelvin; + Real64 tind = surf.getInsideAirTemperature(state, SurfNum) + Constant::Kelvin; Real64 ConvHeatGainFrZoneSideOfShade = ShadeArea * state.dataHeatBalSurf->SurfHConvInt(SurfNum) * (state.dataWindowManager->thetas[state.dataWindowManager->nglfacep - 1] - tind); state.dataSurface->SurfWinHeatGain(SurfNum) = @@ -202,38 +192,35 @@ namespace Window { // Effective shade and glass emissivities that are used later for energy calculations. // This needs to be checked as well. (Simon) - Real64 EffShBlEmiss = EpsShIR1 * (1.0 + RhoGlIR2 * TauShIR / (1.0 - RhoGlIR2 * RhoShIR2)); - std::fill(window.EffShBlindEmiss.begin(), window.EffShBlindEmiss.end(), EffShBlEmiss); - - Real64 EffGlEmiss = glassEmiss * TauShIR / (1.0 - RhoGlIR2 * RhoShIR2); - std::fill(window.EffGlassEmiss.begin(), window.EffGlassEmiss.end(), EffGlEmiss); + surfShade.effShadeEmi = EpsShIR1 * (1.0 + RhoGlIR2 * TauShIR / (1.0 - RhoGlIR2 * RhoShIR2)); + surfShade.effGlassEmi = glassEmiss * TauShIR / (1.0 - RhoGlIR2 * RhoShIR2); Real64 glassTemperature = aGlassLayer->getSurface(FenestrationCommon::Side::Back)->getTemperature(); state.dataSurface->SurfWinEffInsSurfTemp(SurfNum) = - (EffShBlEmiss * SurfInsideTemp + EffGlEmiss * (glassTemperature - Constant::Kelvin)) / (EffShBlEmiss + EffGlEmiss); + (surfShade.effShadeEmi * SurfInsideTemp + surfShade.effGlassEmi * (glassTemperature - Constant::Kelvin)) / + (surfShade.effShadeEmi + surfShade.effGlassEmi); } else { // Another adoptation to old source that looks suspicious. Check if heat flow through // window is actually matching these values. (Simon) // + auto &surfShade = state.dataSurface->surfShades(SurfNum); int totLayers = aLayers.size(); auto aGlassLayer = aLayers[totLayers - 1]; // (AUTO_OK_SPTR) auto backSurface = aGlassLayer->getSurface(FenestrationCommon::Side::Back); // (AUTO_OK_SPTR) Real64 h_cin = aSystem->getHc(Tarcog::ISO15099::Environment::Indoor); Real64 ConvHeatGainFrZoneSideOfGlass = - surface.Area * h_cin * (backSurface->getTemperature() - aSystem->getAirTemperature(Tarcog::ISO15099::Environment::Indoor)); + surf.Area * h_cin * (backSurface->getTemperature() - aSystem->getAirTemperature(Tarcog::ISO15099::Environment::Indoor)); Real64 rmir = state.dataSurface->SurfWinIRfromParentZone(SurfNum) + state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(SurfNum); Real64 NetIRHeatGainGlass = - surface.Area * backSurface->getEmissivity() * (Constant::StefanBoltzmann * pow(backSurface->getTemperature(), 4) - rmir); + surf.Area * backSurface->getEmissivity() * (Constant::StefanBoltzmann * pow(backSurface->getTemperature(), 4) - rmir); state.dataSurface->SurfWinEffInsSurfTemp(SurfNum) = aLayers[totLayers - 1]->getTemperature(FenestrationCommon::Side::Back) - Constant::Kelvin; - std::fill(window.EffGlassEmiss.begin(), - window.EffGlassEmiss.end(), - aLayers[totLayers - 1]->getSurface(FenestrationCommon::Side::Back)->getEmissivity()); + surfShade.effGlassEmi = aLayers[totLayers - 1]->getSurface(FenestrationCommon::Side::Back)->getEmissivity(); state.dataSurface->SurfWinHeatGain(SurfNum) = state.dataSurface->SurfWinTransSolar(SurfNum) + ConvHeatGainFrZoneSideOfGlass + NetIRHeatGainGlass; @@ -242,15 +229,14 @@ namespace Window { } state.dataSurface->SurfWinLossSWZoneToOutWinRep(SurfNum) = - state.dataHeatBal->EnclSolQSWRad(state.dataSurface->Surface(SurfNum).SolarEnclIndex) * surface.Area * - (1 - construction.ReflectSolDiffBack) + + state.dataHeatBal->EnclSolQSWRad(state.dataSurface->Surface(SurfNum).SolarEnclIndex) * surf.Area * (1 - construction.ReflectSolDiffBack) + state.dataHeatBalSurf->SurfWinInitialBeamSolInTrans(SurfNum); state.dataSurface->SurfWinHeatGain(SurfNum) -= - (state.dataSurface->SurfWinLossSWZoneToOutWinRep(SurfNum) + state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(SurfNum) * surface.Area); + (state.dataSurface->SurfWinLossSWZoneToOutWinRep(SurfNum) + state.dataHeatBalSurf->SurfWinInitialDifSolInTrans(SurfNum) * surf.Area); - for (int k = 1; k <= surface.getTotLayers(state); ++k) { - window.thetaFace[2 * k - 1] = state.dataWindowManager->thetas[2 * k - 2]; - window.thetaFace[2 * k] = state.dataWindowManager->thetas[2 * k - 1]; + for (int k = 1; k <= surf.getTotLayers(state); ++k) { + surfWin.thetaFace[2 * k - 1] = state.dataWindowManager->thetas[2 * k - 2]; + surfWin.thetaFace[2 * k] = state.dataWindowManager->thetas[2 * k - 1]; // temperatures for reporting state.dataHeatBal->SurfWinFenLaySurfTempFront(SurfNum, k) = state.dataWindowManager->thetas[2 * k - 2] - Constant::Kelvin; @@ -497,7 +483,7 @@ namespace Window { auto &construction = state.dataConstruction->Construct(ConstrNum); const int LayPtr = construction.LayerPoint(t_Index); - return state.dataMaterial->Material(LayPtr); + return state.dataMaterial->materials(LayPtr); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -509,12 +495,11 @@ namespace Window { Material::Group matGroup = material->group; - if ((matGroup == Material::Group::WindowGlass) || (matGroup == Material::Group::WindowSimpleGlazing) || - (matGroup == Material::Group::WindowBlind) || (matGroup == Material::Group::Shade) || (matGroup == Material::Group::Screen) || - (matGroup == Material::Group::ComplexWindowShade)) { + if ((matGroup == Material::Group::Glass) || (matGroup == Material::Group::GlassSimple) || (matGroup == Material::Group::Blind) || + (matGroup == Material::Group::Shade) || (matGroup == Material::Group::Screen) || (matGroup == Material::Group::ComplexShade)) { ++m_SolidLayerIndex; aLayer = getSolidLayer(state, material, m_SolidLayerIndex); - } else if (matGroup == Material::Group::WindowGas || matGroup == Material::Group::WindowGasMixture) { + } else if (matGroup == Material::Group::Gas || matGroup == Material::Group::GasMixture) { aLayer = getGapLayer(material); } else if (matGroup == Material::Group::ComplexWindowGap) { aLayer = getComplexGapLayer(state, material); @@ -531,7 +516,7 @@ namespace Window { ///////////////////////////////////////////////////////////////////////////////////////// std::shared_ptr - CWCEHeatTransferFactory::getSolidLayer(EnergyPlusData &state, Material::MaterialBase const *materialBase, int const t_Index) + CWCEHeatTransferFactory::getSolidLayer(EnergyPlusData &state, Material::MaterialBase const *mat, int const t_Index) { // SUBROUTINE INFORMATION: // AUTHOR Simon Vidanovic @@ -554,87 +539,105 @@ namespace Window { Real64 Aright = 0.0; Real64 Afront = 0.0; - auto const *material = dynamic_cast(materialBase); - assert(material != nullptr); - if (material->group == Material::Group::WindowGlass || material->group == Material::Group::WindowSimpleGlazing) { - emissFront = material->AbsorpThermalFront; - emissBack = material->AbsorpThermalBack; - transThermalFront = material->TransThermal; - transThermalBack = material->TransThermal; - thickness = material->Thickness; - conductivity = material->Conductivity; - } - if (material->group == Material::Group::WindowBlind) { - int blNum = state.dataSurface->SurfWinBlindNumber(m_SurfNum); - auto const &blind = state.dataMaterial->Blind(blNum); // This was plain auto, did you mean to make a copy of blind? - thickness = blind.SlatThickness; - conductivity = blind.SlatConductivity; - Atop = blind.BlindTopOpeningMult; - Abot = blind.BlindBottomOpeningMult; - Aleft = blind.BlindLeftOpeningMult; - Aright = blind.BlindRightOpeningMult; - Afront = state.dataSurface->SurfWinBlindAirFlowPermeability(m_SurfNum); - emissFront = InterpSlatAng( - state.dataSurface->SurfWinSlatAngThisTS(m_SurfNum), state.dataSurface->SurfWinMovableSlats(m_SurfNum), blind.IRFrontEmiss); - emissBack = InterpSlatAng( - state.dataSurface->SurfWinSlatAngThisTS(m_SurfNum), state.dataSurface->SurfWinMovableSlats(m_SurfNum), blind.IRBackEmiss); - transThermalFront = InterpSlatAng( - state.dataSurface->SurfWinSlatAngThisTS(m_SurfNum), state.dataSurface->SurfWinMovableSlats(m_SurfNum), blind.IRFrontTrans); - transThermalBack = InterpSlatAng( - state.dataSurface->SurfWinSlatAngThisTS(m_SurfNum), state.dataSurface->SurfWinMovableSlats(m_SurfNum), blind.IRBackTrans); + if (mat->group == Material::Group::Glass || mat->group == Material::Group::GlassSimple) { + auto const *matGlass = dynamic_cast(mat); + assert(matGlass != nullptr); + + emissFront = matGlass->AbsorpThermalFront; + emissBack = matGlass->AbsorpThermalBack; + transThermalFront = matGlass->TransThermal; + transThermalBack = matGlass->TransThermal; + thickness = matGlass->Thickness; + conductivity = matGlass->Conductivity; + + } else if (mat->group == Material::Group::Blind) { + auto const &surfShade = state.dataSurface->surfShades(m_SurfNum); + auto const *matBlind = dynamic_cast(mat); + assert(matBlind != nullptr); + thickness = matBlind->SlatThickness; + conductivity = matBlind->SlatConductivity; + Atop = matBlind->topOpeningMult; + Abot = matBlind->bottomOpeningMult; + Aleft = matBlind->leftOpeningMult; + Aright = matBlind->rightOpeningMult; + + Real64 slatAng = matBlind->SlatAngle * Constant::DegToRad; + Real64 PermA = std::sin(slatAng) - matBlind->SlatThickness / matBlind->SlatSeparation; + Real64 PermB = + 1.0 - (std::abs(matBlind->SlatWidth * std::cos(slatAng)) + matBlind->SlatThickness * std::sin(slatAng)) / matBlind->SlatSeparation; + Afront = min(1.0, max(0.0, PermA, PermB)); + + int iSlatLo, iSlatHi; + Real64 interpFac; + + Material::GetSlatIndicesInterpFac(slatAng, iSlatLo, iSlatHi, interpFac); + + emissFront = Interp(matBlind->TARs[iSlatLo].IR.Ft.Emi, matBlind->TARs[iSlatHi].IR.Ft.Emi, interpFac); + emissBack = Interp(matBlind->TARs[iSlatLo].IR.Bk.Emi, matBlind->TARs[iSlatHi].IR.Bk.Emi, interpFac); + transThermalFront = Interp(matBlind->TARs[iSlatLo].IR.Ft.Tra, matBlind->TARs[iSlatHi].IR.Ft.Tra, interpFac); + transThermalBack = Interp(matBlind->TARs[iSlatLo].IR.Bk.Tra, matBlind->TARs[iSlatHi].IR.Bk.Tra, interpFac); + if (t_Index == 1) { m_ExteriorShade = true; } - } - if (material->group == Material::Group::Shade) { - emissFront = material->AbsorpThermal; - emissBack = material->AbsorpThermal; - transThermalFront = material->TransThermal; - transThermalBack = material->TransThermal; - thickness = material->Thickness; - conductivity = material->Conductivity; - Atop = material->WinShadeTopOpeningMult; - Abot = material->WinShadeBottomOpeningMult; - Aleft = material->WinShadeLeftOpeningMult; - Aright = material->WinShadeRightOpeningMult; - Afront = material->WinShadeAirFlowPermeability; + + } else if (mat->group == Material::Group::Shade) { + auto const *matShade = dynamic_cast(mat); + assert(matShade != nullptr); + + emissFront = matShade->AbsorpThermal; + emissBack = matShade->AbsorpThermal; + transThermalFront = matShade->TransThermal; + transThermalBack = matShade->TransThermal; + thickness = matShade->Thickness; + conductivity = matShade->Conductivity; + + Atop = matShade->topOpeningMult; + Abot = matShade->bottomOpeningMult; + Aleft = matShade->leftOpeningMult; + Aright = matShade->rightOpeningMult; + Afront = matShade->airFlowPermeability; if (t_Index == 1) { m_ExteriorShade = true; } - } - if (material->group == Material::Group::Screen) { + + } else if (mat->group == Material::Group::Screen) { + auto const *matScreen = dynamic_cast(mat); + assert(matScreen != nullptr); + // Simon: Existing code already takes into account geometry of Woven and scales down // emissivity for openning area. - emissFront = material->AbsorpThermal; - emissBack = material->AbsorpThermal; - transThermalFront = material->TransThermal; - transThermalBack = material->TransThermal; - thickness = material->Thickness; - conductivity = material->Conductivity; - Atop = material->WinShadeTopOpeningMult; - Abot = material->WinShadeBottomOpeningMult; - Aleft = material->WinShadeLeftOpeningMult; - Aright = material->WinShadeRightOpeningMult; - Afront = material->WinShadeAirFlowPermeability; + emissFront = matScreen->AbsorpThermal; + emissBack = matScreen->AbsorpThermal; + transThermalFront = matScreen->TransThermal; + transThermalBack = matScreen->TransThermal; + thickness = matScreen->Thickness; + conductivity = matScreen->Conductivity; + + Atop = matScreen->topOpeningMult; + Abot = matScreen->bottomOpeningMult; + Aleft = matScreen->leftOpeningMult; + Aright = matScreen->rightOpeningMult; + Afront = matScreen->airFlowPermeability; if (t_Index == 1) { m_ExteriorShade = true; } - } - if (material->group == Material::Group::ComplexWindowShade) { - int shdPtr = material->ComplexShadePtr; - auto const &shade = state.dataMaterial->ComplexShade(shdPtr); - thickness = shade.Thickness; - conductivity = shade.Conductivity; - emissFront = shade.FrontEmissivity; - emissBack = shade.BackEmissivity; - transThermalFront = shade.IRTransmittance; - transThermalBack = shade.IRTransmittance; - Afront = shade.FrontOpeningMultiplier; - Atop = shade.TopOpeningMultiplier; - Abot = shade.BottomOpeningMultiplier; - Aleft = shade.LeftOpeningMultiplier; - Aright = shade.RightOpeningMultiplier; + } else if (mat->group == Material::Group::ComplexShade) { + auto const *matShade = dynamic_cast(mat); + assert(matShade != nullptr); + + thickness = matShade->Thickness; + conductivity = matShade->Conductivity; + emissFront = matShade->FrontEmissivity; + emissBack = matShade->BackEmissivity; + transThermalFront = matShade->TransThermal; + transThermalBack = matShade->TransThermal; + Afront = matShade->frontOpeningMult; + Atop = matShade->topOpeningMult; + Abot = matShade->bottomOpeningMult; + Aleft = matShade->leftOpeningMult; + Aright = matShade->rightOpeningMult; createOpenness = true; m_InteriorBSDFShade = ((2 * t_Index - 1) == m_TotLay); } @@ -700,22 +703,27 @@ namespace Window { auto aGas = getAir(); // (AUTO_OK_OBJ) Real64 thickness = 0.0; + auto &s_mat = state.dataMaterial; + auto &surfWin = state.dataSurface->SurfaceWindow(m_SurfNum); + auto const &surfShade = state.dataSurface->surfShades(m_SurfNum); + const WinShadingType ShadeFlag = getShadeType(state, m_ConstructionNumber); if (ShadeFlag == WinShadingType::IntBlind || ShadeFlag == WinShadingType::ExtBlind) { - thickness = state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(m_SurfNum)).BlindToGlassDist; - } - if (ShadeFlag == WinShadingType::IntShade || ShadeFlag == WinShadingType::ExtShade || ShadeFlag == WinShadingType::ExtScreen) { - const auto *material = dynamic_cast(getLayerMaterial(state, t_Index)); + thickness = dynamic_cast(s_mat->materials(surfShade.blind.matNum))->toGlassDist; + } else if (ShadeFlag == WinShadingType::ExtScreen) { + thickness = dynamic_cast(s_mat->materials(surfWin.screenNum))->toGlassDist; + } else if (ShadeFlag == WinShadingType::IntShade || ShadeFlag == WinShadingType::ExtShade) { + const auto *material = dynamic_cast(getLayerMaterial(state, t_Index)); assert(material != nullptr); - thickness = material->WinShadeToGlassDist; + thickness = material->toGlassDist; } std::shared_ptr aLayer = std::make_shared(thickness, pres, aGas); return aLayer; } ///////////////////////////////////////////////////////////////////////////////////////// - std::shared_ptr CWCEHeatTransferFactory::getComplexGapLayer(EnergyPlusData &state, + std::shared_ptr CWCEHeatTransferFactory::getComplexGapLayer([[maybe_unused]] EnergyPlusData &state, Material::MaterialBase const *materialBase) const { // SUBROUTINE INFORMATION: @@ -727,12 +735,10 @@ namespace Window { // PURPOSE OF THIS SUBROUTINE: // Creates gap layer object from material properties in EnergyPlus Real64 constexpr pres = 1e5; // Old code uses this constant pressure - auto const *material = dynamic_cast(materialBase); - assert(material != nullptr); - Real64 thickness = material->Thickness; - Real64 gasPointer = material->GasPointer; - auto *gasMaterial = state.dataMaterial->Material(gasPointer); - auto aGas = getGas(gasMaterial); // (AUTO_OK_OBJ) + auto const *mat = dynamic_cast(materialBase); + assert(mat != nullptr); + Real64 thickness = mat->Thickness; + auto aGas = getGas(mat); // (AUTO_OK_OBJ) return std::make_shared(thickness, pres, aGas); } @@ -917,32 +923,38 @@ namespace Window { WinShadingType CWCEHeatTransferFactory::getShadeType(EnergyPlusData &state, int ConstrNum) { + auto &s_mat = state.dataMaterial; WinShadingType ShadeFlag = WinShadingType::NoShade; const int TotLay = state.dataConstruction->Construct(ConstrNum).TotLayers; const int TotGlassLay = state.dataConstruction->Construct(ConstrNum).TotGlassLayers; - const int MatOutside = state.dataConstruction->Construct(ConstrNum).LayerPoint(1); - const int MatInside = state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLay); + const int matOutNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(1); + const int matInNum = state.dataConstruction->Construct(ConstrNum).LayerPoint(TotLay); + + auto const *matOut = s_mat->materials(matOutNum); + auto const *matIn = s_mat->materials(matInNum); - if (state.dataMaterial->Material(MatOutside)->group == Material::Group::Shade) { // Exterior shade present + if (matOut->group == Material::Group::Shade) { // Exterior shade present ShadeFlag = WinShadingType::ExtShade; - } else if (state.dataMaterial->Material(MatOutside)->group == Material::Group::Screen) { // Exterior screen present + } else if (matOut->group == Material::Group::Screen) { // Exterior screen present ShadeFlag = WinShadingType::ExtScreen; - } else if (state.dataMaterial->Material(MatOutside)->group == Material::Group::WindowBlind) { // Exterior blind present + } else if (matOut->group == Material::Group::Blind) { // Exterior blind present ShadeFlag = WinShadingType::ExtBlind; - } else if (state.dataMaterial->Material(MatInside)->group == Material::Group::Shade) { // Interior shade present + } else if (matIn->group == Material::Group::Shade) { // Interior shade present ShadeFlag = WinShadingType::IntShade; - } else if (state.dataMaterial->Material(MatInside)->group == Material::Group::WindowBlind) { // Interior blind present + } else if (matIn->group == Material::Group::Blind) { // Interior blind present ShadeFlag = WinShadingType::IntBlind; } else if (TotGlassLay == 2) { - if (state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3))->group == Material::Group::Shade) + auto const *mat3 = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(3)); + if (mat3->group == Material::Group::Shade) ShadeFlag = WinShadingType::BGShade; - if (state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(3))->group == Material::Group::WindowBlind) + else if (mat3->group == Material::Group::Blind) ShadeFlag = WinShadingType::BGBlind; } else if (TotGlassLay == 3) { - if (state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5))->group == Material::Group::Shade) + auto const *mat5 = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(5)); + if (mat5->group == Material::Group::Shade) ShadeFlag = WinShadingType::BGShade; - if (state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(5))->group == Material::Group::WindowBlind) + else if (mat5->group == Material::Group::Blind) ShadeFlag = WinShadingType::BGBlind; } diff --git a/src/EnergyPlus/WindowModel.cc b/src/EnergyPlus/WindowModel.cc index f9b1241fb3a..48b277f535e 100644 --- a/src/EnergyPlus/WindowModel.cc +++ b/src/EnergyPlus/WindowModel.cc @@ -52,14 +52,16 @@ namespace EnergyPlus { -template <> EnumParser::EnumParser() // LOL -{ - m_Map["BUILTINWINDOWSMODEL"] = Window::WindowsModel::BuiltIn; - m_Map["EXTERNALWINDOWSMODEL"] = Window::WindowsModel::External; -} - namespace Window { + constexpr std::array opticalDataModelNames = { + "SpectralAverage", "Spectral", "BSDF", "SpectralAndAngle"}; + + constexpr std::array opticalDataModelNamesUC = { + "SPECTRALAVERAGE", "SPECTRAL", "BSDF", "SPECTRALANDANGLE"}; + + constexpr std::array windowsModelNamesUC = {"BUILTINWINDOWSMODEL", "EXTERNALWINDOWSMODEL"}; + ///////////////////////////////////////////////////////////////////////////////////////// // CWindowModel ///////////////////////////////////////////////////////////////////////////////////////// @@ -78,20 +80,20 @@ namespace Window { // PURPOSE OF THIS SUBROUTINE: // Reads input and creates instance of WindowModel object - int NumNums; - int NumAlphas; - int IOStat; auto aModel = std::make_unique(); // (AUTO_OK) int numCurrModels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, objectName); if (numCurrModels > 0) { + int NumNums; + int NumAlphas; + int IOStat; state.dataInputProcessing->inputProcessor->getObjectItem( state, objectName, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); // Please consider using getEnumValue pattern here. // Consider that you are creating an entire map for the // sole purpose of looking up a single element - EnumParser aParser; - aModel->m_Model = aParser.StringToEnum(state, state.dataIPShortCut->cAlphaArgs(1)); + + aModel->m_Model = static_cast(getEnumValue(windowsModelNamesUC, state.dataIPShortCut->cAlphaArgs(1))); } return aModel; diff --git a/src/EnergyPlus/WindowModel.hh b/src/EnergyPlus/WindowModel.hh index 72e36fd1fec..d5a8bd8a3a3 100644 --- a/src/EnergyPlus/WindowModel.hh +++ b/src/EnergyPlus/WindowModel.hh @@ -60,24 +60,20 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -template class EnumParser -{ - std::map m_Map; - -public: - EnumParser(){}; +namespace Window { - T StringToEnum(EnergyPlusData &state, const std::string &value) + enum class OpticalDataModel { - auto iValue = m_Map.find(value); - if (iValue == m_Map.end()) { - ShowFatalError(state, "Incorrect enumerator assigned."); - } - return iValue->second; - } -}; + Invalid = -1, + SpectralAverage, + Spectral, + BSDF, + SpectralAndAngle, + Num + }; -namespace Window { + extern const std::array opticalDataModelNames; + extern const std::array opticalDataModelNamesUC; enum class WindowsModel { @@ -87,6 +83,8 @@ namespace Window { Num }; + extern const std::array windowsModelNamesUC; + // Class that reads IDF object and decides if interior or exterior window models // will be used. class CWindowModel diff --git a/src/EnergyPlus/ZoneAirLoopEquipmentManager.cc b/src/EnergyPlus/ZoneAirLoopEquipmentManager.cc index e8eafa14f85..92af6665c4b 100644 --- a/src/EnergyPlus/ZoneAirLoopEquipmentManager.cc +++ b/src/EnergyPlus/ZoneAirLoopEquipmentManager.cc @@ -217,28 +217,25 @@ namespace ZoneAirLoopEquipmentManager { static std::string const CurrentModuleObject("ZoneHVAC:AirDistributionUnit"); // Object type for getting and error messages // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int AirDistUnitNum; - int AirDistCompUnitNum; - int NumAlphas; - int NumNums; - int IOStat; bool ErrorsFound(false); // If errors detected in input - bool IsNotOK; // Flag to verify name Array1D_string AlphArray(5); Array1D NumArray(2); Array1D_string cAlphaFields(5); // Alpha field names Array1D_string cNumericFields(2); // Numeric field names Array1D_bool lAlphaBlanks(5); // Logical array, alpha field input BLANK = .TRUE. Array1D_bool lNumericBlanks(2); // Logical array, numeric field input BLANK = .TRUE. - bool DualDuctRecircIsUsed; // local temporary for deciding if recirc side used by dual duct terminal int NumAirDistUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); state.dataDefineEquipment->AirDistUnit.allocate(NumAirDistUnits); if (NumAirDistUnits > 0) { + int NumAlphas; + int NumNums; + int IOStat; + bool IsNotOK; // Flag to verify name - for (AirDistUnitNum = 1; AirDistUnitNum <= NumAirDistUnits; ++AirDistUnitNum) { + for (int AirDistUnitNum = 1; AirDistUnitNum <= NumAirDistUnits; ++AirDistUnitNum) { auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(AirDistUnitNum); state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -267,7 +264,7 @@ namespace ZoneAirLoopEquipmentManager { ObjectIsParent); airDistUnit.InletNodeNum = 0; airDistUnit.NumComponents = 1; - AirDistCompUnitNum = 1; + int AirDistCompUnitNum = 1; // Load the air Distribution Unit Equip and Name airDistUnit.EquipType(AirDistCompUnitNum) = AlphArray(3); airDistUnit.EquipName(AirDistCompUnitNum) = AlphArray(4); @@ -387,6 +384,7 @@ namespace ZoneAirLoopEquipmentManager { airDistUnit.EquipName(AirDistCompUnitNum), "UNDEFINED", AlphArray(2)); + bool DualDuctRecircIsUsed; // local temporary for deciding if recirc side used by dual duct terminal GetDualDuctOutdoorAirRecircUse( state, airDistUnit.EquipType(AirDistCompUnitNum), airDistUnit.EquipName(AirDistCompUnitNum), DualDuctRecircIsUsed); if (DualDuctRecircIsUsed) { @@ -409,7 +407,7 @@ namespace ZoneAirLoopEquipmentManager { } } // End of Air Dist Do Loop - for (AirDistUnitNum = 1; AirDistUnitNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++AirDistUnitNum) { + for (int AirDistUnitNum = 1; AirDistUnitNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++AirDistUnitNum) { auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(AirDistUnitNum); SetupOutputVariable(state, "Zone Air Terminal Sensible Heating Energy", @@ -557,8 +555,6 @@ namespace ZoneAirLoopEquipmentManager { bool ProvideSysOutput; int AirDistCompNum; - int InNodeNum; // air distribution unit inlet node - int OutNodeNum; // air distribution unit outlet node int AirLoopNum(0); // index of air loop Real64 MassFlowRateMaxAvail; // max avail mass flow rate excluding leaks [kg/s] Real64 MassFlowRateMinAvail; // min avail mass flow rate excluding leaks [kg/s] @@ -574,8 +570,8 @@ namespace ZoneAirLoopEquipmentManager { NonAirSysOutput = 0.0; auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(AirDistUnitNum); - InNodeNum = airDistUnit.InletNodeNum; - OutNodeNum = airDistUnit.OutletNodeNum; + int InNodeNum = airDistUnit.InletNodeNum; + int OutNodeNum = airDistUnit.OutletNodeNum; MassFlowRateMaxAvail = 0.0; MassFlowRateMinAvail = 0.0; // check for no plenum diff --git a/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc b/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc index 32863ffb574..ad19296411e 100644 --- a/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc @@ -1504,7 +1504,6 @@ void InitZoneContSetPoints(EnergyPlusData &state) Real64 Pi; // Pressue at zone i Real64 Pj; // Pressue at zone j Real64 Sch; // Schedule value - bool ErrorsFound(false); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { state.dataContaminantBalance->OutdoorCO2 = @@ -1707,6 +1706,7 @@ void InitZoneContSetPoints(EnergyPlusData &state) } if (allocated(state.dataZoneEquip->ZoneEquipConfig) && state.dataZoneContaminantPredictorCorrector->MyConfigOneTimeFlag) { + bool ErrorsFound = false; for (int ContZoneNum = 1; ContZoneNum <= (int)state.dataContaminantBalance->ContaminantControlledZone.size(); ++ContZoneNum) { int ZoneNum = state.dataContaminantBalance->ContaminantControlledZone(ContZoneNum).ActualZoneNum; for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ZoneNum).NumInletNodes; ++zoneInNode) { @@ -1817,13 +1817,13 @@ void InitZoneContSetPoints(EnergyPlusData &state) // From decay model for (auto &con : state.dataContaminantBalance->ZoneContamGenericDecay) { - int Sch = ScheduleManager::GetCurrentScheduleValue(state, con.GCEmiRateSchedPtr); - if (Sch == 0.0 || state.dataGlobal->BeginEnvrnFlag || state.dataGlobal->WarmupFlag) { + int intSch = ScheduleManager::GetCurrentScheduleValue(state, con.GCEmiRateSchedPtr); + if (intSch == 0.0 || state.dataGlobal->BeginEnvrnFlag || state.dataGlobal->WarmupFlag) { con.GCTime = 0.0; } else { con.GCTime += state.dataGlobal->TimeStepZoneSec; } - GCGain = con.GCInitEmiRate * Sch * std::exp(-con.GCTime / con.GCDelayTime); + GCGain = con.GCInitEmiRate * intSch * std::exp(-con.GCTime / con.GCDelayTime); con.GCGenRate = GCGain; } @@ -2051,7 +2051,6 @@ void PredictZoneContaminants(EnergyPlusData &state, // Calculate the coefficients for the 3rd Order derivative for final // zone CO2. The A, B, C coefficients are analogous to the CO2 balance. // Assume that the system will have flow - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); if (state.afn->multizone_always_simulated || (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation && state.afn->AirflowNetworkFanActivated)) { @@ -2165,7 +2164,6 @@ void PredictZoneContaminants(EnergyPlusData &state, // Calculate the coefficients for the 3rd Order derivative for final // zone GC. The A, B, C coefficients are analogous to the GC balance. // Assume that the system will have flow - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); if (state.afn->multizone_always_simulated || (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation && state.afn->AirflowNetworkFanActivated)) { @@ -2334,12 +2332,12 @@ void RevertZoneTimestepHistories(EnergyPlusData &state) } void InverseModelCO2(EnergyPlusData &state, - int const ZoneNum, // Zone number - Real64 &CO2Gain, // Zone total CO2 gain - Real64 &CO2GainExceptPeople, // ZOne total CO2 gain from sources except for people - Real64 &ZoneMassFlowRate, // Zone air mass flow rate - Real64 &CO2MassFlowRate, // Zone air CO2 mass flow rate - Real64 &RhoAir // Air density + int const ZoneNum, // Zone number + Real64 const CO2Gain, // Zone total CO2 gain + Real64 const CO2GainExceptPeople, // ZOne total CO2 gain from sources except for people + Real64 const ZoneMassFlowRate, // Zone air mass flow rate + Real64 const CO2MassFlowRate, // Zone air CO2 mass flow rate + Real64 const RhoAir // Air density ) { // SUBROUTINE INFORMATION: @@ -2363,7 +2361,7 @@ void InverseModelCO2(EnergyPlusData &state, state.dataEnvrn->DayOfYear <= state.dataHybridModel->HybridModelZone(ZoneNum).HybridEndDayOfYear) { state.dataContaminantBalance->ZoneAirCO2(ZoneNum) = state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredCO2Concentration; - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); if (state.dataHybridModel->HybridModelZone(ZoneNum).InfiltrationCalc_C && state.dataHVACGlobal->UseZoneTimeStepHistory) { static constexpr std::string_view RoutineNameInfiltration("CalcAirFlowSimple:Infiltration"); // Conditionally calculate the CO2-dependent and CO2-independent terms. @@ -2575,7 +2573,7 @@ void CorrectZoneContaminants(EnergyPlusData &state, // Calculate moisture flow rate into each zone for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneNum).NumInletNodes; ++NodeNum) { - auto &node = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).InletNode(NodeNum)); + auto const &node = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).InletNode(NodeNum)); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { CO2MassFlowRate += (node.MassFlowRate * node.CO2) / ZoneMult; } @@ -2588,7 +2586,7 @@ void CorrectZoneContaminants(EnergyPlusData &state, // Do the calculations for the plenum zone } else if (ZoneRetPlenumAirFlag) { for (int NodeNum = 1; NodeNum <= state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).NumInletNodes; ++NodeNum) { - auto &node = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).InletNode(NodeNum)); + auto const &node = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).InletNode(NodeNum)); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { CO2MassFlowRate += (node.MassFlowRate * node.CO2) / ZoneMult; } @@ -2602,7 +2600,7 @@ void CorrectZoneContaminants(EnergyPlusData &state, int ADUNum = state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).ADUIndex(ADUListIndex); if (state.dataDefineEquipment->AirDistUnit(ADUNum).UpStreamLeak) { auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(ADUNum); - auto &node = state.dataLoopNodes->Node(airDistUnit.InletNodeNum); + auto const &node = state.dataLoopNodes->Node(airDistUnit.InletNodeNum); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { CO2MassFlowRate += (airDistUnit.MassFlowRateUpStrLk * node.CO2) / ZoneMult; } @@ -2613,7 +2611,7 @@ void CorrectZoneContaminants(EnergyPlusData &state, } if (state.dataDefineEquipment->AirDistUnit(ADUNum).DownStreamLeak) { auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(ADUNum); - auto &node = state.dataLoopNodes->Node(airDistUnit.OutletNodeNum); + auto const &node = state.dataLoopNodes->Node(airDistUnit.OutletNodeNum); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { CO2MassFlowRate += (airDistUnit.MassFlowRateDnStrLk * node.CO2) / ZoneMult; } @@ -2625,7 +2623,7 @@ void CorrectZoneContaminants(EnergyPlusData &state, } } else if (ZoneSupPlenumAirFlag) { - auto &node = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneSupPlenCond(ZoneSupPlenumNum).InletNode); + auto const &node = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneSupPlenCond(ZoneSupPlenumNum).InletNode); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { CO2MassFlowRate += (node.MassFlowRate * node.CO2) / ZoneMult; } diff --git a/src/EnergyPlus/ZoneContaminantPredictorCorrector.hh b/src/EnergyPlus/ZoneContaminantPredictorCorrector.hh index 0201ede7c4d..230fd43e58f 100644 --- a/src/EnergyPlus/ZoneContaminantPredictorCorrector.hh +++ b/src/EnergyPlus/ZoneContaminantPredictorCorrector.hh @@ -87,12 +87,12 @@ namespace ZoneContaminantPredictorCorrector { void RevertZoneTimestepHistories(EnergyPlusData &state); void InverseModelCO2(EnergyPlusData &state, - int ZoneNum, // Zone number - Real64 &CO2Gain, // Zone total CO2 gain - Real64 &CO2GainExceptPeople, // ZOne total CO2 gain from sources except for people - Real64 &ZoneMassFlowRate, // Zone air mass flow rate - Real64 &CO2MassFlowRate, // Zone air CO2 mass flow rate - Real64 &RhoAir // Air density + int ZoneNum, // Zone number + Real64 CO2Gain, // Zone total CO2 gain + Real64 CO2GainExceptPeople, // ZOne total CO2 gain from sources except for people + Real64 ZoneMassFlowRate, // Zone air mass flow rate + Real64 CO2MassFlowRate, // Zone air CO2 mass flow rate + Real64 RhoAir // Air density ); void CorrectZoneContaminants(EnergyPlusData &state, diff --git a/src/EnergyPlus/ZoneDehumidifier.cc b/src/EnergyPlus/ZoneDehumidifier.cc index 95ec5aa25d2..7328ea976e2 100644 --- a/src/EnergyPlus/ZoneDehumidifier.cc +++ b/src/EnergyPlus/ZoneDehumidifier.cc @@ -749,7 +749,6 @@ namespace ZoneDehumidifier { Real64 AirMassFlowRate; // Air mass flow rate through this dehumidifier (kg/s) Real64 Cp; // Heat capacity of inlet air (J/kg-C) int AirInletNodeNum(0); // Node number for the inlet air to the dehumidifier - int AirOutletNodeNum(0); // Node number for the outlet air from the dehumidifier SensibleOutput = 0.0; LatentOutput = 0.0; @@ -763,7 +762,6 @@ namespace ZoneDehumidifier { ElectricPowerOnCycle = 0.0; AirInletNodeNum = state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).AirInletNodeNum; - AirOutletNodeNum = state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).AirOutletNodeNum; InletAirTemp = state.dataLoopNodes->Node(AirInletNodeNum).Temp; InletAirHumRat = state.dataLoopNodes->Node(AirInletNodeNum).HumRat; @@ -1105,7 +1103,6 @@ namespace ZoneDehumidifier { Real64 RhoWater; // Density of condensate (water) being removed (kg/m3) Real64 InletAirTemp; // Dry-bulb temperature of air entering the dehumidifier (C) Real64 OutletAirTemp; // Dry-bulb temperature of air leaving the dehumidifier (C) - int AirInletNodeNum; // Node number corresponding to the air entering dehumidifier state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).SensHeatingEnergy = state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).SensHeatingRate * TimeStepSysSec; @@ -1121,7 +1118,7 @@ namespace ZoneDehumidifier { // Calculate and report condensation rate (how much water extracted from the air stream) // Volumetric flow of water in m3/s for water system interactions - AirInletNodeNum = state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).AirInletNodeNum; + int AirInletNodeNum = state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).AirInletNodeNum; InletAirTemp = state.dataLoopNodes->Node(AirInletNodeNum).Temp; OutletAirTemp = max((InletAirTemp - 11.0), 1.0); // Assume coil outlet air is 11C (20F) lower than inlet air temp RhoWater = RhoH2O(OutletAirTemp); // Density of water, minimum temp = 1.0 C diff --git a/src/EnergyPlus/ZoneEquipmentManager.cc b/src/EnergyPlus/ZoneEquipmentManager.cc index d321e8965c4..c886910a15c 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.cc +++ b/src/EnergyPlus/ZoneEquipmentManager.cc @@ -305,7 +305,7 @@ void sizeZoneSpaceEquipmentPart1(EnergyPlusData &state, DataSizing::ZoneSizingData &zsCalcSizing, DataZoneEnergyDemands::ZoneSystemSensibleDemand &zsEnergyDemand, DataZoneEnergyDemands::ZoneSystemMoistureDemand &zsMoistureDemand, - DataHeatBalance::ZoneData &zoneOrSpace, + DataHeatBalance::ZoneData const &zoneOrSpace, int zoneNum, int spaceNum) { @@ -315,8 +315,6 @@ void sizeZoneSpaceEquipmentPart1(EnergyPlusData &state, : state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).NonAirSystemResponse; auto &sysDepZoneLoads = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).SysDepZoneLoads : state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).SysDepZoneLoads; - auto &zoneLatentGain = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain - : state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).latentGain; auto &zoneNodeNum = (spaceNum > 0) ? state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber : state.dataHeatBal->Zone(zoneNum).SystemZoneNodeNumber; nonAirSystemResponse = 0.0; @@ -557,17 +555,23 @@ void sizeZoneSpaceEquipmentPart1(EnergyPlusData &state, supplyAirNode.MassFlowRate = MassFlowRate; } else { nonAirSystemResponse = SysOutputProvided; - if (state.dataHeatBal->doSpaceHeatBalance) { - for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { + if (zsCalcSizing.zoneLatentSizing) { + int zoneMult = zoneOrSpace.Multiplier * zoneOrSpace.ListMultiplier; + auto &zoneLatentGain = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain + : state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).latentGain; + zoneLatentGain += (LatOutputProvided * HgAir) / zoneMult; + } + if (state.dataHeatBal->doSpaceHeatBalance && spaceNum == 0) { + for (int spaceNum2 : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { // SpaceHB ToDo: For now allocate by space volume frac - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).NonAirSystemResponse = - nonAirSystemResponse * state.dataHeatBal->space(spaceNum).fracZoneVolume; + auto &spHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum2); + spHB.NonAirSystemResponse = nonAirSystemResponse * state.dataHeatBal->space(spaceNum2).fracZoneVolume; + if (zsCalcSizing.zoneLatentSizing) { + int zoneMult = zoneOrSpace.Multiplier * zoneOrSpace.ListMultiplier; + spHB.latentGain += (LatOutputProvided * HgAir) * state.dataHeatBal->space(spaceNum2).fracZoneVolume / zoneMult; + } } } - if (zsCalcSizing.zoneLatentSizing) { - int ZoneMult = zoneOrSpace.Multiplier * zoneOrSpace.ListMultiplier; - zoneLatentGain += (LatOutputProvided * HgAir) / ZoneMult; - } } updateSystemOutputRequired(state, zoneNum, SysOutputProvided, LatOutputProvided, zsEnergyDemand, zsMoistureDemand); @@ -584,7 +588,7 @@ void sizeZoneSpaceEquipmentPart2(EnergyPlusData &state, int zoneNodeNum = (spaceNum > 0) ? state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber : state.dataHeatBal->Zone(zoneNum).SystemZoneNodeNumber; Real64 RetTemp = (returnNodeNum > 0) ? state.dataLoopNodes->Node(returnNodeNum).Temp : state.dataLoopNodes->Node(zoneNodeNum).Temp; - auto &zoneTstatSP = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(zoneNum); + auto const &zoneTstatSP = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(zoneNum); if (zsCalcSizing.HeatLoad > 0.0) { zsCalcSizing.HeatZoneRetTemp = RetTemp; zsCalcSizing.HeatTstatTemp = (zoneTstatSP > 0.0) ? zoneTstatSP : state.dataHeatBalFanSys->ZoneThermostatSetPointLo(zoneNum); @@ -992,7 +996,7 @@ void SetUpZoneSizingArrays(EnergyPlusData &state) // from the specified OA method for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue; - auto &thisZone = state.dataHeatBal->Zone(CtrlZoneNum); + auto const &thisZone = state.dataHeatBal->Zone(CtrlZoneNum); auto &finalZoneSizing = state.dataSize->FinalZoneSizing(CtrlZoneNum); auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum); // Use the max occupancy PEOPLE structure to calculate design min OA for each zone from the outside air flow per person input @@ -1004,7 +1008,6 @@ void SetUpZoneSizingArrays(EnergyPlusData &state) // If this is a DesignSpecification:OutdoorAir:SpaceList check to make sure spaces are valid and belong to this zone if (thisOAReq.numDSOA > 0) { for (int spaceCounter = 1; spaceCounter <= thisOAReq.numDSOA; ++spaceCounter) { - std::string thisSpaceName = thisOAReq.dsoaSpaceNames(spaceCounter); int thisSpaceNum = thisOAReq.dsoaSpaceIndexes(spaceCounter); if (thisSpaceNum > 0) { if (state.dataHeatBal->space(thisSpaceNum).zoneNum != CtrlZoneNum) { @@ -1050,13 +1053,13 @@ void SetUpZoneSizingArrays(EnergyPlusData &state) // Calculate the design min OA flow rate for this zone // flag to use occupancy schedule when calculating OA - bool UseOccSchFlag = false; // flag to use min OA schedule when calculating OA - bool UseMinOASchFlag = false; state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneDesignSpecOAIndex = DSOAPtr; // store for later use state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneAirDistributionIndex = finalZoneSizing.ZoneAirDistributionIndex; // store for later use Real64 OAVolumeFlowRate = 0.0; if (!dsoaError) { + bool UseOccSchFlag = false; + bool UseMinOASchFlag = false; OAVolumeFlowRate = DataSizing::calcDesignSpecificationOutdoorAir(state, DSOAPtr, CtrlZoneNum, UseOccSchFlag, UseMinOASchFlag); } @@ -1348,7 +1351,7 @@ void RezeroZoneSizingArrays(EnergyPlusData &state) } } } -void updateZoneSizingBeginDay(EnergyPlusData &state, DataSizing::ZoneSizingData &zsCalcSizing) +void updateZoneSizingBeginDay(EnergyPlusData const &state, DataSizing::ZoneSizingData &zsCalcSizing) { zsCalcSizing.CoolDesDay = state.dataEnvrn->EnvironmentName; zsCalcSizing.HeatDesDay = state.dataEnvrn->EnvironmentName; @@ -1758,7 +1761,7 @@ void updateZoneSizingEndDay(DataSizing::ZoneSizingData &zsCalcSizing, // save heat peak conditions when there is no design heating load or design heating volume flow rate, i.e., when // zone temperature is always greater than the zone heating thermostat temperature if (zsCalcFinalSizing.DesHeatLoad == 0) { - bool FirstIteration = true; + bool FirstIteration = true; // declare as static to save for next iteration? but needs to be space/zone specific? for (int TimeStepIndex = 1; TimeStepIndex <= numTimeStepInDay; ++TimeStepIndex) { if ((zsCalcSizing.HeatZoneTempSeq(TimeStepIndex) < zsCalcSizing.ZoneTempAtHeatPeak) || FirstIteration) { zsCalcSizing.ZoneTempAtHeatPeak = zsCalcSizing.HeatZoneTempSeq(TimeStepIndex); @@ -1953,7 +1956,7 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum // Other - Initialize to first space values (clear later if not all the same) int firstSpace = state.dataHeatBal->Zone(zoneNum).spaceIndexes[0]; - auto &firstSpaceCFS = state.dataSize->CalcFinalSpaceSizing(firstSpace); + auto const &firstSpaceCFS = state.dataSize->CalcFinalSpaceSizing(firstSpace); zoneCFS.HeatDesDay = firstSpaceCFS.HeatDesDay; zoneCFS.HeatDDNum = firstSpaceCFS.HeatDDNum; zoneCFS.cHeatDDDate = firstSpaceCFS.cHeatDDDate; @@ -1986,10 +1989,6 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum } int numSpaces = 0; // Track this for averages later - bool heatDDNumAllSame = true; - bool coolDDNumAllSame = true; - int priorHeatDDNum = 0; - int priorCoolDDNum = 0; for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto &spaceCFS = state.dataSize->CalcFinalSpaceSizing(spaceNum); ++numSpaces; @@ -2046,22 +2045,22 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum // Other if ((zoneCFS.HeatDDNum != 0) && (zoneCFS.HeatDDNum != spaceCFS.HeatDDNum)) { - zoneCFS.HeatDesDay = "n/a"; + zoneCFS.HeatDesDay = "N/A"; zoneCFS.HeatDDNum = 0; zoneCFS.cHeatDDDate = ""; } if ((zoneCFS.HeatNoDOASDDNum != 0) && (zoneCFS.HeatNoDOASDDNum != spaceCFS.HeatNoDOASDDNum)) { zoneCFS.HeatNoDOASDDNum = 0; - zoneCFS.HeatNoDOASDesDay = "n/a"; + zoneCFS.HeatNoDOASDesDay = "N/A"; } if ((zoneCFS.CoolDDNum != 0) && (zoneCFS.CoolDDNum != spaceCFS.CoolDDNum)) { - zoneCFS.CoolDesDay = "n/a"; + zoneCFS.CoolDesDay = "N/A"; zoneCFS.CoolDDNum = 0; zoneCFS.cCoolDDDate = ""; } if ((zoneCFS.CoolNoDOASDDNum != 0) && (zoneCFS.CoolNoDOASDDNum != spaceCFS.CoolNoDOASDDNum)) { zoneCFS.CoolNoDOASDDNum = 0; - zoneCFS.CoolNoDOASDesDay = "n/a"; + zoneCFS.CoolNoDOASDesDay = "N/A"; } if (zoneCFS.zoneLatentSizing) { @@ -2089,22 +2088,22 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum // Other if ((zoneCFS.LatentHeatDDNum != 0) && (zoneCFS.LatentHeatDDNum != spaceCFS.LatentHeatDDNum)) { - zoneCFS.LatHeatDesDay = "n/a"; + zoneCFS.LatHeatDesDay = "N/A"; zoneCFS.cLatentHeatDDDate = ""; zoneCFS.LatentHeatDDNum = 0; } if ((zoneCFS.LatentHeatNoDOASDDNum != 0) && (zoneCFS.LatentHeatNoDOASDDNum != spaceCFS.LatentHeatNoDOASDDNum)) { zoneCFS.LatentHeatNoDOASDDNum = 0; - zoneCFS.LatHeatNoDOASDesDay = "n/a"; + zoneCFS.LatHeatNoDOASDesDay = "N/A"; } if ((zoneCFS.LatentCoolDDNum != 0) && (zoneCFS.LatentCoolDDNum != spaceCFS.LatentCoolDDNum)) { - zoneCFS.LatCoolDesDay = "n/a"; + zoneCFS.LatCoolDesDay = "N/A"; zoneCFS.cLatentCoolDDDate = ""; zoneCFS.LatentCoolDDNum = 0; } if ((zoneCFS.LatentCoolNoDOASDDNum != 0) && (zoneCFS.LatentCoolNoDOASDDNum != spaceCFS.LatentCoolNoDOASDDNum)) { zoneCFS.LatentCoolNoDOASDDNum = 0; - zoneCFS.LatCoolNoDOASDesDay = "n/a"; + zoneCFS.LatCoolNoDOASDesDay = "N/A"; } // Time-series sums @@ -2140,15 +2139,6 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum zoneCFS.DesCoolCoilInTemp /= zoneCFS.DesCoolMassFlow; zoneCFS.DesCoolCoilInHumRat /= zoneCFS.DesCoolMassFlow; } - // Timestep at max - zoneCFS.TimeStepNumAtHeatMax = 0; - zoneCFS.TimeStepNumAtHeatNoDOASMax = 0; - zoneCFS.TimeStepNumAtCoolMax = 0; - zoneCFS.TimeStepNumAtHeatNoDOASMax = 0; - Real64 maxHeatLoad = 0.0; - Real64 maxHeatLoadNoDOAS = 0.0; - Real64 maxCoolLoad = 0.0; - Real64 maxCoolLoadNoDOAS = 0.0; for (int ts = 1; ts <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++ts) { Real64 tsHeatFlow = zoneCFS.HeatFlowSeq(ts); if (tsHeatFlow > 0) { @@ -2158,8 +2148,6 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum zoneCFS.HeatZoneHumRatSeq(ts) /= tsHeatFlow; zoneCFS.HeatOutHumRatSeq(ts) /= tsHeatFlow; } - if (zoneCFS.HeatLoadSeq(ts) > maxHeatLoad) zoneCFS.TimeStepNumAtHeatMax = ts; - if (zoneCFS.HeatLoadNoDOASSeq(ts) > maxHeatLoadNoDOAS) zoneCFS.TimeStepNumAtHeatNoDOASMax = ts; Real64 tsCoolFlow = zoneCFS.CoolFlowSeq(ts); if (tsCoolFlow > 0) { @@ -2169,9 +2157,16 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum zoneCFS.CoolZoneHumRatSeq(ts) /= tsCoolFlow; zoneCFS.CoolOutHumRatSeq(ts) /= tsCoolFlow; } - if (zoneCFS.CoolLoadSeq(ts) > maxCoolLoad) zoneCFS.TimeStepNumAtCoolMax = ts; - if (zoneCFS.CoolLoadNoDOASSeq(ts) > maxCoolLoadNoDOAS) zoneCFS.TimeStepNumAtCoolNoDOASMax = ts; } + // Timestep at max + zoneCFS.TimeStepNumAtHeatMax = + 1 + std::distance(zoneCFS.HeatLoadSeq.begin(), std::max_element(zoneCFS.HeatLoadSeq.begin(), zoneCFS.HeatLoadSeq.end())); + zoneCFS.TimeStepNumAtHeatNoDOASMax = + 1 + std::distance(zoneCFS.HeatLoadNoDOASSeq.begin(), std::max_element(zoneCFS.HeatLoadNoDOASSeq.begin(), zoneCFS.HeatLoadNoDOASSeq.end())); + zoneCFS.TimeStepNumAtCoolMax = + 1 + std::distance(zoneCFS.CoolLoadSeq.begin(), std::max_element(zoneCFS.CoolLoadSeq.begin(), zoneCFS.CoolLoadSeq.end())); + zoneCFS.TimeStepNumAtCoolNoDOASMax = + 1 + std::distance(zoneCFS.CoolLoadNoDOASSeq.begin(), std::max_element(zoneCFS.CoolLoadNoDOASSeq.begin(), zoneCFS.CoolLoadNoDOASSeq.end())); if (zoneCFS.zoneLatentSizing) { if (zoneCFS.DesLatentHeatMassFlow > 0) { @@ -2189,20 +2184,16 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, int const zoneNum zoneCFS.DesLatentCoolCoilInHumRat /= zoneCFS.DesLatentCoolMassFlow; } // Timestep at max - zoneCFS.TimeStepNumAtLatentHeatMax = 0; - zoneCFS.TimeStepNumAtLatentHeatNoDOASMax = 0; - zoneCFS.TimeStepNumAtLatentCoolMax = 0; - zoneCFS.TimeStepNumAtLatentCoolNoDOASMax = 0; - Real64 maxLatHeatLoad = 0.0; - Real64 maxLatHeatLoadNoDOAS = 0.0; - Real64 maxLatCoolLoad = 0.0; - Real64 maxLatCoolLoadNoDOAS = 0.0; - for (int ts = 1; ts <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++ts) { - if (zoneCFS.LatentHeatFlowSeq(ts) > maxLatHeatLoad) zoneCFS.TimeStepNumAtLatentHeatMax = ts; - if (zoneCFS.HeatLatentLoadNoDOASSeq(ts) > maxLatHeatLoadNoDOAS) zoneCFS.TimeStepNumAtLatentHeatNoDOASMax = ts; - if (zoneCFS.LatentCoolLoadSeq(ts) > maxLatCoolLoad) zoneCFS.TimeStepNumAtLatentCoolMax = ts; - if (zoneCFS.CoolLatentLoadNoDOASSeq(ts) > maxLatCoolLoadNoDOAS) zoneCFS.TimeStepNumAtLatentCoolNoDOASMax = ts; - } + zoneCFS.TimeStepNumAtLatentHeatMax = 1 + std::distance(zoneCFS.LatentHeatFlowSeq.begin(), + std::max_element(zoneCFS.LatentHeatFlowSeq.begin(), zoneCFS.LatentHeatFlowSeq.end())); + zoneCFS.TimeStepNumAtLatentHeatNoDOASMax = + 1 + std::distance(zoneCFS.HeatLatentLoadNoDOASSeq.begin(), + std::max_element(zoneCFS.HeatLatentLoadNoDOASSeq.begin(), zoneCFS.HeatLatentLoadNoDOASSeq.end())); + zoneCFS.TimeStepNumAtLatentCoolMax = 1 + std::distance(zoneCFS.LatentCoolLoadSeq.begin(), + std::max_element(zoneCFS.LatentCoolLoadSeq.begin(), zoneCFS.LatentCoolLoadSeq.end())); + zoneCFS.TimeStepNumAtLatentCoolNoDOASMax = + 1 + std::distance(zoneCFS.CoolLatentLoadNoDOASSeq.begin(), + std::max_element(zoneCFS.CoolLatentLoadNoDOASSeq.begin(), zoneCFS.CoolLatentLoadNoDOASSeq.end())); } return; @@ -2313,7 +2304,7 @@ void updateZoneSizingEndZoneSizingCalc2(EnergyPlusData &state, DataSizing::ZoneS zsCalcSizing.LatCoolPeakDateHrMin = zsCalcSizing.cLatentCoolDDDate + ' ' + sizingPeakTimeStamp(state, zsCalcSizing.TimeStepNumAtLatentCoolMax); } -std::string sizingPeakTimeStamp(EnergyPlusData &state, int timeStepIndex) +std::string sizingPeakTimeStamp(EnergyPlusData const &state, int timeStepIndex) { int constexpr minToSec = 60; int hour = 0; @@ -2328,7 +2319,7 @@ std::string sizingPeakTimeStamp(EnergyPlusData &state, int timeStepIndex) void writeZszSpsz(EnergyPlusData &state, EnergyPlus::InputOutputFile &outputFile, int const numSpacesOrZones, - Array1D const zsEquipConfig, + Array1D const &zsEquipConfig, EPVector const &zsCalcFinalSizing, Array2D const &zsCalcSizing) { @@ -3321,8 +3312,8 @@ void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator const CallI for (std::size_t i = 0; i < state.dataSize->ZoneSizing.size(); ++i) { updateZoneSizingEndZoneSizingCalc4(state.dataSize->ZoneSizing[i], state.dataSize->CalcZoneSizing[i]); if (state.dataHeatBal->doSpaceHeatBalanceSizing) { - for (std::size_t i = 0; i < state.dataSize->SpaceSizing.size(); ++i) { - updateZoneSizingEndZoneSizingCalc4(state.dataSize->SpaceSizing[i], state.dataSize->CalcSpaceSizing[i]); + for (std::size_t j = 0; j < state.dataSize->SpaceSizing.size(); ++j) { + updateZoneSizingEndZoneSizingCalc4(state.dataSize->SpaceSizing[j], state.dataSize->CalcSpaceSizing[j]); } } } @@ -3330,8 +3321,8 @@ void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator const CallI for (std::size_t i = 0; i < state.dataSize->FinalZoneSizing.size(); ++i) { updateZoneSizingEndZoneSizingCalc5(state.dataSize->FinalZoneSizing[i], state.dataSize->CalcFinalZoneSizing[i]); if (state.dataHeatBal->doSpaceHeatBalanceSizing) { - for (std::size_t i = 0; i < state.dataSize->FinalSpaceSizing.size(); ++i) { - updateZoneSizingEndZoneSizingCalc5(state.dataSize->FinalSpaceSizing[i], state.dataSize->CalcFinalSpaceSizing[i]); + for (std::size_t j = 0; j < state.dataSize->FinalSpaceSizing.size(); ++j) { + updateZoneSizingEndZoneSizingCalc5(state.dataSize->FinalSpaceSizing[j], state.dataSize->CalcFinalSpaceSizing[j]); } } } @@ -3795,9 +3786,9 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool // via SumLatentHTRadSys... so setting LatOutputProvided = 0.0 } break; - case ZoneEquipType::LowTemperatureRadiant: { // 'ZoneHVAC:LowTemperatureRadiant:VariableFlow', - // 'ZoneHVAC:LowTemperatureRadiant:ConstantFlow' - // 'ZoneHVAC:LowTemperatureRadiant:Electric' + case ZoneEquipType::LowTemperatureRadiantConstFlow: + case ZoneEquipType::LowTemperatureRadiantVarFlow: + case ZoneEquipType::LowTemperatureRadiantElectric: { LowTempRadiantSystem::SimLowTempRadiantSystem(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, FirstHVACIteration, @@ -3844,7 +3835,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquipType::HeatPumpWaterHeater: { // 'WaterHeater:HeatPump:PumpedCondenser' + case ZoneEquipType::HeatPumpWaterHeaterPumpedCondenser: + case ZoneEquipType::HeatPumpWaterHeaterWrappedCondenser: { WaterThermalTanks::SimHeatPumpWaterHeater(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, FirstHVACIteration, @@ -4045,9 +4037,6 @@ void SetZoneEquipSimOrder(EnergyPlusData &state, int const ControlledZoneNum) // required conditions (heating or cooling). // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int CurEqHeatingPriority; // Used to make sure "optimization features" on compilers don't defeat purpose of this routine - int CurEqCoolingPriority; // Used to make sure "optimization features" on compilers don't defeat purpose of this routine - auto &zeq(state.dataZoneEquip->ZoneEquipList(ControlledZoneNum)); int const NumOfEquipTypes(zeq.NumOfEquipTypes); for (int EquipTypeNum = 1; EquipTypeNum <= NumOfEquipTypes; ++EquipTypeNum) { @@ -4072,8 +4061,8 @@ void SetZoneEquipSimOrder(EnergyPlusData &state, int const ControlledZoneNum) for (int EquipTypeNum = 1; EquipTypeNum <= NumOfEquipTypes; ++EquipTypeNum) { auto &pso(state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum)); - CurEqHeatingPriority = pso.HeatingPriority; - CurEqCoolingPriority = pso.CoolingPriority; + int CurEqHeatingPriority = pso.HeatingPriority; + int CurEqCoolingPriority = pso.CoolingPriority; for (int ComparedEquipTypeNum = EquipTypeNum; ComparedEquipTypeNum <= NumOfEquipTypes; ++ComparedEquipTypeNum) { auto &psc(state.dataZoneEquipmentManager->PrioritySimOrder(ComparedEquipTypeNum)); @@ -4269,8 +4258,8 @@ void distributeOutputRequired(EnergyPlusData &state, const int &equipNum = state.dataZoneEquipmentManager->PrioritySimOrder(priorityNum).EquipPtr; // Determine whether we're heating or cooling and choose the appropriate fraction - const Real64 heatLoadRatio = thisZEqList.SequentialHeatingFraction(state, equipNum); - const Real64 coolLoadRatio = thisZEqList.SequentialCoolingFraction(state, equipNum); + heatLoadRatio = thisZEqList.SequentialHeatingFraction(state, equipNum); + coolLoadRatio = thisZEqList.SequentialCoolingFraction(state, equipNum); const Real64 loadRatio = (energy.TotalOutputRequired >= 0.0) ? heatLoadRatio : coolLoadRatio; // Energy loads @@ -5007,7 +4996,7 @@ void CalcZoneMassBalance(EnergyPlusData &state, bool const FirstHVACIteration) for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { auto &thisZoneEquip(state.dataZoneEquip->ZoneEquipConfig(zoneNum)); - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); if (!thisZoneEquip.IsControlled) continue; int numRetNodes = thisZoneEquip.NumReturnNodes; Real64 totalZoneReturnMassFlow = 0.0; @@ -5095,8 +5084,8 @@ void CalcZoneMassBalance(EnergyPlusData &state, bool const FirstHVACIteration) } void CalcZoneInfiltrationFlows(EnergyPlusData &state, - int const ZoneNum, // current zone index - Real64 &ZoneReturnAirMassFlowRate // zone total zone return air mass flow rate + int const ZoneNum, // current zone index + Real64 const &ZoneReturnAirMassFlowRate // zone total zone return air mass flow rate ) { Real64 constexpr ConvergenceTolerance(0.000010); @@ -5233,7 +5222,7 @@ void CalcZoneLeavingConditions(EnergyPlusData &state, bool const FirstHVACIterat if (state.dataHeatBal->Zone(ZoneNum).HasAirFlowWindowReturn) { for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0 && state.dataSurface->SurfWinAirflowDestination(SurfNum) == DataSurfaces::WindowAirFlowDestination::Return) { @@ -5814,14 +5803,20 @@ void CalcAirFlowSimple(EnergyPlusData &state, Real64 HumRatZN = 0.0; // HumRat of this Zone/Space Real64 HumRatZM = 0.0; // HumRat of From Zone/Space if (state.dataHeatBal->doSpaceHeatBalance) { - auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.spaceIndex); - auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.fromSpaceIndex); + auto const &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.spaceIndex); TZN = thisSpaceHB.MixingMAT; // Temperature of this Space - TZM = fromSpaceHB.MixingMAT; // Temperature of From Space HumRatZN = thisSpaceHB.MixingHumRat; // HumRat of this Space - HumRatZM = fromSpaceHB.MixingHumRat; // HumRat of From Space + if (thisMixing.fromSpaceIndex == 0) { + auto const &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum); + TZM = fromZoneHB.MixingMAT; // Temperature of From Zone + HumRatZM = fromZoneHB.MixingHumRat; // HumRat of From Zone + } else { + auto const &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.fromSpaceIndex); + TZM = fromSpaceHB.MixingMAT; // Temperature of From Space + HumRatZM = fromSpaceHB.MixingHumRat; // HumRat of From Space + } } else { - auto &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum); + auto const &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum); TZN = thisZoneHB.MixingMAT; // Temperature of this zone TZM = fromZoneHB.MixingMAT; // Temperature of From Zone HumRatZN = thisZoneHB.MixingHumRat; // HumRat of this zone @@ -5838,9 +5833,8 @@ void CalcAirFlowSimple(EnergyPlusData &state, bool MixingLimitFlag = false; // Hybrid ventilation global control - int I = 0; if (thisMixing.HybridControlType == DataHeatBalance::HybridCtrlType::Global && thisMixing.HybridControlMasterNum > 0) { - I = thisMixing.HybridControlMasterNum; + int I = thisMixing.HybridControlMasterNum; if (!state.dataHeatBal->Ventilation(I).HybridControlMasterStatus) continue; } else { // Ensure the minimum indoor temperature <= the maximum indoor temperature @@ -6067,12 +6061,17 @@ void CalcAirFlowSimple(EnergyPlusData &state, Real64 HumRatZN = 0.0; // HumRat of this Zone/Space Real64 HumRatZM = 0.0; // HumRat of From Zone/Space if (state.dataHeatBal->doSpaceHeatBalance) { - auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.spaceIndex); - auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.fromSpaceIndex); + auto const &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.spaceIndex); TZN = thisSpaceHB.MixingMAT; // Temperature of this Space - TZM = fromSpaceHB.MixingMAT; // Temperature of From Space HumRatZN = thisSpaceHB.MixingHumRat; // HumRat of this Space - HumRatZM = fromSpaceHB.MixingHumRat; // HumRat of From Space + if (thisCrossMixing.fromSpaceIndex == 0) { + TZM = fromZoneHB.MixingMAT; // Temperature of From Zone + HumRatZM = fromZoneHB.MixingHumRat; // HumRat of From Zone + } else { + auto const &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.fromSpaceIndex); + TZM = fromSpaceHB.MixingMAT; // Temperature of From Space + HumRatZM = fromSpaceHB.MixingHumRat; // HumRat of From Space + } } else { TZN = thisZoneHB.MixingMAT; // Temperature of this zone TZM = fromZoneHB.MixingMAT; // Temperature of From Zone @@ -6183,7 +6182,7 @@ void CalcAirFlowSimple(EnergyPlusData &state, thisCrossMixing.ReportFlag = true; } - if ((TD <= 0.0) || ((TD > 0.0) && (TZM - TZN >= TD))) { + if ((TD <= 0.0) || (TZM - TZN >= TD)) { // SET COEFFICIENTS . Real64 Tavg = (TZN + TZM) / 2.0; Real64 Wavg = (HumRatZN + HumRatZM) / 2.0; @@ -6225,15 +6224,27 @@ void CalcAirFlowSimple(EnergyPlusData &state, fromZoneHB.MixingMassFlowXHumRat += fromXMixingMassFlowXHumRat; if (state.dataHeatBal->doSpaceHeatBalance) { auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.spaceIndex); - auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.fromSpaceIndex); thisSpaceHB.MCPM += thisMCPxM; thisSpaceHB.MCPTM += thisMCPTxM; thisSpaceHB.MixingMassFlowZone += thisXMixingMassFlow; thisSpaceHB.MixingMassFlowXHumRat += thisXMixingMassFlowXHumRat; - fromSpaceHB.MCPM += fromMCPxM; - fromSpaceHB.MCPTM += fromMCPTxM; - fromSpaceHB.MixingMassFlowZone += thisXMixingMassFlow; - fromSpaceHB.MixingMassFlowXHumRat += fromXMixingMassFlowXHumRat; + if (thisCrossMixing.fromSpaceIndex > 0) { + auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.fromSpaceIndex); + fromSpaceHB.MCPM += fromMCPxM; + fromSpaceHB.MCPTM += fromMCPTxM; + fromSpaceHB.MixingMassFlowZone += thisXMixingMassFlow; + fromSpaceHB.MixingMassFlowXHumRat += fromXMixingMassFlowXHumRat; + } else { + // Allocate mixing flows by space volume fraction of zone volume + for (int spaceNum : state.dataHeatBal->Zone(fromZoneNum).spaceIndexes) { + Real64 spaceFrac = state.dataHeatBal->space(spaceNum).fracZoneVolume; + auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum); + fromSpaceHB.MCPM += fromMCPxM * spaceFrac; + fromSpaceHB.MCPTM += fromMCPTxM * spaceFrac; + fromSpaceHB.MixingMassFlowZone += thisXMixingMassFlow * spaceFrac; + fromSpaceHB.MixingMassFlowXHumRat += fromXMixingMassFlowXHumRat * spaceFrac; + } + } } } @@ -6248,7 +6259,7 @@ void CalcAirFlowSimple(EnergyPlusData &state, Real64 TZoneA = zoneAHB.MixingMAT; Real64 HumRatZoneA = zoneAHB.MixingHumRat; if ((state.dataHeatBal->doSpaceHeatBalance) && (thisRefDoorMixing.spaceIndex > 0)) { - auto &spaceAHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisRefDoorMixing.spaceIndex); + auto const &spaceAHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisRefDoorMixing.spaceIndex); TZoneA = spaceAHB.MixingMAT; HumRatZoneA = spaceAHB.MixingHumRat; } @@ -6261,7 +6272,7 @@ void CalcAirFlowSimple(EnergyPlusData &state, Real64 HumRatZoneB = zoneBHB.MixingHumRat; Real64 CpAirZoneB = PsyCpAirFnW(HumRatZoneB); if ((state.dataHeatBal->doSpaceHeatBalance) && (thisRefDoorMixing.fromSpaceIndex > 0)) { - auto &spaceBHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisRefDoorMixing.fromSpaceIndex); + auto const &spaceBHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisRefDoorMixing.fromSpaceIndex); TZoneB = spaceBHB.MixingMAT; HumRatZoneB = spaceBHB.MixingHumRat; } diff --git a/src/EnergyPlus/ZoneEquipmentManager.hh b/src/EnergyPlus/ZoneEquipmentManager.hh index b1114a23688..85ef5c9400b 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.hh +++ b/src/EnergyPlus/ZoneEquipmentManager.hh @@ -94,7 +94,7 @@ namespace ZoneEquipmentManager { DataSizing::ZoneSizingData &zsCalcSizing, DataZoneEnergyDemands::ZoneSystemSensibleDemand &zsEnergyDemand, DataZoneEnergyDemands::ZoneSystemMoistureDemand &zsMoistureDemand, - DataHeatBalance::ZoneData &zoneOrSpace, + DataHeatBalance::ZoneData const &zoneOrSpace, int zoneNum, int spaceNum = 0); @@ -121,7 +121,7 @@ namespace ZoneEquipmentManager { void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator CallIndicator); - void updateZoneSizingBeginDay(EnergyPlusData &state, DataSizing::ZoneSizingData &zsCalcSizing); + void updateZoneSizingBeginDay(EnergyPlusData const &state, DataSizing::ZoneSizingData &zsCalcSizing); void updateZoneSizingDuringDay(DataSizing::ZoneSizingData &zsSizing, DataSizing::ZoneSizingData &zsCalcSizing, @@ -147,11 +147,11 @@ namespace ZoneEquipmentManager { void writeZszSpsz(EnergyPlusData &state, EnergyPlus::InputOutputFile &outputFile, int const numSpacesOrZones, - Array1D const zsEquipConfig, + Array1D const &zsEquipConfig, EPVector const &zsCalcFinalSizing, Array2D const &zsCalcSizing); - std::string sizingPeakTimeStamp(EnergyPlusData &state, int timeStepIndex); + std::string sizingPeakTimeStamp(EnergyPlusData const &state, int timeStepIndex); void updateZoneSizingEndZoneSizingCalc3(DataSizing::ZoneSizingData &zsCalcFinalSizing, Array2D &zsCalcSizing, @@ -213,8 +213,8 @@ namespace ZoneEquipmentManager { void CalcZoneMassBalance(EnergyPlusData &state, bool FirstHVACIteration); void CalcZoneInfiltrationFlows(EnergyPlusData &state, - int ZoneNum, // current zone index - Real64 &ZoneReturnAirMassFlowRate // zone total zone return air mass flow rate + int const ZoneNum, // current zone index + Real64 const &ZoneReturnAirMassFlowRate // zone total zone return air mass flow rate ); void CalcAirFlowSimple(EnergyPlusData &state, diff --git a/src/EnergyPlus/ZonePlenum.cc b/src/EnergyPlus/ZonePlenum.cc index 6c70d8f579b..fc7983c044c 100644 --- a/src/EnergyPlus/ZonePlenum.cc +++ b/src/EnergyPlus/ZonePlenum.cc @@ -658,16 +658,8 @@ void InitAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int InletNode; - int InducedNode(0); - int InletNodeLoop; int ZoneNodeNum; int NodeNum; - int ZonePlenumLoop; - int PlenumZoneNum; - int ZoneEquipConfigLoop; // Loop number of ZoneEquipConfig derived type - int ADUNum; // air distribution unit index - int NumADUsToPlen; // number of ADUs that might leak to this plenum - int ADUsToPlenIndex; // index of an ADU that might leak to this plenum in the plenum ADU list // Do the one time initializations if (state.dataZonePlenum->InitAirZoneReturnPlenumOneTimeFlag) { @@ -677,14 +669,13 @@ void InitAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) // plenum conditions, such as plenum temperature and air flow. Also establish and save connections // to the Air Distribution Units. This is needed for the simple duct leakage calculation. - for (ZonePlenumLoop = 1; ZonePlenumLoop <= state.dataZonePlenum->NumZoneReturnPlenums; ++ZonePlenumLoop) { - ADUsToPlenIndex = 0; - NumADUsToPlen = 0; + for (int ZonePlenumLoop = 1; ZonePlenumLoop <= state.dataZonePlenum->NumZoneReturnPlenums; ++ZonePlenumLoop) { + int NumADUsToPlen = 0; if (state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumLoop).NumInletNodes > 0) { - for (InletNodeLoop = 1; InletNodeLoop <= state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumLoop).NumInletNodes; ++InletNodeLoop) { + for (int InletNodeLoop = 1; InletNodeLoop <= state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumLoop).NumInletNodes; ++InletNodeLoop) { InletNode = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumLoop).InletNode(InletNodeLoop); // Loop through ZoneEquipConfig's and look for return air node value = InletNode - for (ZoneEquipConfigLoop = 1; ZoneEquipConfigLoop <= state.dataGlobal->NumOfZones; ++ZoneEquipConfigLoop) { + for (int ZoneEquipConfigLoop = 1; ZoneEquipConfigLoop <= state.dataGlobal->NumOfZones; ++ZoneEquipConfigLoop) { if (!state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigLoop).IsControlled) continue; for (int retNode = 1; retNode <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigLoop).NumReturnNodes; ++retNode) { if (state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigLoop).ReturnNode(retNode) == InletNode) { @@ -694,7 +685,7 @@ void InitAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) } } // count the ADUs that can leak to this plenum - for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { + for (int ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { if (state.dataDefineEquipment->AirDistUnit(ADUNum).ZoneEqNum == state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumLoop).ZoneEqNum(InletNodeLoop)) { state.dataDefineEquipment->AirDistUnit(ADUNum).RetPlenumNum = ZonePlenumLoop; @@ -707,7 +698,8 @@ void InitAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumLoop).NumADUs = NumADUsToPlen; // fill the list of air distribution units that can leak to this plenum if (NumADUsToPlen > 0) { - for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { + int ADUsToPlenIndex = 0; + for (int ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { if (state.dataDefineEquipment->AirDistUnit(ADUNum).RetPlenumNum == ZonePlenumLoop) { ++ADUsToPlenIndex; state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumLoop).ADUIndex(ADUsToPlenIndex) = ADUNum; @@ -717,7 +709,7 @@ void InitAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) } // Check that all ADUs with leakage found a return plenum - for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { + for (int ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { auto &thisADU(state.dataDefineEquipment->AirDistUnit(ADUNum)); // TODO: the first half of this IF condition was a duplicated OR, if issues around this code, might want to check the history of this line if (thisADU.DownStreamLeak && (thisADU.RetPlenumNum == 0)) { @@ -739,7 +731,7 @@ void InitAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) // Do the Begin Environment initializations if (state.dataZonePlenum->InitAirZoneReturnPlenumEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) { - for (PlenumZoneNum = 1; PlenumZoneNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumZoneNum) { + for (int PlenumZoneNum = 1; PlenumZoneNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumZoneNum) { ZoneNodeNum = state.dataZonePlenum->ZoneRetPlenCond(PlenumZoneNum).ZoneNodeNum; state.dataLoopNodes->Node(ZoneNodeNum).Temp = 20.0; @@ -789,7 +781,7 @@ void InitAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) ZoneNodeNum = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneNodeNum; // Set the induced air flow rates and conditions for (NodeNum = 1; NodeNum <= state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes; ++NodeNum) { - InducedNode = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode(NodeNum); + int InducedNode = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode(NodeNum); state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRate(NodeNum) = state.dataLoopNodes->Node(InducedNode).MassFlowRate; state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMaxAvail(NodeNum) = state.dataLoopNodes->Node(InducedNode).MassFlowRateMaxAvail; @@ -834,23 +826,21 @@ void InitAirZoneSupplyPlenum(EnergyPlusData &state, int const ZonePlenumNum, boo int InletNode; int OutletNode; int ZoneNodeNum; - int PlenumZoneNum; int NodeIndex; - auto &Node(state.dataLoopNodes->Node); - // Do the Begin Environment initializations if (state.dataZonePlenum->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) { - for (PlenumZoneNum = 1; PlenumZoneNum <= state.dataZonePlenum->NumZoneSupplyPlenums; ++PlenumZoneNum) { + for (int PlenumZoneNum = 1; PlenumZoneNum <= state.dataZonePlenum->NumZoneSupplyPlenums; ++PlenumZoneNum) { ZoneNodeNum = state.dataZonePlenum->ZoneSupPlenCond(PlenumZoneNum).ZoneNodeNum; - Node(ZoneNodeNum).Temp = 20.0; - Node(ZoneNodeNum).MassFlowRate = 0.0; - Node(ZoneNodeNum).Quality = 1.0; - Node(ZoneNodeNum).Press = state.dataEnvrn->OutBaroPress; - Node(ZoneNodeNum).HumRat = state.dataEnvrn->OutHumRat; - Node(ZoneNodeNum).Enthalpy = PsyHFnTdbW(Node(ZoneNodeNum).Temp, Node(ZoneNodeNum).HumRat); + auto &node = state.dataLoopNodes->Node(ZoneNodeNum); + node.Temp = 20.0; + node.MassFlowRate = 0.0; + node.Quality = 1.0; + node.Press = state.dataEnvrn->OutBaroPress; + node.HumRat = state.dataEnvrn->OutHumRat; + node.Enthalpy = PsyHFnTdbW(node.Temp, node.HumRat); state.dataZonePlenum->ZoneSupPlenCond(PlenumZoneNum).ZoneTemp = 20.0; state.dataZonePlenum->ZoneSupPlenCond(PlenumZoneNum).ZoneHumRat = 0.0; @@ -875,22 +865,25 @@ void InitAirZoneSupplyPlenum(EnergyPlusData &state, int const ZonePlenumNum, boo // the previous components outlets or the node data in this section. InletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletNode; + auto const &inletNode = state.dataLoopNodes->Node(InletNode); ZoneNodeNum = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).ZoneNodeNum; + auto &zoneNode = state.dataLoopNodes->Node(ZoneNodeNum); if (FirstHVACIteration && FirstCall) { - if (Node(InletNode).MassFlowRate > 0.0) { - Node(ZoneNodeNum).MassFlowRate = Node(InletNode).MassFlowRate; + if (inletNode.MassFlowRate > 0.0) { + zoneNode.MassFlowRate = inletNode.MassFlowRate; for (NodeIndex = 1; NodeIndex <= state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; ++NodeIndex) { OutletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletNode(NodeIndex); - Node(OutletNode).MassFlowRate = Node(InletNode).MassFlowRate / state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; + state.dataLoopNodes->Node(OutletNode).MassFlowRate = + inletNode.MassFlowRate / state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; } } - if (Node(InletNode).MassFlowRateMaxAvail > 0.0) { - Node(ZoneNodeNum).MassFlowRateMaxAvail = Node(InletNode).MassFlowRateMaxAvail; + if (inletNode.MassFlowRateMaxAvail > 0.0) { + zoneNode.MassFlowRateMaxAvail = inletNode.MassFlowRateMaxAvail; for (NodeIndex = 1; NodeIndex <= state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; ++NodeIndex) { OutletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletNode(NodeIndex); - Node(OutletNode).MassFlowRateMaxAvail = - Node(InletNode).MassFlowRateMaxAvail / state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; + state.dataLoopNodes->Node(OutletNode).MassFlowRateMaxAvail = + inletNode.MassFlowRateMaxAvail / state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; } } @@ -898,43 +891,46 @@ void InitAirZoneSupplyPlenum(EnergyPlusData &state, int const ZonePlenumNum, boo if (FirstCall) { - if (Node(InletNode).MassFlowRateMaxAvail == 0.0) { // For Node inlet Max Avail = 0.0 + if (inletNode.MassFlowRateMaxAvail == 0.0) { // For Node inlet Max Avail = 0.0 for (NodeIndex = 1; NodeIndex <= state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; ++NodeIndex) { OutletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletNode(NodeIndex); - Node(OutletNode).MassFlowRate = 0.0; - Node(OutletNode).MassFlowRateMaxAvail = 0.0; - Node(OutletNode).MassFlowRateMinAvail = 0.0; + auto &outletNode = state.dataLoopNodes->Node(OutletNode); + outletNode.MassFlowRate = 0.0; + outletNode.MassFlowRateMaxAvail = 0.0; + outletNode.MassFlowRateMinAvail = 0.0; } - Node(ZoneNodeNum).MassFlowRate = 0.0; - Node(ZoneNodeNum).MassFlowRateMaxAvail = 0.0; - Node(ZoneNodeNum).MassFlowRateMinAvail = 0.0; + zoneNode.MassFlowRate = 0.0; + zoneNode.MassFlowRateMaxAvail = 0.0; + zoneNode.MassFlowRateMinAvail = 0.0; } // For Node inlet Max Avail = 0.0 // Add stuff to calculate conduction inputs to the zone plenum // Now load the zone conditions - state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).ZoneTemp = Node(ZoneNodeNum).Temp; - state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).ZoneHumRat = Node(ZoneNodeNum).HumRat; - state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).ZoneEnthalpy = Node(ZoneNodeNum).Enthalpy; + state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).ZoneTemp = zoneNode.Temp; + state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).ZoneHumRat = zoneNode.HumRat; + state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).ZoneEnthalpy = zoneNode.Enthalpy; for (NodeIndex = 1; NodeIndex <= state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; ++NodeIndex) { OutletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletNode(NodeIndex); - Node(OutletNode).Press = Node(InletNode).Press; - Node(OutletNode).Quality = Node(InletNode).Quality; + auto &outletNode = state.dataLoopNodes->Node(OutletNode); + outletNode.Press = inletNode.Press; + outletNode.Quality = inletNode.Quality; } - Node(ZoneNodeNum).Press = Node(InletNode).Press; - Node(ZoneNodeNum).Quality = Node(InletNode).Quality; + zoneNode.Press = inletNode.Press; + zoneNode.Quality = inletNode.Quality; } else { // On the second call from the ZoneEquipManager this is where the flows are passed back to // the supply plenum inlet. for (NodeIndex = 1; NodeIndex <= state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; ++NodeIndex) { OutletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletNode(NodeIndex); - state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletMassFlowRate(NodeIndex) = Node(OutletNode).MassFlowRate; - state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletMassFlowRateMaxAvail(NodeIndex) = Node(OutletNode).MassFlowRateMaxAvail; - state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletMassFlowRateMinAvail(NodeIndex) = Node(OutletNode).MassFlowRateMinAvail; + auto const &outletNode = state.dataLoopNodes->Node(OutletNode); + state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletMassFlowRate(NodeIndex) = outletNode.MassFlowRate; + state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletMassFlowRateMaxAvail(NodeIndex) = outletNode.MassFlowRateMaxAvail; + state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletMassFlowRateMinAvail(NodeIndex) = outletNode.MassFlowRateMinAvail; } } // For FirstCall @@ -953,7 +949,6 @@ void CalcAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int InletNodeNum(0); // inlet node number int IndNum(0); // induced air index - int ADUNum(0); // air distribution unit number int ADUListIndex(0); // air distribution unit index in zone return plenum data structure Real64 TotIndMassFlowRate(0.0); // total induced air mass flow rate [kg/s] @@ -995,7 +990,7 @@ void CalcAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) // add in the leak flow rate, if any. Don't alter the pressure calc (it is not used anyway) for (ADUListIndex = 1; ADUListIndex <= state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumADUs; ++ADUListIndex) { - ADUNum = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ADUIndex(ADUListIndex); + int ADUNum = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ADUIndex(ADUListIndex); if (state.dataDefineEquipment->AirDistUnit(ADUNum).UpStreamLeak || state.dataDefineEquipment->AirDistUnit(ADUNum).DownStreamLeak) { state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRate += state.dataDefineEquipment->AirDistUnit(ADUNum).MassFlowRateUpStrLk + @@ -1087,84 +1082,72 @@ void UpdateAirZoneReturnPlenum(EnergyPlusData &state, int const ZonePlenumNum) // SUBROUTINE INFORMATION: // AUTHOR Peter Graham Ellis // DATE WRITTEN November 2000 - // MODIFIED na - // RE-ENGINEERED na - // Using/Aliasing // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int OutletNode; - int InletNode; - int ZoneNode; - int InletNodeNum; - int InducedNode; // the node number of an induced air outlet node - int IndNum; // the induced air outlet index in ZoneRetPlenCond - - auto &Node(state.dataLoopNodes->Node); - - OutletNode = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletNode; - InletNode = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletNode(1); - ZoneNode = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneNodeNum; + auto const &zoneRetPlenCond = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum); + auto &outletNode = state.dataLoopNodes->Node(zoneRetPlenCond.OutletNode); + auto const &inletNode = state.dataLoopNodes->Node(zoneRetPlenCond.InletNode(1)); + auto &zoneNode = state.dataLoopNodes->Node(zoneRetPlenCond.ZoneNodeNum); // Set the outlet air nodes of the ZonePlenum - Node(OutletNode).MassFlowRate = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRate; - Node(OutletNode).MassFlowRateMaxAvail = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRateMaxAvail; - Node(OutletNode).MassFlowRateMinAvail = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRateMinAvail; - - Node(ZoneNode).MassFlowRate = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRate; - Node(ZoneNode).MassFlowRateMaxAvail = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRateMaxAvail; - Node(ZoneNode).MassFlowRateMinAvail = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRateMinAvail; - Node(ZoneNode).Press = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletPressure; - - Node(OutletNode).Temp = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletTemp; - Node(OutletNode).HumRat = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletHumRat; - Node(OutletNode).Enthalpy = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletEnthalpy; - Node(OutletNode).Press = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletPressure; - for (IndNum = 1; IndNum <= state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes; ++IndNum) { - InducedNode = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode(IndNum); - Node(InducedNode).Temp = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedTemp(IndNum); - Node(InducedNode).HumRat = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedHumRat(IndNum); - Node(InducedNode).Enthalpy = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedEnthalpy(IndNum); - Node(InducedNode).Press = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedPressure(IndNum); + outletNode.MassFlowRate = zoneRetPlenCond.OutletMassFlowRate; + outletNode.MassFlowRateMaxAvail = zoneRetPlenCond.OutletMassFlowRateMaxAvail; + outletNode.MassFlowRateMinAvail = zoneRetPlenCond.OutletMassFlowRateMinAvail; + + zoneNode.MassFlowRate = zoneRetPlenCond.OutletMassFlowRate; + zoneNode.MassFlowRateMaxAvail = zoneRetPlenCond.OutletMassFlowRateMaxAvail; + zoneNode.MassFlowRateMinAvail = zoneRetPlenCond.OutletMassFlowRateMinAvail; + zoneNode.Press = zoneRetPlenCond.OutletPressure; + + outletNode.Temp = zoneRetPlenCond.OutletTemp; + outletNode.HumRat = zoneRetPlenCond.OutletHumRat; + outletNode.Enthalpy = zoneRetPlenCond.OutletEnthalpy; + outletNode.Press = zoneRetPlenCond.OutletPressure; + for (int IndNum = 1; IndNum <= zoneRetPlenCond.NumInducedNodes; ++IndNum) { + int InducedNode = zoneRetPlenCond.InducedNode(IndNum); + auto &inducedNode = state.dataLoopNodes->Node(InducedNode); + inducedNode.Temp = zoneRetPlenCond.InducedTemp(IndNum); + inducedNode.HumRat = zoneRetPlenCond.InducedHumRat(IndNum); + inducedNode.Enthalpy = zoneRetPlenCond.InducedEnthalpy(IndNum); + inducedNode.Press = zoneRetPlenCond.InducedPressure(IndNum); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - Node(InducedNode).CO2 = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedCO2(IndNum); + inducedNode.CO2 = zoneRetPlenCond.InducedCO2(IndNum); } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - Node(InducedNode).GenContam = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedGenContam(IndNum); + inducedNode.GenContam = zoneRetPlenCond.InducedGenContam(IndNum); } - Node(InducedNode).Quality = Node(InletNode).Quality; + inducedNode.Quality = inletNode.Quality; } // Set the outlet nodes for properties that are just pass through and not used - Node(OutletNode).Quality = Node(InletNode).Quality; - Node(ZoneNode).Quality = Node(InletNode).Quality; + outletNode.Quality = inletNode.Quality; + zoneNode.Quality = inletNode.Quality; // Set the outlet node contaminant properties if needed. The zone contaminant conditions are calculated in ZoneContaminantPredictorCorrector if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - if (state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRate > 0.0) { + if (zoneRetPlenCond.OutletMassFlowRate > 0.0) { // CO2 balance to get outlet air CO2 - Node(OutletNode).CO2 = 0.0; - for (InletNodeNum = 1; InletNodeNum <= state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInletNodes; ++InletNodeNum) { - Node(OutletNode).CO2 += Node(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletNode(InletNodeNum)).CO2 * - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletMassFlowRate(InletNodeNum) / - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRate; + outletNode.CO2 = 0.0; + for (int InletNodeNum = 1; InletNodeNum <= zoneRetPlenCond.NumInletNodes; ++InletNodeNum) { + outletNode.CO2 += state.dataLoopNodes->Node(zoneRetPlenCond.InletNode(InletNodeNum)).CO2 * + zoneRetPlenCond.InletMassFlowRate(InletNodeNum) / zoneRetPlenCond.OutletMassFlowRate; } - Node(ZoneNode).CO2 = Node(OutletNode).CO2; + zoneNode.CO2 = outletNode.CO2; } else { - Node(OutletNode).CO2 = Node(ZoneNode).CO2; + outletNode.CO2 = zoneNode.CO2; } } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - if (state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRate > 0.0) { + if (zoneRetPlenCond.OutletMassFlowRate > 0.0) { // GenContam balance to get outlet air GenContam - Node(OutletNode).GenContam = 0.0; - for (InletNodeNum = 1; InletNodeNum <= state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInletNodes; ++InletNodeNum) { - Node(OutletNode).GenContam += Node(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletNode(InletNodeNum)).GenContam * - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletMassFlowRate(InletNodeNum) / - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletMassFlowRate; + outletNode.GenContam = 0.0; + for (int InletNodeNum = 1; InletNodeNum <= zoneRetPlenCond.NumInletNodes; ++InletNodeNum) { + outletNode.GenContam += state.dataLoopNodes->Node(zoneRetPlenCond.InletNode(InletNodeNum)).GenContam * + zoneRetPlenCond.InletMassFlowRate(InletNodeNum) / zoneRetPlenCond.OutletMassFlowRate; } - Node(ZoneNode).GenContam = Node(OutletNode).GenContam; + zoneNode.GenContam = outletNode.GenContam; } else { - Node(OutletNode).GenContam = Node(ZoneNode).GenContam; + outletNode.GenContam = zoneNode.GenContam; } } } @@ -1175,66 +1158,55 @@ void UpdateAirZoneSupplyPlenum(EnergyPlusData &state, int const ZonePlenumNum, b // SUBROUTINE INFORMATION: // AUTHOR Peter Graham Ellis // DATE WRITTEN March 2000 - // MODIFIED na - // RE-ENGINEERED na // METHODOLOGY EMPLOYED: // Similar to the Zone Splitter component but with interactions to the plenum zone. - // Using/Aliasing // SUBROUTINE PARAMETER DEFINITIONS: - Real64 constexpr FlowRateToler(0.01); // Tolerance for mass flow rate convergence (in kg/s) + Real64 constexpr FlowRateToler = 0.01; // Tolerance for mass flow rate convergence (in kg/s) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int OutletNode; - int InletNode; - int ZoneNode; - int NodeIndex; - - auto &Node(state.dataLoopNodes->Node); - - OutletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletNode(1); - InletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletNode; - ZoneNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).ZoneNodeNum; + auto const &zoneSupPlenCon = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum); + auto &inletNode = state.dataLoopNodes->Node(zoneSupPlenCon.InletNode); + auto &zoneNode = state.dataLoopNodes->Node(zoneSupPlenCon.ZoneNodeNum); // On the FirstCall the State properties are passed through and the mass flows are not dealt with if (FirstCall) { // Set the outlet nodes for properties that just pass through and not used - for (NodeIndex = 1; NodeIndex <= state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).NumOutletNodes; ++NodeIndex) { - OutletNode = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletNode(NodeIndex); - Node(OutletNode).Temp = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletTemp(NodeIndex); - Node(OutletNode).HumRat = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletHumRat(NodeIndex); - Node(OutletNode).Enthalpy = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).OutletEnthalpy(NodeIndex); + for (int NodeIndex = 1; NodeIndex <= zoneSupPlenCon.NumOutletNodes; ++NodeIndex) { + int OutletNode = zoneSupPlenCon.OutletNode(NodeIndex); + auto &outletNode = state.dataLoopNodes->Node(OutletNode); + outletNode.Temp = zoneSupPlenCon.OutletTemp(NodeIndex); + outletNode.HumRat = zoneSupPlenCon.OutletHumRat(NodeIndex); + outletNode.Enthalpy = zoneSupPlenCon.OutletEnthalpy(NodeIndex); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - Node(OutletNode).CO2 = Node(InletNode).CO2; + outletNode.CO2 = inletNode.CO2; } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - Node(OutletNode).GenContam = Node(InletNode).GenContam; + outletNode.GenContam = inletNode.GenContam; } } if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - Node(ZoneNode).CO2 = Node(InletNode).CO2; + zoneNode.CO2 = inletNode.CO2; } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - Node(ZoneNode).GenContam = Node(InletNode).GenContam; + zoneNode.GenContam = inletNode.GenContam; } } else { - // The second time through just updates the mass flow conditions back upstream - // to the inlet. - - if (std::abs(Node(InletNode).MassFlowRate - state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRate) > FlowRateToler) { + // The second time through just updates the mass flow conditions back upstream to the inlet. + if (std::abs(inletNode.MassFlowRate - zoneSupPlenCon.InletMassFlowRate) > FlowRateToler) { PlenumInletChanged = true; } - Node(InletNode).MassFlowRate = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRate; - Node(InletNode).MassFlowRateMaxAvail = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRateMaxAvail; - Node(InletNode).MassFlowRateMinAvail = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRateMinAvail; + inletNode.MassFlowRate = zoneSupPlenCon.InletMassFlowRate; + inletNode.MassFlowRateMaxAvail = zoneSupPlenCon.InletMassFlowRateMaxAvail; + inletNode.MassFlowRateMinAvail = zoneSupPlenCon.InletMassFlowRateMinAvail; - Node(ZoneNode).MassFlowRate = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRate; - Node(ZoneNode).MassFlowRateMaxAvail = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRateMaxAvail; - Node(ZoneNode).MassFlowRateMinAvail = state.dataZonePlenum->ZoneSupPlenCond(ZonePlenumNum).InletMassFlowRateMinAvail; + zoneNode.MassFlowRate = zoneSupPlenCon.InletMassFlowRate; + zoneNode.MassFlowRateMaxAvail = zoneSupPlenCon.InletMassFlowRateMaxAvail; + zoneNode.MassFlowRateMinAvail = zoneSupPlenCon.InletMassFlowRateMinAvail; } // For FirstCall } @@ -1243,9 +1215,7 @@ int GetReturnPlenumIndex(EnergyPlusData &state, int const ExNodeNum) { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PlenumNum; // loop counter - int InducedNodeNum; // loop counter - int WhichPlenum; // index to return plenum + int WhichPlenum; // index to return plenum // Obtains and Allocates ZonePlenum related parameters from input file if (state.dataZonePlenum->GetInputFlag) { // First time subroutine has been entered @@ -1255,14 +1225,14 @@ int GetReturnPlenumIndex(EnergyPlusData &state, int const ExNodeNum) WhichPlenum = 0; if (state.dataZonePlenum->NumZoneReturnPlenums > 0) { - for (PlenumNum = 1; PlenumNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumNum) { + for (int PlenumNum = 1; PlenumNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumNum) { if (ExNodeNum != state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).OutletNode) continue; WhichPlenum = PlenumNum; break; } if (WhichPlenum == 0) { - for (PlenumNum = 1; PlenumNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumNum) { - for (InducedNodeNum = 1; InducedNodeNum <= state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).NumInducedNodes; ++InducedNodeNum) { + for (int PlenumNum = 1; PlenumNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumNum) { + for (int InducedNodeNum = 1; InducedNodeNum <= state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).NumInducedNodes; ++InducedNodeNum) { if (ExNodeNum != state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).InducedNode(InducedNodeNum)) continue; WhichPlenum = PlenumNum; break; @@ -1293,21 +1263,16 @@ void GetReturnPlenumName(EnergyPlusData &state, int const ReturnPlenumIndex, std int getReturnPlenumIndexFromInletNode(EnergyPlusData &state, int const InNodeNum) { - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PlenumNum; // loop counter - int InNodeCtr; // loop counter - int thisPlenum; - // Obtains and Allocates ZonePlenum related parameters from input file if (state.dataZonePlenum->GetInputFlag) { // First time subroutine has been entered GetZonePlenumInput(state); state.dataZonePlenum->GetInputFlag = false; } - thisPlenum = 0; + int thisPlenum = 0; if (state.dataZonePlenum->NumZoneReturnPlenums > 0) { - for (PlenumNum = 1; PlenumNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumNum) { - for (InNodeCtr = 1; InNodeCtr <= state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).NumInletNodes; ++InNodeCtr) { + for (int PlenumNum = 1; PlenumNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumNum) { + for (int InNodeCtr = 1; InNodeCtr <= state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).NumInletNodes; ++InNodeCtr) { if (InNodeNum != state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).InletNode(InNodeCtr)) continue; thisPlenum = PlenumNum; break; @@ -1322,9 +1287,6 @@ int getReturnPlenumIndexFromInletNode(EnergyPlusData &state, int const InNodeNum bool ValidateInducedNode(EnergyPlusData &state, int const InduceNodeNum, int const NumReturnNodes, Array1D const &ReturnNode) { // Ensure induced node is used as inlet node of zoe equipment - int PlenumNum; // loop counter - int InNodeCtr; // loop counter - int InduceNodeCtr; // loop counter bool Nodefound = false; // Obtains and Allocates ZonePlenum related parameters from input file @@ -1334,10 +1296,10 @@ bool ValidateInducedNode(EnergyPlusData &state, int const InduceNodeNum, int con } if (state.dataZonePlenum->NumZoneReturnPlenums > 0) { - for (PlenumNum = 1; PlenumNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumNum) { - for (InduceNodeCtr = 1; InduceNodeCtr <= state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).NumInducedNodes; ++InduceNodeCtr) { + for (int PlenumNum = 1; PlenumNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++PlenumNum) { + for (int InduceNodeCtr = 1; InduceNodeCtr <= state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).NumInducedNodes; ++InduceNodeCtr) { if (InduceNodeNum == state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).InducedNode(InduceNodeCtr)) { - for (InNodeCtr = 1; InNodeCtr <= state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).NumInletNodes; ++InNodeCtr) { + for (int InNodeCtr = 1; InNodeCtr <= state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).NumInletNodes; ++InNodeCtr) { for (int ReturnNodeNum = 1; ReturnNodeNum <= NumReturnNodes; ++ReturnNodeNum) { if (ReturnNode(ReturnNodeNum) != state.dataZonePlenum->ZoneRetPlenCond(PlenumNum).InletNode(InNodeCtr)) continue; Nodefound = true; diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index 20783b681b4..bfd6a4138c3 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -282,8 +282,6 @@ void GetZoneAirSetPoints(EnergyPlusData &state) int CTIndex; int HumidControlledZoneNum; // The Humidity Controller that information is being loaded into bool ValidScheduleControlType; - bool ValidRadFractSched; // check for if radiative fraction schedule has valid numbers - bool ValidZoneOvercoolRangeSched; // check for if Zone Overcool range schedule has valid numbers int SchedMin; int SchedMax; int ActualZoneNum; @@ -291,10 +289,8 @@ void GetZoneAirSetPoints(EnergyPlusData &state) int ComfortControlledZoneNum; // The Splitter that you are currently loading input into int i; - int IZoneCount; int found; int NumStageControlledZones; // Number of staged controlled objects - int StageControlledZoneNum; // Index for staged controlled zones Array1D_int CTSchedMapToControlledZone; Array1D_int CCmSchedMapToControlledZone; @@ -327,17 +323,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) static constexpr std::string_view Format_701("Zone Volume Capacitance Multiplier,{:8.3F} ,{:8.3F},{:8.3F},{:8.3F}\n"); auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - auto &TStatObjects = state.dataZoneCtrls->TStatObjects; - auto &Zone = state.dataHeatBal->Zone; - auto &ZoneList = state.dataHeatBal->ZoneList; - auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone; - auto &HumidityControlZone = state.dataZoneCtrls->HumidityControlZone; - auto &ComfortTStatObjects = state.dataZoneCtrls->ComfortTStatObjects; - auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone; int NumOfZones = state.dataGlobal->NumOfZones; - auto &StageControlledZone = state.dataZoneCtrls->StageControlledZone; - auto &SetPointSingleHeating = state.dataZoneTempPredictorCorrector->SetPointSingleHeating; - auto &SetPointSingleCooling = state.dataZoneTempPredictorCorrector->SetPointSingleCooling; auto &cAlphaArgs = state.dataIPShortCut->cAlphaArgs; auto &rNumericArgs = state.dataIPShortCut->rNumericArgs; auto &lNumericFieldBlanks = state.dataIPShortCut->lNumericFieldBlanks; @@ -345,16 +331,16 @@ void GetZoneAirSetPoints(EnergyPlusData &state) auto &cAlphaFieldNames = state.dataIPShortCut->cAlphaFieldNames; auto &cNumericFieldNames = state.dataIPShortCut->cNumericFieldNames; auto &inputProcessor = state.dataInputProcessing->inputProcessor; - auto &SetPointDualHeatCool = state.dataZoneTempPredictorCorrector->SetPointDualHeatCool; cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::TStat)); // Update Num in state and make local convenience copy int NumTStatStatements = state.dataZoneCtrls->NumTStatStatements = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - TStatObjects.allocate(NumTStatStatements); + state.dataZoneCtrls->TStatObjects.allocate(NumTStatStatements); // Pre-scan for use of Zone lists in TStat statements (i.e. Global application of TStat) state.dataZoneCtrls->NumTempControlledZones = 0; for (Item = 1; Item <= NumTStatStatements; ++Item) { + auto &TStatObjects = state.dataZoneCtrls->TStatObjects(Item); inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -369,22 +355,23 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cNumericFieldNames); Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - TStatObjects(Item).Name = cAlphaArgs(1); - Item1 = Util::FindItemInList(cAlphaArgs(2), Zone); + TStatObjects.Name = cAlphaArgs(1); + Item1 = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); ZLItem = 0; - if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), ZoneList); + if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->ZoneList); if (Item1 > 0) { - TStatObjects(Item).TempControlledZoneStartPtr = state.dataZoneCtrls->NumTempControlledZones + 1; + TStatObjects.TempControlledZoneStartPtr = state.dataZoneCtrls->NumTempControlledZones + 1; ++state.dataZoneCtrls->NumTempControlledZones; - TStatObjects(Item).NumOfZones = 1; - TStatObjects(Item).ZoneListActive = false; - TStatObjects(Item).ZoneOrZoneListPtr = Item1; + TStatObjects.NumOfZones = 1; + TStatObjects.ZoneListActive = false; + TStatObjects.ZoneOrZoneListPtr = Item1; } else if (ZLItem > 0) { - TStatObjects(Item).TempControlledZoneStartPtr = state.dataZoneCtrls->NumTempControlledZones + 1; - state.dataZoneCtrls->NumTempControlledZones += ZoneList(ZLItem).NumOfZones; - TStatObjects(Item).NumOfZones = ZoneList(ZLItem).NumOfZones; - TStatObjects(Item).ZoneListActive = true; - TStatObjects(Item).ZoneOrZoneListPtr = ZLItem; + auto const &ZoneList = state.dataHeatBal->ZoneList(ZLItem); + TStatObjects.TempControlledZoneStartPtr = state.dataZoneCtrls->NumTempControlledZones + 1; + state.dataZoneCtrls->NumTempControlledZones += ZoneList.NumOfZones; + TStatObjects.NumOfZones = ZoneList.NumOfZones; + TStatObjects.ZoneListActive = true; + TStatObjects.ZoneOrZoneListPtr = ZLItem; } else { ShowSevereError( state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); @@ -399,13 +386,14 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } if (state.dataZoneCtrls->NumTempControlledZones > 0) { - TempControlledZone.allocate(state.dataZoneCtrls->NumTempControlledZones); + state.dataZoneCtrls->TempControlledZone.allocate(state.dataZoneCtrls->NumTempControlledZones); TStatControlTypes.allocate(state.dataZoneCtrls->NumTempControlledZones); // Number of set point types CTSchedMapToControlledZone.dimension(state.dataZoneCtrls->NumTempControlledZones, 0); TempControlledZoneNum = 0; state.dataZoneTempPredictorCorrector->NumOnOffCtrZone = 0; for (Item = 1; Item <= NumTStatStatements; ++Item) { + auto &TStatObjects = state.dataZoneCtrls->TStatObjects(Item); inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -418,58 +406,63 @@ void GetZoneAirSetPoints(EnergyPlusData &state) lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); - for (Item1 = 1; Item1 <= TStatObjects(Item).NumOfZones; ++Item1) { + for (Item1 = 1; Item1 <= TStatObjects.NumOfZones; ++Item1) { ++TempControlledZoneNum; - if (TStatObjects(Item).ZoneListActive) { - cAlphaArgs(2) = Zone(ZoneList(TStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name; + auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + if (TStatObjects.ZoneListActive) { + auto &ZoneList = state.dataHeatBal->ZoneList(TStatObjects.ZoneOrZoneListPtr); + cAlphaArgs(2) = state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name; } - int ZoneAssigned = - Util::FindItemInList(cAlphaArgs(2), TempControlledZone, &DataZoneControls::ZoneTempControls::ZoneName, TempControlledZoneNum - 1); + int ZoneAssigned = Util::FindItemInList( + cAlphaArgs(2), state.dataZoneCtrls->TempControlledZone, &DataZoneControls::ZoneTempControls::ZoneName, TempControlledZoneNum - 1); if (ZoneAssigned == 0) { - TempControlledZone(TempControlledZoneNum).ZoneName = cAlphaArgs(2); - TempControlledZone(TempControlledZoneNum).ActualZoneNum = Util::FindItemInList(cAlphaArgs(2), Zone); - if (TempControlledZone(TempControlledZoneNum).ActualZoneNum == 0) { + TempControlledZone.ZoneName = cAlphaArgs(2); + TempControlledZone.ActualZoneNum = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); + if (TempControlledZone.ActualZoneNum == 0) { ShowSevereError( state, format( "{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); ErrorsFound = true; } else { - Zone(TempControlledZone(TempControlledZoneNum).ActualZoneNum).TempControlledZoneIndex = TempControlledZoneNum; + state.dataHeatBal->Zone(TempControlledZone.ActualZoneNum).TempControlledZoneIndex = TempControlledZoneNum; } } else { - TempControlledZone(TempControlledZoneNum).ZoneName = cAlphaArgs(2); // for continuity + TempControlledZone.ZoneName = cAlphaArgs(2); // for continuity ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" zone previously assigned.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); - ShowContinueError(state, format("...Zone was previously assigned to Thermostat=\"{}\".", TempControlledZone(ZoneAssigned).Name)); + ShowContinueError( + state, + format("...Zone was previously assigned to Thermostat=\"{}\".", state.dataZoneCtrls->TempControlledZone(ZoneAssigned).Name)); ErrorsFound = true; continue; } - if (!TStatObjects(Item).ZoneListActive) { - TempControlledZone(TempControlledZoneNum).Name = cAlphaArgs(1); + if (!TStatObjects.ZoneListActive) { + TempControlledZone.Name = cAlphaArgs(1); } else { + auto &ZoneList = state.dataHeatBal->ZoneList(TStatObjects.ZoneOrZoneListPtr); CheckCreatedZoneItemName(state, RoutineName, cCurrentModuleObject, - Zone(ZoneList(TStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name, - ZoneList(TStatObjects(Item).ZoneOrZoneListPtr).MaxZoneNameLength, - TStatObjects(Item).Name, - TempControlledZone, + state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name, + ZoneList.MaxZoneNameLength, + TStatObjects.Name, + state.dataZoneCtrls->TempControlledZone, TempControlledZoneNum - 1, - TempControlledZone(TempControlledZoneNum).Name, + TempControlledZone.Name, errFlag); if (errFlag) ErrorsFound = true; } - TempControlledZone(TempControlledZoneNum).ControlTypeSchedName = cAlphaArgs(3); - TempControlledZone(TempControlledZoneNum).CTSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); + TempControlledZone.ControlTypeSchedName = cAlphaArgs(3); + TempControlledZone.CTSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); if (Item1 == 1) { // only show error on first of several if zone list - if (TempControlledZone(TempControlledZoneNum).CTSchedIndex == 0) { + if (TempControlledZone.CTSchedIndex == 0) { ShowSevereError( state, format( @@ -477,8 +470,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } else { // Check validity of control types. - ValidScheduleControlType = - CheckScheduleValueMinMax(state, TempControlledZone(TempControlledZoneNum).CTSchedIndex, ">=", 0.0, "<=", 4.0); + ValidScheduleControlType = CheckScheduleValueMinMax(state, TempControlledZone.CTSchedIndex, ">=", 0.0, "<=", 4.0); if (!ValidScheduleControlType) { ShowSevereError( state, @@ -497,20 +489,20 @@ void GetZoneAirSetPoints(EnergyPlusData &state) NumAlphas = 9; } - TempControlledZone(TempControlledZoneNum).NumControlTypes = nint((NumAlphas - 3.0) / 2.0); - TempControlledZone(TempControlledZoneNum).ControlType.allocate(TempControlledZone(TempControlledZoneNum).NumControlTypes); - TempControlledZone(TempControlledZoneNum).ControlTypeName.allocate(TempControlledZone(TempControlledZoneNum).NumControlTypes); - TempControlledZone(TempControlledZoneNum).ControlTypeEnum.allocate(TempControlledZone(TempControlledZoneNum).NumControlTypes); + TempControlledZone.NumControlTypes = nint((NumAlphas - 3.0) / 2.0); + TempControlledZone.ControlType.allocate(TempControlledZone.NumControlTypes); + TempControlledZone.ControlTypeName.allocate(TempControlledZone.NumControlTypes); + TempControlledZone.ControlTypeEnum.allocate(TempControlledZone.NumControlTypes); - for (ControlTypeNum = 1; ControlTypeNum <= TempControlledZone(TempControlledZoneNum).NumControlTypes; ++ControlTypeNum) { + for (ControlTypeNum = 1; ControlTypeNum <= TempControlledZone.NumControlTypes; ++ControlTypeNum) { - TempControlledZone(TempControlledZoneNum).ControlType(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 3)); - TempControlledZone(TempControlledZoneNum).ControlTypeName(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum + 3)); + TempControlledZone.ControlType(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 3)); + TempControlledZone.ControlTypeName(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum + 3)); - if (!TempControlledZone(TempControlledZoneNum).ControlType(ControlTypeNum).empty()) { - HVAC::ThermostatType ctrlType = static_cast( - getEnumValue(ValidControlTypesUC, TempControlledZone(TempControlledZoneNum).ControlType(ControlTypeNum))); - TempControlledZone(TempControlledZoneNum).ControlTypeEnum(ControlTypeNum) = ctrlType; + if (!TempControlledZone.ControlType(ControlTypeNum).empty()) { + HVAC::ThermostatType ctrlType = + static_cast(getEnumValue(ValidControlTypesUC, TempControlledZone.ControlType(ControlTypeNum))); + TempControlledZone.ControlTypeEnum(ControlTypeNum) = ctrlType; if (ctrlType == HVAC::ThermostatType::Invalid) { ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\"", @@ -531,7 +523,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } if (NumNums > 0) { if (rNumericArgs(1) >= 0.0) { - TempControlledZone(TempControlledZoneNum).DeltaTCutSet = rNumericArgs(1); + TempControlledZone.DeltaTCutSet = rNumericArgs(1); if (rNumericArgs(1) > 0.0) state.dataZoneTempPredictorCorrector->NumOnOffCtrZone++; } else { ShowSevereError( @@ -541,10 +533,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } } - if (TempControlledZone(TempControlledZoneNum).DeltaTCutSet > 0.0) { - for (ControlTypeNum = 1; ControlTypeNum <= TempControlledZone(TempControlledZoneNum).NumControlTypes; ++ControlTypeNum) { - if (Util::SameString(TempControlledZone(TempControlledZoneNum).ControlType(ControlTypeNum), - "ThermostatSetpoint:SingleHeatingOrCooling")) { + if (TempControlledZone.DeltaTCutSet > 0.0) { + for (ControlTypeNum = 1; ControlTypeNum <= TempControlledZone.NumControlTypes; ++ControlTypeNum) { + if (Util::SameString(TempControlledZone.ControlType(ControlTypeNum), "ThermostatSetpoint:SingleHeatingOrCooling")) { ShowWarningError(state, format("{}=\"{}: The choice of Temperature Difference Between Cutout And Setpoint will not be applied " "to ThermostatSetpoint:SingleHeatingOrCooling.", @@ -561,7 +552,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls > 0) - SetPointSingleHeating.allocate(state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls); + state.dataZoneTempPredictorCorrector->SetPointSingleHeating.allocate(state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls); for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls; ++idx) { inputProcessor->getObjectItem(state, @@ -577,7 +568,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaFieldNames, cNumericFieldNames); Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &singleHtgSetpoint = SetPointSingleHeating(idx); + auto &singleHtgSetpoint = state.dataZoneTempPredictorCorrector->SetPointSingleHeating(idx); singleHtgSetpoint.Name = cAlphaArgs(1); singleHtgSetpoint.TempSchedName = cAlphaArgs(2); singleHtgSetpoint.TempSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); @@ -593,7 +584,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls > 0) - SetPointSingleCooling.allocate(state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls); + state.dataZoneTempPredictorCorrector->SetPointSingleCooling.allocate(state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls); for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls; ++idx) { inputProcessor->getObjectItem(state, @@ -609,7 +600,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaFieldNames, cNumericFieldNames); Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &singleClgSetpoint = SetPointSingleCooling(idx); + auto &singleClgSetpoint = state.dataZoneTempPredictorCorrector->SetPointSingleCooling(idx); singleClgSetpoint.Name = cAlphaArgs(1); singleClgSetpoint.TempSchedName = cAlphaArgs(2); singleClgSetpoint.TempSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); @@ -656,7 +647,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls > 0) - SetPointDualHeatCool.allocate(state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls); + state.dataZoneTempPredictorCorrector->SetPointDualHeatCool.allocate(state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls); for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls; ++idx) { inputProcessor->getObjectItem(state, @@ -672,7 +663,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaFieldNames, cNumericFieldNames); Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &dualHeatCoolSetpoint = SetPointDualHeatCool(idx); + auto &dualHeatCoolSetpoint = state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(idx); dualHeatCoolSetpoint.Name = cAlphaArgs(1); dualHeatCoolSetpoint.HeatTempSetptSchedName = cAlphaArgs(2); dualHeatCoolSetpoint.HeatTempSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); @@ -695,29 +686,32 @@ void GetZoneAirSetPoints(EnergyPlusData &state) int setPointObjectArrayIndex; for (TempControlledZoneNum = 1; TempControlledZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TempControlledZoneNum) { for (int ct = 1; ct <= state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum).NumControlTypes; ct++) { + auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); switch (state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum).ControlTypeEnum(ct)) { case HVAC::ThermostatType::SingleHeating: - setPointObjectArrayIndex = Util::FindItem(TempControlledZone(TempControlledZoneNum).ControlTypeName(ct), SetPointSingleHeating); - TempControlledZone(TempControlledZoneNum).SchIndx_SingleHeatSetPoint = + setPointObjectArrayIndex = + Util::FindItem(TempControlledZone.ControlTypeName(ct), state.dataZoneTempPredictorCorrector->SetPointSingleHeating); + TempControlledZone.SchIndx_SingleHeatSetPoint = state.dataZoneTempPredictorCorrector->SetPointSingleHeating(setPointObjectArrayIndex).TempSchedIndex; break; case HVAC::ThermostatType::SingleCooling: - setPointObjectArrayIndex = Util::FindItem(TempControlledZone(TempControlledZoneNum).ControlTypeName(ct), SetPointSingleCooling); - TempControlledZone(TempControlledZoneNum).SchIndx_SingleCoolSetPoint = + setPointObjectArrayIndex = + Util::FindItem(TempControlledZone.ControlTypeName(ct), state.dataZoneTempPredictorCorrector->SetPointSingleCooling); + TempControlledZone.SchIndx_SingleCoolSetPoint = state.dataZoneTempPredictorCorrector->SetPointSingleCooling(setPointObjectArrayIndex).TempSchedIndex; break; case HVAC::ThermostatType::SingleHeatCool: - setPointObjectArrayIndex = Util::FindItem(TempControlledZone(TempControlledZoneNum).ControlTypeName(ct), - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool); - TempControlledZone(TempControlledZoneNum).SchIndx_SingleHeatCoolSetPoint = + setPointObjectArrayIndex = + Util::FindItem(TempControlledZone.ControlTypeName(ct), state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool); + TempControlledZone.SchIndx_SingleHeatCoolSetPoint = state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool(setPointObjectArrayIndex).TempSchedIndex; break; case HVAC::ThermostatType::DualSetPointWithDeadBand: - setPointObjectArrayIndex = Util::FindItem(TempControlledZone(TempControlledZoneNum).ControlTypeName(ct), - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool); - TempControlledZone(TempControlledZoneNum).SchIndx_DualSetPointWDeadBandHeat = + setPointObjectArrayIndex = + Util::FindItem(TempControlledZone.ControlTypeName(ct), state.dataZoneTempPredictorCorrector->SetPointDualHeatCool); + TempControlledZone.SchIndx_DualSetPointWDeadBandHeat = state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(setPointObjectArrayIndex).HeatTempSchedIndex; - TempControlledZone(TempControlledZoneNum).SchIndx_DualSetPointWDeadBandCool = + TempControlledZone.SchIndx_DualSetPointWDeadBandCool = state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(setPointObjectArrayIndex).CoolTempSchedIndex; break; default: @@ -730,15 +724,16 @@ void GetZoneAirSetPoints(EnergyPlusData &state) for (TempControlledZoneNum = 1; TempControlledZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TempControlledZoneNum) { - ActualZoneNum = TempControlledZone(TempControlledZoneNum).ActualZoneNum; - CTIndex = TempControlledZone(TempControlledZoneNum).CTSchedIndex; + auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + ActualZoneNum = TempControlledZone.ActualZoneNum; + CTIndex = TempControlledZone.CTSchedIndex; if (CTIndex == 0) continue; // error will be caught elsewhere SchedMin = GetScheduleMinValue(state, CTIndex); SchedMax = GetScheduleMaxValue(state, CTIndex); if (SchedMin == 0 && SchedMax == 0) { if (FindNumberInList(CTIndex, CTSchedMapToControlledZone, state.dataZoneCtrls->NumTempControlledZones) == 0) { - ShowSevereError(state, format("Control Type Schedule={}", TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + ShowSevereError(state, format("Control Type Schedule={}", TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, "..specifies control type 0 for all entries."); ShowContinueError(state, "All zones using this Control Type Schedule have no heating or cooling available."); } @@ -752,70 +747,62 @@ void GetZoneAirSetPoints(EnergyPlusData &state) case HVAC::ThermostatType::Uncontrolled: break; case HVAC::ThermostatType::SingleHeating: - TempIndex = TempControlledZone(TempControlledZoneNum).SchIndx_SingleHeatSetPoint; + TempIndex = TempControlledZone.SchIndx_SingleHeatSetPoint; if (TempIndex == 0) { if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleHeating))) { - ShowSevereError(state, format("Control Type Schedule={}", TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + ShowSevereError(state, format("Control Type Schedule={}", TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("..specifies control type 1 ({}) as the control type. Not valid for this zone.", ValidControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TStat)), - TempControlledZone(TempControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone(TempControlledZoneNum).ZoneName)); + ShowContinueError( + state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); ErrorsFound = true; } } break; case HVAC::ThermostatType::SingleCooling: - TempIndex = TempControlledZone(TempControlledZoneNum).SchIndx_SingleCoolSetPoint; + TempIndex = TempControlledZone.SchIndx_SingleCoolSetPoint; if (TempIndex == 0) { if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleCooling))) { - ShowSevereError(state, format("Control Type Schedule={}", TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + ShowSevereError(state, format("Control Type Schedule={}", TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("..specifies control type 2 ({}) as the control type. Not valid for this zone.", ValidControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TStat)), - TempControlledZone(TempControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone(TempControlledZoneNum).ZoneName)); + ShowContinueError( + state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); ErrorsFound = true; } } break; case HVAC::ThermostatType::SingleHeatCool: - TempIndex = TempControlledZone(TempControlledZoneNum).SchIndx_SingleHeatCoolSetPoint; + TempIndex = TempControlledZone.SchIndx_SingleHeatCoolSetPoint; if (TempIndex == 0) { if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleHeatCool))) { - ShowSevereError(state, format("Schedule={}", TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + ShowSevereError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("..specifies control type 3 ({}) as the control type. Not valid for this zone.", ValidControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TStat)), - TempControlledZone(TempControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone(TempControlledZoneNum).ZoneName)); + ShowContinueError( + state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); ErrorsFound = true; } } break; case HVAC::ThermostatType::DualSetPointWithDeadBand: - TempIndex = TempControlledZone(TempControlledZoneNum) + TempIndex = TempControlledZone .SchIndx_DualSetPointWDeadBandHeat; // using "Heat" as a sentinel that dualsetpoint is on this zone control object if (TempIndex == 0) { if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand))) { - ShowSevereError(state, format("Schedule={}", TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + ShowSevereError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("..specifies control type 4 ({}) as the control type. Not valid for this zone.", ValidControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TStat)), - TempControlledZone(TempControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone(TempControlledZoneNum).ZoneName)); + ShowContinueError( + state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); ErrorsFound = true; } } @@ -823,9 +810,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) default: ShowSevereError(state, format("GetZoneAirSetpoints: Illegal control type for Zone={}, Found value={}, in Schedule={}", - Zone(ActualZoneNum).Name, + state.dataHeatBal->Zone(ActualZoneNum).Name, ControlTypeNum, - TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, "..valid range values are [0,4]."); ErrorsFound = true; } @@ -834,8 +821,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) for (TempControlledZoneNum = 1; TempControlledZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TempControlledZoneNum) { - ActualZoneNum = TempControlledZone(TempControlledZoneNum).ActualZoneNum; - CTIndex = TempControlledZone(TempControlledZoneNum).CTSchedIndex; + auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + ActualZoneNum = TempControlledZone.ActualZoneNum; + CTIndex = TempControlledZone.CTSchedIndex; if (CTIndex == 0) continue; // error caught elsewhere -- would just be confusing here for (ControlTypeNum = 1; ControlTypeNum <= 4; ++ControlTypeNum) { @@ -845,51 +833,43 @@ void GetZoneAirSetPoints(EnergyPlusData &state) switch (static_cast(ControlTypeNum)) { case HVAC::ThermostatType::SingleHeating: if (!TStatControlTypes(TempControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + ShowWarningError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("...should include control type 1 ({}) but does not.", ValidControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TStat)), - TempControlledZone(TempControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone(TempControlledZoneNum).ZoneName)); + format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); break; case HVAC::ThermostatType::SingleCooling: if (!TStatControlTypes(TempControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + ShowWarningError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("...should include control type 2 ({}) but does not.", ValidControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)])); ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TStat)), - TempControlledZone(TempControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone(TempControlledZoneNum).ZoneName)); + format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); break; case HVAC::ThermostatType::SingleHeatCool: if (!TStatControlTypes(TempControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + ShowWarningError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("...should include control type 3 ({}) but does not.", ValidControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TStat)), - TempControlledZone(TempControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone(TempControlledZoneNum).ZoneName)); + format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); break; case HVAC::ThermostatType::DualSetPointWithDeadBand: if (!TStatControlTypes(TempControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", TempControlledZone(TempControlledZoneNum).ControlTypeSchedName)); + ShowWarningError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("...should include control type 4 ({}) but does not.", ValidControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)])); ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TStat)), - TempControlledZone(TempControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone(TempControlledZoneNum).ZoneName)); + format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); break; default: break; @@ -903,12 +883,13 @@ void GetZoneAirSetPoints(EnergyPlusData &state) state.dataZoneCtrls->NumHumidityControlZones = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataZoneCtrls->NumHumidityControlZones > 0) { - HumidityControlZone.allocate(state.dataZoneCtrls->NumHumidityControlZones); + state.dataZoneCtrls->HumidityControlZone.allocate(state.dataZoneCtrls->NumHumidityControlZones); state.dataZoneTempPredictorCorrector->HumidityControlZoneUniqueNames.reserve( static_cast(state.dataZoneCtrls->NumHumidityControlZones)); } for (HumidControlledZoneNum = 1; HumidControlledZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HumidControlledZoneNum) { + auto &HumidityControlZone = state.dataZoneCtrls->HumidityControlZone(HumidControlledZoneNum); inputProcessor->getObjectItem(state, cCurrentModuleObject, HumidControlledZoneNum, @@ -923,7 +904,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cNumericFieldNames); Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - HumidityControlZone(HumidControlledZoneNum).ControlName = cAlphaArgs(1); + HumidityControlZone.ControlName = cAlphaArgs(1); GlobalNames::IntraObjUniquenessCheck(state, cAlphaArgs(2), cCurrentModuleObject, @@ -931,33 +912,33 @@ void GetZoneAirSetPoints(EnergyPlusData &state) state.dataZoneTempPredictorCorrector->HumidityControlZoneUniqueNames, ErrorsFound); - HumidityControlZone(HumidControlledZoneNum).ZoneName = cAlphaArgs(2); - HumidityControlZone(HumidControlledZoneNum).ActualZoneNum = Util::FindItem(cAlphaArgs(2), Zone); - if (HumidityControlZone(HumidControlledZoneNum).ActualZoneNum == 0) { + HumidityControlZone.ZoneName = cAlphaArgs(2); + HumidityControlZone.ActualZoneNum = Util::FindItem(cAlphaArgs(2), state.dataHeatBal->Zone); + if (HumidityControlZone.ActualZoneNum == 0) { ShowSevereError(state, format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); ErrorsFound = true; } else { - state.dataHeatBal->Zone(HumidityControlZone(HumidControlledZoneNum).ActualZoneNum).humidityControlZoneIndex = HumidControlledZoneNum; + state.dataHeatBal->Zone(HumidityControlZone.ActualZoneNum).humidityControlZoneIndex = HumidControlledZoneNum; } - HumidityControlZone(HumidControlledZoneNum).HumidifyingSched = cAlphaArgs(3); - HumidityControlZone(HumidControlledZoneNum).HumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); - if (HumidityControlZone(HumidControlledZoneNum).HumidifyingSchedIndex == 0) { + HumidityControlZone.HumidifyingSched = cAlphaArgs(3); + HumidityControlZone.HumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); + if (HumidityControlZone.HumidifyingSchedIndex == 0) { ShowSevereError(state, format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); ErrorsFound = true; } if (NumAlphas == 4) { - HumidityControlZone(HumidControlledZoneNum).DehumidifyingSched = cAlphaArgs(4); - HumidityControlZone(HumidControlledZoneNum).DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(4)); - if (HumidityControlZone(HumidControlledZoneNum).DehumidifyingSchedIndex == 0) { + HumidityControlZone.DehumidifyingSched = cAlphaArgs(4); + HumidityControlZone.DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(4)); + if (HumidityControlZone.DehumidifyingSchedIndex == 0) { ShowSevereError( state, format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(4), cAlphaArgs(4))); ErrorsFound = true; } } else { - HumidityControlZone(HumidControlledZoneNum).DehumidifyingSched = cAlphaArgs(3); - HumidityControlZone(HumidControlledZoneNum).DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); + HumidityControlZone.DehumidifyingSched = cAlphaArgs(3); + HumidityControlZone.DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); } } // HumidControlledZoneNum @@ -965,7 +946,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) // Start to read Thermal comfort control objects cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::TCTStat)); state.dataZoneCtrls->NumComfortTStatStatements = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - ComfortTStatObjects.allocate(state.dataZoneCtrls->NumComfortTStatStatements); + state.dataZoneCtrls->ComfortTStatObjects.allocate(state.dataZoneCtrls->NumComfortTStatStatements); // Pre-scan for use of Zone lists in TStat statements (i.e. Global application of TStat) state.dataZoneCtrls->NumComfortControlledZones = 0; @@ -985,22 +966,24 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cNumericFieldNames); Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - Item1 = Util::FindItemInList(cAlphaArgs(2), Zone); + Item1 = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); ZLItem = 0; - if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), ZoneList); - ComfortTStatObjects(Item).Name = cAlphaArgs(1); + if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->ZoneList); + auto &ComfortTStatObjects = state.dataZoneCtrls->ComfortTStatObjects(Item); + ComfortTStatObjects.Name = cAlphaArgs(1); if (Item1 > 0) { - ComfortTStatObjects(Item).ComfortControlledZoneStartPtr = state.dataZoneCtrls->NumComfortControlledZones + 1; + ComfortTStatObjects.ComfortControlledZoneStartPtr = state.dataZoneCtrls->NumComfortControlledZones + 1; ++state.dataZoneCtrls->NumComfortControlledZones; - ComfortTStatObjects(Item).NumOfZones = 1; - ComfortTStatObjects(Item).ZoneListActive = false; - ComfortTStatObjects(Item).ZoneOrZoneListPtr = Item1; + ComfortTStatObjects.NumOfZones = 1; + ComfortTStatObjects.ZoneListActive = false; + ComfortTStatObjects.ZoneOrZoneListPtr = Item1; } else if (ZLItem > 0) { - ComfortTStatObjects(Item).ComfortControlledZoneStartPtr = state.dataZoneCtrls->NumComfortControlledZones + 1; - state.dataZoneCtrls->NumComfortControlledZones += ZoneList(ZLItem).NumOfZones; - ComfortTStatObjects(Item).NumOfZones = ZoneList(ZLItem).NumOfZones; - ComfortTStatObjects(Item).ZoneListActive = true; - ComfortTStatObjects(Item).ZoneOrZoneListPtr = ZLItem; + auto const &ZoneList = state.dataHeatBal->ZoneList(ZLItem); + ComfortTStatObjects.ComfortControlledZoneStartPtr = state.dataZoneCtrls->NumComfortControlledZones + 1; + state.dataZoneCtrls->NumComfortControlledZones += ZoneList.NumOfZones; + ComfortTStatObjects.NumOfZones = ZoneList.NumOfZones; + ComfortTStatObjects.ZoneListActive = true; + ComfortTStatObjects.ZoneOrZoneListPtr = ZLItem; } else { ShowSevereError( state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); @@ -1016,12 +999,13 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } if (state.dataZoneCtrls->NumComfortControlledZones > 0) { - ComfortControlledZone.allocate(state.dataZoneCtrls->NumComfortControlledZones); + state.dataZoneCtrls->ComfortControlledZone.allocate(state.dataZoneCtrls->NumComfortControlledZones); TComfortControlTypes.allocate(state.dataZoneCtrls->NumComfortControlledZones); // Number of set point types CCmSchedMapToControlledZone.dimension(state.dataZoneCtrls->NumComfortControlledZones, 0); ComfortControlledZoneNum = 0; for (Item = 1; Item <= state.dataZoneCtrls->NumComfortTStatStatements; ++Item) { + auto &ComfortTStatObjects = state.dataZoneCtrls->ComfortTStatObjects(Item); inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -1034,17 +1018,21 @@ void GetZoneAirSetPoints(EnergyPlusData &state) lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); - for (Item1 = 1; Item1 <= ComfortTStatObjects(Item).NumOfZones; ++Item1) { + for (Item1 = 1; Item1 <= ComfortTStatObjects.NumOfZones; ++Item1) { ++ComfortControlledZoneNum; - if (ComfortTStatObjects(Item).ZoneListActive) { - cAlphaArgs(2) = state.dataHeatBal->Zone(ZoneList(ComfortTStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name; - } - int ZoneAssigned = Util::FindItemInList( - cAlphaArgs(2), ComfortControlledZone, &DataZoneControls::ZoneComfortControls::ZoneName, ComfortControlledZoneNum - 1); + auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); + if (ComfortTStatObjects.ZoneListActive) { + auto &ZoneList = state.dataHeatBal->ZoneList(ComfortTStatObjects.ZoneOrZoneListPtr); + cAlphaArgs(2) = state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name; + } + int ZoneAssigned = Util::FindItemInList(cAlphaArgs(2), + state.dataZoneCtrls->ComfortControlledZone, + &DataZoneControls::ZoneComfortControls::ZoneName, + ComfortControlledZoneNum - 1); if (ZoneAssigned == 0) { - ComfortControlledZone(ComfortControlledZoneNum).ZoneName = cAlphaArgs(2); - ComfortControlledZone(ComfortControlledZoneNum).ActualZoneNum = Util::FindItemInList(cAlphaArgs(2), Zone); - if (ComfortControlledZone(ComfortControlledZoneNum).ActualZoneNum == 0) { + ComfortControlledZone.ZoneName = cAlphaArgs(2); + ComfortControlledZone.ActualZoneNum = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); + if (ComfortControlledZone.ActualZoneNum == 0) { ShowSevereError( state, format( @@ -1052,7 +1040,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } } else { - ComfortControlledZone(ComfortControlledZoneNum).ZoneName = cAlphaArgs(2); // for continuity + ComfortControlledZone.ZoneName = cAlphaArgs(2); // for continuity ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" zone previously assigned.", cCurrentModuleObject, @@ -1060,28 +1048,28 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaFieldNames(2), cAlphaArgs(2))); ShowContinueError(state, - format("...Zone was previously assigned to Thermostat=\"{}\".", ComfortControlledZone(ZoneAssigned).Name)); + format("...Zone was previously assigned to Thermostat=\"{}\".", + state.dataZoneCtrls->ComfortControlledZone(ZoneAssigned).Name)); ErrorsFound = true; continue; } - if (!ComfortTStatObjects(Item).ZoneListActive) { - ComfortControlledZone(ComfortControlledZoneNum).Name = cAlphaArgs(1); + if (!ComfortTStatObjects.ZoneListActive) { + ComfortControlledZone.Name = cAlphaArgs(1); } else { - ComfortControlledZone(ComfortControlledZoneNum).Name = - state.dataHeatBal->Zone(ZoneList(ComfortTStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name + ' ' + - ComfortTStatObjects(Item).Name; + auto &ZoneList = state.dataHeatBal->ZoneList(ComfortTStatObjects.ZoneOrZoneListPtr); + ComfortControlledZone.Name = state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name + ' ' + ComfortTStatObjects.Name; } // Read Fields A3 and A4 for averaging method - IZoneCount = 0; + int IZoneCount = 0; for (i = 1; i <= state.dataHeatBal->TotPeople; ++i) { - if (ComfortControlledZone(ComfortControlledZoneNum).ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) { + if (ComfortControlledZone.ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) { ++IZoneCount; } } // Could not find a people object for this particular zone - if (IZoneCount == 0 && ComfortControlledZone(ComfortControlledZoneNum).ActualZoneNum > 0) { + if (IZoneCount == 0 && ComfortControlledZone.ActualZoneNum > 0) { ShowSevereError(state, format("{}=\"{} no PEOPLE in {}=\"{}\" - cannot use Comfort Control.", cCurrentModuleObject, @@ -1090,44 +1078,43 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaArgs(2))); ErrorsFound = true; } - ComfortControlledZone(ComfortControlledZoneNum).AverageMethod = DataZoneControls::AverageMethod::NO; + ComfortControlledZone.AverageMethod = DataZoneControls::AverageMethod::NO; if (IZoneCount > 1) { - ComfortControlledZone(ComfortControlledZoneNum).AverageMethodName = cAlphaArgs(3); + ComfortControlledZone.AverageMethodName = cAlphaArgs(3); if (Util::SameString(cAlphaArgs(3), "SpecificObject")) { - ComfortControlledZone(ComfortControlledZoneNum).AverageMethod = DataZoneControls::AverageMethod::SPE; + ComfortControlledZone.AverageMethod = DataZoneControls::AverageMethod::SPE; } if (Util::SameString(cAlphaArgs(3), "ObjectAverage")) { - ComfortControlledZone(ComfortControlledZoneNum).AverageMethod = DataZoneControls::AverageMethod::OBJ; + ComfortControlledZone.AverageMethod = DataZoneControls::AverageMethod::OBJ; } if (Util::SameString(cAlphaArgs(3), "PeopleAverage")) { - ComfortControlledZone(ComfortControlledZoneNum).AverageMethod = DataZoneControls::AverageMethod::PEO; + ComfortControlledZone.AverageMethod = DataZoneControls::AverageMethod::PEO; } - if (ComfortControlledZone(ComfortControlledZoneNum).AverageMethod == DataZoneControls::AverageMethod::NO) { + if (ComfortControlledZone.AverageMethod == DataZoneControls::AverageMethod::NO) { ShowSevereError( state, format("{}=\"{} invalid {}=\"{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); ShowContinueError(state, "Allowed keys are SpecificObject, ObjectAverage, or PeopleAverage"); ErrorsFound = true; } - if (ComfortControlledZone(ComfortControlledZoneNum).AverageMethod == DataZoneControls::AverageMethod::SPE) { - ComfortControlledZone(ComfortControlledZoneNum).AverageObjectName = cAlphaArgs(4); + if (ComfortControlledZone.AverageMethod == DataZoneControls::AverageMethod::SPE) { + ComfortControlledZone.AverageObjectName = cAlphaArgs(4); if (Util::FindItem(cAlphaArgs(4), state.dataHeatBal->People) == 0) { ShowSevereError( state, format("{}=\"{} invalid {}=\"{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(4), cAlphaArgs(4))); ErrorsFound = true; } else { - ComfortControlledZone(ComfortControlledZoneNum).SpecificObjectNum = - Util::FindItem(cAlphaArgs(4), state.dataHeatBal->People); + ComfortControlledZone.SpecificObjectNum = Util::FindItem(cAlphaArgs(4), state.dataHeatBal->People); } } } else { for (i = 1; i <= state.dataHeatBal->TotPeople; ++i) { - if (ComfortControlledZone(ComfortControlledZoneNum).ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) break; + if (ComfortControlledZone.ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) break; } - ComfortControlledZone(ComfortControlledZoneNum).SpecificObjectNum = i; + ComfortControlledZone.SpecificObjectNum = i; } // Check values used for thermal comfort calculation for (i = 1; i <= state.dataHeatBal->TotPeople; ++i) { - if (ComfortControlledZone(ComfortControlledZoneNum).ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) { + if (ComfortControlledZone.ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) { // Check activity level if (state.dataHeatBal->People(i).ActivityLevelPtr > 0) { ValidScheduleControlType = @@ -1193,7 +1180,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) // Read Max and Min temperature setpoint if (NumNums > 0) { - ComfortControlledZone(ComfortControlledZoneNum).TdbMinSetPoint = rNumericArgs(1); + ComfortControlledZone.TdbMinSetPoint = rNumericArgs(1); if (rNumericArgs(1) > 50 || rNumericArgs(1) < 0) { ShowSevereError( state, @@ -1203,7 +1190,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } } if (NumNums > 1) { - ComfortControlledZone(ComfortControlledZoneNum).TdbMaxSetPoint = rNumericArgs(2); + ComfortControlledZone.TdbMaxSetPoint = rNumericArgs(2); if (rNumericArgs(2) > 50 || rNumericArgs(2) < 0) { ShowSevereError( state, @@ -1213,31 +1200,29 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } } // Ensure MaxTemp >= MinTemp - if (ComfortControlledZone(ComfortControlledZoneNum).TdbMinSetPoint > ComfortControlledZone(ComfortControlledZoneNum).TdbMaxSetPoint) { + if (ComfortControlledZone.TdbMinSetPoint > ComfortControlledZone.TdbMaxSetPoint) { ShowSevereError(state, format("{}=\"{}", cCurrentModuleObject, cAlphaArgs(1))); ShowContinueError(state, format("..{} > {}", cNumericFieldNames(1), cNumericFieldNames(2))); ShowContinueError(state, format("..[{:.0T}] > [{:.0T}].", rNumericArgs(1), rNumericArgs(2))); ErrorsFound = true; } // If MaxTemp = MinTemp, no thermal comfort control - if (ComfortControlledZone(ComfortControlledZoneNum).TdbMinSetPoint == - ComfortControlledZone(ComfortControlledZoneNum).TdbMaxSetPoint) { + if (ComfortControlledZone.TdbMinSetPoint == ComfortControlledZone.TdbMaxSetPoint) { ShowSevereError(state, format("{}=\"{}", cCurrentModuleObject, cAlphaArgs(1))); ShowContinueError(state, format("..{} = {}", cNumericFieldNames(1), cNumericFieldNames(2))); ShowContinueError(state, "The zone will be controlled using this dry-bulb temperature setpoint."); } // read Thermal comfort type schedule name - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName = cAlphaArgs(5); - ComfortControlledZone(ComfortControlledZoneNum).ComfortSchedIndex = GetScheduleIndex(state, cAlphaArgs(5)); - if (ComfortControlledZone(ComfortControlledZoneNum).ComfortSchedIndex == 0) { + ComfortControlledZone.ControlTypeSchedName = cAlphaArgs(5); + ComfortControlledZone.ComfortSchedIndex = GetScheduleIndex(state, cAlphaArgs(5)); + if (ComfortControlledZone.ComfortSchedIndex == 0) { ShowSevereError( state, format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(5), cAlphaArgs(5))); ErrorsFound = true; } else { // Check validity of control types. - ValidScheduleControlType = - CheckScheduleValueMinMax(state, ComfortControlledZone(ComfortControlledZoneNum).ComfortSchedIndex, ">=", 0.0, "<=", 4.0); + ValidScheduleControlType = CheckScheduleValueMinMax(state, ComfortControlledZone.ComfortSchedIndex, ">=", 0.0, "<=", 4.0); if (!ValidScheduleControlType) { ShowSevereError( state, @@ -1246,19 +1231,16 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } } - ComfortControlledZone(ComfortControlledZoneNum).NumControlTypes = nint((NumAlphas - 5.0) / 2.0); - ComfortControlledZone(ComfortControlledZoneNum).ControlType.allocate(ComfortControlledZone(ComfortControlledZoneNum).NumControlTypes); - ComfortControlledZone(ComfortControlledZoneNum) - .ControlTypeName.allocate(ComfortControlledZone(ComfortControlledZoneNum).NumControlTypes); - ComfortControlledZone(ComfortControlledZoneNum) - .ControlTypeSchIndx.allocate(ComfortControlledZone(ComfortControlledZoneNum).NumControlTypes); - - for (ControlTypeNum = 1; ControlTypeNum <= ComfortControlledZone(ComfortControlledZoneNum).NumControlTypes; ++ControlTypeNum) { - ComfortControlledZone(ComfortControlledZoneNum).ControlType(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 5)); - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum + 5)); - if (ComfortControlledZone(ComfortControlledZoneNum).ControlType(ControlTypeNum) != "") { - CTIndex = getEnumValue(ValidComfortControlTypesUC, - Util::makeUPPER(ComfortControlledZone(ComfortControlledZoneNum).ControlType(ControlTypeNum))); + ComfortControlledZone.NumControlTypes = nint((NumAlphas - 5.0) / 2.0); + ComfortControlledZone.ControlType.allocate(ComfortControlledZone.NumControlTypes); + ComfortControlledZone.ControlTypeName.allocate(ComfortControlledZone.NumControlTypes); + ComfortControlledZone.ControlTypeSchIndx.allocate(ComfortControlledZone.NumControlTypes); + + for (ControlTypeNum = 1; ControlTypeNum <= ComfortControlledZone.NumControlTypes; ++ControlTypeNum) { + ComfortControlledZone.ControlType(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 5)); + ComfortControlledZone.ControlTypeName(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum + 5)); + if (ComfortControlledZone.ControlType(ControlTypeNum) != "") { + CTIndex = getEnumValue(ValidComfortControlTypesUC, Util::makeUPPER(ComfortControlledZone.ControlType(ControlTypeNum))); if (CTIndex == 0) { ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\"", @@ -1286,7 +1268,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaFieldNames(nint(2.0 * ControlTypeNum - 1 + 5)))); ErrorsFound = true; } - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchIndx(ControlTypeNum) = 0; + ComfortControlledZone.ControlTypeSchIndx(ControlTypeNum) = 0; } } } // NumComfortTStatStatements @@ -1483,48 +1465,45 @@ void GetZoneAirSetPoints(EnergyPlusData &state) // Finish filling in Schedule pointing indexes for Thermal Comfort Control for (ComfortControlledZoneNum = 1; ComfortControlledZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++ComfortControlledZoneNum) { + auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); int ComfortIndex = Util::FindItem(ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)], - ComfortControlledZone(ComfortControlledZoneNum).ControlType, - ComfortControlledZone(ComfortControlledZoneNum).NumControlTypes); - ComfortControlledZone(ComfortControlledZoneNum).SchIndx_SingleHeating = ComfortIndex; + ComfortControlledZone.ControlType, + ComfortControlledZone.NumControlTypes); + ComfortControlledZone.SchIndx_SingleHeating = ComfortIndex; if (ComfortIndex > 0) { - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchIndx(ComfortIndex) = - Util::FindItem(ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ComfortIndex), - state.dataZoneTempPredictorCorrector->SetPointSingleHeatingFanger); + ComfortControlledZone.ControlTypeSchIndx(ComfortIndex) = Util::FindItem( + ComfortControlledZone.ControlTypeName(ComfortIndex), state.dataZoneTempPredictorCorrector->SetPointSingleHeatingFanger); TComfortControlTypes(ComfortControlledZoneNum).MustHave[static_cast(HVAC::ThermostatType::SingleHeating)] = true; } ComfortIndex = Util::FindItem(ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)], - ComfortControlledZone(ComfortControlledZoneNum).ControlType, - ComfortControlledZone(ComfortControlledZoneNum).NumControlTypes); - ComfortControlledZone(ComfortControlledZoneNum).SchIndx_SingleCooling = ComfortIndex; + ComfortControlledZone.ControlType, + ComfortControlledZone.NumControlTypes); + ComfortControlledZone.SchIndx_SingleCooling = ComfortIndex; if (ComfortIndex > 0) { - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchIndx(ComfortIndex) = - Util::FindItem(ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ComfortIndex), - state.dataZoneTempPredictorCorrector->SetPointSingleCoolingFanger); + ComfortControlledZone.ControlTypeSchIndx(ComfortIndex) = Util::FindItem( + ComfortControlledZone.ControlTypeName(ComfortIndex), state.dataZoneTempPredictorCorrector->SetPointSingleCoolingFanger); TComfortControlTypes(ComfortControlledZoneNum).MustHave[static_cast(HVAC::ThermostatType::SingleCooling)] = true; } ComfortIndex = Util::FindItem(ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)], - ComfortControlledZone(ComfortControlledZoneNum).ControlType, - ComfortControlledZone(ComfortControlledZoneNum).NumControlTypes); - ComfortControlledZone(ComfortControlledZoneNum).SchIndx_SingleHeatCool = ComfortIndex; + ComfortControlledZone.ControlType, + ComfortControlledZone.NumControlTypes); + ComfortControlledZone.SchIndx_SingleHeatCool = ComfortIndex; if (ComfortIndex > 0) { - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchIndx(ComfortIndex) = - Util::FindItem(ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ComfortIndex), - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCoolFanger); + ComfortControlledZone.ControlTypeSchIndx(ComfortIndex) = Util::FindItem( + ComfortControlledZone.ControlTypeName(ComfortIndex), state.dataZoneTempPredictorCorrector->SetPointSingleHeatCoolFanger); TComfortControlTypes(ComfortControlledZoneNum).MustHave[static_cast(HVAC::ThermostatType::SingleHeatCool)] = true; } ComfortIndex = Util::FindItem(ValidComfortControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)], - ComfortControlledZone(ComfortControlledZoneNum).ControlType, - ComfortControlledZone(ComfortControlledZoneNum).NumControlTypes); - ComfortControlledZone(ComfortControlledZoneNum).SchIndx_DualSetPointWithDeadBand = ComfortIndex; + ComfortControlledZone.ControlType, + ComfortControlledZone.NumControlTypes); + ComfortControlledZone.SchIndx_DualSetPointWithDeadBand = ComfortIndex; if (ComfortIndex > 0) { - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchIndx(ComfortIndex) = - Util::FindItem(ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ComfortIndex), - state.dataZoneTempPredictorCorrector->SetPointDualHeatCoolFanger); + ComfortControlledZone.ControlTypeSchIndx(ComfortIndex) = + Util::FindItem(ComfortControlledZone.ControlTypeName(ComfortIndex), state.dataZoneTempPredictorCorrector->SetPointDualHeatCoolFanger); TComfortControlTypes(ComfortControlledZoneNum).MustHave[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)] = true; } } @@ -1532,16 +1511,17 @@ void GetZoneAirSetPoints(EnergyPlusData &state) // Now, Check the schedule values/indices for validity for Thermal Comfort Control for (ComfortControlledZoneNum = 1; ComfortControlledZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++ComfortControlledZoneNum) { + auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); - ActualZoneNum = ComfortControlledZone(ComfortControlledZoneNum).ActualZoneNum; - CTIndex = ComfortControlledZone(ComfortControlledZoneNum).ComfortSchedIndex; + ActualZoneNum = ComfortControlledZone.ActualZoneNum; + CTIndex = ComfortControlledZone.ComfortSchedIndex; if (CTIndex == 0) continue; // error will be caught elsewhere SchedMin = GetScheduleMinValue(state, CTIndex); SchedMax = GetScheduleMaxValue(state, CTIndex); if (SchedMin == 0 && SchedMax == 0) { if (FindNumberInList(CTIndex, CCmSchedMapToControlledZone, state.dataZoneCtrls->NumComfortControlledZones) == 0) { - ShowWarningError(state, format("Control Type Schedule={}", ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ShowWarningError(state, format("Control Type Schedule={}", ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, "..specifies control type 0 for all entries."); ShowContinueError(state, "All zones using this Control Type Schedule have no thermal comfort control."); } @@ -1555,111 +1535,105 @@ void GetZoneAirSetPoints(EnergyPlusData &state) case HVAC::ThermostatType::Uncontrolled: break; case HVAC::ThermostatType::SingleHeating: - ComfortIndex = ComfortControlledZone(ComfortControlledZoneNum).SchIndx_SingleHeating; + ComfortIndex = ComfortControlledZone.SchIndx_SingleHeating; TComfortControlTypes(ComfortControlledZoneNum).DidHave[static_cast(HVAC::ThermostatType::SingleHeating)] = true; if (ComfortIndex != 0) { - SchedTypeIndex = ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchIndx(ComfortIndex); + SchedTypeIndex = ComfortControlledZone.ControlTypeSchIndx(ComfortIndex); if (SchedTypeIndex == 0) { ShowSevereError(state, format("GetZoneAirSetpoints: Could not find {} Schedule={}", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)], - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ComfortIndex))); + ComfortControlledZone.ControlTypeName(ComfortIndex))); ErrorsFound = true; } } else { // ComfortIndex = 0 if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleHeating))) { - ShowSevereError(state, - format("Control Type Schedule={}", ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ShowSevereError(state, format("Control Type Schedule={}", ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("..specifies thermal control type 1 ({}) as the control type. Not valid for this zone.", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), - ComfortControlledZone(ComfortControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone(ComfortControlledZoneNum).ZoneName)); + ShowContinueError( + state, + format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); ErrorsFound = true; } } break; case HVAC::ThermostatType::SingleCooling: - ComfortIndex = ComfortControlledZone(ComfortControlledZoneNum).SchIndx_SingleCooling; + ComfortIndex = ComfortControlledZone.SchIndx_SingleCooling; TComfortControlTypes(ComfortControlledZoneNum).DidHave[static_cast(HVAC::ThermostatType::SingleCooling)] = true; if (ComfortIndex != 0) { - SchedTypeIndex = ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchIndx(ComfortIndex); + SchedTypeIndex = ComfortControlledZone.ControlTypeSchIndx(ComfortIndex); if (SchedTypeIndex == 0) { ShowSevereError(state, format("GetZoneAirSetpoints: Could not find {} Schedule={}", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)], - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ComfortIndex))); + ComfortControlledZone.ControlTypeName(ComfortIndex))); ErrorsFound = true; } } else { // ComfortIndex = 0 if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleCooling))) { - ShowSevereError(state, - format("Control Type Schedule={}", ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ShowSevereError(state, format("Control Type Schedule={}", ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("..specifies thermal control type 2 ({}) as the control type. Not valid for this zone.", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), - ComfortControlledZone(ComfortControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone(ComfortControlledZoneNum).ZoneName)); + ShowContinueError( + state, + format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); ErrorsFound = true; } } break; case HVAC::ThermostatType::SingleHeatCool: - ComfortIndex = ComfortControlledZone(ComfortControlledZoneNum).SchIndx_SingleHeatCool; + ComfortIndex = ComfortControlledZone.SchIndx_SingleHeatCool; TComfortControlTypes(ComfortControlledZoneNum).DidHave[static_cast(HVAC::ThermostatType::SingleHeatCool)] = true; if (ComfortIndex != 0) { - SchedTypeIndex = ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchIndx(ComfortIndex); + SchedTypeIndex = ComfortControlledZone.ControlTypeSchIndx(ComfortIndex); if (SchedTypeIndex == 0) { ShowSevereError(state, format("GetZoneAirSetpoints: Could not find {} Schedule={}", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)], - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ComfortIndex))); + ComfortControlledZone.ControlTypeName(ComfortIndex))); ErrorsFound = true; } } else { // ComfortIndex = 0 if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleHeatCool))) { - ShowSevereError(state, format("Schedule={}", ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ShowSevereError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("..specifies thermal control type 3 ({}) as the control type. Not valid for this zone.", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), - ComfortControlledZone(ComfortControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone(ComfortControlledZoneNum).ZoneName)); + ShowContinueError( + state, + format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); ErrorsFound = true; } } break; case HVAC::ThermostatType::DualSetPointWithDeadBand: - ComfortIndex = ComfortControlledZone(ComfortControlledZoneNum).SchIndx_DualSetPointWithDeadBand; + ComfortIndex = ComfortControlledZone.SchIndx_DualSetPointWithDeadBand; TComfortControlTypes(ComfortControlledZoneNum).DidHave[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)] = true; if (ComfortIndex != 0) { - SchedTypeIndex = ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchIndx(ComfortIndex); + SchedTypeIndex = ComfortControlledZone.ControlTypeSchIndx(ComfortIndex); if (SchedTypeIndex == 0) { ShowSevereError(state, format("GetZoneAirSetpoints: Could not find {} Schedule={}", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)], - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ComfortIndex))); + ComfortControlledZone.ControlTypeName(ComfortIndex))); ErrorsFound = true; } } else { // ComfortIndex = 0 if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand))) { - ShowSevereError(state, format("Schedule={}", ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ShowSevereError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("..specifies thermal control type 4 ({}) as the control type. Not valid for this zone.", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), - ComfortControlledZone(ComfortControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone(ComfortControlledZoneNum).ZoneName)); + ShowContinueError( + state, + format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); ErrorsFound = true; } } @@ -1667,9 +1641,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) default: ShowSevereError(state, format("GetZoneAirSetpoints: Illegal control type for Zone={}, Found value={}, in Schedule={}", - Zone(ActualZoneNum).Name, + state.dataHeatBal->Zone(ActualZoneNum).Name, ControlTypeNum, - ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, "..valid range values are [0,4]."); ErrorsFound = true; break; @@ -1678,9 +1652,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } for (ComfortControlledZoneNum = 1; ComfortControlledZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++ComfortControlledZoneNum) { + auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); - ActualZoneNum = ComfortControlledZone(ComfortControlledZoneNum).ActualZoneNum; - CTIndex = ComfortControlledZone(ComfortControlledZoneNum).ComfortSchedIndex; + ActualZoneNum = ComfortControlledZone.ActualZoneNum; + CTIndex = ComfortControlledZone.ComfortSchedIndex; if (CTIndex == 0) continue; // error caught elsewhere -- would just be confusing here for (ControlTypeNum = 1; ControlTypeNum <= 4; ++ControlTypeNum) { @@ -1691,51 +1666,43 @@ void GetZoneAirSetPoints(EnergyPlusData &state) switch (static_cast(ControlTypeNum)) { case HVAC::ThermostatType::SingleHeating: if (!TComfortControlTypes(ComfortControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ShowWarningError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("...should include control type 1 ({}) but does not.", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), - ComfortControlledZone(ComfortControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone(ComfortControlledZoneNum).ZoneName)); + ShowContinueError( + state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); break; case HVAC::ThermostatType::SingleCooling: if (!TComfortControlTypes(ComfortControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ShowWarningError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("...should include control type 2 ({}) but does not.", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), - ComfortControlledZone(ComfortControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone(ComfortControlledZoneNum).ZoneName)); + ShowContinueError( + state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); break; case HVAC::ThermostatType::SingleHeatCool: if (!TComfortControlTypes(ComfortControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ShowWarningError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("...should include control type 3 ({}) but does not.", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), - ComfortControlledZone(ComfortControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone(ComfortControlledZoneNum).ZoneName)); + ShowContinueError( + state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); break; case HVAC::ThermostatType::DualSetPointWithDeadBand: if (!TComfortControlTypes(ComfortControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", ComfortControlledZone(ComfortControlledZoneNum).ControlTypeSchedName)); + ShowWarningError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); ShowContinueError(state, format("...should include control type 4 ({}) but does not.", ValidComfortControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)])); - ShowContinueError(state, - format("..reference {}={}", - cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), - ComfortControlledZone(ComfortControlledZoneNum).Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone(ComfortControlledZoneNum).ZoneName)); + ShowContinueError( + state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); break; default: break; @@ -1760,10 +1727,11 @@ void GetZoneAirSetPoints(EnergyPlusData &state) if (NumZoneCapaMultiplier == 0) { // Assign default multiplier values to all zones for (int ZoneNum = 1; ZoneNum <= NumOfZones; ZoneNum++) { - Zone(ZoneNum).ZoneVolCapMultpSens = ZoneVolCapMultpSens; - Zone(ZoneNum).ZoneVolCapMultpMoist = ZoneVolCapMultpMoist; - Zone(ZoneNum).ZoneVolCapMultpCO2 = ZoneVolCapMultpCO2; - Zone(ZoneNum).ZoneVolCapMultpGenContam = ZoneVolCapMultpGenContam; + auto &Zone = state.dataHeatBal->Zone(ZoneNum); + Zone.ZoneVolCapMultpSens = ZoneVolCapMultpSens; + Zone.ZoneVolCapMultpMoist = ZoneVolCapMultpMoist; + Zone.ZoneVolCapMultpCO2 = ZoneVolCapMultpCO2; + Zone.ZoneVolCapMultpGenContam = ZoneVolCapMultpGenContam; } } else { @@ -1793,25 +1761,25 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ZoneVolCapMultpGenContam = rNumericArgs(4); } else { // multiplier values for the specified zone(s) - int ZoneNum = 0; ZLItem = 0; - Item1 = Util::FindItemInList(cAlphaArgs(2), Zone); - if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), ZoneList); + Item1 = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); + if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->ZoneList); if (Item1 > 0) { - ZoneNum = Item1; - Zone(ZoneNum).FlagCustomizedZoneCap = true; - Zone(ZoneNum).ZoneVolCapMultpSens = rNumericArgs(1); - Zone(ZoneNum).ZoneVolCapMultpMoist = rNumericArgs(2); - Zone(ZoneNum).ZoneVolCapMultpCO2 = rNumericArgs(3); - Zone(ZoneNum).ZoneVolCapMultpGenContam = rNumericArgs(4); + auto &Zone = state.dataHeatBal->Zone(Item1); + Zone.FlagCustomizedZoneCap = true; + Zone.ZoneVolCapMultpSens = rNumericArgs(1); + Zone.ZoneVolCapMultpMoist = rNumericArgs(2); + Zone.ZoneVolCapMultpCO2 = rNumericArgs(3); + Zone.ZoneVolCapMultpGenContam = rNumericArgs(4); } else if (ZLItem > 0) { - for (int ZonePtrNum = 1; ZonePtrNum < ZoneList(ZLItem).NumOfZones; ZonePtrNum++) { - ZoneNum = ZoneList(ZLItem).Zone(ZonePtrNum); - Zone(ZoneNum).FlagCustomizedZoneCap = true; - Zone(ZoneNum).ZoneVolCapMultpSens = rNumericArgs(1); - Zone(ZoneNum).ZoneVolCapMultpMoist = rNumericArgs(2); - Zone(ZoneNum).ZoneVolCapMultpCO2 = rNumericArgs(3); - Zone(ZoneNum).ZoneVolCapMultpGenContam = rNumericArgs(4); + auto &ZoneList = state.dataHeatBal->ZoneList(ZLItem); + for (int ZonePtrNum = 1; ZonePtrNum < ZoneList.NumOfZones; ZonePtrNum++) { + auto &Zone = state.dataHeatBal->Zone(ZoneList.Zone(ZonePtrNum)); + Zone.FlagCustomizedZoneCap = true; + Zone.ZoneVolCapMultpSens = rNumericArgs(1); + Zone.ZoneVolCapMultpMoist = rNumericArgs(2); + Zone.ZoneVolCapMultpCO2 = rNumericArgs(3); + Zone.ZoneVolCapMultpGenContam = rNumericArgs(4); } } else { @@ -1825,11 +1793,12 @@ void GetZoneAirSetPoints(EnergyPlusData &state) // Assign default multiplier values to all the other zones for (int ZoneNum = 1; ZoneNum <= NumOfZones; ZoneNum++) { - if (!Zone(ZoneNum).FlagCustomizedZoneCap) { - Zone(ZoneNum).ZoneVolCapMultpSens = ZoneVolCapMultpSens; - Zone(ZoneNum).ZoneVolCapMultpMoist = ZoneVolCapMultpMoist; - Zone(ZoneNum).ZoneVolCapMultpCO2 = ZoneVolCapMultpCO2; - Zone(ZoneNum).ZoneVolCapMultpGenContam = ZoneVolCapMultpGenContam; + auto &Zone = state.dataHeatBal->Zone(ZoneNum); + if (!Zone.FlagCustomizedZoneCap) { + Zone.ZoneVolCapMultpSens = ZoneVolCapMultpSens; + Zone.ZoneVolCapMultpMoist = ZoneVolCapMultpMoist; + Zone.ZoneVolCapMultpCO2 = ZoneVolCapMultpCO2; + Zone.ZoneVolCapMultpGenContam = ZoneVolCapMultpGenContam; } } @@ -1841,10 +1810,11 @@ void GetZoneAirSetPoints(EnergyPlusData &state) Real64 ZoneVolCapMultpGenContam_temp = 0.0; for (int ZoneNum = 1; ZoneNum <= NumOfZones; ZoneNum++) { - ZoneVolCapMultpSens_temp += Zone(ZoneNum).ZoneVolCapMultpSens; - ZoneVolCapMultpMoist_temp += Zone(ZoneNum).ZoneVolCapMultpMoist; - ZoneVolCapMultpCO2_temp += Zone(ZoneNum).ZoneVolCapMultpCO2; - ZoneVolCapMultpGenContam_temp += Zone(ZoneNum).ZoneVolCapMultpGenContam; + auto const &Zone = state.dataHeatBal->Zone(ZoneNum); + ZoneVolCapMultpSens_temp += Zone.ZoneVolCapMultpSens; + ZoneVolCapMultpMoist_temp += Zone.ZoneVolCapMultpMoist; + ZoneVolCapMultpCO2_temp += Zone.ZoneVolCapMultpCO2; + ZoneVolCapMultpGenContam_temp += Zone.ZoneVolCapMultpGenContam; } if (NumOfZones > 0) { @@ -1879,10 +1849,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaFieldNames, cNumericFieldNames); // find matching name of ZONECONTROL:THERMOSTAT object - found = Util::FindItem(cAlphaArgs(1), TStatObjects); + found = Util::FindItem(cAlphaArgs(1), state.dataZoneCtrls->TStatObjects); if (found == 0) { // It might be in the TempControlledZones - found = Util::FindItem(cAlphaArgs(1), TempControlledZone); + found = Util::FindItem(cAlphaArgs(1), state.dataZoneCtrls->TempControlledZone); if (found == 0) { // throw error ShowSevereError(state, format("{}={} invalid {} reference not found.", @@ -1891,10 +1861,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cZControlTypes(static_cast(ZoneControlTypes::TStat)))); ErrorsFound = true; } else { - TempControlledZoneNum = found; - TempControlledZone(TempControlledZoneNum).OperativeTempControl = true; + auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(found); + TempControlledZone.OperativeTempControl = true; if (Util::SameString(cAlphaArgs(2), "Scheduled")) { - TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled = true; + TempControlledZone.OpTempCntrlModeScheduled = true; } if ((!(Util::SameString(cAlphaArgs(2), "Scheduled"))) && (!(Util::SameString(cAlphaArgs(2), "Constant")))) { ShowSevereError(state, @@ -1902,10 +1872,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } - TempControlledZone(TempControlledZoneNum).FixedRadiativeFraction = rNumericArgs(1); - TempControlledZone(TempControlledZoneNum).OpTempRadiativeFractionSched = GetScheduleIndex(state, cAlphaArgs(3)); - if ((TempControlledZone(TempControlledZoneNum).OpTempRadiativeFractionSched == 0) && - (TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled)) { // throw error + TempControlledZone.FixedRadiativeFraction = rNumericArgs(1); + TempControlledZone.OpTempRadiativeFractionSched = GetScheduleIndex(state, cAlphaArgs(3)); + if ((TempControlledZone.OpTempRadiativeFractionSched == 0) && (TempControlledZone.OpTempCntrlModeScheduled)) { // throw error ShowSevereError( state, format("{}={} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); @@ -1913,8 +1882,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } // check validity of fixed radiative fraction - if ((TempControlledZone(TempControlledZoneNum).FixedRadiativeFraction < 0.0) && - (!(TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled))) { + if ((TempControlledZone.FixedRadiativeFraction < 0.0) && (!(TempControlledZone.OpTempCntrlModeScheduled))) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot be negative.", cCurrentModuleObject, @@ -1923,8 +1891,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) rNumericArgs(1))); ErrorsFound = true; } - if ((TempControlledZone(TempControlledZoneNum).FixedRadiativeFraction >= 0.9) && - (!(TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled))) { + if ((TempControlledZone.FixedRadiativeFraction >= 0.9) && (!(TempControlledZone.OpTempCntrlModeScheduled))) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot >= .9.", cCurrentModuleObject, @@ -1935,9 +1902,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } // check schedule min max. - if (TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled) { - ValidRadFractSched = CheckScheduleValueMinMax( - state, TempControlledZone(TempControlledZoneNum).OpTempRadiativeFractionSched, ">=", 0.0, "<", 0.9); + if (TempControlledZone.OpTempCntrlModeScheduled) { + bool ValidRadFractSched = + CheckScheduleValueMinMax(state, TempControlledZone.OpTempRadiativeFractionSched, ">=", 0.0, "<", 0.9); if (!ValidRadFractSched) { ShowSevereError( state, @@ -1949,7 +1916,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) // added Jan, 2017 - Xuan Luo // read adaptive comfort model and calculate adaptive thermal comfort setpoint - if (TempControlledZone(TempControlledZoneNum).OperativeTempControl) { + if (TempControlledZone.OperativeTempControl) { if (NumAlphas >= 4 && !lAlphaFieldBlanks(4)) { int adaptiveComfortModelTypeIndex = Util::FindItem(cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); @@ -1962,8 +1929,8 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaArgs(4))); ErrorsFound = true; } else if (adaptiveComfortModelTypeIndex != static_cast(AdaptiveComfortModel::ADAP_NONE)) { - TempControlledZone(TempControlledZoneNum).AdaptiveComfortTempControl = true; - TempControlledZone(TempControlledZoneNum).AdaptiveComfortModelTypeIndex = + TempControlledZone.AdaptiveComfortTempControl = true; + TempControlledZone.AdaptiveComfortModelTypeIndex = Util::FindItem(cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); if (!state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.initialized) { Array1D runningAverageASH(state.dataWeather->NumDaysInYear, 0.0); @@ -1979,18 +1946,20 @@ void GetZoneAirSetPoints(EnergyPlusData &state) SetupOutputVariable(state, "Zone Thermostat Operative Temperature", Constant::Units::C, - state.dataHeatBal->ZnAirRpt(TempControlledZone(TempControlledZoneNum).ActualZoneNum).ThermOperativeTemp, + state.dataHeatBal->ZnAirRpt(TempControlledZone.ActualZoneNum).ThermOperativeTemp, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - Zone(TempControlledZone(TempControlledZoneNum).ActualZoneNum).Name); + state.dataHeatBal->Zone(TempControlledZone.ActualZoneNum).Name); } } else { - for (Item = 1; Item <= TStatObjects(found).NumOfZones; ++Item) { - TempControlledZoneNum = TStatObjects(found).TempControlledZoneStartPtr + Item - 1; + auto const &TStatObjects = state.dataZoneCtrls->TStatObjects(found); + for (Item = 1; Item <= TStatObjects.NumOfZones; ++Item) { + TempControlledZoneNum = TStatObjects.TempControlledZoneStartPtr + Item - 1; + auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); if (state.dataZoneCtrls->NumTempControlledZones == 0) continue; - TempControlledZone(TempControlledZoneNum).OperativeTempControl = true; + TempControlledZone.OperativeTempControl = true; if (Util::SameString(cAlphaArgs(2), "Scheduled")) { - TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled = true; + TempControlledZone.OpTempCntrlModeScheduled = true; } if (Item == 1) { if ((!(Util::SameString(cAlphaArgs(2), "Scheduled"))) && (!(Util::SameString(cAlphaArgs(2), "Constant")))) { @@ -2000,23 +1969,18 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } } - TempControlledZone(TempControlledZoneNum).FixedRadiativeFraction = rNumericArgs(1); - TempControlledZone(TempControlledZoneNum).OpTempRadiativeFractionSched = GetScheduleIndex(state, cAlphaArgs(3)); + TempControlledZone.FixedRadiativeFraction = rNumericArgs(1); + TempControlledZone.OpTempRadiativeFractionSched = GetScheduleIndex(state, cAlphaArgs(3)); if (Item == 1) { - if ((TempControlledZone(TempControlledZoneNum).OpTempRadiativeFractionSched == 0) && - (TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled)) { // throw error + if ((TempControlledZone.OpTempRadiativeFractionSched == 0) && (TempControlledZone.OpTempCntrlModeScheduled)) { // throw error ShowSevereError( state, format( "{}={} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); ErrorsFound = true; } - } - - // check validity of fixed radiative fraction - if (Item == 1) { - if ((TempControlledZone(TempControlledZoneNum).FixedRadiativeFraction < 0.0) && - (!(TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled))) { + // check validity of fixed radiative fraction + if ((TempControlledZone.FixedRadiativeFraction < 0.0) && (!(TempControlledZone.OpTempCntrlModeScheduled))) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot be negative.", cCurrentModuleObject, @@ -2025,10 +1989,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) rNumericArgs(1))); ErrorsFound = true; } - } - if (Item == 1) { - if ((TempControlledZone(TempControlledZoneNum).FixedRadiativeFraction >= 0.9) && - (!(TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled))) { + if ((TempControlledZone.FixedRadiativeFraction >= 0.9) && (!(TempControlledZone.OpTempCntrlModeScheduled))) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot >= .9.", cCurrentModuleObject, @@ -2037,13 +1998,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) rNumericArgs(1))); ErrorsFound = true; } - } - - // check schedule min max. - if (Item == 1) { - if (TempControlledZone(TempControlledZoneNum).OpTempCntrlModeScheduled) { - ValidRadFractSched = CheckScheduleValueMinMax( - state, TempControlledZone(TempControlledZoneNum).OpTempRadiativeFractionSched, ">=", 0.0, "<", 0.9); + // check schedule min max. + if (TempControlledZone.OpTempCntrlModeScheduled) { + bool ValidRadFractSched = + CheckScheduleValueMinMax(state, TempControlledZone.OpTempRadiativeFractionSched, ">=", 0.0, "<", 0.9); if (!ValidRadFractSched) { ShowSevereError( state, @@ -2057,7 +2015,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) // added Jan, 2017 - Xuan Luo // read adaptive comfort model and calculate adaptive thermal comfort setpoint - if (TempControlledZone(TempControlledZoneNum).OperativeTempControl) { + if (TempControlledZone.OperativeTempControl) { if (NumAlphas >= 4 && !lAlphaFieldBlanks(4)) { int adaptiveComfortModelTypeIndex = Util::FindItem(cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); @@ -2070,8 +2028,8 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaArgs(4))); ErrorsFound = true; } else if (adaptiveComfortModelTypeIndex != static_cast(AdaptiveComfortModel::ADAP_NONE)) { - TempControlledZone(TempControlledZoneNum).AdaptiveComfortTempControl = true; - TempControlledZone(TempControlledZoneNum).AdaptiveComfortModelTypeIndex = + TempControlledZone.AdaptiveComfortTempControl = true; + TempControlledZone.AdaptiveComfortModelTypeIndex = Util::FindItem(cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); if (!state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.initialized) { Array1D runningAverageASH(state.dataWeather->NumDaysInYear, 0.0); @@ -2087,10 +2045,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) SetupOutputVariable(state, "Zone Thermostat Operative Temperature", Constant::Units::C, - state.dataHeatBal->ZnAirRpt(TempControlledZone(TempControlledZoneNum).ActualZoneNum).ThermOperativeTemp, + state.dataHeatBal->ZnAirRpt(TempControlledZone.ActualZoneNum).ThermOperativeTemp, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - Zone(TempControlledZone(TempControlledZoneNum).ActualZoneNum).Name); + state.dataHeatBal->Zone(TempControlledZone.ActualZoneNum).Name); } // TStat Objects Loop } // found thermostat referene } // loop over NumOpTempControlledZones @@ -2117,10 +2075,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) cAlphaFieldNames, cNumericFieldNames); // find matching name of ZONECONTROL:THERMOSTAT object - found = Util::FindItem(cAlphaArgs(1), TStatObjects); + found = Util::FindItem(cAlphaArgs(1), state.dataZoneCtrls->TStatObjects); if (found == 0) { // It might be in the TempControlledZones - found = Util::FindItem(cAlphaArgs(1), TempControlledZone); + found = Util::FindItem(cAlphaArgs(1), state.dataZoneCtrls->TempControlledZone); if (found == 0) { // throw error ShowSevereError(state, format("{}={} invalid {} reference not found.", @@ -2130,20 +2088,21 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } else { TempControlledZoneNum = found; - TempControlledZone(TempControlledZoneNum).DehumidifyingSched = cAlphaArgs(2); - TempControlledZone(TempControlledZoneNum).DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (TempControlledZone(TempControlledZoneNum).DehumidifyingSchedIndex == 0) { + auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + TempControlledZone.DehumidifyingSched = cAlphaArgs(2); + TempControlledZone.DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); + if (TempControlledZone.DehumidifyingSchedIndex == 0) { ShowSevereError( state, format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); ErrorsFound = true; } - TempControlledZone(TempControlledZoneNum).ZoneOvercoolControl = true; + TempControlledZone.ZoneOvercoolControl = true; if ((Util::SameString(cAlphaArgs(3), "None"))) { - TempControlledZone(TempControlledZoneNum).ZoneOvercoolControl = false; + TempControlledZone.ZoneOvercoolControl = false; } if (Util::SameString(cAlphaArgs(4), "Scheduled")) { - TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled = true; + TempControlledZone.OvercoolCntrlModeScheduled = true; } if ((!(Util::SameString(cAlphaArgs(4), "Scheduled"))) && (!(Util::SameString(cAlphaArgs(4), "Constant")))) { ShowSevereError(state, @@ -2151,10 +2110,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } - TempControlledZone(TempControlledZoneNum).ZoneOvercoolConstRange = rNumericArgs(1); - TempControlledZone(TempControlledZoneNum).ZoneOvercoolRangeSchedIndex = GetScheduleIndex(state, cAlphaArgs(4)); - if ((TempControlledZone(TempControlledZoneNum).ZoneOvercoolRangeSchedIndex == 0) && - (TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled)) { // throw error + TempControlledZone.ZoneOvercoolConstRange = rNumericArgs(1); + TempControlledZone.ZoneOvercoolRangeSchedIndex = GetScheduleIndex(state, cAlphaArgs(4)); + if ((TempControlledZone.ZoneOvercoolRangeSchedIndex == 0) && (TempControlledZone.OvercoolCntrlModeScheduled)) { // throw error ShowSevereError( state, format("{}={} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(5), cAlphaArgs(5))); @@ -2162,8 +2120,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } // check validity of zone Overcool constant range - if ((TempControlledZone(TempControlledZoneNum).ZoneOvercoolConstRange < 0.0) && - (!(TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled))) { + if ((TempControlledZone.ZoneOvercoolConstRange < 0.0) && (!(TempControlledZone.OvercoolCntrlModeScheduled))) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot be negative.", cCurrentModuleObject, @@ -2172,8 +2129,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) rNumericArgs(1))); ErrorsFound = true; } - if ((TempControlledZone(TempControlledZoneNum).ZoneOvercoolConstRange > 3.0) && - (!(TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled))) { + if ((TempControlledZone.ZoneOvercoolConstRange > 3.0) && (!(TempControlledZone.OvercoolCntrlModeScheduled))) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot be > 3.0", cCurrentModuleObject, @@ -2184,9 +2140,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } // check zone Overcool range schedule min/max values. - if (TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled) { - ValidZoneOvercoolRangeSched = CheckScheduleValueMinMax( - state, TempControlledZone(TempControlledZoneNum).ZoneOvercoolRangeSchedIndex, ">=", 0.0, "<=", 3.0); + if (TempControlledZone.OvercoolCntrlModeScheduled) { + bool ValidZoneOvercoolRangeSched = + CheckScheduleValueMinMax(state, TempControlledZone.ZoneOvercoolRangeSchedIndex, ">=", 0.0, "<=", 3.0); if (!ValidZoneOvercoolRangeSched) { ShowSevereError( state, @@ -2196,8 +2152,8 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } } // check Overcool Control Ratio limits - TempControlledZone(TempControlledZoneNum).ZoneOvercoolControlRatio = rNumericArgs(2); - if (TempControlledZone(TempControlledZoneNum).ZoneOvercoolControlRatio < 0.0) { + TempControlledZone.ZoneOvercoolControlRatio = rNumericArgs(2); + if (TempControlledZone.ZoneOvercoolControlRatio < 0.0) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot be negative.", cCurrentModuleObject, @@ -2208,22 +2164,24 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } } } else { - for (Item = 1; Item <= TStatObjects(found).NumOfZones; ++Item) { - TempControlledZoneNum = TStatObjects(found).TempControlledZoneStartPtr + Item - 1; - TempControlledZone(TempControlledZoneNum).DehumidifyingSched = cAlphaArgs(2); - TempControlledZone(TempControlledZoneNum).DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (TempControlledZone(TempControlledZoneNum).DehumidifyingSchedIndex == 0) { + auto const &TStatObjects = state.dataZoneCtrls->TStatObjects(found); + for (Item = 1; Item <= TStatObjects.NumOfZones; ++Item) { + TempControlledZoneNum = TStatObjects.TempControlledZoneStartPtr + Item - 1; + auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + TempControlledZone.DehumidifyingSched = cAlphaArgs(2); + TempControlledZone.DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); + if (TempControlledZone.DehumidifyingSchedIndex == 0) { ShowSevereError( state, format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); ErrorsFound = true; } - TempControlledZone(TempControlledZoneNum).ZoneOvercoolControl = true; + TempControlledZone.ZoneOvercoolControl = true; if ((Util::SameString(cAlphaArgs(3), "None"))) { - TempControlledZone(TempControlledZoneNum).ZoneOvercoolControl = false; + TempControlledZone.ZoneOvercoolControl = false; } if (Util::SameString(cAlphaArgs(4), "Scheduled")) { - TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled = false; + TempControlledZone.OvercoolCntrlModeScheduled = false; } if (Item == 1) { if ((!(Util::SameString(cAlphaArgs(4), "Scheduled"))) && (!(Util::SameString(cAlphaArgs(4), "Constant")))) { @@ -2232,22 +2190,18 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } } - TempControlledZone(TempControlledZoneNum).ZoneOvercoolConstRange = rNumericArgs(1); - TempControlledZone(TempControlledZoneNum).ZoneOvercoolRangeSchedIndex = GetScheduleIndex(state, cAlphaArgs(6)); + TempControlledZone.ZoneOvercoolConstRange = rNumericArgs(1); + TempControlledZone.ZoneOvercoolRangeSchedIndex = GetScheduleIndex(state, cAlphaArgs(6)); if (Item == 1) { - if ((TempControlledZone(TempControlledZoneNum).ZoneOvercoolRangeSchedIndex == 0) && - (TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled)) { // throw error + if ((TempControlledZone.ZoneOvercoolRangeSchedIndex == 0) && (TempControlledZone.OvercoolCntrlModeScheduled)) { // throw error ShowSevereError( state, format( "{}={} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(5), cAlphaArgs(5))); ErrorsFound = true; } - } - // check validity of zone Overcool constant range - if (Item == 1) { - if ((TempControlledZone(TempControlledZoneNum).ZoneOvercoolConstRange < 0.0) && - (!(TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled))) { + // check validity of zone Overcool constant range + if ((TempControlledZone.ZoneOvercoolConstRange < 0.0) && (!(TempControlledZone.OvercoolCntrlModeScheduled))) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot be negative.", cCurrentModuleObject, @@ -2256,10 +2210,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) rNumericArgs(1))); ErrorsFound = true; } - } - if (Item == 1) { - if ((TempControlledZone(TempControlledZoneNum).ZoneOvercoolConstRange > 3.0) && - (!(TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled))) { + if ((TempControlledZone.ZoneOvercoolConstRange > 3.0) && (!(TempControlledZone.OvercoolCntrlModeScheduled))) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot > 3.0", cCurrentModuleObject, @@ -2268,12 +2219,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) rNumericArgs(1))); ErrorsFound = true; } - } - // check zone Overcool range schedule min/max values. - if (Item == 1) { - if (TempControlledZone(TempControlledZoneNum).OvercoolCntrlModeScheduled) { - ValidZoneOvercoolRangeSched = CheckScheduleValueMinMax( - state, TempControlledZone(TempControlledZoneNum).ZoneOvercoolRangeSchedIndex, ">=", 0.0, "<=", 3.0); + // check zone Overcool range schedule min/max values. + if (TempControlledZone.OvercoolCntrlModeScheduled) { + bool ValidZoneOvercoolRangeSched = + CheckScheduleValueMinMax(state, TempControlledZone.ZoneOvercoolRangeSchedIndex, ">=", 0.0, "<=", 3.0); if (!ValidZoneOvercoolRangeSched) { ShowSevereError( state, @@ -2284,10 +2233,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } } } - TempControlledZone(TempControlledZoneNum).ZoneOvercoolControlRatio = rNumericArgs(2); + TempControlledZone.ZoneOvercoolControlRatio = rNumericArgs(2); // check Overcool Control Ratio limits if (Item == 1) { - if (TempControlledZone(TempControlledZoneNum).ZoneOvercoolControlRatio < 0.0) { + if (TempControlledZone.ZoneOvercoolControlRatio < 0.0) { ShowSevereError(state, format("{}={} invalid {}=[{:.2T}\" cannot be negative.", cCurrentModuleObject, @@ -2326,9 +2275,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); state.dataZoneCtrls->StagedTStatObjects(Item).Name = cAlphaArgs(1); - Item1 = Util::FindItemInList(cAlphaArgs(2), Zone); + Item1 = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); ZLItem = 0; - if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), ZoneList); + if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->ZoneList); if (Item1 > 0) { state.dataZoneCtrls->StagedTStatObjects(Item).StageControlledZoneStartPtr = state.dataZoneTempPredictorCorrector->NumStageCtrZone + 1; ++state.dataZoneTempPredictorCorrector->NumStageCtrZone; @@ -2336,9 +2285,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) state.dataZoneCtrls->StagedTStatObjects(Item).ZoneListActive = false; state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr = Item1; } else if (ZLItem > 0) { + auto const &ZoneList = state.dataHeatBal->ZoneList(ZLItem); state.dataZoneCtrls->StagedTStatObjects(Item).TempControlledZoneStartPtr = state.dataZoneTempPredictorCorrector->NumStageCtrZone + 1; - state.dataZoneTempPredictorCorrector->NumStageCtrZone += ZoneList(ZLItem).NumOfZones; - state.dataZoneCtrls->StagedTStatObjects(Item).NumOfZones = ZoneList(ZLItem).NumOfZones; + state.dataZoneTempPredictorCorrector->NumStageCtrZone += ZoneList.NumOfZones; + state.dataZoneCtrls->StagedTStatObjects(Item).NumOfZones = ZoneList.NumOfZones; state.dataZoneCtrls->StagedTStatObjects(Item).ZoneListActive = true; state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr = ZLItem; } else { @@ -2355,10 +2305,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } if (state.dataZoneTempPredictorCorrector->NumStageCtrZone > 0) { - StageControlledZone.allocate(state.dataZoneTempPredictorCorrector->NumStageCtrZone); + state.dataZoneCtrls->StageControlledZone.allocate(state.dataZoneTempPredictorCorrector->NumStageCtrZone); state.dataZoneCtrls->StageZoneLogic.dimension(NumOfZones, false); - StageControlledZoneNum = 0; + int StageControlledZoneNum = 0; for (Item = 1; Item <= NumStageControlledZones; ++Item) { inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -2375,56 +2325,61 @@ void GetZoneAirSetPoints(EnergyPlusData &state) for (Item1 = 1; Item1 <= state.dataZoneCtrls->StagedTStatObjects(Item).NumOfZones; ++Item1) { ++StageControlledZoneNum; if (state.dataZoneCtrls->StagedTStatObjects(Item).ZoneListActive) { - cAlphaArgs(2) = - state.dataHeatBal->Zone(ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name; - } - int ZoneAssigned = Util::FindItemInList( - cAlphaArgs(2), StageControlledZone, &DataZoneControls::ZoneStagedControls::ZoneName, StageControlledZoneNum - 1); + auto &ZoneList = state.dataHeatBal->ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr); + cAlphaArgs(2) = state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name; + } + int ZoneAssigned = Util::FindItemInList(cAlphaArgs(2), + state.dataZoneCtrls->StageControlledZone, + &DataZoneControls::ZoneStagedControls::ZoneName, + StageControlledZoneNum - 1); + auto &stageControlledZone = state.dataZoneCtrls->StageControlledZone(StageControlledZoneNum); if (ZoneAssigned == 0) { - StageControlledZone(StageControlledZoneNum).ZoneName = cAlphaArgs(2); - StageControlledZone(StageControlledZoneNum).ActualZoneNum = Util::FindItemInList(cAlphaArgs(2), Zone); - if (StageControlledZone(StageControlledZoneNum).ActualZoneNum == 0) { + stageControlledZone.ZoneName = cAlphaArgs(2); + stageControlledZone.ActualZoneNum = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); + if (stageControlledZone.ActualZoneNum == 0) { ShowSevereError( state, format( "{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); ErrorsFound = true; } else { - // Zone(StageControlledZone(StageControlledZoneNum)%ActualZoneNum)%StageControlledZoneIndex = + // Zone(stageControlledZone%ActualZoneNum)%StageControlledZoneIndex = // StageControlledZoneNum } - state.dataZoneCtrls->StageZoneLogic(StageControlledZone(StageControlledZoneNum).ActualZoneNum) = true; + state.dataZoneCtrls->StageZoneLogic(stageControlledZone.ActualZoneNum) = true; } else { - StageControlledZone(StageControlledZoneNum).ZoneName = cAlphaArgs(2); // for continuity + stageControlledZone.ZoneName = cAlphaArgs(2); // for continuity ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" zone previously assigned.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); - ShowContinueError(state, format("...Zone was previously assigned to Thermostat=\"{}\".", StageControlledZone(ZoneAssigned).Name)); + ShowContinueError( + state, + format("...Zone was previously assigned to Thermostat=\"{}\".", state.dataZoneCtrls->StageControlledZone(ZoneAssigned).Name)); ErrorsFound = true; continue; } if (!state.dataZoneCtrls->StagedTStatObjects(Item).ZoneListActive) { - StageControlledZone(StageControlledZoneNum).Name = cAlphaArgs(1); + stageControlledZone.Name = cAlphaArgs(1); } else { - CheckCreatedZoneItemName( - state, - RoutineName, - cCurrentModuleObject, - state.dataHeatBal->Zone(ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name, - ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr).MaxZoneNameLength, - state.dataZoneCtrls->StagedTStatObjects(Item).Name, - StageControlledZone, - StageControlledZoneNum - 1, - StageControlledZone(StageControlledZoneNum).Name, - errFlag); + auto &ZoneList = state.dataHeatBal->ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr); + CheckCreatedZoneItemName(state, + RoutineName, + cCurrentModuleObject, + state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name, + ZoneList.MaxZoneNameLength, + state.dataZoneCtrls->StagedTStatObjects(Item).Name, + state.dataZoneCtrls->StageControlledZone, + StageControlledZoneNum - 1, + stageControlledZone.Name, + errFlag); if (errFlag) ErrorsFound = true; } - StageControlledZone(StageControlledZoneNum).NumOfHeatStages = rNumericArgs(1); + stageControlledZone.NumOfHeatStages = rNumericArgs(1); if (rNumericArgs(1) < 1 || rNumericArgs(1) > 4) { ShowSevereError( state, @@ -2433,10 +2388,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } - StageControlledZone(StageControlledZoneNum).HeatSetBaseSchedName = cAlphaArgs(3); - StageControlledZone(StageControlledZoneNum).HSBchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); + stageControlledZone.HeatSetBaseSchedName = cAlphaArgs(3); + stageControlledZone.HSBchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); if (Item1 == 1) { // only show error on first of several if zone list - if (StageControlledZone(StageControlledZoneNum).HSBchedIndex == 0) { + if (stageControlledZone.HSBchedIndex == 0) { ShowSevereError( state, format( @@ -2445,7 +2400,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } } - StageControlledZone(StageControlledZoneNum).HeatThroRange = rNumericArgs(2); + stageControlledZone.HeatThroRange = rNumericArgs(2); if (rNumericArgs(1) < 0.0) { ShowSevereError(state, format("{}=\"{}\" negative value is found at {}=\"{:.1R}\"", @@ -2457,10 +2412,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } - if (StageControlledZone(StageControlledZoneNum).NumOfHeatStages > 0) { - StageControlledZone(StageControlledZoneNum).HeatTOffset.allocate(StageControlledZone(StageControlledZoneNum).NumOfHeatStages); - for (i = 1; i <= StageControlledZone(StageControlledZoneNum).NumOfHeatStages; ++i) { - StageControlledZone(StageControlledZoneNum).HeatTOffset(i) = rNumericArgs(2 + i); + if (stageControlledZone.NumOfHeatStages > 0) { + stageControlledZone.HeatTOffset.allocate(stageControlledZone.NumOfHeatStages); + for (i = 1; i <= stageControlledZone.NumOfHeatStages; ++i) { + stageControlledZone.HeatTOffset(i) = rNumericArgs(2 + i); if (rNumericArgs(2 + i) > 0.0) { ShowSevereError(state, format("{}=\"{}\" positive value is found at {}", @@ -2493,7 +2448,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } } - StageControlledZone(StageControlledZoneNum).NumOfCoolStages = rNumericArgs(7); + stageControlledZone.NumOfCoolStages = rNumericArgs(7); if (rNumericArgs(7) < 1 || rNumericArgs(7) > 4) { ShowSevereError( state, @@ -2502,10 +2457,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } - StageControlledZone(StageControlledZoneNum).CoolSetBaseSchedName = cAlphaArgs(4); - StageControlledZone(StageControlledZoneNum).CSBchedIndex = GetScheduleIndex(state, cAlphaArgs(4)); + stageControlledZone.CoolSetBaseSchedName = cAlphaArgs(4); + stageControlledZone.CSBchedIndex = GetScheduleIndex(state, cAlphaArgs(4)); if (Item1 == 1) { // only show error on first of several if zone list - if (StageControlledZone(StageControlledZoneNum).CSBchedIndex == 0) { + if (stageControlledZone.CSBchedIndex == 0) { ShowSevereError( state, format( @@ -2514,7 +2469,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) } } - StageControlledZone(StageControlledZoneNum).CoolThroRange = rNumericArgs(8); + stageControlledZone.CoolThroRange = rNumericArgs(8); if (rNumericArgs(8) < 0.0) { ShowSevereError(state, format("{}=\"{}\" negative value is found at {}=\"{:.1R}\"", @@ -2526,10 +2481,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ErrorsFound = true; } - if (StageControlledZone(StageControlledZoneNum).NumOfCoolStages > 0) { - StageControlledZone(StageControlledZoneNum).CoolTOffset.allocate(StageControlledZone(StageControlledZoneNum).NumOfCoolStages); - for (i = 1; i <= StageControlledZone(StageControlledZoneNum).NumOfCoolStages; ++i) { - StageControlledZone(StageControlledZoneNum).CoolTOffset(i) = rNumericArgs(8 + i); + if (stageControlledZone.NumOfCoolStages > 0) { + stageControlledZone.CoolTOffset.allocate(stageControlledZone.NumOfCoolStages); + for (i = 1; i <= stageControlledZone.NumOfCoolStages; ++i) { + stageControlledZone.CoolTOffset(i) = rNumericArgs(8 + i); if (rNumericArgs(8 + i) < 0.0) { ShowSevereError(state, format("{}=\"{}\" negative value is found at {}=\"{:.1R}\"", @@ -2599,37 +2554,25 @@ void CalculateMonthlyRunningAverageDryBulb(EnergyPlusData &state, Array1D adaptiveTemp(state.dataWeather->NumDaysInYear, 0.0); Array1D dailyDryTemp(state.dataWeather->NumDaysInYear, 0.0); - readStat = 0; if (FileSystem::fileExists(state.files.inputWeatherFilePath.filePath)) { // Read hourly dry bulb temperature first auto epwFile = state.files.inputWeatherFilePath.open(state, "CalcThermalComfortAdaptive"); - for (i = 1; i <= 9; ++i) { // Headers + for (int i = 1; i <= 9; ++i) { // Headers epwFile.readLine(); } - for (i = 1; i <= state.dataWeather->NumDaysInYear; ++i) { + for (int i = 1; i <= state.dataWeather->NumDaysInYear; ++i) { avgDryBulb = 0.0; - for (j = 1; j <= 24; ++j) { - epwLine = epwFile.readLine().data; - for (ind = 1; ind <= 6; ++ind) { + for (int j = 1; j <= 24; ++j) { + std::string epwLine = epwFile.readLine().data; + for (int ind = 1; ind <= 6; ++ind) { pos = index(epwLine, ','); epwLine.erase(0, pos + 1); } @@ -2645,23 +2588,23 @@ void CalculateMonthlyRunningAverageDryBulb(EnergyPlusData &state, Array1DNumDaysInYear) { dayOfYear++; - calcEndDay = dayOfYear - 1; - calcStartDayASH = calcEndDay - 30; - calcStartDayCEN = calcEndDay - 7; + int calcEndDay = dayOfYear - 1; + int calcStartDayASH = calcEndDay - 30; + int calcStartDayCEN = calcEndDay - 7; if (calcStartDayASH > 0) { - for (i = calcStartDayASH; i <= calcStartDayASH + 30; i++) { + for (int i = calcStartDayASH; i <= calcStartDayASH + 30; i++) { avgDryBulb = dailyDryTemp(i); runningAverageASH(dayOfYear) = runningAverageASH(dayOfYear) + avgDryBulb; } runningAverageASH(dayOfYear) /= 30; } else { // Do special things for wrapping the epw calcStartDayASH += state.dataWeather->NumDaysInYear; - for (i = 1; i <= calcEndDay; i++) { + for (int i = 1; i <= calcEndDay; i++) { avgDryBulb = dailyDryTemp(i); runningAverageASH(dayOfYear) = runningAverageASH(dayOfYear) + avgDryBulb; } - for (i = calcStartDayASH; i < state.dataWeather->NumDaysInYear; i++) { + for (int i = calcStartDayASH; i < state.dataWeather->NumDaysInYear; i++) { avgDryBulb = dailyDryTemp(i); runningAverageASH(dayOfYear) = runningAverageASH(dayOfYear) + avgDryBulb; } @@ -2669,18 +2612,18 @@ void CalculateMonthlyRunningAverageDryBulb(EnergyPlusData &state, Array1D 0) { - for (i = calcStartDayCEN; i <= calcStartDayCEN + 7; i++) { + for (int i = calcStartDayCEN; i <= calcStartDayCEN + 7; i++) { avgDryBulb = dailyDryTemp(i); runningAverageCEN(dayOfYear) = runningAverageCEN(dayOfYear) + avgDryBulb; } runningAverageCEN(dayOfYear) /= 7; } else { // Do special things for wrapping the epw calcStartDayCEN += state.dataWeather->NumDaysInYear; - for (i = 1; i <= calcEndDay; i++) { + for (int i = 1; i <= calcEndDay; i++) { avgDryBulb = dailyDryTemp(i); runningAverageCEN(dayOfYear) = runningAverageCEN(dayOfYear) + avgDryBulb; } - for (i = calcStartDayCEN; i < state.dataWeather->NumDaysInYear; i++) { + for (int i = calcStartDayCEN; i < state.dataWeather->NumDaysInYear; i++) { avgDryBulb = dailyDryTemp(i); runningAverageCEN(dayOfYear) = runningAverageCEN(dayOfYear) + avgDryBulb; } @@ -2788,30 +2731,20 @@ void InitZoneAirSetPoints(EnergyPlusData &state) static constexpr std::string_view RoutineName("InitZoneAirSetpoints: "); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool FirstSurfFlag; - int TRefFlag; // Flag for Reference Temperature process in Zones - - auto &ZoneList = state.dataHeatBal->ZoneList; - auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone; - auto &TempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint; - auto &TempControlType = state.dataHeatBalFanSys->TempControlType; - auto &TempControlTypeRpt = state.dataHeatBalFanSys->TempControlTypeRpt; - auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone; - auto &ZoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo; - auto &ZoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi; int NumOfZones = state.dataGlobal->NumOfZones; if (state.dataZoneTempPredictorCorrector->InitZoneAirSetPointsOneTimeFlag) { - TempZoneThermostatSetPoint.dimension(NumOfZones, 0.0); + int TRefFlag; // Flag for Reference Temperature process in Zones + state.dataHeatBalFanSys->TempZoneThermostatSetPoint.dimension(NumOfZones, 0.0); state.dataHeatBalFanSys->AdapComfortCoolingSetPoint.dimension(NumOfZones, 0.0); - ZoneThermostatSetPointHi.dimension(NumOfZones, 0.0); - ZoneThermostatSetPointLo.dimension(NumOfZones, 0.0); + state.dataHeatBalFanSys->ZoneThermostatSetPointHi.dimension(NumOfZones, 0.0); + state.dataHeatBalFanSys->ZoneThermostatSetPointLo.dimension(NumOfZones, 0.0); state.dataHeatBalFanSys->ZoneThermostatSetPointHiAver.dimension(NumOfZones, 0.0); state.dataHeatBalFanSys->ZoneThermostatSetPointLoAver.dimension(NumOfZones, 0.0); state.dataHeatBalFanSys->LoadCorrectionFactor.dimension(NumOfZones, 0.0); - TempControlType.dimension(NumOfZones, HVAC::ThermostatType::Uncontrolled); - TempControlTypeRpt.dimension(NumOfZones, 0); + state.dataHeatBalFanSys->TempControlType.dimension(NumOfZones, HVAC::ThermostatType::Uncontrolled); + state.dataHeatBalFanSys->TempControlTypeRpt.dimension(NumOfZones, 0); if (state.dataZoneCtrls->NumComfortControlledZones > 0) { state.dataHeatBalFanSys->ComfortControlType.dimension(NumOfZones, HVAC::ThermostatType::Uncontrolled); state.dataHeatBalFanSys->ComfortControlTypeRpt.dimension(NumOfZones, 0); @@ -2848,9 +2781,9 @@ void InitZoneAirSetPoints(EnergyPlusData &state) } for (int zoneNum = 1; zoneNum <= NumOfZones; ++zoneNum) { - FirstSurfFlag = true; + bool FirstSurfFlag = true; for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { if (FirstSurfFlag) { TRefFlag = state.dataSurface->SurfTAirRef(SurfNum); @@ -2915,21 +2848,21 @@ void InitZoneAirSetPoints(EnergyPlusData &state) SetupOutputVariable(state, "Zone Thermostat Control Type", Constant::Units::None, - TempControlTypeRpt(zoneNum), + state.dataHeatBalFanSys->TempControlTypeRpt(zoneNum), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, thisZone.Name); SetupOutputVariable(state, "Zone Thermostat Heating Setpoint Temperature", Constant::Units::C, - ZoneThermostatSetPointLo(zoneNum), + state.dataHeatBalFanSys->ZoneThermostatSetPointLo(zoneNum), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, thisZone.Name); SetupOutputVariable(state, "Zone Thermostat Cooling Setpoint Temperature", Constant::Units::C, - ZoneThermostatSetPointHi(zoneNum), + state.dataHeatBalFanSys->ZoneThermostatSetPointHi(zoneNum), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, thisZone.Name); @@ -2953,7 +2886,7 @@ void InitZoneAirSetPoints(EnergyPlusData &state) if (state.dataZoneCtrls->NumComfortControlledZones > 0) { // CurrentModuleObject='ZoneControl:Thermostat:ThermalComfort' for (int Loop = 1; Loop <= state.dataZoneCtrls->NumComfortControlledZones; ++Loop) { - int zoneNum = ComfortControlledZone(Loop).ActualZoneNum; + int zoneNum = state.dataZoneCtrls->ComfortControlledZone(Loop).ActualZoneNum; auto &thisZone = state.dataHeatBal->Zone(zoneNum); SetupOutputVariable(state, "Zone Thermal Comfort Control Type", @@ -2981,66 +2914,68 @@ void InitZoneAirSetPoints(EnergyPlusData &state) // CurrentModuleObject='ZoneList' for (int Loop = 1; Loop <= state.dataHeatBal->NumOfZoneLists; ++Loop) { + auto &zoneList = state.dataHeatBal->ZoneList(Loop); SetupOutputVariable(state, "Zone List Sensible Heating Energy", Constant::Units::J, state.dataHeatBal->ZoneListSNLoadHeatEnergy(Loop), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - ZoneList(Loop).Name); + zoneList.Name); SetupOutputVariable(state, "Zone List Sensible Cooling Energy", Constant::Units::J, state.dataHeatBal->ZoneListSNLoadCoolEnergy(Loop), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - ZoneList(Loop).Name); + zoneList.Name); SetupOutputVariable(state, "Zone List Sensible Heating Rate", Constant::Units::W, state.dataHeatBal->ZoneListSNLoadHeatRate(Loop), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - ZoneList(Loop).Name); + zoneList.Name); SetupOutputVariable(state, "Zone List Sensible Cooling Rate", Constant::Units::W, state.dataHeatBal->ZoneListSNLoadCoolRate(Loop), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - ZoneList(Loop).Name); + zoneList.Name); } // Loop // CurrentModuleObject='ZoneGroup' for (int Loop = 1; Loop <= state.dataHeatBal->NumOfZoneGroups; ++Loop) { + auto &zoneGroup = state.dataHeatBal->ZoneGroup(Loop); SetupOutputVariable(state, "Zone Group Sensible Heating Energy", Constant::Units::J, state.dataHeatBal->ZoneGroupSNLoadHeatEnergy(Loop), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataHeatBal->ZoneGroup(Loop).Name); + zoneGroup.Name); SetupOutputVariable(state, "Zone Group Sensible Cooling Energy", Constant::Units::J, state.dataHeatBal->ZoneGroupSNLoadCoolEnergy(Loop), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataHeatBal->ZoneGroup(Loop).Name); + zoneGroup.Name); SetupOutputVariable(state, "Zone Group Sensible Heating Rate", Constant::Units::W, state.dataHeatBal->ZoneGroupSNLoadHeatRate(Loop), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataHeatBal->ZoneGroup(Loop).Name); + zoneGroup.Name); SetupOutputVariable(state, "Zone Group Sensible Cooling Rate", Constant::Units::W, state.dataHeatBal->ZoneGroupSNLoadCoolRate(Loop), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataHeatBal->ZoneGroup(Loop).Name); + zoneGroup.Name); } // Loop state.dataZoneTempPredictorCorrector->InitZoneAirSetPointsOneTimeFlag = false; @@ -3056,13 +2991,13 @@ void InitZoneAirSetPoints(EnergyPlusData &state) thisSpaceHB.beginEnvironmentInit(state); } } - TempZoneThermostatSetPoint = 0.0; + state.dataHeatBalFanSys->TempZoneThermostatSetPoint = 0.0; state.dataHeatBalFanSys->AdapComfortCoolingSetPoint = 0.0; - ZoneThermostatSetPointHi = 0.0; - ZoneThermostatSetPointLo = 0.0; + state.dataHeatBalFanSys->ZoneThermostatSetPointHi = 0.0; + state.dataHeatBalFanSys->ZoneThermostatSetPointLo = 0.0; state.dataHeatBalFanSys->LoadCorrectionFactor = 1.0; - TempControlType = HVAC::ThermostatType::Uncontrolled; + state.dataHeatBalFanSys->TempControlType = HVAC::ThermostatType::Uncontrolled; for (auto &e : state.dataZoneEnergyDemand->ZoneSysEnergyDemand) { e.beginEnvironmentInit(); } @@ -3106,53 +3041,56 @@ void InitZoneAirSetPoints(EnergyPlusData &state) } for (int Loop = 1; Loop <= state.dataZoneCtrls->NumTempControlledZones; ++Loop) { + auto &tempControlledZone = state.dataZoneCtrls->TempControlledZone(Loop); if (state.dataZoneEquip->ZoneEquipInputsFilled && !state.dataZoneTempPredictorCorrector->ControlledZonesChecked) { - if (!VerifyControlledZoneForThermostat(state, TempControlledZone(Loop).ZoneName)) { + if (!VerifyControlledZoneForThermostat(state, tempControlledZone.ZoneName)) { ShowSevereError(state, format("{}Zone=\"{}\" has specified a Thermostatic control but is not a controlled zone.", RoutineName, - TempControlledZone(Loop).ZoneName)); + tempControlledZone.ZoneName)); ShowContinueError(state, "...must have a ZoneHVAC:EquipmentConnections specification for this zone."); state.dataZoneTempPredictorCorrector->ErrorsFound = true; } } - if (TempControlledZone(Loop).ManageDemand) { - int ZoneNum = TempControlledZone(Loop).ActualZoneNum; + if (tempControlledZone.ManageDemand) { + int ZoneNum = tempControlledZone.ActualZoneNum; + auto &zoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum); + auto &zoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum); + auto &tempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum); + auto &tempControlType = state.dataHeatBalFanSys->TempControlType(ZoneNum); - switch (TempControlType(ZoneNum)) { + switch (tempControlType) { case HVAC::ThermostatType::SingleHeating: - if (TempZoneThermostatSetPoint(ZoneNum) > TempControlledZone(Loop).HeatingResetLimit) { - TempZoneThermostatSetPoint(ZoneNum) = TempControlledZone(Loop).HeatingResetLimit; - ZoneThermostatSetPointLo(ZoneNum) = TempZoneThermostatSetPoint(ZoneNum); + if (tempZoneThermostatSetPoint > tempControlledZone.HeatingResetLimit) { + tempZoneThermostatSetPoint = tempControlledZone.HeatingResetLimit; + zoneThermostatSetPointLo = tempZoneThermostatSetPoint; } break; case HVAC::ThermostatType::SingleCooling: - if (TempZoneThermostatSetPoint(ZoneNum) < TempControlledZone(Loop).CoolingResetLimit) { - TempZoneThermostatSetPoint(ZoneNum) = TempControlledZone(Loop).CoolingResetLimit; - ZoneThermostatSetPointHi(ZoneNum) = TempZoneThermostatSetPoint(ZoneNum); + if (tempZoneThermostatSetPoint < tempControlledZone.CoolingResetLimit) { + tempZoneThermostatSetPoint = tempControlledZone.CoolingResetLimit; + zoneThermostatSetPointHi = tempZoneThermostatSetPoint; } break; case HVAC::ThermostatType::SingleHeatCool: - if ((TempZoneThermostatSetPoint(ZoneNum) > TempControlledZone(Loop).HeatingResetLimit) || - (TempZoneThermostatSetPoint(ZoneNum) < TempControlledZone(Loop).CoolingResetLimit)) { + if ((tempZoneThermostatSetPoint > tempControlledZone.HeatingResetLimit) || + (tempZoneThermostatSetPoint < tempControlledZone.CoolingResetLimit)) { - TempControlType(ZoneNum) = HVAC::ThermostatType::DualSetPointWithDeadBand; - TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); - ZoneThermostatSetPointLo(ZoneNum) = TempZoneThermostatSetPoint(ZoneNum); - ZoneThermostatSetPointHi(ZoneNum) = TempZoneThermostatSetPoint(ZoneNum); + tempControlType = HVAC::ThermostatType::DualSetPointWithDeadBand; + state.dataHeatBalFanSys->TempControlTypeRpt(ZoneNum) = static_cast(tempControlType); + zoneThermostatSetPointLo = tempZoneThermostatSetPoint; + zoneThermostatSetPointHi = tempZoneThermostatSetPoint; - if (ZoneThermostatSetPointLo(ZoneNum) > TempControlledZone(Loop).HeatingResetLimit) - ZoneThermostatSetPointLo(ZoneNum) = TempControlledZone(Loop).HeatingResetLimit; - if (ZoneThermostatSetPointHi(ZoneNum) < TempControlledZone(Loop).CoolingResetLimit) - ZoneThermostatSetPointHi(ZoneNum) = TempControlledZone(Loop).CoolingResetLimit; + if (zoneThermostatSetPointLo > tempControlledZone.HeatingResetLimit) + zoneThermostatSetPointLo = tempControlledZone.HeatingResetLimit; + if (zoneThermostatSetPointHi < tempControlledZone.CoolingResetLimit) + zoneThermostatSetPointHi = tempControlledZone.CoolingResetLimit; } break; case HVAC::ThermostatType::DualSetPointWithDeadBand: - if (ZoneThermostatSetPointLo(ZoneNum) > TempControlledZone(Loop).HeatingResetLimit) - ZoneThermostatSetPointLo(ZoneNum) = TempControlledZone(Loop).HeatingResetLimit; - if (ZoneThermostatSetPointHi(ZoneNum) < TempControlledZone(Loop).CoolingResetLimit) - ZoneThermostatSetPointHi(ZoneNum) = TempControlledZone(Loop).CoolingResetLimit; + if (zoneThermostatSetPointLo > tempControlledZone.HeatingResetLimit) zoneThermostatSetPointLo = tempControlledZone.HeatingResetLimit; + if (zoneThermostatSetPointHi < tempControlledZone.CoolingResetLimit) zoneThermostatSetPointHi = tempControlledZone.CoolingResetLimit; break; default: break; @@ -3161,58 +3099,64 @@ void InitZoneAirSetPoints(EnergyPlusData &state) } for (int Loop = 1; Loop <= state.dataZoneCtrls->NumComfortControlledZones; ++Loop) { + auto &comfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(Loop); if (state.dataZoneEquip->ZoneEquipInputsFilled && !state.dataZoneTempPredictorCorrector->ControlledZonesChecked) { - if (!VerifyControlledZoneForThermostat(state, ComfortControlledZone(Loop).ZoneName)) { + if (!VerifyControlledZoneForThermostat(state, comfortControlledZone.ZoneName)) { ShowSevereError(state, format("{}Zone=\"{}\" has specified a Comfort control but is not a controlled zone.", RoutineName, - ComfortControlledZone(Loop).ZoneName)); + comfortControlledZone.ZoneName)); ShowContinueError(state, "...must have a ZoneHVAC:EquipmentConnections specification for this zone."); state.dataZoneTempPredictorCorrector->ErrorsFound = true; } } - if (ComfortControlledZone(Loop).ManageDemand) { - int ZoneNum = ComfortControlledZone(Loop).ActualZoneNum; + if (comfortControlledZone.ManageDemand) { + int ZoneNum = comfortControlledZone.ActualZoneNum; + auto &zoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum); + auto &zoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum); + auto &tempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum); + auto &tempControlTypeRpt = state.dataHeatBalFanSys->TempControlTypeRpt(ZoneNum); + auto &tempControlType = state.dataHeatBalFanSys->TempControlType(ZoneNum); switch (state.dataHeatBalFanSys->ComfortControlType(ZoneNum)) { case HVAC::ThermostatType::SingleHeating: - if (TempZoneThermostatSetPoint(ZoneNum) >= ComfortControlledZone(Loop).HeatingResetLimit) { - TempZoneThermostatSetPoint(ZoneNum) = ComfortControlledZone(Loop).HeatingResetLimit; - ZoneThermostatSetPointLo(ZoneNum) = TempZoneThermostatSetPoint(ZoneNum); - TempControlType(ZoneNum) = HVAC::ThermostatType::SingleHeating; - TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); + if (tempZoneThermostatSetPoint >= comfortControlledZone.HeatingResetLimit) { + tempZoneThermostatSetPoint = comfortControlledZone.HeatingResetLimit; + zoneThermostatSetPointLo = tempZoneThermostatSetPoint; + tempControlType = HVAC::ThermostatType::SingleHeating; + tempControlTypeRpt = static_cast(tempControlType); } break; case HVAC::ThermostatType::SingleCooling: - if (TempZoneThermostatSetPoint(ZoneNum) <= ComfortControlledZone(Loop).CoolingResetLimit) { - TempZoneThermostatSetPoint(ZoneNum) = ComfortControlledZone(Loop).CoolingResetLimit; - ZoneThermostatSetPointHi(ZoneNum) = TempZoneThermostatSetPoint(ZoneNum); - TempControlType(ZoneNum) = HVAC::ThermostatType::SingleCooling; - TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); + if (tempZoneThermostatSetPoint <= comfortControlledZone.CoolingResetLimit) { + tempZoneThermostatSetPoint = comfortControlledZone.CoolingResetLimit; + zoneThermostatSetPointHi = tempZoneThermostatSetPoint; + tempControlType = HVAC::ThermostatType::SingleCooling; + tempControlTypeRpt = static_cast(tempControlType); } break; case HVAC::ThermostatType::SingleHeatCool: - if ((TempZoneThermostatSetPoint(ZoneNum) >= ComfortControlledZone(Loop).HeatingResetLimit) || - (TempZoneThermostatSetPoint(ZoneNum) <= ComfortControlledZone(Loop).CoolingResetLimit)) { + if ((tempZoneThermostatSetPoint >= comfortControlledZone.HeatingResetLimit) || + (tempZoneThermostatSetPoint <= comfortControlledZone.CoolingResetLimit)) { - TempControlType(ZoneNum) = HVAC::ThermostatType::DualSetPointWithDeadBand; - TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); - ZoneThermostatSetPointLo(ZoneNum) = TempZoneThermostatSetPoint(ZoneNum); - ZoneThermostatSetPointHi(ZoneNum) = TempZoneThermostatSetPoint(ZoneNum); + tempControlType = HVAC::ThermostatType::DualSetPointWithDeadBand; + tempControlTypeRpt = static_cast(tempControlType); + zoneThermostatSetPointLo = tempZoneThermostatSetPoint; + zoneThermostatSetPointHi = tempZoneThermostatSetPoint; - if (ZoneThermostatSetPointLo(ZoneNum) >= ComfortControlledZone(Loop).HeatingResetLimit) - ZoneThermostatSetPointLo(ZoneNum) = ComfortControlledZone(Loop).HeatingResetLimit; - if (ZoneThermostatSetPointHi(ZoneNum) <= ComfortControlledZone(Loop).CoolingResetLimit) - ZoneThermostatSetPointHi(ZoneNum) = ComfortControlledZone(Loop).CoolingResetLimit; + if (zoneThermostatSetPointLo >= comfortControlledZone.HeatingResetLimit) + zoneThermostatSetPointLo = comfortControlledZone.HeatingResetLimit; + if (zoneThermostatSetPointHi <= comfortControlledZone.CoolingResetLimit) + zoneThermostatSetPointHi = comfortControlledZone.CoolingResetLimit; } break; case HVAC::ThermostatType::DualSetPointWithDeadBand: - TempControlType(ZoneNum) = HVAC::ThermostatType::DualSetPointWithDeadBand; - TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); - if (ZoneThermostatSetPointLo(ZoneNum) >= ComfortControlledZone(Loop).HeatingResetLimit) - ZoneThermostatSetPointLo(ZoneNum) = ComfortControlledZone(Loop).HeatingResetLimit; - if (ZoneThermostatSetPointHi(ZoneNum) <= ComfortControlledZone(Loop).CoolingResetLimit) - ZoneThermostatSetPointHi(ZoneNum) = ComfortControlledZone(Loop).CoolingResetLimit; + tempControlType = HVAC::ThermostatType::DualSetPointWithDeadBand; + tempControlTypeRpt = static_cast(tempControlType); + if (zoneThermostatSetPointLo >= comfortControlledZone.HeatingResetLimit) + zoneThermostatSetPointLo = comfortControlledZone.HeatingResetLimit; + if (zoneThermostatSetPointHi <= comfortControlledZone.CoolingResetLimit) + zoneThermostatSetPointHi = comfortControlledZone.CoolingResetLimit; break; default: break; @@ -3326,7 +3270,7 @@ void PredictSystemLoads(EnergyPlusData &state, for (int RelativeZoneNum = 1; RelativeZoneNum <= state.dataZoneTempPredictorCorrector->NumStageCtrZone; ++RelativeZoneNum) { auto &thisStageControlZone = state.dataZoneCtrls->StageControlledZone(RelativeZoneNum); int ActualZoneNum = thisStageControlZone.ActualZoneNum; - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ActualZoneNum); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ActualZoneNum); auto &thisZoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ActualZoneNum); auto &thisZoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ActualZoneNum); Real64 ZoneT = thisZoneHB.MAT; // Zone temperature at previous time step @@ -3412,7 +3356,7 @@ void PredictSystemLoads(EnergyPlusData &state, thisTempControlledZone.CoolModeLastSave = thisTempControlledZone.CoolModeLast; } auto &thisTempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(thisTempControlledZone.ActualZoneNum); - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisTempControlledZone.ActualZoneNum); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisTempControlledZone.ActualZoneNum); auto &thisZoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(thisTempControlledZone.ActualZoneNum); auto &thisZoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(thisTempControlledZone.ActualZoneNum); @@ -3670,8 +3614,6 @@ void CalcZoneAirTempSetPoints(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int RelativeZoneNum; - int ActualZoneNum; - int TempControlSchedIndex; int SetPointTempSchedIndexHot; int SetPointTempSchedIndexCold; int SchedNameIndex; @@ -3704,8 +3646,8 @@ void CalcZoneAirTempSetPoints(EnergyPlusData &state) for (RelativeZoneNum = 1; RelativeZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++RelativeZoneNum) { // What if this zone not controlled??? - ActualZoneNum = TempControlledZone(RelativeZoneNum).ActualZoneNum; - TempControlSchedIndex = TempControlledZone(RelativeZoneNum).CTSchedIndex; + int ActualZoneNum = TempControlledZone(RelativeZoneNum).ActualZoneNum; + int TempControlSchedIndex = TempControlledZone(RelativeZoneNum).CTSchedIndex; TempControlType(ActualZoneNum) = static_cast(ScheduleManager::GetCurrentScheduleValue(state, TempControlSchedIndex)); TempControlTypeRpt(ActualZoneNum) = static_cast(TempControlType(ActualZoneNum)); // Error detection for these values is done in the Get routine @@ -3841,8 +3783,8 @@ void CalcZoneAirTempSetPoints(EnergyPlusData &state) if (ScheduleManager::GetCurrentScheduleValue(state, state.dataFaultsMgr->FaultsThermostatOffset(iFault).availSchedNum) > 0.0) { // Check fault severity schedules to update the reference thermostat offset - double rSchVal = 1.0; - double offsetUpdated; + Real64 rSchVal = 1.0; + Real64 offsetUpdated; if (state.dataFaultsMgr->FaultsThermostatOffset(iFault).severitySchedNum >= 0) { rSchVal = ScheduleManager::GetCurrentScheduleValue(state, state.dataFaultsMgr->FaultsThermostatOffset(iFault).severitySchedNum); @@ -3922,11 +3864,7 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, // For Humidistat Offset Type I: ThermostatOffsetDependent bool IsThermostatFound = false; - double offsetThermostat = 0.0; - double offsetZoneRHHumidifyingSetPoint = 0.0; - double offsetZoneRHDehumidifyingSetPoint = 0.0; - double faultZoneWHumidifyingSetPoint; - double faultZoneWDehumidifyingSetPoint; + Real64 offsetThermostat = 0.0; // Get the offset value of the corresponding thermostat fault object if (state.dataFaultsMgr->NumFaultyThermostat > 0) { @@ -3943,7 +3881,7 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, state, state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).availSchedNum) > 0.0) { // Check fault severity schedules to update the reference thermostat offset - double rSchVal = 1.0; + Real64 rSchVal = 1.0; if (state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).severitySchedNum >= 0) { rSchVal = ScheduleManager::GetCurrentScheduleValue( state, state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).severitySchedNum); @@ -3969,14 +3907,14 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, if (offsetThermostat != 0.0) { // Calculate the humidistat offset value from the thermostat offset value - faultZoneWHumidifyingSetPoint = Psychrometrics::PsyWFnTdbRhPb( + Real64 faultZoneWHumidifyingSetPoint = Psychrometrics::PsyWFnTdbRhPb( state, (this->MAT + offsetThermostat), (ZoneRHHumidifyingSetPoint / 100.0), state.dataEnvrn->OutBaroPress); - faultZoneWDehumidifyingSetPoint = Psychrometrics::PsyWFnTdbRhPb( + Real64 faultZoneWDehumidifyingSetPoint = Psychrometrics::PsyWFnTdbRhPb( state, (this->MAT + offsetThermostat), (ZoneRHDehumidifyingSetPoint / 100.0), state.dataEnvrn->OutBaroPress); - offsetZoneRHHumidifyingSetPoint = + Real64 offsetZoneRHHumidifyingSetPoint = ZoneRHHumidifyingSetPoint - Psychrometrics::PsyRhFnTdbWPb(state, this->MAT, faultZoneWHumidifyingSetPoint, state.dataEnvrn->OutBaroPress) * 100.0; - offsetZoneRHDehumidifyingSetPoint = + Real64 offsetZoneRHDehumidifyingSetPoint = ZoneRHDehumidifyingSetPoint - Psychrometrics::PsyRhFnTdbWPb(state, this->MAT, faultZoneWDehumidifyingSetPoint, state.dataEnvrn->OutBaroPress) * 100.0; @@ -3999,8 +3937,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, 0.0) { // Check fault severity schedules to update the reference humidistat offset - double rSchVal = 1.0; - double offsetUpdated; + Real64 rSchVal = 1.0; + Real64 offsetUpdated; if (state.dataFaultsMgr->FaultsHumidistatOffset(iFault).severitySchedNum >= 0) { rSchVal = ScheduleManager::GetCurrentScheduleValue( state, state.dataFaultsMgr->FaultsHumidistatOffset(iFault).severitySchedNum); @@ -4229,14 +4167,15 @@ Real64 correctZoneAirTemps(EnergyPlusData &state, Real64 spaceTempChange = thisSpaceHB.correctAirTemp(state, useZoneTimeStepHistory, zoneNum, spaceNum); maxTempChange = max(maxTempChange, spaceTempChange); } else { - // If no SpaceHB, then set space temps to match zone temps - if (state.dataHeatBal->space(spaceNum).IsControlled) { - auto &thisZoneNode = state.dataLoopNodes->Node(thisZone.SystemZoneNodeNumber); + // If doing sizing and zone is controled, then set space node to match zone node + if (state.dataHeatBal->doSpaceHeatBalanceSizing && thisZone.IsControlled) { + auto const &thisZoneNode = state.dataLoopNodes->Node(thisZone.SystemZoneNodeNumber); auto &thisSpaceNode = state.dataLoopNodes->Node(state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber); thisSpaceNode.Temp = thisZoneNode.Temp; thisSpaceNode.HumRat = thisZoneNode.HumRat; thisSpaceNode.Enthalpy = thisZoneNode.Enthalpy; } + // If no SpaceHB or doing sizing, then set space temps and humrat to match zone thisSpaceHB.ZT = thisZoneHB.ZT; thisSpaceHB.ZTM = thisZoneHB.ZTM; thisSpaceHB.MAT = thisZoneHB.MAT; @@ -4373,7 +4312,7 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( } state.dataHeatBalFanSys->LoadCorrectionFactor(zoneNum) = 1.0; } else { - auto &thisAirModel = state.dataRoomAir->AirModel(zoneNum); + auto const &thisAirModel = state.dataRoomAir->AirModel(zoneNum); if ((thisAirModel.AirModel == RoomAir::RoomAirModel::Mixing) || (!thisAirModel.SimAirModel)) { // Fully mixed thisSystemNode.Temp = this->ZT; @@ -4847,7 +4786,7 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum); // Calculate moisture flow rate into each zone for (int NodeNum = 1; NodeNum <= zoneEquipConfig.NumInletNodes; ++NodeNum) { - auto &inletNode = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(NodeNum)); + auto const &inletNode = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(NodeNum)); MoistureMassFlowRate += (inletNode.MassFlowRate * inletNode.HumRat) / ZoneMult; ZoneMassFlowRate += inletNode.MassFlowRate / ZoneMult; } @@ -4857,14 +4796,14 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo int ZoneRetPlenumNum = zone.PlenumCondNum; auto &zoneRetPlenCond = state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum); for (int NodeNum = 1; NodeNum <= zoneRetPlenCond.NumInletNodes; ++NodeNum) { - auto &inletNode = state.dataLoopNodes->Node(zoneRetPlenCond.InletNode(NodeNum)); + auto const &inletNode = state.dataLoopNodes->Node(zoneRetPlenCond.InletNode(NodeNum)); MoistureMassFlowRate += (inletNode.MassFlowRate * inletNode.HumRat) / ZoneMult; ZoneMassFlowRate += inletNode.MassFlowRate / ZoneMult; } // add in the leak flow for (int ADUListIndex = 1; ADUListIndex <= zoneRetPlenCond.NumADUs; ++ADUListIndex) { int ADUNum = zoneRetPlenCond.ADUIndex(ADUListIndex); - auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(ADUNum); + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(ADUNum); if (airDistUnit.UpStreamLeak) { int ADUInNode = airDistUnit.InletNodeNum; MoistureMassFlowRate += (airDistUnit.MassFlowRateUpStrLk * state.dataLoopNodes->Node(ADUInNode).HumRat) / ZoneMult; @@ -4879,7 +4818,7 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo } else if (ZoneSupPlenumAirFlag) { int ZoneSupPlenumNum = zone.PlenumCondNum; - auto &inletNode = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneSupPlenCond(ZoneSupPlenumNum).InletNode); + auto const &inletNode = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneSupPlenCond(ZoneSupPlenumNum).InletNode); MoistureMassFlowRate += (inletNode.MassFlowRate * inletNode.HumRat) / ZoneMult; ZoneMassFlowRate += inletNode.MassFlowRate / ZoneMult; } @@ -4904,7 +4843,7 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo if (state.afn->multizone_always_simulated || (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation && state.afn->AirflowNetworkFanActivated)) { - auto &exchangeData = state.afn->exchangeData(zoneNum); + auto const &exchangeData = state.afn->exchangeData(zoneNum); // Multizone airflow calculated in AirflowNetwork B = (LatentGain / H2OHtOfVap) + (exchangeData.SumMHrW + exchangeData.SumMMHrW) + (MoistureMassFlowRate) + this->SumHmARaW; A = ZoneMassFlowRate + exchangeData.SumMHr + exchangeData.SumMMHr + this->SumHmARa; @@ -5570,7 +5509,7 @@ void ZoneSpaceHeatBalanceData::calcZoneOrSpaceSums(EnergyPlusData &state, if (state.afn->multizone_always_simulated || (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation && state.afn->AirflowNetworkFanActivated)) { - auto &exchangeData = state.afn->exchangeData(zoneNum); + auto const &exchangeData = state.afn->exchangeData(zoneNum); this->SumMCp = exchangeData.SumMCp + exchangeData.SumMVCp + exchangeData.SumMMCp; this->SumMCpT = exchangeData.SumMCpT + exchangeData.SumMVCpT + exchangeData.SumMMCpT; } @@ -5906,7 +5845,7 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, // Sum all surface convection: SumHA, SumHATsurf, SumHATref (and additional contributions to SumIntGain) for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { Real64 Area = state.dataSurface->Surface(SurfNum).Area; // For windows, this is the glazing area @@ -6251,7 +6190,7 @@ void AdjustOperativeSetPointsforAdapComfort(EnergyPlusData &state, int const Tem // This routine adjust the operative setpoints for each controlled adaptive thermal comfort models. auto &tempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneID); - auto &AdapComfortDailySetPointSchedule = state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule; + auto const &AdapComfortDailySetPointSchedule = state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int originZoneAirSetPoint = ZoneAirSetPoint; @@ -6319,11 +6258,11 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) Real64 SetPointLo = 0.0; Real64 SetPointHi = 0.0; Real64 Tset = 0.0; - int PeopleNum = 0; int ObjectCount = 0; Real64 PeopleCount = 0.0; int SetPointComfortSchedIndex = 0; int SchedTypeIndex = 0; + int PeopleNum; // Call thermal comfort module to read zone control comfort object if (state.dataZoneTempPredictorCorrector->CalcZoneAirComfortSetPointsFirstTimeFlag) { @@ -6439,13 +6378,13 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) case DataZoneControls::AverageMethod::OBJ: SetPointLo = 0.0; SetPointHi = 0.0; - for (int PeopleNum = 1; PeopleNum <= state.dataHeatBal->TotPeople; ++PeopleNum) { - if (ActualZoneNum == state.dataHeatBal->People(PeopleNum).ZonePtr) { + for (int peopleNum = 1; peopleNum <= state.dataHeatBal->TotPeople; ++peopleNum) { + if (ActualZoneNum == state.dataHeatBal->People(peopleNum).ZonePtr) { ++ObjectCount; - GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); + GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); SetPointLo += Tset; if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) { - GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); + GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); SetPointHi += Tset; } } @@ -6456,15 +6395,15 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) case DataZoneControls::AverageMethod::PEO: SetPointLo = 0.0; SetPointHi = 0.0; - for (int PeopleNum = 1; PeopleNum <= state.dataHeatBal->TotPeople; ++PeopleNum) { - if (ActualZoneNum == state.dataHeatBal->People(PeopleNum).ZonePtr) { - int NumberOccupants = state.dataHeatBal->People(PeopleNum).NumberOfPeople * - ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->People(PeopleNum).NumberOfPeoplePtr); + for (int peopleNum = 1; peopleNum <= state.dataHeatBal->TotPeople; ++peopleNum) { + if (ActualZoneNum == state.dataHeatBal->People(peopleNum).ZonePtr) { + int NumberOccupants = state.dataHeatBal->People(peopleNum).NumberOfPeople * + ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->People(peopleNum).NumberOfPeoplePtr); PeopleCount += NumberOccupants; - GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); + GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); SetPointLo += Tset * NumberOccupants; if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) { - GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); + GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); SetPointHi += Tset * NumberOccupants; } } @@ -6489,13 +6428,13 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) PeopleCount); SetPointLo = 0.0; SetPointHi = 0.0; - for (int PeopleNum = 1; PeopleNum <= state.dataHeatBal->TotPeople; ++PeopleNum) { - if (ActualZoneNum == state.dataHeatBal->People(PeopleNum).ZonePtr) { + for (int peopleNum = 1; peopleNum <= state.dataHeatBal->TotPeople; ++peopleNum) { + if (ActualZoneNum == state.dataHeatBal->People(peopleNum).ZonePtr) { ++ObjectCount; - GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); + GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); SetPointLo += Tset; if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) { - GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); + GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); SetPointHi += Tset; } } @@ -6674,7 +6613,6 @@ void GetComfortSetPoints(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 PMVResult = 0.0; // Calculated PMV value - int SolFla = 0; // feed back flag from SolveRoot auto &comfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlNum); Real64 Tmin = comfortControlledZone.TdbMinSetPoint; @@ -6692,6 +6630,7 @@ void GetComfortSetPoints(EnergyPlusData &state, return (PMVSet - PMVresult); }; + int SolFla = 0; // feed back flag from SolveRoot General::SolveRoot(state, Acc, MaxIter, SolFla, Tset, f, Tmin, Tmax); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { @@ -6790,7 +6729,7 @@ void OverrideAirSetPointsforEMSCntrl(EnergyPlusData &state) auto &ZoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi; for (int Loop = 1; Loop <= state.dataZoneCtrls->NumTempControlledZones; ++Loop) { - auto &tempControlledZone = state.dataZoneCtrls->TempControlledZone(Loop); + auto const &tempControlledZone = state.dataZoneCtrls->TempControlledZone(Loop); if (tempControlledZone.EMSOverrideHeatingSetPointOn) { int ZoneNum = tempControlledZone.ActualZoneNum; @@ -7312,8 +7251,10 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re } } ZoneSetPoint = thisTempZoneThermostatSetPoint; - if (RAFNFrac > 0.0) LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; - if (RAFNFrac > 0.0) LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; + if (RAFNFrac > 0.0) { + LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; + LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; + } if (thisZone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) { LoadToCoolingSetPoint = this->tempDepLoad * thisZone.AdjustedReturnTempByITE - this->tempIndLoad; @@ -7398,8 +7339,10 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re assert(false); } } - if (RAFNFrac > 0.0) LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; - if (RAFNFrac > 0.0) LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; + if (RAFNFrac > 0.0) { // several of these inside the switch/case ?? + LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; + LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; + } if (thisZone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) { LoadToCoolingSetPoint = this->tempDepLoad * thisZone.AdjustedReturnTempByITE - this->tempIndLoad; diff --git a/src/Transition/CreateNewIDFUsingRulesV24_2_0.f90 b/src/Transition/CreateNewIDFUsingRulesV24_2_0.f90 index 9c02c3db66d..8064da795de 100644 --- a/src/Transition/CreateNewIDFUsingRulesV24_2_0.f90 +++ b/src/Transition/CreateNewIDFUsingRulesV24_2_0.f90 @@ -394,7 +394,9 @@ SUBROUTINE CreateNewIDFUsingRules(EndOfFile,DiffOnly,InLfn,AskForInput,InputFile OldFanVO(NumOldFanVO)%coeff5 = TRIM(IDFRecords(Num)%Numbers(12)) !- Coefficient5 x**4 OldFanVO(NumOldFanVO)%inletAirNodeName = TRIM(IDFRecords(Num)%Alphas(4)) OldFanVO(NumOldFanVO)%outletAirNodeName = TRIM(IDFRecords(Num)%Alphas(5)) - OldFanVO(NumOldFanVO)%endUseSubCat = TRIM(IDFRecords(Num)%Alphas(6)) + IF (lEN(IDFRecords(Num)%Alphas) .eq. 6) THEN + OldFanVO(NumOldFanVO)%endUseSubCat = TRIM(IDFRecords(Num)%Alphas(6)) + ENDIF IF (FindItemInList(TRIM(IDFRecords(Num)%Alphas(1)), vavFanNameToDelete, NumVRFTU) /= 0) THEN DeleteThisRecord(Num) = .TRUE. ENDIF diff --git a/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc b/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc index a33c98e10b8..ea744bf82c8 100644 --- a/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc +++ b/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc @@ -4054,7 +4054,7 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOASTest) EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); + Material::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -8440,7 +8440,7 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_ReportVariableResetTest) EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); + Material::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc index 0e79bbcdf83..07854f82f6a 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc @@ -4393,7 +4393,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestFanModel) EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); + Material::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc index d3f24a2ba0c..00ecff66806 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc @@ -2122,7 +2122,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); + Material::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -5931,7 +5931,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); + Material::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -10429,7 +10429,7 @@ TEST_F(EnergyPlusFixture, DISABLED_AirLoopNumTest) EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); + Material::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -14092,7 +14092,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestIntraZoneLinkageZoneIndex) HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); ZoneEquipmentManager::GetZoneEquipment(*state); - HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); + Material::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -16216,7 +16216,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_DuctSizingTest) EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); + Material::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/CMakeLists.txt b/tst/EnergyPlus/unit/CMakeLists.txt index 63eaff06bbc..3259c7e9983 100644 --- a/tst/EnergyPlus/unit/CMakeLists.txt +++ b/tst/EnergyPlus/unit/CMakeLists.txt @@ -110,6 +110,7 @@ set(test_src EvaporativeCoolers.unit.cc EvaporativeFluidCoolers.unit.cc ExhaustSystem.unit.cc + ExtendedHI.unit.cc ExteriorEnergyUse.unit.cc FanCoilUnits.unit.cc Fans.unit.cc diff --git a/tst/EnergyPlus/unit/Construction.unit.cc b/tst/EnergyPlus/unit/Construction.unit.cc index 9f7a226dbb7..4a542cdf872 100644 --- a/tst/EnergyPlus/unit/Construction.unit.cc +++ b/tst/EnergyPlus/unit/Construction.unit.cc @@ -70,20 +70,30 @@ TEST_F(EnergyPlusFixture, Construction_reportLayers) SetPredefinedTables(*state); - m->TotMaterials = 8; - for (int i = 1; i <= m->TotMaterials; i++) { - Material::MaterialChild *p = new Material::MaterialChild; - m->Material.push_back(p); - } - - m->Material(1)->Name = "mat a"; - m->Material(2)->Name = "mat b"; - m->Material(3)->Name = "mat c"; - m->Material(4)->Name = "mat d"; - m->Material(5)->Name = "mat e"; - m->Material(6)->Name = "mat f"; - m->Material(7)->Name = "mat g"; - m->Material(8)->Name = "mat h"; + auto *mata = new Material::MaterialBase; + mata->Name = "mat a"; + m->materials.push_back(mata); + auto *matb = new Material::MaterialBase; + matb->Name = "mat b"; + m->materials.push_back(matb); + auto *matc = new Material::MaterialBase; + matc->Name = "mat c"; + m->materials.push_back(matc); + auto *matd = new Material::MaterialBase; + matd->Name = "mat d"; + m->materials.push_back(matd); + auto *mate = new Material::MaterialBase; + mate->Name = "mat e"; + m->materials.push_back(mate); + auto *matf = new Material::MaterialBase; + matf->Name = "mat f"; + m->materials.push_back(matf); + auto *matg = new Material::MaterialBase; + matg->Name = "mat g"; + m->materials.push_back(matg); + auto *math = new Material::MaterialBase; + math->Name = "mat h"; + m->materials.push_back(math); c->Construct.allocate(3); diff --git a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc index 82f29277ba3..69790886002 100644 --- a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc +++ b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc @@ -3718,6 +3718,7 @@ TEST_F(ConvectionCoefficientsFixture, testTARPNaturalConvectionAlgorithm) TEST_F(ConvectionCoefficientsFixture, RoofExtConvectionCoefficient) { + auto &s_mat = state->dataMaterial; state->dataSurface->Surface.allocate(1); @@ -3755,14 +3756,12 @@ TEST_F(ConvectionCoefficientsFixture, RoofExtConvectionCoefficient) state->dataConstruction->Construct(1).LayerPoint(1) = 1; // define material - state->dataMaterial->TotMaterials = 1; - Material::MaterialChild *mat = new Material::MaterialChild; - state->dataMaterial->Material.push_back(mat); - auto *thisMaterial_1 = dynamic_cast(state->dataMaterial->Material(1)); - thisMaterial_1->AbsorpThermalFront = 0.1; - thisMaterial_1->Roughness = Material::SurfaceRoughness::Rough; - thisMaterial_1->Name = "Roof_Material"; - thisMaterial_1->group = Material::Group::Regular; + auto *mat1 = new Material::MaterialBase; + s_mat->materials.push_back(mat1); + mat1->AbsorpThermalFront = 0.1; + mat1->Roughness = Material::SurfaceRoughness::Rough; + mat1->Name = "Roof_Material"; + mat1->group = Material::Group::Regular; // set environment air conditions state->dataEnvrn->OutBaroPress = 101325.0; // Pa @@ -4051,7 +4050,7 @@ TEST_F(ConvectionCoefficientsFixture, SurroundingSurfacesHRadCoefTest) // calculate surrounding surface radiation coeffient Real64 surf_tempExtK = state->dataHeatBalSurf->SurfOutsideTempHist(1)(surfNum) + Constant::Kelvin; auto &north_wall_const = state->dataConstruction->Construct(surface_north_wall.Construction); - auto *north_wall_mat = dynamic_cast(state->dataMaterial->Material(north_wall_const.LayerPoint(1))); + auto const *north_wall_mat = state->dataMaterial->materials(north_wall_const.LayerPoint(1)); Real64 surf_absExt_north_wall = north_wall_mat->AbsorpThermal; // LW emitance of the exterior surface // calculate surrounding surfaces radiation exchange coefficient Real64 north_wall_srdSurfsTK = surface_north_wall.SrdSurfTemp + Constant::Kelvin; @@ -4090,7 +4089,7 @@ TEST_F(ConvectionCoefficientsFixture, SurroundingSurfacesHRadCoefTest) // calculate surrounding surface radiation coeffient surf_tempExtK = state->dataHeatBalSurf->SurfOutsideTempHist(1)(surfNum) + Constant::Kelvin; auto &east_wall_const = state->dataConstruction->Construct(surface_east_wall.Construction); - auto *east_wall_mat = dynamic_cast(state->dataMaterial->Material(east_wall_const.LayerPoint(1))); + auto const *east_wall_mat = state->dataMaterial->materials(east_wall_const.LayerPoint(1)); Real64 surf_absExt_east_wall = east_wall_mat->AbsorpThermal; // LW emitance of the exterior surface // calculate surrounding surfaces radiation exchange coefficient Real64 east_wall_srdSurfsTK = surface_east_wall.SrdSurfTemp + Constant::Kelvin; diff --git a/tst/EnergyPlus/unit/DXCoils.unit.cc b/tst/EnergyPlus/unit/DXCoils.unit.cc index fddcb1dd1c0..63715acc638 100644 --- a/tst/EnergyPlus/unit/DXCoils.unit.cc +++ b/tst/EnergyPlus/unit/DXCoils.unit.cc @@ -4737,7 +4737,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) ! , Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF {Btu/W-h}, Region Number DX Heating Coil Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 34415.4, 20666.4, 6.56, 4 ! , Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF2 {Btu/W-h}, Region Number - DX Heating Coil AHRI 2023 Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 34697.2, 20948.1, 5.34, 4 + DX Heating Coil AHRI 2023 Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 34697.2, 20948.1, 5.76, 4 )EIO"; EXPECT_TRUE(compare_eio_stream(htg_coil_eio_output, true)); } @@ -6956,4 +6956,788 @@ TEST_F(EnergyPlusFixture, Test_DHW_End_Use_Cat_Removal) EXPECT_EQ((int)state->dataOutputProcessor->meters[20]->endUseCat, (int)OutputProcessor::EndUseCat::WaterSystem); } +TEST_F(EnergyPlusFixture, MultiSpeedDXHeatingCoilsHSPF2Test) +{ + // Test HSPF2 for Coil:Heating:DX:MultiSpeed #9909 + + std::string const idf_objects = delimited_string({ + + " Coil:Heating:DX:MultiSpeed,", + " ashp htg coil, !- Name", + " , !- Availability Schedule Name", + " ashp unitary system Cooling Coil - Heating Coil Node, !- Air Inlet Node Name", + " ashp unitary system Heating Coil - Supplemental Coil Node, !- Air Outlet Node Name", + " -8.0, !- Minimum Outdoor Dry-Bulb Temperature for Compressor Operation {C}", + " -6.0, !- Outdoor Dry-Bulb Temperature to Turn On Compressor {C}", + " 50, !- Crankcase Heater Capacity {W}", + " , !- Crankcase Heater Capacity Function of Temperature Curve Name", + " 10, !- Maximum Outdoor Dry-Bulb Temperature for Crankcase Heater Operation {C}", + " DefrostEIR, !- Defrost Energy Input Ratio Function of Temperature Curve Name", + " 4.44444444444444, !- Maximum Outdoor Dry-Bulb Temperature for Defrost Operation {C}", + " ReverseCycle, !- Defrost Strategy", + " OnDemand, !- Defrost Control", + " 0.058333, !- Defrost Time Period Fraction", + " AutoSize, !- Resistive Defrost Heater Capacity {W}", + " No, !- Apply Part Load Fraction to Speeds Greater than 1", + " Electricity, !- Fuel Type", + " 4, !- Region number for Calculating HSPF", + " 2, !- Number of Speeds", + " AutoSize, !- Speed Gross Rated Heating Capacity 1 {W}", + " 4.60, !- Speed Gross Rated Heating COP 1 {W/W}", + " AutoSize, !- Speed Rated Air Flow Rate 1 {m3/s}", + " 773.3, !- 2017 Speed 1 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", + " 834.4, !- 2023 Speed 1 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", //?? + " HP_Heat-Cap-fT1, !- Speed Heating Capacity Function of Temperature Curve Name 1", + " HP_Heat-CAP-fFF1, !- Speed Heating Capacity Function of Flow Fraction Curve Name 1", + " HP_Heat-EIR-fT1, !- Speed Energy Input Ratio Function of Temperature Curve Name 1", + " HP_Heat-EIR-fFF1, !- Speed Energy Input Ratio Function of Flow Fraction Curve Name 1", + " HP_Heat-PLF-fPLR1, !- Speed Part Load Fraction Correlation Curve Name 1", + " 0.2, !- Speed Rated Waste Heat Fraction of Power Input 1 {dimensionless}", + " ConstantBiquadratic, !- Speed Waste Heat Function of Temperature Curve Name 1", + " AutoSize, !- Speed Gross Rated Heating Capacity 2 {W}", + " 4.40, !- Speed Gross Rated Heating COP 2 {W/W}", + " AutoSize, !- Speed Rated Air Flow Rate 2 {m3/s}", + " 773.3, !- 2017 Speed 2 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", + " 834.3, !- 2023 Speed 2 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", //?? + " HP_Heat-Cap-fT2, !- Speed Heating Capacity Function of Temperature Curve Name 2", + " HP_Heat-CAP-fFF2, !- Speed Heating Capacity Function of Flow Fraction Curve Name 2", + " HP_Heat-EIR-fT2, !- Speed Energy Input Ratio Function of Temperature Curve Name 2", + " HP_Heat-EIR-fFF2, !- Speed Energy Input Ratio Function of Flow Fraction Curve Name 2", + " HP_Heat-PLF-fPLR2, !- Speed Part Load Fraction Correlation Curve Name 2", + " 0.2, !- Speed Rated Waste Heat Fraction of Power Input 2 {dimensionless}", + " ConstantBiquadratic; !- Speed Waste Heat Function of Temperature Curve Name 2", + + " Curve:Biquadratic,", + " DefrostEIR, !- Name", + " 0.1528, !- Coefficient1 Constant", + " 0, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Coefficient4 y", + " 0, !- Coefficient5 y**2", + " 0, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-Cap-fT1, !- Name", + " 0.84077409, !- Coefficient1 Constant", + " -0.0014336586, !- Coefficient2 x", + " -0.000150336, !- Coefficient3 x**2", + " 0.029628603, !- Coefficient4 y", + " 0.000161676, !- Coefficient5 y**2", + " -2.349e-005, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-CAP-fFF1, !- Name", + " 0.741466907, !- Coefficient1 Constant", + " 0.378645444, !- Coefficient2 x", + " -0.119754733, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-EIR-fT1, !- Name", + " 0.539472334, !- Coefficient1 Constant", + " 0.0165103146, !- Coefficient2 x", + " 0.00083874528, !- Coefficient3 x**2", + " -0.00403234020000001, !- Coefficient4 y", + " 0.00142404156, !- Coefficient5 y**2", + " -0.00211806252, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-EIR-fFF1, !- Name", + " 2.153618211, !- Coefficient1 Constant", + " -1.737190609, !- Coefficient2 x", + " 0.584269478, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-PLF-fPLR1, !- Name", + " 0.89, !- Coefficient1 Constant", + " 0.11, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.7, !- Minimum Curve Output {BasedOnField A3}", + " 1; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Biquadratic,", + " ConstantBiquadratic, !- Name", + " 1, !- Coefficient1 Constant", + " 0, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Coefficient4 y", + " 0, !- Coefficient5 y**2", + " 0, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-Cap-fT2, !- Name", + " 0.831506971, !- Coefficient1 Constant", + " 0.0018392166, !- Coefficient2 x", + " -0.000187596, !- Coefficient3 x**2", + " 0.0266002056, !- Coefficient4 y", + " 0.000191484, !- Coefficient5 y**2", + " -6.5772e-005, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-CAP-fFF2, !- Name", + " 0.76634609, !- Coefficient1 Constant", + " 0.32840943, !- Coefficient2 x", + " -0.094701495, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-EIR-fT2, !- Name", + " 0.787746797, !- Coefficient1 Constant", + " -0.000652314599999999, !- Coefficient2 x", + " 0.00078866784, !- Coefficient3 x**2", + " -0.0023209056, !- Coefficient4 y", + " 0.00074760408, !- Coefficient5 y**2", + " -0.00109173096, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-EIR-fFF2, !- Name", + " 2.001041353, !- Coefficient1 Constant", + " -1.58869128, !- Coefficient2 x", + " 0.587593517, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-PLF-fPLR2, !- Name", + " 0.89, !- Coefficient1 Constant", + " 0.11, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.7, !- Minimum Curve Output {BasedOnField A3}", + " 1; !- Maximum Curve Output {BasedOnField A3}", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + // get input + GetDXCoils(*state); + SetPredefinedTables(*state); + state->dataEnvrn->StdBaroPress = 101325.0; + state->dataEnvrn->StdRhoAir = 1.2; + Psychrometrics::InitializePsychRoutines(*state); + + // set sizing parameters + state->dataSize->CurZoneEqNum = 0; + state->dataSize->CurSysNum = 1; + state->dataSize->FinalSysSizing.allocate(1); + state->dataSize->SysSizingRunDone = true; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).DesMainVolFlow = 0.580; + // set heating sizing parameters + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatOutTemp = 14.4064; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatOutHumRat = 0.005; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatSupTemp = 35.0; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatSupHumRat = 0.005; + state->dataSize->SysSizInput.allocate(1); + state->dataSize->SysSizInput(1).AirLoopNum = state->dataSize->CurSysNum; + state->dataSize->NumSysSizInput = 1; + // Need this to prevent crash in Sizers + state->dataSize->UnitarySysEqSizing.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(state->dataSize->CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(state->dataSize->CurSysNum).supFanNum = -1; + state->dataAirSystemsData->PrimaryAirSystems(state->dataSize->CurSysNum).retFanNum = -1; + + // set companion dx cooling coil + state->dataDXCoils->DXCoil(1).CompanionUpstreamDXCoil = 0; + auto thisHtgDXCoil = state->dataDXCoils->DXCoil(1); + // check multi-speed DX heating coil + EXPECT_EQ("ASHP HTG COIL", thisHtgDXCoil.Name); + EXPECT_EQ("Coil:Heating:DX:MultiSpeed", thisHtgDXCoil.DXCoilType); + EXPECT_EQ(-8.0, thisHtgDXCoil.MinOATCompressor); + EXPECT_EQ(-6.0, thisHtgDXCoil.OATempCompressorOn); + EXPECT_EQ(773.3, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate(1)); + EXPECT_EQ(834.4, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate_2023(1)); + + // reset eio stream + has_eio_output(true); + // autosize the coil + SizeDXCoil(*state, 1); + // capture autosized parameters + thisHtgDXCoil = state->dataDXCoils->DXCoil(1); + // check autosized values + EXPECT_EQ(0.580, thisHtgDXCoil.MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.290, thisHtgDXCoil.MSRatedAirVolFlowRate(2) * 0.5); + EXPECT_EQ(0.290, thisHtgDXCoil.MSRatedAirVolFlowRate(1)); + EXPECT_NEAR(14402.78, thisHtgDXCoil.MSRatedTotCap(2), 0.01); + EXPECT_NEAR(7201.39, thisHtgDXCoil.MSRatedTotCap(1), 0.01); + + // Check EIO reporting + const std::string htg_coil_eio_output = R"EIO(! , Component Type, Component Name, Input Field Description, Value + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 2 Rated Air Flow Rate [m3/s], 0.58000 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 1 Rated Air Flow Rate [m3/s], 0.29000 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 2 Gross Rated Heating Capacity [W], 14402.78123 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 1 Gross Rated Heating Capacity [W], 7201.39061 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Resistive Defrost Heater Capacity, 0.00000 +! , Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF {Btu/W-h}, Region Number + DX Heating Coil Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 14996.6, 8946.7, 8.12, 4 +! , Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF2 {Btu/W-h}, Region Number + DX Heating Coil AHRI 2023 Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 15032.0, 8982.1, 7.29, 4 +)EIO"; + + EXPECT_TRUE(compare_eio_stream(htg_coil_eio_output, true)); +} + +TEST_F(EnergyPlusFixture, MultiSpeedDXHeatingCoilsHSPF2Test1) +{ + // Test HSPF2 for Coil:Heating:DX:MultiSpeed #9909 + + std::string const idf_objects = delimited_string({ + + " Coil:Heating:DX:MultiSpeed,", + " ashp htg coil, !- Name", + " , !- Availability Schedule Name", + " ashp unitary system Cooling Coil - Heating Coil Node, !- Air Inlet Node Name", + " ashp unitary system Heating Coil - Supplemental Coil Node, !- Air Outlet Node Name", + " -8.0, !- Minimum Outdoor Dry-Bulb Temperature for Compressor Operation {C}", + " -6.0, !- Outdoor Dry-Bulb Temperature to Turn On Compressor {C}", + " 50, !- Crankcase Heater Capacity {W}", + " , !- Crankcase Heater Capacity Function of Temperature Curve Name", + " 10, !- Maximum Outdoor Dry-Bulb Temperature for Crankcase Heater Operation {C}", + " DefrostEIR, !- Defrost Energy Input Ratio Function of Temperature Curve Name", + " 4.44444444444444, !- Maximum Outdoor Dry-Bulb Temperature for Defrost Operation {C}", + " ReverseCycle, !- Defrost Strategy", + " OnDemand, !- Defrost Control", + " 0.058333, !- Defrost Time Period Fraction", + " AutoSize, !- Resistive Defrost Heater Capacity {W}", + " No, !- Apply Part Load Fraction to Speeds Greater than 1", + " Electricity, !- Fuel Type", + " 4, !- Region number for Calculating HSPF", + " 2, !- Number of Speeds", + " AutoSize, !- Speed Gross Rated Heating Capacity 1 {W}", + " 4.60, !- Speed Gross Rated Heating COP 1 {W/W}", + " AutoSize, !- Speed Rated Air Flow Rate 1 {m3/s}", + " 773.3, !- 2017 Speed 1 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", + " 773.3, !- 2023 Speed 1 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", //?? + " HP_Heat-Cap-fT1, !- Speed Heating Capacity Function of Temperature Curve Name 1", + " HP_Heat-CAP-fFF1, !- Speed Heating Capacity Function of Flow Fraction Curve Name 1", + " HP_Heat-EIR-fT1, !- Speed Energy Input Ratio Function of Temperature Curve Name 1", + " HP_Heat-EIR-fFF1, !- Speed Energy Input Ratio Function of Flow Fraction Curve Name 1", + " HP_Heat-PLF-fPLR1, !- Speed Part Load Fraction Correlation Curve Name 1", + " 0.2, !- Speed Rated Waste Heat Fraction of Power Input 1 {dimensionless}", + " ConstantBiquadratic, !- Speed Waste Heat Function of Temperature Curve Name 1", + " AutoSize, !- Speed Gross Rated Heating Capacity 2 {W}", + " 4.40, !- Speed Gross Rated Heating COP 2 {W/W}", + " AutoSize, !- Speed Rated Air Flow Rate 2 {m3/s}", + " 773.3, !- 2017 Speed 2 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", + " 773.3, !- 2023 Speed 2 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", //?? + " HP_Heat-Cap-fT2, !- Speed Heating Capacity Function of Temperature Curve Name 2", + " HP_Heat-CAP-fFF2, !- Speed Heating Capacity Function of Flow Fraction Curve Name 2", + " HP_Heat-EIR-fT2, !- Speed Energy Input Ratio Function of Temperature Curve Name 2", + " HP_Heat-EIR-fFF2, !- Speed Energy Input Ratio Function of Flow Fraction Curve Name 2", + " HP_Heat-PLF-fPLR2, !- Speed Part Load Fraction Correlation Curve Name 2", + " 0.2, !- Speed Rated Waste Heat Fraction of Power Input 2 {dimensionless}", + " ConstantBiquadratic; !- Speed Waste Heat Function of Temperature Curve Name 2", + + " Curve:Biquadratic,", + " DefrostEIR, !- Name", + " 0.1528, !- Coefficient1 Constant", + " 0, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Coefficient4 y", + " 0, !- Coefficient5 y**2", + " 0, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-Cap-fT1, !- Name", + " 0.84077409, !- Coefficient1 Constant", + " -0.0014336586, !- Coefficient2 x", + " -0.000150336, !- Coefficient3 x**2", + " 0.029628603, !- Coefficient4 y", + " 0.000161676, !- Coefficient5 y**2", + " -2.349e-005, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-CAP-fFF1, !- Name", + " 0.741466907, !- Coefficient1 Constant", + " 0.378645444, !- Coefficient2 x", + " -0.119754733, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-EIR-fT1, !- Name", + " 0.539472334, !- Coefficient1 Constant", + " 0.0165103146, !- Coefficient2 x", + " 0.00083874528, !- Coefficient3 x**2", + " -0.00403234020000001, !- Coefficient4 y", + " 0.00142404156, !- Coefficient5 y**2", + " -0.00211806252, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-EIR-fFF1, !- Name", + " 2.153618211, !- Coefficient1 Constant", + " -1.737190609, !- Coefficient2 x", + " 0.584269478, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-PLF-fPLR1, !- Name", + " 0.89, !- Coefficient1 Constant", + " 0.11, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.7, !- Minimum Curve Output {BasedOnField A3}", + " 1; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Biquadratic,", + " ConstantBiquadratic, !- Name", + " 1, !- Coefficient1 Constant", + " 0, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Coefficient4 y", + " 0, !- Coefficient5 y**2", + " 0, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-Cap-fT2, !- Name", + " 0.831506971, !- Coefficient1 Constant", + " 0.0018392166, !- Coefficient2 x", + " -0.000187596, !- Coefficient3 x**2", + " 0.0266002056, !- Coefficient4 y", + " 0.000191484, !- Coefficient5 y**2", + " -6.5772e-005, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-CAP-fFF2, !- Name", + " 0.76634609, !- Coefficient1 Constant", + " 0.32840943, !- Coefficient2 x", + " -0.094701495, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-EIR-fT2, !- Name", + " 0.787746797, !- Coefficient1 Constant", + " -0.000652314599999999, !- Coefficient2 x", + " 0.00078866784, !- Coefficient3 x**2", + " -0.0023209056, !- Coefficient4 y", + " 0.00074760408, !- Coefficient5 y**2", + " -0.00109173096, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-EIR-fFF2, !- Name", + " 2.001041353, !- Coefficient1 Constant", + " -1.58869128, !- Coefficient2 x", + " 0.587593517, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-PLF-fPLR2, !- Name", + " 0.89, !- Coefficient1 Constant", + " 0.11, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.7, !- Minimum Curve Output {BasedOnField A3}", + " 1; !- Maximum Curve Output {BasedOnField A3}", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + // get input + GetDXCoils(*state); + SetPredefinedTables(*state); + state->dataEnvrn->StdBaroPress = 101325.0; + state->dataEnvrn->StdRhoAir = 1.2; + Psychrometrics::InitializePsychRoutines(*state); + + // set sizing parameters + state->dataSize->CurZoneEqNum = 0; + state->dataSize->CurSysNum = 1; + state->dataSize->FinalSysSizing.allocate(1); + state->dataSize->SysSizingRunDone = true; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).DesMainVolFlow = 0.580; + // set heating sizing parameters + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatOutTemp = 14.4064; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatOutHumRat = 0.005; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatSupTemp = 35.0; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatSupHumRat = 0.005; + state->dataSize->SysSizInput.allocate(1); + state->dataSize->SysSizInput(1).AirLoopNum = state->dataSize->CurSysNum; + state->dataSize->NumSysSizInput = 1; + // Need this to prevent crash in Sizers + state->dataSize->UnitarySysEqSizing.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(state->dataSize->CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(state->dataSize->CurSysNum).supFanNum = -1; + state->dataAirSystemsData->PrimaryAirSystems(state->dataSize->CurSysNum).retFanNum = -1; + + // set companion dx cooling coil + state->dataDXCoils->DXCoil(1).CompanionUpstreamDXCoil = 0; + auto thisHtgDXCoil = state->dataDXCoils->DXCoil(1); + // check multi-speed DX heating coil + EXPECT_EQ("ASHP HTG COIL", thisHtgDXCoil.Name); + EXPECT_EQ("Coil:Heating:DX:MultiSpeed", thisHtgDXCoil.DXCoilType); + EXPECT_EQ(-8.0, thisHtgDXCoil.MinOATCompressor); + EXPECT_EQ(-6.0, thisHtgDXCoil.OATempCompressorOn); + EXPECT_EQ(773.3, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate(1)); + EXPECT_EQ(773.3, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate_2023(1)); + EXPECT_EQ(773.3, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate(2)); + EXPECT_EQ(773.3, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate_2023(2)); + + // reset eio stream + has_eio_output(true); + // autosize the coil + SizeDXCoil(*state, 1); + // capture autosized parameters + thisHtgDXCoil = state->dataDXCoils->DXCoil(1); + // check autosized values + EXPECT_EQ(0.580, thisHtgDXCoil.MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.290, thisHtgDXCoil.MSRatedAirVolFlowRate(2) * 0.5); + EXPECT_EQ(0.290, thisHtgDXCoil.MSRatedAirVolFlowRate(1)); + EXPECT_NEAR(14402.78, thisHtgDXCoil.MSRatedTotCap(2), 0.01); + EXPECT_NEAR(7201.39, thisHtgDXCoil.MSRatedTotCap(1), 0.01); + + // Check EIO reporting + const std::string htg_coil_eio_output = R"EIO(! , Component Type, Component Name, Input Field Description, Value + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 2 Rated Air Flow Rate [m3/s], 0.58000 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 1 Rated Air Flow Rate [m3/s], 0.29000 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 2 Gross Rated Heating Capacity [W], 14402.78123 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 1 Gross Rated Heating Capacity [W], 7201.39061 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Resistive Defrost Heater Capacity, 0.00000 +! , Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF {Btu/W-h}, Region Number + DX Heating Coil Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 14996.6, 8946.7, 8.12, 4 +! , Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF2 {Btu/W-h}, Region Number + DX Heating Coil AHRI 2023 Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 14996.6, 8946.7, 7.32, 4 +)EIO"; + + EXPECT_TRUE(compare_eio_stream(htg_coil_eio_output, true)); +} + +TEST_F(EnergyPlusFixture, MultiSpeedDXHeatingCoilsHSPF2Test2) +{ + // Test HSPF2 for Coil:Heating:DX:MultiSpeed #9909 + + std::string const idf_objects = delimited_string({ + + " Coil:Heating:DX:MultiSpeed,", + " ashp htg coil, !- Name", + " , !- Availability Schedule Name", + " ashp unitary system Cooling Coil - Heating Coil Node, !- Air Inlet Node Name", + " ashp unitary system Heating Coil - Supplemental Coil Node, !- Air Outlet Node Name", + " -10.0, !- Minimum Outdoor Dry-Bulb Temperature for Compressor Operation {C}", + " -8.0, !- Outdoor Dry-Bulb Temperature to Turn On Compressor {C}", + " 50, !- Crankcase Heater Capacity {W}", + " , !- Crankcase Heater Capacity Function of Temperature Curve Name", + " 10, !- Maximum Outdoor Dry-Bulb Temperature for Crankcase Heater Operation {C}", + " DefrostEIR, !- Defrost Energy Input Ratio Function of Temperature Curve Name", + " 4.44444444444444, !- Maximum Outdoor Dry-Bulb Temperature for Defrost Operation {C}", + " ReverseCycle, !- Defrost Strategy", + " OnDemand, !- Defrost Control", + " 0.058333, !- Defrost Time Period Fraction", + " AutoSize, !- Resistive Defrost Heater Capacity {W}", + " No, !- Apply Part Load Fraction to Speeds Greater than 1", + " Electricity, !- Fuel Type", + " 4, !- Region number for Calculating HSPF", + " 2, !- Number of Speeds", + " AutoSize, !- Speed Gross Rated Heating Capacity 1 {W}", + " 4.60, !- Speed Gross Rated Heating COP 1 {W/W}", + " AutoSize, !- Speed Rated Air Flow Rate 1 {m3/s}", + " 773.3, !- 2017 Speed 1 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", + " 773.3, !- 2023 Speed 1 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", //?? + " HP_Heat-Cap-fT1, !- Speed Heating Capacity Function of Temperature Curve Name 1", + " HP_Heat-CAP-fFF1, !- Speed Heating Capacity Function of Flow Fraction Curve Name 1", + " HP_Heat-EIR-fT1, !- Speed Energy Input Ratio Function of Temperature Curve Name 1", + " HP_Heat-EIR-fFF1, !- Speed Energy Input Ratio Function of Flow Fraction Curve Name 1", + " HP_Heat-PLF-fPLR1, !- Speed Part Load Fraction Correlation Curve Name 1", + " 0.2, !- Speed Rated Waste Heat Fraction of Power Input 1 {dimensionless}", + " ConstantBiquadratic, !- Speed Waste Heat Function of Temperature Curve Name 1", + " AutoSize, !- Speed Gross Rated Heating Capacity 2 {W}", + " 4.40, !- Speed Gross Rated Heating COP 2 {W/W}", + " AutoSize, !- Speed Rated Air Flow Rate 2 {m3/s}", + " 773.3, !- 2017 Speed 2 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", + " 773.3, !- 2023 Speed 2 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", //?? + " HP_Heat-Cap-fT2, !- Speed Heating Capacity Function of Temperature Curve Name 2", + " HP_Heat-CAP-fFF2, !- Speed Heating Capacity Function of Flow Fraction Curve Name 2", + " HP_Heat-EIR-fT2, !- Speed Energy Input Ratio Function of Temperature Curve Name 2", + " HP_Heat-EIR-fFF2, !- Speed Energy Input Ratio Function of Flow Fraction Curve Name 2", + " HP_Heat-PLF-fPLR2, !- Speed Part Load Fraction Correlation Curve Name 2", + " 0.2, !- Speed Rated Waste Heat Fraction of Power Input 2 {dimensionless}", + " ConstantBiquadratic; !- Speed Waste Heat Function of Temperature Curve Name 2", + + " Curve:Biquadratic,", + " DefrostEIR, !- Name", + " 0.1528, !- Coefficient1 Constant", + " 0, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Coefficient4 y", + " 0, !- Coefficient5 y**2", + " 0, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-Cap-fT1, !- Name", + " 0.84077409, !- Coefficient1 Constant", + " -0.0014336586, !- Coefficient2 x", + " -0.000150336, !- Coefficient3 x**2", + " 0.029628603, !- Coefficient4 y", + " 0.000161676, !- Coefficient5 y**2", + " -2.349e-005, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-CAP-fFF1, !- Name", + " 0.741466907, !- Coefficient1 Constant", + " 0.378645444, !- Coefficient2 x", + " -0.119754733, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-EIR-fT1, !- Name", + " 0.539472334, !- Coefficient1 Constant", + " 0.0165103146, !- Coefficient2 x", + " 0.00083874528, !- Coefficient3 x**2", + " -0.00403234020000001, !- Coefficient4 y", + " 0.00142404156, !- Coefficient5 y**2", + " -0.00211806252, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-EIR-fFF1, !- Name", + " 2.153618211, !- Coefficient1 Constant", + " -1.737190609, !- Coefficient2 x", + " 0.584269478, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-PLF-fPLR1, !- Name", + " 0.89, !- Coefficient1 Constant", + " 0.11, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.7, !- Minimum Curve Output {BasedOnField A3}", + " 1; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Biquadratic,", + " ConstantBiquadratic, !- Name", + " 1, !- Coefficient1 Constant", + " 0, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Coefficient4 y", + " 0, !- Coefficient5 y**2", + " 0, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-Cap-fT2, !- Name", + " 0.831506971, !- Coefficient1 Constant", + " 0.0018392166, !- Coefficient2 x", + " -0.000187596, !- Coefficient3 x**2", + " 0.0266002056, !- Coefficient4 y", + " 0.000191484, !- Coefficient5 y**2", + " -6.5772e-005, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-CAP-fFF2, !- Name", + " 0.76634609, !- Coefficient1 Constant", + " 0.32840943, !- Coefficient2 x", + " -0.094701495, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Biquadratic,", + " HP_Heat-EIR-fT2, !- Name", + " 0.787746797, !- Coefficient1 Constant", + " -0.000652314599999999, !- Coefficient2 x", + " 0.00078866784, !- Coefficient3 x**2", + " -0.0023209056, !- Coefficient4 y", + " 0.00074760408, !- Coefficient5 y**2", + " -0.00109173096, !- Coefficient6 x*y", + " -100, !- Minimum Value of x {BasedOnField A2}", + " 100, !- Maximum Value of x {BasedOnField A2}", + " -100, !- Minimum Value of y {BasedOnField A3}", + " 100; !- Maximum Value of y {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-EIR-fFF2, !- Name", + " 2.001041353, !- Coefficient1 Constant", + " -1.58869128, !- Coefficient2 x", + " 0.587593517, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 2, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Curve Output {BasedOnField A3}", + " 2; !- Maximum Curve Output {BasedOnField A3}", + + " Curve:Quadratic,", + " HP_Heat-PLF-fPLR2, !- Name", + " 0.89, !- Coefficient1 Constant", + " 0.11, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.7, !- Minimum Curve Output {BasedOnField A3}", + " 1; !- Maximum Curve Output {BasedOnField A3}", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + // get input + GetDXCoils(*state); + SetPredefinedTables(*state); + state->dataEnvrn->StdBaroPress = 101325.0; + state->dataEnvrn->StdRhoAir = 1.2; + Psychrometrics::InitializePsychRoutines(*state); + + // set sizing parameters + state->dataSize->CurZoneEqNum = 0; + state->dataSize->CurSysNum = 1; + state->dataSize->FinalSysSizing.allocate(1); + state->dataSize->SysSizingRunDone = true; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).DesMainVolFlow = 0.580; + // set heating sizing parameters + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatOutTemp = 14.4064; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatOutHumRat = 0.005; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatSupTemp = 35.0; + state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).HeatSupHumRat = 0.005; + state->dataSize->SysSizInput.allocate(1); + state->dataSize->SysSizInput(1).AirLoopNum = state->dataSize->CurSysNum; + state->dataSize->NumSysSizInput = 1; + // Need this to prevent crash in Sizers + state->dataSize->UnitarySysEqSizing.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(state->dataSize->CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(state->dataSize->CurSysNum).supFanNum = -1; + state->dataAirSystemsData->PrimaryAirSystems(state->dataSize->CurSysNum).retFanNum = -1; + + // set companion dx cooling coil + state->dataDXCoils->DXCoil(1).CompanionUpstreamDXCoil = 0; + auto thisHtgDXCoil = state->dataDXCoils->DXCoil(1); + // check multi-speed DX heating coil + EXPECT_EQ("ASHP HTG COIL", thisHtgDXCoil.Name); + EXPECT_EQ("Coil:Heating:DX:MultiSpeed", thisHtgDXCoil.DXCoilType); + EXPECT_EQ(-10.0, thisHtgDXCoil.MinOATCompressor); + EXPECT_EQ(-8.0, thisHtgDXCoil.OATempCompressorOn); + EXPECT_EQ(773.3, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate(1)); + EXPECT_EQ(773.3, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate_2023(1)); + EXPECT_EQ(773.3, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate(2)); + EXPECT_EQ(773.3, thisHtgDXCoil.MSFanPowerPerEvapAirFlowRate_2023(2)); + + // reset eio stream + has_eio_output(true); + // autosize the coil + SizeDXCoil(*state, 1); + // capture autosized parameters + thisHtgDXCoil = state->dataDXCoils->DXCoil(1); + // check autosized values + EXPECT_EQ(0.580, thisHtgDXCoil.MSRatedAirVolFlowRate(2)); + EXPECT_EQ(0.290, thisHtgDXCoil.MSRatedAirVolFlowRate(2) * 0.5); + EXPECT_EQ(0.290, thisHtgDXCoil.MSRatedAirVolFlowRate(1)); + EXPECT_NEAR(14402.78, thisHtgDXCoil.MSRatedTotCap(2), 0.01); + EXPECT_NEAR(7201.39, thisHtgDXCoil.MSRatedTotCap(1), 0.01); + + // Check EIO reporting + const std::string htg_coil_eio_output = R"EIO(! , Component Type, Component Name, Input Field Description, Value + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 2 Rated Air Flow Rate [m3/s], 0.58000 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 1 Rated Air Flow Rate [m3/s], 0.29000 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 2 Gross Rated Heating Capacity [W], 14402.78123 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Speed 1 Gross Rated Heating Capacity [W], 7201.39061 + Component Sizing Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, Design Size Resistive Defrost Heater Capacity, 0.00000 +! , Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF {Btu/W-h}, Region Number + DX Heating Coil Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 14996.6, 8946.7, 8.57, 4 +! , Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF2 {Btu/W-h}, Region Number + DX Heating Coil AHRI 2023 Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 14996.6, 8946.7, 7.66, 4 +)EIO"; + + EXPECT_TRUE(compare_eio_stream(htg_coil_eio_output, true)); +} + } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/DataHeatBalance.unit.cc b/tst/EnergyPlus/unit/DataHeatBalance.unit.cc index 80eee21ec81..b8b0ecaf334 100644 --- a/tst/EnergyPlus/unit/DataHeatBalance.unit.cc +++ b/tst/EnergyPlus/unit/DataHeatBalance.unit.cc @@ -843,9 +843,9 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_CheckConstructLayers) 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(state->dataMaterial->Material(4)->Name, "SINGLEPANE"); // single pane glass - EXPECT_EQ(state->dataMaterial->Material(5)->Name, "WINGAS"); // air gap - EXPECT_EQ(state->dataMaterial->Material(6)->Name, "BLIND"); // window blind + EXPECT_EQ(state->dataMaterial->materials(4)->Name, "SINGLEPANE"); // single pane glass + EXPECT_EQ(state->dataMaterial->materials(5)->Name, "WINGAS"); // air gap + EXPECT_EQ(state->dataMaterial->materials(6)->Name, "BLIND"); // window blind // construction layer material pointers. this construction has no blind EXPECT_EQ(state->dataConstruction->Construct(4).LayerPoint(1), 4); // glass, outer layer @@ -888,7 +888,7 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_CheckConstructLayers) SetFlagForWindowConstructionWithShadeOrBlindLayer(*state); EXPECT_TRUE(state->dataSurface->SurfWinHasShadeOrBlindLayer(windowSurfNum)); // the window construction has blind // set the blind to movable - state->dataSurface->SurfWinMovableSlats(windowSurfNum) = true; + state->dataSurface->surfShades(windowSurfNum).blind.movableSlats = true; // check if EMS actuator is available when blind layer is added SetupWindowShadingControlActuators(*state); EXPECT_EQ(state->dataRuntimeLang->numEMSActuatorsAvailable, 2); diff --git a/tst/EnergyPlus/unit/DataSizing.unit.cc b/tst/EnergyPlus/unit/DataSizing.unit.cc index f6d36b4073d..027e9b4e004 100644 --- a/tst/EnergyPlus/unit/DataSizing.unit.cc +++ b/tst/EnergyPlus/unit/DataSizing.unit.cc @@ -288,7 +288,8 @@ TEST_F(EnergyPlusFixture, OARequirements_calcDesignSpecificationOutdoorAir) }, "Space 1d" : { "zone_name": "Zone 1", - "floor_area": 100.0 + "floor_area": 100.0, + "volume": 300.0 } }, "DesignSpecification:OutdoorAir": { @@ -392,6 +393,7 @@ TEST_F(EnergyPlusFixture, OARequirements_calcDesignSpecificationOutdoorAir) thisSpaceName = "SPACE 1D"; spaceNum = Util::FindItemInList(thisSpaceName, state->dataHeatBal->space); state->dataHeatBal->space(spaceNum).FloorArea = 100.0; + state->dataHeatBal->space(spaceNum).Volume = 300.0; std::string thisZoneName = "ZONE 2"; zoneNum = Util::FindItemInList(thisZoneName, state->dataHeatBal->Zone); diff --git a/tst/EnergyPlus/unit/DaylightingManager.unit.cc b/tst/EnergyPlus/unit/DaylightingManager.unit.cc index 59981992f63..913ede27f08 100644 --- a/tst/EnergyPlus/unit/DaylightingManager.unit.cc +++ b/tst/EnergyPlus/unit/DaylightingManager.unit.cc @@ -1467,13 +1467,13 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_LuminanceShadin auto &thisDaylgtCtrl = dl->daylightControl(ZoneNum); int numExtWins = dl->enclDaylight(1).TotalExtWindows; int numRefPts = thisDaylgtCtrl.TotalDaylRefPoints; - int numSlatAngs = state->dataSurface->actualMaxSlatAngs; for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { for (int iWin = 1; iWin <= numExtWins; ++iWin) { for (int iRefPt = 1; iRefPt <= numRefPts; ++iRefPt) { - for (int iSlatAng = 1; iSlatAng <= numSlatAngs; ++iSlatAng) { - auto &daylFac = thisDaylgtCtrl.daylFac[iHr](iWin, iRefPt, iSlatAng); + for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { + auto &daylFac = thisDaylgtCtrl.daylFac[iHr](iWin, iRefPt)[iWinCover]; + daylFac[(int)Lum::Illum].sky = {0.2, 0.2, 0.2, 0.2}; daylFac[(int)Lum::Illum].sun = 0.02; daylFac[(int)Lum::Illum].sunDisk = 0.01; @@ -1481,6 +1481,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_LuminanceShadin daylFac[(int)Lum::Back].sky = {0.01, 0.01, 0.01, 0.01}; daylFac[(int)Lum::Back].sun = 0.01; daylFac[(int)Lum::Back].sunDisk = 0.01; + daylFac[(int)Lum::Source].sky = {0.9, 0.9, 0.9, 0.9}; daylFac[(int)Lum::Source].sun = 0.26; daylFac[(int)Lum::Source].sunDisk = 0.0; @@ -1505,8 +1506,8 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_LuminanceShadin for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { for (int iWin = 1; iWin <= numExtWins; ++iWin) { for (int iRefPt = 1; iRefPt <= numRefPts; ++iRefPt) { - for (int iSlatAng = 1; iSlatAng <= numSlatAngs; ++iSlatAng) { - auto &daylFac = thisDaylgtCtrl.daylFac[iHr](iWin, iRefPt, iSlatAng); + for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { + auto &daylFac = thisDaylgtCtrl.daylFac[iHr](iWin, iRefPt)[iWinCover]; daylFac[(int)Lum::Illum] = Illums(); daylFac[(int)Lum::Source] = Illums(); daylFac[(int)Lum::Back] = Illums(); @@ -1793,13 +1794,12 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) auto &thisDaylgtCtrl = dl->daylightControl(ZoneNum); int numExtWins = dl->enclDaylight(1).TotalExtWindows; int numRefPts = thisDaylgtCtrl.TotalDaylRefPoints; - int numSlatAngs = state->dataSurface->actualMaxSlatAngs; for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { for (int iWin = 1; iWin <= numExtWins; ++iWin) { for (int iRefPt = 1; iRefPt <= numRefPts; ++iRefPt) { - for (int iSlatAng = 1; iSlatAng <= numSlatAngs; ++iSlatAng) { - auto &daylFac = thisDaylgtCtrl.daylFac[iHr](iWin, iRefPt, iSlatAng); + for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { + auto &daylFac = thisDaylgtCtrl.daylFac[iHr](iWin, iRefPt)[iWinCover]; daylFac[(int)Lum::Illum] = Illums(); daylFac[(int)Lum::Source] = Illums(); daylFac[(int)Lum::Back] = Illums(); @@ -1813,19 +1813,17 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) int iSky = (int)SkyType::Clear; int DayltgExtWin = 1; - int Shaded = 2; - int Unshaded = 1; int IWin = Util::FindItemInList("ZN001:WALL001:WIN001", state->dataSurface->Surface); EXPECT_GT(IWin, 0); // Set un-shaded surface illuminance factor to 1.0 for RefPt1, 0.1 for RefPt2 // Set shaded surface illuminance factor to 0.5 for RefPt1, 0.05 for RefPt2 int RefPt = 1; - thisDaylgtCtrl.daylFac[state->dataGlobal->HourOfDay](DayltgExtWin, RefPt, Unshaded)[(int)Lum::Illum].sky[iSky] = 1.0; - thisDaylgtCtrl.daylFac[state->dataGlobal->HourOfDay](DayltgExtWin, RefPt, Shaded)[(int)Lum::Illum].sky[iSky] = 0.5; + thisDaylgtCtrl.daylFac[state->dataGlobal->HourOfDay](DayltgExtWin, RefPt)[(int)WinCover::Bare][(int)Lum::Illum].sky[iSky] = 1.0; + thisDaylgtCtrl.daylFac[state->dataGlobal->HourOfDay](DayltgExtWin, RefPt)[(int)WinCover::Shaded][(int)Lum::Illum].sky[iSky] = 0.5; RefPt = 2; - thisDaylgtCtrl.daylFac[state->dataGlobal->HourOfDay](DayltgExtWin, RefPt, Unshaded)[(int)Lum::Illum].sky[iSky] = 0.1; - thisDaylgtCtrl.daylFac[state->dataGlobal->HourOfDay](DayltgExtWin, RefPt, Shaded)[(int)Lum::Illum].sky[iSky] = 0.05; + thisDaylgtCtrl.daylFac[state->dataGlobal->HourOfDay](DayltgExtWin, RefPt)[(int)WinCover::Bare][(int)Lum::Illum].sky[iSky] = 0.1; + thisDaylgtCtrl.daylFac[state->dataGlobal->HourOfDay](DayltgExtWin, RefPt)[(int)WinCover::Shaded][(int)Lum::Illum].sky[iSky] = 0.05; // Window5 model - expect 100 for unshaded and 50 for shaded (10 and 5 for RefPt2) state->dataSurface->SurfWinWindowModelType(IWin) = WindowModel::Detailed; @@ -3674,10 +3672,10 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgIlluminanceMap) " 0.9, !- Z height {m} ", " 0.1, !- X Minimum Coordinate {m} ", " 6.0, !- X Maximum Coordinate {m} ", - " 10, !- Number of X Grid Points ", + " 10, !- Number of X Grid Points ", " 0.1, !- Y Minimum Coordinate {m} ", " 6.0, !- Y Maximum Coordinate {m} ", - " 10; !- Number of Y Grid Points ", + " 10; !- Number of Y Grid Points ", " Lights, ", " East Zone Lights 1, !- Name ", diff --git a/tst/EnergyPlus/unit/EMSManager.unit.cc b/tst/EnergyPlus/unit/EMSManager.unit.cc index 95a4a637586..0fd6ebb8929 100644 --- a/tst/EnergyPlus/unit/EMSManager.unit.cc +++ b/tst/EnergyPlus/unit/EMSManager.unit.cc @@ -1599,6 +1599,7 @@ TEST_F(EnergyPlusFixture, EMSManager_TestWindowShadingControlExteriorScreenOptio // #7586 state->dataSurface->Surface.allocate(2); state->dataSurface->SurfaceWindow.allocate(2); + state->dataSurface->surfShades.allocate(2); EnergyPlus::SurfaceGeometry::AllocateSurfaceWindows(*state, 2); state->dataConstruction->Construct.allocate(1); state->dataSurface->WindowShadingControl.allocate(2); diff --git a/tst/EnergyPlus/unit/EcoRoofManager.unit.cc b/tst/EnergyPlus/unit/EcoRoofManager.unit.cc index 98d7216bb65..83e7935abf0 100644 --- a/tst/EnergyPlus/unit/EcoRoofManager.unit.cc +++ b/tst/EnergyPlus/unit/EcoRoofManager.unit.cc @@ -235,12 +235,11 @@ TEST_F(EnergyPlusFixture, EcoRoofManager_initEcoRoofFirstTimeTest) Real64 allowableTolerance = 0.000001; state->dataConstruction->Construct.allocate(constrNum); - Material::MaterialChild *mat = new Material::MaterialChild; - state->dataMaterial->Material.push_back(mat); + auto *mat = new Material::MaterialEcoRoof; + state->dataMaterial->materials.push_back(mat); state->dataSurface->Surface.allocate(surfNum); auto &thisConstruct = state->dataConstruction->Construct(constrNum); - auto *thisMat = dynamic_cast(state->dataMaterial->Material(1)); auto &thisEcoRoof = state->dataEcoRoofMgr; thisConstruct.LayerPoint.allocate(1); @@ -248,8 +247,8 @@ TEST_F(EnergyPlusFixture, EcoRoofManager_initEcoRoofFirstTimeTest) state->dataSurface->Surface(surfNum).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::CTF; - thisMat->LAI = 3.21; - thisMat->AbsorpSolar = 0.72; + mat->LAI = 3.21; + mat->AbsorpSolar = 0.72; thisEcoRoof->FirstEcoSurf = 0; thisEcoRoof->EcoRoofbeginFlag = true; @@ -272,12 +271,11 @@ TEST_F(EnergyPlusFixture, EcoRoofManager_initEcoRoofTest) Real64 allowableTolerance = 0.000001; state->dataConstruction->Construct.allocate(constrNum); - Material::MaterialChild *mat = new Material::MaterialChild; - state->dataMaterial->Material.push_back(mat); + auto *mat = new Material::MaterialEcoRoof; + state->dataMaterial->materials.push_back(mat); state->dataSurface->Surface.allocate(surfNum); auto &thisConstruct = state->dataConstruction->Construct(constrNum); - auto *thisMat = dynamic_cast(state->dataMaterial->Material(1)); auto &thisEcoRoof = state->dataEcoRoofMgr; thisConstruct.LayerPoint.allocate(1); @@ -287,8 +285,8 @@ TEST_F(EnergyPlusFixture, EcoRoofManager_initEcoRoofTest) state->dataGlobal->BeginEnvrnFlag = false; state->dataGlobal->WarmupFlag = true; thisEcoRoof->CalcEcoRoofMyEnvrnFlag = false; - thisMat->InitMoisture = 23.0; - thisMat->AbsorpSolar = 0.72; + mat->InitMoisture = 23.0; + mat->AbsorpSolar = 0.72; thisEcoRoof->Moisture = 0.0; thisEcoRoof->MeanRootMoisture = 0.0; thisEcoRoof->Alphag = 0.0; diff --git a/tst/EnergyPlus/unit/ExtendedHI.unit.cc b/tst/EnergyPlus/unit/ExtendedHI.unit.cc new file mode 100644 index 00000000000..e2a00657cfa --- /dev/null +++ b/tst/EnergyPlus/unit/ExtendedHI.unit.cc @@ -0,0 +1,625 @@ +// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// The Regents of the University of California, through Lawrence Berkeley National Laboratory +// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge +// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other +// contributors. All rights reserved. +// +// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the +// U.S. Government consequently retains certain rights. As such, the U.S. Government has been +// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, +// worldwide license in the Software to reproduce, distribute copies to the public, prepare +// derivative works, and perform publicly and display publicly, and to permit others to do so. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// (1) Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// (2) Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, +// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific prior +// written permission. +// +// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form +// without changes from the version obtained under this License, or (ii) Licensee makes a +// reference solely to the software portion of its product, Licensee must refer to the +// software as "EnergyPlus version X" software, where "X" is the version number Licensee +// obtained under this License and may not use a different name for the software. Except as +// specifically required in this Section (4), Licensee shall not use in a company name, a +// product name, in advertising, publicity, or other promotional activities any name, trade +// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly +// similar designation, without the U.S. Department of Energy's prior written consent. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Google Test Headers +#include + +#include +#include +#include +#include + +// EnergyPlus Headers +#include "Fixtures/EnergyPlusFixture.hh" +#include +#include +#include + +using namespace EnergyPlus; +using namespace ExtendedHI; + +TEST_F(EnergyPlusFixture, extendedHI_pvstar) +{ + Real64 tol = 1e-8; + std::vector T_values = {200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370}; + std::vector result = {0.16315953, + 0.70457376, + 2.66392126, + 8.97272134, + 27.31539419, + 76.07472151, + 195.83100376, + 470.03352248, + 991.92542226, + 1920.68015554, + 3538.94082369, + 6235.88791594, + 10554.04916628, + 17222.31477378, + 27187.71571487, + 41643.76611223, + 62053.26405691, + 90163.72448627}; + + for (size_t i = 0; i < T_values.size(); ++i) { + EXPECT_NEAR(ExtendedHI::pvstar(T_values[i]), result[i], tol); + } +} + +TEST_F(EnergyPlusFixture, extendedHI_Le) +{ + Real64 tol = 1e-2; + std::vector T_values = {200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370}; + std::vector result = {2663805.16, + 2641405.16, + 2619005.16, + 2596605.16, + 2574205.16, + 2551805.16, + 2529405.16, + 2507005.16, + 2484605.16, + 2462205.16, + 2439805.16, + 2417405.16, + 2395005.16, + 2372605.16, + 2350205.16, + 2327805.16, + 2305405.16, + 2283005.16}; + for (size_t i = 0; i < T_values.size(); ++i) { + EXPECT_NEAR(ExtendedHI::Le(T_values[i]), result[i], tol); + } +} + +TEST_F(EnergyPlusFixture, extendedHI_Qv) +{ + Real64 tol = 1e-8; + std::vector T_values = {200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370}; + std::vector P_values = {1, 10, 100, 1000, 10000}; + std::vector> result = {{49.94618971, 49.91176799, 49.56755081, 46.12537897, 11.70366056}, + {47.35664275, 47.32222103, 46.97800385, 43.53583201, 9.1141136}, + {44.76709579, 44.73267407, 44.38845689, 40.94628505, 6.52456664}, + {42.17754883, 42.14312711, 41.79890993, 38.35673809, 3.93501968}, + {39.58800187, 39.55358015, 39.20936297, 35.76719113, 1.34547272}, + {36.99845491, 36.96403319, 36.61981601, 33.17764417, -1.24407424}, + {34.40890795, 34.37448623, 34.03026905, 30.58809721, -3.8336212}, + {31.81936099, 31.78493927, 31.44072209, 27.99855025, -6.42316816}, + {29.22981403, 29.19539231, 28.85117513, 25.40900329, -9.01271512}, + {26.64026707, 26.60584535, 26.26162817, 22.81945633, -11.60226208}, + {24.05072011, 24.01629839, 23.67208121, 20.22990937, -14.19180904}, + {21.46117315, 21.42675143, 21.08253425, 17.64036241, -16.781356}, + {18.87162619, 18.83720447, 18.49298729, 15.05081545, -19.37090296}, + {16.28207923, 16.24765751, 15.90344033, 12.46126849, -21.96044992}, + {13.69253227, 13.65811055, 13.31389337, 9.87172153, -24.54999688}, + {11.10298531, 11.06856359, 10.72434641, 7.28217457, -27.13954384}, + {8.51343835, 8.47901663, 8.13479945, 4.69262761, -29.7290908}, + {5.92389139, 5.88946967, 5.54525249, 2.10308065, -32.31863776}}; + for (size_t i = 0; i < T_values.size(); ++i) { + for (size_t j = 0; j < P_values.size(); ++j) { + EXPECT_NEAR(ExtendedHI::Qv(T_values[i], P_values[j]), result[i][j], tol); + } + } +} + +TEST_F(EnergyPlusFixture, extendedHI_Zs) +{ + Real64 tol = 1e-8; + std::vector Rs_values = {0.0387, 0.5, 1, 1.2}; + std::vector result = {52.1, 18750000.0, 600000000.0, 1492991999.9999998}; + for (size_t i = 0; i < Rs_values.size(); ++i) { + EXPECT_NEAR(ExtendedHI::Zs(Rs_values[i]), result[i], tol); + } +} + +TEST_F(EnergyPlusFixture, extendedHI_Ra) +{ + Real64 tol = 1e-8; + std::vector Ts_values = {240, 260, 280, 300, 320, 340, 360}; + std::vector Ta_values = {240, 260, 280, 300, 320, 340, 360}; + std::vector> result = {{0.05003743, 0.04919687, 0.04829495, 0.04733483, 0.04632048, 0.04525658, 0.04414843}, + {0.04919687, 0.04834035, 0.0474255, 0.04645568, 0.045435, 0.0443682, 0.04326057}, + {0.04829495, 0.0474255, 0.04650092, 0.04552473, 0.04450111, 0.04343485, 0.04233118}, + {0.04733483, 0.04645568, 0.04552473, 0.0445456, 0.04352252, 0.04246025, 0.04136396}, + {0.04632048, 0.045435, 0.04450111, 0.04352252, 0.04250345, 0.0414486, 0.04036303}, + {0.04525658, 0.0443682, 0.04343485, 0.04246025, 0.0414486, 0.04040451, 0.03933288}, + {0.04414843, 0.04326057, 0.04233118, 0.04136396, 0.04036303, 0.03933288, 0.03827822}}; + for (size_t i = 0; i < Ts_values.size(); ++i) { + for (size_t j = 0; j < Ta_values.size(); ++j) { + EXPECT_NEAR(ExtendedHI::Ra(Ts_values[i], Ta_values[j]), result[i][j], tol); + } + } +} + +TEST_F(EnergyPlusFixture, extendedHI_Ra_bar) +{ + Real64 tol = 1e-8; + std::vector Tf_values = {240, 260, 280, 300, 320, 340, 360}; + std::vector Ta_values = {240, 260, 280, 300, 320, 340, 360}; + std::vector> result = {{0.07141547, 0.06983279, 0.06815365, 0.0663875, 0.06454507, 0.06263806, 0.06067882}, + {0.06983279, 0.06823771, 0.06655337, 0.06478927, 0.06295607, 0.06106521, 0.05912865}, + {0.06815365, 0.06655337, 0.06487109, 0.06311629, 0.06129941, 0.05943158, 0.0575243}, + {0.0663875, 0.06478927, 0.06311629, 0.06137788, 0.05958421, 0.05774599, 0.05587418}, + {0.06454507, 0.06295607, 0.06129941, 0.05958421, 0.05782026, 0.05601779, 0.05418719}, + {0.06263806, 0.06106521, 0.05943158, 0.05774599, 0.05601779, 0.05425668, 0.05247244}, + {0.06067882, 0.05912865, 0.0575243, 0.05587418, 0.05418719, 0.05247244, 0.0507391}}; + + for (size_t i = 0; i < Tf_values.size(); ++i) { + for (size_t j = 0; j < Ta_values.size(); ++j) { + EXPECT_NEAR(ExtendedHI::Ra_bar(Tf_values[i], Ta_values[j]), result[i][j], tol); + } + } +} + +TEST_F(EnergyPlusFixture, extendedHI_Ra_un) +{ + Real64 tol = 1e-8; + std::vector Tf_values = {240, 260, 280, 300, 320, 340, 360}; + std::vector Ta_values = {240, 260, 280, 300, 320, 340, 360}; + std::vector> result = {{0.06787493, 0.06642598, 0.06488609, 0.06326346, 0.06156753, 0.05980867, 0.05799795}, + {0.06642598, 0.06496324, 0.06341598, 0.0617925, 0.06010222, 0.05835534, 0.05656263}, + {0.06488609, 0.06341598, 0.06186786, 0.06025007, 0.0585719, 0.0568433, 0.05507465}, + {0.06326346, 0.0617925, 0.06025007, 0.05864444, 0.05698468, 0.05528041, 0.05354159}, + {0.06156753, 0.06010222, 0.0585719, 0.05698468, 0.05534934, 0.05367512, 0.0519715}, + {0.05980867, 0.05835534, 0.0568433, 0.05528041, 0.05367512, 0.05203623, 0.0503727}, + {0.05799795, 0.05656263, 0.05507465, 0.05354159, 0.0519715, 0.0503727, 0.0487536}}; + for (size_t i = 0; i < Tf_values.size(); ++i) { + for (size_t j = 0; j < Ta_values.size(); ++j) { + EXPECT_NEAR(ExtendedHI::Ra_un(Tf_values[i], Ta_values[j]), result[i][j], tol); + } + } +} + +TEST_F(EnergyPlusFixture, extendedHI_find_eqvar) +{ + Real64 tol = 1e-5; + std::vector Ta_values = {240, 260, 280, 300, 320, 340, 360}; + std::vector RH_values = {0, 0.2, 0.4, 0.6, 0.8, 1.0}; + std::vector> result_0 = {{static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf)}, + {static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf)}, + {static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf), + static_cast(EqvarName::Rf)}, + {static_cast(EqvarName::Rf), + static_cast(EqvarName::Rs), + static_cast(EqvarName::Rs), + static_cast(EqvarName::Rs), + static_cast(EqvarName::Rs), + static_cast(EqvarName::Rs)}, + {static_cast(EqvarName::Rs), + static_cast(EqvarName::Rs), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt)}, + {static_cast(EqvarName::Rs), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt)}, + {static_cast(EqvarName::Rs), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt), + static_cast(EqvarName::DTcdt)}}; + + std::vector> result_1 = {{33.04275, 32.69563, 32.35542, 32.02191, 31.69491, 31.37423}, + {1.56043, 1.54633, 1.53238, 1.51858, 1.50491, 1.49139}, + {0.44248, 0.42288, 0.40403, 0.38594, 0.36856, 0.35189}, + {0.01107, 0.03821, 0.03685, 0.03533, 0.03356, 0.0314}, + {0.02699, 0.02259, 0.00048, 0.00338, 0.00628, 0.00918}, + {0.02073, 0.00466, 0.01213, 0.0196, 0.02707, 0.03453}, + {0.00147, 0.01691, 0.03395, 0.051, 0.06804, 0.08509}}; + + for (size_t i = 0; i < Ta_values.size(); ++i) { + for (size_t j = 0; j < RH_values.size(); ++j) { + EXPECT_EQ(find_eqvar_name(*state, Ta_values[i], RH_values[j]), result_0[i][j]); + EXPECT_NEAR(find_eqvar_value(*state, Ta_values[i], RH_values[j]), result_1[i][j], tol); + } + } +} + +TEST_F(EnergyPlusFixture, extendedHI_find_T) +{ + Real64 tol = 1e-7; + state->dataRootFinder->HVACSystemRootFinding.HVACSystemRootSolver = HVACSystemRootSolverAlgorithm::Bisection; + std::vector Rf_values = {30, 32, 34, 36, 38}; + std::vector result_0_rf = {240.0675404, 239.9711237, 239.8858108, 239.8097882, 239.7416167}; + for (size_t i = 0; i < Rf_values.size(); ++i) { + EXPECT_NEAR(ExtendedHI::find_T(*state, static_cast(EnergyPlus::ExtendedHI::EqvarName::Rf), Rf_values[i]), result_0_rf[i], tol); + } + std::vector Rs_values = {0.01, 0.02, 0.03}; + std::vector result_0_rs = {337.8697, 329.7587, 307.4816}; + tol = 1e-4; + for (size_t i = 0; i < Rs_values.size(); ++i) { + EXPECT_NEAR(ExtendedHI::find_T(*state, static_cast(EnergyPlus::ExtendedHI::EqvarName::Rs), Rs_values[i]), result_0_rs[i], tol); + } + std::vector phi_values = {0.86, 0.88, 0.90, 0.92, 0.94, 0.96}; + std::vector result_0_phi = {228.6900, 215.9994, 199.0012, 175.1865, 139.7124, 82.0478}; + for (size_t i = 0; i < phi_values.size(); ++i) { + EXPECT_NEAR(ExtendedHI::find_T(*state, static_cast(EnergyPlus::ExtendedHI::EqvarName::Phi), phi_values[i]), result_0_phi[i], tol); + } + std::vector dTcdt_values = {0.01, 0.03, 0.05, 0.07, 0.09}; + std::vector result_0_dTcdt = {412.5272, 512.3596, 584.547, 641.1988, 688.0423}; + for (size_t i = 0; i < dTcdt_values.size(); ++i) { + EXPECT_NEAR(ExtendedHI::find_T(*state, static_cast(EnergyPlus::ExtendedHI::EqvarName::DTcdt), dTcdt_values[i]), result_0_dTcdt[i], tol); + } +} + +TEST_F(EnergyPlusFixture, extendedHI_heatindex) +{ + + state->dataRootFinder->HVACSystemRootFinding.HVACSystemRootSolver = HVACSystemRootSolverAlgorithm::Bisection; + std::vector> HI_values = {{199.9994, 199.9997, 200.0}, + {209.9976, 209.9988, 210.0}, + {219.9916, 219.9958, 220.0}, + {229.974, 229.987, 230.0}, + {239.9254, 239.9627, 240.0}, + {249.7677, 249.8837, 250.0}, + {259.3736, 259.6864, 260.0}, + {268.5454, 269.2746, 270.0}, + {277.2234, 278.6369, 280.0}, + {285.7511, 288.2814, 290.7861}, + {297.5738, 300.2923, 305.3947}, + {305.555, 318.6226, 359.9063}, + {313.0299, 359.0539, 407.5345}, + {320.5089, 398.576, 464.9949}, + {328.0358, 445.8599, 530.5525}, + {333.2806, 500.0422, 601.9518}, + {343.6313, 559.664, 677.2462}, + {354.1826, 623.196, 755.0833}}; + + std::vector T_values = {200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370}; + std::vector RH_values = {0, 0.5, 1}; + + Real64 tol = 1e-4; + + for (size_t i = 0; i < T_values.size(); ++i) { + for (size_t j = 0; j < RH_values.size(); ++j) { + Real64 HI = HI_values[i][j]; + EXPECT_NEAR(ExtendedHI::heatindex(*state, T_values[i], RH_values[j]), HI, tol); + } + } +} + +// helper: calculating HI the old way +Real64 calcHI(Real64 ZoneTF, Real64 ZoneRH) +{ + Real64 HI; + Real64 constexpr c1 = -42.379; + Real64 constexpr c2 = 2.04901523; + Real64 constexpr c3 = 10.14333127; + Real64 constexpr c4 = -.22475541; + Real64 constexpr c5 = -.00683783; + Real64 constexpr c6 = -.05481717; + Real64 constexpr c7 = .00122874; + Real64 constexpr c8 = .00085282; + Real64 constexpr c9 = -.00000199; + if (ZoneTF < 80) { + HI = 0.5 * (ZoneTF + 61.0 + (ZoneTF - 68.0) * 1.2 + (ZoneRH * 0.094)); + } else { + HI = c1 + c2 * ZoneTF + c3 * ZoneRH + c4 * ZoneTF * ZoneRH + c5 * ZoneTF * ZoneTF + c6 * ZoneRH * ZoneRH + c7 * ZoneTF * ZoneTF * ZoneRH + + c8 * ZoneTF * ZoneRH * ZoneRH + c9 * ZoneTF * ZoneTF * ZoneRH * ZoneRH; + if (ZoneRH < 13 && ZoneTF < 112) { + HI -= (13 - ZoneRH) / 4 * std::sqrt((17 - abs(ZoneTF - 95)) / 17); + } else if (ZoneRH > 85 && ZoneTF < 87) { + HI += (ZoneRH - 85) / 10 * (87 - ZoneTF) / 5; + } + } + HI = (HI - 32.0) * (5.0 / 9.0); + return HI; +} + +constexpr Real64 Fahrenheit2Celsius(Real64 F) +{ + return (F - 32.0) * 5.0 / 9.0; +} + +// compare different the old and new HI method +TEST_F(EnergyPlusFixture, extendedHI_heatindex_compare) +{ + // uncomment the following to write out outputs comparing the old HI and the extended HI + // for (int T = 80; T < 112; T += 2) { + // for (int RH_percent = 40; RH_percent < 105; RH_percent += 5) { + // fmt::print("{},{},{},{}\n", T, Fahrenheit2Celsius(T) + 273.15, RH_percent, calcHI(T * 1.0, RH_percent) + 273.15); + // } + // } + // + // fmt::print("--------------------------extended HI------------------------------\n"); + // + // for (int T = 80; T < 112; T += 2) { + // for (int RH_percent = 40; RH_percent < 105; RH_percent += 5) { + // fmt::print("{},{},{},{}\n", + // T, + // Fahrenheit2Celsius(T) + 273.15, + // RH_percent, + // ExtendedHI::heatindex(*state, Fahrenheit2Celsius(T) + 273.15, RH_percent / 100.0, false)); + // } + // } + + std::vector> HI_values = {{299.50263955106493, + 299.776740099187, + 300.0697403535014, + 300.3840374486754, + 300.7224627089454, + 301.0883855406428, + 301.48585129820276, + 301.91976206202526, + 302.39612058678176, + 302.9223619942786, + 303.50781721121166, + 304.164366737823, + 304.90738965163473}, + {300.7371586287627, + 301.08082855993416, + 301.45165138470475, + 301.85347046062816, + 302.29090810229536, + 302.7695771184517, + 303.2963640097296, + 303.8798186200438, + 304.5306942932075, + 305.2627171872882, + 306.0937017010292, + 307.0472131000133, + 308.15511379914824}, + {302.02736771141645, + 302.4561810697196, + 302.92349559196737, + 303.4353941195877, + 303.9993409969611, + 304.62460199545603, + 305.322829571669, + 306.10889266303275, + 307.00207884714473, + 308.027883155155, + 309.2207373859128, + 313.0628398671979, + 321.5848247316899}, + {303.3841495186789, + 303.9170689758612, + 304.50409744807985, + 305.1547874516109, + 305.88112467259634, + 306.69836198852863, + 307.62622559734154, + 308.69069155014586, + 309.9266883142991, + 311.38231908960734, + 318.54246110946406, + 328.0043066147482, + 333.3393972698832}, + {304.8199354641838, + 305.48032203514595, + 306.21634121227544, + 307.0429394330131, + 307.97934497182723, + 309.05072723689955, + 310.29069143289234, + 311.7451353772776, + 313.95530016103294, + 323.83440227771644, + 332.4701096833451, + 334.90678639907856, + 337.31894975469913}, + {306.3492841011612, + 307.16624582593795, + 308.0886627669679, + 309.13992447021883, + 310.35097800020594, + 311.7636495939223, + 313.43586634553503, + 317.6494802389061, + 328.3628307696199, + 333.74059265770484, + 336.3222867687, + 338.8761290133698, + 341.4020377426641}, + {307.98957814869937, + 308.99980285495985, + 310.15708861581516, + 311.49815879471134, + 313.0731694836868, + 314.95241500844713, + 320.7787010347238, + 331.8317274673609, + 334.83416476810817, + 337.5699159357464, + 340.2740648871986, + 342.94652084296104, + 345.6054543473874}, + {309.7619108116487, + 311.0122043680167, + 312.46811247605365, + 314.187658362207, + 316.2529625179013, + 323.0801825976232, + 332.79726637585554, + 335.7326857879525, + 338.63242015999276, + 341.4963439834537, + 344.32435625989456, + 347.16610411327565, + 349.9882094984059}, + {311.6922567837173, + 313.2431093422929, + 315.0828601612011, + 317.30399334745016, + 324.3992667720886, + 333.3013983833371, + 336.4164381631417, + 339.4910959439585, + 342.5252268166514, + 345.53482289920794, + 348.55059671303025, + 351.53749776567565, + 354.49586372385966}, + {313.81305196962785, + 315.74373047973495, + 318.0832217884017, + 324.6363173221471, + 333.556578377611, + 336.86389599752147, + 340.12557708716486, + 343.3414515358163, + 346.5464459863142, + 349.74051965837134, + 352.90212786378106, + 356.0316775160027, + 359.1295787363197}, + {316.1653665843187, + 318.58128181367647, + 323.6855917231878, + 333.5378166526789, + 337.0514521509176, + 340.51358119759243, + 343.9240011043148, + 347.3324049610528, + 350.715991469624, + 354.063080122869, + 357.3741601619986, + 360.6497245162609, + 363.89026874647243}, + {318.80192411888856, + 321.8453275115462, + 333.2175307610305, + 336.9530971109634, + 340.63061076856684, + 344.2498254548991, + 347.8701384467422, + 351.4554844770464, + 354.99980266642524, + 358.5036799122463, + 361.96770739537897, + 365.39247917797184, + 368.7785908780643}, + {321.79129250056576, + 332.5651462195674, + 336.5400431206217, + 340.4496004333487, + 344.2935131903505, + 348.13508995372104, + 351.9356167348451, + 355.6900213044719, + 359.3990061376826, + 363.0632788382354, + 366.6835501792957, + 370.2605324515025, + 373.7949378686608}, + {329.9497329717269, + 335.7802855706541, + 339.9405041738646, + 344.0269053383963, + 348.1004405542626, + 352.130907458195, + 356.1095161383855, + 360.03710570017574, + 363.9145213572192, + 367.74261204962386, + 371.5222280813032, + 375.2542191799148, + 378.9394325375906}, + {334.63809705979656, + 339.06981446722057, + 343.41864144138526, + 347.7367934017093, + 352.013488568773, + 356.2318584616878, + 360.3929031532607, + 364.49763041891856, + 368.54705243284116, + 372.5421826945967, + 376.48403349361615, + 380.3736132776248, + 384.2119247702067}, + {337.80000485421624, + 342.43363185960334, + 347.0118012771127, + 351.55276412755484, + 356.0280998123926, + 360.438997685269, + 364.78665706905304, + 369.07228278025286, + 373.2970810952247, + 377.4622562734294, + 381.56900731119094, + 385.6185252717114, + 389.61199074954493}}; + + std::vector T_values; + for (int i = 0; i < 16; ++i) { + T_values.push_back(80 + 2 * i); + } + std::vector RH_values; + for (int i = 0; i < 13; ++i) { + RH_values.push_back(40 + 5 * i); + } + + Real64 extended; + for (size_t i = 0; i < T_values.size(); ++i) { + for (size_t j = 0; j < RH_values.size(); ++j) { + extended = ExtendedHI::heatindex(*state, Fahrenheit2Celsius(T_values[i]) + 273.15, RH_values[j] / 100.0); + EXPECT_NEAR(HI_values[i][j], extended, 1e-4); + } + } +} diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 9b43733018a..08fe0801971 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -2593,6 +2593,52 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) EXPECT_NEAR(2080, Ncomp, 1); EXPECT_EQ(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(1).VRFTUInletNodeNum).MassFlowRate, 0.0); } + +{ + // Test the method VRFOU_CalcCompC at low load condition with cycling + + // Inputs_condition + Real64 TU_load = 6006; // Indoor unit cooling load [W] + Real64 T_suction = 8.86; // Compressor suction temperature Te' [C] + Real64 T_discharge = 40.26; // Compressor discharge temperature Tc' [C] + Real64 Psuction = 1.2e6; // Compressor suction pressure Pe' [Pa] + Real64 T_comp_in = 25.0; // Refrigerant temperature at compressor inlet (after piping loss) [C] + Real64 h_comp_in = 4.3e5; // Enthalpy after piping loss (compressor inlet) [kJ/kg] + Real64 h_IU_evap_in = 2.5e5; // Enthalpy of IU at inlet [kJ/kg] + Real64 Pipe_Q_c = 5.0; // Piping Loss Algorithm Parameter: Heat loss [W] + Real64 CapMaxTc = 50.0; // The maximum temperature that Tc can be at heating mode [C] + Real64 OUEvapHeatExtract = 900.0; // Evaporator heat extract [W] + Real64 Ncomp = 1058; // Compressor power [W] + Real64 CompSpdActual; // Actual compressor running speed [rps] + + // Run + Real64 CyclingRatio = 1.0; + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CalcCompC(*state, + TU_load, + T_suction, + T_discharge, + Psuction, + T_comp_in, + h_comp_in, + h_IU_evap_in, + Pipe_Q_c, + CapMaxTc, + OUEvapHeatExtract, + CompSpdActual, + Ncomp, + CyclingRatio); + + // Test + auto const &thisVRF = state->dataHVACVarRefFlow->VRF(VRFCond); + Real64 CompEvaporatingCAPSpdMin = + thisVRF.RatedEvapCapacity * CurveValue(*state, thisVRF.OUCoolingCAPFT(1), thisVRF.CondensingTemp, thisVRF.EvaporatingTemp); + Real64 CompEvaporatingPWRSpdMin = + thisVRF.RatedCompPower * CurveValue(*state, thisVRF.OUCoolingPWRFT(1), thisVRF.CondensingTemp, thisVRF.EvaporatingTemp); + EXPECT_NEAR(0.34, CyclingRatio, 0.01); + EXPECT_NEAR(OUEvapHeatExtract, CompEvaporatingCAPSpdMin + Ncomp, 1e-4); + EXPECT_NEAR(1500, CompSpdActual, 1); + EXPECT_NEAR(Ncomp, CompEvaporatingPWRSpdMin, 1e-4); +} } TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) @@ -13277,7 +13323,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) EXPECT_NEAR(5645.5696, thisVRFTU.TotalCoolingRate, 0.0001); EXPECT_NEAR(84.8359, thisFan->totalPower, 0.0001); EXPECT_NEAR(thisDXCoolingCoil.TotalCoolingEnergyRate, (thisVRFTU.TotalCoolingRate + thisFan->totalPower), 0.0001); - EXPECT_NEAR(0.9994, state->dataHVACVarRefFlow->VRF(1).VRFCondCyclingRatio, 0.0001); + EXPECT_NEAR(0.4124, state->dataHVACVarRefFlow->VRF(1).VRFCondCyclingRatio, 0.0001); EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(1).OUFanPower, state->dataHVACVarRefFlow->VRF(1).RatedOUFanPower, 0.0001); } diff --git a/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc b/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc index c9a03fc2ea5..4a4cfabbb58 100644 --- a/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc @@ -231,6 +231,8 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_CalcNodeHeatFluxTest) TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_adjustPropertiesForPhaseChange) { + auto &s_mat = state->dataMaterial; + // create a single PCM object in the input and process it std::string const idf_objects = delimited_string({" MaterialProperty:PhaseChangeHysteresis,", " PCMNAME, !- Name", @@ -257,18 +259,31 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_adjustPropertiesForPhaseChang SurfaceFD(surfaceIndex).PhaseChangeTemperatureReverse.allocate(1); SurfaceFD(surfaceIndex).PhaseChangeTemperatureReverse(finiteDiffLayerIndex) = 20.0; SurfaceFD(surfaceIndex).PhaseChangeState.allocate(1); - SurfaceFD(surfaceIndex).PhaseChangeState(finiteDiffLayerIndex) = HysteresisPhaseChange::PhaseChangeStates::LIQUID; + SurfaceFD(surfaceIndex).PhaseChangeState(finiteDiffLayerIndex) = Material::Phase::Liquid; SurfaceFD(surfaceIndex).PhaseChangeStateOld.allocate(1); - SurfaceFD(surfaceIndex).PhaseChangeStateOld(finiteDiffLayerIndex) = HysteresisPhaseChange::PhaseChangeStates::MELTING; + SurfaceFD(surfaceIndex).PhaseChangeStateOld(finiteDiffLayerIndex) = Material::Phase::Melting; + SurfaceFD(surfaceIndex).PhaseChangeStateRep.allocate(1); + SurfaceFD(surfaceIndex).PhaseChangeStateRep(finiteDiffLayerIndex) = Material::phaseInts[(int)Material::Phase::Liquid]; + SurfaceFD(surfaceIndex).PhaseChangeStateOldRep.allocate(1); + SurfaceFD(surfaceIndex).PhaseChangeStateOldRep(finiteDiffLayerIndex) = Material::phaseInts[(int)Material::Phase::Melting]; // create a materials data object and assign the phase change variable based on above IDF processing - Material::MaterialChild material; - material.phaseChange = HysteresisPhaseChange::HysteresisPhaseChange::factory(*state, "PCMNAME"); + auto *mat = new Material::MaterialBase; + mat->Name = "PCMNAME"; + mat->group = Material::Group::Regular; + s_mat->materials.push_back(mat); + mat->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat->Name, mat->Num); + + bool ErrorsFound; + Material::GetHysteresisData(*state, ErrorsFound); + + auto *matPC = dynamic_cast(s_mat->materials(Material::GetMaterialNum(*state, "PCMNAME"))); // create local variables to calculate and call the new worker function Real64 newSpecificHeat, newDensity, newThermalConductivity; adjustPropertiesForPhaseChange( - *state, finiteDiffLayerIndex, surfaceIndex, &material, 20.0, 20.1, newSpecificHeat, newDensity, newThermalConductivity); + *state, finiteDiffLayerIndex, surfaceIndex, matPC, 20.0, 20.1, newSpecificHeat, newDensity, newThermalConductivity); // check the values are correct EXPECT_NEAR(10187.3, newSpecificHeat, 0.1); @@ -458,7 +473,7 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_findAnySurfacesUsingConstruct // call the function for initialization of finite difference calculation std::string const error_string = delimited_string({" ** Severe ** InitialInitHeatBalFiniteDiff: Found Material that is too thin and/or too " - "highly conductive, material name = REG MAT F05 CEILING AIR SPACE RESISTANCE", + "highly conductive, material name = Reg Mat F05 Ceiling air space resistance", " ** ~~~ ** High conductivity Material layers are not well supported by Conduction " "Finite Difference, material conductivity = 2.000 [W/m-K]", " ** ~~~ ** Material thermal diffusivity = 1.626E-003 [m2/s]", @@ -467,7 +482,7 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_findAnySurfacesUsingConstruct " ...Summary of Errors that led to program termination:", " ..... Reference severe error count=1", " ..... Last severe error=InitialInitHeatBalFiniteDiff: Found Material that is too thin " - "and/or too highly conductive, material name = REG MAT F05 CEILING AIR SPACE RESISTANCE"}); + "and/or too highly conductive, material name = Reg Mat F05 Ceiling air space resistance"}); EXPECT_ANY_THROW(InitialInitHeatBalFiniteDiff(*state)); compare_err_stream(error_string, true); diff --git a/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc index eb9143cfe47..f3ee37f8754 100644 --- a/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -518,6 +519,48 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_GetMixingAndCrossMixing) state->dataInputProcessing->inputProcessor->epJSON = R"( { + "SimulationControl": { + "SimulationControl 1": { + "do_plant_sizing_calculation": "No", + "do_system_sizing_calculation": "No", + "do_zone_sizing_calculation": "No", + "run_simulation_for_sizing_periods": "Yes", + "run_simulation_for_weather_file_run_periods": "No" + } + }, + "ZoneAirHeatBalanceAlgorithm": { + "ZoneAirHeatBalanceAlgorithm 1": { + "algorithm": "AnalyticalSolution", + "do_space_heat_balance_for_simulation": "Yes" + } + }, + "Site:Location": { + "USA IL-CHICAGO-OHARE": { + "elevation": 190, + "latitude": 41.77, + "longitude": -87.75, + "time_zone": -6.0 + } + }, + "SizingPeriod:DesignDay": { + "CHICAGO Ann Clg .4% Condns WB=>MDB": { + "barometric_pressure": 99063.0, + "daily_dry_bulb_temperature_range": 10.7, + "day_of_month": 21, + "day_type": "SummerDesignDay", + "daylight_saving_time_indicator": "No", + "humidity_condition_type": "WetBulb", + "maximum_dry_bulb_temperature": 31.2, + "month": 7, + "rain_indicator": "No", + "sky_clearness": 1.0, + "snow_indicator": "No", + "solar_model_indicator": "ASHRAEClearSky", + "wetbulb_or_dewpoint_at_maximum_dry_bulb": 25.5, + "wind_direction": 230, + "wind_speed": 5.3 + } + }, "Zone": { "Zone 1" : { "volume": 100.0 @@ -755,32 +798,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_GetMixingAndCrossMixing) state->dataIPShortCut->rNumericArgs.dimension(MaxNumeric, 0.0); state->dataIPShortCut->lNumericFieldBlanks.dimension(MaxNumeric, false); + // Need to do this before ManageSimulation to get the space heat balance input bool ErrorsFound = false; - HeatBalanceManager::GetHeatBalanceInput(*state); - std::string const error_string = delimited_string( - {" ** Warning ** GetSurfaceData: Entered Space Floor Area(s) differ more than 5% from calculated Space Floor Area(s).", - " ** ~~~ ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual Spaces.", - " ** Warning ** CalculateZoneVolume: 1 zone is not fully enclosed. For more details use: Output:Diagnostics,DisplayExtrawarnings; ", - " ** Warning ** CalcApproximateViewFactors: Zero area for all other zone surfaces.", - " ** ~~~ ** Happens for Surface=\"DUMMY SPACE 1A FLOOR\" in Zone=ZONE 1", - " ** Warning ** CalcApproximateViewFactors: Zero area for all other zone surfaces.", - " ** ~~~ ** Happens for Surface=\"DUMMY SPACE 1B FLOOR\" in Zone=ZONE 1", - " ** Warning ** Surfaces in Zone/Enclosure=\"ZONE 1\" do not define an enclosure.", - " ** ~~~ ** Number of surfaces <= 3, view factors are set to force reciprocity but may not fulfill completeness.", - " ** ~~~ ** Reciprocity means that radiant exchange between two surfaces will match and not lead to an energy loss.", - " ** ~~~ ** Completeness means that all of the view factors between a surface and the other surfaces in a zone add up to unity.", - " ** ~~~ ** So, when there are three or less surfaces in a zone, EnergyPlus will make sure there are no losses of energy but", - " ** ~~~ ** it will not exchange the full amount of radiation with the rest of the zone as it would if there was a completed " - "enclosure."}); - - compare_err_stream(error_string, true); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state->dataHeatBalFanSys->ZoneReOrder.allocate(state->dataGlobal->NumOfZones); - ErrorsFound = false; - HeatBalanceAirManager::GetSimpleAirModelInputs(*state, ErrorsFound); - compare_err_stream("", true); - EXPECT_FALSE(ErrorsFound); + SimulationManager::ManageSimulation(*state); // Expected floor areas Real64 constexpr Space1aFloorArea = 10.0; diff --git a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc index 3e5dfa6557d..91dafeeebfa 100644 --- a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc @@ -393,8 +393,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT int SurfNum; state->dataConstruction->Construct.allocate(1); - Material::MaterialBase *mat = new Material::MaterialChild; - state->dataMaterial->Material.push_back(mat); + auto *mat = new Material::MaterialBase; + state->dataMaterial->materials.push_back(mat); state->dataSurface->Surface.allocate(1); state->dataSurface->SurfMaterialMovInsulInt.allocate(1); state->dataHeatBalSurf->SurfMovInsulIntPresent.allocate(1); @@ -408,10 +408,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT state->dataSurface->SurfMaterialMovInsulInt(1) = 1; state->dataConstruction->Construct(1).InsideAbsorpThermal = 0.9; - auto *thisMaterial_1 = dynamic_cast(state->dataMaterial->Material(1)); - thisMaterial_1->AbsorpThermal = 0.5; - thisMaterial_1->Resistance = 1.25; - thisMaterial_1->AbsorpSolar = 0.25; + mat->AbsorpThermal = 0.5; + mat->Resistance = 1.25; + mat->AbsorpSolar = 0.25; // 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 @@ -426,7 +425,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT // 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. state->dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(1) = true; - thisMaterial_1->AbsorpThermal = state->dataConstruction->Construct(1).InsideAbsorpThermal; + mat->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 5532e6f098f..3af392c8063 100644 --- a/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc @@ -135,6 +135,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirBalance_OutdoorAir) EXPECT_TRUE(ErrorsFound); } +#ifdef GET_OUT TEST_F(EnergyPlusFixture, HeatBalanceManager_WindowMaterial_Gap_Duplicate_Names) { std::string const idf_objects = delimited_string({ @@ -208,6 +209,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_WindowMaterial_Gap_Duplicate_Names_ EXPECT_FALSE(ErrorsFound); } +#endif // GET_OUT TEST_F(EnergyPlusFixture, HeatBalanceManager_ProcessZoneData) { @@ -337,29 +339,29 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetWindowConstructData) ASSERT_TRUE(process_idf(idf_objects)); + auto &s_mat = state->dataMaterial; + bool ErrorsFound(false); // If errors detected in input - state->dataMaterial->TotMaterials = 3; - for (int i = 1; i <= state->dataMaterial->TotMaterials; i++) { - Material::MaterialChild *p = new Material::MaterialChild; - state->dataMaterial->Material.push_back(p); - } - state->dataMaterial->Material(1)->Name = "GLASS"; - state->dataMaterial->Material(2)->Name = "AIRGAP"; - state->dataMaterial->Material(3)->Name = "GLASS"; + auto *mat1 = new Material::MaterialGlass; + mat1->group = Material::Group::Glass; + mat1->Name = "GLASS"; + s_mat->materials.push_back(mat1); + mat1->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat1->Name, mat1->Num); - // Material layer group index - state->dataMaterial->Material(1)->group = Material::Group::WindowGlass; - state->dataMaterial->Material(2)->group = Material::Group::WindowGas; - state->dataMaterial->Material(3)->group = Material::Group::WindowGlass; + auto *mat2 = new Material::MaterialGasMix; + mat2->group = Material::Group::Gas; + mat2->Name = "AIRGAP"; + s_mat->materials.push_back(mat2); + mat2->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat2->Name, mat2->Num); state->dataHeatBal->NominalRforNominalUCalculation.allocate(1); state->dataHeatBal->NominalRforNominalUCalculation(1) = 0.0; - state->dataHeatBal->NominalR.allocate(state->dataMaterial->TotMaterials); - state->dataHeatBal->NominalR(1) = 0.4; // Set these explicity for each material layer to avoid random failures of check for - // NominalRforNominalUCalculation == 0.0 at end of GetConstructData - state->dataHeatBal->NominalR(2) = 0.4; - state->dataHeatBal->NominalR(3) = 0.4; + mat1->NominalR = 0.4; // Set these explicity for each material layer to avoid random failures of check for + // NominalRforNominalUCalculation == 0.0 at end of GetConstructData + mat2->NominalR = 0.4; // call to get valid window material types ErrorsFound = false; @@ -718,12 +720,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetMaterialRoofVegetation) EXPECT_FALSE(ErrorsFound); // check the "Material:RoofVegetation" names - auto const *thisMaterial_1 = dynamic_cast(state->dataMaterial->Material(1)); - EXPECT_EQ(thisMaterial_1->Name, "THICKSOIL"); + auto const *mat1 = dynamic_cast(state->dataMaterial->materials(1)); + EXPECT_EQ(mat1->Name, "THICKSOIL"); // check maximum (saturated) moisture content - EXPECT_EQ(0.4, thisMaterial_1->Porosity); + EXPECT_EQ(0.4, mat1->Porosity); // check initial moisture Content was reset - EXPECT_EQ(0.4, thisMaterial_1->InitMoisture); // reset from 0.45 to 0.4 during get input + EXPECT_EQ(0.4, mat1->InitMoisture); // reset from 0.45 to 0.4 during get input } TEST_F(EnergyPlusFixture, HeatBalanceManager_WarmUpConvergenceSmallLoadTest) @@ -1778,7 +1780,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GlazingEquivalentLayer_RValue) Material::GetMaterialData(*state, errorsfound); EXPECT_FALSE(errorsfound); - EXPECT_NEAR(dynamic_cast(state->dataMaterial->Material(1))->Resistance, 0.158, 0.0001); + EXPECT_NEAR(state->dataMaterial->materials(1)->Resistance, 0.158, 0.0001); } TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData) @@ -1855,7 +1857,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2) // skip call to get material data since this doesn't use IRT ErrorsFound = false; - EXPECT_EQ(state->dataMaterial->TotMaterials, 0); + EXPECT_EQ(state->dataMaterial->materials.size(), 0); // get constructions ErrorsFound = false; @@ -2632,7 +2634,7 @@ TEST_F(EnergyPlusFixture, ReadIncidentSolarMultiplierInput) EXPECT_TRUE(compare_err_stream(error_string, true)); state->dataSurface->Surface(2).HasShadeControl = false; - state->dataMaterial->Material(3)->group = Material::Group::Screen; + state->dataMaterial->materials(3)->group = Material::Group::Screen; GetIncidentSolarMultiplier(*state, ErrorsFound); error_string = delimited_string({" ** Severe ** Non-compatible shades defined alongside SurfaceProperty:IncidentSolarMultiplier for the same window"}); diff --git a/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc b/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc index bfdcef419de..4ca640a2fb0 100644 --- a/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc @@ -69,6 +69,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalOutsideMovableInsulation) { + auto &s_mat = state->dataMaterial; int SurfNum = 1; state->dataSurface->Surface.allocate(SurfNum); @@ -86,16 +87,15 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalOutsideMovableInsulat state->dataHeatBalSurf->SurfMovInsulExtPresent(1) = true; state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(1); - Material::MaterialBase *mat = new Material::MaterialChild; - state->dataMaterial->Material.push_back(mat); - auto *thisMaterial_1 = dynamic_cast(state->dataMaterial->Material(1)); - thisMaterial_1->Resistance = 1.25; - thisMaterial_1->Roughness = Material::SurfaceRoughness::VeryRough; - thisMaterial_1->group = Material::Group::Regular; - thisMaterial_1->AbsorpSolar = 0.75; - thisMaterial_1->AbsorpThermal = 0.75; - thisMaterial_1->Trans = 0.25; - thisMaterial_1->ReflectSolBeamFront = 0.20; + auto *mat1 = new Material::MaterialShade; + s_mat->materials.push_back(mat1); + mat1->Resistance = 1.25; + mat1->Roughness = Material::SurfaceRoughness::VeryRough; + mat1->group = Material::Group::Regular; + mat1->AbsorpSolar = 0.75; + mat1->AbsorpThermal = 0.75; + mat1->Trans = 0.25; + mat1->ReflectSolBeamFront = 0.20; state->dataHeatBal->Zone.allocate(1); state->dataGlobal->NumOfZones = 1; state->dataHeatBal->space.allocate(1); @@ -110,15 +110,42 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalOutsideMovableInsulat EXPECT_ENUM_EQ(Material::SurfaceRoughness::VeryRough, state->dataHeatBalSurf->SurfRoughnessExt(1)); EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsThermalExt(1)); + delete mat1; + s_mat->materials.clear(); + state->dataHeatBalSurf->SurfAbsSolarExt(1) = 0.0; - thisMaterial_1->group = Material::Group::WindowGlass; + auto *mat2 = new Material::MaterialGlass; + s_mat->materials.push_back(mat2); + mat2->Resistance = 1.25; + mat2->Roughness = Material::SurfaceRoughness::VeryRough; + mat2->group = Material::Group::Glass; + mat2->AbsorpSolar = 0.75; + mat2->AbsorpThermal = 0.75; + mat2->Trans = 0.25; + mat2->ReflectSolBeamFront = 0.20; + HeatBalanceSurfaceManager::EvalOutsideMovableInsulation(*state); EXPECT_EQ(0.55, state->dataHeatBalSurf->SurfAbsSolarExt(1)); + delete mat2; + s_mat->materials.clear(); + state->dataHeatBalSurf->SurfAbsSolarExt(1) = 0.0; - thisMaterial_1->group = Material::Group::GlassEquivalentLayer; + + auto *mat3 = new Material::MaterialGlassEQL; + s_mat->materials.push_back(mat3); + mat3->Resistance = 1.25; + mat3->Roughness = Material::SurfaceRoughness::VeryRough; + mat3->group = Material::Group::GlassEQL; + mat3->AbsorpSolar = 0.75; + mat3->AbsorpThermal = 0.75; + mat3->Trans = 0.25; + mat3->ReflectSolBeamFront = 0.20; HeatBalanceSurfaceManager::EvalOutsideMovableInsulation(*state); EXPECT_EQ(0.55, state->dataHeatBalSurf->SurfAbsSolarExt(1)); + + delete mat3; + s_mat->materials.clear(); } TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalInsideMovableInsulation) @@ -139,16 +166,15 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalInsideMovableInsulati state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(1); - Material::MaterialBase *mat = new Material::MaterialChild; - state->dataMaterial->Material.push_back(mat); - auto *thisMaterial_1 = dynamic_cast(state->dataMaterial->Material(1)); - thisMaterial_1->Resistance = 1.25; - thisMaterial_1->Roughness = Material::SurfaceRoughness::VeryRough; - thisMaterial_1->group = Material::Group::Regular; - thisMaterial_1->AbsorpSolar = 0.75; - thisMaterial_1->AbsorpThermal = 0.75; - thisMaterial_1->Trans = 0.25; - thisMaterial_1->ReflectSolBeamFront = 0.20; + auto *mat = new Material::MaterialShade; + state->dataMaterial->materials.push_back(mat); + mat->Resistance = 1.25; + mat->Roughness = Material::SurfaceRoughness::VeryRough; + mat->group = Material::Group::Regular; + mat->AbsorpSolar = 0.75; + mat->AbsorpThermal = 0.75; + mat->Trans = 0.25; + mat->ReflectSolBeamFront = 0.20; state->dataHeatBal->Zone.allocate(1); state->dataGlobal->NumOfZones = 1; state->dataHeatBal->space.allocate(1); @@ -164,12 +190,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalInsideMovableInsulati EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsThermalInt(1)); state->dataHeatBalSurf->SurfAbsSolarInt(1) = 0.0; - thisMaterial_1->group = Material::Group::WindowGlass; + mat->group = Material::Group::Glass; HeatBalanceSurfaceManager::EvalInsideMovableInsulation(*state); EXPECT_EQ(0.55, state->dataHeatBalSurf->SurfAbsSolarInt(1)); state->dataHeatBalSurf->SurfAbsSolarInt(1) = 0.0; - thisMaterial_1->group = Material::Group::GlassEquivalentLayer; + mat->group = Material::Group::GlassEQL; HeatBalanceSurfaceManager::EvalInsideMovableInsulation(*state); EXPECT_EQ(0.55, state->dataHeatBalSurf->SurfAbsSolarInt(1)); } @@ -273,8 +299,8 @@ TEST_F(EnergyPlusFixture, SurfaceControlMovableInsulation_InvalidWindowSimpleGla // get materials data Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - EXPECT_EQ(4, state->dataMaterial->TotMaterials); - EXPECT_ENUM_EQ(state->dataMaterial->Material(4)->group, Material::Group::WindowSimpleGlazing); + EXPECT_EQ(4, state->dataMaterial->materials.size()); + EXPECT_ENUM_EQ(state->dataMaterial->materials(4)->group, Material::Group::GlassSimple); // get construction data HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_EQ(1, state->dataHeatBal->TotConstructs); @@ -310,10 +336,10 @@ TEST_F(EnergyPlusFixture, SurfaceControlMovableInsulation_InvalidWindowSimpleGla state->dataSurface->Surface(1) = state->dataSurfaceGeometry->SurfaceTmp(1); SurfaceGeometry::GetMovableInsulationData(*state, ErrorsFound); // check movable insulation material - EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(1).BaseSurfName, "ZN001:WALL001"); // base surface name - EXPECT_EQ(state->dataSurface->SurfMaterialMovInsulExt(1), 4); // index to movable insulation material - EXPECT_EQ(state->dataMaterial->Material(4)->Name, "SIMPLEGLAZINGSYSTEM"); // name of movable insulation material - EXPECT_ENUM_EQ(state->dataMaterial->Material(4)->group, Material::Group::WindowSimpleGlazing); // invalid material group type - EXPECT_TRUE(ErrorsFound); // error found due to invalid material + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(1).BaseSurfName, "ZN001:WALL001"); // base surface name + EXPECT_EQ(state->dataSurface->SurfMaterialMovInsulExt(1), 4); // index to movable insulation material + EXPECT_EQ(state->dataMaterial->materials(4)->Name, "SIMPLEGLAZINGSYSTEM"); // name of movable insulation material + EXPECT_ENUM_EQ(state->dataMaterial->materials(4)->group, Material::Group::GlassSimple); // invalid material group type + EXPECT_TRUE(ErrorsFound); // error found due to invalid material } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc index 4b8411051ef..9601e745d0b 100644 --- a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc @@ -118,14 +118,15 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_CalcOutsideSurfTemp) state->dataConstruction->Construct(ConstrNum).CTFCross[0] = 0.0; state->dataConstruction->Construct(ConstrNum).CTFOutside[0] = 1.0; state->dataConstruction->Construct(ConstrNum).SourceSinkPresent = true; - Material::MaterialBase *p = new Material::MaterialBase; - state->dataMaterial->Material.push_back(p); - state->dataMaterial->Material(1)->Name = "TestMaterial"; + auto *p = new Material::MaterialBase; + state->dataMaterial->materials.push_back(p); + state->dataMaterial->materials(1)->Name = "TestMaterial"; state->dataSurface->TotSurfaces = SurfNum; state->dataGlobal->NumOfZones = ZoneNum; state->dataSurface->Surface.allocate(SurfNum); + state->dataSurface->SurfaceWindow.allocate(SurfNum); state->dataHeatBal->Zone.allocate(ZoneNum); state->dataSurface->Surface(SurfNum).Class = DataSurfaces::SurfaceClass::Wall; @@ -288,7 +289,6 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_ComputeIntThermalAbsorpFacto state->dataSurface->TotSurfaces = 1; state->dataGlobal->NumOfZones = 1; - state->dataMaterial->TotMaterials = 1; state->dataHeatBal->TotConstructs = 1; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); state->dataHeatBal->space.allocate(1); @@ -297,14 +297,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_ComputeIntThermalAbsorpFacto state->dataHeatBal->space(1).WindowSurfaceLast = 1; state->dataSurface->Surface.allocate(state->dataSurface->TotSurfaces); state->dataSurface->SurfaceWindow.allocate(state->dataSurface->TotSurfaces); + state->dataSurface->surfShades.allocate(state->dataSurface->TotSurfaces); SurfaceGeometry::AllocateSurfaceWindows(*state, state->dataSurface->TotSurfaces); state->dataConstruction->Construct.allocate(state->dataHeatBal->TotConstructs); - for (int i = 1; i <= state->dataMaterial->TotMaterials; i++) { - Material::MaterialBase *p = new Material::MaterialBase; - state->dataMaterial->Material.push_back(p); - } - state->dataSurface->SurfaceWindow(1).EffShBlindEmiss[1] = 0.1; - state->dataSurface->SurfaceWindow(1).EffGlassEmiss[1] = 0.1; + + state->dataSurface->surfShades(1).effShadeEmi = 0.1; + state->dataSurface->surfShades(1).effGlassEmi = 0.1; state->dataSurface->Surface(1).HeatTransSurf = true; state->dataSurface->Surface(1).Construction = 1; @@ -3133,7 +3131,6 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInterzoneRadFactorCalc) state->dataSurface->TotSurfaces = 2; state->dataGlobal->NumOfZones = 2; - state->dataMaterial->TotMaterials = 1; state->dataHeatBal->TotConstructs = 1; state->dataViewFactor->NumOfSolarEnclosures = 3; @@ -3261,7 +3258,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0022; // RH = 10% CalcThermalResilience(*state); ReportThermalResilience(*state); - EXPECT_NEAR(26, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); + EXPECT_NEAR(25, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); EXPECT_NEAR(23, state->dataHeatBal->Resilience(1).ZoneHumidex, 1); // Heat Index Case 4: Rothfusz regression, other than the above conditions; @@ -3836,7 +3833,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0022; // RH = 10% CalcThermalResilience(*state); ReportThermalResilience(*state); - EXPECT_NEAR(26, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); + EXPECT_NEAR(25, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); EXPECT_NEAR(23, state->dataHeatBal->Resilience(1).ZoneHumidex, 1); // Heat Index Case 4: Rothfusz regression, other than the above conditions; @@ -4882,6 +4879,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_IncSolarMultiplier) state->dataHeatBal->TotConstructs = 1; int totConstructs = state->dataHeatBal->TotConstructs; state->dataSurface->Surface.allocate(totSurf); + state->dataSurface->surfShades.allocate(totSurf); state->dataConstruction->Construct.allocate(totConstructs); state->dataGlobal->TimeStepZoneSec = 900; state->dataGlobal->NumOfTimeStepInHour = 6; @@ -8532,21 +8530,23 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestUpdateVariableAbsorptanc state->dataConstruction->Construct(2).Name = "CONSTRUCT_WALL_2"; state->dataConstruction->Construct(2).LayerPoint.allocate(1); state->dataConstruction->Construct(2).LayerPoint(1) = 2; - for (int i = 0; i < 2; i++) { - Material::MaterialBase *p = new Material::MaterialChild; - state->dataMaterial->Material.push_back(p); - } - auto *thisMaterial_1 = dynamic_cast(state->dataMaterial->Material(1)); - thisMaterial_1->Name = "WALL_1"; - thisMaterial_1->group = Material::Group::Regular; - thisMaterial_1->absorpVarCtrlSignal = Material::VariableAbsCtrlSignal::SurfaceTemperature; - thisMaterial_1->absorpThermalVarFuncIdx = 2; - thisMaterial_1->absorpSolarVarFuncIdx = 1; - auto *thisMaterial_2 = dynamic_cast(state->dataMaterial->Material(2)); - thisMaterial_2->Name = "WALL_2"; - thisMaterial_2->group = Material::Group::Regular; - thisMaterial_2->absorpVarCtrlSignal = Material::VariableAbsCtrlSignal::Scheduled; - thisMaterial_2->absorpThermalVarSchedIdx = 1; + + auto &s_mat = state->dataMaterial; + auto *mat1 = new Material::MaterialBase; + mat1->Name = "WALL_1"; + mat1->group = Material::Group::Regular; + mat1->absorpVarCtrlSignal = Material::VariableAbsCtrlSignal::SurfaceTemperature; + mat1->absorpThermalVarFuncIdx = 2; + mat1->absorpSolarVarFuncIdx = 1; + s_mat->materials.push_back(mat1); + + auto *mat2 = new Material::MaterialBase; + mat2->Name = "WALL_2"; + mat2->group = Material::Group::Regular; + mat2->absorpVarCtrlSignal = Material::VariableAbsCtrlSignal::Scheduled; + mat2->absorpThermalVarSchedIdx = 1; + s_mat->materials.push_back(mat2); + state->dataCurveManager->allocateCurveVector(2); state->dataHeatBalSurf->SurfTempOut.allocate(2); state->dataHeatBalSurf->SurfTempOut(1) = 10; diff --git a/tst/EnergyPlus/unit/ICSCollector.unit.cc b/tst/EnergyPlus/unit/ICSCollector.unit.cc index 27dc6c0e750..4087613f8a1 100644 --- a/tst/EnergyPlus/unit/ICSCollector.unit.cc +++ b/tst/EnergyPlus/unit/ICSCollector.unit.cc @@ -116,8 +116,8 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest state->dataConstruction->Construct.allocate(ConstrNum); state->dataConstruction->Construct(ConstrNum).LayerPoint.allocate(MatNum); state->dataConstruction->Construct(ConstrNum).LayerPoint(MatNum) = 1; - Material::MaterialChild *p = new Material::MaterialChild; - state->dataMaterial->Material.push_back(p); + auto *p = new Material::MaterialBase; + state->dataMaterial->materials.push_back(p); p->AbsorpThermal = 0.8; // allocate exterior vented cavity variable data state->dataHeatBal->ExtVentedCavity.allocate(1); @@ -199,7 +199,11 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest state->dataSurface->Surface.deallocate(); state->dataConstruction->Construct(ConstrNum).LayerPoint.deallocate(); state->dataConstruction->Construct.deallocate(); - state->dataMaterial->Material.deallocate(); + + for (int i = 1; i <= state->dataMaterial->materials.isize(); ++i) + delete state->dataMaterial->materials(i); + + state->dataMaterial->materials.deallocate(); state->dataHeatBal->ExtVentedCavity(NumOfSurf).SurfPtrs.deallocate(); state->dataHeatBal->ExtVentedCavity.deallocate(); state->dataHeatBal->Zone.deallocate(); diff --git a/tst/EnergyPlus/unit/Material.unit.cc b/tst/EnergyPlus/unit/Material.unit.cc index f8c8881ad90..9c0b1786380 100644 --- a/tst/EnergyPlus/unit/Material.unit.cc +++ b/tst/EnergyPlus/unit/Material.unit.cc @@ -109,33 +109,43 @@ TEST_F(EnergyPlusFixture, GetMaterialDataReadVarAbsorptance) ScheduleManager::ProcessScheduleInput(*state); // read schedules state->dataScheduleMgr->ScheduleInputProcessed = true; - for (int i = 0; i < 3; i++) { - Material::MaterialBase *p = new Material::MaterialChild; - state->dataMaterial->Material.push_back(p); - } - auto *thisMaterial_1 = dynamic_cast(state->dataMaterial->Material(1)); - thisMaterial_1->Name = "WALL_1"; - thisMaterial_1->group = Material::Group::Regular; - auto *thisMaterial_2 = dynamic_cast(state->dataMaterial->Material(2)); - thisMaterial_2->Name = "WALL_2"; - thisMaterial_2->group = Material::Group::Regular; - auto *thisMaterial_3 = dynamic_cast(state->dataMaterial->Material(3)); - thisMaterial_3->Name = "WALL_3"; - thisMaterial_3->group = Material::Group::Regular; + auto &s_mat = state->dataMaterial; + + auto *mat1 = new Material::MaterialBase; + mat1->Name = "WALL_1"; + mat1->group = Material::Group::Regular; + s_mat->materials.push_back(mat1); + mat1->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat1->Name, mat1->Num); + + auto *mat2 = new Material::MaterialBase; + mat2->Name = "WALL_2"; + mat2->group = Material::Group::Regular; + s_mat->materials.push_back(mat2); + mat2->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat2->Name, mat2->Num); + + auto *mat3 = new Material::MaterialBase; + mat3->Name = "WALL_3"; + mat3->group = Material::Group::Regular; + s_mat->materials.push_back(mat3); + mat3->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat3->Name, mat3->Num); + state->dataCurveManager->allocateCurveVector(2); state->dataCurveManager->PerfCurve(1)->Name = "THERMAL_ABSORPTANCE_TABLE"; state->dataCurveManager->PerfCurve(2)->Name = "SOLAR_ABSORPTANCE_CURVE"; state->dataCurveManager->GetCurvesInputFlag = false; bool errors_found(false); Material::GetVariableAbsorptanceInput(*state, errors_found); - EXPECT_ENUM_EQ(thisMaterial_1->absorpVarCtrlSignal, Material::VariableAbsCtrlSignal::SurfaceTemperature); - EXPECT_EQ(thisMaterial_1->absorpThermalVarFuncIdx, 1); - EXPECT_EQ(thisMaterial_1->absorpSolarVarFuncIdx, 2); - EXPECT_ENUM_EQ(thisMaterial_2->absorpVarCtrlSignal, Material::VariableAbsCtrlSignal::SurfaceReceivedSolarRadiation); - EXPECT_EQ(thisMaterial_2->absorpSolarVarFuncIdx, 2); - EXPECT_ENUM_EQ(thisMaterial_3->absorpVarCtrlSignal, Material::VariableAbsCtrlSignal::Scheduled); - EXPECT_EQ(thisMaterial_3->absorpThermalVarSchedIdx, 1); - EXPECT_EQ(thisMaterial_3->absorpSolarVarSchedIdx, 1); + EXPECT_ENUM_EQ(mat1->absorpVarCtrlSignal, Material::VariableAbsCtrlSignal::SurfaceTemperature); + EXPECT_EQ(mat1->absorpThermalVarFuncIdx, 1); + EXPECT_EQ(mat1->absorpSolarVarFuncIdx, 2); + EXPECT_ENUM_EQ(mat2->absorpVarCtrlSignal, Material::VariableAbsCtrlSignal::SurfaceReceivedSolarRadiation); + EXPECT_EQ(mat2->absorpSolarVarFuncIdx, 2); + EXPECT_ENUM_EQ(mat3->absorpVarCtrlSignal, Material::VariableAbsCtrlSignal::Scheduled); + EXPECT_EQ(mat3->absorpThermalVarSchedIdx, 1); + EXPECT_EQ(mat3->absorpSolarVarSchedIdx, 1); std::string idf_objects_bad_inputs = delimited_string({ "MaterialProperty:VariableAbsorptance,", @@ -223,8 +233,8 @@ TEST_F(EnergyPlusFixture, GetMaterialDataReadVarAbsorptance) }); ASSERT_TRUE(process_idf(idf_objects_bad_inputs)); Material::GetVariableAbsorptanceInput(*state, errors_found); - compare_err_stream(" ** Severe ** MaterialProperty:VariableAbsorptance: invalid Reference Material Name entered=WALL_0, must match to a valid " - "Material name.\n", + compare_err_stream(" ** Severe ** GetVariableAbsorptanceInput: MaterialProperty:VariableAbsorptance = VARIABLETHERMAL_WALL_1\n ** ~~~ " + "** Reference Material Name = WALL_0, item not found.\n", true); // wrong material group @@ -239,11 +249,9 @@ TEST_F(EnergyPlusFixture, GetMaterialDataReadVarAbsorptance) "; !- Solar Absorptance Schedule Name", }); ASSERT_TRUE(process_idf(idf_objects_bad_inputs)); - thisMaterial_1->group = Material::Group::WindowGlass; + mat1->group = Material::Group::Glass; Material::GetVariableAbsorptanceInput(*state, errors_found); - compare_err_stream( - " ** Severe ** MaterialProperty:VariableAbsorptance: Reference Material is not appropriate type for Thermal/Solar Absorptance properties, " - "material=WALL_1, must have regular " - "properties (Thermal/Solar Absorptance)\n", - true); + compare_err_stream(" ** Severe ** MaterialProperty:VariableAbsorptance: Reference Material is not appropriate type for Thermal/Solar " + "Absorptance properties, material=WALL_1, must have regular properties (Thermal/Solar Absorptance)\n", + true); } diff --git a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc index 3ae7a8bf95c..961e19d6867 100644 --- a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc +++ b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc @@ -121,7 +121,7 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc) state->dataConstruction->Construct.allocate(1); Construction::ConstructionProps &construction = state->dataConstruction->Construct(1); construction.TotLayers = 1; - construction.LayerPoint(construction.TotLayers) = Util::FindItemInPtrList("CONCRETE", state->dataMaterial->Material); + construction.LayerPoint(construction.TotLayers) = Material::GetMaterialNum(*state, "CONCRETE"); // Initialize and get inputs MoistureBalanceEMPDManager::InitMoistureBalanceEMPD(*state); @@ -184,9 +184,9 @@ TEST_F(EnergyPlusFixture, EMPDAutocalcDepth) ASSERT_FALSE(errors_found) << "Errors in GetMaterialData"; MoistureBalanceEMPDManager::GetMoistureBalanceEMPDInput(*state); - auto const *material = dynamic_cast(state->dataMaterial->Material(1)); - ASSERT_NEAR(material->EMPDSurfaceDepth, 0.014143, 0.000001); - ASSERT_NEAR(material->EMPDDeepDepth, 0.064810, 0.000001); + auto const *matEMPD = dynamic_cast(state->dataMaterial->materials(1)); + ASSERT_NEAR(matEMPD->surfaceDepth, 0.014143, 0.000001); + ASSERT_NEAR(matEMPD->deepDepth, 0.064810, 0.000001); } TEST_F(EnergyPlusFixture, EMPDRcoating) @@ -241,7 +241,7 @@ TEST_F(EnergyPlusFixture, EMPDRcoating) state->dataConstruction->Construct.allocate(1); Construction::ConstructionProps &construction = state->dataConstruction->Construct(1); construction.TotLayers = 1; - construction.LayerPoint(construction.TotLayers) = Util::FindItemInPtrList("CONCRETE", state->dataMaterial->Material); + construction.LayerPoint(construction.TotLayers) = Material::GetMaterialNum(*state, "CONCRETE"); // Initialize and get inputs MoistureBalanceEMPDManager::InitMoistureBalanceEMPD(*state); @@ -327,7 +327,7 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) state->dataConstruction->Construct.allocate(constNum); Construction::ConstructionProps &construction = state->dataConstruction->Construct(constNum); construction.TotLayers = constNum; - construction.LayerPoint(construction.TotLayers) = Util::FindItemInPtrList("WOOD", state->dataMaterial->Material); + construction.LayerPoint(construction.TotLayers) = Material::GetMaterialNum(*state, "WOOD"); // Initialize and get inputs MoistureBalanceEMPDManager::InitMoistureBalanceEMPD(*state); @@ -346,7 +346,7 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) using Psychrometrics::PsyRhFnTdbRhov; - auto const *material(dynamic_cast(state->dataMaterial->Material(1))); + auto const *matEMPD = dynamic_cast(state->dataMaterial->materials(1)); Real64 Tsat(0.0); state->dataHeatBalSurf->SurfTempIn.allocate(surfNum); @@ -358,15 +358,14 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) Real64 RV_Deep_Old = state->dataMstBalEMPD->RVdeepOld(surfNum); Real64 RVaver = state->dataMstBalEMPD->RVSurfLayerOld(surfNum); Real64 RHaver = RVaver * 461.52 * (Taver + Constant::Kelvin) * std::exp(-23.7093 + 4111.0 / (Taver + 237.7)); - Real64 dU_dRH = material->MoistACoeff * material->MoistBCoeff * pow(RHaver, material->MoistBCoeff - 1) + - material->MoistCCoeff * material->MoistDCoeff * pow(RHaver, material->MoistDCoeff - 1); + Real64 dU_dRH = matEMPD->moistACoeff * matEMPD->moistBCoeff * pow(RHaver, matEMPD->moistBCoeff - 1) + + matEMPD->moistCCoeff * matEMPD->moistDCoeff * pow(RHaver, matEMPD->moistDCoeff - 1); // Convert stored vapor density to RH. Real64 RH_deep_layer_old = PsyRhFnTdbRhov(*state, Taver, RV_Deep_Old); Real64 RH_surf_layer_old = PsyRhFnTdbRhov(*state, Taver, RVaver); Real64 mass_flux_surf_deep_max = - material->EMPDDeepDepth * material->Density * dU_dRH * (RH_surf_layer_old - RH_deep_layer_old) / (state->dataGlobal->TimeStepZone * 3600.0); - + matEMPD->deepDepth * matEMPD->Density * dU_dRH * (RH_surf_layer_old - RH_deep_layer_old) / (state->dataGlobal->TimeStepZone * 3600.0); Real64 hm_deep_layer = 6.9551289450635225e-05; Real64 mass_flux_surf_deep_result = hm_deep_layer * (RVaver - RV_Deep_Old); if (std::abs(mass_flux_surf_deep_max) < std::abs(mass_flux_surf_deep_result)) { diff --git a/tst/EnergyPlus/unit/PhaseChangeModeling/HysteresisModel.unit.cc b/tst/EnergyPlus/unit/PhaseChangeModeling/HysteresisModel.unit.cc index 3a98db87353..2b9418ffbac 100644 --- a/tst/EnergyPlus/unit/PhaseChangeModeling/HysteresisModel.unit.cc +++ b/tst/EnergyPlus/unit/PhaseChangeModeling/HysteresisModel.unit.cc @@ -57,10 +57,10 @@ using namespace EnergyPlus; class HysteresisTest : public testing::Test { public: - HysteresisPhaseChange::HysteresisPhaseChange ModelA; + Material::MaterialPhaseChange ModelA; virtual void SetUp() { - this->ModelA.name = "PCM Name"; + this->ModelA.Name = "PCM Name"; this->ModelA.totalLatentHeat = 25000; // J/kg ? this->ModelA.specificHeatLiquid = 25000; // J/kgK this->ModelA.deltaTempMeltingHigh = 1.0; // deltaC @@ -88,15 +88,15 @@ struct GetSpecHeatArgs Real64 previousTemperature; Real64 updatedTemperature; Real64 temperatureReverse; - int previousPhaseChangeState; - int expectedUpdatedPhaseChangeState; + Material::Phase previousPhaseChangeState; + Material::Phase expectedUpdatedPhaseChangeState; Real64 expectedSpecificHeat; GetSpecHeatArgs(Real64 _previousTemperature, Real64 _updatedTemperature, Real64 _temperatureReverse, - int _previousPhaseChangeState, - int _expectedUpdatedPhaseChangeState, + Material::Phase _previousPhaseChangeState, + Material::Phase _expectedUpdatedPhaseChangeState, Real64 _expectedSpecificHeat) : previousTemperature(_previousTemperature), updatedTemperature(_updatedTemperature), temperatureReverse(_temperatureReverse), previousPhaseChangeState(_previousPhaseChangeState), expectedUpdatedPhaseChangeState(_expectedUpdatedPhaseChangeState), @@ -159,33 +159,33 @@ TEST_F(HysteresisTest, StraightUpCurve) // 0 5 10 15 20 25 // std::vector args_list; - args_list.push_back(GetSpecHeatArgs(14.0, 14.5, -999.000000, 2, 2, 20000.417543)); - args_list.push_back(GetSpecHeatArgs(14.5, 15.0, -999.000000, 2, 2, 20001.134998)); - args_list.push_back(GetSpecHeatArgs(15.0, 15.5, -999.000000, 2, 2, 20003.085245)); - args_list.push_back(GetSpecHeatArgs(15.5, 16.0, -999.000000, 2, 2, 20008.386566)); - args_list.push_back(GetSpecHeatArgs(16.0, 16.5, -999.000000, 2, 2, 20022.797049)); - args_list.push_back(GetSpecHeatArgs(16.5, 17.0, -999.000000, 2, 2, 20061.968804)); - args_list.push_back(GetSpecHeatArgs(17.0, 17.5, -999.000000, 2, 2, 20168.448675)); - args_list.push_back(GetSpecHeatArgs(17.5, 18.0, -999.000000, 2, 2, 20457.890972)); - args_list.push_back(GetSpecHeatArgs(18.0, 18.5, -999.000000, 2, 2, 21244.676709)); - args_list.push_back(GetSpecHeatArgs(18.5, 19.0, -999.000000, 2, -1, 23383.382081)); - args_list.push_back(GetSpecHeatArgs(19.0, 19.5, -999.000000, -1, -1, 29196.986029)); - args_list.push_back(GetSpecHeatArgs(19.5, 20.0, -999.000000, -1, -1, 35803.013971)); - args_list.push_back(GetSpecHeatArgs(20.0, 20.5, -999.000000, -1, -1, 34196.986029)); - args_list.push_back(GetSpecHeatArgs(20.5, 21.0, -999.000000, -1, -1, 28383.382081)); - args_list.push_back(GetSpecHeatArgs(21.0, 21.5, -999.000000, -1, -2, 26244.676709)); - args_list.push_back(GetSpecHeatArgs(21.5, 22.0, -999.000000, -2, -2, 25457.890972)); - args_list.push_back(GetSpecHeatArgs(22.0, 22.5, -999.000000, -2, -2, 25168.448675)); - args_list.push_back(GetSpecHeatArgs(22.5, 23.0, -999.000000, -2, -2, 25061.968804)); - args_list.push_back(GetSpecHeatArgs(23.0, 23.5, -999.000000, -2, -2, 25022.797049)); - args_list.push_back(GetSpecHeatArgs(23.5, 24.0, -999.000000, -2, -2, 25008.386566)); - args_list.push_back(GetSpecHeatArgs(24.0, 24.5, -999.000000, -2, -2, 25003.085245)); - args_list.push_back(GetSpecHeatArgs(24.5, 25.0, -999.000000, -2, -2, 25001.134998)); - args_list.push_back(GetSpecHeatArgs(25.0, 25.5, -999.000000, -2, -2, 25000.417543)); - args_list.push_back(GetSpecHeatArgs(25.5, 26.0, -999.000000, -2, -2, 25000.153605)); - args_list.push_back(GetSpecHeatArgs(26.0, 26.5, -999.000000, -2, -2, 25000.056508)); + args_list.push_back(GetSpecHeatArgs(14.0, 14.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.417543)); + args_list.push_back(GetSpecHeatArgs(14.5, 15.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20001.134998)); + args_list.push_back(GetSpecHeatArgs(15.0, 15.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20003.085245)); + args_list.push_back(GetSpecHeatArgs(15.5, 16.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20008.386566)); + args_list.push_back(GetSpecHeatArgs(16.0, 16.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20022.797049)); + args_list.push_back(GetSpecHeatArgs(16.5, 17.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20061.968804)); + args_list.push_back(GetSpecHeatArgs(17.0, 17.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20168.448675)); + args_list.push_back(GetSpecHeatArgs(17.5, 18.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20457.890972)); + args_list.push_back(GetSpecHeatArgs(18.0, 18.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 21244.676709)); + args_list.push_back(GetSpecHeatArgs(18.5, 19.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Melting, 23383.382081)); + args_list.push_back(GetSpecHeatArgs(19.0, 19.5, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 29196.986029)); + args_list.push_back(GetSpecHeatArgs(19.5, 20.0, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 35803.013971)); + args_list.push_back(GetSpecHeatArgs(20.0, 20.5, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 34196.986029)); + args_list.push_back(GetSpecHeatArgs(20.5, 21.0, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 28383.382081)); + args_list.push_back(GetSpecHeatArgs(21.0, 21.5, -999.000000, Material::Phase::Melting, Material::Phase::Liquid, 26244.676709)); + args_list.push_back(GetSpecHeatArgs(21.5, 22.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25457.890972)); + args_list.push_back(GetSpecHeatArgs(22.0, 22.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25168.448675)); + args_list.push_back(GetSpecHeatArgs(22.5, 23.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25061.968804)); + args_list.push_back(GetSpecHeatArgs(23.0, 23.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25022.797049)); + args_list.push_back(GetSpecHeatArgs(23.5, 24.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25008.386566)); + args_list.push_back(GetSpecHeatArgs(24.0, 24.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25003.085245)); + args_list.push_back(GetSpecHeatArgs(24.5, 25.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25001.134998)); + args_list.push_back(GetSpecHeatArgs(25.0, 25.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.417543)); + args_list.push_back(GetSpecHeatArgs(25.5, 26.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.153605)); + args_list.push_back(GetSpecHeatArgs(26.0, 26.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.056508)); for (auto &cp_call : args_list) { - int calculated_pcm_state = -99; + Material::Phase calculated_pcm_state = Material::Phase::Invalid; Real64 calculated_cp = this->ModelA.getCurrentSpecificHeat(cp_call.previousTemperature, cp_call.updatedTemperature, cp_call.temperatureReverse, @@ -197,7 +197,7 @@ TEST_F(HysteresisTest, StraightUpCurve) } // Generated by this call: -// generate_test_data(this->ModelA, "StraightDownCurve", 30.000000, 15.000000, -0.500000, -2); +// generate_test_data(this->ModelA, "StraightDownCurve", 30.000000, 15.000000, -0.500000, Material::Phase::Liquid); TEST_F(HysteresisTest, StraightDownCurve) { // TestDescription @@ -250,39 +250,39 @@ TEST_F(HysteresisTest, StraightDownCurve) // 0 5 10 15 20 25 30 // std::vector args_list; - args_list.push_back(GetSpecHeatArgs(30.0, 29.5, -999.000000, -2, -2, 25000.056508)); - args_list.push_back(GetSpecHeatArgs(29.5, 29.0, -999.000000, -2, -2, 25000.153605)); - args_list.push_back(GetSpecHeatArgs(29.0, 28.5, -999.000000, -2, -2, 25000.417543)); - args_list.push_back(GetSpecHeatArgs(28.5, 28.0, -999.000000, -2, -2, 25001.134998)); - args_list.push_back(GetSpecHeatArgs(28.0, 27.5, -999.000000, -2, -2, 25003.085245)); - args_list.push_back(GetSpecHeatArgs(27.5, 27.0, -999.000000, -2, -2, 25008.386566)); - args_list.push_back(GetSpecHeatArgs(27.0, 26.5, -999.000000, -2, -2, 25022.797049)); - args_list.push_back(GetSpecHeatArgs(26.5, 26.0, -999.000000, -2, -2, 25061.968804)); - args_list.push_back(GetSpecHeatArgs(26.0, 25.5, -999.000000, -2, -2, 25168.448675)); - args_list.push_back(GetSpecHeatArgs(25.5, 25.0, -999.000000, -2, -2, 25457.890972)); - args_list.push_back(GetSpecHeatArgs(25.0, 24.5, -999.000000, -2, -2, 26244.676709)); - args_list.push_back(GetSpecHeatArgs(24.5, 24.0, -999.000000, -2, 1, 28383.382081)); - args_list.push_back(GetSpecHeatArgs(24.0, 23.5, -999.000000, 1, 1, 34196.986029)); - args_list.push_back(GetSpecHeatArgs(23.5, 23.0, -999.000000, 1, 1, 40803.013971)); - args_list.push_back(GetSpecHeatArgs(23.0, 22.5, -999.000000, 1, 1, 29196.986029)); - args_list.push_back(GetSpecHeatArgs(22.5, 22.0, -999.000000, 1, 1, 23383.382081)); - args_list.push_back(GetSpecHeatArgs(22.0, 21.5, -999.000000, 1, 2, 21244.676709)); - args_list.push_back(GetSpecHeatArgs(21.5, 21.0, -999.000000, 2, 2, 20457.890972)); - args_list.push_back(GetSpecHeatArgs(21.0, 20.5, -999.000000, 2, 2, 20168.448675)); - args_list.push_back(GetSpecHeatArgs(20.5, 20.0, -999.000000, 2, 2, 20061.968804)); - args_list.push_back(GetSpecHeatArgs(20.0, 19.5, -999.000000, 2, 2, 20022.797049)); - args_list.push_back(GetSpecHeatArgs(19.5, 19.0, -999.000000, 2, 2, 20008.386566)); - args_list.push_back(GetSpecHeatArgs(19.0, 18.5, -999.000000, 2, 2, 20003.085245)); - args_list.push_back(GetSpecHeatArgs(18.5, 18.0, -999.000000, 2, 2, 20001.134998)); - args_list.push_back(GetSpecHeatArgs(18.0, 17.5, -999.000000, 2, 2, 20000.417543)); - args_list.push_back(GetSpecHeatArgs(17.5, 17.0, -999.000000, 2, 2, 20000.153605)); - args_list.push_back(GetSpecHeatArgs(17.0, 16.5, -999.000000, 2, 2, 20000.056508)); - args_list.push_back(GetSpecHeatArgs(16.5, 16.0, -999.000000, 2, 2, 20000.020788)); - args_list.push_back(GetSpecHeatArgs(16.0, 15.5, -999.000000, 2, 2, 20000.007648)); - args_list.push_back(GetSpecHeatArgs(15.5, 15.0, -999.000000, 2, 2, 20000.002813)); - args_list.push_back(GetSpecHeatArgs(15.0, 14.5, -999.000000, 2, 2, 20000.001035)); + args_list.push_back(GetSpecHeatArgs(30.0, 29.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.056508)); + args_list.push_back(GetSpecHeatArgs(29.5, 29.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.153605)); + args_list.push_back(GetSpecHeatArgs(29.0, 28.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.417543)); + args_list.push_back(GetSpecHeatArgs(28.5, 28.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25001.134998)); + args_list.push_back(GetSpecHeatArgs(28.0, 27.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25003.085245)); + args_list.push_back(GetSpecHeatArgs(27.5, 27.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25008.386566)); + args_list.push_back(GetSpecHeatArgs(27.0, 26.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25022.797049)); + args_list.push_back(GetSpecHeatArgs(26.5, 26.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25061.968804)); + args_list.push_back(GetSpecHeatArgs(26.0, 25.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25168.448675)); + args_list.push_back(GetSpecHeatArgs(25.5, 25.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25457.890972)); + args_list.push_back(GetSpecHeatArgs(25.0, 24.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 26244.676709)); + args_list.push_back(GetSpecHeatArgs(24.5, 24.0, -999.000000, Material::Phase::Liquid, Material::Phase::Freezing, 28383.382081)); + args_list.push_back(GetSpecHeatArgs(24.0, 23.5, -999.000000, Material::Phase::Freezing, Material::Phase::Freezing, 34196.986029)); + args_list.push_back(GetSpecHeatArgs(23.5, 23.0, -999.000000, Material::Phase::Freezing, Material::Phase::Freezing, 40803.013971)); + args_list.push_back(GetSpecHeatArgs(23.0, 22.5, -999.000000, Material::Phase::Freezing, Material::Phase::Freezing, 29196.986029)); + args_list.push_back(GetSpecHeatArgs(22.5, 22.0, -999.000000, Material::Phase::Freezing, Material::Phase::Freezing, 23383.382081)); + args_list.push_back(GetSpecHeatArgs(22.0, 21.5, -999.000000, Material::Phase::Freezing, Material::Phase::Crystallized, 21244.676709)); + args_list.push_back(GetSpecHeatArgs(21.5, 21.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20457.890972)); + args_list.push_back(GetSpecHeatArgs(21.0, 20.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20168.448675)); + args_list.push_back(GetSpecHeatArgs(20.5, 20.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20061.968804)); + args_list.push_back(GetSpecHeatArgs(20.0, 19.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20022.797049)); + args_list.push_back(GetSpecHeatArgs(19.5, 19.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20008.386566)); + args_list.push_back(GetSpecHeatArgs(19.0, 18.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20003.085245)); + args_list.push_back(GetSpecHeatArgs(18.5, 18.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20001.134998)); + args_list.push_back(GetSpecHeatArgs(18.0, 17.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.417543)); + args_list.push_back(GetSpecHeatArgs(17.5, 17.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.153605)); + args_list.push_back(GetSpecHeatArgs(17.0, 16.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.056508)); + args_list.push_back(GetSpecHeatArgs(16.5, 16.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.020788)); + args_list.push_back(GetSpecHeatArgs(16.0, 15.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.007648)); + args_list.push_back(GetSpecHeatArgs(15.5, 15.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.002813)); + args_list.push_back(GetSpecHeatArgs(15.0, 14.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.001035)); for (auto &cp_call : args_list) { - int calculated_pcm_state = -99; + Material::Phase calculated_pcm_state = Material::Phase::Invalid; Real64 calculated_cp = this->ModelA.getCurrentSpecificHeat(cp_call.previousTemperature, cp_call.updatedTemperature, cp_call.temperatureReverse, @@ -353,75 +353,75 @@ TEST_F(HysteresisTest, CompletelyThroughMeltingAndBackDown) // 0 10 20 30 40 50 60 70 // std::vector args_list; - args_list.push_back(GetSpecHeatArgs(14.0, 14.5, -999.000000, 2, 2, 20000.417543)); - args_list.push_back(GetSpecHeatArgs(14.5, 15.0, -999.000000, 2, 2, 20001.134998)); - args_list.push_back(GetSpecHeatArgs(15.0, 15.5, -999.000000, 2, 2, 20003.085245)); - args_list.push_back(GetSpecHeatArgs(15.5, 16.0, -999.000000, 2, 2, 20008.386566)); - args_list.push_back(GetSpecHeatArgs(16.0, 16.5, -999.000000, 2, 2, 20022.797049)); - args_list.push_back(GetSpecHeatArgs(16.5, 17.0, -999.000000, 2, 2, 20061.968804)); - args_list.push_back(GetSpecHeatArgs(17.0, 17.5, -999.000000, 2, 2, 20168.448675)); - args_list.push_back(GetSpecHeatArgs(17.5, 18.0, -999.000000, 2, 2, 20457.890972)); - args_list.push_back(GetSpecHeatArgs(18.0, 18.5, -999.000000, 2, 2, 21244.676709)); - args_list.push_back(GetSpecHeatArgs(18.5, 19.0, -999.000000, 2, -1, 23383.382081)); - args_list.push_back(GetSpecHeatArgs(19.0, 19.5, -999.000000, -1, -1, 29196.986029)); - args_list.push_back(GetSpecHeatArgs(19.5, 20.0, -999.000000, -1, -1, 35803.013971)); - args_list.push_back(GetSpecHeatArgs(20.0, 20.5, -999.000000, -1, -1, 34196.986029)); - args_list.push_back(GetSpecHeatArgs(20.5, 21.0, -999.000000, -1, -1, 28383.382081)); - args_list.push_back(GetSpecHeatArgs(21.0, 21.5, -999.000000, -1, -2, 26244.676709)); - args_list.push_back(GetSpecHeatArgs(21.5, 22.0, -999.000000, -2, -2, 25457.890972)); - args_list.push_back(GetSpecHeatArgs(22.0, 22.5, -999.000000, -2, -2, 25168.448675)); - args_list.push_back(GetSpecHeatArgs(22.5, 23.0, -999.000000, -2, -2, 25061.968804)); - args_list.push_back(GetSpecHeatArgs(23.0, 23.5, -999.000000, -2, -2, 25022.797049)); - args_list.push_back(GetSpecHeatArgs(23.5, 24.0, -999.000000, -2, -2, 25008.386566)); - args_list.push_back(GetSpecHeatArgs(24.0, 24.5, -999.000000, -2, -2, 25003.085245)); - args_list.push_back(GetSpecHeatArgs(24.5, 25.0, -999.000000, -2, -2, 25001.134998)); - args_list.push_back(GetSpecHeatArgs(25.0, 25.5, -999.000000, -2, -2, 25000.417543)); - args_list.push_back(GetSpecHeatArgs(25.5, 26.0, -999.000000, -2, -2, 25000.153605)); - args_list.push_back(GetSpecHeatArgs(26.0, 26.5, -999.000000, -2, -2, 25000.056508)); - args_list.push_back(GetSpecHeatArgs(26.5, 27.0, -999.000000, -2, -2, 25000.020788)); - args_list.push_back(GetSpecHeatArgs(27.0, 27.5, -999.000000, -2, -2, 25000.007648)); - args_list.push_back(GetSpecHeatArgs(27.5, 28.0, -999.000000, -2, -2, 25000.002813)); - args_list.push_back(GetSpecHeatArgs(28.0, 28.5, -999.000000, -2, -2, 25000.001035)); - args_list.push_back(GetSpecHeatArgs(28.5, 29.0, -999.000000, -2, -2, 25000.000381)); - args_list.push_back(GetSpecHeatArgs(29.0, 29.5, -999.000000, -2, -2, 25000.000140)); - args_list.push_back(GetSpecHeatArgs(29.5, 30.0, -999.000000, -2, -2, 25000.000052)); - args_list.push_back(GetSpecHeatArgs(30.0, 30.5, -999.000000, -2, -2, 25000.000019)); - args_list.push_back(GetSpecHeatArgs(30.5, 30.0, -999.000000, -2, -2, 25000.020788)); - args_list.push_back(GetSpecHeatArgs(30.0, 29.5, -999.000000, -2, -2, 25000.056508)); - args_list.push_back(GetSpecHeatArgs(29.5, 29.0, -999.000000, -2, -2, 25000.153605)); - args_list.push_back(GetSpecHeatArgs(29.0, 28.5, -999.000000, -2, -2, 25000.417543)); - args_list.push_back(GetSpecHeatArgs(28.5, 28.0, -999.000000, -2, -2, 25001.134998)); - args_list.push_back(GetSpecHeatArgs(28.0, 27.5, -999.000000, -2, -2, 25003.085245)); - args_list.push_back(GetSpecHeatArgs(27.5, 27.0, -999.000000, -2, -2, 25008.386566)); - args_list.push_back(GetSpecHeatArgs(27.0, 26.5, -999.000000, -2, -2, 25022.797049)); - args_list.push_back(GetSpecHeatArgs(26.5, 26.0, -999.000000, -2, -2, 25061.968804)); - args_list.push_back(GetSpecHeatArgs(26.0, 25.5, -999.000000, -2, -2, 25168.448675)); - args_list.push_back(GetSpecHeatArgs(25.5, 25.0, -999.000000, -2, -2, 25457.890972)); - args_list.push_back(GetSpecHeatArgs(25.0, 24.5, -999.000000, -2, -2, 26244.676709)); - args_list.push_back(GetSpecHeatArgs(24.5, 24.0, -999.000000, -2, 1, 28383.382081)); - args_list.push_back(GetSpecHeatArgs(24.0, 23.5, -999.000000, 1, 1, 34196.986029)); - args_list.push_back(GetSpecHeatArgs(23.5, 23.0, -999.000000, 1, 1, 40803.013971)); - args_list.push_back(GetSpecHeatArgs(23.0, 22.5, -999.000000, 1, 1, 29196.986029)); - args_list.push_back(GetSpecHeatArgs(22.5, 22.0, -999.000000, 1, 1, 23383.382081)); - args_list.push_back(GetSpecHeatArgs(22.0, 21.5, -999.000000, 1, 2, 21244.676709)); - args_list.push_back(GetSpecHeatArgs(21.5, 21.0, -999.000000, 2, 2, 20457.890972)); - args_list.push_back(GetSpecHeatArgs(21.0, 20.5, -999.000000, 2, 2, 20168.448675)); - args_list.push_back(GetSpecHeatArgs(20.5, 20.0, -999.000000, 2, 2, 20061.968804)); - args_list.push_back(GetSpecHeatArgs(20.0, 19.5, -999.000000, 2, 2, 20022.797049)); - args_list.push_back(GetSpecHeatArgs(19.5, 19.0, -999.000000, 2, 2, 20008.386566)); - args_list.push_back(GetSpecHeatArgs(19.0, 18.5, -999.000000, 2, 2, 20003.085245)); - args_list.push_back(GetSpecHeatArgs(18.5, 18.0, -999.000000, 2, 2, 20001.134998)); - args_list.push_back(GetSpecHeatArgs(18.0, 17.5, -999.000000, 2, 2, 20000.417543)); - args_list.push_back(GetSpecHeatArgs(17.5, 17.0, -999.000000, 2, 2, 20000.153605)); - args_list.push_back(GetSpecHeatArgs(17.0, 16.5, -999.000000, 2, 2, 20000.056508)); - args_list.push_back(GetSpecHeatArgs(16.5, 16.0, -999.000000, 2, 2, 20000.020788)); - args_list.push_back(GetSpecHeatArgs(16.0, 15.5, -999.000000, 2, 2, 20000.007648)); - args_list.push_back(GetSpecHeatArgs(15.5, 15.0, -999.000000, 2, 2, 20000.002813)); - args_list.push_back(GetSpecHeatArgs(15.0, 14.5, -999.000000, 2, 2, 20000.001035)); - args_list.push_back(GetSpecHeatArgs(14.5, 14.0, -999.000000, 2, 2, 20000.000381)); - args_list.push_back(GetSpecHeatArgs(14.0, 13.5, -999.000000, 2, 2, 20000.000140)); + args_list.push_back(GetSpecHeatArgs(14.0, 14.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.417543)); + args_list.push_back(GetSpecHeatArgs(14.5, 15.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20001.134998)); + args_list.push_back(GetSpecHeatArgs(15.0, 15.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20003.085245)); + args_list.push_back(GetSpecHeatArgs(15.5, 16.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20008.386566)); + args_list.push_back(GetSpecHeatArgs(16.0, 16.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20022.797049)); + args_list.push_back(GetSpecHeatArgs(16.5, 17.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20061.968804)); + args_list.push_back(GetSpecHeatArgs(17.0, 17.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20168.448675)); + args_list.push_back(GetSpecHeatArgs(17.5, 18.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20457.890972)); + args_list.push_back(GetSpecHeatArgs(18.0, 18.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 21244.676709)); + args_list.push_back(GetSpecHeatArgs(18.5, 19.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Melting, 23383.382081)); + args_list.push_back(GetSpecHeatArgs(19.0, 19.5, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 29196.986029)); + args_list.push_back(GetSpecHeatArgs(19.5, 20.0, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 35803.013971)); + args_list.push_back(GetSpecHeatArgs(20.0, 20.5, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 34196.986029)); + args_list.push_back(GetSpecHeatArgs(20.5, 21.0, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 28383.382081)); + args_list.push_back(GetSpecHeatArgs(21.0, 21.5, -999.000000, Material::Phase::Melting, Material::Phase::Liquid, 26244.676709)); + args_list.push_back(GetSpecHeatArgs(21.5, 22.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25457.890972)); + args_list.push_back(GetSpecHeatArgs(22.0, 22.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25168.448675)); + args_list.push_back(GetSpecHeatArgs(22.5, 23.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25061.968804)); + args_list.push_back(GetSpecHeatArgs(23.0, 23.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25022.797049)); + args_list.push_back(GetSpecHeatArgs(23.5, 24.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25008.386566)); + args_list.push_back(GetSpecHeatArgs(24.0, 24.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25003.085245)); + args_list.push_back(GetSpecHeatArgs(24.5, 25.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25001.134998)); + args_list.push_back(GetSpecHeatArgs(25.0, 25.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.417543)); + args_list.push_back(GetSpecHeatArgs(25.5, 26.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.153605)); + args_list.push_back(GetSpecHeatArgs(26.0, 26.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.056508)); + args_list.push_back(GetSpecHeatArgs(26.5, 27.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.020788)); + args_list.push_back(GetSpecHeatArgs(27.0, 27.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.007648)); + args_list.push_back(GetSpecHeatArgs(27.5, 28.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.002813)); + args_list.push_back(GetSpecHeatArgs(28.0, 28.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.001035)); + args_list.push_back(GetSpecHeatArgs(28.5, 29.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.000381)); + args_list.push_back(GetSpecHeatArgs(29.0, 29.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.000140)); + args_list.push_back(GetSpecHeatArgs(29.5, 30.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.000052)); + args_list.push_back(GetSpecHeatArgs(30.0, 30.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.000019)); + args_list.push_back(GetSpecHeatArgs(30.5, 30.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.020788)); + args_list.push_back(GetSpecHeatArgs(30.0, 29.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.056508)); + args_list.push_back(GetSpecHeatArgs(29.5, 29.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.153605)); + args_list.push_back(GetSpecHeatArgs(29.0, 28.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25000.417543)); + args_list.push_back(GetSpecHeatArgs(28.5, 28.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25001.134998)); + args_list.push_back(GetSpecHeatArgs(28.0, 27.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25003.085245)); + args_list.push_back(GetSpecHeatArgs(27.5, 27.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25008.386566)); + args_list.push_back(GetSpecHeatArgs(27.0, 26.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25022.797049)); + args_list.push_back(GetSpecHeatArgs(26.5, 26.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25061.968804)); + args_list.push_back(GetSpecHeatArgs(26.0, 25.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25168.448675)); + args_list.push_back(GetSpecHeatArgs(25.5, 25.0, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 25457.890972)); + args_list.push_back(GetSpecHeatArgs(25.0, 24.5, -999.000000, Material::Phase::Liquid, Material::Phase::Liquid, 26244.676709)); + args_list.push_back(GetSpecHeatArgs(24.5, 24.0, -999.000000, Material::Phase::Liquid, Material::Phase::Freezing, 28383.382081)); + args_list.push_back(GetSpecHeatArgs(24.0, 23.5, -999.000000, Material::Phase::Freezing, Material::Phase::Freezing, 34196.986029)); + args_list.push_back(GetSpecHeatArgs(23.5, 23.0, -999.000000, Material::Phase::Freezing, Material::Phase::Freezing, 40803.013971)); + args_list.push_back(GetSpecHeatArgs(23.0, 22.5, -999.000000, Material::Phase::Freezing, Material::Phase::Freezing, 29196.986029)); + args_list.push_back(GetSpecHeatArgs(22.5, 22.0, -999.000000, Material::Phase::Freezing, Material::Phase::Freezing, 23383.382081)); + args_list.push_back(GetSpecHeatArgs(22.0, 21.5, -999.000000, Material::Phase::Freezing, Material::Phase::Crystallized, 21244.676709)); + args_list.push_back(GetSpecHeatArgs(21.5, 21.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20457.890972)); + args_list.push_back(GetSpecHeatArgs(21.0, 20.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20168.448675)); + args_list.push_back(GetSpecHeatArgs(20.5, 20.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20061.968804)); + args_list.push_back(GetSpecHeatArgs(20.0, 19.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20022.797049)); + args_list.push_back(GetSpecHeatArgs(19.5, 19.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20008.386566)); + args_list.push_back(GetSpecHeatArgs(19.0, 18.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20003.085245)); + args_list.push_back(GetSpecHeatArgs(18.5, 18.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20001.134998)); + args_list.push_back(GetSpecHeatArgs(18.0, 17.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.417543)); + args_list.push_back(GetSpecHeatArgs(17.5, 17.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.153605)); + args_list.push_back(GetSpecHeatArgs(17.0, 16.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.056508)); + args_list.push_back(GetSpecHeatArgs(16.5, 16.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.020788)); + args_list.push_back(GetSpecHeatArgs(16.0, 15.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.007648)); + args_list.push_back(GetSpecHeatArgs(15.5, 15.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.002813)); + args_list.push_back(GetSpecHeatArgs(15.0, 14.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.001035)); + args_list.push_back(GetSpecHeatArgs(14.5, 14.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.000381)); + args_list.push_back(GetSpecHeatArgs(14.0, 13.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.000140)); for (auto &cp_call : args_list) { - int calculated_pcm_state = -99; + Material::Phase calculated_pcm_state = Material::Phase::Invalid; Real64 calculated_cp = this->ModelA.getCurrentSpecificHeat(cp_call.previousTemperature, cp_call.updatedTemperature, cp_call.temperatureReverse, @@ -487,35 +487,35 @@ TEST_F(HysteresisTest, IntoMeltingAndBackDown) // 0 5 10 15 20 25 // std::vector args_list; - args_list.push_back(GetSpecHeatArgs(14.0, 14.5, -999.000000, 2, 2, 20000.417543)); - args_list.push_back(GetSpecHeatArgs(14.5, 15.0, -999.000000, 2, 2, 20001.134998)); - args_list.push_back(GetSpecHeatArgs(15.0, 15.5, -999.000000, 2, 2, 20003.085245)); - args_list.push_back(GetSpecHeatArgs(15.5, 16.0, -999.000000, 2, 2, 20008.386566)); - args_list.push_back(GetSpecHeatArgs(16.0, 16.5, -999.000000, 2, 2, 20022.797049)); - args_list.push_back(GetSpecHeatArgs(16.5, 17.0, -999.000000, 2, 2, 20061.968804)); - args_list.push_back(GetSpecHeatArgs(17.0, 17.5, -999.000000, 2, 2, 20168.448675)); - args_list.push_back(GetSpecHeatArgs(17.5, 18.0, -999.000000, 2, 2, 20457.890972)); - args_list.push_back(GetSpecHeatArgs(18.0, 18.5, -999.000000, 2, 2, 21244.676709)); - args_list.push_back(GetSpecHeatArgs(18.5, 19.0, -999.000000, 2, -1, 23383.382081)); - args_list.push_back(GetSpecHeatArgs(19.0, 19.5, -999.000000, -1, -1, 29196.986029)); - args_list.push_back(GetSpecHeatArgs(19.5, 20.0, -999.000000, -1, -1, 35803.013971)); - args_list.push_back(GetSpecHeatArgs(20.0, 20.5, -999.000000, -1, -1, 34196.986029)); - args_list.push_back(GetSpecHeatArgs(20.5, 20.0, -999.000000, -1, 2, 20061.968804)); - args_list.push_back(GetSpecHeatArgs(20.0, 19.5, -999.000000, 2, 2, 20022.797049)); - args_list.push_back(GetSpecHeatArgs(19.5, 19.0, -999.000000, 2, 2, 20008.386566)); - args_list.push_back(GetSpecHeatArgs(19.0, 18.5, -999.000000, 2, 2, 20003.085245)); - args_list.push_back(GetSpecHeatArgs(18.5, 18.0, -999.000000, 2, 2, 20001.134998)); - args_list.push_back(GetSpecHeatArgs(18.0, 17.5, -999.000000, 2, 2, 20000.417543)); - args_list.push_back(GetSpecHeatArgs(17.5, 17.0, -999.000000, 2, 2, 20000.153605)); - args_list.push_back(GetSpecHeatArgs(17.0, 16.5, -999.000000, 2, 2, 20000.056508)); - args_list.push_back(GetSpecHeatArgs(16.5, 16.0, -999.000000, 2, 2, 20000.020788)); - args_list.push_back(GetSpecHeatArgs(16.0, 15.5, -999.000000, 2, 2, 20000.007648)); - args_list.push_back(GetSpecHeatArgs(15.5, 15.0, -999.000000, 2, 2, 20000.002813)); - args_list.push_back(GetSpecHeatArgs(15.0, 14.5, -999.000000, 2, 2, 20000.001035)); - args_list.push_back(GetSpecHeatArgs(14.5, 14.0, -999.000000, 2, 2, 20000.000381)); - args_list.push_back(GetSpecHeatArgs(14.0, 13.5, -999.000000, 2, 2, 20000.000140)); + args_list.push_back(GetSpecHeatArgs(14.0, 14.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.417543)); + args_list.push_back(GetSpecHeatArgs(14.5, 15.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20001.134998)); + args_list.push_back(GetSpecHeatArgs(15.0, 15.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20003.085245)); + args_list.push_back(GetSpecHeatArgs(15.5, 16.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20008.386566)); + args_list.push_back(GetSpecHeatArgs(16.0, 16.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20022.797049)); + args_list.push_back(GetSpecHeatArgs(16.5, 17.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20061.968804)); + args_list.push_back(GetSpecHeatArgs(17.0, 17.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20168.448675)); + args_list.push_back(GetSpecHeatArgs(17.5, 18.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20457.890972)); + args_list.push_back(GetSpecHeatArgs(18.0, 18.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 21244.676709)); + args_list.push_back(GetSpecHeatArgs(18.5, 19.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Melting, 23383.382081)); + args_list.push_back(GetSpecHeatArgs(19.0, 19.5, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 29196.986029)); + args_list.push_back(GetSpecHeatArgs(19.5, 20.0, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 35803.013971)); + args_list.push_back(GetSpecHeatArgs(20.0, 20.5, -999.000000, Material::Phase::Melting, Material::Phase::Melting, 34196.986029)); + args_list.push_back(GetSpecHeatArgs(20.5, 20.0, -999.000000, Material::Phase::Melting, Material::Phase::Crystallized, 20061.968804)); + args_list.push_back(GetSpecHeatArgs(20.0, 19.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20022.797049)); + args_list.push_back(GetSpecHeatArgs(19.5, 19.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20008.386566)); + args_list.push_back(GetSpecHeatArgs(19.0, 18.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20003.085245)); + args_list.push_back(GetSpecHeatArgs(18.5, 18.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20001.134998)); + args_list.push_back(GetSpecHeatArgs(18.0, 17.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.417543)); + args_list.push_back(GetSpecHeatArgs(17.5, 17.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.153605)); + args_list.push_back(GetSpecHeatArgs(17.0, 16.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.056508)); + args_list.push_back(GetSpecHeatArgs(16.5, 16.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.020788)); + args_list.push_back(GetSpecHeatArgs(16.0, 15.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.007648)); + args_list.push_back(GetSpecHeatArgs(15.5, 15.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.002813)); + args_list.push_back(GetSpecHeatArgs(15.0, 14.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.001035)); + args_list.push_back(GetSpecHeatArgs(14.5, 14.0, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.000381)); + args_list.push_back(GetSpecHeatArgs(14.0, 13.5, -999.000000, Material::Phase::Crystallized, Material::Phase::Crystallized, 20000.000140)); for (auto &cp_call : args_list) { - int calculated_pcm_state = -99; + Material::Phase calculated_pcm_state = Material::Phase::Invalid; Real64 calculated_cp = this->ModelA.getCurrentSpecificHeat(cp_call.previousTemperature, cp_call.updatedTemperature, cp_call.temperatureReverse, diff --git a/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc b/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc index 585f60d3cdb..2967f4ca730 100644 --- a/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc +++ b/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc @@ -1921,11 +1921,11 @@ TEST_F(EnergyPlusFixture, PipingSystem_SiteGroundDomainUsingNoMassMatTest) int MaterialIndex; Material::MaterialBase *p = new Material::MaterialBase; - state->dataMaterial->Material.push_back(p); + state->dataMaterial->materials.push_back(p); // Test 1: Material has a valid thickness and is not R-only, result should be false MaterialIndex = 1; - auto *thisMaterial = state->dataMaterial->Material(MaterialIndex); + auto *thisMaterial = state->dataMaterial->materials(MaterialIndex); thisMaterial->ROnly = false; Thickness = 0.01; ExpectedResult = false; diff --git a/tst/EnergyPlus/unit/SQLite.unit.cc b/tst/EnergyPlus/unit/SQLite.unit.cc index 92229c26516..aba5b3a41a2 100644 --- a/tst/EnergyPlus/unit/SQLite.unit.cc +++ b/tst/EnergyPlus/unit/SQLite.unit.cc @@ -677,21 +677,21 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) zoneGroupData1->ZoneList = 2; zoneGroupData1->Multiplier = 99; - auto const materialData0 = std::make_unique(); + auto const materialData0 = std::make_unique(); materialData0->Name = "test material 1"; - materialData0->group = Material::Group::Air; - auto const materialData1 = std::make_unique(); + materialData0->group = Material::Group::AirGap; + auto const materialData1 = std::make_unique(); materialData1->Name = "test material 2"; materialData1->group = Material::Group::Shade; materialData1->Roughness = Material::SurfaceRoughness::Rough; // 1 materialData1->Conductivity = 2; materialData1->Density = 2; - materialData1->IsoMoistCap = 2; + // materialData1->IsoMoistCap = 2; materialData1->Porosity = 2; materialData1->Resistance = 2; materialData1->ROnly = true; materialData1->SpecHeat = 2; - materialData1->ThermGradCoef = 2; + // materialData1->ThermGradCoef = 2; materialData1->Thickness = 2; materialData1->VaporDiffus = 2; @@ -983,7 +983,7 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) ASSERT_EQ(2ul, materials.size()); std::vector material0{"1", "test material 1", "1", "-1", "0.0", "0.0", "0.0", "0.0", "0.0", "0", "0.0", "0.0", "0.0", "0.0"}; - std::vector material1{"2", "test material 2", "2", "1", "2.0", "2.0", "2.0", "2.0", "2.0", "1", "2.0", "2.0", "2.0", "2.0"}; + std::vector material1{"2", "test material 2", "2", "1", "2.0", "2.0", "0.0", "2.0", "2.0", "1", "2.0", "0.0", "2.0", "2.0"}; EXPECT_EQ(material0, materials[0]); EXPECT_EQ(material1, materials[1]); diff --git a/tst/EnergyPlus/unit/SizingManager.unit.cc b/tst/EnergyPlus/unit/SizingManager.unit.cc index 356ac07dfef..3c85f995a1c 100644 --- a/tst/EnergyPlus/unit/SizingManager.unit.cc +++ b/tst/EnergyPlus/unit/SizingManager.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -558,3 +559,3742 @@ TEST_F(EnergyPlusFixture, SizingManager_OverrideAvgWindowInSizing) EXPECT_EQ(state->dataGlobal->NumOfTimeStepInHour, 1); EXPECT_EQ(state->dataSize->NumTimeStepsInAvg, 1); } +TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_1x) +{ + std::string const idf_objects = delimited_string({ + " Timestep,6;", + + " Site:Location,", + " CHICAGO_IL_USA TMY2-94846, !- Name", + " 41.78, !- Latitude {deg}", + " -87.75, !- Longitude {deg}", + " -6.00, !- Time Zone {hr}", + " 190.00; !- Elevation {m}", + + " SimulationControl,", + " Yes, !- Do Zone Sizing Calculation", + " No, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " No, !- Run Simulation for Sizing Periods", + " No; !- Run Simulation for Weather File Run Periods", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Heating 99% Design Conditions DB, !- Name", + " 1, !- Month", + " 21, !- Day of Month", + " WinterDesignDay, !- Day Type", + " -17.3, !- Maximum Dry-Bulb Temperature {C}", + " 0.0, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " -17.3, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 4.9, !- Wind Speed {m/s}", + " 270, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless}", + " 0.0; !- Sky Clearness", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Cooling 1% Design Conditions DB/MCWB, !- Name", + " 7, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " ZoneControl:Thermostat,", + " Zone 1 Thermostat, !- Name", + " Zone 1, !- Zone or ZoneList Name", + " Zone Control Type Sched, !- Control Type Schedule Name", + " ThermostatSetpoint:DualSetpoint, !- Control 1 Object Type", + " Dual Setpoint with SB; !- Control 1 Name", + + " Schedule:Compact,", + " ZONE CONTROL TYPE SCHED, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,4; !- Field 11", + + " ThermostatSetpoint:DualSetpoint,", + " Dual Setpoint with SB,!- Name", + " Heating Setpoints, !- Setpoint Temperature Schedule Name", + " Cooling Setpoints; !- Setpoint Temperature Schedule Name", + + " Schedule:Compact,", + " HEATING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,15.00, !- Field 3", + " Until: 17:00,20.00, !- Field 5", + " Until: 24:00,15.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,15.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,20.00; !- Field 13", + + " Schedule:Compact,", + " COOLING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,30.00, !- Field 3", + " Until: 17:00,24.00, !- Field 5", + " Until: 24:00,30.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,24.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,50.00; !- Field 13", + + " Sizing:Zone,", + " Zone 1, !- Zone or ZoneList Name", + " SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method", + " 12., !- Zone Cooling Design Supply Air Temperature {C}", + " , !- Zone Cooling Design Supply Air Temperature Difference {deltaC}", + " SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method", + " 50., !- Zone Heating Design Supply Air Temperature {C}", + " , !- Zone Heating Design Supply Air Temperature Difference {deltaC}", + " 0.008, !- Zone Cooling Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.008, !- Zone Heating Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " SZ DSOA West Zone, !- Design Specification Outdoor Air Object Name", + " 1.0, !- Zone Heating Sizing Factor", + " 1.0, !- Zone Cooling Sizing Factor", + " DesignDay, !- Cooling Design Air Flow Method", + " 0, !- Cooling Design Air Flow Rate {m3/s}", + " , !- Cooling Minimum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Cooling Minimum Air Flow {m3/s}", + " , !- Cooling Minimum Air Flow Fraction", + " DesignDay, !- Heating Design Air Flow Method", + " 0, !- Heating Design Air Flow Rate {m3/s}", + " , !- Heating Maximum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Heating Maximum Air Flow {m3/s}", + " , !- Heating Maximum Air Flow Fraction", + " , !- Design Specification Zone Air Distribution Object Name", + " No, !- Account for Dedicated Outdoor Air System", + " NeutralSupplyAir, !- Dedicated Outdoor Air System Control Strategy", + " autosize, !- Dedicated Outdoor Air Low Setpoint Temperature for Design {C}", + " autosize, !- Dedicated Outdoor Air High Setpoint Temperature for Design {C}", + " , !- Zone Load Sizing Method", + " , !- Zone Latent Cooling Design Supply Air Humidity Ratio Input Method", + " , !- Zone Dehumidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " , !- Zone Cooling Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Latent Heating Design Supply Air Humidity Ratio Input Method", + " , !- Zone Humidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " , !- Zone Humidification Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Humidistat Dehumidification Set Point Schedule Name {percent}", + " , !- Zone Humidistat Humidification Set Point Schedule Name {percent}", + " Coincident; !- Type of Space Sum to Use", + + " DesignSpecification:OutdoorAir,", + " SZ DSOA West Zone, !- Name", + " flow/person, !- Outdoor Air Method", + " 0.00944, !- Outdoor Air Flow per Person {m3/s-person}", + " 0.0, !- Outdoor Air Flow per Zone Floor Area {m3/s-m2}", + " 0.0; !- Outdoor Air Flow per Zone {m3/s}", + + " Zone,", + " Zone 1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " 3.048, !- Ceiling Height {m}", + " 40.; !- Volume {m3}", + + " BuildingSurface:Detailed,", + " Zn001:Wall001, !- Name", + " Wall, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,3.048000, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 6.096000,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 6.096000,0,3.048000; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor001, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor002, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 2, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor003, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 3, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " C4 - 4 IN COMMON BRICK, !- Name", + " Rough, !- Roughness", + " 0.1014984, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1922.216, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7600000, !- Solar Absorptance", + " 0.7600000; !- Visible Absorptance", + + " Material,", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD, !- Name", + " Smooth, !- Roughness", + " 1.9050000E-02, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1601.846, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Construction,", + " EXTWALL80, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " C4 - 4 IN COMMON BRICK, !- Layer 2", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD; !- Layer 3", + + " ZoneHVAC:EquipmentConnections,", + " Zone 1, !- Zone Name", + " ZONE 1 EQUIPMENT, !- Zone Conditioning Equipment List Name", + " ZONE 1 INLETS, !- Zone Air Inlet Node or NodeList Name", + " , !- Zone Air Exhaust Node or NodeList Name", + " ZONE 1 NODE, !- Zone Air Node Name", + " ZONE 1 OUTLET; !- Zone Return Air Node or NodeList Name", + + " ZoneHVAC:EquipmentList,", + " ZONE 1 EQUIPMENT, !- Name", + " SequentialLoad, !- Load Distribution Scheme", + " ZoneHVAC:IdealLoadsAirSystem, !- Zone Equipment 1 Object Type", + " ZONE 1 Ideal Loads, !- Zone Equipment 1 Name", + " 1, !- Zone Equipment 1 Cooling Sequence", + " 1, !- Zone Equipment 1 Heating or No-Load Sequence", + " , !- Zone Equipment 1 Sequential Cooling Load Fraction", + " ; !- Zone Equipment 1 Sequential Heating Load Fraction", + + " ZoneHVAC:IdealLoadsAirSystem,", + " ZONE 1 Ideal Loads, !- Name", + " , !- Availability Schedule Name", + " ZONE 1 INLETS, !- Zone Supply Air Node Name", + " , !- Zone Exhaust Air Node Name", + " , !- System Inlet Air Node Name", + " 50, !- Maximum Heating Supply Air Temperature {C}", + " 13, !- Minimum Cooling Supply Air Temperature {C}", + " 0.015, !- Maximum Heating Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.009, !- Minimum Cooling Supply Air Humidity Ratio {kgWater/kgDryAir}", + " NoLimit, !- Heating Limit", + " autosize, !- Maximum Heating Air Flow Rate {m3/s}", + " , !- Maximum Sensible Heating Capacity {W}", + " NoLimit, !- Cooling Limit", + " autosize, !- Maximum Cooling Air Flow Rate {m3/s}", + " , !- Maximum Total Cooling Capacity {W}", + " , !- Heating Availability Schedule Name", + " , !- Cooling Availability Schedule Name", + " ConstantSupplyHumidityRatio, !- Dehumidification Control Type", + " , !- Cooling Sensible Heat Ratio {dimensionless}", + " ConstantSupplyHumidityRatio, !- Humidification Control Type", + " , !- Design Specification Outdoor Air Object Name", + " , !- Outdoor Air Inlet Node Name", + " , !- Demand Controlled Ventilation Type", + " , !- Outdoor Air Economizer Type", + " , !- Heat Recovery Type", + " , !- Sensible Heat Recovery Effectiveness {dimensionless}", + " ; !- Latent Heat Recovery Effectiveness {dimensionless}", + + " NodeList,", + " ZONE 1 INLETS, !- Name", + " ZONE 1 INLET; !- Node 1 Name", + "Space,", + "Space 1, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 2, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 3, !- Name", + "Zone 1; !- Zone Name", + + " ElectricEquipment,", + " Space 1 ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 500.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Morning, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 8:00,0.0, !- Field 11", + " Until: 12:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 2 ElecEq, !- Name", + " Space 2, !- Zone or ZoneList Name", + " Afternoon, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Afternoon, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 12:00,0.0, !- Field 11", + " Until: 16:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 3 ElecEq, !- Name", + " Space 3, !- Zone or ZoneList Name", + " Evening, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 750.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Evening, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 16:00,0.0, !- Field 11", + " Until: 20:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + "ZoneAirHeatBalanceAlgorithm,", + "ThirdOrderBackwardDifference, !- Algorithm", + "Yes, !- Do Space Heat Balance for Sizing", + "No; !- Do Space Heat Balance for Simulation", + " Output:Table:SummaryReports,", + " AllSummary; !- Report Name 1", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + SimulationManager::ManageSimulation(*state); + + EXPECT_EQ("1898.77", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.053", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.053", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 1")); + EXPECT_EQ("832.44", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.058", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.058", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 1")); + EXPECT_EQ("7/21 17:30:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 1")); + + EXPECT_EQ("631.20", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.018", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.018", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 2")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 2")); + EXPECT_EQ("940.20", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.065", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.065", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 2")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 2")); + + EXPECT_EQ("631.20", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.018", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.018", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 3")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 3")); + EXPECT_EQ("810.65", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.056", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.056", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 3")); + EXPECT_EQ("7/21 19:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 3")); + + // For coincident, expect zone Des Cooling Load to be less than sum of space loads which is 832.44 + 940.2 + 810.65 = 2583.29 + EXPECT_EQ("3155.31", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.088", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.088", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtDesDay, "ZONE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtPkTime, "ZONE 1")); + EXPECT_EQ("1942.36", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.135", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.135", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1")); +} +TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_10x) +{ + std::string const idf_objects = delimited_string({ + " Timestep,6;", + + " Site:Location,", + " CHICAGO_IL_USA TMY2-94846, !- Name", + " 41.78, !- Latitude {deg}", + " -87.75, !- Longitude {deg}", + " -6.00, !- Time Zone {hr}", + " 190.00; !- Elevation {m}", + + " SimulationControl,", + " Yes, !- Do Zone Sizing Calculation", + " No, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " No, !- Run Simulation for Sizing Periods", + " No; !- Run Simulation for Weather File Run Periods", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Heating 99% Design Conditions DB, !- Name", + " 1, !- Month", + " 21, !- Day of Month", + " WinterDesignDay, !- Day Type", + " -17.3, !- Maximum Dry-Bulb Temperature {C}", + " 0.0, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " -17.3, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 4.9, !- Wind Speed {m/s}", + " 270, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless}", + " 0.0; !- Sky Clearness", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Cooling 1% Design Conditions DB/MCWB, !- Name", + " 7, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " ZoneControl:Thermostat,", + " Zone 1 Thermostat, !- Name", + " Zone 1, !- Zone or ZoneList Name", + " Zone Control Type Sched, !- Control Type Schedule Name", + " ThermostatSetpoint:DualSetpoint, !- Control 1 Object Type", + " Dual Setpoint with SB; !- Control 1 Name", + + " Schedule:Compact,", + " ZONE CONTROL TYPE SCHED, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,4; !- Field 11", + + " ThermostatSetpoint:DualSetpoint,", + " Dual Setpoint with SB,!- Name", + " Heating Setpoints, !- Setpoint Temperature Schedule Name", + " Cooling Setpoints; !- Setpoint Temperature Schedule Name", + + " Schedule:Compact,", + " HEATING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,15.00, !- Field 3", + " Until: 17:00,20.00, !- Field 5", + " Until: 24:00,15.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,15.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,20.00; !- Field 13", + + " Schedule:Compact,", + " COOLING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,30.00, !- Field 3", + " Until: 17:00,24.00, !- Field 5", + " Until: 24:00,30.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,24.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,50.00; !- Field 13", + + " Sizing:Zone,", + " Zone 1, !- Zone or ZoneList Name", + " SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method", + " 12., !- Zone Cooling Design Supply Air Temperature {C}", + " , !- Zone Cooling Design Supply Air Temperature Difference {deltaC}", + " SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method", + " 50., !- Zone Heating Design Supply Air Temperature {C}", + " , !- Zone Heating Design Supply Air Temperature Difference {deltaC}", + " 0.008, !- Zone Cooling Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.008, !- Zone Heating Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " SZ DSOA West Zone, !- Design Specification Outdoor Air Object Name", + " 1.0, !- Zone Heating Sizing Factor", + " 1.0, !- Zone Cooling Sizing Factor", + " DesignDay, !- Cooling Design Air Flow Method", + " 0, !- Cooling Design Air Flow Rate {m3/s}", + " , !- Cooling Minimum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Cooling Minimum Air Flow {m3/s}", + " , !- Cooling Minimum Air Flow Fraction", + " DesignDay, !- Heating Design Air Flow Method", + " 0, !- Heating Design Air Flow Rate {m3/s}", + " , !- Heating Maximum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Heating Maximum Air Flow {m3/s}", + " , !- Heating Maximum Air Flow Fraction", + " , !- Design Specification Zone Air Distribution Object Name", + " No, !- Account for Dedicated Outdoor Air System", + " NeutralSupplyAir, !- Dedicated Outdoor Air System Control Strategy", + " autosize, !- Dedicated Outdoor Air Low Setpoint Temperature for Design {C}", + " autosize, !- Dedicated Outdoor Air High Setpoint Temperature for Design {C}", + " , !- Zone Load Sizing Method", + " , !- Zone Latent Cooling Design Supply Air Humidity Ratio Input Method", + " , !- Zone Dehumidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " , !- Zone Cooling Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Latent Heating Design Supply Air Humidity Ratio Input Method", + " , !- Zone Humidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " , !- Zone Humidification Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Humidistat Dehumidification Set Point Schedule Name {percent}", + " , !- Zone Humidistat Humidification Set Point Schedule Name {percent}", + " Coincident; !- Type of Space Sum to Use", + + " DesignSpecification:OutdoorAir,", + " SZ DSOA West Zone, !- Name", + " flow/person, !- Outdoor Air Method", + " 0.00944, !- Outdoor Air Flow per Person {m3/s-person}", + " 0.0, !- Outdoor Air Flow per Zone Floor Area {m3/s-m2}", + " 0.0; !- Outdoor Air Flow per Zone {m3/s}", + + " Zone,", + " Zone 1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 10, !- Multiplier", + " 3.048, !- Ceiling Height {m}", + " 40.; !- Volume {m3}", + + " BuildingSurface:Detailed,", + " Zn001:Wall001, !- Name", + " Wall, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,3.048000, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 6.096000,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 6.096000,0,3.048000; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor001, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor002, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 2, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor003, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 3, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " C4 - 4 IN COMMON BRICK, !- Name", + " Rough, !- Roughness", + " 0.1014984, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1922.216, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7600000, !- Solar Absorptance", + " 0.7600000; !- Visible Absorptance", + + " Material,", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD, !- Name", + " Smooth, !- Roughness", + " 1.9050000E-02, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1601.846, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Construction,", + " EXTWALL80, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " C4 - 4 IN COMMON BRICK, !- Layer 2", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD; !- Layer 3", + + " ZoneHVAC:EquipmentConnections,", + " Zone 1, !- Zone Name", + " ZONE 1 EQUIPMENT, !- Zone Conditioning Equipment List Name", + " ZONE 1 INLETS, !- Zone Air Inlet Node or NodeList Name", + " , !- Zone Air Exhaust Node or NodeList Name", + " ZONE 1 NODE, !- Zone Air Node Name", + " ZONE 1 OUTLET; !- Zone Return Air Node or NodeList Name", + + " ZoneHVAC:EquipmentList,", + " ZONE 1 EQUIPMENT, !- Name", + " SequentialLoad, !- Load Distribution Scheme", + " ZoneHVAC:IdealLoadsAirSystem, !- Zone Equipment 1 Object Type", + " ZONE 1 Ideal Loads, !- Zone Equipment 1 Name", + " 1, !- Zone Equipment 1 Cooling Sequence", + " 1, !- Zone Equipment 1 Heating or No-Load Sequence", + " , !- Zone Equipment 1 Sequential Cooling Load Fraction", + " ; !- Zone Equipment 1 Sequential Heating Load Fraction", + + " ZoneHVAC:IdealLoadsAirSystem,", + " ZONE 1 Ideal Loads, !- Name", + " , !- Availability Schedule Name", + " ZONE 1 INLETS, !- Zone Supply Air Node Name", + " , !- Zone Exhaust Air Node Name", + " , !- System Inlet Air Node Name", + " 50, !- Maximum Heating Supply Air Temperature {C}", + " 13, !- Minimum Cooling Supply Air Temperature {C}", + " 0.015, !- Maximum Heating Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.009, !- Minimum Cooling Supply Air Humidity Ratio {kgWater/kgDryAir}", + " NoLimit, !- Heating Limit", + " autosize, !- Maximum Heating Air Flow Rate {m3/s}", + " , !- Maximum Sensible Heating Capacity {W}", + " NoLimit, !- Cooling Limit", + " autosize, !- Maximum Cooling Air Flow Rate {m3/s}", + " , !- Maximum Total Cooling Capacity {W}", + " , !- Heating Availability Schedule Name", + " , !- Cooling Availability Schedule Name", + " ConstantSupplyHumidityRatio, !- Dehumidification Control Type", + " , !- Cooling Sensible Heat Ratio {dimensionless}", + " ConstantSupplyHumidityRatio, !- Humidification Control Type", + " , !- Design Specification Outdoor Air Object Name", + " , !- Outdoor Air Inlet Node Name", + " , !- Demand Controlled Ventilation Type", + " , !- Outdoor Air Economizer Type", + " , !- Heat Recovery Type", + " , !- Sensible Heat Recovery Effectiveness {dimensionless}", + " ; !- Latent Heat Recovery Effectiveness {dimensionless}", + + " NodeList,", + " ZONE 1 INLETS, !- Name", + " ZONE 1 INLET; !- Node 1 Name", + "Space,", + "Space 1, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 2, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 3, !- Name", + "Zone 1; !- Zone Name", + + " ElectricEquipment,", + " Space 1 ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 500.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Morning, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 8:00,0.0, !- Field 11", + " Until: 12:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 2 ElecEq, !- Name", + " Space 2, !- Zone or ZoneList Name", + " Afternoon, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Afternoon, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 12:00,0.0, !- Field 11", + " Until: 16:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 3 ElecEq, !- Name", + " Space 3, !- Zone or ZoneList Name", + " Evening, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 750.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Evening, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 16:00,0.0, !- Field 11", + " Until: 20:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + "ZoneAirHeatBalanceAlgorithm,", + "ThirdOrderBackwardDifference, !- Algorithm", + "Yes, !- Do Space Heat Balance for Sizing", + "No; !- Do Space Heat Balance for Simulation", + " Output:Table:SummaryReports,", + " AllSummary; !- Report Name 1", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + SimulationManager::ManageSimulation(*state); + + EXPECT_EQ("18987.69", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.527", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.527", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 1")); + EXPECT_EQ("8324.40", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.578", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.578", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 1")); + EXPECT_EQ("7/21 17:30:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 1")); + + EXPECT_EQ("6311.95", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 2")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 2")); + EXPECT_EQ("9402.01", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.653", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.653", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 2")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 2")); + + EXPECT_EQ("6311.95", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 3")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 3")); + EXPECT_EQ("8106.47", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.563", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.563", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 3")); + EXPECT_EQ("7/21 19:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 3")); + + // For coincident, expect zone Des Cooling Load to be less than sum of space loads which is 832.44 + 940.2 + 810.65 = 2583.29 + EXPECT_EQ("31553.14", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.876", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.876", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtDesDay, "ZONE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtPkTime, "ZONE 1")); + EXPECT_EQ("19423.64", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesLd, "ZONE 1")); + EXPECT_EQ("1.348", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("1.348", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1")); +} +TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_NonCoincident1) +{ + // Spaces peak on same day + std::string const idf_objects = delimited_string({ + " Timestep,6;", + + " Site:Location,", + " CHICAGO_IL_USA TMY2-94846, !- Name", + " 41.78, !- Latitude {deg}", + " -87.75, !- Longitude {deg}", + " -6.00, !- Time Zone {hr}", + " 190.00; !- Elevation {m}", + + " SimulationControl,", + " Yes, !- Do Zone Sizing Calculation", + " No, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " No, !- Run Simulation for Sizing Periods", + " No; !- Run Simulation for Weather File Run Periods", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Cooling 1% Design Conditions DB/MCWB, !- Name", + " 7, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " ZoneControl:Thermostat,", + " Zone 1 Thermostat, !- Name", + " Zone 1, !- Zone or ZoneList Name", + " Zone Control Type Sched, !- Control Type Schedule Name", + " ThermostatSetpoint:DualSetpoint, !- Control 1 Object Type", + " Dual Setpoint with SB; !- Control 1 Name", + + " Schedule:Compact,", + " ZONE CONTROL TYPE SCHED, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,4; !- Field 11", + + " ThermostatSetpoint:DualSetpoint,", + " Dual Setpoint with SB,!- Name", + " Heating Setpoints, !- Setpoint Temperature Schedule Name", + " Cooling Setpoints; !- Setpoint Temperature Schedule Name", + + " Schedule:Compact,", + " HEATING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,15.00, !- Field 3", + " Until: 17:00,20.00, !- Field 5", + " Until: 24:00,15.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,15.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,20.00; !- Field 13", + + " Schedule:Compact,", + " COOLING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,30.00, !- Field 3", + " Until: 17:00,24.00, !- Field 5", + " Until: 24:00,30.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,24.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,50.00; !- Field 13", + + " Sizing:Zone,", + " Zone 1, !- Zone or ZoneList Name", + " SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method", + " 12., !- Zone Cooling Design Supply Air Temperature {C}", + " , !- Zone Cooling Design Supply Air Temperature Difference {deltaC}", + " SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method", + " 50., !- Zone Heating Design Supply Air Temperature {C}", + " , !- Zone Heating Design Supply Air Temperature Difference {deltaC}", + " 0.008, !- Zone Cooling Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.008, !- Zone Heating Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " SZ DSOA West Zone, !- Design Specification Outdoor Air Object Name", + " 1.0, !- Zone Heating Sizing Factor", + " 1.0, !- Zone Cooling Sizing Factor", + " DesignDay, !- Cooling Design Air Flow Method", + " 0, !- Cooling Design Air Flow Rate {m3/s}", + " , !- Cooling Minimum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Cooling Minimum Air Flow {m3/s}", + " , !- Cooling Minimum Air Flow Fraction", + " DesignDay, !- Heating Design Air Flow Method", + " 0, !- Heating Design Air Flow Rate {m3/s}", + " , !- Heating Maximum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Heating Maximum Air Flow {m3/s}", + " , !- Heating Maximum Air Flow Fraction", + " , !- Design Specification Zone Air Distribution Object Name", + " No, !- Account for Dedicated Outdoor Air System", + " NeutralSupplyAir, !- Dedicated Outdoor Air System Control Strategy", + " autosize, !- Dedicated Outdoor Air Low Setpoint Temperature for Design {C}", + " autosize, !- Dedicated Outdoor Air High Setpoint Temperature for Design {C}", + " , !- Zone Load Sizing Method", + " , !- Zone Latent Cooling Design Supply Air Humidity Ratio Input Method", + " , !- Zone Dehumidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " , !- Zone Cooling Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Latent Heating Design Supply Air Humidity Ratio Input Method", + " , !- Zone Humidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " , !- Zone Humidification Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Humidistat Dehumidification Set Point Schedule Name {percent}", + " , !- Zone Humidistat Humidification Set Point Schedule Name {percent}", + " NonCoincident; !- Type of Space Sum to Use", + + " DesignSpecification:OutdoorAir,", + " SZ DSOA West Zone, !- Name", + " flow/person, !- Outdoor Air Method", + " 0.00944, !- Outdoor Air Flow per Person {m3/s-person}", + " 0.0, !- Outdoor Air Flow per Zone Floor Area {m3/s-m2}", + " 0.0; !- Outdoor Air Flow per Zone {m3/s}", + + " Zone,", + " Zone 1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 10, !- Multiplier", + " 3.048, !- Ceiling Height {m}", + " 40.; !- Volume {m3}", + + " BuildingSurface:Detailed,", + " Zn001:Wall001, !- Name", + " Wall, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,3.048000, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 6.096000,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 6.096000,0,3.048000; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor001, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor002, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 2, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor003, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 3, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " C4 - 4 IN COMMON BRICK, !- Name", + " Rough, !- Roughness", + " 0.1014984, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1922.216, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7600000, !- Solar Absorptance", + " 0.7600000; !- Visible Absorptance", + + " Material,", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD, !- Name", + " Smooth, !- Roughness", + " 1.9050000E-02, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1601.846, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Construction,", + " EXTWALL80, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " C4 - 4 IN COMMON BRICK, !- Layer 2", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD; !- Layer 3", + + " ZoneHVAC:EquipmentConnections,", + " Zone 1, !- Zone Name", + " ZONE 1 EQUIPMENT, !- Zone Conditioning Equipment List Name", + " ZONE 1 INLETS, !- Zone Air Inlet Node or NodeList Name", + " , !- Zone Air Exhaust Node or NodeList Name", + " ZONE 1 NODE, !- Zone Air Node Name", + " ZONE 1 OUTLET; !- Zone Return Air Node or NodeList Name", + + " ZoneHVAC:EquipmentList,", + " ZONE 1 EQUIPMENT, !- Name", + " SequentialLoad, !- Load Distribution Scheme", + " ZoneHVAC:IdealLoadsAirSystem, !- Zone Equipment 1 Object Type", + " ZONE 1 Ideal Loads, !- Zone Equipment 1 Name", + " 1, !- Zone Equipment 1 Cooling Sequence", + " 1, !- Zone Equipment 1 Heating or No-Load Sequence", + " , !- Zone Equipment 1 Sequential Cooling Load Fraction", + " ; !- Zone Equipment 1 Sequential Heating Load Fraction", + + " ZoneHVAC:IdealLoadsAirSystem,", + " ZONE 1 Ideal Loads, !- Name", + " , !- Availability Schedule Name", + " ZONE 1 INLETS, !- Zone Supply Air Node Name", + " , !- Zone Exhaust Air Node Name", + " , !- System Inlet Air Node Name", + " 50, !- Maximum Heating Supply Air Temperature {C}", + " 13, !- Minimum Cooling Supply Air Temperature {C}", + " 0.015, !- Maximum Heating Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.009, !- Minimum Cooling Supply Air Humidity Ratio {kgWater/kgDryAir}", + " NoLimit, !- Heating Limit", + " autosize, !- Maximum Heating Air Flow Rate {m3/s}", + " , !- Maximum Sensible Heating Capacity {W}", + " NoLimit, !- Cooling Limit", + " autosize, !- Maximum Cooling Air Flow Rate {m3/s}", + " , !- Maximum Total Cooling Capacity {W}", + " , !- Heating Availability Schedule Name", + " , !- Cooling Availability Schedule Name", + " ConstantSupplyHumidityRatio, !- Dehumidification Control Type", + " , !- Cooling Sensible Heat Ratio {dimensionless}", + " ConstantSupplyHumidityRatio, !- Humidification Control Type", + " , !- Design Specification Outdoor Air Object Name", + " , !- Outdoor Air Inlet Node Name", + " , !- Demand Controlled Ventilation Type", + " , !- Outdoor Air Economizer Type", + " , !- Heat Recovery Type", + " , !- Sensible Heat Recovery Effectiveness {dimensionless}", + " ; !- Latent Heat Recovery Effectiveness {dimensionless}", + + " NodeList,", + " ZONE 1 INLETS, !- Name", + " ZONE 1 INLET; !- Node 1 Name", + "Space,", + "Space 1, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 2, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 3, !- Name", + "Zone 1; !- Zone Name", + + " ElectricEquipment,", + " Space 1 ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 500.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Morning, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 8:00,0.0, !- Field 11", + " Until: 12:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 2 ElecEq, !- Name", + " Space 2, !- Zone or ZoneList Name", + " Afternoon, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Afternoon, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 12:00,0.0, !- Field 11", + " Until: 16:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 3 ElecEq, !- Name", + " Space 3, !- Zone or ZoneList Name", + " Evening, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 750.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Evening, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 16:00,0.0, !- Field 11", + " Until: 20:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + "ZoneAirHeatBalanceAlgorithm,", + "ThirdOrderBackwardDifference, !- Algorithm", + "Yes, !- Do Space Heat Balance for Sizing", + "No; !- Do Space Heat Balance for Simulation", + " Output:Table:SummaryReports,", + " AllSummary; !- Report Name 1", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + SimulationManager::ManageSimulation(*state); + + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 1")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 1")); + EXPECT_EQ("8324.40", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.578", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.578", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 1")); + EXPECT_EQ("7/21 17:30:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 1")); + + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 2")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 2")); + EXPECT_EQ("9402.01", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.653", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.653", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 2")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 2")); + + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 3")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 3")); + EXPECT_EQ("8106.47", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.563", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.563", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 3")); + EXPECT_EQ("7/21 19:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 3")); + + // For noncoincident, expect zone Des Cooling Load to be sum of space loads = 832.44 + 940.2 + 810.65 = 2583.29 + // For noncoincident, expect zone Des Cooling Air Flow to be sum of space flows = 0.058 + 0.065 + 0.056 = 0.179 + // Spaces peak on same day, so expect zone peak time to be the same as coincident sizing + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtDesDay, "ZONE 1")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtPkTime, "ZONE 1")); + EXPECT_EQ("25832.88", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesLd, "ZONE 1")); + EXPECT_EQ("1.793", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("1.793", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1")); +} +TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_NonCoincident2) +// Spaces peak on different days +{ + std::string const idf_objects = delimited_string({ + " Timestep,6;", + + " Site:Location,", + " CHICAGO_IL_USA TMY2-94846, !- Name", + " 41.78, !- Latitude {deg}", + " -87.75, !- Longitude {deg}", + " -6.00, !- Time Zone {hr}", + " 190.00; !- Elevation {m}", + + " SimulationControl,", + " Yes, !- Do Zone Sizing Calculation", + " No, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " No, !- Run Simulation for Sizing Periods", + " No; !- Run Simulation for Weather File Run Periods", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA July Cooling 1% Design Conditions DB/MCWB, !- Name", + " 7, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA August Cooling 1% Design Conditions DB/MCWB, !- Name", + " 8, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA September Cooling 1% Design Conditions DB/MCWB, !- Name", + " 9, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " ZoneControl:Thermostat,", + " Zone 1 Thermostat, !- Name", + " Zone 1, !- Zone or ZoneList Name", + " Zone Control Type Sched, !- Control Type Schedule Name", + " ThermostatSetpoint:DualSetpoint, !- Control 1 Object Type", + " Dual Setpoint with SB; !- Control 1 Name", + + " Schedule:Compact,", + " ZONE CONTROL TYPE SCHED, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,4; !- Field 11", + + " ThermostatSetpoint:DualSetpoint,", + " Dual Setpoint with SB,!- Name", + " Heating Setpoints, !- Setpoint Temperature Schedule Name", + " Cooling Setpoints; !- Setpoint Temperature Schedule Name", + + " Schedule:Compact,", + " HEATING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,15.00, !- Field 3", + " Until: 17:00,20.00, !- Field 5", + " Until: 24:00,15.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,15.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,20.00; !- Field 13", + + " Schedule:Compact,", + " COOLING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,30.00, !- Field 3", + " Until: 17:00,24.00, !- Field 5", + " Until: 24:00,30.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,24.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,50.00; !- Field 13", + + " Sizing:Zone,", + " Zone 1, !- Zone or ZoneList Name", + " SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method", + " 12., !- Zone Cooling Design Supply Air Temperature {C}", + " , !- Zone Cooling Design Supply Air Temperature Difference {deltaC}", + " SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method", + " 50., !- Zone Heating Design Supply Air Temperature {C}", + " , !- Zone Heating Design Supply Air Temperature Difference {deltaC}", + " 0.008, !- Zone Cooling Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.008, !- Zone Heating Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " SZ DSOA West Zone, !- Design Specification Outdoor Air Object Name", + " 1.0, !- Zone Heating Sizing Factor", + " 1.0, !- Zone Cooling Sizing Factor", + " DesignDay, !- Cooling Design Air Flow Method", + " 0, !- Cooling Design Air Flow Rate {m3/s}", + " , !- Cooling Minimum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Cooling Minimum Air Flow {m3/s}", + " , !- Cooling Minimum Air Flow Fraction", + " DesignDay, !- Heating Design Air Flow Method", + " 0, !- Heating Design Air Flow Rate {m3/s}", + " , !- Heating Maximum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Heating Maximum Air Flow {m3/s}", + " , !- Heating Maximum Air Flow Fraction", + " , !- Design Specification Zone Air Distribution Object Name", + " No, !- Account for Dedicated Outdoor Air System", + " NeutralSupplyAir, !- Dedicated Outdoor Air System Control Strategy", + " autosize, !- Dedicated Outdoor Air Low Setpoint Temperature for Design {C}", + " autosize, !- Dedicated Outdoor Air High Setpoint Temperature for Design {C}", + " , !- Zone Load Sizing Method", + " , !- Zone Latent Cooling Design Supply Air Humidity Ratio Input Method", + " , !- Zone Dehumidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " , !- Zone Cooling Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Latent Heating Design Supply Air Humidity Ratio Input Method", + " , !- Zone Humidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " , !- Zone Humidification Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Humidistat Dehumidification Set Point Schedule Name {percent}", + " , !- Zone Humidistat Humidification Set Point Schedule Name {percent}", + " NonCoincident; !- Type of Space Sum to Use", + + " DesignSpecification:OutdoorAir,", + " SZ DSOA West Zone, !- Name", + " flow/person, !- Outdoor Air Method", + " 0.00944, !- Outdoor Air Flow per Person {m3/s-person}", + " 0.0, !- Outdoor Air Flow per Zone Floor Area {m3/s-m2}", + " 0.0; !- Outdoor Air Flow per Zone {m3/s}", + + " Zone,", + " Zone 1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 10, !- Multiplier", + " 3.048, !- Ceiling Height {m}", + " 40.; !- Volume {m3}", + + " BuildingSurface:Detailed,", + " Zn001:Wall001, !- Name", + " Wall, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,3.048000, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 6.096000,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 6.096000,0,3.048000; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor001, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor002, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 2, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor003, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 3, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " C4 - 4 IN COMMON BRICK, !- Name", + " Rough, !- Roughness", + " 0.1014984, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1922.216, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7600000, !- Solar Absorptance", + " 0.7600000; !- Visible Absorptance", + + " Material,", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD, !- Name", + " Smooth, !- Roughness", + " 1.9050000E-02, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1601.846, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Construction,", + " EXTWALL80, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " C4 - 4 IN COMMON BRICK, !- Layer 2", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD; !- Layer 3", + + " ZoneHVAC:EquipmentConnections,", + " Zone 1, !- Zone Name", + " ZONE 1 EQUIPMENT, !- Zone Conditioning Equipment List Name", + " ZONE 1 INLETS, !- Zone Air Inlet Node or NodeList Name", + " , !- Zone Air Exhaust Node or NodeList Name", + " ZONE 1 NODE, !- Zone Air Node Name", + " ZONE 1 OUTLET; !- Zone Return Air Node or NodeList Name", + + " ZoneHVAC:EquipmentList,", + " ZONE 1 EQUIPMENT, !- Name", + " SequentialLoad, !- Load Distribution Scheme", + " ZoneHVAC:IdealLoadsAirSystem, !- Zone Equipment 1 Object Type", + " ZONE 1 Ideal Loads, !- Zone Equipment 1 Name", + " 1, !- Zone Equipment 1 Cooling Sequence", + " 1, !- Zone Equipment 1 Heating or No-Load Sequence", + " , !- Zone Equipment 1 Sequential Cooling Load Fraction", + " ; !- Zone Equipment 1 Sequential Heating Load Fraction", + + " ZoneHVAC:IdealLoadsAirSystem,", + " ZONE 1 Ideal Loads, !- Name", + " , !- Availability Schedule Name", + " ZONE 1 INLETS, !- Zone Supply Air Node Name", + " , !- Zone Exhaust Air Node Name", + " , !- System Inlet Air Node Name", + " 50, !- Maximum Heating Supply Air Temperature {C}", + " 13, !- Minimum Cooling Supply Air Temperature {C}", + " 0.015, !- Maximum Heating Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.009, !- Minimum Cooling Supply Air Humidity Ratio {kgWater/kgDryAir}", + " NoLimit, !- Heating Limit", + " autosize, !- Maximum Heating Air Flow Rate {m3/s}", + " , !- Maximum Sensible Heating Capacity {W}", + " NoLimit, !- Cooling Limit", + " autosize, !- Maximum Cooling Air Flow Rate {m3/s}", + " , !- Maximum Total Cooling Capacity {W}", + " , !- Heating Availability Schedule Name", + " , !- Cooling Availability Schedule Name", + " ConstantSupplyHumidityRatio, !- Dehumidification Control Type", + " , !- Cooling Sensible Heat Ratio {dimensionless}", + " ConstantSupplyHumidityRatio, !- Humidification Control Type", + " , !- Design Specification Outdoor Air Object Name", + " , !- Outdoor Air Inlet Node Name", + " , !- Demand Controlled Ventilation Type", + " , !- Outdoor Air Economizer Type", + " , !- Heat Recovery Type", + " , !- Sensible Heat Recovery Effectiveness {dimensionless}", + " ; !- Latent Heat Recovery Effectiveness {dimensionless}", + + " NodeList,", + " ZONE 1 INLETS, !- Name", + " ZONE 1 INLET; !- Node 1 Name", + "Space,", + "Space 1, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 2, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 3, !- Name", + "Zone 1; !- Zone Name", + + " ElectricEquipment,", + " Space 1 ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " July Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 5000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " July Morning, !- Name", + " , !- Schedule Type Limits Name", + " Through: 6/30, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,0.0, !- Field 11", + " Through: 7/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 8:00,0.0, !- Field 11", + " Until: 12:00,1.0, !- Field 11", + " Until: 24:00,0.0, !- Field 11", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 2 ElecEq, !- Name", + " Space 2, !- Zone or ZoneList Name", + " August Afternoon, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 10000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " August Afternoon, !- Name", + " , !- Schedule Type Limits Name", + " Through: 7/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,0.0, !- Field 11", + " Through: 8/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 12:00,0.0, !- Field 11", + " Until: 16:00,1.0, !- Field 11", + " Until: 24:00,0.0, !- Field 11", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 3 ElecEq, !- Name", + " Space 3, !- Zone or ZoneList Name", + " September Evening, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 7500.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " September Evening, !- Name", + " , !- Schedule Type Limits Name", + " Through: 8/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,0.0, !- Field 11", + " Through: 9/30, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 16:00,0.0, !- Field 11", + " Until: 20:00,1.0, !- Field 11", + " Until: 24:00,0.0, !- Field 11", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,0.0; !- Field 11", + + "ZoneAirHeatBalanceAlgorithm,", + "ThirdOrderBackwardDifference, !- Algorithm", + "Yes, !- Do Space Heat Balance for Sizing", + "No; !- Do Space Heat Balance for Simulation", + " Output:Table:SummaryReports,", + " AllSummary; !- Report Name 1", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + SimulationManager::ManageSimulation(*state); + + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 1")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 1")); + EXPECT_EQ("41650.19", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 1")); + EXPECT_EQ("2.891", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("2.891", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA JULY COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 1")); + EXPECT_EQ("7/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 1")); + + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 2")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 2")); + EXPECT_EQ("77258.02", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 2")); + EXPECT_EQ("5.362", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("5.362", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA AUGUST COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 2")); + EXPECT_EQ("8/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 2")); + + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 3")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 3")); + EXPECT_EQ("58268.65", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 3")); + EXPECT_EQ("4.044", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("4.044", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA SEPTEMBER COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 3")); + EXPECT_EQ("9/21 20:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 3")); + + // For noncoincident, expect zone Des Cooling Load to be sum of space loads = 4165.02 + 7725.80 + 5826.87 = 17717.69 + // For noncoincident, expect zone Des Cooling Air Flow to be sum of space flows = 0.289 + 0.536 + 0.404 = 1.229 + // Spaces peak on same day, so expect zone peak time to be the different coincident sizing, and day to be "N/A" + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.0", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtDesDay, "ZONE 1")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtPkTime, "ZONE 1")); + EXPECT_EQ("177176.86", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesLd, "ZONE 1")); + EXPECT_EQ("12.297", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("12.297", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1")); + EXPECT_EQ("16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1")); +} +TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_NonAir_1x_NoLatent) +{ + std::string const idf_objects = delimited_string({ + " Timestep,6;", + + " Site:Location,", + " CHICAGO_IL_USA TMY2-94846, !- Name", + " 41.78, !- Latitude {deg}", + " -87.75, !- Longitude {deg}", + " -6.00, !- Time Zone {hr}", + " 190.00; !- Elevation {m}", + + " SimulationControl,", + " Yes, !- Do Zone Sizing Calculation", + " No, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " No, !- Run Simulation for Sizing Periods", + " No; !- Run Simulation for Weather File Run Periods", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Heating 99% Design Conditions DB, !- Name", + " 1, !- Month", + " 21, !- Day of Month", + " WinterDesignDay, !- Day Type", + " -17.3, !- Maximum Dry-Bulb Temperature {C}", + " 0.0, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " -17.3, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 4.9, !- Wind Speed {m/s}", + " 270, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless}", + " 0.0; !- Sky Clearness", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Cooling 1% Design Conditions DB/MCWB, !- Name", + " 7, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " ZoneControl:Thermostat,", + " Zone 1 Thermostat, !- Name", + " Zone 1, !- Zone or ZoneList Name", + " Zone Control Type Sched, !- Control Type Schedule Name", + " ThermostatSetpoint:DualSetpoint, !- Control 1 Object Type", + " Dual Setpoint with SB; !- Control 1 Name", + + " Schedule:Compact,", + " ZONE CONTROL TYPE SCHED, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,4; !- Field 11", + + " ThermostatSetpoint:DualSetpoint,", + " Dual Setpoint with SB,!- Name", + " Heating Setpoints, !- Setpoint Temperature Schedule Name", + " Cooling Setpoints; !- Setpoint Temperature Schedule Name", + + " Schedule:Compact,", + " HEATING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,15.00, !- Field 3", + " Until: 17:00,20.00, !- Field 5", + " Until: 24:00,15.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,15.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,20.00; !- Field 13", + + " Schedule:Compact,", + " COOLING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,30.00, !- Field 3", + " Until: 17:00,24.00, !- Field 5", + " Until: 24:00,30.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,24.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,50.00; !- Field 13", + + " Sizing:Zone,", + " Zone 1, !- Zone or ZoneList Name", + " SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method", + " 12., !- Zone Cooling Design Supply Air Temperature {C}", + " , !- Zone Cooling Design Supply Air Temperature Difference {deltaC}", + " SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method", + " 50., !- Zone Heating Design Supply Air Temperature {C}", + " , !- Zone Heating Design Supply Air Temperature Difference {deltaC}", + " 0.008, !- Zone Cooling Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.008, !- Zone Heating Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " SZ DSOA West Zone, !- Design Specification Outdoor Air Object Name", + " 1.0, !- Zone Heating Sizing Factor", + " 1.0, !- Zone Cooling Sizing Factor", + " DesignDay, !- Cooling Design Air Flow Method", + " 0, !- Cooling Design Air Flow Rate {m3/s}", + " , !- Cooling Minimum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Cooling Minimum Air Flow {m3/s}", + " , !- Cooling Minimum Air Flow Fraction", + " DesignDay, !- Heating Design Air Flow Method", + " 0, !- Heating Design Air Flow Rate {m3/s}", + " , !- Heating Maximum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Heating Maximum Air Flow {m3/s}", + " , !- Heating Maximum Air Flow Fraction", + " , !- Design Specification Zone Air Distribution Object Name", + " No, !- Account for Dedicated Outdoor Air System", + " NeutralSupplyAir, !- Dedicated Outdoor Air System Control Strategy", + " autosize, !- Dedicated Outdoor Air Low Setpoint Temperature for Design {C}", + " autosize, !- Dedicated Outdoor Air High Setpoint Temperature for Design {C}", + " Sensible Load, !- Zone Load Sizing Method", + " HumidityRatioDifference, !- Zone Latent Cooling Design Supply Air Humidity Ratio Input Method", + " , !- Zone Dehumidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.005, !- Zone Cooling Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " HumidityRatioDifference, !- Zone Latent Heating Design Supply Air Humidity Ratio Input Method", + " , !- Zone Humidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.005, !- Zone Humidification Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Humidistat Dehumidification Set Point Schedule Name {percent}", + " , !- Zone Humidistat Humidification Set Point Schedule Name {percent}", + " Coincident; !- Type of Space Sum to Use", + + " DesignSpecification:OutdoorAir,", + " SZ DSOA West Zone, !- Name", + " flow/person, !- Outdoor Air Method", + " 0.00944, !- Outdoor Air Flow per Person {m3/s-person}", + " 0.0, !- Outdoor Air Flow per Zone Floor Area {m3/s-m2}", + " 0.0; !- Outdoor Air Flow per Zone {m3/s}", + + " Zone,", + " Zone 1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " 3.048, !- Ceiling Height {m}", + " 40.; !- Volume {m3}", + + " BuildingSurface:Detailed,", + " Zn001:Wall001, !- Name", + " Wall, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,3.048000, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 6.096000,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 6.096000,0,3.048000; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor001, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor002, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 2, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor003, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 3, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " C4 - 4 IN COMMON BRICK, !- Name", + " Rough, !- Roughness", + " 0.1014984, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1922.216, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7600000, !- Solar Absorptance", + " 0.7600000; !- Visible Absorptance", + + " Material,", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD, !- Name", + " Smooth, !- Roughness", + " 1.9050000E-02, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1601.846, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Construction,", + " EXTWALL80, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " C4 - 4 IN COMMON BRICK, !- Layer 2", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD; !- Layer 3", + + " ZoneHVAC:EquipmentConnections,", + " Zone 1, !- Zone Name", + " ZONE 1 EQUIPMENT, !- Zone Conditioning Equipment List Name", + " , !- Zone Air Inlet Node or NodeList Name", + " , !- Zone Air Exhaust Node or NodeList Name", + " ZONE 1 NODE, !- Zone Air Node Name", + " ; !- Zone Return Air Node or NodeList Name", + + " ZoneHVAC:EquipmentList,", + " ZONE 1 EQUIPMENT, !- Name", + " SequentialLoad, !- Load Distribution Scheme", + " ZoneHVAC:Baseboard:RadiantConvective:Electric, !- Zone Equipment 1 Object Type", + " ZONE 1 Baseboard, !- Zone Equipment 1 Name", + " 1, !- Zone Equipment 1 Cooling Sequence", + " 1, !- Zone Equipment 1 Heating or No-Load Sequence", + " , !- Zone Equipment 1 Sequential Cooling Load Fraction", + " ; !- Zone Equipment 1 Sequential Heating Load Fraction", + + " ZoneHVAC:Baseboard:RadiantConvective:Electric,", + " Zone 1 Baseboard, !- Name", + " , !- Availability Schedule Name", + " HeatingDesignCapacity, !- Heating Design Capacity Method", + " autosize, !- Heating Design Capacity {W}", + " , !- Heating Design Capacity Per Floor Area {W/m2}", + " , !- Fraction of Autosized Heating Design Capacity", + " 0.97, !- Efficiency", + " 0.2, !- Fraction Radiant", + " 0.3, !- Fraction of Radiant Energy Incident on People", + " Zn001:Wall001, !- Surface 1 Name", + " 0.7; !- Fraction of Radiant Energy to Surface 1", + + "Space,", + "Space 1, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 2, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 3, !- Name", + "Zone 1; !- Zone Name", + + " ElectricEquipment,", + " Space 1 ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 500.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " ElectricEquipment,", + " Space 1 Latent ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 1.0, !- Fraction Latent", + " 0.0, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Morning, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 8:00,0.0, !- Field 11", + " Until: 12:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 2 ElecEq, !- Name", + " Space 2, !- Zone or ZoneList Name", + " Afternoon, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Afternoon, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 12:00,0.0, !- Field 11", + " Until: 16:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 3 ElecEq, !- Name", + " Space 3, !- Zone or ZoneList Name", + " Evening, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 750.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Evening, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 16:00,0.0, !- Field 11", + " Until: 20:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + "ZoneAirHeatBalanceAlgorithm,", + "ThirdOrderBackwardDifference, !- Algorithm", + "Yes, !- Do Space Heat Balance for Sizing", + "No; !- Do Space Heat Balance for Simulation", + " Output:Table:SummaryReports,", + " AllSummary; !- Report Name 1", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + SimulationManager::ManageSimulation(*state); + + EXPECT_EQ("1898.77", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.053", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.053", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 1")); + EXPECT_EQ("832.44", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.058", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.058", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 1")); + EXPECT_EQ("7/21 17:30:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 1")); + + EXPECT_EQ("631.20", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.018", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.018", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 2")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 2")); + EXPECT_EQ("940.20", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.065", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.065", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 2")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 2")); + + EXPECT_EQ("631.20", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.018", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.018", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 3")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 3")); + EXPECT_EQ("810.65", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.056", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.056", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 3")); + EXPECT_EQ("7/21 19:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 3")); + + // For coincident, expect zone Des Cooling Load to be less than sum of space loads which is 832.44 + 940.2 + 810.65 = 2583.29 + EXPECT_EQ("3155.31", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.088", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.088", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtDesDay, "ZONE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtPkTime, "ZONE 1")); + EXPECT_EQ("1942.36", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.135", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.135", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1")); +} +TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_NonAir_10x_NoLatent) +{ + std::string const idf_objects = delimited_string({ + " Timestep,6;", + + " Site:Location,", + " CHICAGO_IL_USA TMY2-94846, !- Name", + " 41.78, !- Latitude {deg}", + " -87.75, !- Longitude {deg}", + " -6.00, !- Time Zone {hr}", + " 190.00; !- Elevation {m}", + + " SimulationControl,", + " Yes, !- Do Zone Sizing Calculation", + " No, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " No, !- Run Simulation for Sizing Periods", + " No; !- Run Simulation for Weather File Run Periods", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Heating 99% Design Conditions DB, !- Name", + " 1, !- Month", + " 21, !- Day of Month", + " WinterDesignDay, !- Day Type", + " -17.3, !- Maximum Dry-Bulb Temperature {C}", + " 0.0, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " -17.3, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 4.9, !- Wind Speed {m/s}", + " 270, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless}", + " 0.0; !- Sky Clearness", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Cooling 1% Design Conditions DB/MCWB, !- Name", + " 7, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " ZoneControl:Thermostat,", + " Zone 1 Thermostat, !- Name", + " Zone 1, !- Zone or ZoneList Name", + " Zone Control Type Sched, !- Control Type Schedule Name", + " ThermostatSetpoint:DualSetpoint, !- Control 1 Object Type", + " Dual Setpoint with SB; !- Control 1 Name", + + " Schedule:Compact,", + " ZONE CONTROL TYPE SCHED, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,4; !- Field 11", + + " ThermostatSetpoint:DualSetpoint,", + " Dual Setpoint with SB,!- Name", + " Heating Setpoints, !- Setpoint Temperature Schedule Name", + " Cooling Setpoints; !- Setpoint Temperature Schedule Name", + + " Schedule:Compact,", + " HEATING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,15.00, !- Field 3", + " Until: 17:00,20.00, !- Field 5", + " Until: 24:00,15.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,15.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,20.00; !- Field 13", + + " Schedule:Compact,", + " COOLING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,30.00, !- Field 3", + " Until: 17:00,24.00, !- Field 5", + " Until: 24:00,30.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,24.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,50.00; !- Field 13", + + " Sizing:Zone,", + " Zone 1, !- Zone or ZoneList Name", + " SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method", + " 12., !- Zone Cooling Design Supply Air Temperature {C}", + " , !- Zone Cooling Design Supply Air Temperature Difference {deltaC}", + " SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method", + " 50., !- Zone Heating Design Supply Air Temperature {C}", + " , !- Zone Heating Design Supply Air Temperature Difference {deltaC}", + " 0.008, !- Zone Cooling Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.008, !- Zone Heating Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " SZ DSOA West Zone, !- Design Specification Outdoor Air Object Name", + " 1.0, !- Zone Heating Sizing Factor", + " 1.0, !- Zone Cooling Sizing Factor", + " DesignDay, !- Cooling Design Air Flow Method", + " 0, !- Cooling Design Air Flow Rate {m3/s}", + " , !- Cooling Minimum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Cooling Minimum Air Flow {m3/s}", + " , !- Cooling Minimum Air Flow Fraction", + " DesignDay, !- Heating Design Air Flow Method", + " 0, !- Heating Design Air Flow Rate {m3/s}", + " , !- Heating Maximum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Heating Maximum Air Flow {m3/s}", + " , !- Heating Maximum Air Flow Fraction", + " , !- Design Specification Zone Air Distribution Object Name", + " No, !- Account for Dedicated Outdoor Air System", + " NeutralSupplyAir, !- Dedicated Outdoor Air System Control Strategy", + " autosize, !- Dedicated Outdoor Air Low Setpoint Temperature for Design {C}", + " autosize, !- Dedicated Outdoor Air High Setpoint Temperature for Design {C}", + " Sensible Load, !- Zone Load Sizing Method", + " HumidityRatioDifference, !- Zone Latent Cooling Design Supply Air Humidity Ratio Input Method", + " , !- Zone Dehumidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.005, !- Zone Cooling Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " HumidityRatioDifference, !- Zone Latent Heating Design Supply Air Humidity Ratio Input Method", + " , !- Zone Humidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.005, !- Zone Humidification Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Humidistat Dehumidification Set Point Schedule Name {percent}", + " , !- Zone Humidistat Humidification Set Point Schedule Name {percent}", + " Coincident; !- Type of Space Sum to Use", + + " DesignSpecification:OutdoorAir,", + " SZ DSOA West Zone, !- Name", + " flow/person, !- Outdoor Air Method", + " 0.00944, !- Outdoor Air Flow per Person {m3/s-person}", + " 0.0, !- Outdoor Air Flow per Zone Floor Area {m3/s-m2}", + " 0.0; !- Outdoor Air Flow per Zone {m3/s}", + + " Zone,", + " Zone 1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 10, !- Multiplier", + " 3.048, !- Ceiling Height {m}", + " 40.; !- Volume {m3}", + + " BuildingSurface:Detailed,", + " Zn001:Wall001, !- Name", + " Wall, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,3.048000, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 6.096000,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 6.096000,0,3.048000; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor001, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor002, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 2, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor003, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 3, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " C4 - 4 IN COMMON BRICK, !- Name", + " Rough, !- Roughness", + " 0.1014984, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1922.216, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7600000, !- Solar Absorptance", + " 0.7600000; !- Visible Absorptance", + + " Material,", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD, !- Name", + " Smooth, !- Roughness", + " 1.9050000E-02, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1601.846, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Construction,", + " EXTWALL80, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " C4 - 4 IN COMMON BRICK, !- Layer 2", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD; !- Layer 3", + + " ZoneHVAC:EquipmentConnections,", + " Zone 1, !- Zone Name", + " ZONE 1 EQUIPMENT, !- Zone Conditioning Equipment List Name", + " , !- Zone Air Inlet Node or NodeList Name", + " , !- Zone Air Exhaust Node or NodeList Name", + " ZONE 1 NODE, !- Zone Air Node Name", + " ; !- Zone Return Air Node or NodeList Name", + + " ZoneHVAC:EquipmentList,", + " ZONE 1 EQUIPMENT, !- Name", + " SequentialLoad, !- Load Distribution Scheme", + " ZoneHVAC:Baseboard:RadiantConvective:Electric, !- Zone Equipment 1 Object Type", + " ZONE 1 Baseboard, !- Zone Equipment 1 Name", + " 1, !- Zone Equipment 1 Cooling Sequence", + " 1, !- Zone Equipment 1 Heating or No-Load Sequence", + " , !- Zone Equipment 1 Sequential Cooling Load Fraction", + " ; !- Zone Equipment 1 Sequential Heating Load Fraction", + + " ZoneHVAC:Baseboard:RadiantConvective:Electric,", + " Zone 1 Baseboard, !- Name", + " , !- Availability Schedule Name", + " HeatingDesignCapacity, !- Heating Design Capacity Method", + " autosize, !- Heating Design Capacity {W}", + " , !- Heating Design Capacity Per Floor Area {W/m2}", + " , !- Fraction of Autosized Heating Design Capacity", + " 0.97, !- Efficiency", + " 0.2, !- Fraction Radiant", + " 0.3, !- Fraction of Radiant Energy Incident on People", + " Zn001:Wall001, !- Surface 1 Name", + " 0.7; !- Fraction of Radiant Energy to Surface 1", + + "Space,", + "Space 1, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 2, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 3, !- Name", + "Zone 1; !- Zone Name", + + " ElectricEquipment,", + " Space 1 ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 500.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " ElectricEquipment,", + " Space 1 Latent ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 1.0, !- Fraction Latent", + " 0.0, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Morning, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 8:00,0.0, !- Field 11", + " Until: 12:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 2 ElecEq, !- Name", + " Space 2, !- Zone or ZoneList Name", + " Afternoon, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Afternoon, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 12:00,0.0, !- Field 11", + " Until: 16:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 3 ElecEq, !- Name", + " Space 3, !- Zone or ZoneList Name", + " Evening, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 750.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Evening, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 16:00,0.0, !- Field 11", + " Until: 20:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + "ZoneAirHeatBalanceAlgorithm,", + "ThirdOrderBackwardDifference, !- Algorithm", + "Yes, !- Do Space Heat Balance for Sizing", + "No; !- Do Space Heat Balance for Simulation", + " Output:Table:SummaryReports,", + " AllSummary; !- Report Name 1", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + SimulationManager::ManageSimulation(*state); + + EXPECT_EQ("18987.69", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.527", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.527", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 1")); + EXPECT_EQ("8324.40", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.578", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.578", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 1")); + EXPECT_EQ("7/21 17:30:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 1")); + + EXPECT_EQ("6311.95", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 2")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 2")); + EXPECT_EQ("9402.01", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.653", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.653", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 2")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 2")); + + EXPECT_EQ("6311.95", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 3")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 3")); + EXPECT_EQ("8106.47", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.563", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.563", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 3")); + EXPECT_EQ("7/21 19:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 3")); + + // For coincident, expect zone Des Cooling Load to be less than sum of space loads which is 832.44 + 940.2 + 810.65 = 2583.29 + EXPECT_EQ("31553.14", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.876", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.876", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtDesDay, "ZONE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtPkTime, "ZONE 1")); + EXPECT_EQ("19423.64", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesLd, "ZONE 1")); + EXPECT_EQ("1.348", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("1.348", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1")); +} +TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_NonAir_10x_NoLatent_NoSpaceHB) +{ + std::string const idf_objects = delimited_string({ + " Timestep,6;", + + " Site:Location,", + " CHICAGO_IL_USA TMY2-94846, !- Name", + " 41.78, !- Latitude {deg}", + " -87.75, !- Longitude {deg}", + " -6.00, !- Time Zone {hr}", + " 190.00; !- Elevation {m}", + + " SimulationControl,", + " Yes, !- Do Zone Sizing Calculation", + " No, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " No, !- Run Simulation for Sizing Periods", + " No; !- Run Simulation for Weather File Run Periods", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Heating 99% Design Conditions DB, !- Name", + " 1, !- Month", + " 21, !- Day of Month", + " WinterDesignDay, !- Day Type", + " -17.3, !- Maximum Dry-Bulb Temperature {C}", + " 0.0, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " -17.3, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 4.9, !- Wind Speed {m/s}", + " 270, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless}", + " 0.0; !- Sky Clearness", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Cooling 1% Design Conditions DB/MCWB, !- Name", + " 7, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " ZoneControl:Thermostat,", + " Zone 1 Thermostat, !- Name", + " Zone 1, !- Zone or ZoneList Name", + " Zone Control Type Sched, !- Control Type Schedule Name", + " ThermostatSetpoint:DualSetpoint, !- Control 1 Object Type", + " Dual Setpoint with SB; !- Control 1 Name", + + " Schedule:Compact,", + " ZONE CONTROL TYPE SCHED, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,4; !- Field 11", + + " ThermostatSetpoint:DualSetpoint,", + " Dual Setpoint with SB,!- Name", + " Heating Setpoints, !- Setpoint Temperature Schedule Name", + " Cooling Setpoints; !- Setpoint Temperature Schedule Name", + + " Schedule:Compact,", + " HEATING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,15.00, !- Field 3", + " Until: 17:00,20.00, !- Field 5", + " Until: 24:00,15.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,15.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,20.00; !- Field 13", + + " Schedule:Compact,", + " COOLING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,30.00, !- Field 3", + " Until: 17:00,24.00, !- Field 5", + " Until: 24:00,30.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,24.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,50.00; !- Field 13", + + " Sizing:Zone,", + " Zone 1, !- Zone or ZoneList Name", + " SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method", + " 12., !- Zone Cooling Design Supply Air Temperature {C}", + " , !- Zone Cooling Design Supply Air Temperature Difference {deltaC}", + " SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method", + " 50., !- Zone Heating Design Supply Air Temperature {C}", + " , !- Zone Heating Design Supply Air Temperature Difference {deltaC}", + " 0.008, !- Zone Cooling Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.008, !- Zone Heating Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " SZ DSOA West Zone, !- Design Specification Outdoor Air Object Name", + " 1.0, !- Zone Heating Sizing Factor", + " 1.0, !- Zone Cooling Sizing Factor", + " DesignDay, !- Cooling Design Air Flow Method", + " 0, !- Cooling Design Air Flow Rate {m3/s}", + " , !- Cooling Minimum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Cooling Minimum Air Flow {m3/s}", + " , !- Cooling Minimum Air Flow Fraction", + " DesignDay, !- Heating Design Air Flow Method", + " 0, !- Heating Design Air Flow Rate {m3/s}", + " , !- Heating Maximum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Heating Maximum Air Flow {m3/s}", + " , !- Heating Maximum Air Flow Fraction", + " , !- Design Specification Zone Air Distribution Object Name", + " No, !- Account for Dedicated Outdoor Air System", + " NeutralSupplyAir, !- Dedicated Outdoor Air System Control Strategy", + " autosize, !- Dedicated Outdoor Air Low Setpoint Temperature for Design {C}", + " autosize, !- Dedicated Outdoor Air High Setpoint Temperature for Design {C}", + " Sensible Load, !- Zone Load Sizing Method", + " HumidityRatioDifference, !- Zone Latent Cooling Design Supply Air Humidity Ratio Input Method", + " , !- Zone Dehumidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.005, !- Zone Cooling Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " HumidityRatioDifference, !- Zone Latent Heating Design Supply Air Humidity Ratio Input Method", + " , !- Zone Humidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.005, !- Zone Humidification Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Humidistat Dehumidification Set Point Schedule Name {percent}", + " , !- Zone Humidistat Humidification Set Point Schedule Name {percent}", + " Coincident; !- Type of Space Sum to Use", + + " DesignSpecification:OutdoorAir,", + " SZ DSOA West Zone, !- Name", + " flow/person, !- Outdoor Air Method", + " 0.00944, !- Outdoor Air Flow per Person {m3/s-person}", + " 0.0, !- Outdoor Air Flow per Zone Floor Area {m3/s-m2}", + " 0.0; !- Outdoor Air Flow per Zone {m3/s}", + + " Zone,", + " Zone 1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 10, !- Multiplier", + " 3.048, !- Ceiling Height {m}", + " 40.; !- Volume {m3}", + + " BuildingSurface:Detailed,", + " Zn001:Wall001, !- Name", + " Wall, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,3.048000, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 6.096000,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 6.096000,0,3.048000; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor001, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor002, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 2, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor003, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 3, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " C4 - 4 IN COMMON BRICK, !- Name", + " Rough, !- Roughness", + " 0.1014984, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1922.216, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7600000, !- Solar Absorptance", + " 0.7600000; !- Visible Absorptance", + + " Material,", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD, !- Name", + " Smooth, !- Roughness", + " 1.9050000E-02, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1601.846, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Construction,", + " EXTWALL80, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " C4 - 4 IN COMMON BRICK, !- Layer 2", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD; !- Layer 3", + + " ZoneHVAC:EquipmentConnections,", + " Zone 1, !- Zone Name", + " ZONE 1 EQUIPMENT, !- Zone Conditioning Equipment List Name", + " , !- Zone Air Inlet Node or NodeList Name", + " , !- Zone Air Exhaust Node or NodeList Name", + " ZONE 1 NODE, !- Zone Air Node Name", + " ; !- Zone Return Air Node or NodeList Name", + + " ZoneHVAC:EquipmentList,", + " ZONE 1 EQUIPMENT, !- Name", + " SequentialLoad, !- Load Distribution Scheme", + " ZoneHVAC:Baseboard:RadiantConvective:Electric, !- Zone Equipment 1 Object Type", + " ZONE 1 Baseboard, !- Zone Equipment 1 Name", + " 1, !- Zone Equipment 1 Cooling Sequence", + " 1, !- Zone Equipment 1 Heating or No-Load Sequence", + " , !- Zone Equipment 1 Sequential Cooling Load Fraction", + " ; !- Zone Equipment 1 Sequential Heating Load Fraction", + + " ZoneHVAC:Baseboard:RadiantConvective:Electric,", + " Zone 1 Baseboard, !- Name", + " , !- Availability Schedule Name", + " HeatingDesignCapacity, !- Heating Design Capacity Method", + " autosize, !- Heating Design Capacity {W}", + " , !- Heating Design Capacity Per Floor Area {W/m2}", + " , !- Fraction of Autosized Heating Design Capacity", + " 0.97, !- Efficiency", + " 0.2, !- Fraction Radiant", + " 0.3, !- Fraction of Radiant Energy Incident on People", + " Zn001:Wall001, !- Surface 1 Name", + " 0.7; !- Fraction of Radiant Energy to Surface 1", + + "Space,", + "Space 1, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 2, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 3, !- Name", + "Zone 1; !- Zone Name", + + " ElectricEquipment,", + " Space 1 ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 500.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " ElectricEquipment,", + " Space 1 Latent ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 1.0, !- Fraction Latent", + " 0.0, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Morning, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 8:00,0.0, !- Field 11", + " Until: 12:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 2 ElecEq, !- Name", + " Space 2, !- Zone or ZoneList Name", + " Afternoon, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Afternoon, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 12:00,0.0, !- Field 11", + " Until: 16:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 3 ElecEq, !- Name", + " Space 3, !- Zone or ZoneList Name", + " Evening, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 750.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Evening, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 16:00,0.0, !- Field 11", + " Until: 20:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + "ZoneAirHeatBalanceAlgorithm,", + "ThirdOrderBackwardDifference, !- Algorithm", + "No, !- Do Space Heat Balance for Sizing", + "No; !- Do Space Heat Balance for Simulation", + " Output:Table:SummaryReports,", + " AllSummary; !- Report Name 1", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + SimulationManager::ManageSimulation(*state); + + // For coincident, expect zone Des Cooling Load to be less than sum of space loads which is 832.44 + 940.2 + 810.65 = 2583.29 + EXPECT_EQ("31553.14", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.876", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.876", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtDesDay, "ZONE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtPkTime, "ZONE 1")); + EXPECT_EQ("19423.64", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesLd, "ZONE 1")); + EXPECT_EQ("1.348", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("1.348", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1")); +} +TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_NonAir_10x_Latent_SpaceHB) +{ + std::string const idf_objects = delimited_string({ + " Timestep,6;", + + " Site:Location,", + " CHICAGO_IL_USA TMY2-94846, !- Name", + " 41.78, !- Latitude {deg}", + " -87.75, !- Longitude {deg}", + " -6.00, !- Time Zone {hr}", + " 190.00; !- Elevation {m}", + + " SimulationControl,", + " Yes, !- Do Zone Sizing Calculation", + " No, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " No, !- Run Simulation for Sizing Periods", + " No; !- Run Simulation for Weather File Run Periods", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Heating 99% Design Conditions DB, !- Name", + " 1, !- Month", + " 21, !- Day of Month", + " WinterDesignDay, !- Day Type", + " -17.3, !- Maximum Dry-Bulb Temperature {C}", + " 0.0, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " -17.3, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 4.9, !- Wind Speed {m/s}", + " 270, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless}", + " 0.0; !- Sky Clearness", + + " SizingPeriod:DesignDay,", + " CHICAGO_IL_USA Annual Cooling 1% Design Conditions DB/MCWB, !- Name", + " 7, !- Month", + " 21, !- Day of Month", + " SummerDesignDay, !- Day Type", + " 31.5, !- Maximum Dry-Bulb Temperature {C}", + " 10.7, !- Daily Dry-Bulb Temperature Range {deltaC}", + " , !- Dry-Bulb Temperature Range Modifier Type", + " , !- Dry-Bulb Temperature Range Modifier Day Schedule Name", + " Wetbulb, !- Humidity Condition Type", + " 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C}", + " , !- Humidity Condition Day Schedule Name", + " , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir}", + " , !- Enthalpy at Maximum Dry-Bulb {J/kg}", + " , !- Daily Wet-Bulb Temperature Range {deltaC}", + " 99063., !- Barometric Pressure {Pa}", + " 5.3, !- Wind Speed {m/s}", + " 230, !- Wind Direction {deg}", + " No, !- Rain Indicator", + " No, !- Snow Indicator", + " No, !- Daylight Saving Time Indicator", + " ASHRAEClearSky, !- Solar Model Indicator", + " , !- Beam Solar Day Schedule Name", + " , !- Diffuse Solar Day Schedule Name", + " , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless}", + " , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud){dimensionless}", + " 1.0; !- Sky Clearness", + + " ZoneControl:Thermostat,", + " Zone 1 Thermostat, !- Name", + " Zone 1, !- Zone or ZoneList Name", + " Zone Control Type Sched, !- Control Type Schedule Name", + " ThermostatSetpoint:DualSetpoint, !- Control 1 Object Type", + " Dual Setpoint with SB; !- Control 1 Name", + + " Schedule:Compact,", + " ZONE CONTROL TYPE SCHED, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,4; !- Field 11", + + " ThermostatSetpoint:DualSetpoint,", + " Dual Setpoint with SB,!- Name", + " Heating Setpoints, !- Setpoint Temperature Schedule Name", + " Cooling Setpoints; !- Setpoint Temperature Schedule Name", + + " Schedule:Compact,", + " HEATING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,15.00, !- Field 3", + " Until: 17:00,20.00, !- Field 5", + " Until: 24:00,15.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,15.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,20.00; !- Field 13", + + " Schedule:Compact,", + " COOLING SETPOINTS, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: Weekdays Weekends Holidays CustomDay1 CustomDay2, !- Field 2", + " Until: 7:00,30.00, !- Field 3", + " Until: 17:00,24.00, !- Field 5", + " Until: 24:00,30.00, !- Field 7", + " For: SummerDesignDay, !- Field 9", + " Until: 24:00,24.00, !- Field 10", + " For: WinterDesignDay, !- Field 12", + " Until: 24:00,50.00; !- Field 13", + + " Sizing:Zone,", + " Zone 1, !- Zone or ZoneList Name", + " SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method", + " 12., !- Zone Cooling Design Supply Air Temperature {C}", + " , !- Zone Cooling Design Supply Air Temperature Difference {deltaC}", + " SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method", + " 50., !- Zone Heating Design Supply Air Temperature {C}", + " , !- Zone Heating Design Supply Air Temperature Difference {deltaC}", + " 0.008, !- Zone Cooling Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.008, !- Zone Heating Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " SZ DSOA West Zone, !- Design Specification Outdoor Air Object Name", + " 1.0, !- Zone Heating Sizing Factor", + " 1.0, !- Zone Cooling Sizing Factor", + " DesignDay, !- Cooling Design Air Flow Method", + " 0, !- Cooling Design Air Flow Rate {m3/s}", + " , !- Cooling Minimum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Cooling Minimum Air Flow {m3/s}", + " , !- Cooling Minimum Air Flow Fraction", + " DesignDay, !- Heating Design Air Flow Method", + " 0, !- Heating Design Air Flow Rate {m3/s}", + " , !- Heating Maximum Air Flow per Zone Floor Area {m3/s-m2}", + " , !- Heating Maximum Air Flow {m3/s}", + " , !- Heating Maximum Air Flow Fraction", + " , !- Design Specification Zone Air Distribution Object Name", + " No, !- Account for Dedicated Outdoor Air System", + " NeutralSupplyAir, !- Dedicated Outdoor Air System Control Strategy", + " autosize, !- Dedicated Outdoor Air Low Setpoint Temperature for Design {C}", + " autosize, !- Dedicated Outdoor Air High Setpoint Temperature for Design {C}", + " Sensible And Latent Load, !- Zone Load Sizing Method", + " HumidityRatioDifference, !- Zone Latent Cooling Design Supply Air Humidity Ratio Input Method", + " , !- Zone Dehumidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.005, !- Zone Cooling Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " HumidityRatioDifference, !- Zone Latent Heating Design Supply Air Humidity Ratio Input Method", + " , !- Zone Humidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}", + " 0.005, !- Zone Humidification Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}", + " , !- Zone Humidistat Dehumidification Set Point Schedule Name {percent}", + " , !- Zone Humidistat Humidification Set Point Schedule Name {percent}", + " Coincident; !- Type of Space Sum to Use", + + " DesignSpecification:OutdoorAir,", + " SZ DSOA West Zone, !- Name", + " flow/person, !- Outdoor Air Method", + " 0.00944, !- Outdoor Air Flow per Person {m3/s-person}", + " 0.0, !- Outdoor Air Flow per Zone Floor Area {m3/s-m2}", + " 0.0; !- Outdoor Air Flow per Zone {m3/s}", + + " Zone,", + " Zone 1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 10, !- Multiplier", + " 3.048, !- Ceiling Height {m}", + " 40.; !- Volume {m3}", + + " BuildingSurface:Detailed,", + " Zn001:Wall001, !- Name", + " Wall, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,3.048000, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 6.096000,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 6.096000,0,3.048000; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor001, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 1, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor002, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 2, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Zn001:Floor003, !- Name", + " Floor, !- Surface Type", + " EXTWALL80, !- Construction Name", + " Zone 1, !- Zone Name", + " Space 3, !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,5,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 3,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 3,5,0; !- X,Y,Z ==> Vertex 4 {m}", + + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " C4 - 4 IN COMMON BRICK, !- Name", + " Rough, !- Roughness", + " 0.1014984, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1922.216, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7600000, !- Solar Absorptance", + " 0.7600000; !- Visible Absorptance", + + " Material,", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD, !- Name", + " Smooth, !- Roughness", + " 1.9050000E-02, !- Thickness {m}", + " 0.7264224, !- Conductivity {W/m-K}", + " 1601.846, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Construction,", + " EXTWALL80, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " C4 - 4 IN COMMON BRICK, !- Layer 2", + " E1 - 3 / 4 IN PLASTER OR GYP BOARD; !- Layer 3", + + " ZoneHVAC:EquipmentConnections,", + " Zone 1, !- Zone Name", + " ZONE 1 EQUIPMENT, !- Zone Conditioning Equipment List Name", + " , !- Zone Air Inlet Node or NodeList Name", + " , !- Zone Air Exhaust Node or NodeList Name", + " ZONE 1 NODE, !- Zone Air Node Name", + " ; !- Zone Return Air Node or NodeList Name", + + " ZoneHVAC:EquipmentList,", + " ZONE 1 EQUIPMENT, !- Name", + " SequentialLoad, !- Load Distribution Scheme", + " ZoneHVAC:Baseboard:RadiantConvective:Electric, !- Zone Equipment 1 Object Type", + " ZONE 1 Baseboard, !- Zone Equipment 1 Name", + " 1, !- Zone Equipment 1 Cooling Sequence", + " 1, !- Zone Equipment 1 Heating or No-Load Sequence", + " , !- Zone Equipment 1 Sequential Cooling Load Fraction", + " ; !- Zone Equipment 1 Sequential Heating Load Fraction", + + " ZoneHVAC:Baseboard:RadiantConvective:Electric,", + " Zone 1 Baseboard, !- Name", + " , !- Availability Schedule Name", + " HeatingDesignCapacity, !- Heating Design Capacity Method", + " autosize, !- Heating Design Capacity {W}", + " , !- Heating Design Capacity Per Floor Area {W/m2}", + " , !- Fraction of Autosized Heating Design Capacity", + " 0.97, !- Efficiency", + " 0.2, !- Fraction Radiant", + " 0.3, !- Fraction of Radiant Energy Incident on People", + " Zn001:Wall001, !- Surface 1 Name", + " 0.7; !- Fraction of Radiant Energy to Surface 1", + + "Space,", + "Space 1, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 2, !- Name", + "Zone 1; !- Zone Name", + "Space,", + "Space 3, !- Name", + "Zone 1; !- Zone Name", + + " ElectricEquipment,", + " Space 1 ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " Morning, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 500.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " ElectricEquipment,", + " Space 1 Latent ElecEq, !- Name", + " Space 1, !- Zone or ZoneList Name", + " SummerMorning2, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 1.0, !- Fraction Latent", + " 0.0, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Morning, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 8:00,0.0, !- Field 11", + " Until: 9:00,0.5, !- Field 11", + " Until: 12:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " Schedule:Compact,", + " SummerMorning2, !- Name", + " , !- Schedule Type Limits Name", + " Through: 5/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,0.0, !- Field 11", + " Through: 9/30, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 8:00,0.0, !- Field 11", + " Until: 9:00,0.5, !- Field 11", + " Until: 11:00,0.8, !- Field 11", + " Until: 12:00,1.0, !- Field 11", + " Until: 13:00,0.9, !- Field 11", + " Until: 24:00,0.0, !- Field 11", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 2 ElecEq, !- Name", + " Space 2, !- Zone or ZoneList Name", + " Afternoon, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 1000.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Afternoon, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 12:00,0.0, !- Field 11", + " Until: 16:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + " ElectricEquipment,", + " Space 3 ElecEq, !- Name", + " Space 3, !- Zone or ZoneList Name", + " Evening, !- Schedule Name", + " EquipmentLevel, !- Design Level Calculation Method", + " 750.0, !- Design Level {W}", + " , !- Watts per Zone Floor Area {W/m2}", + " , !- Watts per Person {W/person}", + " 0, !- Fraction Latent", + " 0.3000000, !- Fraction Radiant", + " 0; !- Fraction Lost", + + " Schedule:Compact,", + " Evening, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: Alldays, !- Field 10", + " Until: 16:00,0.0, !- Field 11", + " Until: 20:00,1.0, !- Field 11", + " Until: 24:00,0.0; !- Field 11", + + "ZoneAirHeatBalanceAlgorithm,", + "ThirdOrderBackwardDifference, !- Algorithm", + "Yes, !- Do Space Heat Balance for Sizing", + "No; !- Do Space Heat Balance for Simulation", + " Output:Table:SummaryReports,", + " AllSummary; !- Report Name 1", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + SimulationManager::ManageSimulation(*state); + + int space1Num = 1; + auto &calFinalSpSiz = state->dataSize->CalcFinalSpaceSizing(space1Num); + EXPECT_EQ(calFinalSpSiz.TimeStepNumAtLatentCoolMax, 72); + + EXPECT_EQ("18989.14", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.527", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.527", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 1")); + EXPECT_EQ("10000.00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 1")); + EXPECT_EQ("0.667", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 1")); + EXPECT_EQ("0.667", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 1")); + EXPECT_EQ("7/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 1")); + + EXPECT_EQ("6311.95", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 2")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 2")); + EXPECT_EQ("9402.01", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 2")); + EXPECT_EQ("0.653", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 2")); + EXPECT_EQ("0.653", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 2")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 2")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 2")); + + EXPECT_EQ("6311.95", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.175", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtDesDay, "SPACE 3")); + EXPECT_EQ("1/21 12:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpHtPkTime, "SPACE 3")); + EXPECT_EQ("8106.47", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesLd, "SPACE 3")); + EXPECT_EQ("0.563", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClCalcDesAirFlow, "SPACE 3")); + EXPECT_EQ("0.563", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClUserDesAirFlow, "SPACE 3")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClDesDay, "SPACE 3")); + EXPECT_EQ("7/21 19:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchSpClPkTime, "SPACE 3")); + + // For coincident, expect zone Des Cooling Load to be less than sum of space loads which is 832.44 + 940.2 + 810.65 = 2583.29 + EXPECT_EQ("31554.59", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesLd, "ZONE 1")); + EXPECT_EQ("0.876", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("0.876", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtDesDay, "ZONE 1")); + EXPECT_EQ("1/21 08:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnHtPkTime, "ZONE 1")); + EXPECT_EQ("19406.72", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesLd, "ZONE 1")); + EXPECT_EQ("1.347", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClCalcDesAirFlow, "ZONE 1")); + EXPECT_EQ("1.347", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClUserDesAirFlow, "ZONE 1")); + EXPECT_EQ("CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB", + OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1")); + EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1")); +} diff --git a/tst/EnergyPlus/unit/SolarShading.unit.cc b/tst/EnergyPlus/unit/SolarShading.unit.cc index a3ac60850a3..23d8830f682 100644 --- a/tst/EnergyPlus/unit/SolarShading.unit.cc +++ b/tst/EnergyPlus/unit/SolarShading.unit.cc @@ -2671,6 +2671,7 @@ TEST_F(EnergyPlusFixture, WindowShadingManager_Lum_Test) { state->dataSurface->Surface.allocate(2); state->dataSurface->SurfaceWindow.allocate(2); + state->dataSurface->surfShades.allocate(2); EnergyPlus::SurfaceGeometry::AllocateSurfaceWindows(*state, 2); state->dataConstruction->Construct.allocate(1); @@ -3916,7 +3917,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_Warn_Pixel_Count_and_TM_Schedule) #ifdef EP_NO_OPENGL EXPECT_EQ(state->dataErrTracking->TotalWarningErrors, 2); - EXPECT_EQ(state->dataErrTracking->TotalSevereErrors, 0; + EXPECT_EQ(state->dataErrTracking->TotalSevereErrors, 0); EXPECT_EQ(state->dataErrTracking->LastSevereError, ""); #else if (!Penumbra::Penumbra::is_valid_context()) { @@ -5224,13 +5225,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcBeamSolarOnWinRevealSurface) construct1.TotGlassLayers = 1; construct1.TransSolBeamCoef(1) = 0.9; - state->dataMaterial->TotMaterials = 1; - for (int i = 1; i <= state->dataMaterial->TotMaterials; i++) { - Material::MaterialChild *p = new Material::MaterialChild; - state->dataMaterial->Material.push_back(p); - } - state->dataMaterial->Material(1)->Name = "GLASS"; - state->dataMaterial->Material(1)->group = Material::Group::WindowGlass; + auto &s_mat = state->dataMaterial; + + auto *mat1 = new Material::MaterialGlass; + mat1->Name = "GLASS"; + mat1->group = Material::Group::Glass; + s_mat->materials.push_back(mat1); + mat1->Num = s_mat->materials.isize(); + s_mat->materialMap.insert_or_assign(mat1->Name, mat1->Num); state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(1); @@ -6199,10 +6201,13 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_GetShadowingInputTest6) EXPECT_TRUE(state->dataSysVars->SlaterBarsky); #ifdef EP_NO_OPENGL - std::string const error_string = delimited_string({" ** Warning ** ShadowCalculation: suspect Shading Calculation Update Frequency", - " ** ~~~ ** Value entered=[56], Shadowing Calculations will be inaccurate.", - " ** Warning ** No GPU found (required for PixelCounting)", - " ** ~~~ ** PolygonClipping will be used instead"}); + std::string const error_string = + delimited_string({" ** Warning ** ShadowCalculation: suspect Shading Calculation Update Frequency", + " ** ~~~ ** Value entered=[56], Shadowing Calculations will be inaccurate.", + " ** Warning ** ShadowCalculation: invalid Shading Calculation Method", + " ** ~~~ ** Value entered=\"PixelCounting\"", + " ** ~~~ ** This version of EnergyPlus was not compiled to use OpenGL (required for PixelCounting)", + " ** ~~~ ** PolygonClipping will be used instead"}); EXPECT_TRUE(compare_err_stream(error_string, true)); EXPECT_ENUM_EQ(state->dataSysVars->shadingMethod, ShadingMethod::PolygonClipping); diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index d4c559ceba2..d369945cb47 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -3859,50 +3859,57 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckWindowShadingControlSimilarForWin TEST_F(EnergyPlusFixture, SurfaceGeometry_createAirMaterialFromDistance_Test) { - state->dataMaterial->TotMaterials = 0; + auto &s_mat = state->dataMaterial; createAirMaterialFromDistance(*state, 0.008, "test_air_"); - auto *thisMaterial = dynamic_cast(state->dataMaterial->Material(state->dataMaterial->TotMaterials)); - EXPECT_EQ(state->dataMaterial->TotMaterials, 1); - EXPECT_EQ(thisMaterial->Name, "test_air_8MM"); - EXPECT_EQ(thisMaterial->Thickness, 0.008); - EXPECT_EQ(thisMaterial->gases[0].con.c0, 2.873e-3); - EXPECT_EQ(thisMaterial->gases[0].con.c1, 7.760e-5); + auto const *mat1 = dynamic_cast(s_mat->materials(1)); + EXPECT_EQ(mat1->Name, "test_air_8MM"); + EXPECT_EQ(mat1->Thickness, 0.008); + EXPECT_EQ(mat1->gases[0].con.c0, 2.873e-3); + EXPECT_EQ(mat1->gases[0].con.c1, 7.760e-5); createAirMaterialFromDistance(*state, 0.012, "test_air_"); - thisMaterial = dynamic_cast(state->dataMaterial->Material(state->dataMaterial->TotMaterials)); - EXPECT_EQ(state->dataMaterial->TotMaterials, 2); - EXPECT_EQ(thisMaterial->Name, "test_air_12MM"); - EXPECT_EQ(thisMaterial->Thickness, 0.012); + auto const *mat2 = dynamic_cast(s_mat->materials(2)); + EXPECT_EQ(mat2->Name, "test_air_12MM"); + EXPECT_EQ(mat2->Thickness, 0.012); createAirMaterialFromDistance(*state, 0.008, "test_air_"); - EXPECT_EQ(state->dataMaterial->TotMaterials, 2); + EXPECT_EQ(s_mat->materials.isize(), 2); } TEST_F(EnergyPlusFixture, SurfaceGeometry_createConstructionWithStorm_Test) { + auto &s_mat = state->dataMaterial; state->dataHeatBal->TotConstructs = 1; state->dataConstruction->Construct.allocate(state->dataHeatBal->TotConstructs); - for (int i = 1; i <= 60; i++) { - Material::MaterialBase *p = new Material::MaterialChild; - state->dataMaterial->Material.push_back(p); - } - dynamic_cast(state->dataMaterial->Material(47))->AbsorpThermalFront = 0.11; + auto *matStorm = new Material::MaterialGlass; + s_mat->materials.push_back(matStorm); + matStorm->AbsorpThermalFront = 0.11; + + auto *matGap = new Material::MaterialGasMix; + s_mat->materials.push_back(matGap); + + auto *mat3 = new Material::MaterialGlass; + s_mat->materials.push_back(mat3); + auto *mat4 = new Material::MaterialGlass; + s_mat->materials.push_back(mat4); + auto *mat5 = new Material::MaterialGlass; + s_mat->materials.push_back(mat5); // Case 1a: Constructs with regular materials are a reverse of each other--material layers match in reverse (should get a "false" answer) state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).TotLayers = 3; - state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(1) = 11; - state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(2) = 22; - state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(3) = 33; + state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(1) = 3; + state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(2) = 4; + state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(3) = 5; - createConstructionWithStorm(*state, 1, "construction_A", 47, 59); + createConstructionWithStorm(*state, 1, "construction_A", 1, 2); EXPECT_EQ(state->dataHeatBal->TotConstructs, 2); EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).Name, "construction_A"); - EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(1), 47); - EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(2), 59); - EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(3), 11); - EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(4), 22); - EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(5), 33); + EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(1), 1); + EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(2), 2); + EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(3), 3); + EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(4), 4); + EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).LayerPoint(5), 5); EXPECT_EQ(state->dataConstruction->Construct(state->dataHeatBal->TotConstructs).OutsideAbsorpThermal, 0.11); } @@ -5102,12 +5109,9 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test4) TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) { + auto &s_mat = state->dataMaterial; bool RevLayerDiffs; state->dataConstruction->Construct.allocate(6); - for (int i = 1; i <= 60; i++) { - Material::MaterialChild *p = new Material::MaterialChild; - state->dataMaterial->Material.push_back(p); - } // Case 1a: Constructs with regular materials are a reverse of each other--material layers match in reverse (should get a "false" answer) state->dataConstruction->Construct(1).TotLayers = 3; @@ -5126,9 +5130,19 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) // Case 1a: Constructs with regular materials are not reverse of each other--material layers do not match in reverse (should get a "true" answer) state->dataConstruction->Construct(2).LayerPoint(1) = 1; state->dataConstruction->Construct(2).LayerPoint(3) = 3; - state->dataMaterial->Material(1)->group = Material::Group::Regular; - state->dataMaterial->Material(2)->group = Material::Group::Regular; - state->dataMaterial->Material(3)->group = Material::Group::Regular; + + auto *mat1 = new Material::MaterialBase; + mat1->group = Material::Group::Regular; + s_mat->materials.push_back(mat1); + + auto *mat2 = new Material::MaterialBase; + mat2->group = Material::Group::Regular; + s_mat->materials.push_back(mat2); + + auto *mat3 = new Material::MaterialBase; + mat3->group = Material::Group::Regular; + s_mat->materials.push_back(mat3); + RevLayerDiffs = false; // ExpectResult = true; CheckForReversedLayers(*state, RevLayerDiffs, 1, 2, 3); @@ -5143,46 +5157,52 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) state->dataConstruction->Construct(4).LayerPoint(1) = 4; state->dataConstruction->Construct(4).LayerPoint(2) = 2; state->dataConstruction->Construct(4).LayerPoint(3) = 5; - auto *thisMaterial_4 = dynamic_cast(state->dataMaterial->Material(4)); - thisMaterial_4->group = Material::Group::WindowGlass; - thisMaterial_4->Thickness = 0.15; - thisMaterial_4->ReflectSolBeamFront = 0.35; - thisMaterial_4->ReflectSolBeamBack = 0.25; - thisMaterial_4->TransVis = 0.45; - thisMaterial_4->ReflectVisBeamFront = 0.34; - thisMaterial_4->ReflectVisBeamBack = 0.24; - thisMaterial_4->TransThermal = 0.44; - thisMaterial_4->AbsorpThermalFront = 0.33; - thisMaterial_4->AbsorpThermalBack = 0.23; - thisMaterial_4->Conductivity = 0.43; - thisMaterial_4->GlassTransDirtFactor = 0.67; - thisMaterial_4->SolarDiffusing = true; - thisMaterial_4->YoungModulus = 0.89; - thisMaterial_4->PoissonsRatio = 1.11; - auto *thisMaterial_5 = dynamic_cast(state->dataMaterial->Material(5)); - thisMaterial_5->group = Material::Group::WindowGlass; - thisMaterial_5->Thickness = 0.15; - thisMaterial_5->ReflectSolBeamFront = 0.25; - thisMaterial_5->ReflectSolBeamBack = 0.35; - thisMaterial_5->TransVis = 0.45; - thisMaterial_5->ReflectVisBeamFront = 0.24; - thisMaterial_5->ReflectVisBeamBack = 0.34; - thisMaterial_5->TransThermal = 0.44; - thisMaterial_5->AbsorpThermalFront = 0.23; - thisMaterial_5->AbsorpThermalBack = 0.33; - thisMaterial_5->Conductivity = 0.43; - thisMaterial_5->GlassTransDirtFactor = 0.67; - thisMaterial_5->SolarDiffusing = true; - thisMaterial_5->YoungModulus = 0.89; - thisMaterial_5->PoissonsRatio = 1.11; + + auto *mat4 = new Material::MaterialGlass; + mat4->group = Material::Group::Glass; + s_mat->materials.push_back(mat4); + + mat4->Thickness = 0.15; + mat4->ReflectSolBeamFront = 0.35; + mat4->ReflectSolBeamBack = 0.25; + mat4->TransVis = 0.45; + mat4->ReflectVisBeamFront = 0.34; + mat4->ReflectVisBeamBack = 0.24; + mat4->TransThermal = 0.44; + mat4->AbsorpThermalFront = 0.33; + mat4->AbsorpThermalBack = 0.23; + mat4->Conductivity = 0.43; + mat4->GlassTransDirtFactor = 0.67; + mat4->SolarDiffusing = true; + mat4->YoungModulus = 0.89; + mat4->PoissonsRatio = 1.11; + + auto *mat5 = new Material::MaterialGlass; + mat5->group = Material::Group::Glass; + s_mat->materials.push_back(mat5); + + mat5->Thickness = 0.15; + mat5->ReflectSolBeamFront = 0.25; + mat5->ReflectSolBeamBack = 0.35; + mat5->TransVis = 0.45; + mat5->ReflectVisBeamFront = 0.24; + mat5->ReflectVisBeamBack = 0.34; + mat5->TransThermal = 0.44; + mat5->AbsorpThermalFront = 0.23; + mat5->AbsorpThermalBack = 0.33; + mat5->Conductivity = 0.43; + mat5->GlassTransDirtFactor = 0.67; + mat5->SolarDiffusing = true; + mat5->YoungModulus = 0.89; + mat5->PoissonsRatio = 1.11; RevLayerDiffs = true; // ExpectResult = false; 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) - thisMaterial_5->ReflectVisBeamFront = 0.34; // correct would be 0.24 - thisMaterial_5->ReflectVisBeamBack = 0.24; // correct would be 0.34 + mat5->ReflectVisBeamFront = 0.34; // correct would be 0.24 + mat5->ReflectVisBeamBack = 0.24; // correct would be 0.34 RevLayerDiffs = false; // ExpectResult = true; CheckForReversedLayers(*state, RevLayerDiffs, 3, 4, 3); @@ -5193,69 +5213,74 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) state->dataConstruction->Construct(5).LayerPoint(1) = 6; state->dataConstruction->Construct(6).TotLayers = 1; state->dataConstruction->Construct(6).LayerPoint(1) = 7; - auto *thisMaterial_6 = dynamic_cast(state->dataMaterial->Material(6)); - thisMaterial_6->group = Material::Group::GlassEquivalentLayer; - thisMaterial_6->TausFrontBeamBeam = 0.39; - thisMaterial_6->TausBackBeamBeam = 0.29; - thisMaterial_6->ReflFrontBeamBeam = 0.38; - thisMaterial_6->ReflBackBeamBeam = 0.28; - thisMaterial_6->TausFrontBeamBeamVis = 0.37; - thisMaterial_6->TausBackBeamBeamVis = 0.27; - thisMaterial_6->ReflFrontBeamBeamVis = 0.36; - thisMaterial_6->ReflBackBeamBeamVis = 0.26; - thisMaterial_6->TausFrontBeamDiff = 0.35; - thisMaterial_6->TausBackBeamDiff = 0.25; - thisMaterial_6->ReflFrontBeamDiff = 0.34; - thisMaterial_6->ReflBackBeamDiff = 0.24; - thisMaterial_6->TausFrontBeamDiffVis = 0.33; - thisMaterial_6->TausBackBeamDiffVis = 0.23; - thisMaterial_6->ReflFrontBeamDiffVis = 0.32; - thisMaterial_6->ReflBackBeamDiffVis = 0.22; - thisMaterial_6->TausDiffDiff = 0.456; - thisMaterial_6->ReflFrontDiffDiff = 0.31; - thisMaterial_6->ReflBackDiffDiff = 0.21; - thisMaterial_6->TausDiffDiffVis = 0.345; - thisMaterial_6->ReflFrontDiffDiffVis = 0.30; - thisMaterial_6->ReflBackDiffDiffVis = 0.20; - thisMaterial_6->TausThermal = 0.234; - thisMaterial_6->EmissThermalFront = 0.888; - thisMaterial_6->EmissThermalBack = 0.777; - thisMaterial_6->Resistance = 1.234; - auto *thisMaterial_7 = dynamic_cast(state->dataMaterial->Material(7)); - thisMaterial_7->group = Material::Group::GlassEquivalentLayer; - thisMaterial_7->TausFrontBeamBeam = 0.29; - thisMaterial_7->TausBackBeamBeam = 0.39; - thisMaterial_7->ReflFrontBeamBeam = 0.28; - thisMaterial_7->ReflBackBeamBeam = 0.38; - thisMaterial_7->TausFrontBeamBeamVis = 0.27; - thisMaterial_7->TausBackBeamBeamVis = 0.37; - thisMaterial_7->ReflFrontBeamBeamVis = 0.26; - thisMaterial_7->ReflBackBeamBeamVis = 0.36; - thisMaterial_7->TausFrontBeamDiff = 0.25; - thisMaterial_7->TausBackBeamDiff = 0.35; - thisMaterial_7->ReflFrontBeamDiff = 0.24; - thisMaterial_7->ReflBackBeamDiff = 0.34; - thisMaterial_7->TausFrontBeamDiffVis = 0.23; - thisMaterial_7->TausBackBeamDiffVis = 0.33; - thisMaterial_7->ReflFrontBeamDiffVis = 0.22; - thisMaterial_7->ReflBackBeamDiffVis = 0.32; - thisMaterial_7->TausDiffDiff = 0.456; - thisMaterial_7->ReflFrontDiffDiff = 0.21; - thisMaterial_7->ReflBackDiffDiff = 0.31; - thisMaterial_7->TausDiffDiffVis = 0.345; - thisMaterial_7->ReflFrontDiffDiffVis = 0.20; - thisMaterial_7->ReflBackDiffDiffVis = 0.30; - thisMaterial_7->TausThermal = 0.234; - thisMaterial_7->EmissThermalFront = 0.777; - thisMaterial_7->EmissThermalBack = 0.888; - thisMaterial_7->Resistance = 1.234; + + auto *mat6 = new Material::MaterialGlassEQL; + mat6->group = Material::Group::GlassEQL; + s_mat->materials.push_back(mat6); + mat6->TAR.Sol.Ft.Bm[0].BmTra = 0.39; + mat6->TAR.Sol.Bk.Bm[0].BmTra = 0.29; + mat6->TAR.Sol.Ft.Bm[0].BmRef = 0.38; + mat6->TAR.Sol.Bk.Bm[0].BmRef = 0.28; + mat6->TAR.Vis.Ft.Bm[0].BmTra = 0.37; + mat6->TAR.Vis.Bk.Bm[0].BmTra = 0.27; + mat6->TAR.Vis.Ft.Bm[0].BmRef = 0.36; + mat6->TAR.Vis.Bk.Bm[0].BmRef = 0.26; + mat6->TAR.Sol.Ft.Bm[0].DfTra = 0.35; + mat6->TAR.Sol.Bk.Bm[0].DfTra = 0.25; + mat6->TAR.Sol.Ft.Bm[0].DfRef = 0.34; + mat6->TAR.Sol.Bk.Bm[0].DfRef = 0.24; + mat6->TAR.Vis.Ft.Bm[0].DfTra = 0.33; + mat6->TAR.Vis.Bk.Bm[0].DfTra = 0.23; + mat6->TAR.Vis.Ft.Bm[0].DfRef = 0.32; + mat6->TAR.Vis.Bk.Bm[0].DfRef = 0.22; + mat6->TAR.Sol.Ft.Df.Tra = 0.456; + mat6->TAR.Sol.Ft.Df.Ref = 0.31; + mat6->TAR.Sol.Bk.Df.Ref = 0.21; + mat6->TAR.Vis.Ft.Df.Tra = 0.345; + mat6->TAR.Vis.Ft.Df.Ref = 0.30; + mat6->TAR.Vis.Bk.Df.Ref = 0.20; + mat6->TAR.IR.Ft.Tra = 0.234; + mat6->TAR.IR.Ft.Emi = 0.888; + mat6->TAR.IR.Bk.Emi = 0.777; + mat6->Resistance = 1.234; + + auto *mat7 = new Material::MaterialGlassEQL; + mat7->group = Material::Group::GlassEQL; + s_mat->materials.push_back(mat7); + + mat7->TAR.Sol.Ft.Bm[0].BmTra = 0.29; + mat7->TAR.Sol.Bk.Bm[0].BmTra = 0.39; + mat7->TAR.Sol.Ft.Bm[0].BmRef = 0.28; + mat7->TAR.Sol.Bk.Bm[0].BmRef = 0.38; + mat7->TAR.Vis.Ft.Bm[0].BmTra = 0.27; + mat7->TAR.Vis.Bk.Bm[0].BmTra = 0.37; + mat7->TAR.Vis.Ft.Bm[0].BmRef = 0.26; + mat7->TAR.Vis.Bk.Bm[0].BmRef = 0.36; + mat7->TAR.Sol.Ft.Bm[0].DfTra = 0.25; + mat7->TAR.Sol.Bk.Bm[0].DfTra = 0.35; + mat7->TAR.Sol.Ft.Bm[0].DfRef = 0.24; + mat7->TAR.Sol.Bk.Bm[0].DfRef = 0.34; + mat7->TAR.Vis.Ft.Bm[0].DfTra = 0.23; + mat7->TAR.Vis.Bk.Bm[0].DfTra = 0.33; + mat7->TAR.Vis.Ft.Bm[0].DfRef = 0.22; + mat7->TAR.Vis.Bk.Bm[0].DfRef = 0.32; + mat7->TAR.Sol.Ft.Df.Tra = 0.456; + mat7->TAR.Sol.Ft.Df.Ref = 0.21; + mat7->TAR.Sol.Bk.Df.Ref = 0.31; + mat7->TAR.Vis.Ft.Df.Tra = 0.345; + mat7->TAR.Vis.Ft.Df.Ref = 0.20; + mat7->TAR.Vis.Bk.Df.Ref = 0.30; + mat7->TAR.IR.Ft.Tra = 0.234; + mat7->TAR.IR.Ft.Emi = 0.777; + mat7->TAR.IR.Bk.Emi = 0.888; + mat7->Resistance = 1.234; RevLayerDiffs = true; // ExpectResult = false; 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) - thisMaterial_7->EmissThermalFront = 0.888; + mat7->TAR.IR.Ft.Emi = 0.888; RevLayerDiffs = false; // ExpectResult = true; CheckForReversedLayers(*state, RevLayerDiffs, 5, 6, 1); @@ -12197,17 +12222,14 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_ZoneAndSpaceAreas) // Space 2 has a floor surface of area 2.0, user-entered floor area is blank EXPECT_EQ(state->dataHeatBal->space(1).Name, "SPACE 1A"); EXPECT_NEAR(state->dataHeatBal->space(1).userEnteredFloorArea, Constant::AutoCalculate, 0.001); - EXPECT_NEAR(state->dataHeatBal->space(1).calcFloorArea, 1.0, 0.001); EXPECT_NEAR(state->dataHeatBal->space(1).FloorArea, 10.0, 0.001); EXPECT_EQ(state->dataHeatBal->space(2).Name, "SPACE 1B"); EXPECT_NEAR(state->dataHeatBal->space(2).userEnteredFloorArea, Constant::AutoCalculate, 0.001); - EXPECT_NEAR(state->dataHeatBal->space(2).calcFloorArea, 2.0, 0.001); EXPECT_NEAR(state->dataHeatBal->space(2).FloorArea, 20.0, 0.001); EXPECT_EQ(state->dataHeatBal->Zone(1).Name, "ZONE 1"); EXPECT_NEAR(state->dataHeatBal->Zone(1).UserEnteredFloorArea, 30.0, 0.001); - EXPECT_NEAR(state->dataHeatBal->Zone(1).CalcFloorArea, 3.0, 0.001); EXPECT_NEAR(state->dataHeatBal->Zone(1).FloorArea, 30.0, 0.001); Real64 zone1Area = state->dataHeatBal->space(1).FloorArea + state->dataHeatBal->space(2).FloorArea; EXPECT_NEAR(state->dataHeatBal->Zone(1).FloorArea, zone1Area, 0.001); @@ -12216,22 +12238,18 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_ZoneAndSpaceAreas) // Space 3 has a floor surface of area 1.0, user-entered floor is 5.0 EXPECT_EQ(state->dataHeatBal->Zone(3).Name, "ZONE 3"); EXPECT_NEAR(state->dataHeatBal->Zone(3).UserEnteredFloorArea, Constant::AutoCalculate, 0.001); - EXPECT_NEAR(state->dataHeatBal->Zone(3).CalcFloorArea, 5.0, 0.001); EXPECT_NEAR(state->dataHeatBal->Zone(3).FloorArea, 5.0, 0.001); EXPECT_EQ(state->dataHeatBal->space(3).Name, "SPACE 3"); EXPECT_NEAR(state->dataHeatBal->space(3).userEnteredFloorArea, 5.0, 0.001); - EXPECT_NEAR(state->dataHeatBal->space(3).calcFloorArea, 1.0, 0.001); EXPECT_NEAR(state->dataHeatBal->space(3).FloorArea, 5.0, 0.001); // Zone 2 consists of auto-generated Space 4, user-entered floor area is 20.0 // Space 4 has a floor surface of area 1.0, user-entered floor is blank EXPECT_EQ(state->dataHeatBal->Zone(2).Name, "ZONE 2"); EXPECT_NEAR(state->dataHeatBal->Zone(2).UserEnteredFloorArea, 20.0, 0.001); - EXPECT_NEAR(state->dataHeatBal->Zone(2).CalcFloorArea, 1.0, 0.001); EXPECT_NEAR(state->dataHeatBal->Zone(2).FloorArea, 20.0, 0.001); EXPECT_EQ(state->dataHeatBal->space(4).Name, "ZONE 2"); EXPECT_NEAR(state->dataHeatBal->space(4).userEnteredFloorArea, Constant::AutoCalculate, 0.001); - EXPECT_NEAR(state->dataHeatBal->space(4).calcFloorArea, 1.0, 0.001); EXPECT_NEAR(state->dataHeatBal->space(4).FloorArea, 20.0, 0.001); } @@ -12393,7 +12411,6 @@ TEST_F(EnergyPlusFixture, ZoneFloorAreaTest) EXPECT_FALSE(ErrorsFound); // expect no errors EXPECT_NEAR(state->dataHeatBal->Zone(1).FloorArea, 1.0, 0.001); - EXPECT_NEAR(state->dataHeatBal->Zone(1).CalcFloorArea, 1.0, 0.001); } TEST_F(EnergyPlusFixture, SurfaceGeometry_GetSurfaceGroundSurfsTest) @@ -13171,7 +13188,6 @@ TEST_F(EnergyPlusFixture, CalculateZoneVolume_WithAirBoundaries) auto const &zone3 = state->dataHeatBal->Zone(3); EXPECT_EQ(zone1.UserEnteredFloorArea, -99999.0); - EXPECT_EQ(zone1.CalcFloorArea, 0.0); EXPECT_EQ(zone1.FloorArea, 0.0); EXPECT_EQ(zone1.geometricFloorArea, 1.0); EXPECT_FALSE(zone1.HasFloor); @@ -13182,7 +13198,6 @@ TEST_F(EnergyPlusFixture, CalculateZoneVolume_WithAirBoundaries) EXPECT_EQ(zone1.Volume, 2.0); EXPECT_EQ(zone2.UserEnteredFloorArea, -99999.0); - EXPECT_EQ(zone2.CalcFloorArea, 1.0); EXPECT_EQ(zone2.FloorArea, 1.0); EXPECT_EQ(zone2.geometricFloorArea, 1.0); EXPECT_TRUE(zone2.HasFloor); @@ -13193,7 +13208,6 @@ TEST_F(EnergyPlusFixture, CalculateZoneVolume_WithAirBoundaries) EXPECT_EQ(zone2.Volume, 2.0); EXPECT_EQ(zone3.UserEnteredFloorArea, -99999.0); - EXPECT_EQ(zone3.CalcFloorArea, 4.0); EXPECT_EQ(zone3.FloorArea, 4.0); EXPECT_EQ(zone3.geometricFloorArea, 4.0); EXPECT_TRUE(zone3.HasFloor); @@ -13398,7 +13412,6 @@ TEST_F(EnergyPlusFixture, CalculatZoneVolume_WithoutAirBoundaries) auto const &zone3 = state->dataHeatBal->Zone(3); EXPECT_EQ(zone1.UserEnteredFloorArea, -99999.0); - EXPECT_EQ(zone1.CalcFloorArea, 1.0); EXPECT_EQ(zone1.FloorArea, 1.0); EXPECT_EQ(zone1.geometricFloorArea, 1.0); EXPECT_TRUE(zone1.HasFloor); @@ -13409,7 +13422,6 @@ TEST_F(EnergyPlusFixture, CalculatZoneVolume_WithoutAirBoundaries) EXPECT_EQ(zone1.Volume, 2.0); EXPECT_EQ(zone2.UserEnteredFloorArea, -99999.0); - EXPECT_EQ(zone2.CalcFloorArea, 1.0); EXPECT_EQ(zone2.FloorArea, 1.0); EXPECT_EQ(zone2.geometricFloorArea, 1.0); EXPECT_TRUE(zone2.HasFloor); @@ -13420,7 +13432,6 @@ TEST_F(EnergyPlusFixture, CalculatZoneVolume_WithoutAirBoundaries) EXPECT_EQ(zone2.Volume, 2.0); EXPECT_EQ(zone3.UserEnteredFloorArea, -99999.0); - EXPECT_EQ(zone3.CalcFloorArea, 4.0); EXPECT_EQ(zone3.FloorArea, 4.0); EXPECT_EQ(zone3.geometricFloorArea, 4.0); EXPECT_TRUE(zone3.HasFloor); diff --git a/tst/EnergyPlus/unit/ThermalChimney.unit.cc b/tst/EnergyPlus/unit/ThermalChimney.unit.cc index c978752aeaa..1d5c6e9cf51 100644 --- a/tst/EnergyPlus/unit/ThermalChimney.unit.cc +++ b/tst/EnergyPlus/unit/ThermalChimney.unit.cc @@ -1121,7 +1121,7 @@ TEST_F(EnergyPlusFixture, ThermalChimney_EMSAirflow_Test) EXPECT_FALSE(localErrorsFound); HeatBalanceManager::GetZoneData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(*state, localErrorsFound); + Material::GetWindowGlassSpectralData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); Material::GetMaterialData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 741c2a7d0dd..a1cc7eebea8 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -16203,7 +16203,7 @@ Dimensionless; !- Output Unit Type EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); + Material::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc b/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc index 4870a46650d..f139375a41e 100644 --- a/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc +++ b/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc @@ -180,17 +180,14 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_GetInput) Material::GetMaterialData(*state, ErrorsFound); HeatBalanceManager::GetConstructData(*state, ErrorsFound); - int VBMatNum(0); - for (int i = 1; i <= 4; i++) { - if (state->dataMaterial->Material(i)->group == Material::Group::BlindEquivalentLayer) { - VBMatNum = i; - break; - } - } - auto const *thisMaterial = dynamic_cast(state->dataMaterial->Material(VBMatNum)); - EXPECT_EQ(1, state->dataHeatBal->TotBlindsEQL); - EXPECT_ENUM_EQ(thisMaterial->group, Material::Group::BlindEquivalentLayer); - EXPECT_EQ(static_cast(thisMaterial->slatAngleType), state->dataWindowEquivalentLayer->lscVBNOBM); + EXPECT_EQ(1, state->dataMaterial->NumEQLBlinds); + int VBMatNum = Material::GetMaterialNum(*state, "VBU8D6+45SW1"); + + auto const *mat = state->dataMaterial->materials(VBMatNum); + EXPECT_ENUM_EQ(mat->group, Material::Group::BlindEQL); + + auto const *matVenetBlind = dynamic_cast(mat); + EXPECT_EQ(static_cast(matVenetBlind->slatAngleType), state->dataWindowEquivalentLayer->lscVBNOBM); int ConstrNum = 1; int EQLNum = 0; @@ -204,7 +201,6 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBMaximizeBeamSolar) { // GitHub issue 5750 int SurfNum(0); - int VBMatNum(0); Real64 ProfAngVer(0); static Array2D AbsSolBeam(2, CFSMAXNL + 1); @@ -543,30 +539,25 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBMaximizeBeamSolar) break; } } + // get venetian blind material index - for (int i = 1; i <= 7; i++) { - if (state->dataMaterial->Material(i)->group == Material::Group::BlindEquivalentLayer) { - VBMatNum = i; - break; - } - } - auto const *thisMaterial = dynamic_cast(state->dataMaterial->Material(VBMatNum)); + int VBMatNum = Material::GetMaterialNum(*state, "VBU8D6+45SW1"); + auto const *matVenetBlind = dynamic_cast(state->dataMaterial->materials(VBMatNum)); // get equivalent layer window optical properties CalcEQLOpticalProperty(*state, SurfNum, DataWindowEquivalentLayer::SolarArrays::BEAM, AbsSolBeam); // check that the slat angle control type is set to MaximizeSolar - EXPECT_EQ(static_cast(thisMaterial->slatAngleType), state->dataWindowEquivalentLayer->lscVBPROF); + EXPECT_EQ(static_cast(matVenetBlind->slatAngleType), state->dataWindowEquivalentLayer->lscVBPROF); // check the slat angle - EXPECT_NEAR(-71.0772, state->dataSurface->SurfWinSlatAngThisTSDeg(SurfNum), 0.0001); + EXPECT_NEAR(-71.0772, state->dataSurface->surfShades(SurfNum).blind.slatAngDeg, 0.0001); // check that for MaximizeSolar slat angle control, the slat angle = -ve vertical profile angle ProfAngVer = Dayltg::ProfileAngle(*state, SurfNum, state->dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Horizontal); - EXPECT_NEAR(-Constant::RadToDeg * ProfAngVer, state->dataSurface->SurfWinSlatAngThisTSDeg(SurfNum), 0.0001); + EXPECT_NEAR(-Constant::RadToDeg * ProfAngVer, state->dataSurface->surfShades(SurfNum).blind.slatAngDeg, 0.0001); } TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBBlockBeamSolar) { // GitHub issue 5750 int SurfNum(0); - int VBMatNum(0); Real64 ProfAngVer(0); static Array2D AbsSolBeam(2, CFSMAXNL + 1); @@ -906,25 +897,20 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBBlockBeamSolar) } } // get venetian blind material index - for (int i = 1; i <= 7; i++) { - if (state->dataMaterial->Material(i)->group == Material::Group::BlindEquivalentLayer) { - VBMatNum = i; - break; - } - } - auto const *thisMaterial = dynamic_cast(state->dataMaterial->Material(VBMatNum)); + int VBMatNum = Material::GetMaterialNum(*state, "VBU8D6+45SW1"); + auto const *matVenetBlind = dynamic_cast(state->dataMaterial->materials(VBMatNum)); // calc window optical property CalcEQLOpticalProperty(*state, SurfNum, DataWindowEquivalentLayer::SolarArrays::BEAM, AbsSolBeam); // check VB slat angle for BlockBeamSolar slat angle control - EXPECT_EQ(static_cast(thisMaterial->slatAngleType), state->dataWindowEquivalentLayer->lscVBNOBM); + EXPECT_EQ(static_cast(matVenetBlind->slatAngleType), state->dataWindowEquivalentLayer->lscVBNOBM); // check the VB slat angle - EXPECT_NEAR(18.9228, state->dataSurface->SurfWinSlatAngThisTSDeg(SurfNum), 0.0001); + EXPECT_NEAR(18.9228, state->dataSurface->surfShades(SurfNum).blind.slatAngDeg, 0.0001); // check that for BlockBeamSolar slat angle control, the slat angle = 90 - ProfAngVer ProfAngVer = Dayltg::ProfileAngle(*state, SurfNum, state->dataEnvrn->SOLCOS, DataWindowEquivalentLayer::Orientation::Horizontal); - EXPECT_NEAR(90.0 - Constant::RadToDeg * ProfAngVer, state->dataSurface->SurfWinSlatAngThisTSDeg(SurfNum), 0.0001); + EXPECT_NEAR(90.0 - Constant::RadToDeg * ProfAngVer, state->dataSurface->surfShades(SurfNum).blind.slatAngDeg, 0.0001); // get the slat angle from profile angle Real64 SlateAngleBlockBeamSolar = VB_CriticalSlatAngle(Constant::RadToDeg * ProfAngVer); - EXPECT_NEAR(SlateAngleBlockBeamSolar, state->dataSurface->SurfWinSlatAngThisTSDeg(SurfNum), 0.0001); + EXPECT_NEAR(SlateAngleBlockBeamSolar, state->dataSurface->surfShades(SurfNum).blind.slatAngDeg, 0.0001); } TEST_F(EnergyPlusFixture, WindowEquivalentLayer_InvalidLayerTest) @@ -948,8 +934,7 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_InvalidLayerTest) Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - EXPECT_EQ(1, state->dataMaterial->TotMaterials); - EXPECT_ENUM_EQ(state->dataMaterial->Material(1)->group, Material::Group::WindowSimpleGlazing); + EXPECT_ENUM_EQ(state->dataMaterial->materials(1)->group, Material::Group::GlassSimple); // get construction returns error forund true due to invalid layer GetConstructData(*state, ErrorsFound); EXPECT_EQ(1, state->dataHeatBal->TotConstructs); @@ -1977,7 +1962,6 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBEffectiveEmissivityTest) int EQLNum(0); int SurfNum(0); - int VBMatNum(0); int ConstrNum(0); for (int iSurf = 1; iSurf <= state->dataSurface->TotSurfaces; iSurf++) { @@ -1987,13 +1971,8 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBEffectiveEmissivityTest) } } // get venetian blind material index - for (int i = 1; i <= state->dataMaterial->TotMaterials; i++) { - if (state->dataMaterial->Material(i)->group == Material::Group::BlindEquivalentLayer) { - VBMatNum = i; - break; - } - } - auto const *thisMaterial = dynamic_cast(state->dataMaterial->Material(VBMatNum)); + int VBMatNum = Material::GetMaterialNum(*state, "WMTEUQL_BLND_KINDV_RF80_T02_A18_Rb45"); + auto const *matVenetBlind = dynamic_cast(state->dataMaterial->materials(VBMatNum)); // get equivalent layer window contruction index for (int ConstrPtr = 1; ConstrPtr <= state->dataHeatBal->TotConstructs; ++ConstrPtr) { if (state->dataConstruction->Construct(ConstrPtr).WindowTypeEQL) { @@ -2001,7 +1980,7 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBEffectiveEmissivityTest) } } // check VB slat angle control for FixedSlatAngle - EXPECT_EQ(static_cast(thisMaterial->slatAngleType), state->dataWindowEquivalentLayer->lscNONE); + EXPECT_EQ(static_cast(matVenetBlind->slatAngleType), state->dataWindowEquivalentLayer->lscNONE); EQLNum = state->dataConstruction->Construct(ConstrNum).EQLConsPtr; // check number of solid layers diff --git a/tst/EnergyPlus/unit/WindowManager.unit.cc b/tst/EnergyPlus/unit/WindowManager.unit.cc index 3dec455a767..c7fc9400de5 100644 --- a/tst/EnergyPlus/unit/WindowManager.unit.cc +++ b/tst/EnergyPlus/unit/WindowManager.unit.cc @@ -2502,7 +2502,7 @@ TEST_F(EnergyPlusFixture, SpectralAngularPropertyTest) Curve::GetCurveInput(*state); state->dataCurveManager->GetCurvesInputFlag = false; - HeatBalanceManager::GetWindowGlassSpectralData(*state, FoundError); + Material::GetWindowGlassSpectralData(*state, FoundError); EXPECT_FALSE(FoundError); Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -3020,7 +3020,7 @@ TEST_F(EnergyPlusFixture, WindowManager_CalcNominalWindowCondAdjRatioTest) Real64 NominalConductanceSummer; MaterNum = state->dataConstruction->Construct(ConstrNum).LayerPoint(1); - auto *thisMaterial = dynamic_cast(state->dataMaterial->Material(MaterNum)); + auto *thisMaterial = dynamic_cast(state->dataMaterial->materials(MaterNum)); // summer, adj ratio should stay the same, only change for winter state->dataHeatBal->CoeffAdjRatio(ConstrNum) = 1.5; CalcNominalWindowCond(*state, ConstrNum, 2, NominalConductanceSummer, SHGC, TransSolNorm, TransVisNorm, errFlag); @@ -3031,7 +3031,7 @@ TEST_F(EnergyPlusFixture, WindowManager_CalcNominalWindowCondAdjRatioTest) std::array legalInputUs = {3.0, 5.0, 7.0}; for (auto varyInputU : legalInputUs) { thisMaterial->SimpleWindowUfactor = varyInputU; - HeatBalanceManager::SetupSimpleWindowGlazingSystem(*state, MaterNum); + thisMaterial->SetupSimpleWindowGlazingSystem(*state); state->dataWindowManager->scon[0] = thisMaterial->Conductivity / thisMaterial->Thickness; CalcNominalWindowCond(*state, ConstrNum, 1, NominalConductanceWinter, SHGC, TransSolNorm, TransVisNorm, errFlag); EXPECT_NEAR(NominalConductanceWinter, varyInputU, 0.01); @@ -3076,24 +3076,29 @@ TEST_F(EnergyPlusFixture, WindowMaterialComplexShadeTest) bool errors_found = false; Material::GetMaterialData(*state, errors_found); EXPECT_FALSE(errors_found); - EXPECT_EQ(state->dataMaterial->ComplexShade(1).Name, "SHADE_14_LAYER"); - EXPECT_ENUM_EQ(state->dataMaterial->ComplexShade(1).LayerType, TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).Thickness, 1.016000e-003, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).Conductivity, 1.592276e+002, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).IRTransmittance, 0, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).FrontEmissivity, 0.9, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).BackEmissivity, 0.9, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).TopOpeningMultiplier, 0, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).BottomOpeningMultiplier, 0, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).LeftOpeningMultiplier, 0, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).RightOpeningMultiplier, 0, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).FrontOpeningMultiplier, 5.000000e-002, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).SlatWidth, 0.0254, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).SlatSpacing, 0.0201, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).SlatThickness, 0.0010, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).SlatAngle, 45.0, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).SlatConductivity, 159.2276, 1e-5); - EXPECT_NEAR(state->dataMaterial->ComplexShade(1).SlatCurve, 0, 1e-5); + + auto &s_mat = state->dataMaterial; + auto const *matComplexShade = dynamic_cast(s_mat->materials(1)); + assert(matComplexShade != nullptr); + + EXPECT_EQ(matComplexShade->Name, "SHADE_14_LAYER"); + EXPECT_ENUM_EQ(matComplexShade->LayerType, TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ); + EXPECT_NEAR(matComplexShade->Thickness, 1.016000e-003, 1e-5); + EXPECT_NEAR(matComplexShade->Conductivity, 1.592276e+002, 1e-5); + EXPECT_NEAR(matComplexShade->TransThermal, 0, 1e-5); + EXPECT_NEAR(matComplexShade->FrontEmissivity, 0.9, 1e-5); + EXPECT_NEAR(matComplexShade->BackEmissivity, 0.9, 1e-5); + EXPECT_NEAR(matComplexShade->topOpeningMult, 0, 1e-5); + EXPECT_NEAR(matComplexShade->bottomOpeningMult, 0, 1e-5); + EXPECT_NEAR(matComplexShade->leftOpeningMult, 0, 1e-5); + EXPECT_NEAR(matComplexShade->rightOpeningMult, 0, 1e-5); + EXPECT_NEAR(matComplexShade->frontOpeningMult, 5.000000e-002, 1e-5); + EXPECT_NEAR(matComplexShade->SlatWidth, 0.0254, 1e-5); + EXPECT_NEAR(matComplexShade->SlatSpacing, 0.0201, 1e-5); + EXPECT_NEAR(matComplexShade->SlatThickness, 0.0010, 1e-5); + EXPECT_NEAR(matComplexShade->SlatAngle, 45.0, 1e-5); + EXPECT_NEAR(matComplexShade->SlatConductivity, 159.2276, 1e-5); + EXPECT_NEAR(matComplexShade->SlatCurve, 0, 1e-5); } TEST_F(EnergyPlusFixture, SetupComplexWindowStateGeometry_Test) diff --git a/tst/EnergyPlus/unit/WindowManagerExteriorThermal.unit.cc b/tst/EnergyPlus/unit/WindowManagerExteriorThermal.unit.cc index ac0e5b9107e..04b4ec8b74f 100644 --- a/tst/EnergyPlus/unit/WindowManagerExteriorThermal.unit.cc +++ b/tst/EnergyPlus/unit/WindowManagerExteriorThermal.unit.cc @@ -76,6 +76,7 @@ using namespace EnergyPlus::Window; TEST_F(EnergyPlusFixture, test_overallUfactorFromFilmsAndCond) { + auto &s_mat = state->dataMaterial; // set up for using CWCEHeatTransferFactory int numSurf = 1; state->dataSurface->Surface.allocate(numSurf); @@ -92,12 +93,10 @@ TEST_F(EnergyPlusFixture, test_overallUfactorFromFilmsAndCond) state->dataConstruction->Construct(numCons).LayerPoint(numLayers) = materialInside; state->dataConstruction->Construct(numCons).AbsDiff.allocate(2); int numMaterials = materialInside; - for (int i = 1; i <= numMaterials; i++) { - Material::MaterialBase *p = new Material::MaterialBase; - state->dataMaterial->Material.push_back(p); - } - state->dataMaterial->Material(materialOutside)->group = Material::Group::WindowGlass; - state->dataMaterial->Material(materialInside)->group = Material::Group::WindowGlass; + + s_mat->materials.push_back(new Material::MaterialGlass); + s_mat->materials.push_back(new Material::MaterialGlass); + auto aFactory = CWCEHeatTransferFactory(*state, state->dataSurface->Surface(numSurf), numSurf, numCons); double hIntConvCoeff = 0.; @@ -132,6 +131,7 @@ TEST_F(EnergyPlusFixture, test_overallUfactorFromFilmsAndCond) TEST_F(EnergyPlusFixture, test_getOutdoorNfrc) { + auto &s_mat = state->dataMaterial; // set up for using CWCEHeatTransferFactory int numSurf = 1; state->dataSurface->Surface.allocate(numSurf); @@ -148,12 +148,12 @@ TEST_F(EnergyPlusFixture, test_getOutdoorNfrc) state->dataConstruction->Construct(numCons).LayerPoint(numLayers) = materialInside; state->dataConstruction->Construct(numCons).AbsDiff.allocate(2); int numMaterials = materialInside; - for (int i = 1; i <= numMaterials; i++) { - Material::MaterialBase *p = new Material::MaterialBase; - state->dataMaterial->Material.push_back(p); - } - state->dataMaterial->Material(materialOutside)->group = Material::Group::WindowGlass; - state->dataMaterial->Material(materialInside)->group = Material::Group::WindowGlass; + + auto *matOutside = new Material::MaterialGlass; + s_mat->materials.push_back(matOutside); + auto *matInside = new Material::MaterialGlass; + s_mat->materials.push_back(matInside); + auto aFactory = CWCEHeatTransferFactory(*state, state->dataSurface->Surface(numSurf), numSurf, numCons); auto indoor = aFactory.getOutdoorNfrc(true); @@ -167,6 +167,7 @@ TEST_F(EnergyPlusFixture, test_getOutdoorNfrc) TEST_F(EnergyPlusFixture, test_getIndoorNfrc) { + auto &s_mat = state->dataMaterial; // set up for using CWCEHeatTransferFactory int numSurf = 1; state->dataSurface->Surface.allocate(numSurf); @@ -182,13 +183,9 @@ TEST_F(EnergyPlusFixture, test_getIndoorNfrc) state->dataConstruction->Construct(numCons).LayerPoint(1) = materialOutside; state->dataConstruction->Construct(numCons).LayerPoint(numLayers) = materialInside; state->dataConstruction->Construct(numCons).AbsDiff.allocate(2); - int numMaterials = materialInside; - for (int i = 1; i <= numMaterials; i++) { - Material::MaterialBase *p = new Material::MaterialBase; - state->dataMaterial->Material.push_back(p); - } - state->dataMaterial->Material(materialOutside)->group = Material::Group::WindowGlass; - state->dataMaterial->Material(materialInside)->group = Material::Group::WindowGlass; + s_mat->materials.push_back(new Material::MaterialGlass); + s_mat->materials.push_back(new Material::MaterialGlass); + auto aFactory = CWCEHeatTransferFactory(*state, state->dataSurface->Surface(numSurf), numSurf, numCons); auto indoor = aFactory.getIndoorNfrc(true); @@ -200,6 +197,7 @@ TEST_F(EnergyPlusFixture, test_getIndoorNfrc) TEST_F(EnergyPlusFixture, test_getShadeType) { + auto &s_mat = state->dataMaterial; // set up for using CWCEHeatTransferFactory int numSurf = 1; state->dataSurface->Surface.allocate(numSurf); @@ -218,41 +216,42 @@ TEST_F(EnergyPlusFixture, test_getShadeType) state->dataConstruction->Construct(simpleCons).LayerPoint(numLayers) = materialInside; state->dataConstruction->Construct(simpleCons).AbsDiff.allocate(2); int numMaterials = materialInside + 1; - for (int i = 1; i <= numMaterials; i++) { - Material::MaterialBase *p = new Material::MaterialBase; - state->dataMaterial->Material.push_back(p); - } - state->dataMaterial->Material(materialOutside)->group = Material::Group::WindowGlass; - state->dataMaterial->Material(materialInside)->group = Material::Group::WindowGlass; + s_mat->materials.push_back(new Material::MaterialGlass); + s_mat->materials.push_back(new Material::MaterialGlass); auto aFactory = CWCEHeatTransferFactory(*state, state->dataSurface->Surface(numSurf), numSurf, simpleCons); // outside auto typeOfShade = aFactory.getShadeType(*state, simpleCons); EXPECT_ENUM_EQ(typeOfShade, DataSurfaces::WinShadingType::NoShade); - state->dataMaterial->Material(materialOutside)->group = Material::Group::Shade; + delete s_mat->materials(materialOutside); + s_mat->materials(materialOutside) = new Material::MaterialShade; typeOfShade = aFactory.getShadeType(*state, simpleCons); EXPECT_ENUM_EQ(typeOfShade, DataSurfaces::WinShadingType::ExtShade); - state->dataMaterial->Material(materialOutside)->group = Material::Group::WindowBlind; + delete s_mat->materials(materialOutside); + s_mat->materials(materialOutside) = new Material::MaterialBlind; typeOfShade = aFactory.getShadeType(*state, simpleCons); EXPECT_ENUM_EQ(typeOfShade, DataSurfaces::WinShadingType::ExtBlind); // reset the outside to glass - state->dataMaterial->Material(materialOutside)->group = Material::Group::WindowGlass; + delete s_mat->materials(materialOutside); + s_mat->materials(materialOutside) = new Material::MaterialGlass; // inside - state->dataMaterial->Material(materialInside)->group = Material::Group::Shade; + delete s_mat->materials(materialInside); + s_mat->materials(materialInside) = new Material::MaterialShade; typeOfShade = aFactory.getShadeType(*state, simpleCons); EXPECT_ENUM_EQ(typeOfShade, DataSurfaces::WinShadingType::IntShade); - state->dataMaterial->Material(materialInside)->group = Material::Group::WindowBlind; + delete s_mat->materials(materialInside); + s_mat->materials(materialInside) = new Material::MaterialBlind; typeOfShade = aFactory.getShadeType(*state, simpleCons); EXPECT_ENUM_EQ(typeOfShade, DataSurfaces::WinShadingType::IntBlind); // reset the outside to glass - state->dataMaterial->Material(materialInside)->group = Material::Group::WindowGlass; - state->dataMaterial->Material(materialOutside)->group = Material::Group::WindowGlass; + delete s_mat->materials(materialInside); + s_mat->materials(materialInside) = new Material::MaterialGlass; // between glass - double pane int betweenCons = 2; @@ -268,17 +267,19 @@ TEST_F(EnergyPlusFixture, test_getShadeType) state->dataConstruction->Construct(betweenCons).LayerPoint(numLayers) = materialInside; state->dataConstruction->Construct(betweenCons).AbsDiff.allocate(2); - state->dataMaterial->Material(materialShade)->group = Material::Group::Shade; + s_mat->materials.push_back(new Material::MaterialShade); typeOfShade = aFactory.getShadeType(*state, betweenCons); EXPECT_ENUM_EQ(typeOfShade, DataSurfaces::WinShadingType::BGShade); - state->dataMaterial->Material(materialShade)->group = Material::Group::WindowBlind; + delete s_mat->materials(materialShade); + s_mat->materials(materialShade) = new Material::MaterialBlind; typeOfShade = aFactory.getShadeType(*state, betweenCons); EXPECT_ENUM_EQ(typeOfShade, DataSurfaces::WinShadingType::BGBlind); } TEST_F(EnergyPlusFixture, test_getActiveConstructionNumber) { + auto &s_mat = state->dataMaterial; // set up for using CWCEHeatTransferFactory int numSurf = 1; state->dataSurface->Surface.allocate(numSurf); @@ -298,12 +299,9 @@ TEST_F(EnergyPlusFixture, test_getActiveConstructionNumber) state->dataConstruction->Construct(numCons).LayerPoint(numLayers) = materialInside; state->dataConstruction->Construct(numCons).AbsDiff.allocate(2); int numMaterials = materialInside; - for (int i = 1; i <= numMaterials; i++) { - Material::MaterialBase *p = new Material::MaterialBase; - state->dataMaterial->Material.push_back(p); - } - state->dataMaterial->Material(materialOutside)->group = Material::Group::WindowGlass; - state->dataMaterial->Material(materialInside)->group = Material::Group::WindowGlass; + + s_mat->materials.push_back(new Material::MaterialGlass); + s_mat->materials.push_back(new Material::MaterialGlass); auto aFactory = CWCEHeatTransferFactory(*state, state->dataSurface->Surface(numSurf), numSurf, numCons); @@ -322,6 +320,7 @@ TEST_F(EnergyPlusFixture, test_getActiveConstructionNumber) TEST_F(EnergyPlusFixture, test_getIGU) { + auto &s_mat = state->dataMaterial; // set up for using CWCEHeatTransferFactory int numSurf = 1; state->dataSurface->Surface.allocate(numSurf); @@ -338,12 +337,10 @@ TEST_F(EnergyPlusFixture, test_getIGU) state->dataConstruction->Construct(numCons).LayerPoint(numLayers) = materialInside; state->dataConstruction->Construct(numCons).AbsDiff.allocate(2); int numMaterials = materialInside; - for (int i = 1; i <= numMaterials; i++) { - Material::MaterialBase *p = new Material::MaterialBase; - state->dataMaterial->Material.push_back(p); - } - state->dataMaterial->Material(materialOutside)->group = Material::Group::WindowGlass; - state->dataMaterial->Material(materialInside)->group = Material::Group::WindowGlass; + + s_mat->materials.push_back(new Material::MaterialGlass); + s_mat->materials.push_back(new Material::MaterialGlass); + auto aFactory = CWCEHeatTransferFactory(*state, state->dataSurface->Surface(numSurf), numSurf, numCons); double width = 10.;