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 SolarReflectionManager_hh_INCLUDED
49 : #define SolarReflectionManager_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Array2D.hh>
54 : #include <ObjexxFCL/Vector3.hh>
55 :
56 : // EnergyPlus Headers
57 : #include <EnergyPlus/DataGlobals.hh>
58 : #include <EnergyPlus/EnergyPlus.hh>
59 : #include <EnergyPlus/UtilityRoutines.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace SolarReflectionManager {
67 :
68 : struct SolReflRecSurfData
69 : {
70 : // Members
71 : int SurfNum; // Number of heat transfer surface
72 : std::string SurfName; // Name of heat transfer surface
73 : int NumRecPts; // Number of receiving points
74 : Array1D<Vector3<Real64>> RecPt; // Coordinates of receiving point on receiving surface in global CS (m)
75 : Vector3<Real64> NormVec; // Unit outward normal to receiving surface
76 : Real64 ThetaNormVec; // Azimuth of surface normal (radians)
77 : Real64 PhiNormVec; // Altitude of surface normal (radians)
78 : int NumReflRays; // Number of rays from this receiving surface
79 : Array1D<Vector3<Real64>> RayVec; // Unit vector in direction of ray from receiving surface
80 : Array1D<Real64> CosIncAngRay; // Cosine of angle between ray and receiving surface outward normal
81 : Array1D<Real64> dOmegaRay; // Delta solid angle associated with ray
82 : Array2D<Vector3<Real64>> HitPt; // For each receiving point and ray, coords of hit point on obstruction
83 : // that is closest to receiving point (m)
84 : Array2D_int HitPtSurfNum; // Number of surface containing the hit point for a ray, except:
85 : // 0 => ray does not hit an obstruction, but hits sky
86 : // -1 => ray does not hit an obstruction, but hits ground
87 : Array2D<Real64> HitPtSolRefl; // Beam-to-diffuse solar reflectance at hit point
88 : Array2D<Real64> RecPtHitPtDis; // Distance from receiving point to hit point (m)
89 : Array2D<Vector3<Real64>> HitPtNormVec; // Hit point's surface normal unit vector pointing into hemisphere
90 : // containing the receiving point
91 : Array1D_int PossibleObsSurfNums; // Surface numbers of possible obstructions for a receiving surf
92 : int NumPossibleObs; // Number of possible obstructions for a receiving surface
93 :
94 : // Default Constructor
95 9 : SolReflRecSurfData() : SurfNum(0), NumRecPts(0), NormVec(0.0), ThetaNormVec(0.0), PhiNormVec(0.0), NumReflRays(0), NumPossibleObs(0)
96 : {
97 9 : }
98 : };
99 :
100 : void InitSolReflRecSurf(EnergyPlusData &state);
101 :
102 : //=====================================================================================================
103 :
104 : void CalcBeamSolDiffuseReflFactors(EnergyPlusData &state);
105 :
106 : void FigureBeamSolDiffuseReflFactors(EnergyPlusData &state, int const iHour);
107 :
108 : //=================================================================================================
109 :
110 : void CalcBeamSolSpecularReflFactors(EnergyPlusData &state);
111 :
112 : void FigureBeamSolSpecularReflFactors(EnergyPlusData &state, int const iHour);
113 :
114 : //=================================================================================================
115 :
116 : void CalcSkySolDiffuseReflFactors(EnergyPlusData &state);
117 :
118 : } // namespace SolarReflectionManager
119 :
120 : struct SolarReflectionManagerData : BaseGlobalStruct
121 : {
122 :
123 : int TotSolReflRecSurf = 0; // Total number of exterior surfaces that can receive reflected solar
124 : int TotPhiReflRays = 0; // Number of rays in altitude angle (-90 to 90 deg) for diffuse refl calc
125 : int TotThetaReflRays = 0; // Number of rays in azimuth angle (0 to 180 deg) for diffuse refl calc
126 :
127 : Array1D<SolarReflectionManager::SolReflRecSurfData> SolReflRecSurf;
128 :
129 : // static variables extracted from functions
130 : int IHr = 0; // Hour number
131 : Vector3<Real64> SunVec; // Unit vector to sun
132 : int RecSurfNum = 0; // Receiving surface number
133 : int SurfNum = 0; // Heat transfer surface number corresponding to RecSurfNum
134 : int RecPtNum = 0; // Receiving point number
135 : int NumRecPts = 0; // Number of receiving points on a receiving surface
136 : int HitPtSurfNum = 0; // Surface number of hit point: -1 = ground,
137 : // 0 = sky or obstruction with receiving point below ground level,
138 : // >0 = obstruction with receiving point above ground level
139 : int RayNum = 0; // Ray number
140 : Vector3<Real64> OriginThisRay; // Origin point of a ray (m)
141 : Vector3<Real64> ObsHitPt; // Hit point on obstruction (m)
142 : int ObsSurfNum = 0; // Obstruction surface number
143 : Real64 CosIncBmAtHitPt = 0.0; // Cosine of incidence angle of beam solar at hit point
144 : Real64 CosIncBmAtHitPt2 = 0.0; // Cosine of incidence angle of beam solar at hit point, the mirrored shading surface
145 : Real64 BmReflSolRadiance = 0.0; // Solar radiance at hit point due to incident beam, divided by beam normal irradiance
146 : Real64 dReflBeamToDiffSol = 0.0; // Contribution to reflection factor at a receiving point from beam solar reflected from a hit point
147 : Real64 SunLitFract = 0.0; // Sunlit fraction
148 : int NumHr = 0; // Hour number
149 : Vector3<Real64> SunVect; // Unit vector to sun
150 : Vector3<Real64> SunVecMir; // Unit vector to sun mirrored by a reflecting surface
151 : Vector3<Real64> RecPt; // Receiving point (m)
152 : Vector3<Real64> HitPtRefl; // Hit point on a reflecting surface (m)
153 : Vector3<Real64> HitPtObs; // Hit point on obstruction (m)
154 : Vector3<Real64> ReflNorm; // Unit normal to reflecting surface
155 : Real64 SpecReflectance = 0.0; // Specular reflectance of a reflecting surface
156 : int ConstrNumRefl = 0; // Construction number of a reflecting surface
157 : Real64 CosIncAngRefl = 0.0; // Cosine of incidence angle of beam on reflecting surface
158 : Real64 CosIncAngRec = 0.0; // Angle of incidence of reflected beam on receiving surface
159 : Real64 ReflFac = 0.0; // Contribution to specular reflection factor
160 : Real64 CosIncWeighted = 0.0; // Cosine of incidence angle on receiving surf weighted by reflection factor
161 : int iRecSurfNum = 0; // Receiving surface number
162 : int iSurfNum = 0; // Heat transfer surface number corresponding to RecSurfNum
163 : int iObsSurfNum = 0; // Obstruction surface number
164 : int iRecPtNum = 0; // Receiving point number
165 : int iNumRecPts = 0; // Number of receiving points on a receiving surface
166 : int HitPntSurfNum = 0; // Surface number of hit point: -1 = ground,
167 : // 0 = sky or obstruction with receiving point below ground level,
168 : // >0 = obstruction with receiving point above ground level
169 : int HitPtSurfNumX = 0; // For a shading surface, HitPtSurfNum for original surface, HitPitSurfNum + 1 for mirror surface
170 : int iRayNum = 0; // Ray number
171 : Vector3<Real64> HitPntRefl; // Coordinates of hit point on obstruction or ground (m)
172 : Vector3<Real64> HitPntObs; // Hit point on an obstruction (m)
173 : Real64 SkyReflSolRadiance = 0.0; // Reflected radiance at hit point divided by unobstructed sky diffuse horizontal irradiance
174 : Real64 dReflSkySol = 0.0; // Contribution to reflection factor at a receiving point from sky solar reflected from a hit point
175 : Vector3<Real64> URay; // Unit vector along ray from ground hit point
176 : Vector3<Real64> SurfVertToGndPt; // Vector from a vertex of possible obstructing surface to ground hit point (m)
177 : Vector3<Real64> SurfVert; // Surface vertex (m)
178 :
179 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
180 : {
181 796 : }
182 :
183 0 : void clear_state() override
184 : {
185 0 : this->IHr = 0;
186 0 : this->SunVec = 0.0;
187 0 : this->RecSurfNum = 0;
188 0 : this->SurfNum = 0;
189 0 : this->RecPtNum = 0;
190 0 : this->NumRecPts = 0;
191 0 : this->HitPtSurfNum = 0;
192 0 : this->RayNum = 0;
193 0 : this->OriginThisRay = 0.0;
194 0 : this->ObsHitPt = 0.0;
195 0 : this->ObsSurfNum = 0;
196 0 : this->CosIncBmAtHitPt = 0.0;
197 0 : this->CosIncBmAtHitPt2 = 0.0;
198 0 : this->BmReflSolRadiance = 0.0;
199 0 : this->dReflBeamToDiffSol = 0.0;
200 0 : this->SunLitFract = 0.0;
201 0 : this->NumHr = 0;
202 0 : this->SunVect = 0.0;
203 0 : this->SunVecMir = 0.0;
204 0 : this->RecPt = 0.0;
205 0 : this->HitPtRefl = 0.0;
206 0 : this->HitPtObs = 0.0;
207 0 : this->ReflNorm = 0.0;
208 0 : this->SpecReflectance = 0.0;
209 0 : this->ConstrNumRefl = 0;
210 0 : this->CosIncAngRefl = 0.0;
211 0 : this->CosIncAngRec = 0.0;
212 0 : this->ReflFac = 0.0;
213 0 : this->CosIncWeighted = 0.0;
214 0 : this->iRecSurfNum = 0;
215 0 : this->iSurfNum = 0;
216 0 : this->iObsSurfNum = 0;
217 0 : this->iRecPtNum = 0;
218 0 : this->iNumRecPts = 0;
219 0 : this->HitPntSurfNum = 0;
220 0 : this->HitPtSurfNumX = 0;
221 0 : this->iRayNum = 0;
222 0 : this->HitPntRefl = 0.0;
223 0 : this->HitPntObs = 0.0;
224 0 : this->SkyReflSolRadiance = 0.0;
225 0 : this->dReflSkySol = 0.0;
226 0 : this->URay = 0.0;
227 0 : this->SurfVertToGndPt = 0.0;
228 0 : this->SurfVert = 0.0;
229 0 : }
230 :
231 : // Default Constructor
232 796 : SolarReflectionManagerData() = default;
233 : };
234 : } // namespace EnergyPlus
235 :
236 : #endif
|