Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2024, 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 DataBSDFWindow_hh_INCLUDED
49 : #define DataBSDFWindow_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Array2D.hh>
54 : #include <ObjexxFCL/Array3D.hh>
55 :
56 : // EnergyPlus Headers
57 : #include <EnergyPlus/Data/BaseData.hh>
58 : #include <EnergyPlus/DataVectorTypes.hh>
59 : #include <EnergyPlus/EPVector.hh>
60 : #include <EnergyPlus/EnergyPlus.hh>
61 :
62 : namespace EnergyPlus {
63 :
64 : namespace DataBSDFWindow {
65 :
66 : // Using/Aliasing
67 : using DataVectorTypes::Vector;
68 :
69 : enum class Basis
70 : {
71 : Invalid = -1,
72 : WINDOW,
73 : Custom,
74 : Num
75 : };
76 :
77 : enum class BasisSymmetry
78 : {
79 : Invalid = -1,
80 : Axisymmetric,
81 : None,
82 : Num
83 : };
84 :
85 : // Thermal calculations for complex fenestration can be used to generate reports for standard cases
86 : // noCondition is used when performing timestep calculations
87 : // 'Summer' will override certain parameters so that produced results are matching standard summer WINDOW = software results
88 : // 'Winter' will override certain parameters so that produced results are matching standard winter WINDOW = software results
89 : enum class Condition
90 : {
91 : Invalid = -1,
92 : Summer,
93 : Winter,
94 : Num
95 : };
96 :
97 : struct BasisElemDescr
98 : {
99 : // Members
100 : // The following are in the local coordinate system corresponding to the matrix
101 : Real64 Theta = 0.0; // Centroid Theta value
102 : Real64 Phi = 0.0; // Centroid Phi value
103 : Real64 dTheta = 0.0; // Element width, Theta
104 : Real64 dPhi = 0.0; // Element width, Phi
105 : Real64 UpprTheta = 0.0; // Patch upper edge, Theta
106 : Real64 LwrTheta = 0.0; // Patch lower edge, Theta
107 : Real64 UpprPhi = 0.0; // Patch upper edge, Phi
108 : Real64 LwrPhi = 0.0; // Patch lower edge, Phi
109 : // Note: The dimension index of the BasisElementDescription object corresponds to
110 : // the position (index) of this element in the row or column of property matrix
111 : // Note: the following are intended to be used for interpolating directions among basis elements
112 : int INNbInL = 0; // Index of inward (lower Theta) neighbor, lower phi
113 : int INNbInH = 0; // Index of inward (lower Theta) neighbor, higher phi
114 : int INNbOutL = 0; // Index of outward (higher Theta) neighbor, lower phi
115 : int INNbOutH = 0; // Index of outward (higher Theta) neighbor, higher phi
116 : int INNbLft = 0; // Index of leftward (higher Phi) neighbor (same Theta)
117 : int INNbRt = 0; // Index of rightward (lower Phi) neighbor (same Theta)
118 : // These indices are in the BasisElement array, which matches the row/column of the matrix
119 : };
120 :
121 : struct BSDFDaylghtPosition
122 : {
123 : // Members
124 : Real64 Altitude; // Altitude range is from -pi/2 to pi/2. Horizontal vector have altitude of zero
125 : Real64 Azimuth; // Azimuth is measured from positive x counter clockwise. Its range is from -pi to pi
126 :
127 : // Default Constructor
128 4140 : BSDFDaylghtPosition() : Altitude(0.0), Azimuth(0.0)
129 : {
130 4140 : }
131 :
132 : // Member Constructor
133 48 : BSDFDaylghtPosition(Real64 const Altitude, // Altitude range is from -pi/2 to pi/2. Horizontal vector have altitude of zero
134 : Real64 const Azimuth // Azimuth is measured from positive x counter clockwise. Its range is from -pi to pi
135 : )
136 48 : : Altitude(Altitude), Azimuth(Azimuth)
137 : {
138 48 : }
139 : };
140 :
141 : struct BasisStruct
142 : {
143 : // Members
144 : Basis BasisType = Basis::Invalid; // BasisType_WINDOW or BasisType_Custom (see HeatBalanceManager)
145 : BasisSymmetry BasisSymmetryType = BasisSymmetry::Invalid; // BasisSymmetry_Axisymmetric or BasisSymmetry_None (see HeatBalanceManager)
146 : int BasisMatIndex = 0; // pointer to matrix for basis
147 : int NBasis = 0; // No. elements in basis
148 : Array1D<Real64> Lamda; // Vector of diagonal Lamda matrix elems for grid
149 : Array1D<Real64> SolAng; // Vector of basis element solid angles for grid
150 : int NThetas = 0; // No. Theta values in basis
151 : Array1D<Real64> Thetas; // List of basis theta values
152 : Array1D_int NPhis; // No. basis phi values for each theta
153 : Array2D<Real64> Phis; // List of basis phi values for each theta
154 : Array2D_int BasisIndex; // Index of basis element for theta, phi
155 : Array1D<BasisElemDescr> Grid; // actual basis (to be constructed from matrix)
156 : };
157 :
158 : struct BSDFGeomDescr
159 : {
160 : // Members
161 : BasisStruct Inc; // Basis for incident hemisphere
162 : Array1D<Vector> sInc; // Central direction vectors of incident grid (World coords)
163 : Array1D<BSDFDaylghtPosition> pInc; // azimuth and altitude of incidence vectors
164 : Array1D<Real64> CosInc; // cosine of incident angle
165 : Array1D<Real64> DAInc; // cosine of incident angle times delta theta time delta phi (used in daylighting calculations)
166 : int NSkyUnobs = 0; // Number of Inc basis rays from unobstructed sky
167 : int NGndUnobs = 0; // Number of Inc basis rays from unobstructed ground
168 : int NSky = 0; // Number of Inc basis rays from sky
169 : int NGnd = 0; // Number of Inc basis rays from gnd
170 : int NReflSurf = 0; // Number of Inc basis rays from (potentially reflecting) surfaces
171 : Array1D_int SkyIndex; // list of sky basis indices
172 : Array1D_int GndIndex; // list of gnd basis indices
173 : Array1D<Vector> GndPt; // gnd intersection pt of gnd basis ray (z=0)
174 : Array1D_int RefSurfIndex; // list of basis indices of rays striking exterior surf
175 : Array1D_int RefRayNHits; // for a given ray striking a surface, no. of surfaces pierced
176 : Array2D_int HitSurfNo; // for a given ray striking surface, list of intersected surf nos
177 : Array2D<Real64> HitSurfDSq; // for a given ray striking surface, list of distance^2
178 : // from window
179 : Array2D<Vector> HitPt; // for a given ray striking surface, list of hit pts
180 : Array1D<Real64> SolSkyWt; // Sky intensity weights
181 : Array1D<Real64> SolSkyGndWt; // Wts for sky rad refl from grn
182 : Array3D<Real64> SolBmGndWt; // Wts for beam rad refl from gnd (hour, timestep)
183 : Array2D_int SolBmIndex; // Basis index corresponding to beam dir (hour, timestep)
184 : // Note this is zero if sun is not in incident hemisphere
185 : // otherwise in range 1..NBasis
186 : Array2D<Real64> ThetaBm; // Theta angle corresponging to beam dir (hour, timestep) (rad)
187 : Array2D<Real64> PhiBm; // Theta angle corresponging to beam dir (hour, timestep) (rad)
188 : BasisStruct Trn;
189 : Array1D<Vector> sTrn; // Central direction vectors of Outgoing grid (World coords)
190 : Array1D<BSDFDaylghtPosition> pTrn; // azimuth and altitude of incidence vectors
191 : Array1D_int NSurfInt; // No. of basis rays intersecting back surface (dim from
192 : // NBkSurf in BSDF State Descr)
193 : Array2D_int SurfInt; // Basis index (IBkSurf, j) of the jth ray intersecting IBkSurf
194 : Array2D<Real64> SjdotN; // dot product (IBksurf, j) of the jth ray direction with
195 : // the normal to the back surface
196 : Array2D<Real64> AOverlap; // Overlap areas for each outgoing
197 : // direction (Trn) (no of outgoing dir, NBKSurf)
198 : Array2D<Real64>
199 : ARhoVisOverlap; // Overlap areas multiplied with surface reflectance for each outgoing direction (Trn) (no of outgoing dir, NBKSurf)
200 : Array1D<Real64> AveRhoVisOverlap; // Average visible reflectance from overlap surface which originates from one outgoing direction
201 : bool InitState = true; // Flag for marking that state needs to be initialized
202 : };
203 :
204 : struct BSDFRefPoints
205 : {
206 : // Members
207 : Array1D_int NSky; // number of sky elements for each window element (# window el)
208 : Array1D_int NGnd; // number of ground elements for each window element (# window el)
209 : Array1D_int NReflSurf; // number of Inc basis rays from reflecting surfaces (# window el)
210 : Array2D_int SkyIndex; // list of sky basis indices (# window el, NSky)
211 : Array2D_int GndIndex; // list of gnd basis indices (# window el, NGnd)
212 : Array2D<Vector> GndPt; // gnd intersection pt of gnd basis ray (z=0) (# window el, NGnd)
213 : Array2D<Real64> GndObstrMultiplier; // ground obstruction multiplier used in reflection calculatations (# window el, NGnd)
214 : Array2D_int RefSurfIndex; // list of basis indices of rays striking exterior surf (# window el, NReflSurf)
215 : Array2D_int RefRayNHits; // for a given ray striking a surface, no. of surfaces pierced (# window el, NReflSurf)
216 : Array2D<Real64> TransOutSurf; // total transmittance of exterior obstructions for given incoming basis direction. (# window el, NReflSurf)
217 : Array3D_int HitSurfNo; // for a given ray striking surface, list of intersected surf nos (# window el, NReflSurf, RefRayNHits)
218 : Array3D<Real64> HitSurfDSq; // for a given ray striking surface, list of distance^2 from window (# window el, NReflSurf, RefRayNHits)
219 : Array3D<Vector> HitPt; // for a given ray striking surface, list of hit pts (# window el, NReflSurf, RefRayNHits)
220 : Array1D_int RefPointIndex; // outgoing direction which containts reference point (# window el)
221 : Array1D_bool RefPointIntersection; // determines if reference point is laying in light tube of bsdf outgoing direction (NTrnBasis)
222 : Array1D<Real64> RefPtIntPosFac; // position factors for intersections from reference point to window for each outgoing direction (NTrnBasis)
223 : };
224 :
225 : struct BSDFDaylghtGeomDescr
226 : {
227 : // Members
228 : Array2D<BSDFRefPoints>
229 : IlluminanceMap; // array to keep bsdf coefficients for different illuminance maps (# of illuminance maps, # of reference points)
230 : Array1D<BSDFRefPoints> RefPoint; // keep reference points daylight coefficients (# of reference points)
231 : };
232 :
233 : struct BSDFBkSurfDescr
234 : {
235 : // Members
236 : Array2D<Real64> WinDHBkRefl; // Back directional hemispherical reflectance (hour, timestep)
237 : // of this window for radiation from the back surface window
238 : Array3D<Real64> WinDirBkAbs; // back absorptance (hr, timestep, layer)
239 : // for beam radiation absorbed in this
240 : // window that comes from the back surface window
241 : // Performance May be faster in (layer,hr,timestep) order (loops are not consistent)
242 : // Note: WinDHBkRefl and WinDirBkAbs are the same for all hours & timesteps if the back surface window is a
243 : // Complex Fenestration; they depend on the sun direction if the back surface window is a regular window
244 : };
245 :
246 : struct BSDFStateDescr
247 : {
248 : // Members
249 : int Konst = 0; // pointer to construction for this state; property matrices are in the construction
250 : // INTEGER :: ThermConst =0 ! pointer to thermal construction for this state
251 : Real64 WinDiffTrans = 0.0; // Window hemispherical ave diff trans
252 : // for use in corrections requiring a diffuse trans
253 : // that have not been redone in detail for Compex Fen
254 : Real64 WinDiffVisTrans = 0.0; // Window hemispherical ave diff trans for visible spectrum
255 : Array2D<Real64> WinDirHemiTrans; // Directional-hemispherical transmittance(hr,ts)
256 : Array2D<Real64> WinDirSpecTrans; // Directional specular transmittance(hr,ts)
257 : Real64 WinSkyTrans = 0.0; // Transmittance for sky radiation (weighted average over sky viewed)
258 : Real64 WinSkyGndTrans = 0.0; // Transmittance for sky radiation reflected from ground (average over
259 : // viewed part of ground)
260 : Array2D<Real64> WinBmGndTrans; // Transmittance (hour, timestep) for beam radiation reflected
261 : // from ground (average over unshaded ground viewed)
262 : Real64 WinBkHemRefl = 0.0; // Window back hemispherical reflectance
263 : Real64 WinBkHemVisRefl = 0.0; // Window back hemispherical reflectance (visible spectrum)
264 : //(for reflection of interior diffuse radiation)
265 : int NLayers = 0; // Number of absorbing layers in this window
266 : Array3D<Real64> WinBmFtAbs; // Front directional absorptance (hour, timestep, layer)
267 : Array1D<Real64> WinSkyFtAbs; // Front absorptance (layer) averaged over sky
268 : Array1D<Real64> WinSkyGndAbs; // Front absorptance (layer) averaged over ground
269 : // viewed part of gnd (for ground-reflected sky radiation)
270 : Array3D<Real64> WinBmGndAbs; // Front absorptance (hour, timestep, layer) averaged
271 : // over unshaded ground viewed by beam
272 : Array1D<Real64> WinFtHemAbs; // Front hemispherical absorptance (layers)
273 : Array1D<Real64> WinBkHemAbs; // Back hemispherical absorptance (layers)
274 : Array3D<Real64> WinToSurfBmTrans; // Beam transmittance (hour, timestep, bk surf no)
275 : // to back surface
276 : // Note: the following will be evaluated only if the given back surface is a window
277 : Array1D<BSDFBkSurfDescr> BkSurf; // Structure dimensioned (bk surface no)
278 : // Integrated beam values at front and back sides of window. It is used in calculations of how much of the energy is
279 : // leaving throught the window to other zone or to the outside for certain beam direction
280 : Array1D<Real64> IntegratedFtAbs; // Sum of all back layer absorptances (for each back direction)
281 : Array1D<Real64> IntegratedFtRefl; // Integrated back layer reflectance (for each back direction)
282 : Array1D<Real64> IntegratedFtTrans; // Integrated back layer transmittance (for each back direction)
283 : Array1D<Real64> IntegratedBkAbs; // Sum of all back layer absorptances (for each back direction)
284 : Array1D<Real64> IntegratedBkRefl; // Integrated back layer reflectance (for each back direction)
285 : Array1D<Real64> IntegratedBkTrans; // Integrated back layer transmittance (for each back direction)
286 : };
287 :
288 : struct BSDFRefPointsGeomDescr
289 : {
290 : // Members
291 : Array1D<Real64> SolidAngle; // Solid angle from daylighting reference point to each window element (# window el)
292 : Array1D<Vector> SolidAngleVec; // unit vector from reference point towards center of window element (# window el)
293 : };
294 :
295 : struct BSDFWindowGeomDescr
296 : {
297 : // Members
298 : // This contains all the geometry info that we don't want to carry around in SurfaceWindow
299 : // This is dimensioned like SurfaceWindow, but only surfaces that are complex windows
300 : // will have the structure below allocated
301 : int NumStates = 0; // Number of states for this window
302 : Array1D<BSDFGeomDescr> Geom; // This is dimensioned with number of states
303 : Array1D<BSDFDaylghtGeomDescr> DaylghtGeom; // This is dimensioned with number of states
304 : bool DaylightingInitialized = false; // used for one time initialization only
305 : int NBkSurf = 0; // Number of back (interior) surfaces viewed by this window
306 : Array1D<Vector> sWinSurf; // Unit vector from window center to center of IBkSurf
307 : Array1D<Real64> sdotN; // Dot product of unit vector s with back surface normal
308 : // here s is vector from center of window to center of back surface
309 : // Function of the following subsumed by using an index of 0 if no beam incidence
310 : Array2D<BSDFRefPointsGeomDescr>
311 : IlluminanceMap; // array to keep bsdf coefficients for different illuminance maps (# of illuminance maps, # of reference points)
312 : Array1D<BSDFRefPointsGeomDescr> RefPoint; // keep reference points daylight coefficients (# of reference points)
313 : };
314 :
315 : struct BSDFWindowDescript
316 : {
317 : // Members
318 : int NumStates = 0; // Number of states for this window
319 : int CurrentState = 1; // Current state of this window
320 : Array2D<Real64> ResultAllStates; // Array to hold calculated
321 : // quantities for all states.
322 : // Currently unallocated. To be defined when control
323 : // scheme worked out. This is an array (nvar, nstates)
324 : // to be set up for some number of variables, and calculated
325 : // for all states 1...NumStates each time step. e.g., one variable could be
326 : // total beam transmitted solar, another total transmitted diffuse
327 : // The idea is that for a given time step when one has the
328 : // actual result (total cooling load or whatever), one needs to have
329 : // some information about all the states to decide where to
330 : // set the state variable for the next time step
331 : Array1D<BSDFStateDescr> State; // State description, dimensioned with number of states
332 : };
333 :
334 : struct BSDFLayerAbsorpStruct
335 : {
336 : // Members
337 : int MaterialIndex = 0; // pointer to material layer
338 : int FrtAbsIndex = 0; // pointer to matrix for Front directional absorptance vector
339 : int AbsNcols = 0; // Number of elements (columns) in each of the absorption (row) vectors
340 : Array2D<Real64> FrtAbs; // Front directional absorptance vector
341 : int BkAbsIndex = 0; // pointer to matrix for Back directional absorptance vector
342 : Array2D<Real64> BkAbs; // Back directional absorptance vector
343 : };
344 :
345 : struct BSDFWindowInputStruct
346 : {
347 : // Members
348 : // nested data for Construction
349 : Basis BasisType = Basis::Invalid;
350 : BasisSymmetry BasisSymmetryType = BasisSymmetry::Invalid;
351 : int ThermalModel = 0; // Pointer to thermal model
352 : int BasisMatIndex = 0; // pointer to matrix for basis
353 : int BasisMatNrows = 0; // No. rows in matrix
354 : int BasisMatNcols = 0; // No. columns in matrix
355 : int NBasis = 0; // No. elements in basis
356 : Array2D<Real64> BasisMat; // basis matrix
357 : int SolFrtTransIndex = 0; // pointer to matrix for Front optical transmittance matrix
358 : int SolFrtTransNrows = 0; // No. rows in matrix
359 : int SolFrtTransNcols = 0; // No. columns in matrix
360 : Array2D<Real64> SolFrtTrans; // Front optical transmittance matrix
361 : int SolBkReflIndex = 0; // pointer to matrix for Back optical reflectance matrix
362 : int SolBkReflNrows = 0; // No. rows in matrix
363 : int SolBkReflNcols = 0; // No. columns in matrix
364 : Array2D<Real64> SolBkRefl; // Back optical reflectance matrix
365 : int VisFrtTransIndex = 0; // pointer to matrix for Front visible transmittance matrix
366 : int VisFrtTransNrows = 0; // No. rows in matrix
367 : int VisFrtTransNcols = 0; // No. columns in matrix
368 : Array2D<Real64> VisFrtTrans; // Front visible transmittance matrix
369 : int VisBkReflIndex = 0; // pointer to matrix for Back visible reflectance matrix
370 : int VisBkReflNrows = 0; // No. rows in matrix
371 : int VisBkReflNcols = 0; // No. columns in matrix
372 : Array2D<Real64> VisBkRefl; // Back visible reflectance matrix
373 : int NumLayers = 0;
374 : Array1D<BSDFLayerAbsorpStruct> Layer;
375 : };
376 :
377 : } // namespace DataBSDFWindow
378 :
379 : struct BSDFWindowData : BaseGlobalStruct
380 : {
381 :
382 : int TotComplexFenStates = 0; // Number of complex fenestration construction definitions
383 : int FirstBSDF = 0; // Location of first complex fenestration construction definition in Constr array
384 : int MaxBkSurf = 20; // was 20 Maximum number of back surfaces in solar overlap & interior solar distribution
385 : int TotThermalModels = 0; // Number of thermal models
386 :
387 : // calculation
388 : Array2D<Vector3<Real64>> SUNCOSTS = Array2D<Vector3<Real64>>(60, 24); // Timestep values of solar direction cosines
389 : Array2D<Real64> BSDFTempMtrx; // Temporary matrix for holding axisymmetric input
390 : EPVector<DataBSDFWindow::BSDFWindowGeomDescr> ComplexWind; // Window geometry structure: set in CalcPerSolarBeam/SolarShading
391 :
392 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
393 : {
394 796 : }
395 :
396 0 : void clear_state() override
397 : {
398 0 : new (this) BSDFWindowData();
399 0 : }
400 : };
401 :
402 : } // namespace EnergyPlus
403 :
404 : #endif
|