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 DataDaylighting_hh_INCLUDED
49 : #define DataDaylighting_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Array2D.hh>
54 : #include <ObjexxFCL/Array3D.hh>
55 : #include <ObjexxFCL/Array4D.hh>
56 : #include <ObjexxFCL/Array5D.hh>
57 :
58 : // EnergyPlus Headers
59 : #include <EnergyPlus/Data/BaseData.hh>
60 : #include <EnergyPlus/DataGlobals.hh>
61 : #include <EnergyPlus/EPVector.hh>
62 : #include <EnergyPlus/EnergyPlus.hh>
63 :
64 : namespace EnergyPlus {
65 :
66 : namespace DataDaylighting {
67 :
68 : // Two kinds of reference points: used directly in daylighting, used to show illuminance map of zone
69 : constexpr int MaxMapRefPoints(2500); // Maximum number of Illuminance Map Ref Points
70 :
71 : enum class SkyType : int
72 : {
73 : Invalid = -1,
74 : Clear = 1,
75 : ClearTurbid,
76 : Intermediate,
77 : Overcast,
78 : Num
79 : };
80 :
81 : enum class ExtWinType
82 : {
83 : Invalid = -1,
84 : NotInOrAdjZoneExtWin, // Exterior window is not in a Daylighting:Detailed zone or in an adjacent zone with a shared interior window
85 : InZoneExtWin, // Exterior window is in a Daylighting:Detailed zone
86 : AdjZoneExtWin, // Exterior window is in a zone adjacent to a Daylighting:Detailed zone with which it shares an interior window
87 : Num
88 : };
89 :
90 : enum class CalledFor
91 : {
92 : Invalid = -1,
93 : RefPoint,
94 : MapPoint,
95 : Num
96 : };
97 :
98 : enum class DaylightingMethod
99 : {
100 : Invalid = -1,
101 : None,
102 : SplitFlux,
103 : DElight,
104 : Num
105 : };
106 :
107 : // Parameters for "Lighting Control Type" - these are the values expected by DElight
108 : enum class LtgCtrlType
109 : {
110 : Invalid = -1,
111 : Continuous = 1,
112 : Stepped = 2,
113 : ContinuousOff = 3,
114 : Num
115 : };
116 :
117 : static constexpr std::array<std::string_view, 4> LtgCtrlTypeNamesUC = {"INVALID", "CONTINUOUS", "STEPPED", "CONTINUOUSOFF"};
118 :
119 4 : struct IntWinAdjEnclExtWinStruct // nested structure for EnclDaylightCalc
120 : {
121 : // Members
122 : int SurfNum = 0; // exterior window index
123 : int NumOfIntWindows = 0; // count of interior windows associated with this ext win
124 : Array1D_int IntWinNum; // index numbers for interior windows assoc with this ext win
125 : };
126 :
127 1540 : struct EnclDaylightCalc
128 : {
129 : Real64 aveVisDiffReflect = 0.0; // Area-weighted average inside surface visible reflectance of zone
130 : Real64 totInsSurfArea = 0.0; // Total inside surface area of a daylit zone (m2)
131 : Real64 floorVisRefl = 0.0; // Area-weighted visible reflectance of floor of a daylit zone
132 : int TotalExtWindows = 0; // Total number of exterior windows in the zone or same solar enclosure
133 : Array1D_int AdjIntWinEnclNums; // List of enclosure numbers of adjacent enclosures that have exterior windows and
134 : // share one or more interior windows with target enclosure
135 : int NumOfIntWinAdjEncls = 0; // Number of adjacent enclosures that have exterior windows and share one or
136 : // more interior windows with target enclosure
137 : int NumOfIntWinAdjEnclExtWins = 0; // number of exterior windows associated with enclosure via interior windows
138 : Array1D<IntWinAdjEnclExtWinStruct>
139 : IntWinAdjEnclExtWin; // nested structure | info about exterior window associated with enclosure via interior window
140 : int NumOfDayltgExtWins = 0; // Number of associated exterior windows providing daylight to this enclosure
141 : Array1D_int DayltgExtWinSurfNums; // List of surface numbers of enclosure's exterior windows or
142 : // exterior windows in adjacent enclosures sharing interior windows with the enclosure
143 : bool adjEnclHasDayltgCtrl = false; // True if at least one adjacent enclosure, sharing one or more interior windows, has daylighting control
144 : Real64 MinIntWinSolidAng = 0.0; // Minimum solid angle subtended by an interior window in a zone
145 : Real64 InterReflIllFrIntWins = 0.0; // Inter-reflected illuminance due to beam and diffuse solar passing
146 : // through a zone's interior windows (lux)
147 : bool hasSplitFluxDaylighting = false;
148 : EPVector<int> daylightControlIndexes; // Indexes to daylighting:controls object operating in this enclosure
149 : };
150 :
151 698 : struct DaylightingControl
152 : {
153 : std::string Name; // Name of the daylighting:controls object
154 : std::string ZoneName; // name of the zone where the daylighting:controls object is located
155 : int zoneIndex = 0; // Index to zone where the daylighting:controls object is located
156 : int spaceIndex = 0; // Index to space where the daylighting:controls object is located (0 if specified for a zone)
157 : int enclIndex = 0; // Index to enclosure where the daylighting:controls object is located
158 : DataDaylighting::DaylightingMethod DaylightMethod = DaylightingMethod::None; // Type of Daylighting (1=SplitFlux, 2=DElight)
159 : int AvailSchedNum = 0; // pointer to availability schedule if present
160 : int TotalDaylRefPoints = 0; // Number of daylighting reference points for this control
161 : Array1D_int DaylRefPtNum; // Reference number to DaylRefPt array that stores Daylighting:ReferencePoint
162 : Array2D<Real64> DaylRefPtAbsCoord; // =0.0 ! X,Y,Z coordinates of all daylighting reference points
163 : // in absolute coordinate system (m)
164 : // Points 1 and 2 are the control reference points
165 : Array1D_bool DaylRefPtInBounds; // True when coordinates are in bounds of zone coordinates
166 : Array1D<Real64> FracZoneDaylit; // =0.0 ! Fraction of zone controlled by each reference point
167 : Real64 sumFracLights = 0.0; // Sum of lighting control fractions for this daylighting control
168 : Array1D<Real64> IllumSetPoint; // =0.0 ! Illuminance setpoint at each reference point (lux)
169 : LtgCtrlType LightControlType = LtgCtrlType::Continuous; // Lighting control type (same for all reference points)
170 : // (1=continuous, 2=stepped, 3=continuous/off)
171 : int glareRefPtNumber = 0; // from field: Glare Calculation Daylighting Reference Point Name
172 : Real64 ViewAzimuthForGlare = 0.0; // View direction relative to window for glare calculation (deg)
173 : int MaxGlareallowed = 0; // Maximum allowable discomfort glare index
174 : Real64 MinPowerFraction = 0.0; // Minimum fraction of power input that continuous dimming system can dim down to
175 : Real64 MinLightFraction = 0.0; // Minimum fraction of light output that continuous dimming system can dim down to
176 : int LightControlSteps = 0; // Number of levels (excluding zero) of stepped control system
177 : Real64 LightControlProbability = 0.0; // For manual control of stepped systems, probability that lighting will
178 : Real64 PowerReductionFactor = 1.0; // Electric power reduction factor for this control due to daylighting
179 : Real64 DElightGriddingResolution = 0.0; // Field: Delight Gridding Resolution
180 : Array1D<Real64> RefPtPowerReductionFactor; // =1.0 ! Electric power reduction factor at reference points
181 : // due to daylighting
182 : Array1D<Real64> DaylIllumAtRefPt; // =0.0 ! Daylight illuminance at reference points (lux)
183 : Array1D<Real64> GlareIndexAtRefPt; // =0.0 ! Glare index at reference points
184 : Array1D<Real64> BacLum; // =0.0 ! Background luminance at each reference point (cd/m2)
185 : Array2D<Real64> SolidAngAtRefPt; // (Number of Zones, Total Daylighting Reference Points)
186 : Array2D<Real64> SolidAngAtRefPtWtd; // (Number of Zones, Total Daylighting Reference Points)
187 : Array3D<Real64> IllumFromWinAtRefPt; // (Number of Zones, 2, Total Daylighting Reference Points)
188 : Array3D<Real64> BackLumFromWinAtRefPt; // (Number of Zones, 2, Total Daylighting Reference Points)
189 : Array3D<Real64> SourceLumFromWinAtRefPt; // (Number of Zones, 2, Total Daylighting Reference Points)
190 : Array1D<Real64> TimeExceedingGlareIndexSPAtRefPt;
191 : // Allocatable daylight factor arrays
192 : // Arguments (dimensions) for Dayl---Sky are:
193 : // 1: Sun position index / HourOfDay (1 to 24)
194 : // 2: Shading index (1 to MaxSlatAngs+1; 1 = bare window; 2 = with shade, or, if blinds
195 : // 2 = first slat position, 3 = second position, ..., MaxSlatAngs+1 = last position)
196 : // 3: Reference point number (1 to Total Daylighting Reference Points)
197 : // 4: Sky type (1 to 4; 1 = clear, 2 = clear turbid, 3 = intermediate, 4 = overcast
198 : // 5: Daylit window number (1 to NumOfDayltgExtWins)
199 : Array5D<Real64> DaylIllFacSky;
200 : Array5D<Real64> DaylSourceFacSky;
201 : Array5D<Real64> DaylBackFacSky;
202 : // Arguments (dimensions) for Dayl---Sun are:
203 : // 1: Sun position index / HourOfDay (1 to 24)
204 : // 2: Shading index (1 to MaxSlatAngs+1; 1 = bare window; 2 = with shade, or, if blinds
205 : // 2 = first slat position, 3 = second position, ..., MaxSlatAngs+1 = last position)
206 : // 3: Reference point number (1 to Total Daylighting Reference Points)
207 : // 4: Daylit window number (1 to NumOfDayltgExtWins)
208 : Array4D<Real64> DaylIllFacSun;
209 : Array4D<Real64> DaylIllFacSunDisk;
210 : Array4D<Real64> DaylSourceFacSun;
211 : Array4D<Real64> DaylSourceFacSunDisk;
212 : Array4D<Real64> DaylBackFacSun;
213 : Array4D<Real64> DaylBackFacSunDisk;
214 : // Time exceeding daylight illuminance setpoint at reference points (hours)
215 : Array1D<Real64> TimeExceedingDaylightIlluminanceSPAtRefPt;
216 : std::vector<std::vector<int>> ShadeDeployOrderExtWins; // describes how the fenestration surfaces should deploy the shades.
217 : // It is a list of lists. Each sublist is a group of fenestration surfaces that should be deployed together. Many times the
218 : // sublists a just a single index to a fenestration surface if they are deployed one at a time.
219 : Array1D_int MapShdOrdToLoopNum; // list that maps back the original loop order when using ShadeDeployOrderExtWins for shade deployment
220 : // Time exceeding maximum allowable discomfort glare index at reference points (hours)
221 : };
222 :
223 771 : struct ZoneDaylightCalc
224 : {
225 : Real64 zoneAvgIllumSum = 0.0; // For VisualResilienceSummary reported average illuminance
226 : int totRefPts = 0.0; // For VisualResilienceSummary total number of rereference points
227 : };
228 :
229 138 : struct IllumMapData
230 : {
231 : // Members
232 : std::string Name; // Map name
233 : int zoneIndex; // Index to zone being mapped
234 : int enclIndex = 0; // Index to enclosure for this map
235 : Real64 Z = 0.0; // Elevation or height
236 : Real64 Xmin = 0.0; // Minimum X value
237 : Real64 Xmax = 0.0; // Maximum X value
238 : int Xnum = 0; // Number of X reference points (going N-S)
239 : Real64 Xinc = 0.0; // Increment between X reference points
240 : Real64 Ymin = 0.0; // Minimum Y value
241 : Real64 Ymax = 0.0; // Maximum Y value
242 : int Ynum = 0; // Number of Y reference points (going E-W)
243 : Real64 Yinc = 0.0; // Increment between Y reference points
244 : SharedFileHandle mapFile; // Unit number for map output (later merged to final file)
245 : bool HeaderXLineLengthNeeded = true; // X header will likely be the longest line in the file
246 : int HeaderXLineLength = 0; // actual length of this X header line
247 : std::string pointsHeader; // part of the header that lists the reference points in the same zone
248 : };
249 :
250 138 : struct MapCalcData
251 : {
252 : // Members
253 : int TotalMapRefPoints = 0; // Number of illuminance map reference points in this zone (up to 100)
254 : int zoneIndex = 0; // Pointer to zone being mapped
255 : int enclIndex = 0; // Index to enclosure for this map
256 : Array2D<Real64> MapRefPtAbsCoord; // X,Y,Z coordinates of all illuminance map reference points
257 : // in absolute coordinate system (m)
258 : // Points 1 and 2 are the control reference points
259 : Array1D_bool MapRefPtInBounds; // True when coordinates are in bounds of zone coordinates
260 : Array1D<Real64> DaylIllumAtMapPt; // Daylight illuminance at illuminance map points (lux)
261 : // following Hr - report avg hr
262 : Array1D<Real64> DaylIllumAtMapPtHr; // Daylight illuminance at illuminance map points (lux)
263 : Array3D<Real64> IllumFromWinAtMapPt; // (Number of Zones, 2, Total Map Reference Points)
264 : // Arguments (dimensions) for Dayl---Sky are:
265 : // 1: Sun position index / HourOfDay (1 to 24)
266 : // 2: Shading index (1 to MaxSlatAngs+1; 1 = bare window; 2 = with shade, or, if blinds
267 : // 2 = first slat position, 3 = second position, ..., MaxSlatAngs+1 = last position)
268 : // 3: Reference point number (1 to Total Map Reference Points)
269 : // 4: Sky type (1 to 4; 1 = clear, 2 = clear turbid, 3 = intermediate, 4 = overcast
270 : // 5: Daylit window number (1 to NumOfDayltgExtWins)
271 : Array5D<Real64> DaylIllFacSky;
272 : // Arguments (dimensions) for Dayl---Sun are:
273 : // 1: Sun position index / HourOfDay (1 to 24)
274 : // 2: Shading index (1 to MaxSlatAngs+1; 1 = bare window; 2 = with shade, or, if blinds
275 : // 2 = first slat position, 3 = second position, ..., MaxSlatAngs+1 = last position)
276 : // 3: Reference point number (1 to Total Map Reference Points)
277 : // 4: Daylit window number (1 to NumOfDayltgExtWins)
278 : Array4D<Real64> DaylIllFacSun;
279 : Array4D<Real64> DaylIllFacSunDisk;
280 : };
281 :
282 1056 : struct RefPointData
283 : {
284 : std::string Name; // Map name
285 : int ZoneNum = 0; // Pointer to zone being referenced
286 : Real64 x = 0.0; // x coordinate
287 : Real64 y = 0.0; // y coordinate
288 : Real64 z = 0.0; // z coordinate
289 : int indexToFracAndIllum = 0;
290 : };
291 :
292 10 : struct DElightComplexFeneData // holds Daylighting:DELight:ComplexFenestration
293 : {
294 : std::string Name;
295 : std::string ComplexFeneType; // Complex Fenestration Type
296 : std::string surfName; // Building Surface name
297 : std::string wndwName; // Window name
298 : Real64 feneRota; // Fenestration Rotation
299 : };
300 :
301 : } // namespace DataDaylighting
302 :
303 1542 : struct DaylightingData : BaseGlobalStruct
304 : {
305 : int maxRefPointsPerControl = 0;
306 : bool mapResultsToReport = false; // used when only partial hour has "sun up"
307 : bool mapResultsReported = false; // when no map results are ever reported this will still be false
308 : char MapColSep; // Character for separating map columns (tab, space, comma)
309 : bool DFSReportSizingDays = false;
310 : bool DFSReportAllShadowCalculationDays = false;
311 :
312 : Array1D<DataDaylighting::EnclDaylightCalc> enclDaylight;
313 : Array1D<DataDaylighting::ZoneDaylightCalc> ZoneDaylight;
314 : Array1D<DataDaylighting::DaylightingControl> daylightControl;
315 : Array1D<DataDaylighting::IllumMapData> IllumMap;
316 : Array1D<DataDaylighting::MapCalcData> IllumMapCalc;
317 : Array1D<DataDaylighting::RefPointData> DaylRefPt;
318 : Array1D<DataDaylighting::DElightComplexFeneData> DElightComplexFene;
319 : Array1D<Real64> spacePowerReductionFactor; // Average electric power reduction factor for space due to daylighting
320 :
321 0 : void clear_state() override
322 : {
323 0 : *this = DaylightingData();
324 0 : }
325 : };
326 :
327 : } // namespace EnergyPlus
328 :
329 : #endif
|