LCOV - code coverage report
Current view: top level - EnergyPlus - DataEnvironment.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 1 4 25.0 %
Date: 2023-01-17 19:17:23 Functions: 2 4 50.0 %

          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 DataEnvironment_hh_INCLUDED
      49             : #define DataEnvironment_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/EnergyPlus.hh>
      57             : 
      58             : namespace EnergyPlus {
      59             : 
      60             : // Forward declarations
      61             : struct EnergyPlusData;
      62             : 
      63             : namespace DataEnvironment {
      64             : 
      65             :     Real64 constexpr EarthRadius(6356000.0);          // Radius of the Earth (m)
      66             :     Real64 constexpr AtmosphericTempGradient(0.0065); // Standard atmospheric air temperature gradient (K/m)
      67             :     Real64 constexpr SunIsUpValue(0.00001);           // if Cos Zenith Angle of the sun is >= this value, the sun is "up"
      68             :     Real64 constexpr StdPressureSeaLevel(101325.0);   // Standard barometric pressure at sea level (Pa)
      69             : 
      70             :     Real64 OutDryBulbTempAt(EnergyPlusData &state, Real64 Z); // Height above ground (m)
      71             : 
      72             :     Real64 OutWetBulbTempAt(EnergyPlusData &state, Real64 Z); // Height above ground (m)
      73             : 
      74             :     Real64 OutDewPointTempAt(EnergyPlusData &state, Real64 Z); // Height above ground (m)
      75             : 
      76             :     Real64 WindSpeedAt(EnergyPlusData &state, Real64 Z); // Height above ground (m)
      77             : 
      78             :     Real64 OutBaroPressAt(EnergyPlusData &state, Real64 Z); // Height above ground (m)
      79             : 
      80             :     void SetOutBulbTempAt_error(EnergyPlusData &state, std::string const &Settings, Real64 max_height, std::string const &SettingsName);
      81             : 
      82             : } // namespace DataEnvironment
      83             : 
      84        1542 : struct EnvironmentData : BaseGlobalStruct
      85             : {
      86             : 
      87             :     Real64 BeamSolarRad = 0.0;                 // Current beam normal solar irradiance
      88             :     bool EMSBeamSolarRadOverrideOn = false;    // EMS flag for beam normal solar irradiance
      89             :     Real64 EMSBeamSolarRadOverrideValue = 0.0; // EMS override value for beam normal solar irradiance
      90             :     int DayOfMonth = 0;                        // Current day of the month
      91             :     int DayOfMonthTomorrow = 0;                // Tomorrow's day of the month
      92             :     int DayOfWeek = 0;                         // Current day of the week (Sunday=1, Monday=2, ...)
      93             :     int DayOfWeekTomorrow = 0;                 // Tomorrow's day of the week (Sunday=1, Monday=2, ...)
      94             :     int DayOfYear = 0;                         // Current day of the year (01JAN=1, 02JAN=2, ...)
      95             :     int DayOfYear_Schedule = 0;                // Schedule manager always assumes leap years...
      96             :     Real64 DifSolarRad = 0.0;                  // Current sky diffuse solar horizontal irradiance
      97             :     bool EMSDifSolarRadOverrideOn = false;     // EMS flag for sky diffuse solar horizontal irradiance
      98             :     Real64 EMSDifSolarRadOverrideValue = 0.0;  // EMS override value for sky diffuse solar horizontal irradiance
      99             :     int DSTIndicator = 0;                      // Daylight Saving Time Indicator (1=yes, 0=no) for Today
     100             :     Real64 Elevation = 0.0;                    // Elevation of this building site
     101             :     bool EndMonthFlag = false;                 // Set to true on last day of month
     102             :     bool EndYearFlag = false;                  // Set to true on the last day of year
     103             :     Real64 GndReflectanceForDayltg = 0.0;      // Ground visible reflectance for use in daylighting calc
     104             :     Real64 GndReflectance = 0.0;               // Ground visible reflectance from input
     105             :     Real64 GndSolarRad = 0.0;                  // Current ground reflected radiation
     106             :     Real64 GroundTemp = 0.0;                   // Current ground temperature {C}
     107             :     Real64 GroundTempKelvin = 0.0;             // Current ground temperature {K}
     108             :     Real64 GroundTempFC = 0.0;                 // Current ground temperature defined for F or C factor method {C}
     109             :     Real64 GroundTemp_Surface = 0.0;           // Current surface ground temperature {C}
     110             :     Real64 GroundTemp_Deep = 0.0;              // Current deep ground temperature
     111             :     int HolidayIndex = 0; // Indicates whether current day is a holiday and if so what type - HolidayIndex=(0-no holiday, 1-holiday type 1, ...)
     112             :     int HolidayIndexTomorrow = 0;                 // Tomorrow's Holiday Index
     113             :     bool IsRain = false;                          // Surfaces are wet for this time interval
     114             :     bool IsSnow = false;                          // Snow on the ground for this time interval
     115             :     Real64 Latitude = 0.0;                        // Latitude of building location
     116             :     Real64 Longitude = 0.0;                       // Longitude of building location
     117             :     int Month = 0;                                // Current calendar month
     118             :     int MonthTomorrow = 0;                        // Tomorrow's calendar month
     119             :     Real64 OutBaroPress = 0.0;                    // Current outdoor air barometric pressure
     120             :     Real64 OutDryBulbTemp = 0.0;                  // Current outdoor air dry bulb temperature
     121             :     bool EMSOutDryBulbOverrideOn = false;         // EMS flag for outdoor air dry bulb temperature
     122             :     Real64 EMSOutDryBulbOverrideValue = 0.0;      // EMS override value for outdoor air dry bulb temperature
     123             :     Real64 OutHumRat = 0.0;                       // Current outdoor air humidity ratio
     124             :     Real64 OutRelHum = 0.0;                       // Current outdoor relative humidity [%]
     125             :     Real64 OutRelHumValue = 0.0;                  // Current outdoor relative humidity value [0.0-1.0]
     126             :     bool EMSOutRelHumOverrideOn = false;          // EMS flag for outdoor relative humidity value
     127             :     Real64 EMSOutRelHumOverrideValue = 0.0;       // EMS override value for outdoor relative humidity value
     128             :     Real64 OutEnthalpy = 0.0;                     // Current outdoor enthalpy
     129             :     Real64 OutAirDensity = 0.0;                   // Current outdoor air density
     130             :     Real64 OutWetBulbTemp = 0.0;                  // Current outdoor air wet bulb temperature
     131             :     Real64 OutDewPointTemp = 0.0;                 // Current outdoor dewpoint temperature
     132             :     bool EMSOutDewPointTempOverrideOn = false;    // EMS flag for outdoor dewpoint temperature
     133             :     Real64 EMSOutDewPointTempOverrideValue = 0.0; // EMS override value for outdoor dewpoint temperature
     134             :     Real64 SkyTemp = 0.0;                         // Current sky temperature {C}
     135             :     Real64 SkyTempKelvin = 0.0;                   // Current sky temperature {K}
     136             :     Real64 LiquidPrecipitation = 0.0;             // Current liquid precipitation amount (rain) {m}
     137             :     bool SunIsUp = false;                         // True when Sun is over horizon, False when not
     138             :     bool SunIsUpPrevTS = false;                   // True when Sun is over horizon in the previous timestep, False when not in the previous timestep
     139             :     bool PreviousSolRadPositive = false; // True when Sun is over horizon at the previous timestep, and BeamSolarRad + GndSolarRad + DifSolarRad > 0.0
     140             :     Real64 WindDir = 0.0;                // Current outdoor air wind direction
     141             :     bool EMSWindDirOverrideOn = false;   // EMS flag for outdoor air wind direction
     142             :     Real64 EMSWindDirOverrideValue = 0.0;                       // EMS override value for outdoor air wind direction
     143             :     Real64 WindSpeed = 0.0;                                     // Current outdoor air wind speed
     144             :     bool EMSWindSpeedOverrideOn = false;                        // EMS flag for outdoor air wind speed
     145             :     Real64 EMSWindSpeedOverrideValue = false;                   // EMS override value for outdoor air wind speed
     146             :     Real64 WaterMainsTemp = 0.0;                                // Current water mains temperature
     147             :     int Year = 0;                                               // Current calendar year of the simulation from the weather file
     148             :     int YearTomorrow = 0;                                       // Tomorrow's calendar year of the simulation
     149             :     Array1D<Real64> SOLCOS = Array1D<Real64>(3);                // Solar direction cosines at current time step
     150             :     Real64 CloudFraction = 0.0;                                 // Fraction of sky covered by clouds
     151             :     Real64 HISKF = 0.0;                                         // Exterior horizontal illuminance from sky (lux).
     152             :     Real64 HISUNF = 0.0;                                        // Exterior horizontal beam illuminance (lux)
     153             :     Real64 HISUNFnorm = 0.0;                                    // Exterior beam normal illuminance (lux)
     154             :     Real64 PDIRLW = 0.0;                                        // Luminous efficacy (lum/W) of beam solar radiation
     155             :     Real64 PDIFLW = 0.0;                                        // Luminous efficacy (lum/W) of sky diffuse solar radiation
     156             :     Real64 SkyClearness = 0.0;                                  // Sky clearness (see subr. DayltgLuminousEfficacy)
     157             :     Real64 SkyBrightness = 0.0;                                 // Sky brightness (see subr. DayltgLuminousEfficacy)
     158             :     Real64 TotalCloudCover = 5.0;                               // Total Sky Cover (tenth of sky)
     159             :     Real64 OpaqueCloudCover = 5.0;                              // Opaque Sky Cover (tenth of sky)
     160             :     Real64 StdBaroPress = DataEnvironment::StdPressureSeaLevel; // Standard "atmospheric pressure" based on elevation (ASHRAE HOF p6.1)
     161             :     Real64 StdRhoAir = 0.0;                                     // Standard "rho air" set in WeatherManager - based on StdBaroPress
     162             :     Real64 rhoAirSTP = 0.0;                                     // Standard density of dry air at 101325 Pa, 20.0C temperature
     163             :     Real64 TimeZoneNumber = 0.0;                                // Time Zone Number of building location
     164             :     Real64 TimeZoneMeridian = 0.0;                              // Standard Meridian of TimeZone
     165             :     std::string EnvironmentName;                                // Current environment name (longer for weather file names)
     166             :     std::string WeatherFileLocationTitle;                       // Location Title from Weather File
     167             :     std::string CurMnDyHr;                                      // Current Month/Day/Hour timestamp info
     168             :     std::string CurMnDy;                                        // Current Month/Day timestamp info
     169             :     std::string CurMnDyYr;                                      // Current Month/Day/Year timestamp info
     170             :     int CurEnvirNum = 0;                                        // current environment number
     171             :     int TotDesDays = 0;                                         // Total number of Design days to Setup
     172             :     int TotRunDesPersDays = 0;                                  // Total number of Run Design Periods [Days] (Weather data) to Setup
     173             :     int CurrentOverallSimDay = 0;                               // Count of current simulation day in total of all sim days
     174             :     int TotalOverallSimDays = 0;                                // Count of all possible simulation days in all environments
     175             :     int MaxNumberSimYears = 0;                                  // Maximum number of simulation years requested in all RunPeriod statements
     176             :     int RunPeriodStartDayOfWeek = 0;                            // Day of week of the first day of the run period. (or design day - day of week)
     177             :     Real64 CosSolarDeclinAngle = 0.0;                           // Cosine of the solar declination angle
     178             :     Real64 EquationOfTime = 0.0;                                // Value of the equation of time formula
     179             :     Real64 SinLatitude = 0.0;                                   // Sine of Latitude
     180             :     Real64 CosLatitude = 0.0;                                   // Cosine of Latitude
     181             :     Real64 SinSolarDeclinAngle = 0.0;                           // Sine of the solar declination angle
     182             :     Real64 TS1TimeOffset = -0.5;                                // offset when TS=1 for solar calculations
     183             :     Real64 WeatherFileWindModCoeff = 1.5863;                    // =(WindBLHeight/WindSensorHeight)**WindExp for conditions at the weather station
     184             :     Real64 WeatherFileTempModCoeff = 0.0;                       // =AtmosphericTempGradient*EarthRadius*SensorHeight/(EarthRadius+SensorHeight)
     185             :     Real64 SiteWindExp = 0.22;                                  // Exponent for the wind velocity profile at the site
     186             :     Real64 SiteWindBLHeight = 370.0;                            // Boundary layer height for the wind velocity profile at the site (m)
     187             :     Real64 SiteTempGradient = 0.0065;                           // Air temperature gradient coefficient (K/m)
     188             :     bool GroundTempObjInput = false;                            // Ground temperature object input
     189             :     bool GroundTemp_SurfaceObjInput = false;                    // Surface ground temperature object input
     190             :     bool GroundTemp_DeepObjInput = false;                       // Deep ground temperature object input
     191             :     bool FCGroundTemps = false;
     192             :     bool DisplayWeatherMissingDataWarnings = false; // Display missing/out of range weather warnings
     193             :     bool IgnoreSolarRadiation = false;              // TRUE if all solar radiation is to be ignored
     194             :     bool IgnoreBeamRadiation = false;               // TRUE if beam (aka direct normal) radiation is to be ignored
     195             :     bool IgnoreDiffuseRadiation = false;            // TRUE if diffuse horizontal radiation is to be ignored
     196             :     bool PrintEnvrnStampWarmup = false;
     197             :     bool PrintEnvrnStampWarmupPrinted = false;
     198             :     bool RunPeriodEnvironment = false; // True if Run Period, False if DesignDay
     199             :     int StartYear = 0;                 // Start year for Environment
     200             :     int EndYear = 0;                   // End year for Environment
     201             :     std::string EnvironmentStartEnd;   // Start/End dates for Environment
     202             :     bool CurrentYearIsLeapYear =
     203             :         false; // true when current year is leap year (convoluted logic dealing with whether weather file allows leap years, runperiod inputs.
     204             :     int varyingLocationSchedIndexLat = 0;
     205             :     int varyingLocationSchedIndexLong = 0;
     206             :     int varyingOrientationSchedIndex = 0;
     207             :     bool forceBeginEnvResetSuppress = false; // for PerformancePrecisionTradeoffs
     208             :     bool oneTimeCompRptHeaderFlag = true;
     209             : 
     210           0 :     void clear_state() override
     211             :     {
     212           0 :         *this = EnvironmentData();
     213           0 :     }
     214             : };
     215             : 
     216             : } // namespace EnergyPlus
     217             : 
     218             : #endif

Generated by: LCOV version 1.13