Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2025, 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 :
56 : // EnergyPlus Headers
57 : #include <EnergyPlus/Data/BaseData.hh>
58 : #include <EnergyPlus/DataGlobals.hh>
59 : #include <EnergyPlus/DataSurfaces.hh>
60 : #include <EnergyPlus/EnergyPlus.hh>
61 : #include <EnergyPlus/WindowEquivalentLayer.hh>
62 : #include <EnergyPlus/WindowManagerExteriorData.hh>
63 : #include <EnergyPlus/WindowModel.hh>
64 :
65 : namespace EnergyPlus {
66 :
67 : // Forward declarations
68 : struct EnergyPlusData;
69 :
70 : namespace Window {
71 :
72 : int constexpr nume = 107; // Number of wavelength values in solar spectrum
73 : int constexpr numt3 = 81; // Number of wavelength values in the photopic response
74 :
75 : int constexpr maxGlassLayers = 5;
76 : int constexpr maxGapLayers = 5;
77 : int constexpr maxSpectralDataElements = 800; // Maximum number in Spectral Data arrays.
78 :
79 : int constexpr numPhis = 10;
80 : Real64 constexpr dPhiDeg = 10.0;
81 : Real64 constexpr dPhiRad = dPhiDeg * Constant::DegToRad;
82 :
83 : constexpr std::array<Real64, numPhis> cosPhis = {1.0,
84 : 0.98480775301220802,
85 : 0.93969262078590842,
86 : 0.86602540378443871,
87 : 0.76604444311897812,
88 : 0.64278760968653936,
89 : 0.50000000000000011,
90 : 0.34202014332566882,
91 : 0.17364817766693041,
92 : 0.0}; // 6.123233995736766E-17
93 :
94 : constexpr int maxPolyCoef = 6;
95 :
96 : class CWindowModel;
97 : class CWindowOpticalModel;
98 : class CWindowConstructionsSimplified;
99 :
100 : void InitWindowOpticalCalculations(EnergyPlusData &state);
101 :
102 : void InitGlassOpticalCalculations(EnergyPlusData &state);
103 :
104 : void W5InitGlassParameters(EnergyPlusData &state);
105 :
106 : //****************************************************************************
107 : // WINDOW 5 Optical Calculation Subroutines
108 : //****************************************************************************
109 :
110 : void SystemSpectralPropertiesAtPhi(EnergyPlusData &state,
111 : int iquasi, // When there is no spectral data, this is the wavelength
112 : int ngllayer, // Number of glass layers in construction
113 : Real64 wlbot, // Lowest and highest wavelength considered
114 : Real64 wltop,
115 : std::array<int, maxGlassLayers> const &numpt,
116 : std::array<std::array<Real64, maxSpectralDataElements>, maxGlassLayers> const &wlt,
117 : std::array<std::array<Real64, maxSpectralDataElements>, maxGlassLayers> const &tPhi,
118 : std::array<std::array<Real64, maxSpectralDataElements>, maxGlassLayers> const &rfPhi,
119 : std::array<std::array<Real64, maxSpectralDataElements>, maxGlassLayers> const &rbPhi,
120 : std::array<Real64, nume> &stPhi,
121 : std::array<Real64, nume> &srfPhi,
122 : std::array<Real64, nume> &srbPhi,
123 : Array2D<Real64> &saPhi);
124 :
125 : void SystemPropertiesAtLambdaAndPhi(EnergyPlusData &state,
126 : int n, // Number of glass layers
127 : Real64 &tt, // System transmittance
128 : Real64 &rft, // System front and back reflectance
129 : Real64 &rbt,
130 : Array1A<Real64> aft // System absorptance of each glass layer
131 : );
132 :
133 : Real64 solarSpectrumAverage(EnergyPlusData const &state, gsl::span<Real64 const> p);
134 :
135 : Real64 visibleSpectrumAverage(EnergyPlusData const &state, gsl::span<Real64 const> p);
136 :
137 : Real64 Interpolate(gsl::span<Real64 const> x, // Array of data points for independent variable
138 : gsl::span<Real64 const> y, // Array of data points for dependent variable
139 : int npts, // Number of data pairs
140 : Real64 xin // Given value of x
141 : );
142 :
143 : void CalcWindowHeatBalance(EnergyPlusData &state,
144 : int SurfNum, // Surface number
145 : Real64 HextConvCoeff, // Outside air film conductance coefficient
146 : Real64 &SurfInsideTemp, // Inside window surface temperature
147 : Real64 &SurfOutsideTemp // Outside surface temperature (C)
148 : );
149 :
150 : void CalcWindowHeatBalanceInternalRoutines(EnergyPlusData &state,
151 : int SurfNum, // Surface number
152 : Real64 HextConvCoeff, // Outside air film conductance coefficient
153 : Real64 &SurfInsideTemp, // Inside window surface temperature
154 : Real64 &SurfOutsideTemp // Outside surface temperature (C)
155 : );
156 :
157 : void GetHeatBalanceEqCoefMatrixSimple(EnergyPlusData &state,
158 : int nglasslayer, // Number of glass layers
159 : Array1D<Real64> const &hr, // Radiative conductance (W/m2-K)
160 : Array1A<Real64> &hgap, // Gap gas conductive conductance (W/m2-K)
161 : Array2D<Real64> &Aface, // Coefficient in equation Aface*thetas = Bface
162 : Array1D<Real64> &Bface // Coefficient in equation Aface*thetas = Bface
163 : );
164 :
165 : void GetHeatBalanceEqCoefMatrix(EnergyPlusData &state,
166 : int SurfNum,
167 : int nglasslayer,
168 : DataSurfaces::WinShadingType ShadeFlag,
169 : Real64 sconsh,
170 : Real64 TauShIR,
171 : Real64 EpsShIR1,
172 : Real64 EpsShIR2,
173 : Real64 RhoShIR1,
174 : Real64 RhoShIR2,
175 : Real64 ShGlReflFacIR,
176 : Real64 RhoGlIR1,
177 : Real64 RhoGlIR2,
178 : Real64 hcv, // Convection coefficient from gap glass or shade/blind to gap air (W/m2-K)
179 : Real64 TGapNew, // Current-iteration average air temp in airflow gap (K)
180 : Real64 TAirflowGapNew, // Average air temp in airflow gap between glass panes (K)
181 : Real64 hcvAirflowGap, // Convection coefficient from airflow gap glass to airflow gap air (W/m2-K)
182 : Array1A<Real64> const &hcvBG, // Convection coefficient from gap glass or shade to gap gas (W/m2-K)
183 : Array1A<Real64> const &TGapNewBG,
184 : Array1A<Real64> const &AbsRadShadeFace,
185 : Array1D<Real64> const &hr,
186 : Array2D<Real64> &Aface,
187 : Array1D<Real64> &Bface);
188 :
189 : void SolveForWindowTemperatures(EnergyPlusData &state, int SurfNum); // Surface number
190 :
191 : void ExtOrIntShadeNaturalFlow(EnergyPlusData &state,
192 : int SurfNum, // Surface number
193 : int iter, // Iteration number for glass heat balance calculation
194 : Real64 &VGap, // Air velocity in glass-shade/blind gap (m/s)
195 : Real64 &TGapNew, // Current-iteration average air temp in glass-shade/blind gap (K)
196 : Real64 &TGapOutlet, // Temperature of air leaving glass-shade/blind gap at top for upward
197 : Real64 &hcv, // Convection coefficient from gap glass or shade to gap air (W/m2-K)
198 : Real64 &QConvGap // Convective heat gain from glass-shade/blind gap for interior shade (W)
199 : );
200 :
201 : void BetweenGlassShadeNaturalFlow(EnergyPlusData &state,
202 : int SurfNum, // Surface number
203 : int iter, // Iteration number for glass heat balance calculation
204 : Real64 &VGap, // Gas velocity in gaps (m/s)
205 : Array1A<Real64> TGapNew, // Current-iteration average gas temp in gaps (K)
206 : Array1A<Real64> hcv // Convection coefficient from gap glass or shade to gap gas (W/m2-K)
207 : );
208 :
209 : void BetweenGlassForcedFlow(EnergyPlusData &state,
210 : int SurfNum, // Surface number
211 : int iter, // Iteration number for glass heat balance calculation
212 : Real64 &VGap, // Air velocity in airflow gap (m/s)
213 : Real64 &TGapNew, // Current-iteration average air temp in airflow gap (K)
214 : Real64 &TGapOutlet, // Temperature of air leaving glass-shade/blind gap at top for upward
215 : Real64 &hcv, // Convection coefficient from gap glass faces to gap air (W/m2-K)
216 : Real64 &QConvGap // Convective heat gain from air flow gap (W)
217 : );
218 :
219 : void BetweenGlassShadeForcedFlow(EnergyPlusData &state,
220 : int SurfNum, // Surface number
221 : int iter, // Iteration number for glass heat balance calculation
222 : Real64 &VGap, // Air velocity in each gap (m/s)
223 : Array1A<Real64> TGapNew, // Current-iteration average gas temp in gaps (K)
224 : Real64 &TGapOutletAve, // Average of TGapOutlet(1) and TGapOutlet(2) (K)
225 : Array1A<Real64> hcv, // Convection coefficient from gap glass or shade to gap gas (W/m2-K)
226 : Real64 &QConvTot // Sum of convective heat flow from gaps (W)
227 : );
228 :
229 : void LUdecomposition(EnergyPlusData &state,
230 : Array2<Real64> &ajac, // As input: matrix to be decomposed;
231 : int n, // Dimension of matrix
232 : Array1D_int &indx, // Vector of row permutations
233 : int &d // +1 if even number of row interchange is even, -1
234 : );
235 :
236 : void LUsolution(EnergyPlusData &state,
237 : Array2<Real64> const &a, // Matrix and vector in a.x = b;
238 : int n, // Dimension of a and b
239 : Array1D_int const &indx, // Vector of row permutations
240 : Array1D<Real64> &b // Matrix and vector in a.x = b;
241 : );
242 :
243 768107 : constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence
244 : std::array<Real64, 6> const &A // Polynomial coefficients
245 : )
246 : {
247 768107 : return (X < 0.0 || X > 1.0) ? 0.0 : (X * (A[0] + X * (A[1] + X * (A[2] + X * (A[3] + X * (A[4] + X * A[5]))))));
248 : }
249 :
250 : #ifdef GET_OUT
251 : constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence
252 : Array1D<Real64> const &A // Polynomial coefficients
253 : )
254 : {
255 : if (X < 0.0 || X > 1.0) {
256 : return 0.0;
257 : } else {
258 : return X * (A(1) + X * (A(2) + X * (A(3) + X * (A(4) + X * (A(5) + X * A(6))))));
259 : }
260 : }
261 : #endif // GET_OUT
262 :
263 : void WindowGasConductance(EnergyPlusData &state,
264 : Real64 tleft, // Temperature of gap surface closest to outside (K)
265 : Real64 tright, // Temperature of gap surface closest to zone (K)
266 : int IGap, // Gap number
267 : Real64 &con, // Gap gas conductance (W/m2-K)
268 : Real64 &pr, // Gap gas Prandtl number
269 : Real64 &gr // Gap gas Grashof number
270 : );
271 :
272 : void WindowGasPropertiesAtTemp(EnergyPlusData const &state,
273 : Real64 tmean, // Temperature of gas in gap (K)
274 : int IGap, // Gap number
275 : Real64 &dens, // Gap gas density at tmean (kg/m3)
276 : Real64 &visc // Gap gas dynamic viscosity at tmean (g/m-s)
277 : );
278 :
279 : void StartingWindowTemps(EnergyPlusData &state,
280 : int SurfNum, // Surface number
281 : Array1A<Real64> AbsRadShade // Short-wave radiation absorbed by shade/blind faces
282 : );
283 :
284 : void NusseltNumber(EnergyPlusData &state,
285 : int SurfNum, // Surface number
286 : Real64 tso, // Temperature of gap surface closest to outside (K)
287 : Real64 tsi, // Temperature of gap surface closest to zone (K)
288 : int IGap, // Gap number
289 : Real64 gr, // Gap gas Grashof number
290 : Real64 pr, // Gap gas Prandtl number
291 : Real64 &gnu // Gap gas Nusselt number
292 : );
293 :
294 : void TransAndReflAtPhi(Real64 cs, // Cosine of incidence angle
295 : Real64 tf0, // Transmittance at zero incidence angle
296 : Real64 rf0, // Front reflectance at zero incidence angle
297 : Real64 rb0, // Back reflectance at zero incidence angle
298 : Real64 &tfp, // Transmittance at cs
299 : Real64 &rfp, // Front reflectance at cs
300 : Real64 &rbp, // Back reflectance at cs
301 : bool SimpleGlazingSystem, // .TRUE. if simple block model being used
302 : Real64 SimpleGlazingSHGC, // SHGC value to use in alternate model for simple glazing system
303 : Real64 SimpleGlazingU // U-factor value to use in alternate model for simple glazing system
304 : );
305 :
306 : Real64 InterpolateBetweenTwoValues(Real64 X, Real64 X0, Real64 X1, Real64 F0, Real64 F1);
307 :
308 : Real64 InterpolateBetweenFourValues(
309 : Real64 X, Real64 Y, Real64 X1, Real64 X2, Real64 Y1, Real64 Y2, Real64 Fx1y1, Real64 Fx1y2, Real64 Fx2y1, Real64 Fx2y2);
310 :
311 : void W5LsqFit(std::array<Real64, numPhis> const &ivars, // Independent variables
312 : std::array<Real64, numPhis> const &dvars, // Dependent variables
313 : std::array<Real64, Window::maxPolyCoef> &coeffs // Polynomial coeffients from fit
314 : );
315 :
316 : Real64 DiffuseAverage(std::array<Real64, numPhis> const &props); // Property value at angles of incidence
317 :
318 : void CalcWinFrameAndDividerTemps(EnergyPlusData &state,
319 : int SurfNum, // Surface number
320 : Real64 tout, // Outside air temperature (K)
321 : Real64 tin, // Inside air temperature (K)
322 : Real64 HOutConv, // Outside convective air film conductance (W/m2-K)
323 : Real64 HInConv, // Inside convective air film conductance (W/m2-K)
324 : Real64 Outir, // Exterior IR irradiance from sky and ground
325 : int ConstrNum // Construction number of window
326 : );
327 :
328 : void CalcNominalWindowCond(EnergyPlusData &state,
329 : int ConstrNum, // Construction number
330 : int WinterSummerFlag, // 1=winter, 2=summer
331 : Real64 &NominalConductance, // Nominal center-of-glass conductance, including air films
332 : Real64 &SHGC, // Nominal center-of-glass solar heat gain coefficient for
333 : Real64 &TSolNorm, // Overall beam solar transmittance at normal incidence
334 : Real64 &TVisNorm, // Overall beam visible transmittance at normal incidence
335 : int &errFlag // Error flag
336 : );
337 :
338 : void EvalNominalWindowCond(EnergyPlusData &state,
339 : Real64 AbsBeamShadeNorm, // Shade solar absorptance at normal incidence
340 : Array1D<Real64> AbsBeamNorm, // Beam absorptance at normal incidence for each glass layer
341 : Array1D<Real64> hgap, // Conductive gap conductance [W/m2-K]
342 : Real64 &NominalConductance, // Nominal center-of-glass conductance, including air films
343 : Real64 &SHGC, // Nominal center-of-glass solar heat gain coefficient for
344 : Real64 TSolNorm // Overall beam solar transmittance at normal incidence
345 : );
346 :
347 : void WindowTempsForNominalCond(EnergyPlusData &state,
348 : int ConstrNum, // Construction number
349 : Array1A<Real64> hgap, // Gap gas conductive conductance (W/m2-K)
350 : Real64 adjRatio // adjusment Ratio to hcin
351 : );
352 :
353 : void StartingWinTempsForNominalCond(EnergyPlusData &state);
354 :
355 : void ReportGlass(EnergyPlusData &state);
356 :
357 : void CalcWindowBlindProperties(EnergyPlusData &state);
358 :
359 : void CalcWindowScreenProperties(EnergyPlusData &state);
360 :
361 : void BlindOpticsDiffuse(EnergyPlusData &state,
362 : int BlindNum, // Blind number
363 : int ISolVis, // 1 = solar and IR calculation; 2 = visible calculation
364 : Array1A<Real64> c, // Slat properties
365 : Real64 b_el, // Slat elevation (radians)
366 : Array1A<Real64> p // Blind properties
367 : );
368 :
369 : void BlindOpticsBeam(EnergyPlusData &state,
370 : int BlindNum, // Blind number
371 : Array1A<Real64> c, // Slat properties (equivalent to BLD_PR)
372 : Real64 b_el, // Slat elevation (radians)
373 : Real64 s_el, // Solar profile angle (radians)
374 : Array1A<Real64> p // Blind properties (equivalent to ST_LAY)
375 : );
376 :
377 0 : inline Real64 InterpSw(Real64 const SwitchFac, // Switching factor: 0.0 if glazing is unswitched, = 1.0 if fully switched
378 : Real64 const A, // Glazing property in unswitched state
379 : Real64 const B // Glazing property in fully switched state
380 : )
381 : {
382 : // FUNCTION INFORMATION:
383 : // AUTHOR Fred Winkelmann
384 : // DATE WRITTEN February 1999
385 :
386 : // PURPOSE OF THIS FUNCTION:
387 : // For switchable glazing, calculates a weighted average of properties
388 : // A and B
389 :
390 0 : Real64 locSwitchFac = std::clamp(SwitchFac, 0.0, 1.0);
391 :
392 0 : return (1.0 - locSwitchFac) * A + locSwitchFac * B;
393 : }
394 :
395 : void ViewFac(Real64 s, // Slat width (m)
396 : Real64 h, // Distance between faces of adjacent slats (m)
397 : Real64 phib, // Elevation angle of normal to slat (radians)
398 : Real64 phis, // Profile angle of radiation source (radians)
399 : Array2A<Real64> F // View factor array
400 : );
401 :
402 : void InvertMatrix(EnergyPlusData &state,
403 : Array2D<Real64> &a, // Matrix to be inverted
404 : Array2D<Real64> &y, // Inverse of matrix a
405 : Array1D_int &indx, // Index vector for LU decomposition
406 : int n);
407 :
408 : // added for custom solar or visible spectrum
409 : void CheckAndReadCustomSprectrumData(EnergyPlusData &state);
410 :
411 : void initWindowModel(EnergyPlusData &state);
412 :
413 : struct WindowGap
414 : {
415 : int numGases = 0;
416 : std::array<Material::Gas, Material::maxMixGases> gases = {Material::Gas()};
417 : std::array<Real64, Material::maxMixGases> gasFracts = {0.0};
418 : Real64 width = 0.0;
419 : };
420 :
421 : } // namespace Window
422 :
423 : struct WindowManagerData : BaseGlobalStruct
424 : {
425 :
426 : // Dens dDens/dT Con dCon/dT Vis dVis/dT Prandtl dPrandtl/dT
427 : 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};
428 :
429 : // Air mass 1.5 terrestrial solar global spectral irradiance (W/m2-micron)
430 : // on a 37 degree tilted surface; corresponds
431 : // to wavelengths (microns) in following data block (ISO 9845-1 and ASTM E 892;
432 : // derived from Optics5 data file ISO-9845GlobalNorm.std, 10-14-99)
433 :
434 : // Solar spectrum wavelength values (microns)
435 : std::array<Real64, Window::nume> wle = {
436 : 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, 0.3900, 0.4000,
437 : 0.4100, 0.4200, 0.4300, 0.4400, 0.4500, 0.4600, 0.4700, 0.4800, 0.4900, 0.5000, 0.5100, 0.5200, 0.5300, 0.5400, 0.5500, 0.5700,
438 : 0.5900, 0.6100, 0.6300, 0.6500, 0.6700, 0.6900, 0.7100, 0.7180, 0.7244, 0.7400, 0.7525, 0.7575, 0.7625, 0.7675, 0.7800, 0.8000,
439 : 0.8160, 0.8237, 0.8315, 0.8400, 0.8600, 0.8800, 0.9050, 0.9150, 0.9250, 0.9300, 0.9370, 0.9480, 0.9650, 0.9800, 0.9935, 1.0400,
440 : 1.0700, 1.1000, 1.1200, 1.1300, 1.1370, 1.1610, 1.1800, 1.2000, 1.2350, 1.2900, 1.3200, 1.3500, 1.3950, 1.4425, 1.4625, 1.4770,
441 : 1.4970, 1.5200, 1.5390, 1.5580, 1.5780, 1.5920, 1.6100, 1.6300, 1.6460, 1.6780, 1.7400, 1.8000, 1.8600, 1.9200, 1.9600, 1.9850,
442 : 2.0050, 2.0350, 2.0650, 2.1000, 2.1480, 2.1980, 2.2700, 2.3600, 2.4500, 2.4940, 2.5370};
443 :
444 : // Solar spectrum values corresponding to wle
445 : std::array<Real64, Window::nume> e = {
446 : 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, 720.7, 1013.1,
447 : 1158.2, 1184.0, 1071.9, 1302.0, 1526.0, 1599.6, 1581.0, 1628.3, 1539.2, 1548.7, 1586.5, 1484.9, 1572.4, 1550.7, 1561.5, 1501.5,
448 : 1395.5, 1485.3, 1434.1, 1419.9, 1392.3, 1130.0, 1316.7, 1010.3, 1043.2, 1211.2, 1193.9, 1175.5, 643.1, 1030.7, 1131.1, 1081.6,
449 : 849.2, 785.0, 916.4, 959.9, 978.9, 933.2, 748.5, 667.5, 690.3, 403.6, 258.3, 313.6, 526.8, 646.4, 746.8, 690.5,
450 : 637.5, 412.6, 108.9, 189.1, 132.2, 339.0, 460.0, 423.6, 480.5, 413.1, 250.2, 32.5, 1.6, 55.7, 105.1, 105.5,
451 : 182.1, 262.2, 274.2, 275.0, 244.6, 247.4, 228.7, 244.5, 234.8, 220.5, 171.5, 30.7, 2.0, 1.2, 21.2, 91.1,
452 : 26.8, 99.5, 60.4, 89.1, 82.2, 71.5, 70.2, 62.0, 21.2, 18.5, 3.2};
453 :
454 : // Phototopic response function and corresponding wavelengths (microns)
455 : // (CIE 1931 observer; ISO/CIE 10527, CIE Standard Calorimetric Observers;
456 : // derived from Optics5 data file "CIE 1931 Color Match from E308.txt", which is
457 : // the same as WINDOW4 file Cie31t.dat)
458 : // Wavelength values for photopic response
459 : std::array<Real64, Window::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,
460 : 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,
461 : 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,
462 : 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,
463 : 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,
464 : 0.730, 0.735, 0.740, 0.745, 0.750, 0.755, 0.760, 0.765, 0.770, 0.775, 0.780};
465 :
466 : // Photopic response corresponding to wavelengths in wlt3
467 : std::array<Real64, Window::numt3> y30 = {
468 : 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, 0.0380, 0.0480, 0.0600,
469 : 0.0739, 0.0910, 0.1126, 0.1390, 0.1693, 0.2080, 0.2586, 0.3230, 0.4073, 0.5030, 0.6082, 0.7100, 0.7932, 0.8620, 0.9149, 0.9540, 0.9803,
470 : 0.9950, 1.0000, 0.9950, 0.9786, 0.9520, 0.9154, 0.8700, 0.8163, 0.7570, 0.6949, 0.6310, 0.5668, 0.5030, 0.4412, 0.3810, 0.3210, 0.2650,
471 : 0.2170, 0.1750, 0.1382, 0.1070, 0.0816, 0.0610, 0.0446, 0.0320, 0.0232, 0.0170, 0.0119, 0.0082, 0.0158, 0.0041, 0.0029, 0.0021, 0.0015,
472 : 0.0010, 0.0007, 0.0005, 0.0004, 0.0002, 0.0002, 0.0001, 0.0001, 0.0001, 0.0000, 0.0000, 0.0000, 0.0000};
473 :
474 : int ngllayer = 0; // Number of glass layers
475 : int nglface = 0; // Number of glass faces
476 : int nglfacep = 0; // Number of glass faces, + 2 if shade layer present
477 : Real64 tout = 0.0; // Outside air temperature (K)
478 : Real64 tin = 0.0; // Inside air temperature (previous timestep) (K)
479 : Real64 tilt = 0.0; // Window tilt (deg)
480 : Real64 tiltr = 0.0; // Window tilt (radians)
481 : Real64 hcin = 0.0; // Convective inside air film conductance (W/m2-K)
482 : Real64 hcout = 0.0; // Convective outside air film conductance (W/m2-K)
483 : Real64 Ebout = 0.0; // Sigma*(outside air temp)**4 (W/m2)
484 : Real64 Outir = 0.0; // IR radiance of window's exterior surround (W/m2)
485 : Real64 Rmir = 0.0; // IR radiance of window's interior surround (W/m2)
486 : Real64 Rtot = 0.0; // Total thermal resistance of window (m2-K/W)
487 : std::array<Window::WindowGap, Window::maxGlassLayers> gaps = {Window::WindowGap()}; // Gas thermal conductivity coefficients for each gap
488 : std::array<Real64, Window::maxGlassLayers> thick = {0.0}; // Glass layer thickness (m)
489 : std::array<Real64, Window::maxGlassLayers> scon = {0.0}; // Glass layer conductance--conductivity/thickness (W/m2-K)
490 :
491 : std::array<Real64, 2 *Window::maxGlassLayers> tir = {0.0}; // Front and back IR transmittance for each glass layer
492 : std::array<Real64, 2 *Window::maxGlassLayers> emis = {0.0}; // Front and back IR emissivity for each glass layer
493 : std::array<Real64, 2 *Window::maxGlassLayers> rir = {0.0}; // Front and back IR reflectance for each glass layer
494 : // (program calculates from tir and emis)
495 : std::array<Real64, 2 *Window::maxGlassLayers> AbsRadGlassFace = {
496 : 0.0}; // Solar radiation and IR radiation from internal gains absorbed by glass face
497 : std::array<Real64, 2 *Window::maxGlassLayers> thetas = {0.0}; // Glass surface temperatures (K)
498 : std::array<Real64, 2 *Window::maxGlassLayers> thetasPrev = {0.0}; // Previous-iteration glass surface temperatures (K)
499 :
500 : std::array<Real64, Window::maxGlassLayers> hrgap = {0.0}; // Radiative gap conductance
501 :
502 : Real64 A23P = 0.0; // Intermediate variables in glass face
503 : Real64 A32P = 0.0;
504 : Real64 A45P = 0.0;
505 : Real64 A54P = 0.0;
506 : Real64 A67P = 0.0;
507 : Real64 A76P = 0.0;
508 : Real64 A23 = 0.0; // heat balance equations
509 : Real64 A45 = 0.0;
510 : Real64 A67 = 0.0;
511 :
512 : // TEMP MOVED FROM DataHeatBalance.hh -BLB
513 :
514 : // for each wavelenth in wle
515 : std::array<std::array<Real64, Window::maxGlassLayers>, Window::maxGlassLayers> top = {0.0}; // Transmittance matrix for subr. op
516 : std::array<std::array<Real64, Window::maxGlassLayers>, Window::maxGlassLayers> rfop = {0.0}; // Front reflectance matrix for subr. op
517 : std::array<std::array<Real64, Window::maxGlassLayers>, Window::maxGlassLayers> rbop = {0.0}; // Back transmittance matrix for subr. op
518 :
519 : std::unique_ptr<Window::CWindowModel> inExtWindowModel; // Information about windows model (interior or exterior)
520 : std::unique_ptr<Window::CWindowOpticalModel> winOpticalModel; // Information about windows optical model (Simplified or BSDF)
521 :
522 : bool RunMeOnceFlag = false;
523 : bool lSimpleGlazingSystem = false; // true if using simple glazing system block model
524 : bool BGFlag = false; // True if between-glass shade or blind
525 : bool locTCFlag = false; // True if this surface is a TC window
526 : bool DoReport = false;
527 : bool HasWindows = false;
528 : bool HasComplexWindows = false;
529 : bool HasEQLWindows = false; // equivalent layer window defined
530 : Real64 SimpleGlazingSHGC = 0.0; // value of SHGC for simple glazing system block model
531 : Real64 SimpleGlazingU = 0.0; // value of U-factor for simple glazing system block model
532 : Real64 tmpTrans = 0.0; // solar transmittance calculated from spectral data
533 : Real64 tmpTransVis = 0.0; // visible transmittance calculated from spectral data
534 : Real64 tmpReflectSolBeamFront = 0.0;
535 : Real64 tmpReflectSolBeamBack = 0.0;
536 : Real64 tmpReflectVisBeamFront = 0.0;
537 : Real64 tmpReflectVisBeamBack = 0.0;
538 :
539 : std::array<int, Window::maxGlassLayers> LayerNum = {0}; // Glass layer number
540 :
541 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
542 : {
543 2126 : }
544 :
545 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
546 : {
547 1152 : }
548 :
549 2100 : void clear_state() override
550 : {
551 2100 : this->ngllayer = 0;
552 2100 : this->nglface = 0;
553 2100 : this->nglfacep = 0;
554 2100 : this->tout = 0.0;
555 2100 : this->tin = 0.0;
556 2100 : this->tilt = 0.0;
557 2100 : this->tiltr = 0.0;
558 2100 : this->hcin = 0.0;
559 2100 : this->hcout = 0.0;
560 2100 : this->Ebout = 0.0;
561 2100 : this->Outir = 0.0;
562 2100 : this->Rmir = 0.0;
563 2100 : this->Rtot = 0.0;
564 2100 : this->gaps = {Window::WindowGap()};
565 2100 : this->thick = {0.0};
566 2100 : this->scon = {0.0};
567 2100 : this->tir = {0.0};
568 2100 : this->emis = {0.0};
569 2100 : this->rir = {0.0};
570 2100 : this->AbsRadGlassFace = {0.0};
571 2100 : this->thetas = {0.0};
572 2100 : this->thetasPrev = {0.0};
573 2100 : this->hrgap = {0.0};
574 2100 : this->A23P = 0.0;
575 2100 : this->A32P = 0.0;
576 2100 : this->A45P = 0.0;
577 2100 : this->A54P = 0.0;
578 2100 : this->A67P = 0.0;
579 2100 : this->A76P = 0.0;
580 2100 : this->A23 = 0.0;
581 2100 : this->A45 = 0.0;
582 2100 : this->A67 = 0.0;
583 2100 : this->top = {0.0};
584 2100 : this->rfop = {0.0};
585 2100 : this->rbop = {0.0};
586 2100 : Window::CWindowConstructionsSimplified::clearState();
587 2100 : this->RunMeOnceFlag = false;
588 2100 : this->lSimpleGlazingSystem = false; // true if using simple glazing system block model
589 2100 : this->BGFlag = false; // True if between-glass shade or blind
590 2100 : this->locTCFlag = false; // True if this surface is a TC window
591 2100 : this->DoReport = false;
592 2100 : this->HasWindows = false;
593 2100 : this->HasComplexWindows = false;
594 2100 : this->HasEQLWindows = false; // equivalent layer window defined
595 2100 : this->SimpleGlazingSHGC = 0.0;
596 2100 : this->SimpleGlazingU = 0.0;
597 2100 : this->tmpTrans = 0.0; // solar transmittance calculated from spectral data
598 2100 : this->tmpTransVis = 0.0; // visible transmittance calculated from spectral data
599 2100 : this->tmpReflectSolBeamFront = 0.0;
600 2100 : this->tmpReflectSolBeamBack = 0.0;
601 2100 : this->tmpReflectVisBeamFront = 0.0;
602 2100 : this->tmpReflectVisBeamBack = 0.0;
603 2100 : }
604 :
605 : // Default Constructor
606 2129 : WindowManagerData()
607 2129 : {
608 2129 : SimpleGlazingSHGC = 0.0;
609 2129 : SimpleGlazingU = 0.0;
610 2129 : tmpReflectSolBeamFront = 0.0;
611 2129 : tmpReflectSolBeamBack = 0.0;
612 2129 : tmpReflectVisBeamFront = 0.0;
613 2129 : tmpReflectVisBeamBack = 0.0;
614 2129 : }
615 : };
616 :
617 : } // namespace EnergyPlus
618 :
619 : #endif
|