LCOV - code coverage report
Current view: top level - EnergyPlus - DaylightingManager.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 8 161 5.0 %
Date: 2023-01-17 19:17:23 Functions: 2 3 66.7 %

          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 DaylightingManager_hh_INCLUDED
      49             : #define DaylightingManager_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1A.hh>
      53             : #include <ObjexxFCL/Array2A.hh>
      54             : #include <ObjexxFCL/Array2S.hh>
      55             : #include <ObjexxFCL/Array3D.hh>
      56             : #include <ObjexxFCL/Vector3.fwd.hh>
      57             : 
      58             : // EnergyPlus Headers
      59             : #include <EnergyPlus/DataBSDFWindow.hh>
      60             : #include <EnergyPlus/DataDaylighting.hh>
      61             : #include <EnergyPlus/DataSurfaces.hh>
      62             : #include <EnergyPlus/EnergyPlus.hh>
      63             : 
      64             : namespace EnergyPlus {
      65             : 
      66             : // Forward declarations
      67             : struct EnergyPlusData;
      68             : 
      69             : namespace DaylightingManager {
      70             : 
      71             :     // Surface count crossover for using octree algorithm
      72             :     // The octree gives lower computational complexity for much higher performance
      73             :     //  as the surface count increases but has some overhead such that the direct
      74             :     //  algorithm can be more efficient at small surface counts.
      75             :     // Testing to date shows that the octree performance is close to that of the
      76             :     //  direct algorithm even with small surface counts and that there is no single
      77             :     //  crossover that is ideal for all models: some cases with 10-30 surfaces were
      78             :     //  faster with the octree but another with 80 surfaces was faster with the
      79             :     //  direct algorithm.
      80             :     // A reasonable, conservative crossover is selected but may be refined as more
      81             :     //  experience is gained.
      82             :     constexpr int octreeCrossover(100); // Octree surface count crossover
      83             :     constexpr int NTH(18);              // Number of azimuth steps for sky integration
      84             :     constexpr int NPH(8);               // Number of altitude steps for sky integration
      85             :     constexpr int NPHMAX(10);           // Number of sky/ground integration steps in altitude
      86             :     constexpr int NTHMAX(16);           // Number of sky/ground integration steps in azimuth
      87             : 
      88             :     void DayltgAveInteriorReflectance(EnergyPlusData &state, int const enclNum); // Enclosure number
      89             : 
      90             :     void CalcDayltgCoefficients(EnergyPlusData &state);
      91             : 
      92             :     void CalcDayltgCoeffsRefMapPoints(EnergyPlusData &state);
      93             : 
      94             :     void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum);
      95             : 
      96             :     void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum);
      97             : 
      98             :     void FigureDayltgCoeffsAtPointsSetupForWindow(
      99             :         EnergyPlusData &state,
     100             :         int const daylightCtrlNum, // zero if called for map points
     101             :         int const iRefPoint,
     102             :         int const loopwin,
     103             :         DataDaylighting::CalledFor const CalledFrom, // indicate  which type of routine called this routine
     104             :         Vector3<Real64> const &RREF,                 // Location of a reference point in absolute coordinate system
     105             :         Vector3<Real64> const &VIEWVC,               // View vector in absolute coordinate system
     106             :         int &IWin,
     107             :         int &IWin2,
     108             :         int &NWX,
     109             :         int &NWY,
     110             :         Vector3<Real64> &W2,                     // Second vertex of window
     111             :         Vector3<Real64> &W3,                     // Third vertex of window
     112             :         Vector3<Real64> &W21,                    // Vector from window vertex 2 to window vertex 1
     113             :         Vector3<Real64> &W23,                    // Vector from window vertex 2 to window vertex 3
     114             :         int &LSHCAL,                             // Interior shade calculation flag:  0=not yet calculated, 1=already calculated
     115             :         int &InShelfSurf,                        // Inside daylighting shelf surface number
     116             :         int &ICtrl,                              // Window control counter
     117             :         DataSurfaces::WinShadingType &ShType,    // Window shading type
     118             :         int &BlNum,                              // Window blind number
     119             :         Vector3<Real64> &WNORM2,                 // Unit vector normal to window
     120             :         DataDaylighting::ExtWinType &ExtWinType, // Exterior window type (InZoneExtWin, AdjZoneExtWin, NotInOrAdjZoneExtWin)
     121             :         int &IConst,                             // Construction counter
     122             :         Vector3<Real64> &RREF2,                  // Location of virtual reference point in absolute coordinate system
     123             :         Real64 &DWX,                             // Horizontal dimension of window element (m)
     124             :         Real64 &DWY,                             // Vertical dimension of window element (m)
     125             :         Real64 &DAXY,                            // Area of window element
     126             :         Vector3<Real64> &U2,                     // Second vertex of window for TDD:DOME (if exists)
     127             :         Vector3<Real64> &U23,                    // Vector from window vertex 2 to window vertex 3 for TDD:DOME (if exists)
     128             :         Vector3<Real64> &U21,                    // Vector from window vertex 2 to window vertex 1 for TDD:DOME (if exists)
     129             :         Vector3<Real64> &VIEWVC2,                // Virtual view vector in absolute coordinate system
     130             :         bool &Rectangle,                         // True if window is rectangular
     131             :         bool &Triangle,                          // True if window is triangular
     132             :         int const MapNum = 0);
     133             : 
     134             :     void FigureDayltgCoeffsAtPointsForWindowElements(
     135             :         EnergyPlusData &state,
     136             :         int const daylightCtrlNum, // Current daylighting control number (only used when called from RefPoint)
     137             :         int const iRefPoint,
     138             :         int const loopwin,
     139             :         DataDaylighting::CalledFor const CalledFrom, // indicate  which type of routine called this routine
     140             :         int const WinEl,                             // Current window element number
     141             :         int const IWin,
     142             :         int const IWin2,
     143             :         int const iXelement,
     144             :         int const iYelement,
     145             :         Real64 &SkyObstructionMult,
     146             :         Vector3<Real64> const &W2,                    // Second vertex of window
     147             :         Vector3<Real64> const &W21,                   // Vector from window vertex 2 to window vertex 1
     148             :         Vector3<Real64> const &W23,                   // Vector from window vertex 2 to window vertex 3
     149             :         Vector3<Real64> const &RREF,                  // Location of a reference point in absolute coordinate system
     150             :         int const NWYlim,                             // For triangle, largest NWY for a given IX
     151             :         Vector3<Real64> const &VIEWVC2,               // Virtual view vector in absolute coordinate system
     152             :         Real64 const DWX,                             // Horizontal dimension of window element (m)
     153             :         Real64 const DWY,                             // Vertical dimension of window element (m)
     154             :         Real64 const DAXY,                            // Area of window element
     155             :         Vector3<Real64> const &U2,                    // Second vertex of window for TDD:DOME (if exists)
     156             :         Vector3<Real64> const &U23,                   // Vector from window vertex 2 to window vertex 3 for TDD:DOME (if exists)
     157             :         Vector3<Real64> const &U21,                   // Vector from window vertex 2 to window vertex 1 for TDD:DOME (if exists)
     158             :         Vector3<Real64> &RWIN,                        // Center of a window element for TDD:DOME (if exists) in abs coord sys
     159             :         Vector3<Real64> &RWIN2,                       // Center of a window element for TDD:DOME (if exists) in abs coord sys
     160             :         Vector3<Real64> &Ray,                         // Unit vector along ray from reference point to window element
     161             :         Real64 &PHRAY,                                // Altitude of ray from reference point to window element (radians)
     162             :         int &LSHCAL,                                  // Interior shade calculation flag:  0=not yet calculated, 1=already calculated
     163             :         Real64 &COSB,                                 // Cosine of angle between window outward normal and ray from reference point to window element
     164             :         Real64 &ObTrans,                              // Product of solar transmittances of exterior obstructions hit by ray
     165             :         Real64 &TVISB,                                // Visible transmittance of window for COSB angle of incidence (times light well
     166             :         Real64 &DOMEGA,                               // Solid angle subtended by window element wrt reference point (steradians)
     167             :         Real64 &THRAY,                                // Azimuth of ray from reference point to window element (radians)
     168             :         bool &hitIntObs,                              // True iff interior obstruction hit
     169             :         bool &hitExtObs,                              // True iff ray from ref pt to ext win hits an exterior obstruction
     170             :         Vector3<Real64> const &WNORM2,                // Unit vector normal to window
     171             :         DataDaylighting::ExtWinType const ExtWinType, // Exterior window type (InZoneExtWin, AdjZoneExtWin, NotInOrAdjZoneExtWin)
     172             :         int const IConst,                             // Construction counter
     173             :         Vector3<Real64> const &RREF2,                 // Location of virtual reference point in absolute coordinate system
     174             :         bool const Triangle,
     175             :         Real64 &TVISIntWin,     // Visible transmittance of int win at COSBIntWin for light from ext win
     176             :         Real64 &TVISIntWinDisk, // Visible transmittance of int win at COSBIntWin for sun
     177             :         int const MapNum = 0);
     178             : 
     179             :     void InitializeCFSDaylighting(EnergyPlusData &state,
     180             :                                   int const daylightCtrlNum,       // Current daylighting control number
     181             :                                   int const IWin,                  // Complex fenestration number
     182             :                                   int const NWX,                   // Number of horizontal divisions
     183             :                                   int const NWY,                   // Number of vertical divisions
     184             :                                   Vector3<Real64> const &RefPoint, // reference point coordinates
     185             :                                   int const NRefPts,               // Number of reference points
     186             :                                   int const iRefPoint,             // Reference points counter
     187             :                                   DataDaylighting::CalledFor const CalledFrom,
     188             :                                   int const MapNum = 0);
     189             : 
     190             :     void InitializeCFSStateData(EnergyPlusData &state,
     191             :                                 DataBSDFWindow::BSDFRefPoints &StateRefPoint,
     192             :                                 DataBSDFWindow::BSDFRefPointsGeomDescr &DaylghtGeomDescr,
     193             :                                 int const daylightCtrlNum, // Current daylighting control number
     194             :                                 int const iWin,
     195             :                                 Vector3<Real64> const &RefPoint, // reference point
     196             :                                 int const CurFenState,
     197             :                                 int const NBasis,
     198             :                                 int const NTrnBasis,
     199             :                                 Real64 const AZVIEW,
     200             :                                 int const NWX,
     201             :                                 int const NWY,
     202             :                                 Vector3<Real64> const &W2,
     203             :                                 Vector3<Real64> const &W21,
     204             :                                 Vector3<Real64> const &W23,
     205             :                                 Real64 const DWX,
     206             :                                 Real64 const DWY,
     207             :                                 Vector3<Real64> const &WNorm, // unit vector from window (point towards outside)
     208             :                                 Real64 const WinElArea);
     209             : 
     210             :     void AllocateForCFSRefPointsState(
     211             :         EnergyPlusData &state, DataBSDFWindow::BSDFRefPoints &StateRefPoint, int const NumOfWinEl, int const NBasis, int const NTrnBasis);
     212             : 
     213             :     void AllocateForCFSRefPointsGeometry(DataBSDFWindow::BSDFRefPointsGeomDescr &RefPointsGeomDescr, int const NumOfWinEl);
     214             : 
     215             :     void CFSRefPointSolidAngle(EnergyPlusData &state,
     216             :                                Vector3<Real64> const &RefPoint,
     217             :                                Vector3<Real64> const &RWin,
     218             :                                Vector3<Real64> const &WNorm,
     219             :                                DataBSDFWindow::BSDFRefPoints &RefPointMap,
     220             :                                DataBSDFWindow::BSDFRefPointsGeomDescr &RefPointGeomMap,
     221             :                                int const iWin,
     222             :                                int const CurFenState,
     223             :                                int const NTrnBasis,
     224             :                                int const curWinEl,
     225             :                                Real64 const WinElArea);
     226             : 
     227             :     void CFSRefPointPosFactor(EnergyPlusData &state,
     228             :                               Vector3<Real64> const &RefPoint,
     229             :                               DataBSDFWindow::BSDFRefPoints &RefPointMap,
     230             :                               int const iWin,
     231             :                               int const CurFenState,
     232             :                               int const NTrnBasis,
     233             :                               Real64 const AZVIEW);
     234             : 
     235             :     Real64 CalcObstrMultiplier(EnergyPlusData &state,
     236             :                                Vector3<Real64> const &GroundHitPt, // Coordinates of point that ray hits ground (m)
     237             :                                int const AltSteps,                 // Number of steps in altitude angle for solar reflection calc
     238             :                                int const AzimSteps                 // Number of steps in azimuth angle of solar reflection calc
     239             :     );
     240             : 
     241             :     void FigureDayltgCoeffsAtPointsForSunPosition(
     242             :         EnergyPlusData &state,
     243             :         int const daylightCtrlNum, // Current daylighting control number
     244             :         int const iRefPoint,
     245             :         int const iXelement,
     246             :         int const NWX, // Number of window elements in x direction for dayltg calc
     247             :         int const iYelement,
     248             :         int const NWY,   // Number of window elements in y direction for dayltg calc
     249             :         int const WinEl, // Current window element counter
     250             :         int const IWin,
     251             :         int const IWin2,
     252             :         int const iHour,
     253             :         int &ISunPos,
     254             :         Real64 const SkyObstructionMult,
     255             :         Vector3<Real64> const &RWIN2, // Center of a window element for TDD:DOME (if exists) in abs coord sys
     256             :         Vector3<Real64> const &Ray,   // Unit vector along ray from reference point to window element
     257             :         Real64 const PHRAY,           // Altitude of ray from reference point to window element (radians)
     258             :         int const LSHCAL,             // Interior shade calculation flag:  0=not yet calculated, 1=already calculated
     259             :         int const InShelfSurf,        // Inside daylighting shelf surface number
     260             :         Real64 const COSB,            // Cosine of angle between window outward normal and ray from reference point to window element
     261             :         Real64 const ObTrans, // Product of solar transmittances of exterior obstructions hit by ray from reference point through a window element
     262             :         Real64 const TVISB,   // Visible transmittance of window for COSB angle of incidence (times light well efficiency, if appropriate)
     263             :         Real64 const DOMEGA,  // Solid angle subtended by window element wrt reference point (steradians)
     264             :         int const ICtrl,      // Window control counter
     265             :         DataSurfaces::WinShadingType const ShType,    // Window shading type
     266             :         int const BlNum,                              // Window blind number
     267             :         Real64 const THRAY,                           // Azimuth of ray from reference point to window element (radians)
     268             :         Vector3<Real64> const &WNORM2,                // Unit vector normal to window
     269             :         DataDaylighting::ExtWinType const ExtWinType, // Exterior window type (InZoneExtWin, AdjZoneExtWin, NotInOrAdjZoneExtWin)
     270             :         int const IConst,                             // Construction counter
     271             :         Real64 const AZVIEW,                          // Azimuth of view vector in absolute coord system for glare calculation (radians)
     272             :         Vector3<Real64> const &RREF2,                 // Location of virtual reference point in absolute coordinate system
     273             :         bool const hitIntObs,                         // True iff interior obstruction hit
     274             :         bool const hitExtObs,                         // True iff ray from ref pt to ext win hits an exterior obstruction
     275             :         DataDaylighting::CalledFor const CalledFrom,  // indicate  which type of routine called this routine
     276             :         Real64 &TVISIntWin,                           // Visible transmittance of int win at COSBIntWin for light from ext win
     277             :         Real64 &TVISIntWinDisk,                       // Visible transmittance of int win at COSBIntWin for sun
     278             :         int const MapNum = 0);
     279             : 
     280             :     void FigureRefPointDayltgFactorsToAddIllums(EnergyPlusData &state,
     281             :                                                 int const daylightCtrlNum, // Current daylighting control number
     282             :                                                 int const iRefPoint,
     283             :                                                 int const iHour,
     284             :                                                 int &ISunPos,
     285             :                                                 int const IWin,
     286             :                                                 int const loopwin,
     287             :                                                 int const NWX,  // Number of window elements in x direction for dayltg calc
     288             :                                                 int const NWY,  // Number of window elements in y direction for dayltg calc
     289             :                                                 int const ICtrl // Window control counter
     290             :     );
     291             : 
     292             :     void FigureMapPointDayltgFactorsToAddIllums(EnergyPlusData &state,
     293             :                                                 int const MapNum,
     294             :                                                 int const iMapPoint,
     295             :                                                 int const iHour,
     296             :                                                 int const IWin,
     297             :                                                 int const loopwin,
     298             :                                                 int const ICtrl // Window control counter
     299             :     );
     300             : 
     301             :     void GetDaylightingParametersInput(EnergyPlusData &state);
     302             : 
     303             :     void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound);
     304             : 
     305             :     void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound);
     306             : 
     307             :     void GeometryTransformForDaylighting(EnergyPlusData &state);
     308             : 
     309             :     void GetInputDayliteRefPt(EnergyPlusData &state, bool &ErrorsFound);
     310             : 
     311             :     bool doesDayLightingUseDElight(EnergyPlusData &state);
     312             : 
     313             :     void CheckTDDsAndLightShelvesInDaylitZones(EnergyPlusData &state);
     314             : 
     315             :     void AssociateWindowShadingControlWithDaylighting(EnergyPlusData &state);
     316             : 
     317             :     void GetLightWellData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
     318             : 
     319             :     int findWinShadingStatus(int const IWin);
     320             : 
     321             :     void DayltgGlare(EnergyPlusData &state,
     322             :                      int &IL,                  // Reference point index: 1=first ref pt, 2=second ref pt
     323             :                      Real64 &BLUM,             // Window background (surround) luminance (cd/m2)
     324             :                      Real64 &GLINDX,           // Glare index
     325             :                      int const daylightCtrlNum // Current daylighting control number
     326             :     );
     327             : 
     328             :     void DayltgGlareWithIntWins(EnergyPlusData &state,
     329             :                                 Array1D<Real64> &GLINDX,  // Glare index
     330             :                                 int const daylightCtrlNum // Current daylighting control number
     331             :     );
     332             : 
     333             :     void DayltgExtHorizIllum(EnergyPlusData &state,
     334             :                              Array1A<Real64> HISK, // Horizontal illuminance from sky for different sky types
     335             :                              Real64 &HISU          // Horizontal illuminance from sun for unit beam normal
     336             :     );
     337             : 
     338             :     void DayltgHitObstruction(EnergyPlusData &state,
     339             :                               int const IHOUR,           // Hour number
     340             :                               int const IWin,            // Window index
     341             :                               Vector3<Real64> const &R1, // Origin of ray (m)
     342             :                               Vector3<Real64> const &RN, // Unit vector along ray
     343             :                               Real64 &ObTrans            // Product of solar transmittances of exterior obstructions
     344             :     );
     345             : 
     346             :     void DayltgHitInteriorObstruction(EnergyPlusData &state,
     347             :                                       int const IWin,            // Window index
     348             :                                       Vector3<Real64> const &R1, // Origin of ray (m)
     349             :                                       Vector3<Real64> const &R2, // Destination of ray (m)
     350             :                                       bool &hit                  // True iff ray hits an obstruction
     351             :     );
     352             : 
     353             :     void DayltgHitBetWinObstruction(EnergyPlusData &state,
     354             :                                     int const IWin1,           // Surface number of origin window
     355             :                                     int const IWin2,           // Surface number of destination window
     356             :                                     Vector3<Real64> const &R1, // Origin of ray (on IWin1) (m)
     357             :                                     Vector3<Real64> const &R2, // Destination of ray (on IWin2) (m)
     358             :                                     bool &hit                  // True iff ray hits an obstruction
     359             :     );
     360             : 
     361             :     void initDaylighting(EnergyPlusData &state, bool const initSurfaceHeatBalancefirstTime);
     362             : 
     363             :     void manageDaylighting(EnergyPlusData &state);
     364             : 
     365             :     void DayltgInteriorIllum(EnergyPlusData &state, int const daylightCtrlNum); // Daylighting:Controls number
     366             : 
     367             :     void DayltgInteriorTDDIllum(EnergyPlusData &state);
     368             : 
     369             :     void DayltgElecLightingControl(EnergyPlusData &state);
     370             : 
     371             :     Real64 DayltgGlarePositionFactor(Real64 &X, // Lateral and vertical distance of luminous window element from
     372             :                                      Real64 &Y);
     373             : 
     374             :     void DayltgInterReflectedIllum(EnergyPlusData &state,
     375             :                                    int const ISunPos, // Sun position counter; used to avoid calculating various
     376             :                                    int const IHR,     // Hour of day
     377             :                                    int const enclNum, // Daylighting enclosure index
     378             :                                    int const IWin     // Window index
     379             :     );
     380             : 
     381             :     void ComplexFenestrationLuminances(EnergyPlusData &state,
     382             :                                        int const IWin,
     383             :                                        int const WinEl,
     384             :                                        int const NBasis,
     385             :                                        int const IHR,
     386             :                                        int const iRefPoint,
     387             :                                        Array2<Real64> &ElementLuminanceSky,      // sky related luminance at window element (exterior side)
     388             :                                        Array1D<Real64> &ElementLuminanceSun,     // sun related luminance at window element (exterior side),
     389             :                                        Array1D<Real64> &ElementLuminanceSunDisk, // sun related luminance at window element (exterior side),
     390             :                                        DataDaylighting::CalledFor const CalledFrom,
     391             :                                        int const MapNum = 0);
     392             : 
     393             :     void DayltgInterReflectedIllumComplexFenestration(EnergyPlusData &state,
     394             :                                                       int const IWin,            // Window index
     395             :                                                       int const WinEl,           // Current window element counter
     396             :                                                       int const IHR,             // Hour of day
     397             :                                                       int const daylightCtrlNum, // Daylighting control number
     398             :                                                       int const iRefPoint,       // reference point counter
     399             :                                                       DataDaylighting::CalledFor const CalledFrom,
     400             :                                                       int const MapNum = 0);
     401             : 
     402             :     void DayltgDirectIllumComplexFenestration(EnergyPlusData &state,
     403             :                                               int const IWin,      // Window index
     404             :                                               int const WinEl,     // Current window element counter
     405             :                                               int const IHR,       // Hour of day
     406             :                                               int const iRefPoint, // reference point index
     407             :                                               DataDaylighting::CalledFor const CalledFrom,
     408             :                                               int const MapNum = 0);
     409             : 
     410             :     void DayltgDirectSunDiskComplexFenestration(EnergyPlusData &state,
     411             :                                                 int const iWin,  // Window index
     412             :                                                 int const iHour, // Hour of day
     413             :                                                 int const iRefPoint,
     414             :                                                 int const NumEl,                             // Total number of window elements
     415             :                                                 Real64 const AZVIEW,                         // Azimuth of view vector in absolute coord system for
     416             :                                                 DataDaylighting::CalledFor const CalledFrom, // indicate  which type of routine called this routine
     417             :                                                 int const MapNum = 0);
     418             : 
     419             :     Real64 DayltgSkyLuminance(EnergyPlusData &state,
     420             :                               int const ISky,     // Sky type: 1=clear, 2=clear turbid, 3=intermediate, 4=overcast
     421             :                               Real64 const THSKY, // Azimuth and altitude of sky element (radians)
     422             :                               Real64 const PHSKY);
     423             : 
     424             :     void ProfileAngle(EnergyPlusData &state,
     425             :                       int const SurfNum,                                      // Surface number
     426             :                       Vector3<Real64> const &CosDirSun,                       // Solar direction cosines
     427             :                       DataWindowEquivalentLayer::Orientation const HorOrVert, // If HORIZONTAL, calculates ProfileAngHor
     428             :                       Real64 &ProfileAng                                      // Solar profile angle (radians).
     429             :     );
     430             : 
     431             :     void DayltgClosestObstruction(EnergyPlusData &state,
     432             :                                   Vector3<Real64> const &RecPt,  // Point on window from which ray emanates (m)
     433             :                                   Vector3<Real64> const &RayVec, // Unit vector along ray pointing away from window (m)
     434             :                                   int &NearestHitSurfNum,        // Surface number of nearest obstruction that is hit by ray;
     435             :                                   Vector3<Real64> &NearestHitPt  // Ray's hit point on nearest obstruction (m)
     436             :     );
     437             : 
     438             :     void DayltgSurfaceLumFromSun(EnergyPlusData &state,
     439             :                                  int const IHR,                    // Hour number
     440             :                                  Vector3<Real64> const &Ray,       // Ray from window to reflecting surface (m)
     441             :                                  int const ReflSurfNum,            // Number of surface for which luminance is being calculated
     442             :                                  Vector3<Real64> const &ReflHitPt, // Point on ReflSurfNum for luminance calculation (m)
     443             :                                  Real64 &LumAtReflHitPtFrSun       // Luminance at ReflHitPt from beam solar reflection for unit
     444             :     );
     445             : 
     446             :     void DayltgInteriorMapIllum(EnergyPlusData &state);
     447             : 
     448             :     void ReportIllumMap(EnergyPlusData &state, int const MapNum);
     449             : 
     450             :     void CloseReportIllumMaps(EnergyPlusData &state);
     451             : 
     452             :     void CloseDFSFile(EnergyPlusData &state);
     453             : 
     454             :     void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state);
     455             : 
     456             :     std::size_t CreateShadeDeploymentOrder(EnergyPlusData &state, int const enclNum);
     457             : 
     458             :     void MapShadeDeploymentOrderToLoopNumber(EnergyPlusData &state, int const enclNum);
     459             : 
     460             :     void DayltgInterReflIllFrIntWins(EnergyPlusData &state, int const enclNum);
     461             : 
     462             :     void CalcMinIntWinSolidAngs(EnergyPlusData &state);
     463             : 
     464             :     void CheckForGeometricTransform(EnergyPlusData &state, bool &doTransform, Real64 &OldAspectRatio, Real64 &NewAspectRatio);
     465             : 
     466             :     void WriteDaylightMapTitle(EnergyPlusData &state,
     467             :                                int const mapNum,
     468             :                                InputOutputFile &mapFile,
     469             :                                std::string const &mapName,
     470             :                                std::string const &environmentName,
     471             :                                int const ZoneNum,
     472             :                                std::string const &refPts,
     473             :                                Real64 const zcoord);
     474             : 
     475             : } // namespace DaylightingManager
     476             : 
     477         771 : struct DaylightingManagerData : BaseGlobalStruct
     478             : {
     479             : 
     480             :     bool CalcDayltghCoefficients_firstTime = true;
     481             :     bool getDaylightingParametersInputFlag = true;
     482             :     bool refFirstTime = true;
     483             :     bool DayltgInteriorIllum_firstTime = true; // true first time routine is called
     484             :     bool FirstTimeDaylFacCalc = true;
     485             :     bool VeryFirstTime = true;
     486             :     bool mapFirstTime = true;
     487             :     bool CheckTDDs_firstTime = true;
     488             :     bool DayltgExtHorizIllum_firstTime = true; // flag for first time thru to initialize
     489             :     bool DayltgInteriorMapIllum_FirstTimeFlag = true;
     490             :     bool ReportIllumMap_firstTime = true;
     491             :     bool SQFirstTime = true;
     492             :     bool doSkyReporting = true;
     493             :     bool CreateDFSReportFile = true;
     494             : 
     495             :     int TotWindowsWithDayl = 0;                          // Total number of exterior windows in all daylit zones
     496             :     Array1D<Real64> DaylIllum;                           // Daylight illuminance at reference points (lux)
     497             :     int maxNumRefPtInAnyDaylCtrl = 0;                    // The most number of reference points that any single daylighting control has
     498             :     int maxNumRefPtInAnyEncl = 0;                        // The most number of reference points that any single enclosure has
     499             :     Real64 PHSUN = 0.0;                                  // Solar altitude (radians)
     500             :     Real64 SPHSUN = 0.0;                                 // Sine of solar altitude
     501             :     Real64 CPHSUN = 0.0;                                 // Cosine of solar altitude
     502             :     Real64 THSUN = 0.0;                                  // Solar azimuth (rad) in Absolute Coordinate System (azimuth=0 along east)
     503             :     Array1D<Real64> PHSUNHR = Array1D<Real64>(24, 0.0);  // Hourly values of PHSUN
     504             :     Array1D<Real64> SPHSUNHR = Array1D<Real64>(24, 0.0); // Hourly values of the sine of PHSUN
     505             :     Array1D<Real64> CPHSUNHR = Array1D<Real64>(24, 0.0); // Hourly values of the cosine of PHSUN
     506             :     Array1D<Real64> THSUNHR = Array1D<Real64>(24, 0.0);  // Hourly values of THSUN
     507             : 
     508             :     // In the following I,J,K arrays:
     509             :     // I = 1 for clear sky, 2 for clear turbid, 3 for intermediate, 4 for overcast;
     510             :     // J = 1 for bare window, 2 - 12 for shaded;
     511             :     // K = sun position index.
     512             :     Array3D<Real64> EINTSK; // Sky-related portion of internally reflected illuminance
     513             :     Array2D<Real64> EINTSU; // Sun-related portion of internally reflected illuminance,
     514             :     // excluding entering beam
     515             :     Array2D<Real64> EINTSUdisk; // Sun-related portion of internally reflected illuminance
     516             :     // due to entering beam
     517             :     Array3D<Real64> WLUMSK;     // Sky-related window luminance
     518             :     Array2D<Real64> WLUMSU;     // Sun-related window luminance, excluding view of solar disk
     519             :     Array2D<Real64> WLUMSUdisk; // Sun-related window luminance, due to view of solar disk
     520             : 
     521             :     Array2D<Real64> GILSK = Array2D<Real64>(24, 4, 0.0); // Horizontal illuminance from sky, by sky type, for each hour of the day
     522             :     Array1D<Real64> GILSU = Array1D<Real64>(24, 0.0);    // Horizontal illuminance from sun for each hour of the day
     523             : 
     524             :     Array3D<Real64> EDIRSK;     // Sky-related component of direct illuminance
     525             :     Array2D<Real64> EDIRSU;     // Sun-related component of direct illuminance (excluding beam solar at ref pt)
     526             :     Array2D<Real64> EDIRSUdisk; // Sun-related component of direct illuminance due to beam solar at ref pt
     527             :     Array3D<Real64> AVWLSK;     // Sky-related average window luminance
     528             :     Array2D<Real64> AVWLSU;     // Sun-related average window luminance, excluding view of solar disk
     529             :     Array2D<Real64> AVWLSUdisk; // Sun-related average window luminance due to view of solar disk
     530             : 
     531             :     // Allocatable daylight factor arrays  -- are in the ZoneDaylight Structure
     532             : 
     533             :     Array2D<Real64> TDDTransVisBeam;
     534             :     Array3D<Real64> TDDFluxInc;
     535             :     Array3D<Real64> TDDFluxTrans;
     536             : 
     537             :     Array2D_int MapErrIndex;
     538             :     Array2D_int RefErrIndex;
     539             : 
     540             :     bool MySunIsUpFlag = false;
     541             :     bool CalcDayltgCoeffsMapPointsMySunIsUpFlag = false;
     542             : 
     543             :     // static variables extracted from functions
     544             :     Vector3<Real64> AR;      // Inside surface area sum for floor/wall/ceiling (m2)
     545             :     Vector3<Real64> ARH;     // Inside surface area*reflectance sum for floor/wall/ceiling (m2)
     546             :     Vector3<Real64> AP;      // Zone inside surface floor/wall/ceiling area without a selected floor/wall/ceiling (m2)
     547             :     Vector3<Real64> ARHP;    // Zone inside surface floor/wall/ceiling area*reflectance without a selected floor/wall/ceiling (m2)
     548             :     Vector3<Real64> W2;      // Second vertex of window
     549             :     Vector3<Real64> W3;      // Third vertex of window
     550             :     Vector3<Real64> W21;     // Vector from window vertex 2 to window vertex 1
     551             :     Vector3<Real64> W23;     // Vector from window vertex 2 to window vertex 3
     552             :     Vector3<Real64> RREF;    // Location of a reference point in absolute coordinate system
     553             :     Vector3<Real64> RREF2;   // Location of virtual reference point in absolute coordinate system
     554             :     Vector3<Real64> RWIN;    // Center of a window element in absolute coordinate system
     555             :     Vector3<Real64> RWIN2;   // Center of a window element for TDD:DOME (if exists) in abs coord sys
     556             :     Vector3<Real64> Ray;     // Unit vector along ray from reference point to window element
     557             :     Vector3<Real64> WNORM2;  // Unit vector normal to TDD:DOME (if exists)
     558             :     Vector3<Real64> VIEWVC;  // View vector in absolute coordinate system
     559             :     Vector3<Real64> U2;      // Second vertex of window for TDD:DOME (if exists)
     560             :     Vector3<Real64> U21;     // Vector from window vertex 2 to window vertex 1 for TDD:DOME (if exists)
     561             :     Vector3<Real64> U23;     // Vector from window vertex 2 to window vertex 3 for TDD:DOME (if exists)
     562             :     Vector3<Real64> VIEWVC2; // Virtual view vector in absolute coordinate system
     563             : 
     564             :     Vector3<Real64> W1;     // First vertex of window (where vertices are numbered
     565             :     Vector3<Real64> WC;     // Center point of window
     566             :     Vector3<Real64> REFWC;  // Vector from reference point to center of window
     567             :     Vector3<Real64> WNORM;  // Unit vector normal to window (pointing away from room)
     568             :     Vector3<Real64> W2REF;  // Vector from window origin to project of ref. pt. on window plane
     569             :     Vector3<Real64> REFD;   // Vector from ref pt to center of win in TDD:DIFFUSER coord sys (if exists)
     570             :     Vector3<Real64> VIEWVD; // Virtual view vector in TDD:DIFFUSER coord sys (if exists)
     571             :     Vector3<Real64> U1;     // First vertex of window for TDD:DOME (if exists)
     572             :     Vector3<Real64> U3;     // Third vertex of window for TDD:DOME (if exists)
     573             :     Vector3<Real64> RayVector;
     574             : 
     575             :     Vector3<Real64> HitPtIntWin; // Intersection point on an interior window for ray from ref pt to ext win (m)
     576             :     Vector3<Real64> GroundHitPt; // Coordinates of point that ray hits ground (m)
     577             :     Vector3<Real64> URay;        // Unit vector in (Phi,Theta) direction
     578             :     Vector3<Real64> ObsHitPt;    // Coordinates of hit point on an obstruction (m)
     579             : 
     580             :     Vector3<Real64> WNorm;      // unit vector from window (point towards outside)
     581             :     Vector3<Real64> RayNorm;    // unit vector along ray from window to reference point
     582             :     Vector3<Real64> InterPoint; // Intersection point
     583             :     Vector3<Real64> RWin;       // window element center point (same as centroid)
     584             :     Vector3<Real64> V;          // vector array
     585             : 
     586             :     Vector3<Real64> NearestHitPt;    // Hit point of ray on nearest obstruction
     587             :     Vector3<Real64> ReflNorm;        // Normal vector to reflecting surface
     588             :     Vector3<Real64> SunVecMir;       // Sun ray mirrored in reflecting surface
     589             :     Vector3<Real64> HitPtRefl;       // Point that ray hits reflecting surface
     590             :     Vector3<Real64> HitPtObs;        // Hit point on obstruction
     591             :     Vector3<Real64> HitPtIntWinDisk; // Intersection point on an interior window for ray from ref pt to sun (m)
     592             : 
     593             :     int AltSteps_last = 0;
     594             :     Array1D<Real64> cos_Phi; // cos( Phi ) table
     595             :     Array1D<Real64> sin_Phi; // sin( Phi ) table
     596             :     int AzimSteps_last = 0;
     597             :     Array1D<Real64> cos_Theta; // cos( Theta ) table
     598             :     Array1D<Real64> sin_Theta; // sin( Theta ) table
     599             : 
     600             :     int IConstShaded = 0; // The shaded window construction for switchable windows
     601             :     Real64 VTDark = 0.0;  // Visible transmittance (VT) of electrochromic (EC) windows in fully dark state
     602             :     Real64 VTMULT = 1.0;  // VT multiplier for EC windows
     603             : 
     604             :     Vector3<Real64> WinNorm; // Window outward normal unit vector
     605             :     Vector3<Real64>
     606             :         SunPrime; // Projection of sun vector onto plane (perpendicular to window plane) determined by WinNorm and vector along baseline of window
     607             :     Vector3<Real64> WinNormCrossBase;                         // Cross product of WinNorm and vector along window baseline
     608             :     Vector4<Real64> XEDIRSK;                                  // Illuminance contribution from luminance element, sky-related
     609             :     Vector4<Real64> XAVWLSK;                                  // Luminance of window element, sky-related
     610             :     Vector3<Real64> RAYCOS;                                   // Unit vector from reference point to sun
     611             :     Vector3<Real64> HP;                                       // Hit coordinates, if ray hits
     612             :     Vector3<Real64> DayltgHitObstructionHP;                   // Hit coordinates, if ray hits an obstruction
     613             :     Vector3<Real64> DayltgHitInteriorObstructionHP;           // Hit coordinates, if ray hits an obstruction
     614             :     Vector3<Real64> RN;                                       // Unit vector along ray
     615             :     Vector3<Real64> DayltgHitBetWinObstructionHP;             // Hit coordinates, if ray hits an obstruction surface (m)
     616             :     Vector3<Real64> DayltgHitBetWinObstructionRN;             // Unit vector along ray from R1 to R2
     617             :     Vector2<Real64> DFSUHR;                                   // Sun daylight factor for bare/shaded window
     618             :     Vector2<Real64> BFSUHR;                                   // Sun background luminance factor for bare/shaded window
     619             :     Vector2<Real64> SFSUHR;                                   // Sun source luminance factor for bare/shaded window
     620             :     Vector4<Real64> HorIllSky;                                // Horizontal illuminance for different sky types
     621             :     Vector4<Real64> TDDTransVisDiff;                          // Weighted diffuse visible transmittance for each sky type
     622             :     Vector3<Real64> HitPt;                                    // Hit point on an obstruction (m)
     623             :     Vector3<Real64> DayltgSurfaceLumFromSunReflNorm;          // Unit normal to reflecting surface (m)
     624             :     Vector3<Real64> DayltgSurfaceLumFromSunObsHitPt;          // Hit point on obstruction (m)
     625             :     Vector3<Real64> U;                                        // Unit vector in (PH,TH) direction
     626             :     Vector3<Real64> DayltgInterReflectedIllumNearestHitPt;    // Hit point of ray on nearest obstruction (m)
     627             :     Vector3<Real64> DayltgInterReflectedIllumObsHitPt;        // Coordinates of hit point on an obstruction (m)
     628             :     Vector3<Real64> DayltgInterReflectedIllumGroundHitPt;     // Coordinates of point that ray from window center hits the ground (m)
     629             :     Vector3<Real64> DayltgInterReflectedIllumURay;            // Unit vector in (Phi,Theta) direction
     630             :     Vector3<Real64> ComplexFenestrationLuminancesObsHitPt;    // Coordinates of hit point on an obstruction (m)
     631             :     Vector3<Real64> ComplexFenestrationLuminancesGroundHitPt; // Coordinates of point that ray from window center hits the ground (m)
     632             :     Vector4<Real64> ZSK;                                      // Sky-related and sun-related illuminance on window from sky/ground
     633             :     Vector4<Real64> FFSKTot;
     634             :     Vector4<Real64> WinLumSK;                                   // Sky related window luminance
     635             :     Vector4<Real64> EDirSky;                                    // Sky related direct illuminance
     636             :     Vector3<Real64> DayltgDirectSunDiskComplexFenestrationV;    // temporary vector
     637             :     Vector3<Real64> DayltgDirectSunDiskComplexFenestrationRWin; // Window center
     638             :     Vector2<Real64> DayltgInteriorMapIllumDFSUHR;               // Sun daylight factor for bare/shaded window
     639             :     Vector4<Real64> DayltgInteriorMapIllumHorIllSky;            // Horizontal illuminance for different sky types
     640             :     Vector3<Real64> CalcMinIntWinSolidAngsW1;                   // Window vertices
     641             :     Vector3<Real64> CalcMinIntWinSolidAngsW2;
     642             :     Vector3<Real64> CalcMinIntWinSolidAngsW3;
     643             :     Vector3<Real64> CalcMinIntWinSolidAngsWC;  // Center point of window
     644             :     Vector3<Real64> CalcMinIntWinSolidAngsW21; // Unit vectors from window vertex 2 to 1 and 2 to 3
     645             :     Vector3<Real64> CalcMinIntWinSolidAngsW23;
     646             :     Vector3<Real64> CalcMinIntWinSolidAngsRREF;  // Location of a reference point in absolute coordinate system
     647             :     Vector3<Real64> CalcMinIntWinSolidAngsRay;   // Unit vector along ray from reference point to window center
     648             :     Vector3<Real64> CalcMinIntWinSolidAngsREFWC; // Vector from reference point to center of window
     649             :     Vector3<Real64> CalcMinIntWinSolidAngsWNORM; // Unit vector normal to window (pointing away from room)
     650             : 
     651             :     Array2D<Real64> DayltgInteriorMapIllumDFSKHR =
     652             :         Array2D<Real64>(2, 4); // Sky daylight factor for sky type (first index), bare/shaded window (second index)
     653             :     Array2D<Real64> DayltgInteriorMapIllumBFSKHR =
     654             :         Array2D<Real64>(2, 4); // Sky background luminance factor for sky type (first index), bare/shaded window (second index)
     655             :     Array2D<Real64> DayltgInteriorMapIllumSFSKHR =
     656             :         Array2D<Real64>(2, 4); // Sky source luminance factor for sky type (first index), bare/shaded window (second index)
     657             :     Array1D<Real64> BACLUM;
     658             :     Array1D<Real64> DayltgInteriorMapIllumGLRNDX;
     659             :     Array1D<Real64> daylight_illum;
     660             :     Array1D<Real64> FLFWSU;                                            // Sun-related downgoing luminous flux, excluding entering beam
     661             :     Array1D<Real64> FLFWSUdisk;                                        // Sun-related downgoing luminous flux, due to entering beam
     662             :     Array1D<Real64> FLCWSU;                                            // Sun-related upgoing luminous flux
     663             :     Array1D<Real64> TransMult;                                         // Transmittance multiplier
     664             :     Array1D<Real64> DayltgInterReflectedIllumTransBmBmMult;            // Isolated blind beam-beam transmittance
     665             :     Array1D<Real64> TransBmBmMult;                                     // Beam-beam transmittance of isolated blind
     666             :     Array1D<Real64> TransBmBmMultRefl;                                 // As above but for beam reflected from exterior obstruction
     667             :     Array1D<Real64> PH = Array1D<Real64>(DaylightingManager::NPH);     // Altitude of sky element (radians)
     668             :     Array1D<Real64> TH = Array1D<Real64>(DaylightingManager::NTH);     // Azimuth of sky element (radians)
     669             :     Array1D<Real64> SPHCPH = Array1D<Real64>(DaylightingManager::NPH); // Sine times cosine of altitude of sky element
     670             :     Array1D<Real64> SetPnt;                                            // Illuminance setpoint at reference points (lux)
     671             :     Array1D<Real64> GLRNDX;                                            // Glare index at reference point
     672             :     Array1D<Real64> GLRNEW;                                            // New glare index at reference point
     673             :     Array2D<Real64> FLCWSK;                                            // Sky-related upgoing luminous flux
     674             :     Array2D<Real64> SkyObstructionMult =
     675             :         Array2D<Real64>(DaylightingManager::NPHMAX,
     676             :                         DaylightingManager::NTHMAX); // Ratio of obstructed to unobstructed sky diffuse at a ground point for each (TH,PH) direction
     677             :     Array2D<Real64> FLFWSK;                          // Sky-related downgoing luminous flux
     678             :     Array2D<Real64> ObTransM = Array2D<Real64>(DaylightingManager::NPHMAX, DaylightingManager::NTHMAX); // ObTrans value for each (TH,PH) direction
     679             :     Array2D<Real64> SFSKHR = Array2D<Real64>(2, 4); // Sky source luminance factor for sky type (second index), bare/shaded window (first index)
     680             :     Array2D<Real64> DFSKHR = Array2D<Real64>(2, 4); // Sky daylight factor for sky type (second index), bare/shaded window (first index)
     681             :     Array2D<Real64> BFSKHR = Array2D<Real64>(2, 4); // Sky background luminance factor for sky type (second index), bare/shaded window (first index)
     682             :     Array3D<Real64> tmpIllumFromWinAtRefPt;
     683             :     Array3D<Real64> tmpBackLumFromWinAtRefPt;
     684             :     Array3D<Real64> tmpSourceLumFromWinAtRefPt;
     685             :     Array1D_bool FirstTimeMaps;
     686             :     Array1D_bool EnvrnPrint;
     687             :     Array1D_string SavedMnDy;
     688             :     Array1D<Real64> XValue;
     689             :     Array1D<Real64> YValue;
     690             :     Array2D<Real64> IllumValue;
     691             : 
     692             :     Real64 tmpSWSL1 = 0.0;
     693             :     Real64 tmpSWSL2 = 0.0;
     694             :     Real64 tmpSWFactor = 0.0; // new switching factor to meet glare criteria
     695             :     Real64 tmpMult = 0.0;
     696             : 
     697             :     bool GlareOK = false;
     698             :     bool blnCycle = false;
     699             : 
     700             :     Array1D<Real64> DILLSW;         // Illuminance a ref point from a group of windows that can be switched together,
     701             :     Array1D<Real64> DILLUN;         //  and from those that aren't (lux)
     702             :     Array1D_bool previously_shaded; // array of flags to indicate that previously groups would have already shaded this window
     703             :     Array3D<Real64> WDAYIL;         // Illuminance from window at reference point (second index)
     704             :     //   for shade open/closed (first index), the number of shade deployment groups (third index)
     705             :     Array3D<Real64> WBACLU; // Background illuminance from window at reference point (second index)
     706             :     //   for shade open/closed (first index), the number of shade deployment groups (third index)
     707             :     Array2D<Real64> RDAYIL; // Illuminance from window at reference point after closing shade
     708             :     Array2D<Real64> RBACLU; // Background illuminance from window at reference point after closing shade
     709             :     Array1D<Real64> TVIS1;  // Visible transmittance at normal incidence of unswitched glazing
     710             :     Array1D<Real64> TVIS2;  // Visible transmittance at normal incidence of fully-switched glazing
     711             :     Array1D<Real64> ASETIL; // Illuminance ratio (lux)
     712             : 
     713         771 :     DaylightingManagerData()
     714         771 :     {
     715         771 :         this->cos_Phi = Array1D<Real64>(DataSurfaces::AltAngStepsForSolReflCalc / 2);    // cos( Phi ) table
     716         771 :         this->sin_Phi = Array1D<Real64>(DataSurfaces::AltAngStepsForSolReflCalc / 2);    // sin( Phi ) table
     717         771 :         this->cos_Theta = Array1D<Real64>(2 * DataSurfaces::AzimAngStepsForSolReflCalc); // cos( Theta ) table
     718         771 :         this->sin_Theta = Array1D<Real64>(2 * DataSurfaces::AzimAngStepsForSolReflCalc); // sin( Theta ) table
     719         771 :     }
     720             : 
     721           0 :     void clear_state() override
     722             :     {
     723           0 :         this->CalcDayltghCoefficients_firstTime = true;
     724           0 :         this->getDaylightingParametersInputFlag = true;
     725           0 :         this->refFirstTime = true;
     726           0 :         this->DayltgInteriorIllum_firstTime = true;
     727           0 :         this->FirstTimeDaylFacCalc = true;
     728           0 :         this->VeryFirstTime = true;
     729           0 :         this->mapFirstTime = true;
     730           0 :         this->CheckTDDs_firstTime = true;
     731           0 :         this->DayltgExtHorizIllum_firstTime = true;
     732           0 :         this->DayltgInteriorMapIllum_FirstTimeFlag = true;
     733           0 :         this->ReportIllumMap_firstTime = true;
     734           0 :         this->SQFirstTime = true;
     735           0 :         this->doSkyReporting = true;
     736           0 :         this->CreateDFSReportFile = true;
     737           0 :         this->TotWindowsWithDayl = 0;
     738           0 :         this->DaylIllum.deallocate();
     739           0 :         this->maxNumRefPtInAnyDaylCtrl = 0;
     740           0 :         this->maxNumRefPtInAnyEncl = 0;
     741           0 :         this->PHSUN = 0.0;
     742           0 :         this->SPHSUN = 0.0;
     743           0 :         this->CPHSUN = 0.0;
     744           0 :         this->THSUN = 0.0;
     745           0 :         this->PHSUNHR = Array1D<Real64>(24, 0.0);
     746           0 :         this->SPHSUNHR = Array1D<Real64>(24, 0.0);
     747           0 :         this->CPHSUNHR = Array1D<Real64>(24, 0.0);
     748           0 :         this->THSUNHR = Array1D<Real64>(24, 0.0);
     749           0 :         this->EINTSK.deallocate();
     750           0 :         this->EINTSU.deallocate();
     751           0 :         this->EINTSUdisk.deallocate();
     752           0 :         this->WLUMSK.deallocate();
     753           0 :         this->WLUMSU.deallocate();
     754           0 :         this->WLUMSUdisk.deallocate();
     755           0 :         this->GILSK = Array2D<Real64>(24, 4, 0.0);
     756           0 :         this->GILSU = Array1D<Real64>(24, 0.0);
     757           0 :         this->EDIRSK.deallocate();
     758           0 :         this->EDIRSU.deallocate();
     759           0 :         this->EDIRSUdisk.deallocate();
     760           0 :         this->AVWLSK.deallocate();
     761           0 :         this->AVWLSU.deallocate();
     762           0 :         this->AVWLSUdisk.deallocate();
     763           0 :         this->TDDTransVisBeam.deallocate();
     764           0 :         this->TDDFluxInc.deallocate();
     765           0 :         this->TDDFluxTrans.deallocate();
     766           0 :         this->MapErrIndex.deallocate();
     767           0 :         this->RefErrIndex.deallocate();
     768           0 :         this->MySunIsUpFlag = false;
     769           0 :         this->CalcDayltgCoeffsMapPointsMySunIsUpFlag = false;
     770             :         // seems like a reasonable initialization for the Vector variables
     771           0 :         this->AR = 0.0;
     772           0 :         this->ARH = 0.0;
     773           0 :         this->AP = 0.0;
     774           0 :         this->ARHP = 0.0;
     775           0 :         this->W2 = 0.0;
     776           0 :         this->W3 = 0.0;
     777           0 :         this->W21 = 0.0;
     778           0 :         this->W23 = 0.0;
     779           0 :         this->RREF = 0.0;
     780           0 :         this->RREF2 = 0.0;
     781           0 :         this->RWIN = 0.0;
     782           0 :         this->RWIN2 = 0.0;
     783           0 :         this->Ray = 0.0;
     784           0 :         this->WNORM2 = 0.0;
     785           0 :         this->VIEWVC = 0.0;
     786           0 :         this->U2 = 0.0;
     787           0 :         this->U21 = 0.0;
     788           0 :         this->U23 = 0.0;
     789           0 :         this->VIEWVC2 = 0.0;
     790           0 :         this->W1 = 0.0;
     791           0 :         this->WC = 0.0;
     792           0 :         this->REFWC = 0.0;
     793           0 :         this->WNORM = 0.0;
     794           0 :         this->W2REF = 0.0;
     795           0 :         this->REFD = 0.0;
     796           0 :         this->VIEWVD = 0.0;
     797           0 :         this->U1 = 0.0;
     798           0 :         this->U3 = 0.0;
     799           0 :         this->RayVector = 0.0;
     800           0 :         this->HitPtIntWin = 0.0;
     801           0 :         this->GroundHitPt = 0.0;
     802           0 :         this->URay = 0.0;
     803           0 :         this->ObsHitPt = 0.0;
     804           0 :         this->WNorm = 0.0;
     805           0 :         this->RayNorm = 0.0;
     806           0 :         this->InterPoint = 0.0;
     807           0 :         this->RWin = 0.0;
     808           0 :         this->V = 0.0;
     809           0 :         this->NearestHitPt = 0.0;
     810           0 :         this->ReflNorm = 0.0;
     811           0 :         this->SunVecMir = 0.0;
     812           0 :         this->HitPtRefl = 0.0;
     813           0 :         this->HitPtObs = 0.0;
     814           0 :         this->HitPtIntWinDisk = 0.0;
     815             : 
     816           0 :         this->AltSteps_last = 0;
     817           0 :         this->AzimSteps_last = 0;
     818           0 :         this->cos_Phi = Array1D<Real64>(DataSurfaces::AltAngStepsForSolReflCalc / 2);    // cos( Phi ) table
     819           0 :         this->sin_Phi = Array1D<Real64>(DataSurfaces::AltAngStepsForSolReflCalc / 2);    // sin( Phi ) table
     820           0 :         this->cos_Theta = Array1D<Real64>(2 * DataSurfaces::AzimAngStepsForSolReflCalc); // cos( Theta ) table
     821           0 :         this->sin_Theta = Array1D<Real64>(2 * DataSurfaces::AzimAngStepsForSolReflCalc); // sin( Theta ) table
     822             : 
     823           0 :         this->IConstShaded = 0;
     824           0 :         this->VTDark = 0.0;
     825           0 :         this->VTMULT = 1.0;
     826             : 
     827           0 :         this->DayltgInteriorMapIllumDFSKHR = Array2D<Real64>(2, 4);
     828           0 :         this->DayltgInteriorMapIllumBFSKHR = Array2D<Real64>(2, 4);
     829           0 :         this->DayltgInteriorMapIllumSFSKHR = Array2D<Real64>(2, 4);
     830           0 :         this->BACLUM.clear();
     831           0 :         this->DayltgInteriorMapIllumGLRNDX.clear();
     832           0 :         this->daylight_illum.clear();
     833           0 :         this->FLFWSU.clear();
     834           0 :         this->FLFWSUdisk.clear();
     835           0 :         this->FLCWSU.clear();
     836           0 :         this->TransMult.clear();
     837           0 :         this->DayltgInterReflectedIllumTransBmBmMult.clear();
     838           0 :         this->TransBmBmMult.clear();
     839           0 :         this->TransBmBmMultRefl.clear();
     840           0 :         this->PH = Array1D<Real64>(DaylightingManager::NPH);
     841           0 :         this->TH = Array1D<Real64>(DaylightingManager::NTH);
     842           0 :         this->SPHCPH = Array1D<Real64>(DaylightingManager::NPH);
     843           0 :         this->SetPnt.clear();
     844           0 :         this->GLRNDX.clear();
     845           0 :         this->GLRNEW.clear();
     846           0 :         this->FLCWSK.clear();
     847           0 :         this->SkyObstructionMult = Array2D<Real64>(DaylightingManager::NPHMAX, DaylightingManager::NTHMAX);
     848           0 :         this->FLFWSK.clear();
     849           0 :         this->ObTransM = Array2D<Real64>(DaylightingManager::NPHMAX, DaylightingManager::NTHMAX);
     850           0 :         this->SFSKHR = Array2D<Real64>(2, 4);
     851           0 :         this->DFSKHR = Array2D<Real64>(2, 4);
     852           0 :         this->BFSKHR = Array2D<Real64>(2, 4);
     853           0 :         this->tmpIllumFromWinAtRefPt.clear();
     854           0 :         this->tmpBackLumFromWinAtRefPt.clear();
     855           0 :         this->tmpSourceLumFromWinAtRefPt.clear();
     856           0 :         this->FirstTimeMaps.clear();
     857           0 :         this->EnvrnPrint.clear();
     858           0 :         this->SavedMnDy.clear();
     859           0 :         this->XValue.clear();
     860           0 :         this->YValue.clear();
     861           0 :         this->IllumValue.clear();
     862             : 
     863           0 :         this->tmpSWSL1 = 0.0;
     864           0 :         this->tmpSWSL2 = 0.0;
     865           0 :         this->tmpSWFactor = 0.0;
     866           0 :         this->tmpMult = 0.0;
     867           0 :         this->GlareOK = false;
     868           0 :         this->blnCycle = false;
     869             : 
     870           0 :         this->DILLSW.clear();
     871           0 :         this->DILLUN.clear();
     872           0 :         this->previously_shaded.clear();
     873           0 :         this->WDAYIL.clear();
     874           0 :         this->WBACLU.clear();
     875           0 :         this->RDAYIL.clear();
     876           0 :         this->RBACLU.clear();
     877           0 :         this->TVIS1.clear();
     878           0 :         this->TVIS2.clear();
     879           0 :         this->ASETIL.clear();
     880           0 :     }
     881             : };
     882             : 
     883             : } // namespace EnergyPlus
     884             : 
     885             : #endif

Generated by: LCOV version 1.13