Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : #ifndef WindowManager_hh_INCLUDED
49 : #define WindowManager_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1A.hh>
53 : #include <ObjexxFCL/Array1D.hh>
54 : #include <ObjexxFCL/Array2A.hh>
55 : #include <ObjexxFCL/Array3D.hh>
56 :
57 : // EnergyPlus Headers
58 : #include <EnergyPlus/Data/BaseData.hh>
59 : #include <EnergyPlus/DataGlobals.hh>
60 : #include <EnergyPlus/DataHeatBalance.hh>
61 : #include <EnergyPlus/EnergyPlus.hh>
62 : #include <EnergyPlus/WindowEquivalentLayer.hh>
63 : #include <EnergyPlus/WindowManagerExteriorData.hh>
64 : #include <EnergyPlus/WindowModel.hh>
65 :
66 : namespace EnergyPlus {
67 :
68 : // Forward declarations
69 : struct EnergyPlusData;
70 :
71 : namespace WindowManager {
72 :
73 : class CWindowModel;
74 : class CWindowOpticalModel;
75 : class CWindowConstructionsSimplified;
76 :
77 : void InitWindowOpticalCalculations(EnergyPlusData &state);
78 :
79 : void InitGlassOpticalCalculations(EnergyPlusData &state);
80 :
81 : void W5InitGlassParameters(EnergyPlusData &state);
82 :
83 : //****************************************************************************
84 : // WINDOW 5 Optical Calculation Subroutines
85 : //****************************************************************************
86 :
87 : void SystemSpectralPropertiesAtPhi(EnergyPlusData &state,
88 : int iquasi, // When there is no spectral data, this is the wavelength
89 : int ngllayer, // Number of glass layers in construction
90 : Real64 wlbot, // Lowest and highest wavelength considered
91 : Real64 wltop);
92 :
93 : void SystemPropertiesAtLambdaAndPhi(EnergyPlusData &state,
94 : int n, // Number of glass layers
95 : Real64 &tt, // System transmittance
96 : Real64 &rft, // System front and back reflectance
97 : Real64 &rbt,
98 : Array1A<Real64> aft // System absorptance of each glass layer
99 : );
100 :
101 : void SolarSprectrumAverage(EnergyPlusData &state,
102 : Array1A<Real64> p, // Quantity to be weighted by solar spectrum
103 : Real64 &psol // Quantity p weighted by solar spectrum
104 : );
105 :
106 : Real64 solarSpectrumAverage(EnergyPlusData &state, gsl::span<Real64> p);
107 :
108 : Real64 visibleSpectrumAverage(EnergyPlusData &state, gsl::span<Real64> p);
109 :
110 : Real64 Interpolate(gsl::span<Real64> x, // Array of data points for independent variable
111 : gsl::span<Real64> y, // Array of data points for dependent variable
112 : int npts, // Number of data pairs
113 : Real64 xin // Given value of x
114 : );
115 :
116 : void CalcWindowHeatBalance(EnergyPlusData &state,
117 : int SurfNum, // Surface number
118 : Real64 HextConvCoeff, // Outside air film conductance coefficient
119 : Real64 &SurfInsideTemp, // Inside window surface temperature
120 : Real64 &SurfOutsideTemp // Outside surface temperature (C)
121 : );
122 :
123 : void CalcWindowHeatBalanceInternalRoutines(EnergyPlusData &state,
124 : int SurfNum, // Surface number
125 : Real64 HextConvCoeff, // Outside air film conductance coefficient
126 : Real64 &SurfInsideTemp, // Inside window surface temperature
127 : Real64 &SurfOutsideTemp // Outside surface temperature (C)
128 : );
129 :
130 : void WindowHeatBalanceEquations(EnergyPlusData &state, int SurfNum); // Surface number
131 :
132 : void GetHeatBalanceEqCoefMatrixSimple(EnergyPlusData &state,
133 : int nglasslayer, // Number of glass layers
134 : Array1D<Real64> const &hr, // Radiative conductance (W/m2-K)
135 : Array1A<Real64> &hgap, // Gap gas conductive conductance (W/m2-K)
136 : Array2D<Real64> &Aface, // Coefficient in equation Aface*thetas = Bface
137 : Array1D<Real64> &Bface // Coefficient in equation Aface*thetas = Bface
138 : );
139 :
140 : void GetHeatBalanceEqCoefMatrix(EnergyPlusData &state,
141 : int SurfNum,
142 : int nglasslayer,
143 : DataSurfaces::WinShadingType ShadeFlag,
144 : Real64 sconsh,
145 : Real64 TauShIR,
146 : Real64 EpsShIR1,
147 : Real64 EpsShIR2,
148 : Real64 RhoShIR1,
149 : Real64 RhoShIR2,
150 : Real64 ShGlReflFacIR,
151 : Real64 RhoGlIR1,
152 : Real64 RhoGlIR2,
153 : Real64 hcv, // Convection coefficient from gap glass or shade/blind to gap air (W/m2-K)
154 : Real64 TGapNew, // Current-iteration average air temp in airflow gap (K)
155 : Real64 TAirflowGapNew, // Average air temp in airflow gap between glass panes (K)
156 : Real64 hcvAirflowGap, // Convection coefficient from airflow gap glass to airflow gap air (W/m2-K)
157 : Array1A<Real64> const &hcvBG, // Convection coefficient from gap glass or shade to gap gas (W/m2-K)
158 : Array1A<Real64> const &TGapNewBG,
159 : Array1A<Real64> const &AbsRadShadeFace,
160 : Array1D<Real64> const &hr,
161 : Array2D<Real64> &Aface,
162 : Array1D<Real64> &Bface);
163 :
164 : void SolveForWindowTemperatures(EnergyPlusData &state, int SurfNum); // Surface number
165 :
166 : void ExtOrIntShadeNaturalFlow(EnergyPlusData &state,
167 : int SurfNum, // Surface number
168 : int iter, // Iteration number for glass heat balance calculation
169 : Real64 &VGap, // Air velocity in glass-shade/blind gap (m/s)
170 : Real64 &TGapNew, // Current-iteration average air temp in glass-shade/blind gap (K)
171 : Real64 &TGapOutlet, // Temperature of air leaving glass-shade/blind gap at top for upward
172 : Real64 &hcv, // Convection coefficient from gap glass or shade to gap air (W/m2-K)
173 : Real64 &QConvGap // Convective heat gain from glass-shade/blind gap for interior shade (W)
174 : );
175 :
176 : void BetweenGlassShadeNaturalFlow(EnergyPlusData &state,
177 : int SurfNum, // Surface number
178 : int iter, // Iteration number for glass heat balance calculation
179 : Real64 &VGap, // Gas velocity in gaps (m/s)
180 : Array1A<Real64> TGapNew, // Current-iteration average gas temp in gaps (K)
181 : Array1A<Real64> hcv // Convection coefficient from gap glass or shade to gap gas (W/m2-K)
182 : );
183 :
184 : void BetweenGlassForcedFlow(EnergyPlusData &state,
185 : int SurfNum, // Surface number
186 : int iter, // Iteration number for glass heat balance calculation
187 : Real64 &VGap, // Air velocity in airflow gap (m/s)
188 : Real64 &TGapNew, // Current-iteration average air temp in airflow gap (K)
189 : Real64 &TGapOutlet, // Temperature of air leaving glass-shade/blind gap at top for upward
190 : Real64 &hcv, // Convection coefficient from gap glass faces to gap air (W/m2-K)
191 : Real64 &QConvGap // Convective heat gain from air flow gap (W)
192 : );
193 :
194 : void BetweenGlassShadeForcedFlow(EnergyPlusData &state,
195 : int SurfNum, // Surface number
196 : int iter, // Iteration number for glass heat balance calculation
197 : Real64 &VGap, // Air velocity in each gap (m/s)
198 : Array1A<Real64> TGapNew, // Current-iteration average gas temp in gaps (K)
199 : Real64 &TGapOutletAve, // Average of TGapOutlet(1) and TGapOutlet(2) (K)
200 : Array1A<Real64> hcv, // Convection coefficient from gap glass or shade to gap gas (W/m2-K)
201 : Real64 &QConvTot // Sum of convective heat flow from gaps (W)
202 : );
203 :
204 : void LUdecomposition(EnergyPlusData &state,
205 : Array2<Real64> &ajac, // As input: matrix to be decomposed;
206 : int n, // Dimension of matrix
207 : Array1D_int &indx, // Vector of row permutations
208 : Real64 &d // +1 if even number of row interchange is even, -1
209 : );
210 :
211 : void LUsolution(Array2<Real64> const &a, // Matrix and vector in a.x = b;
212 : int n, // Dimension of a and b
213 : Array1D_int const &indx, // Vector of row permutations
214 : Array1D<Real64> &b // Matrix and vector in a.x = b;
215 : );
216 :
217 : void WindowGasConductance(EnergyPlusData &state,
218 : Real64 tleft, // Temperature of gap surface closest to outside (K)
219 : Real64 tright, // Temperature of gap surface closest to zone (K)
220 : int IGap, // Gap number
221 : Real64 &con, // Gap gas conductance (W/m2-K)
222 : Real64 &pr, // Gap gas Prandtl number
223 : Real64 &gr // Gap gas Grashof number
224 : );
225 :
226 : void WindowGasPropertiesAtTemp(EnergyPlusData &state,
227 : Real64 tmean, // Temperature of gas in gap (K)
228 : int IGap, // Gap number
229 : Real64 &dens, // Gap gas density at tmean (kg/m3)
230 : Real64 &visc // Gap gas dynamic viscosity at tmean (g/m-s)
231 : );
232 :
233 : void StartingWindowTemps(EnergyPlusData &state,
234 : int SurfNum, // Surface number
235 : Array1A<Real64> AbsRadShade // Short-wave radiation absorbed by shade/blind faces
236 : );
237 :
238 : void NusseltNumber(EnergyPlusData &state,
239 : int SurfNum, // Surface number
240 : Real64 tso, // Temperature of gap surface closest to outside (K)
241 : Real64 tsi, // Temperature of gap surface closest to zone (K)
242 : int IGap, // Gap number
243 : Real64 gr, // Gap gas Grashof number
244 : Real64 pr, // Gap gas Prandtl number
245 : Real64 &gnu // Gap gas Nusselt number
246 : );
247 :
248 : void TransAndReflAtPhi(Real64 cs, // Cosine of incidence angle
249 : Real64 tf0, // Transmittance at zero incidence angle
250 : Real64 rf0, // Front reflectance at zero incidence angle
251 : Real64 rb0, // Back reflectance at zero incidence angle
252 : Real64 &tfp, // Transmittance at cs
253 : Real64 &rfp, // Front reflectance at cs
254 : Real64 &rbp, // Back reflectance at cs
255 : bool SimpleGlazingSystem, // .TRUE. if simple block model being used
256 : Real64 SimpleGlazingSHGC, // SHGC value to use in alternate model for simple glazing system
257 : Real64 SimpleGlazingU // U-factor value to use in alternate model for simple glazing system
258 : );
259 :
260 : Real64 InterpolateBetweenTwoValues(Real64 X, Real64 X0, Real64 X1, Real64 F0, Real64 F1);
261 :
262 : Real64 InterpolateBetweenFourValues(
263 : Real64 X, Real64 Y, Real64 X1, Real64 X2, Real64 Y1, Real64 Y2, Real64 Fx1y1, Real64 Fx1y2, Real64 Fx2y1, Real64 Fx2y2);
264 :
265 : void W5LsqFit(Array1S<Real64> IndepVar, // Independent variables
266 : Array1S<Real64> DepVar, // Dependent variables
267 : int N, // Order of polynomial
268 : int N1, // First and last data points used
269 : int N2,
270 : Array1S<Real64> CoeffsCurve // Polynomial coeffients from fit
271 : );
272 :
273 : void W5LsqFit2(Array1A<Real64> IndepVar, // Independent variables
274 : Array1A<Real64> DepVar, // Dependent variables
275 : int N, // Order of polynomial
276 : int N1, // First and last data points used
277 : int N2,
278 : Array1A<Real64> CoeffsCurve // Polynomial coeffients from fit
279 : );
280 :
281 : Real64 DiffuseAverage(Array1S<Real64> PropertyValue); // Property value at angles of incidence
282 :
283 : Real64 DiffuseAverageProfAngGnd(Array1S<Real64> Property); // Property value vs. profile angle
284 :
285 : Real64 DiffuseAverageProfAngSky(Array1S<Real64> Property); // Property value vs. profile angle
286 :
287 : void CalcWinFrameAndDividerTemps(EnergyPlusData &state,
288 : int SurfNum, // Surface number
289 : Real64 tout, // Outside air temperature (K)
290 : Real64 tin, // Inside air temperature (K)
291 : Real64 HOutConv, // Outside convective air film conductance (W/m2-K)
292 : Real64 HInConv, // Inside convective air film conductance (W/m2-K)
293 : Real64 Outir, // Exterior IR irradiance from sky and ground
294 : int ConstrNum // Construction number of window
295 : );
296 :
297 : void CalcNominalWindowCond(EnergyPlusData &state,
298 : int ConstrNum, // Construction number
299 : int WinterSummerFlag, // 1=winter, 2=summer
300 : Real64 &NominalConductance, // Nominal center-of-glass conductance, including air films
301 : Real64 &SHGC, // Nominal center-of-glass solar heat gain coefficient for
302 : Real64 &TSolNorm, // Overall beam solar transmittance at normal incidence
303 : Real64 &TVisNorm, // Overall beam visible transmittance at normal incidence
304 : int &errFlag // Error flag
305 : );
306 :
307 : void EvalNominalWindowCond(EnergyPlusData &state,
308 : Real64 AbsBeamShadeNorm, // Shade solar absorptance at normal incidence
309 : Array1D<Real64> AbsBeamNorm, // Beam absorptance at normal incidence for each glass layer
310 : Array1D<Real64> hgap, // Conductive gap conductance [W/m2-K]
311 : Real64 &NominalConductance, // Nominal center-of-glass conductance, including air films
312 : Real64 &SHGC, // Nominal center-of-glass solar heat gain coefficient for
313 : Real64 &TSolNorm // Overall beam solar transmittance at normal incidence
314 : );
315 :
316 : void WindowTempsForNominalCond(EnergyPlusData &state,
317 : int ConstrNum, // Construction number
318 : Array1A<Real64> hgap, // Gap gas conductive conductance (W/m2-K)
319 : Real64 adjRatio // adjusment Ratio to hcin
320 : );
321 :
322 : void StartingWinTempsForNominalCond(EnergyPlusData &state);
323 :
324 : void ReportGlass(EnergyPlusData &state);
325 :
326 : void CalcWindowBlindProperties(EnergyPlusData &state);
327 :
328 : void CalcWindowScreenProperties(EnergyPlusData &state);
329 :
330 : void BlindOpticsDiffuse(EnergyPlusData &state,
331 : int BlindNum, // Blind number
332 : int ISolVis, // 1 = solar and IR calculation; 2 = visible calculation
333 : Array1A<Real64> c, // Slat properties
334 : Real64 b_el, // Slat elevation (radians)
335 : Array1A<Real64> p // Blind properties
336 : );
337 :
338 : void BlindOpticsBeam(EnergyPlusData &state,
339 : int BlindNum, // Blind number
340 : Array1A<Real64> c, // Slat properties (equivalent to BLD_PR)
341 : Real64 b_el, // Slat elevation (radians)
342 : Real64 s_el, // Solar profile angle (radians)
343 : Array1A<Real64> p // Blind properties (equivalent to ST_LAY)
344 : );
345 :
346 : void ViewFac(Real64 s, // Slat width (m)
347 : Real64 h, // Distance between faces of adjacent slats (m)
348 : Real64 phib, // Elevation angle of normal to slat (radians)
349 : Real64 phis, // Profile angle of radiation source (radians)
350 : Array2A<Real64> F // View factor array
351 : );
352 :
353 : void InvertMatrix(EnergyPlusData &state,
354 : Array2A<Real64> a, // Matrix to be inverted
355 : Array2A<Real64> y, // Inverse of matrix a
356 : Array1A_int indx, // Index vector for LU decomposition
357 : int np, // Dimension of matrix
358 : int n);
359 :
360 : void LUDCMP(EnergyPlusData &state,
361 : Array2A<Real64> A, // matrix
362 : int N,
363 : int NP,
364 : Array1A_int INDX,
365 : int &D);
366 :
367 : void LUBKSB(Array2A<Real64> A, int N, int NP, Array1A_int INDX, Array1A<Real64> B);
368 :
369 : // added for custom solar or visible spectrum
370 : void CheckAndReadCustomSprectrumData(EnergyPlusData &state);
371 :
372 : void initWindowModel(EnergyPlusData &state);
373 :
374 : } // namespace WindowManager
375 :
376 771 : struct WindowManagerData : BaseGlobalStruct
377 : {
378 :
379 : static Real64 constexpr sigma = 5.6697e-8; // Stefan-Boltzmann constant
380 : static Real64 constexpr TKelvin = DataGlobalConstants::KelvinConv; // conversion from Kelvin to Celsius
381 : static int constexpr nume = 107; // Number of wavelength values in solar spectrum
382 : static int constexpr numt3 = 81; // Number of wavelength values in the photopic response
383 :
384 : // Dens dDens/dT Con dCon/dT Vis dVis/dT Prandtl dPrandtl/dT
385 : std::array<Real64, 8> const AirProps = {1.29, -0.4e-2, 2.41e-2, 7.6e-5, 1.73e-5, 1.0e-7, 0.72, 1.8e-3};
386 :
387 : // Air mass 1.5 terrestrial solar global spectral irradiance (W/m2-micron)
388 : // on a 37 degree tilted surface; corresponds
389 : // to wavelengths (microns) in following data block (ISO 9845-1 and ASTM E 892;
390 : // derived from Optics5 data file ISO-9845GlobalNorm.std, 10-14-99)
391 :
392 : // Solar spectrum wavelength values (microns)
393 : std::array<Real64, nume> wle = {0.3000, 0.3050, 0.3100, 0.3150, 0.3200, 0.3250, 0.3300, 0.3350, 0.3400, 0.3450, 0.3500, 0.3600, 0.3700, 0.3800,
394 : 0.3900, 0.4000, 0.4100, 0.4200, 0.4300, 0.4400, 0.4500, 0.4600, 0.4700, 0.4800, 0.4900, 0.5000, 0.5100, 0.5200,
395 : 0.5300, 0.5400, 0.5500, 0.5700, 0.5900, 0.6100, 0.6300, 0.6500, 0.6700, 0.6900, 0.7100, 0.7180, 0.7244, 0.7400,
396 : 0.7525, 0.7575, 0.7625, 0.7675, 0.7800, 0.8000, 0.8160, 0.8237, 0.8315, 0.8400, 0.8600, 0.8800, 0.9050, 0.9150,
397 : 0.9250, 0.9300, 0.9370, 0.9480, 0.9650, 0.9800, 0.9935, 1.0400, 1.0700, 1.1000, 1.1200, 1.1300, 1.1370, 1.1610,
398 : 1.1800, 1.2000, 1.2350, 1.2900, 1.3200, 1.3500, 1.3950, 1.4425, 1.4625, 1.4770, 1.4970, 1.5200, 1.5390, 1.5580,
399 : 1.5780, 1.5920, 1.6100, 1.6300, 1.6460, 1.6780, 1.7400, 1.8000, 1.8600, 1.9200, 1.9600, 1.9850, 2.0050, 2.0350,
400 : 2.0650, 2.1000, 2.1480, 2.1980, 2.2700, 2.3600, 2.4500, 2.4940, 2.5370};
401 :
402 : // Solar spectrum values corresponding to wle
403 : std::array<Real64, nume> e = {0.0, 9.5, 42.3, 107.8, 181.0, 246.0, 395.3, 390.1, 435.3, 438.9, 483.7, 520.3, 666.2, 712.5,
404 : 720.7, 1013.1, 1158.2, 1184.0, 1071.9, 1302.0, 1526.0, 1599.6, 1581.0, 1628.3, 1539.2, 1548.7, 1586.5, 1484.9,
405 : 1572.4, 1550.7, 1561.5, 1501.5, 1395.5, 1485.3, 1434.1, 1419.9, 1392.3, 1130.0, 1316.7, 1010.3, 1043.2, 1211.2,
406 : 1193.9, 1175.5, 643.1, 1030.7, 1131.1, 1081.6, 849.2, 785.0, 916.4, 959.9, 978.9, 933.2, 748.5, 667.5,
407 : 690.3, 403.6, 258.3, 313.6, 526.8, 646.4, 746.8, 690.5, 637.5, 412.6, 108.9, 189.1, 132.2, 339.0,
408 : 460.0, 423.6, 480.5, 413.1, 250.2, 32.5, 1.6, 55.7, 105.1, 105.5, 182.1, 262.2, 274.2, 275.0,
409 : 244.6, 247.4, 228.7, 244.5, 234.8, 220.5, 171.5, 30.7, 2.0, 1.2, 21.2, 91.1, 26.8, 99.5,
410 : 60.4, 89.1, 82.2, 71.5, 70.2, 62.0, 21.2, 18.5, 3.2};
411 :
412 : // Phototopic response function and corresponding wavelengths (microns)
413 : // (CIE 1931 observer; ISO/CIE 10527, CIE Standard Calorimetric Observers;
414 : // derived from Optics5 data file "CIE 1931 Color Match from E308.txt", which is
415 : // the same as WINDOW4 file Cie31t.dat)
416 : // Wavelength values for photopic response
417 : std::array<Real64, numt3> wlt3 = {0.380, 0.385, 0.390, 0.395, 0.400, 0.405, 0.410, 0.415, 0.420, 0.425, 0.430, 0.435, 0.440, 0.445,
418 : 0.450, 0.455, 0.460, 0.465, 0.470, 0.475, 0.480, 0.485, 0.490, 0.495, 0.500, 0.505, 0.510, 0.515,
419 : 0.520, 0.525, 0.530, 0.535, 0.540, 0.545, 0.550, 0.555, 0.560, 0.565, 0.570, 0.575, 0.580, 0.585,
420 : 0.590, 0.595, 0.600, 0.605, 0.610, 0.615, 0.620, 0.625, 0.630, 0.635, 0.640, 0.645, 0.650, 0.655,
421 : 0.660, 0.665, 0.670, 0.675, 0.680, 0.685, 0.690, 0.695, 0.700, 0.705, 0.710, 0.715, 0.720, 0.725,
422 : 0.730, 0.735, 0.740, 0.745, 0.750, 0.755, 0.760, 0.765, 0.770, 0.775, 0.780};
423 :
424 : // Photopic response corresponding to wavelengths in wlt3
425 : std::array<Real64, numt3> y30 = {0.0000, 0.0001, 0.0001, 0.0002, 0.0004, 0.0006, 0.0012, 0.0022, 0.0040, 0.0073, 0.0116, 0.0168, 0.0230, 0.0298,
426 : 0.0380, 0.0480, 0.0600, 0.0739, 0.0910, 0.1126, 0.1390, 0.1693, 0.2080, 0.2586, 0.3230, 0.4073, 0.5030, 0.6082,
427 : 0.7100, 0.7932, 0.8620, 0.9149, 0.9540, 0.9803, 0.9950, 1.0000, 0.9950, 0.9786, 0.9520, 0.9154, 0.8700, 0.8163,
428 : 0.7570, 0.6949, 0.6310, 0.5668, 0.5030, 0.4412, 0.3810, 0.3210, 0.2650, 0.2170, 0.1750, 0.1382, 0.1070, 0.0816,
429 : 0.0610, 0.0446, 0.0320, 0.0232, 0.0170, 0.0119, 0.0082, 0.0158, 0.0041, 0.0029, 0.0021, 0.0015, 0.0010, 0.0007,
430 : 0.0005, 0.0004, 0.0002, 0.0002, 0.0001, 0.0001, 0.0001, 0.0000, 0.0000, 0.0000, 0.0000};
431 :
432 : int ngllayer = 0; // Number of glass layers
433 : int nglface = 0; // Number of glass faces
434 : int nglfacep = 0; // Number of glass faces, + 2 if shade layer present
435 : Real64 tout = 0.0; // Outside air temperature (K)
436 : Real64 tin = 0.0; // Inside air temperature (previous timestep) (K)
437 : Real64 tilt = 0.0; // Window tilt (deg)
438 : Real64 tiltr = 0.0; // Window tilt (radians)
439 : Real64 hcin = 0.0; // Convective inside air film conductance (W/m2-K)
440 : Real64 hcout = 0.0; // Convective outside air film conductance (W/m2-K)
441 : Real64 Ebout = 0.0; // Sigma*(outside air temp)**4 (W/m2)
442 : Real64 Outir = 0.0; // IR radiance of window's exterior surround (W/m2)
443 : Real64 Rmir = 0.0; // IR radiance of window's interior surround (W/m2)
444 : Real64 Rtot = 0.0; // Total thermal resistance of window (m2-K/W)
445 : std::array<std::array<std::array<Real64, 5>, 5>, 3> gcon = {0.0}; // Gas thermal conductivity coefficients for each gap
446 : std::array<std::array<std::array<Real64, 5>, 5>, 3> gvis = {0.0}; // Gas viscosity coefficients for each gap
447 : std::array<std::array<std::array<Real64, 5>, 5>, 3> gcp = {0.0}; // Gas specific-heat coefficients for each gap
448 : std::array<std::array<Real64, 5>, 5> gwght = {0.0}; // Gas molecular weights for each gap
449 : std::array<std::array<Real64, 5>, 5> gfract = {0.0}; // Gas fractions for each gap
450 : std::array<int, 5> gnmix = {0}; // Number of gases in gap
451 : std::array<Real64, 5> gap = {0.0}; // Gap width (m)
452 : std::array<Real64, 5> thick = {0.0}; // Glass layer thickness (m)
453 : std::array<Real64, 5> scon = {0.0}; // Glass layer conductance--conductivity/thickness (W/m2-K)
454 :
455 : std::array<Real64, 10> tir = {0.0}; // Front and back IR transmittance for each glass layer
456 : std::array<Real64, 10> emis = {0.0}; // Front and back IR emissivity for each glass layer
457 : std::array<Real64, 10> rir = {0.0}; // Front and back IR reflectance for each glass layer
458 : // (program calculates from tir and emis)
459 : std::array<Real64, 10> AbsRadGlassFace = {0.0}; // Solar radiation and IR radiation from internal gains absorbed by glass face
460 : std::array<Real64, 10> thetas = {0.0}; // Glass surface temperatures (K)
461 : std::array<Real64, 10> thetasPrev = {0.0}; // Previous-iteration glass surface temperatures (K)
462 : std::array<Real64, 10> fvec = {0.0}; // Glass face heat balance function
463 :
464 : std::array<Real64, 5> hrgap = {0.0}; // Radiative gap conductance
465 :
466 : Real64 A23P = 0.0; // Intermediate variables in glass face
467 : Real64 A32P = 0.0;
468 : Real64 A45P = 0.0;
469 : Real64 A54P = 0.0;
470 : Real64 A67P = 0.0;
471 : Real64 A76P = 0.0;
472 : Real64 A23 = 0.0; // heat balance equations
473 : Real64 A45 = 0.0;
474 : Real64 A67 = 0.0;
475 :
476 : static int constexpr MaxNumOfIncidentAngles = 20;
477 : static int constexpr MaxSpectralDataElements = 800; // Maximum number in Spectral Data arrays.
478 : // TEMP MOVED FROM DataHeatBalance.hh -BLB
479 :
480 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> wlt = {0.0}; // Spectral data wavelengths for each glass layer in a glazing system
481 :
482 : // Following data, Spectral data for each layer for each wavelength in wlt
483 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> t = {0.0}; // normal transmittance
484 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> rff = {0.0}; // normal front reflectance
485 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> rbb = {0.0}; // normal back reflectance
486 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> tPhi = {0.0}; // transmittance at angle of incidence
487 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> rfPhi = {0.0}; // front reflectance at angle of incidence
488 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> rbPhi = {0.0}; // back reflectance at angle of incidence
489 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> tadjPhi = {0.0}; // transmittance at angle of incidence
490 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> rfadjPhi = {0.0}; // front reflectance at angle of incidence
491 : std::array<std::array<Real64, MaxSpectralDataElements>, 5> rbadjPhi = {0.0}; // back reflectance at angle of incidence
492 :
493 : std::array<int, 5> numpt = {0}; // Number of spectral data wavelengths for each layer; =2 if no spectra data for a layer
494 : std::array<Real64, nume> stPhi = {0.0}; // Glazing system transmittance at angle of incidence for each wavelength in wle
495 : std::array<Real64, nume> srfPhi = {0.0}; // Glazing system front reflectance at angle of incidence for each wavelength in wle
496 : std::array<Real64, nume> srbPhi = {0.0}; // Glazing system back reflectance at angle of incidence for each wavelenth in wle
497 : Array2D<Real64> saPhi; // For each layer, glazing system absorptance at angle of incidence
498 : // for each wavelenth in wle
499 : std::array<std::array<Real64, 5>, 5> top = {0.0}; // Transmittance matrix for subr. op
500 : std::array<std::array<Real64, 5>, 5> rfop = {0.0}; // Front reflectance matrix for subr. op
501 : std::array<std::array<Real64, 5>, 5> rbop = {0.0}; // Back transmittance matrix for subr. op
502 :
503 : // These need to stay as Array1D for a little longer because changing them spreads into many source files
504 : Array1D<Real64> DepVarCurveFit; // Values of dependent variable corresponding to IndepVarCurveFit values
505 : Array1D<Real64> CoeffsCurveFit; // Polynomial coefficients from curve fit
506 : Array1D<Real64> tsolPhi; // Glazing system solar transmittance for each angle of incidence
507 : Array1D<Real64> rfsolPhi; // Glazing system solar front reflectance for each angle of incidence
508 : Array1D<Real64> rbsolPhi; // Glazing system solar back reflectance for each angle of incidence
509 : Array2D<Real64> solabsPhi; // Glazing system solar absorptance for each angle of incidence
510 : Array2D<Real64> solabsBackPhi; // Glazing system back solar absorptance for each angle of incidence
511 : Array1D<Real64> solabsShadePhi; // Glazing system interior shade solar absorptance for each angle of incidence
512 : Array1D<Real64> tvisPhi; // Glazing system visible transmittance for each angle of incidence
513 : Array1D<Real64> rfvisPhi; // Glazing system visible front reflectance for each angle of incidence
514 : Array1D<Real64> rbvisPhi; // Glazing system visible back reflectance for each angle of incidence
515 : Array1D<Real64> CosPhiIndepVar; // Cos of incidence angles at 10-deg increments for curve fits
516 :
517 : std::unique_ptr<WindowManager::CWindowModel> inExtWindowModel; // Information about windows model (interior or exterior)
518 : std::unique_ptr<WindowManager::CWindowOpticalModel> winOpticalModel; // Information about windows optical model (Simplified or BSDF)
519 :
520 : bool RunMeOnceFlag = false;
521 : bool lSimpleGlazingSystem = false; // true if using simple glazing system block model
522 : bool BGFlag = false; // True if between-glass shade or blind
523 : bool locTCFlag = false; // True if this surface is a TC window
524 : bool DoReport = false;
525 : bool HasWindows = false;
526 : bool HasComplexWindows = false;
527 : bool HasEQLWindows = false; // equivalent layer window defined
528 : Real64 SimpleGlazingSHGC = 0.0; // value of SHGC for simple glazing system block model
529 : Real64 SimpleGlazingU = 0.0; // value of U-factor for simple glazing system block model
530 : Real64 tmpTrans = 0.0; // solar transmittance calculated from spectral data
531 : Real64 tmpTransVis = 0.0; // visible transmittance calculated from spectral data
532 : Real64 tmpReflectSolBeamFront = 0.0;
533 : Real64 tmpReflectSolBeamBack = 0.0;
534 : Real64 tmpReflectVisBeamFront = 0.0;
535 : Real64 tmpReflectVisBeamBack = 0.0;
536 :
537 : Array1D<Real64> deltaTemp = Array1D<Real64>(100, 0.0);
538 : Array1D_int iMinDT = Array1D_int(1, 0);
539 : Array1D_int IDConst = Array1D_int(100, 0);
540 :
541 : Array1D<Real64> hgap = Array1D<Real64>(5); // Gap gas conductance (W/m2-K)
542 : Array1D<Real64> hr = Array1D<Real64>(10); // Radiative conductance (W/m2-K)
543 : Array1D_int indx = Array1D_int(10); // Vector of row permutations in LU decomposition
544 : Array2D<Real64> Aface = Array2D<Real64>(10, 10); // Coefficient in equation Aface*thetas = Bface
545 : Array1D<Real64> Bface = Array1D<Real64>(10); // Coefficient in equation Aface*thetas = Bface
546 : Array1D<Real64> TGapNewBG = Array1D<Real64>(2); // For between-glass shade/blind, average gas temp in gaps on either
547 : // side of shade/blind (K)
548 : Array1D<Real64> hcvBG = Array1D<Real64>(2); // For between-glass shade/blind, convection coefficient from gap glass or
549 : // shade/blind to gap gas on either side of shade/blind (W/m2-K)
550 : Array1D<Real64> AbsRadShadeFace = Array1D<Real64>(2); // Solar radiation, short-wave radiation from lights, and long-wave
551 : Array1D<Real64> RhoIR = Array1D<Real64>(10); // Face IR reflectance
552 :
553 : std::array<Real64, 10> vv = {0.0}; // Stores the implicit scaling of each row
554 : std::array<Real64, 10> kprime = {0.0}; // Monotonic thermal conductivity
555 : std::array<Real64, 10> kdblprm = {
556 : 0.0}; // Conductivity term accounting for additional energy moved by the diffusional transport of internal energy in polyatomic gases.
557 : std::array<Real64, 10> mukpdwn = {0.0}; // Denominator term
558 : std::array<Real64, 10> kpdown = {0.0}; // Denominator terms
559 : std::array<Real64, 10> kdpdown = {0.0};
560 : std::array<Real64, 10> frct = {0.0}; // Fraction of each gas in a mixture
561 : std::array<Real64, 10> fvis = {0.0}; // Viscosity of each gas in a mixture (g/m-s)
562 : std::array<Real64, 10> fcon = {0.0}; // Conductance of each gas in a mixture (W/m2-K)
563 : std::array<Real64, 10> fdens = {0.0}; // Density of each gas in a mixture (kg/m3)
564 : std::array<Real64, 10> fcp = {0.0}; // Specific heat of each gas in a mixture (J/m3-K)
565 :
566 : std::array<int, 5> LayerNum = {0}; // Glass layer number
567 :
568 0 : void clear_state() override
569 : {
570 0 : this->ngllayer = 0;
571 0 : this->nglface = 0;
572 0 : this->nglfacep = 0;
573 0 : this->tout = 0.0;
574 0 : this->tin = 0.0;
575 0 : this->tilt = 0.0;
576 0 : this->tiltr = 0.0;
577 0 : this->hcin = 0.0;
578 0 : this->hcout = 0.0;
579 0 : this->Ebout = 0.0;
580 0 : this->Outir = 0.0;
581 0 : this->Rmir = 0.0;
582 0 : this->Rtot = 0.0;
583 0 : this->gcon = {0.0};
584 0 : this->gvis = {0.0};
585 0 : this->gcp = {0.0};
586 0 : this->gwght = {0.0};
587 0 : this->gfract = {0.0};
588 0 : this->gnmix = {0};
589 0 : this->gap = {0.0};
590 0 : this->thick = {0.0};
591 0 : this->scon = {0.0};
592 0 : this->tir = {0.0};
593 0 : this->emis = {0.0};
594 0 : this->rir = {0.0};
595 0 : this->AbsRadGlassFace = {0.0};
596 0 : this->thetas = {0.0};
597 0 : this->thetasPrev = {0.0};
598 0 : this->fvec = {0.0};
599 0 : this->hrgap = {0.0};
600 0 : this->A23P = 0.0;
601 0 : this->A32P = 0.0;
602 0 : this->A45P = 0.0;
603 0 : this->A54P = 0.0;
604 0 : this->A67P = 0.0;
605 0 : this->A76P = 0.0;
606 0 : this->A23 = 0.0;
607 0 : this->A45 = 0.0;
608 0 : this->A67 = 0.0;
609 0 : this->numpt = {0};
610 0 : this->stPhi = {0.0};
611 0 : this->srfPhi = {0.0};
612 0 : this->srbPhi = {0.0};
613 0 : this->saPhi = Array2D<Real64>(5, nume, 0.0);
614 0 : this->top = {0.0};
615 0 : this->rfop = {0.0};
616 0 : this->rbop = {0.0};
617 0 : this->DepVarCurveFit = Array1D<Real64>(10, 0.0);
618 0 : this->CoeffsCurveFit = Array1D<Real64>(6, 0.0);
619 0 : this->tsolPhi = Array1D<Real64>(MaxNumOfIncidentAngles, 0.0);
620 0 : this->rfsolPhi = Array1D<Real64>(MaxNumOfIncidentAngles, 0.0);
621 0 : this->rbsolPhi = Array1D<Real64>(MaxNumOfIncidentAngles, 0.0);
622 0 : this->solabsPhi = Array2D<Real64>(5, MaxNumOfIncidentAngles, 0.0);
623 0 : this->solabsBackPhi = Array2D<Real64>(5, MaxNumOfIncidentAngles, 0.0);
624 0 : this->solabsShadePhi = Array1D<Real64>(MaxNumOfIncidentAngles, 0.0);
625 0 : this->tvisPhi = Array1D<Real64>(MaxNumOfIncidentAngles, 0.0);
626 0 : this->rfvisPhi = Array1D<Real64>(MaxNumOfIncidentAngles, 0.0);
627 0 : this->rbvisPhi = Array1D<Real64>(MaxNumOfIncidentAngles, 0.0);
628 0 : this->CosPhiIndepVar = Array1D<Real64>(MaxNumOfIncidentAngles, 0.0);
629 0 : WindowManager::CWindowConstructionsSimplified::clearState();
630 0 : this->RunMeOnceFlag = false;
631 0 : this->lSimpleGlazingSystem = false; // true if using simple glazing system block model
632 0 : this->BGFlag = false; // True if between-glass shade or blind
633 0 : this->locTCFlag = false; // True if this surface is a TC window
634 0 : this->DoReport = false;
635 0 : this->HasWindows = false;
636 0 : this->HasComplexWindows = false;
637 0 : this->HasEQLWindows = false; // equivalent layer window defined
638 0 : this->SimpleGlazingSHGC = 0.0;
639 0 : this->SimpleGlazingU = 0.0;
640 0 : this->tmpTrans = 0.0; // solar transmittance calculated from spectral data
641 0 : this->tmpTransVis = 0.0; // visible transmittance calculated from spectral data
642 0 : this->tmpReflectSolBeamFront = 0.0;
643 0 : this->tmpReflectSolBeamBack = 0.0;
644 0 : this->tmpReflectVisBeamFront = 0.0;
645 0 : this->tmpReflectVisBeamBack = 0.0;
646 0 : }
647 :
648 : // Default Constructor
649 771 : WindowManagerData()
650 771 : {
651 771 : saPhi.allocate(5, nume); // For each layer, glazing system absorptance at angle of incidence
652 771 : saPhi = 0.0; // for each wavelenth in wle
653 771 : DepVarCurveFit.allocate(MaxNumOfIncidentAngles); // Values of dependent variable corresponding to IndepVarCurveFit values
654 771 : DepVarCurveFit = 0.0;
655 771 : CoeffsCurveFit.allocate(6); // Polynomial coefficients from curve fit
656 771 : CoeffsCurveFit = 0.0;
657 771 : tsolPhi.allocate(MaxNumOfIncidentAngles); // Glazing system solar transmittance for each angle of incidence
658 771 : tsolPhi = 0.0;
659 771 : rfsolPhi.allocate(MaxNumOfIncidentAngles); // Glazing system solar front reflectance for each angle of incidence
660 771 : rfsolPhi = 0.0;
661 771 : rbsolPhi.allocate(MaxNumOfIncidentAngles); // Glazing system solar back reflectance for each angle of incidence
662 771 : rbsolPhi = 0.0;
663 771 : solabsPhi.allocate(5, MaxNumOfIncidentAngles); // Glazing system solar absorptance for each angle of incidence
664 771 : solabsPhi = 0.0;
665 771 : solabsBackPhi.allocate(5, MaxNumOfIncidentAngles); // Glazing system back solar absorptance for each angle of incidence
666 771 : solabsBackPhi = 0.0;
667 771 : solabsShadePhi.allocate(MaxNumOfIncidentAngles); // Glazing system interior shade solar absorptance for each angle of incidence
668 771 : solabsShadePhi = 0.0;
669 771 : tvisPhi.allocate(MaxNumOfIncidentAngles); // Glazing system visible transmittance for each angle of incidence
670 771 : tvisPhi = 0.0;
671 771 : rfvisPhi.allocate(MaxNumOfIncidentAngles); // Glazing system visible front reflectance for each angle of incidence
672 771 : rfvisPhi = 0.0;
673 771 : rbvisPhi.allocate(MaxNumOfIncidentAngles); // Glazing system visible back reflectance for each angle of incidence
674 771 : rbvisPhi = 0.0;
675 771 : CosPhiIndepVar.allocate(MaxNumOfIncidentAngles); // Cos of incidence angles at 10-deg increments for curve fits
676 771 : CosPhiIndepVar = 0.0;
677 771 : SimpleGlazingSHGC = 0.0;
678 771 : SimpleGlazingU = 0.0;
679 771 : tmpReflectSolBeamFront = 0.0;
680 771 : tmpReflectSolBeamBack = 0.0;
681 771 : tmpReflectVisBeamFront = 0.0;
682 771 : tmpReflectVisBeamBack = 0.0;
683 771 : }
684 : };
685 :
686 : } // namespace EnergyPlus
687 :
688 : #endif
|