LCOV - code coverage report
Current view: top level - EnergyPlus - SolarShading.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 98.5 % 137 135
Test Date: 2025-05-22 16:09:37 Functions: 80.0 % 5 4

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : #ifndef SolarShading_hh_INCLUDED
      49              : #define SolarShading_hh_INCLUDED
      50              : 
      51              : // C++ Headers
      52              : #include <fstream>
      53              : #include <memory>
      54              : 
      55              : // ObjexxFCL Headers
      56              : #include <ObjexxFCL/Array2D.hh>
      57              : #include <ObjexxFCL/Array3D.hh>
      58              : 
      59              : // Penumbra Headers
      60              : #ifndef EP_NO_OPENGL
      61              : #    include <penumbra/penumbra.h>
      62              : #endif
      63              : 
      64              : // EnergyPlus Headers
      65              : #include <EnergyPlus/DataBSDFWindow.hh>
      66              : #include <EnergyPlus/DataSurfaces.hh>
      67              : #include <EnergyPlus/DataVectorTypes.hh>
      68              : #include <EnergyPlus/EnergyPlus.hh>
      69              : #include <EnergyPlus/WindowEquivalentLayer.hh>
      70              : 
      71              : namespace EnergyPlus {
      72              : 
      73              : // Forward declarations
      74              : struct EnergyPlusData;
      75              : 
      76              : namespace SolarShading {
      77              : 
      78              :     // Using/Aliasing
      79              :     using DataBSDFWindow::BSDFGeomDescr;
      80              :     using DataBSDFWindow::BSDFWindowGeomDescr;
      81              :     using DataVectorTypes::Vector;
      82              : 
      83              :     struct SurfaceErrorTracking
      84              :     {
      85              :         // Members
      86              :         int SurfIndex1; // Tracking for main error message
      87              :         int SurfIndex2; // Tracking for Overlapping Figure Name or Surface # 1
      88              :         int MiscIndex;  // Used for other pertinent information to be stored
      89              : 
      90              :         // Default Constructor
      91            0 :         SurfaceErrorTracking() : SurfIndex1(0), SurfIndex2(0), MiscIndex(0)
      92              :         {
      93            0 :         }
      94              :     };
      95              : 
      96              :     void InitSolarCalculations(EnergyPlusData &state);
      97              : 
      98              :     void checkShadingSurfaceSchedules(EnergyPlusData &state);
      99              : 
     100              :     void GetShadowingInput(EnergyPlusData &state);
     101              : 
     102              :     void processShadowingInput(EnergyPlusData &state);
     103              : 
     104              :     void checkScheduledSurfacePresent(EnergyPlusData &state);
     105              : 
     106              :     void AllocateModuleArrays(EnergyPlusData &state);
     107              : 
     108              :     void AnisoSkyViewFactors(EnergyPlusData &state);
     109              : 
     110              :     void CHKBKS(EnergyPlusData &state,
     111              :                 int const NBS, // Surface Number of the potential back surface
     112              :                 int const NRS  // Surface Number of the potential shadow receiving surface
     113              :     );
     114              : 
     115              :     void CHKGSS(EnergyPlusData &state,
     116              :                 int const NRS,     // Surface number of the potential shadow receiving surface
     117              :                 int const NSS,     // Surface number of the potential shadow casting surface
     118              :                 Real64 const ZMIN, // Lowest point of the receiving surface
     119              :                 bool &CannotShade  // TRUE if shadow casting surface cannot shade receiving surface.
     120              :     );
     121              : 
     122              :     void CHKSBS(EnergyPlusData &state,
     123              :                 int const HTS,   // Heat transfer surface number of the general receiving surf
     124              :                 int const GRSNR, // Surface number of general receiving surface
     125              :                 int const SBSNR  // Surface number of subsurface
     126              :     );
     127              : 
     128              :     bool polygon_contains_point(int const nsides,            // number of sides (vertices)
     129              :                                 Array1D<Vector> &polygon_3d, // points of polygon
     130              :                                 Vector const &point_3d,      // point to be tested
     131              :                                 bool const ignorex,
     132              :                                 bool const ignorey,
     133              :                                 bool const ignorez);
     134              : 
     135              :     void ComputeIntSolarAbsorpFactors(EnergyPlusData &state);
     136              : 
     137              :     void CLIP(EnergyPlusData &state, int const NVT, Array1D<Real64> &XVT, Array1D<Real64> &YVT, Array1D<Real64> &ZVT);
     138              : 
     139              :     void CLIPLINE(Real64 &x0, Real64 &x1, Real64 &y0, Real64 &y1, Real64 maxX, Real64 minX, Real64 maxY, Real64 minY, bool &visible);
     140              : 
     141              :     void CTRANS(EnergyPlusData &state,
     142              :                 int const NS,         // Surface number whose vertex coordinates are being transformed
     143              :                 int const NGRS,       // Base surface number for surface NS
     144              :                 int &NVT,             // Number of vertices for surface NS
     145              :                 Array1D<Real64> &XVT, // XYZ coordinates of vertices of NS in plane of NGRS
     146              :                 Array1D<Real64> &YVT,
     147              :                 Array1D<Real64> &ZVT);
     148              : 
     149              :     void HTRANS(EnergyPlusData &state,
     150              :                 int const I,          // Mode selector: 0 - Compute H.C. of sides
     151              :                 int const NS,         // Figure Number
     152              :                 int const NumVertices // Number of vertices
     153              :     );
     154              : 
     155              :     void HTRANS0(EnergyPlusData &state,
     156              :                  int const NS,         // Figure Number
     157              :                  int const NumVertices // Number of vertices
     158              :     );
     159              : 
     160              :     void HTRANS1(EnergyPlusData &state,
     161              :                  int const NS,         // Figure Number
     162              :                  int const NumVertices // Number of vertices
     163              :     );
     164              : 
     165              :     void INCLOS(EnergyPlusData &state,
     166              :                 int const N1,            // Figure number of figure 1
     167              :                 int const N1NumVert,     // Number of vertices of figure 1
     168              :                 int const N2,            // Figure number of figure 2
     169              :                 int const N2NumVert,     // Number of vertices of figure 2
     170              :                 int &NumVerticesOverlap, // Number of vertices which overlap
     171              :                 int &NIN                 // Number of vertices of figure 1 within figure 2
     172              :     );
     173              : 
     174              :     void INTCPT(EnergyPlusData &state,
     175              :                 int const NV1, // Number of vertices of figure NS1
     176              :                 int const NV2, // Number of vertices of figure NS2
     177              :                 int &NV3,      // Number of vertices of figure NS3
     178              :                 int const NS1, // Number of the figure being overlapped
     179              :                 int const NS2  // Number of the figure doing overlapping
     180              :     );
     181              : 
     182              :     void CLIPPOLY(EnergyPlusData &state,
     183              :                   int const NS1, // Figure number of figure 1 (The subject polygon)
     184              :                   int const NS2, // Figure number of figure 2 (The clipping polygon)
     185              :                   int const NV1, // Number of vertices of figure 1
     186              :                   int const NV2, // Number of vertices of figure 2
     187              :                   int &NV3       // Number of vertices of figure 3
     188              :     );
     189              : 
     190              :     void MULTOL(EnergyPlusData &state,
     191              :                 int const NNN,   // argument
     192              :                 int const LOC0,  // Location in the homogeneous coordinate array
     193              :                 int const NRFIGS // Number of figures overlapped
     194              :     );
     195              : 
     196              :     void ORDER(EnergyPlusData &state,
     197              :                int const NV3, // Number of vertices of figure NS3
     198              :                int const NS3  // Location to place results of overlap
     199              :     );
     200              : 
     201              :     void DeterminePolygonOverlap(EnergyPlusData &state,
     202              :                                  int const NS1, // Number of the figure being overlapped
     203              :                                  int const NS2, // Number of the figure doing overlapping
     204              :                                  int const NS3  // Location to place results of overlap
     205              :     );
     206              : 
     207              :     void CalcPerSolarBeam(EnergyPlusData &state,
     208              :                           Real64 const AvgEqOfTime,       // Average value of Equation of Time for period
     209              :                           Real64 const AvgSinSolarDeclin, // Average value of Sine of Solar Declination for period
     210              :                           Real64 const AvgCosSolarDeclin  // Average value of Cosine of Solar Declination for period
     211              :     );
     212              : 
     213              :     void FigureSunCosines(EnergyPlusData &state,
     214              :                           int const iHour,
     215              :                           int const iTimeStep,
     216              :                           Real64 const EqOfTime,       // value of Equation of Time for period
     217              :                           Real64 const SinSolarDeclin, // value of Sine of Solar Declination for period
     218              :                           Real64 const CosSolarDeclin  // value of Cosine of Solar Declination for period
     219              :     );
     220              : 
     221              :     void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const iTimeStep);
     222              : 
     223              :     void DetermineShadowingCombinations(EnergyPlusData &state);
     224              : 
     225              :     void SHADOW(EnergyPlusData &state,
     226              :                 int const iHour, // Hour index
     227              :                 int const TS     // Time Step
     228              :     );
     229              : 
     230              :     void SHDBKS(EnergyPlusData &state,
     231              :                 int const NGRS, // Number of the general receiving surface
     232              :                 int const CurSurf,
     233              :                 int const NBKS, // Number of back surfaces
     234              :                 int const HTS   // Heat transfer surface number of the general receiving surf
     235              :     );
     236              : 
     237              :     void SHDGSS(EnergyPlusData &state,
     238              :                 int const NGRS,
     239              :                 int const iHour,   // Hour Counter
     240              :                 int const TS,      // TimeStep
     241              :                 int const CurSurf, // Current Surface
     242              :                 int const NGSS,    // Number of general shadowing surfaces
     243              :                 int const HTS      // Heat transfer surface number of the general receiving surf
     244              :     );
     245              : 
     246              :     void CalcInteriorSolarOverlaps(EnergyPlusData &state,
     247              :                                    int const iHour, // Hour Index
     248              :                                    int const NBKS,  // Number of back surfaces associated with this GRSNR (in general, only
     249              :                                    int const HTSS,  // Surface number of the subsurface (exterior window)
     250              :                                    int const GRSNR, // General receiving surface number (base surface of the exterior window)
     251              :                                    int const TS     // Time step Index
     252              :     );
     253              : 
     254              :     void CalcInteriorSolarDistribution(EnergyPlusData &state);
     255              : 
     256              :     void CalcAbsorbedOnExteriorOpaqueSurfaces(EnergyPlusData &state);
     257              : 
     258              :     void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state);
     259              : 
     260              :     int WindowScheduledSolarAbs(EnergyPlusData &state,
     261              :                                 int const SurfNum, // Surface number
     262              :                                 int const ConstNum // Construction number
     263              :     );
     264              : 
     265              :     int SurfaceScheduledSolarInc(EnergyPlusData &state,
     266              :                                  int const SurfNum, // Surface number
     267              :                                  int const ConstNum // Construction number
     268              :     );
     269              : 
     270              :     void PerformSolarCalculations(EnergyPlusData &state);
     271              : 
     272              :     void SHDRVL(EnergyPlusData &state,
     273              :                 int const HTSS,  // Heat transfer surface number of the subsurface
     274              :                 int const SBSNR, // Subsurface number
     275              :                 int const Hour,
     276              :                 int const TS);
     277              : 
     278              :     void SHDSBS(EnergyPlusData &state,
     279              :                 int const iHour, // Hour Index
     280              :                 int const CurSurf,
     281              :                 int const NBKS, // Number of back surfaces
     282              :                 int const NSBS, // Number of subsurfaces
     283              :                 int const HTS,  // Heat transfer surface number of the general receiving surf
     284              :                 int const TS    // Time step Index
     285              :     );
     286              : 
     287              :     void SUN3(int const JulianDayOfYear,      // Julian Day Of Year
     288              :               Real64 &SineOfSolarDeclination, // Sine of Solar Declination
     289              :               Real64 &EquationOfTime          // Equation of Time (Degrees)
     290              :     );
     291              : 
     292              :     void SUN4(EnergyPlusData &state,
     293              :               Real64 const CurrentTime,    // Time to use in shadowing calculations
     294              :               Real64 const EqOfTime,       // Equation of time for current day
     295              :               Real64 const SinSolarDeclin, // Sine of the Solar declination (current day)
     296              :               Real64 const CosSolarDeclin  // Cosine of the Solar declination (current day)
     297              :     );
     298              : 
     299              :     void WindowShadingManager(EnergyPlusData &state);
     300              : 
     301              :     void CheckGlazingShadingStatusChange(EnergyPlusData &state);
     302              : 
     303              :     DataSurfaces::WinShadingType findValueInEnumeration(Real64 controlValue);
     304              : 
     305              :     int selectActiveWindowShadingControlIndex(EnergyPlusData &state, int curSurface);
     306              : 
     307              :     void WindowGapAirflowControl(EnergyPlusData &state);
     308              : 
     309              :     void SkyDifSolarShading(EnergyPlusData &state);
     310              : 
     311              :     void CalcWindowProfileAngles(EnergyPlusData &state);
     312              : 
     313              :     void CalcFrameDividerShadow(EnergyPlusData &state,
     314              :                                 int const SurfNum,  // Surface number
     315              :                                 int const FrDivNum, // Frame/divider number
     316              :                                 int const HourNum   // Hour number
     317              :     );
     318              : 
     319              :     void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state);
     320              : 
     321              :     void ReportSurfaceShading(EnergyPlusData &state);
     322              : 
     323              :     void ReportSurfaceErrors(EnergyPlusData &state);
     324              : 
     325              :     void ComputeWinShadeAbsorpFactors(EnergyPlusData &state);
     326              : 
     327              :     void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state);
     328              : 
     329              :     void CalcInteriorWinTransDifSolInitialDistribution(
     330              :         EnergyPlusData &state,
     331              :         int const IntWinEnclosureNum,     // Interior Window Enclosure index number
     332              :         int const IntWinSurfNum,          // Interior Window Surface number
     333              :         Real64 const IntWinDifSolarTransW // Diffuse Solar transmitted through Interior Window IntWinSurfNum from adjacent enclosure [W]
     334              :     );
     335              : 
     336              :     void CalcComplexWindowOverlap(EnergyPlusData &state,
     337              :                                   BSDFGeomDescr &Geom,               // State Geometry
     338              :                                   BSDFWindowGeomDescr const &Window, // Window Geometry
     339              :                                   int const ISurf                    // Surface number of the complex fenestration
     340              :     );
     341              : 
     342              :     void TimestepInitComplexFenestration(EnergyPlusData &state);
     343              : 
     344              : } // namespace SolarShading
     345              : 
     346              : struct SolarShadingData : BaseGlobalStruct
     347              : {
     348              :     Array1D_string const cOverLapStatus;
     349              :     int MaxHCV = 15;             // Maximum number of HC vertices
     350              :                                  // (needs to be based on maxnumvertices)
     351              :     int MaxHCS = 15000;          // 200      ! Maximum number of HC surfaces (was 56)
     352              :                                  // Following are initially set in AllocateModuleArrays
     353              :     int MAXHCArrayBounds = 0;    // Bounds based on Max Number of Vertices in surfaces
     354              :     int MAXHCArrayIncrement = 0; // Increment based on Max Number of Vertices in surfaces
     355              :                                  // The following variable should be re-engineered to lower in module hierarchy but need more analysis
     356              :     int NVS;                     // Number of vertices of the shadow/clipped surface
     357              :     int NumVertInShadowOrClippedSurface;
     358              :     int CurrentSurfaceBeingShadowed;
     359              :     int CurrentShadowingSurface;
     360              :     int OverlapStatus; // Results of overlap calculation:
     361              :                        // 1=No overlap; 2=NS1 completely within NS2
     362              :                        // 3=NS2 completely within NS1; 4=Partial overlap
     363              : 
     364              :     Array1D<Real64> SurfSunCosTheta;            // Cosine of angle of incidence of sun's rays on surface NS
     365              :     Array1D<Real64> SurfAnisoSkyMult;           // Multiplier on exterior-surface sky view factor to account for
     366              :                                                 // anisotropy of sky radiance; = 1.0 for for isotropic sky
     367              :     Array1D<Real64> SurfDifShdgRatioIsoSky;     // Diffuse shading ratio (WithShdgIsoSky/WoShdgIsoSky)
     368              :     Array3D<Real64> SurfDifShdgRatioIsoSkyHRTS; // Diffuse shading ratio (WithShdgIsoSky/WoShdgIsoSky)
     369              :     Array1D<Real64> SurfCurDifShdgRatioIsoSky;  // Diffuse shading ratio (WithShdgIsoSky/WoShdgIsoSky)
     370              :     Array1D<Real64> SurfDifShdgRatioHoriz;      // Horizon shading ratio (WithShdgHoriz/WoShdgHoriz)
     371              :     Array3D<Real64> SurfDifShdgRatioHorizHRTS;  // Horizon shading ratio (WithShdgHoriz/WoShdgHoriz)
     372              :     Array1D<Real64> SurfWithShdgIsoSky;         // Diffuse solar irradiance from sky on surface, with shading
     373              :     Array1D<Real64> SurfWoShdgIsoSky;           // Diffuse solar from sky on surface, without shading
     374              :     Array1D<Real64> SurfWithShdgHoriz;          // Diffuse solar irradiance from horizon portion of sky on surface, with shading
     375              :     Array1D<Real64> SurfWoShdgHoriz;            // Diffuse solar irradiance from horizon portion of sky on surface, without shading
     376              :     Array1D<Real64> SurfMultIsoSky;             // Contribution to eff sky view factor from isotropic sky
     377              :     Array1D<Real64> SurfMultCircumSolar;        // Contribution to eff sky view factor from circumsolar brightening
     378              :     Array1D<Real64> SurfMultHorizonZenith;      // Contribution to eff sky view factor from horizon or zenith brightening
     379              : 
     380              :     int FBKSHC = 0;                 // HC location of first back surface
     381              :     int FGSSHC = 0;                 // HC location of first general shadowing surface
     382              :     int FINSHC = 0;                 // HC location of first back surface overlap
     383              :     int FRVLHC = 0;                 // HC location of first reveal surface
     384              :     int FSBSHC = 0;                 // HC location of first subsurface
     385              :     int LOCHCA = 0;                 // Location of highest data in the HC arrays
     386              :     int NBKSHC = 0;                 // Number of back surfaces in the HC arrays
     387              :     int NGSSHC = 0;                 // Number of general shadowing surfaces in the HC arrays
     388              :     int NINSHC = 0;                 // Number of back surface overlaps in the HC arrays
     389              :     int NRVLHC = 0;                 // Number of reveal surfaces in HC array
     390              :     int NSBSHC = 0;                 // Number of subsurfaces in the HC arrays
     391              :     bool CalcSkyDifShading = false; // True when sky diffuse solar shading is
     392              :     int ShadowingCalcFrequency = 0; // Frequency for Shadowing Calculations
     393              :     int ShadowingDaysLeft = 0;      // Days left in current shadowing period
     394              : 
     395              :     Array1D_int HCNS;   // Surface number of back surface HC figures
     396              :     Array1D_int HCNV;   // Number of vertices of each HC figure
     397              :     Array2D<Int64> HCA; // 'A' homogeneous coordinates of sides
     398              :     Array2D<Int64> HCB; // 'B' homogeneous coordinates of sides
     399              :     Array2D<Int64> HCC; // 'C' homogeneous coordinates of sides
     400              :     Array2D<Int64> HCX; // 'X' homogeneous coordinates of vertices of figure.
     401              :     Array2D<Int64> HCY; // 'Y' homogeneous coordinates of vertices of figure.
     402              :     Array3D_int SurfWinRevealStatus;
     403              :     Array1D<Real64> HCAREA;         // Area of each HC figure.  Sign Convention:  Base Surface
     404              :                                     // - Positive, Shadow - Negative, Overlap between two shadows
     405              :                                     // - positive, etc., so that sum of HC areas=base sunlit area
     406              :     Array1D<Real64> HCT;            // Transmittance of each HC figure
     407              :     Array1D<Real64> SurfIntAbsFac;  // For simple interior solar distribution (in which all beam
     408              :                                     // radiation entering zone is assumed to strike the floor),
     409              :                                     // fraction of beam radiation absorbed by each floor surface
     410              :     Array1D<Real64> SurfSunlitArea; // Sunlit area of heat transfer surface HTS
     411              :                                     // Excludes multiplier for windows
     412              :                                     // Shadowing combinations data structure...See ShadowingCombinations type
     413              :     int NumTooManyFigures = 0;
     414              :     int NumTooManyVertices = 0;
     415              :     int NumBaseSubSurround = 0;
     416              :     Vector3<Real64> SUNCOS;   // Direction cosines of solar position
     417              :     Real64 XShadowProjection; // X projection of a shadow (formerly called C)
     418              :     Real64 YShadowProjection; // Y projection of a shadow (formerly called S)
     419              :     Array1D<Real64> XTEMP;    // Temporary 'X' values for HC vertices of the overlap
     420              :     Array1D<Real64> XVC;      // X-vertices of the clipped figure
     421              :     Array1D<Real64> XVS;      // X-vertices of the shadow
     422              :     Array1D<Real64> YTEMP;    // Temporary 'Y' values for HC vertices of the overlap
     423              :     Array1D<Real64> YVC;      // Y-vertices of the clipped figure
     424              :     Array1D<Real64> YVS;      // Y-vertices of the shadow
     425              :     Array1D<Real64> ZVC;      // Z-vertices of the clipped figure
     426              :                               // Used in Sutherland Hodman poly clipping
     427              :     Array1D<Real64> ATEMP;    // Temporary 'A' values for HC vertices of the overlap
     428              :     Array1D<Real64> BTEMP;    // Temporary 'B' values for HC vertices of the overlap
     429              :     Array1D<Real64> CTEMP;    // Temporary 'C' values for HC vertices of the overlap
     430              :     Array1D<Real64> XTEMP1;   // Temporary 'X' values for HC vertices of the overlap
     431              :     Array1D<Real64> YTEMP1;   // Temporary 'Y' values for HC vertices of the overlap
     432              :     int maxNumberOfFigures = 0;
     433              : 
     434              : #ifdef EP_NO_OPENGL
     435              :     bool penumbra = false;
     436              : #else
     437              :     std::unique_ptr<Penumbra::Penumbra> penumbra = nullptr;
     438              :     std::pair<EnergyPlusData *, std::string> LoggerContext;
     439              : #endif
     440              : 
     441              :     bool GetInputFlag = true;
     442              :     bool anyScheduledShadingSurface = false;
     443              :     bool firstTime = true;
     444              :     bool debugging = false;
     445              :     std::vector<unsigned> penumbraIDs;
     446              : 
     447              :     bool InitComplexOnce = true;
     448              :     bool ShadowOneTimeFlag = true;
     449              :     bool CHKSBSOneTimeFlag = true;
     450              :     bool ORDERFirstTimeFlag = true;
     451              :     bool TooManyFiguresMessage = false;
     452              :     bool TooManyVerticesMessage = false;
     453              :     bool SHDBKSOneTimeFlag = true;
     454              :     bool SHDGSSOneTimeFlag = true;
     455              : 
     456              :     Array1D<SolarShading::SurfaceErrorTracking> TrackTooManyFigures;
     457              :     Array1D<SolarShading::SurfaceErrorTracking> TrackTooManyVertices;
     458              :     Array1D<SolarShading::SurfaceErrorTracking> TrackBaseSubSurround;
     459              : 
     460              :     Real64 TolValue = 0.0003;
     461              :     Array1D<Real64> XVT;   // X Vertices of
     462              :     Array1D<Real64> YVT;   // Y vertices of
     463              :     Array1D<Real64> ZVT;   // Z vertices of
     464              :     Array1D<Real64> SLOPE; // Slopes from left-most vertex to others.
     465              :     int MaxGSS = 50;       // Current Max for GSS array
     466              :     int MaxBKS = 50;       // Current Max for BKS array
     467              :     int MaxSBS = 50;       // Current Max for SBS array
     468              :     int MaxDim = 0;
     469              :     Array1D<Real64> XVrt;  // X Vertices of Shadows
     470              :     Array1D<Real64> YVrt;  // Y vertices of Shadows
     471              :     Array1D<Real64> ZVrt;  // Z vertices of Shadows
     472              :     Array1D<Real64> XVrtx; // X,Y,Z coordinates of vertices of
     473              :     Array1D<Real64> YVrtx; // back surfaces projected into system
     474              :     Array1D<Real64> ZVrtx; // relative to receiving surface
     475              :     Array1D<Real64> XVert;
     476              :     Array1D<Real64> YVert;
     477              :     Array1D<Real64> ZVert;
     478              :     Array1D<Real64> SurfWinAbsBeam;                                                               // Glass layer beam solar absorptance of a window
     479              :     Array1D<Real64> SurfWinAbsBeamEQL = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL + 1); // layers beam solar absorptance of a window
     480              :     Array1D<Real64> SurfWinExtBeamAbsByShadFac; // Factor for exterior beam radiation absorbed by shade (1/m2) (absorbed radation = beam incident *
     481              :                                                 // ExtBeamAbsByShad
     482              :     Array1D<Real64> SurfWinIntBeamAbsByShadFac; // Like SurfWinExtBeamAbsByShadFac, but for interior beam radiation.
     483              :     Array1D<Real64>
     484              :         SurfWinTransBmSolar; // Factor for exterior beam solar transmitted through window, or window plus shade, into zone at current time (m2)
     485              :     Array1D<Real64>
     486              :         SurfWinTransDifSolar; // Factor for exterior diffuse solar transmitted through window, or window plus shade, into zone at current time (m2)
     487              :     Array1D<Real64> SurfWinTransDifSolarGnd; // Factor for exterior ground diffuse solar transmitted through window with horizontally-slatted blind
     488              :                                              // into zone at current time (m2)
     489              :     Array1D<Real64> SurfWinTransDifSolarSky; // Factor for exterior sky diffuse solar transmitted through window with horizontally-slatted blind into
     490              :                                              // zone at current time (m2)
     491              :     Array2D<Real64> SurfWinAbsSolBeamEQL =
     492              :         Array2D<Real64>(2, DataWindowEquivalentLayer::CFSMAXNL + 1); // absorbed exterior beam radiation by layers fraction
     493              :     Array2D<Real64> SurfWinAbsSolDiffEQL =
     494              :         Array2D<Real64>(2, DataWindowEquivalentLayer::CFSMAXNL + 1); // absorbed exterior diffuse radiation by layers fraction
     495              :     Array2D<Real64> SurfWinAbsSolBeamBackEQL =
     496              :         Array2D<Real64>(2, DataWindowEquivalentLayer::CFSMAXNL + 1); // absorbed interior beam radiation by layers fraction from back
     497              :     Array1D<Real64> SurfWinTransBmBmSolar;  // Factor for exterior beam to beam solar transmitted through window, or window plus shade, into zone at
     498              :                                             // current time (m2)
     499              :     Array1D<Real64> SurfWinTransBmDifSolar; // Factor for exterior beam to diffuse solar transmitted through window, or window plus shade, into zone
     500              :                                             // at current time (m2)
     501              :     Real64 ThetaBig = 0.0;                  // Larger of ThetaBlock1 and ThetaBlock2     //Autodesk Used uninitialized in some runs
     502              :     Real64 ThetaSmall = 0.0;                // Smaller of ThetaBlock1 and ThetaBlock2 //Autodesk Used uninitialized in some runs
     503              :     Real64 ThetaMin = 0.0;                  // Minimum allowed slat angle, resp. (rad)  //Autodesk Used uninitialized in some runs
     504              :     Real64 ThetaMax = 0.0;                  // Maximum allowed slat angle, resp. (rad)  //Autodesk Used uninitialized in some runs
     505              :     Array1D<Real64> XVertex;                // X,Y,Z coordinates of vertices of
     506              :     Array1D<Real64> YVertex;                // back surfaces projected into system
     507              :     Array1D<Real64> ZVertex;                // relative to receiving surface
     508              :     std::vector<Real64> sin_Phi;
     509              :     std::vector<Real64> cos_Phi;
     510              :     std::vector<Real64> sin_Theta;
     511              :     std::vector<Real64> cos_Theta;
     512              :     std::unique_ptr<std::iostream> shd_stream; // Shading file stream
     513              : 
     514         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     515              :     {
     516         2126 :     }
     517              : 
     518         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     519              :     {
     520         1152 :     }
     521              : 
     522         2100 :     void clear_state() override
     523              :     {
     524         2100 :         this->MaxHCV = 15;
     525         2100 :         this->MaxHCS = 1500;
     526         2100 :         this->MAXHCArrayBounds = 0;
     527         2100 :         this->MAXHCArrayIncrement = 0;
     528         2100 :         this->NVS = 0;
     529         2100 :         this->NumVertInShadowOrClippedSurface = 0;
     530         2100 :         this->CurrentSurfaceBeingShadowed = 0;
     531         2100 :         this->CurrentShadowingSurface = 0;
     532         2100 :         this->OverlapStatus = 0;
     533         2100 :         this->SurfSunCosTheta.deallocate();
     534         2100 :         this->SurfAnisoSkyMult.deallocate();
     535         2100 :         this->SurfDifShdgRatioIsoSky.deallocate();
     536         2100 :         this->SurfDifShdgRatioIsoSkyHRTS.deallocate();
     537         2100 :         this->SurfCurDifShdgRatioIsoSky.deallocate();
     538         2100 :         this->SurfDifShdgRatioHoriz.deallocate();
     539         2100 :         this->SurfDifShdgRatioHorizHRTS.deallocate();
     540         2100 :         this->SurfWithShdgIsoSky.deallocate();
     541         2100 :         this->SurfWoShdgIsoSky.deallocate();
     542         2100 :         this->SurfWithShdgHoriz.deallocate();
     543         2100 :         this->SurfWoShdgHoriz.deallocate();
     544         2100 :         this->SurfMultIsoSky.deallocate();
     545         2100 :         this->SurfMultCircumSolar.deallocate();
     546         2100 :         this->SurfMultHorizonZenith.deallocate();
     547         2100 :         this->FBKSHC = 0;
     548         2100 :         this->FGSSHC = 0;
     549         2100 :         this->FINSHC = 0;
     550         2100 :         this->FRVLHC = 0;
     551         2100 :         this->FSBSHC = 0;
     552         2100 :         this->LOCHCA = 0;
     553         2100 :         this->NBKSHC = 0;
     554         2100 :         this->NGSSHC = 0;
     555         2100 :         this->NINSHC = 0;
     556         2100 :         this->NRVLHC = 0;
     557         2100 :         this->NSBSHC = 0;
     558         2100 :         this->CalcSkyDifShading = false;
     559         2100 :         this->ShadowingCalcFrequency = 0; // Frequency for Shadowing Calculations
     560         2100 :         this->ShadowingDaysLeft = 0;      // Days left in current shadowing period
     561         2100 :         this->debugging = false;
     562         2100 :         this->GetInputFlag = true;
     563         2100 :         this->anyScheduledShadingSurface = false;
     564         2100 :         this->firstTime = true;
     565         2100 :         this->HCNS.deallocate();
     566         2100 :         this->HCNV.deallocate();
     567         2100 :         this->HCA.deallocate();
     568         2100 :         this->HCB.deallocate();
     569         2100 :         this->HCC.deallocate();
     570         2100 :         this->HCX.deallocate();
     571         2100 :         this->HCY.deallocate();
     572         2100 :         this->SurfWinRevealStatus.deallocate();
     573         2100 :         this->HCAREA.deallocate();
     574         2100 :         this->HCT.deallocate();
     575         2100 :         this->SurfIntAbsFac.deallocate();
     576         2100 :         this->SurfSunlitArea.deallocate();
     577         2100 :         this->NumTooManyFigures = 0;
     578         2100 :         this->NumTooManyVertices = 0;
     579         2100 :         this->NumBaseSubSurround = 0;
     580         2100 :         this->XShadowProjection = 0.0;
     581         2100 :         this->YShadowProjection = 0.0;
     582         2100 :         this->XTEMP.deallocate();
     583         2100 :         this->XVC.deallocate();
     584         2100 :         this->XVS.deallocate();
     585         2100 :         this->YTEMP.deallocate();
     586         2100 :         this->YVC.deallocate();
     587         2100 :         this->YVS.deallocate();
     588         2100 :         this->ZVC.deallocate();
     589         2100 :         this->ATEMP.deallocate();
     590         2100 :         this->BTEMP.deallocate();
     591         2100 :         this->CTEMP.deallocate();
     592         2100 :         this->XTEMP1.deallocate();
     593         2100 :         this->YTEMP1.deallocate();
     594         2100 :         this->maxNumberOfFigures = 0;
     595         2100 :         this->TrackTooManyFigures.deallocate();
     596         2100 :         this->TrackTooManyVertices.deallocate();
     597         2100 :         this->TrackBaseSubSurround.deallocate();
     598         2100 :         this->InitComplexOnce = true;
     599         2100 :         this->ShadowOneTimeFlag = true;
     600         2100 :         this->CHKSBSOneTimeFlag = true;
     601         2100 :         this->ORDERFirstTimeFlag = true;
     602         2100 :         this->TooManyFiguresMessage = false;
     603         2100 :         this->TooManyVerticesMessage = false;
     604         2100 :         this->SHDBKSOneTimeFlag = true;
     605         2100 :         this->SHDGSSOneTimeFlag = true;
     606         2100 :         this->TolValue = 0.0003;
     607         2100 :         this->XVT.deallocate();
     608         2100 :         this->YVT.deallocate();
     609         2100 :         this->ZVT.deallocate();
     610         2100 :         this->SLOPE.deallocate();
     611         2100 :         this->MaxGSS = 50;
     612         2100 :         this->MaxBKS = 50;
     613         2100 :         this->MaxSBS = 50;
     614         2100 :         this->MaxDim = 0;
     615         2100 :         this->XVrt.deallocate();
     616         2100 :         this->YVrt.deallocate();
     617         2100 :         this->ZVrt.deallocate();
     618         2100 :         this->XVrtx.deallocate();
     619         2100 :         this->YVrtx.deallocate();
     620         2100 :         this->ZVrtx.deallocate();
     621         2100 :         this->XVert.deallocate();
     622         2100 :         this->YVert.deallocate();
     623         2100 :         this->ZVert.deallocate();
     624         2100 :         this->SurfWinAbsBeam.deallocate();
     625         2100 :         this->SurfWinAbsBeamEQL = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL + 1);
     626         2100 :         this->SurfWinExtBeamAbsByShadFac.deallocate();
     627         2100 :         this->SurfWinIntBeamAbsByShadFac.deallocate();
     628         2100 :         this->SurfWinTransBmSolar.deallocate();
     629         2100 :         this->SurfWinTransDifSolar.deallocate();
     630         2100 :         this->SurfWinTransDifSolarGnd.deallocate();
     631         2100 :         this->SurfWinTransDifSolarSky.deallocate();
     632         2100 :         this->SurfWinAbsSolBeamEQL = Array2D<Real64>(2, DataWindowEquivalentLayer::CFSMAXNL + 1);
     633         2100 :         this->SurfWinAbsSolDiffEQL = Array2D<Real64>(2, DataWindowEquivalentLayer::CFSMAXNL + 1);
     634         2100 :         this->SurfWinAbsSolBeamBackEQL = Array2D<Real64>(2, DataWindowEquivalentLayer::CFSMAXNL + 1);
     635         2100 :         this->SurfWinTransBmBmSolar.deallocate();
     636         2100 :         this->SurfWinTransBmDifSolar.deallocate();
     637         2100 :         this->ThetaBig = 0.0;
     638         2100 :         this->ThetaSmall = 0.0;
     639         2100 :         this->ThetaMin = 0.0;
     640         2100 :         this->ThetaMax = 0.0;
     641         2100 :         this->XVertex.deallocate();
     642         2100 :         this->YVertex.deallocate();
     643         2100 :         this->ZVertex.deallocate();
     644         2100 :         this->sin_Phi.clear();
     645         2100 :         this->cos_Phi.clear();
     646         2100 :         this->sin_Theta.clear();
     647         2100 :         this->cos_Theta.clear();
     648         2100 :         this->shd_stream.reset();
     649         2100 :     }
     650              : 
     651              :     // Default Constructor
     652         2129 :     SolarShadingData()
     653         2129 :         : cOverLapStatus(6, {"No-Overlap", "1st-Surf-within-2nd", "2nd-Surf-within-1st", "Partial-Overlap", "Too-Many-Vertices", "Too-Many-Figures"}),
     654         4258 :           SUNCOS(3)
     655              :     {
     656         2129 :     }
     657              : };
     658              : 
     659              : } // namespace EnergyPlus
     660              : #endif
        

Generated by: LCOV version 2.0-1