LCOV - code coverage report
Current view: top level - EnergyPlus - WeatherManager.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 3 10 30.0 %
Date: 2024-08-24 18:31:18 Functions: 1 2 50.0 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois,
       2             : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3             : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4             : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5             : // contributors. All rights reserved.
       6             : //
       7             : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8             : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9             : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10             : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11             : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12             : //
      13             : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14             : // provided that the following conditions are met:
      15             : //
      16             : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17             : //     conditions and the following disclaimer.
      18             : //
      19             : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20             : //     conditions and the following disclaimer in the documentation and/or other materials
      21             : //     provided with the distribution.
      22             : //
      23             : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24             : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25             : //     used to endorse or promote products derived from this software without specific prior
      26             : //     written permission.
      27             : //
      28             : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29             : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30             : //     reference solely to the software portion of its product, Licensee must refer to the
      31             : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32             : //     obtained under this License and may not use a different name for the software. Except as
      33             : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34             : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35             : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36             : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37             : //
      38             : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39             : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40             : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41             : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42             : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43             : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44             : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45             : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46             : // POSSIBILITY OF SUCH DAMAGE.
      47             : 
      48             : #ifndef WeatherManager_hh_INCLUDED
      49             : #define WeatherManager_hh_INCLUDED
      50             : 
      51             : // C++ Headers
      52             : #include <vector>
      53             : 
      54             : // ObjexxFCL Headers
      55             : #include <ObjexxFCL/Array2D.hh>
      56             : #include <ObjexxFCL/Array3D.hh>
      57             : #include <ObjexxFCL/Optional.hh>
      58             : 
      59             : // EnergyPlus Headers
      60             : #include <EnergyPlus/Data/BaseData.hh>
      61             : #include <EnergyPlus/DataGlobals.hh>
      62             : #include <EnergyPlus/EPVector.hh>
      63             : #include <EnergyPlus/EnergyPlus.hh>
      64             : #include <EnergyPlus/ScheduleManager.hh>
      65             : 
      66             : namespace EnergyPlus {
      67             : 
      68             : // Forward declarations
      69             : class BaseGroundTempsModel;
      70             : struct EnergyPlusData;
      71             : 
      72             : namespace Weather {
      73             : 
      74             :     enum class EpwHeaderType
      75             :     {
      76             :         Invalid = -1,
      77             :         Location = 0, // epw Headers are assumed to be in this order
      78             :         DesignConditions,
      79             :         TypicalExtremePeriods,
      80             :         GroundTemperatures,
      81             :         HolidaysDST,
      82             :         Comments1,
      83             :         Comments2,
      84             :         DataPeriods,
      85             :         Num
      86             :     };
      87             : 
      88             :     // Following are Date Types read in from EPW file or IDF
      89             :     enum class DateType
      90             :     {
      91             :         Invalid = -1,
      92             :         MonthDay = 1,
      93             :         NthDayInMonth = 2,
      94             :         LastDayInMonth = 3,
      95             :         Num
      96             :     };
      97             : 
      98             :     // Water mains temperatures calculation methods
      99             :     enum class WaterMainsTempCalcMethod
     100             :     {
     101             :         Invalid = -1,
     102             :         Schedule,
     103             :         Correlation,
     104             :         CorrelationFromWeatherFile,
     105             :         FixedDefault,
     106             :         Num
     107             :     };
     108             : 
     109             :     enum class DesDaySolarModel
     110             :     {
     111             :         Invalid = -1,
     112             :         ASHRAE_ClearSky,     // Design Day solar model ASHRAE ClearSky (default)
     113             :         Zhang_Huang,         // Design Day solar model Zhang Huang
     114             :         SolarModel_Schedule, // Design Day solar model (beam and diffuse) from user entered schedule
     115             :         ASHRAE_Tau,          // Design Day solar model ASHRAE tau (per 2009 HOF)
     116             :         ASHRAE_Tau2017,      // Design Day solar model ASHRAE tau (per 2013 and 2017 HOF)
     117             :         Num
     118             :     };
     119             : 
     120             :     static constexpr std::array<std::string_view, (int)DesDaySolarModel::Num> DesDaySolarModelNames = {
     121             :         "ASHRAEClearSky", "ZhangHuang", "Schedule", "ASHRAETau", "ASHRAETau2017"};
     122             : 
     123             :     static constexpr std::array<std::string_view, (int)DesDaySolarModel::Num> DesDaySolarModelNamesUC = {
     124             :         "ASHRAECLEARSKY", "ZHANGHUANG", "SCHEDULE", "ASHRAETAU", "ASHRAETAU2017"};
     125             : 
     126             :     // Design Day Humidity Indicating Type
     127             :     enum class DesDayHumIndType
     128             :     {
     129             :         Invalid = -1,
     130             :         WetBulb,   // Wetbulb (default)
     131             :         DewPoint,  // Dewpoint
     132             :         Enthalpy,  // Enthalpy
     133             :         HumRatio,  // Humidity Ratio
     134             :         RelHumSch, // relhum schedule
     135             :         WBProfDef, // Wetbulb default profile
     136             :         WBProfDif, // Wetbulb difference profile
     137             :         WBProfMul, // Wetbulb multiplier profile
     138             :         Num
     139             :     };
     140             : 
     141             :     static constexpr std::array<std::string_view, (int)DesDayHumIndType::Num> DesDayHumIndTypeNamesUC = {"WETBULB",
     142             :                                                                                                          "DEWPOINT",
     143             :                                                                                                          "ENTHALPY",
     144             :                                                                                                          "HUMIDITYRATIO",
     145             :                                                                                                          "RELATIVEHUMIDITYSCHEDULE",
     146             :                                                                                                          "WETBULBPROFILEDEFAULTMULTIPLIERS",
     147             :                                                                                                          "WETBULBPROFILEDIFFERENCESCHEDULE",
     148             :                                                                                                          "WETBULBPROFILEMULTIPLIERSCHEDULE"};
     149             : 
     150             :     // Design Day DryBulb Range Type
     151             :     enum class DesDayDryBulbRangeType
     152             :     {
     153             :         Invalid = -1,
     154             :         Default,    // Default Multipliers
     155             :         Multiplier, // Multiplier Schedule
     156             :         Difference, // Difference Schedule
     157             :         Profile,    // Temperature Profile
     158             :         Num
     159             :     };
     160             : 
     161             :     static constexpr std::array<std::string_view, (int)DesDayDryBulbRangeType::Num> DesDayDryBulbRangeTypeNamesUC = {
     162             :         "DEFAULTMULTIPLIERS", "MULTIPLIERSCHEDULE", "DIFFERENCESCHEDULE", "TEMPERATUREPROFILESCHEDULE"};
     163             : 
     164             :     enum class SkyTempModel
     165             :     {
     166             :         Invalid = -1,
     167             :         ClarkAllen,    // Use Clark & Allen model for sky emissivity calculation
     168             :         ScheduleValue, // User entered Schedule value for Weather Property
     169             :         DryBulbDelta,  // User entered DryBulb difference Schedule value for Weather Property
     170             :         DewPointDelta, // User entered Dewpoint difference Schedule value for Weather Property
     171             :         Brunt,         // Use Brunt model for sky emissivity calculation
     172             :         Idso,          // Use Isdo model for sky emissivity calculation
     173             :         BerdahlMartin, // Use Martin & Berdahl model for sky emissivity calculation
     174             :         Num
     175             :     };
     176             : 
     177             :     struct EnvironmentData
     178             :     {
     179             :         // Members
     180             :         std::string Title = "";                                         // Environment name
     181             :         std::string cKindOfEnvrn = "";                                  // kind of environment
     182             :         Constant::KindOfSim KindOfEnvrn = Constant::KindOfSim::Invalid; // Type of environment (see Parameters for KindOfSim in DataGlobals)
     183             :         int DesignDayNum = 0;                                           // index in DesignDay structure and DesignDayInput
     184             :         int RunPeriodDesignNum = 0;                                     // for WeatherFileDays, index in  RunPeriodDesign and RunPeriodDesignInput
     185             :         int SeedEnvrnNum = 0;           // for HVAC sizing sim, new environments are copies of original environments, this is the index for original
     186             :         int HVACSizingIterationNum = 0; // environments for HVAC sizing simulations are associated with iteration
     187             :         int TotalDays = 0;              // Number of days in environment
     188             :         int StartJDay = 0;              // Day of year of first day of environment
     189             :         int StartMonth = 0;
     190             :         int StartDay = 0;
     191             :         int StartYear = 0;
     192             :         int StartDate = 0;
     193             :         int EndMonth = 0;
     194             :         int EndDay = 0;
     195             :         int EndJDay = 0;
     196             :         int EndYear = 0;
     197             :         int EndDate = 0;
     198             :         int DayOfWeek = 0;             // Starting Day of Week for the (Weather) RunPeriod (User Input)
     199             :         bool UseDST = false;           // True if DaylightSavingTime is used for this RunPeriod
     200             :         bool UseHolidays = false;      // True if Holidays are used for this RunPeriod (from WeatherFile)
     201             :         bool ApplyWeekendRule = false; // True if "Weekend Rule" is to be applied to RunPeriod
     202             :         bool UseRain = true;           // True if Rain from weather file should be used (set rain to true)
     203             :         bool UseSnow = true;           // True if Snow from weather file should be used (set Snow to true)
     204             :         Array1D_int MonWeekDay = Array1D_int(12, 0);
     205             :         bool SetWeekDays = false;                             // true when weekdays will be reset (after first year or on repeat)
     206             :         int NumSimYears = 1;                                  // Total Number of times this period to be performed
     207             :         int CurrentCycle = 0;                                 // Current cycle through weather file in NumSimYears repeats
     208             :         int WP_Type1 = 0;                                     // WeatherProperties SkyTemperature Pointer
     209             :         SkyTempModel skyTempModel = SkyTempModel::ClarkAllen; // WeatherProperties SkyTemperature CalculationType
     210             :         bool UseWeatherFileHorizontalIR = true;               // If false, horizontal IR and sky temperature are calculated with WP models
     211             :         int CurrentYear = 0;                                  // Current year
     212             :         bool IsLeapYear = false;                              // True if current year is leap year.
     213             :         bool RollDayTypeOnRepeat = true;                      // If repeating run period, increment day type on repeat.
     214             :         bool TreatYearsAsConsecutive = true;                  // When year rolls over, increment year and recalculate Leap Year
     215             :         bool MatchYear = false;                               // for actual weather will be true
     216             :         bool ActualWeather = false;                           // true when using actual weather data
     217             :         int RawSimDays = 0;                                   // number of basic sim days.
     218             :         bool firstHrInterpUseHr1 = false;                     // true when using Hour 1 for first hour interpolations; false to use Hour 24
     219             : 
     220             :         Real64 maxCoolingOATSizing = -1000.0;  // max outdoor dry-bulb for DesignDay or RunPeriodDesign type weather
     221             :         Real64 maxCoolingOADPSizing = -1000.0; // outdoor dew point at max outdoor dry-bulb for DesignDay or RunPeriodDesign type weather
     222             :         Real64 minHeatingOATSizing = 1000.0;   // min outdoor dry-bulb for DesignDay or RunPeriodDesign type weather
     223             :         Real64 minHeatingOADPSizing = 1000.0;  // outdoor dew point at min outdoor dry-bulb for DesignDay or RunPeriodDesign type weather
     224             :     };
     225             : 
     226             :     struct DesignDayData
     227             :     {
     228             :         // Members
     229             :         std::string Title = "";                                          // Environment name
     230             :         Real64 MaxDryBulb = 0.0;                                         // Maximum Dry-Bulb Temperature (C)
     231             :         Real64 DailyDBRange = 0.0;                                       // Daily Temperature Range (deltaC)
     232             :         Real64 HumIndValue = 0.0;                                        // Humidity Indicating Value at Max Dry-bulb Temperature
     233             :         DesDayHumIndType HumIndType = DesDayHumIndType::WetBulb;         // Humidity Indicating type  (see Parameters)
     234             :         Real64 PressBarom = 0.0;                                         // Atmospheric/Barometric Pressure (Pascals)
     235             :         Real64 WindSpeed = 0.0;                                          // Wind Speed (m/s)
     236             :         Real64 WindDir = 0.0;                                            // Wind Direction (degrees clockwise from North, N=0, E=90, S=180, W=270)
     237             :         Real64 SkyClear = 0.0;                                           // Sky Clearness (0 to 1)
     238             :         int RainInd = 0;                                                 // Rain Indicator (1 = raining and surfaces are wet, else 0)
     239             :         int SnowInd = 0;                                                 // Snow Indicator (1 = snow on ground, else  0)
     240             :         int DayOfMonth = 0;                                              // Day of Month ( 1 - 31 )
     241             :         int Month = 0;                                                   // Month of Year ( 1 - 12 )
     242             :         int DayType = 0;                                                 // Day Type Sunday = 1 - Saturday = 7
     243             :         int DSTIndicator = 0;                                            // Daylight Saving Time Period Indicator (1=yes, 0=no) for this DesignDay
     244             :         DesDaySolarModel solarModel = DesDaySolarModel::ASHRAE_ClearSky; // Solar Model for creating solar values for design day.
     245             :         DesDayDryBulbRangeType dryBulbRangeType = DesDayDryBulbRangeType::Default; // Drybulb Range Type (see Parameters)
     246             :         int TempRangeSchPtr = 0; // Schedule pointer to a day schedule for dry-bulb temperature range multipliers
     247             :         int HumIndSchPtr = 0;    // Schedule pointer to a day schedule that specifies
     248             :         //    relative humidity (%) or wet-bulb range multipliers per HumIndType
     249             :         int BeamSolarSchPtr = 0;          // Schedule pointer to a day schedule for beam solar
     250             :         int DiffuseSolarSchPtr = 0;       // Schedule pointer to a day schedule for diffuse solar
     251             :         Real64 TauB = 0.0;                // beam pseudo optical depth for ASHRAE tau model
     252             :         Real64 TauD = 0.0;                // diffuse pseudo optical depth for ASHRAE tau model
     253             :         Real64 DailyWBRange = 0.0;        // daily range of wetbulb (deltaC)
     254             :         bool PressureEntered = false;     // true if a pressure was entered in design day data
     255             :         bool DewPointNeedsSet = false;    // true if the Dewpoint humidicating value needs to be set (after location determined)
     256             :         int maxWarmupDays = -1;           // Maximum warmup days between sizing periods
     257             :         bool suppressBegEnvReset = false; // true if this design day should be run without thermal history being reset at begin environment
     258             :     };
     259             : 
     260             :     struct ReportPeriodData
     261             :     {
     262             :         std::string title = "";
     263             :         std::string reportName = "";
     264             :         int startYear = 2017;
     265             :         int startMonth = 1;
     266             :         int startDay = 1;
     267             :         int startHour = 1;
     268             :         int startJulianDate = 2457755;
     269             :         int endYear = 2017;
     270             :         int endMonth = 12;
     271             :         int endDay = 31;
     272             :         int endHour = 24;
     273             :         int endJulianDate = 2458119;
     274             :         Real64 totalElectricityUse = 0.0; // What is this doing here?
     275             :     };
     276             : 
     277             :     struct RunPeriodData
     278             :     {
     279             :         // Members
     280             :         std::string title;
     281             :         std::string periodType;
     282             :         int totalDays = 365; // total number of days in requested period
     283             :         int startMonth = 1;
     284             :         int startDay = 1;
     285             :         int startJulianDate = 2457755; // Calculated start date (Julian or ordinal) for a weather file run period
     286             :         int startYear = 2017;          // entered in "consecutive"/real runperiod object
     287             :         int endMonth = 12;
     288             :         int endDay = 31;
     289             :         int endJulianDate = 2458119; // Calculated end date (Julian or ordinal) for a weather file run period
     290             :         int endYear = 2017;          // entered in "consecutive"/real runperiod object
     291             :         int dayOfWeek = 1;           // Day of Week that the RunPeriod will start on (User Input)
     292             :         ScheduleManager::DayType startWeekDay = ScheduleManager::DayType::Sunday; // Day of the week that the RunPeriod will start on (User Input)
     293             :         bool useDST = false;                                                      // True if DaylightSavingTime is used for this RunPeriod
     294             :         bool useHolidays = false;                                                 // True if Holidays are used for this RunPeriod (from WeatherFile)
     295             :         bool applyWeekendRule = false;                                            // True if "Weekend Rule" is to be applied to RunPeriod
     296             :         bool useRain = true;                                                      // True if Rain from weather file should be used (set rain to true)
     297             :         bool useSnow = true;                                                      // True if Snow from weather file should be used (set Snow to true)
     298             :         Array1D_int monWeekDay = {1, 4, 4, 7, 2, 5, 7, 3, 6, 1, 4, 6};            // Weekday for first day of each month
     299             :         int numSimYears = 1;                                                      // Total Number of years of simulation to be performed
     300             :         bool isLeapYear = false;                                                  // True if Begin Year is leap year.
     301             :         bool RollDayTypeOnRepeat = true;                                          // If repeating run period, increment day type on repeat.
     302             :         bool TreatYearsAsConsecutive = true;                                      // When year rolls over, increment year and recalculate Leap Year
     303             :         bool actualWeather = false;                                               // true when using actual weather data
     304             :         bool firstHrInterpUsingHr1 = false; // true for using Hour 1 for first hour interpolate; false for using Hour 24
     305             :     };
     306             : 
     307             :     struct DayWeatherVariables // Derived Type for Storing Weather "Header" Data
     308             :     {
     309             :         // Members
     310             :         int DayOfYear = 0;                // Day of year for weather data
     311             :         int DayOfYear_Schedule = 0;       // Day of year in schedule
     312             :         int Year = 0;                     // Year of weather data
     313             :         int Month = 0;                    // Month of weather data
     314             :         int DayOfMonth = 0;               // Day of month for weather data
     315             :         int DayOfWeek = 0;                // Day of week for weather data
     316             :         int DaylightSavingIndex = 0;      // Daylight Saving Time Period indicator (0=no,1=yes)
     317             :         int HolidayIndex = 0;             // Holiday indicator (0=no holiday, non-zero=holiday type)
     318             :         Real64 SinSolarDeclinAngle = 0.0; // Sine of the solar declination angle
     319             :         Real64 CosSolarDeclinAngle = 0.0; // Cosine of the solar declination angle
     320             :         Real64 EquationOfTime = 0.0;      // Value of the equation of time formula
     321             :     };
     322             : 
     323             :     struct SpecialDayData
     324             :     {
     325             :         // Members
     326             :         std::string Name = "";                 // Name
     327             :         DateType dateType = DateType::Invalid; // Date type as read in from IDF
     328             :         int Month = 0;                         // Start Month
     329             :         int Day = 0;                           // Start Day of month or Count for DateTypes=NthDayOfMonth
     330             :         int WeekDay = 0;                       // For Date types=NthDayOfMonth and LastDayOfMonth
     331             :         int CompDate = 0;                      // Start Date in "compressed date" format, only if Month/Day
     332             :         bool WthrFile = false;                 // True if this Special Day came from weather file (EPW)
     333             :         int Duration = 0;                      // Number of days this special Day is used for
     334             :         int DayType = 0;                       // Day Type desigation for this Special Day period
     335             :         int ActStMon = 0;
     336             :         int ActStDay = 0;
     337             :         bool Used = false; // Set to true in a run period after use (NthDayOfMonth and LastDayOfMonth only)
     338             :     };
     339             : 
     340             :     struct DataPeriodData
     341             :     {
     342             :         // Members
     343             :         std::string Name = "";      // DataPeriod Title
     344             :         std::string DayOfWeek = ""; // Start Day of Week for DataPeriod
     345             :         int NumYearsData = 1;       // Number of years for which data is present in EPW.
     346             :         int WeekDay = 0;
     347             :         int StMon = 0;
     348             :         int StDay = 0;
     349             :         int StYear = 0;
     350             :         int EnMon = 0;
     351             :         int EnDay = 0;
     352             :         int EnYear = 0;
     353             :         int NumDays = 0;
     354         788 :         Array1D_int MonWeekDay = Array1D_int(12, 0);
     355             :         int DataStJDay = 0;
     356             :         int DataEnJDay = 0;
     357             :         bool HasYearData = false;
     358             :     };
     359             : 
     360             :     struct DSTPeriod
     361             :     {
     362             :         // Members
     363             :         DateType StDateType = DateType::Invalid; // Start Date type as from EPW or IDF
     364             :         int StWeekDay = 0;                       // For DateTypes=NthDayOfMonth or LastDayOfMonth
     365             :         int StMon = 0;                           // DaylightSavingTime (DST) Start Month
     366             :         int StDay = 0;                           // DaylightSavingTime (DST) Start Day
     367             :         DateType EnDateType = DateType::Invalid; // End Date type as from EPW or IDF
     368             :         int EnMon = 0;                           // DaylightSavingTime (DST) End Month
     369             :         int EnDay = 0;                           // DaylightSavingTime (DST) End Day
     370             :         int EnWeekDay = 0;                       // For DateTypes=NthDayOfMonth or LastDayOfMonth
     371             :     };
     372             : 
     373             :     // This Derived type carries the counts of missing data items in the weather reading process. It will count only items that are on the source file
     374             :     // -- not those that are derived from data on the source file.
     375             :     struct WeatherVarCounts
     376             :     {
     377             :         // Members
     378             :         // Comments below illustrate the data that is being counted:
     379             :         int OutDryBulbTemp = 0;  // Dry Bulb Temperature (C)
     380             :         int OutDewPointTemp = 0; // Dew Point Temperature (C)
     381             :         int OutRelHum = 0;       // Relative Humidity (%)
     382             :         int OutBaroPress = 0;    // Atmospheric Pressure (Pa)
     383             :         int WindDir = 0;         // Wind Direction (deg)
     384             :         int WindSpeed = 0;       // Wind Speed/Velocity (m/s)
     385             :         int BeamSolarRad = 0;    // Direct Radiation (wh/m2)
     386             :         int DifSolarRad = 0;     // Diffuse Radiation (wh/m2)
     387             :         int TotalSkyCover = 0;   // Total Sky Cover (tenths)
     388             :         int OpaqueSkyCover = 0;  // Opaque Sky Cover (tenths)
     389             :         int Visibility = 0;      // Visibility (km)
     390             :         int Ceiling = 0;         // Ceiling Height (m)
     391             :         int LiquidPrecip = 0;    // Precipitable Water (mm)
     392             :         int WaterPrecip = 0;     // Precipitable Water (mm)
     393             :         int AerOptDepth = 0;     // Aerosol Optical Depth
     394             :         int SnowDepth = 0;       // Snow Depth (cm)
     395             :         int DaysLastSnow = 0;    // Number of Days since last snow
     396             :         int WeathCodes = 0;      // Weather codes invalid
     397             :         int Albedo = 0;          // Albedo
     398             :     };
     399             : 
     400             :     struct TypicalExtremeData
     401             :     {
     402             :         // Members
     403             :         std::string Title = "";       // Environment name
     404             :         std::string ShortTitle = "";  // Environment name
     405             :         std::string MatchValue = "";  // String to be matched for input/running these periods for design.
     406             :         std::string MatchValue1 = ""; // String to be also matched (synonym)
     407             :         std::string MatchValue2 = ""; // String to be also matched (synonym)
     408             :         std::string TEType = "";      // Typical or Extreme
     409             :         int TotalDays = 0;            // Number of days in environment
     410             :         int StartJDay = 0;            // Day of year of first day of environment
     411             :         int StartMonth = 0;
     412             :         int StartDay = 0;
     413             :         int EndMonth = 0;
     414             :         int EndDay = 0;
     415             :         int EndJDay = 0;
     416             :     };
     417             : 
     418             :     struct WeatherProperties
     419             :     {
     420             :         // Members
     421             :         std::string Name = "";         // Reference Name
     422             :         std::string ScheduleName = ""; // Schedule Name or Algorithm Name
     423             :         bool IsSchedule = true;        // Default is using Schedule
     424             :         SkyTempModel skyTempModel = SkyTempModel::ClarkAllen;
     425             :         int SchedulePtr = 0; // pointer to schedule when used
     426             :         bool UsedForEnvrn = false;
     427             :         bool UseWeatherFileHorizontalIR = true; // If false, horizontal IR and sky temperature are calculated with WP models
     428             :     };
     429             : 
     430             :     struct UnderwaterBoundary
     431             :     {
     432             :         std::string Name = "";
     433             :         Real64 distanceFromLeadingEdge = 0.0;
     434             :         int OSCMIndex = 0;
     435             :         int WaterTempScheduleIndex = 0;
     436             :         int VelocityScheduleIndex = 0;
     437             :     };
     438             : 
     439             :     // Functions
     440             :     void ManageWeather(EnergyPlusData &state);
     441             : 
     442             :     void ResetEnvironmentCounter(EnergyPlusData &state);
     443             : 
     444             :     bool GetNextEnvironment(EnergyPlusData &state, bool &Available, bool &ErrorsFound);
     445             : 
     446             :     void AddDesignSetToEnvironmentStruct(
     447             :         EnergyPlusData &state, int HVACSizingIterCount // Counter for number of times HVAC Sizing Simulation of Design Period set is being rerun
     448             :     );
     449             : 
     450             :     bool CheckIfAnyUnderwaterBoundaries(EnergyPlusData &state);
     451             : 
     452             :     Real64 calculateWaterBoundaryConvectionCoefficient(Real64 curWaterTemp, Real64 curWaterVelocity, Real64 distanceFromLeadingEdge);
     453             : 
     454             :     void UpdateUnderwaterBoundaries(EnergyPlusData &state);
     455             : 
     456             :     void ReadVariableLocationOrientation(EnergyPlusData &state);
     457             : 
     458             :     void UpdateLocationAndOrientation(EnergyPlusData &state);
     459             : 
     460             :     void SetupWeekDaysByMonth(EnergyPlusData &state, int StMon, int StDay, int StWeekDay, Array1D_int &WeekDays);
     461             : 
     462             :     void ResetWeekDaysByMonth(EnergyPlusData &state,
     463             :                               Array1D_int &WeekDays,
     464             :                               int AddLeapYear,
     465             :                               int StartMonth,
     466             :                               int StartMonthDay,
     467             :                               int EndMonth,
     468             :                               int EndMonthDay,
     469             :                               bool Rollover,
     470             :                               bool MidSimReset = false);
     471             : 
     472             :     void SetDSTDateRanges(EnergyPlusData &state,
     473             :                           Array1D_int const &MonWeekDay, // Weekday of each day 1 of month
     474             :                           Array1D_int &DSTIdx,           // DST Index for each julian day (1:366)
     475             :                           ObjexxFCL::Optional_int DSTActStMon = _,
     476             :                           ObjexxFCL::Optional_int DSTActStDay = _,
     477             :                           ObjexxFCL::Optional_int DSTActEnMon = _,
     478             :                           ObjexxFCL::Optional_int DSTActEnDay = _);
     479             : 
     480             :     void SetSpecialDayDates(EnergyPlusData &state, Array1D_int const &MonWeekDay); // Weekday of each day 1 of month
     481             : 
     482             :     void InitializeWeather(EnergyPlusData &state, bool &printEnvrnStamp); // Set to true when the environment header should be printed
     483             : 
     484             :     void UpdateWeatherData(EnergyPlusData &state);
     485             : 
     486             :     void SetCurrentWeather(EnergyPlusData &state);
     487             : 
     488             :     void ReadWeatherForDay(EnergyPlusData &state,
     489             :                            int DayToRead,          // =1 when starting out, otherwise signifies next day
     490             :                            int Environ,            // Environment being simulated
     491             :                            bool BackSpaceAfterRead // True if weather file is to be backspaced after read
     492             :     );
     493             : 
     494             :     void ReadEPlusWeatherForDay(EnergyPlusData &state,
     495             :                                 int DayToRead,          // =1 when starting out, otherwise signifies next day
     496             :                                 int Environ,            // Environment being simulated
     497             :                                 bool BackSpaceAfterRead // True if weather file is to be backspaced after read
     498             :     );
     499             : 
     500             :     Real64 interpolateWindDirection(Real64 prevHrWindDir, Real64 curHrWindDir, Real64 curHrWeight);
     501             : 
     502             :     void SetDayOfWeekInitialValues(int EnvironDayOfWeek, // Starting Day of Week for the (Weather) RunPeriod (User Input)
     503             :                                    int &currentDayOfWeek // Current Day of Week
     504             :     );
     505             : 
     506             :     void ErrorInterpretWeatherDataLine(
     507             :         EnergyPlusData &state, int WYear, int WMonth, int WDay, int WHour, int WMinute, std::string_view SaveLine, std::string_view Line);
     508             : 
     509             :     void InterpretWeatherDataLine(EnergyPlusData &state,
     510             :                                   std::string_view Line,
     511             :                                   bool &ErrorFound, // True if an error is found, false otherwise
     512             :                                   int &WYear,
     513             :                                   int &WMonth,
     514             :                                   int &WDay,
     515             :                                   int &WHour,
     516             :                                   int &WMinute,
     517             :                                   Real64 &DryBulb,           // DryBulb
     518             :                                   Real64 &DewPoint,          // DewPoint
     519             :                                   Real64 &RelHum,            // RelHum
     520             :                                   Real64 &AtmPress,          // AtmPress
     521             :                                   Real64 &ETHoriz,           // ETHoriz
     522             :                                   Real64 &ETDirect,          // ETDirect
     523             :                                   Real64 &IRHoriz,           // IRHoriz
     524             :                                   Real64 &GLBHoriz,          // GLBHoriz
     525             :                                   Real64 &DirectRad,         // DirectRad
     526             :                                   Real64 &DiffuseRad,        // DiffuseRad
     527             :                                   Real64 &GLBHorizIllum,     // GLBHorizIllum
     528             :                                   Real64 &DirectNrmIllum,    // DirectNrmIllum
     529             :                                   Real64 &DiffuseHorizIllum, // DiffuseHorizIllum
     530             :                                   Real64 &ZenLum,            // ZenLum
     531             :                                   Real64 &WindDir,           // WindDir
     532             :                                   Real64 &WindSpeed,         // WindSpeed
     533             :                                   Real64 &TotalSkyCover,     // TotalSkyCover
     534             :                                   Real64 &OpaqueSkyCover,    // OpaqueSkyCover
     535             :                                   Real64 &Visibility,        // Visibility
     536             :                                   Real64 &CeilHeight,        // CeilHeight
     537             :                                   int &WObs,                 // PresWeathObs
     538             :                                   Array1D_int &WCodesArr,    // PresWeathConds
     539             :                                   Real64 &PrecipWater,       // PrecipWater
     540             :                                   Real64 &AerosolOptDepth,   // AerosolOptDepth
     541             :                                   Real64 &SnowDepth,         // SnowDepth
     542             :                                   Real64 &DaysSinceLastSnow, // DaysSinceLastSnow
     543             :                                   Real64 &Albedo,            // Albedo
     544             :                                   Real64 &LiquidPrecip       // LiquidPrecip
     545             :     );
     546             : 
     547             :     void SetUpDesignDay(EnergyPlusData &state, int EnvrnNum); // Environment number passed into the routine
     548             : 
     549             :     Real64 AirMass(Real64 CosZen); // COS( solar zenith), 0 - 1
     550             : 
     551             :     // Calculate sky temperature from weather data
     552             :     Real64 CalcSkyEmissivity(EnergyPlusData &state, SkyTempModel skyTempModel, Real64 OSky, Real64 DryBulb, Real64 DewPoint, Real64 RelHum);
     553             : 
     554             :     void ASHRAETauModel([[maybe_unused]] EnergyPlusData &state,
     555             :                         DesDaySolarModel TauModel, // ASHRAETau solar model type ASHRAE_Tau or ASHRAE_Tau2017
     556             :                         Real64 ETR,                // extraterrestrial normal irradiance, W/m2
     557             :                         Real64 CosZen,             // COS( solar zenith angle), 0 - 1
     558             :                         Real64 TauB,               // beam tau factor
     559             :                         Real64 TauD,               // dif tau factor
     560             :                         Real64 &IDirN,             // returned: direct (beam) irradiance on normal surface, W/m2
     561             :                         Real64 &IDifH,             // returned: diffuse irradiance on horiz surface, W/m2
     562             :                         Real64 &IGlbH              // returned: global irradiance on horiz surface, W/m2
     563             :     );
     564             : 
     565             :     void AllocateWeatherData(EnergyPlusData &state);
     566             : 
     567             :     void CalculateDailySolarCoeffs(EnergyPlusData &state,
     568             :                                    int DayOfYear,                 // Day of year (1 - 366)
     569             :                                    Real64 &A,                     // ASHRAE "A" - Apparent solar irradiation at air mass = 0 [W/M**2]
     570             :                                    Real64 &B,                     // ASHRAE "B" - Atmospheric extinction coefficient
     571             :                                    Real64 &C,                     // ASHRAE "C" - Diffuse radiation factor
     572             :                                    Real64 &AnnVarSolConstant,     // Annual variation in the solar constant
     573             :                                    Real64 &EquationOfTime,        // Equation of Time
     574             :                                    Real64 &SineSolarDeclination,  // Sine of Solar Declination
     575             :                                    Real64 &CosineSolarDeclination // Cosine of Solar Declination
     576             :     );
     577             : 
     578             :     void CalculateSunDirectionCosines(EnergyPlusData &state,
     579             :                                       Real64 TimeValue,    // Current Time of Day
     580             :                                       Real64 EqOfTime,     // Equation of Time
     581             :                                       Real64 SinSolDeclin, // Sine of Solar Declination
     582             :                                       Real64 CosSolDeclin, // Cosine of Solar Declination
     583             :                                       Vector3<Real64> &SUNCOS);
     584             : 
     585             :     void DetermineSunUpDown(EnergyPlusData &state, Vector3<Real64> &SUNCOS);
     586             : 
     587             :     void OpenWeatherFile(EnergyPlusData &state, bool &ErrorsFound);
     588             : 
     589             :     void OpenEPlusWeatherFile(EnergyPlusData &state,
     590             :                               bool &ErrorsFound, // Will be set to true if errors found
     591             :                               bool ProcessHeader // Set to true when headers should be processed (rather than just read)
     592             :     );
     593             : 
     594             :     void CloseWeatherFile(EnergyPlusData &state);
     595             : 
     596             :     void ResolveLocationInformation(EnergyPlusData &state, bool &ErrorsFound); // Set to true if no location evident
     597             : 
     598             :     void CheckLocationValidity(EnergyPlusData &state);
     599             : 
     600             :     void CheckWeatherFileValidity(EnergyPlusData &state);
     601             : 
     602             :     void ReportOutputFileHeaders(EnergyPlusData &state);
     603             : 
     604             :     void ReportWeatherAndTimeInformation(EnergyPlusData &state,
     605             :                                          bool &printEnvrnStamp); // Set to true when the environment header should be printed
     606             : 
     607             :     void ReadUserWeatherInput(EnergyPlusData &state);
     608             : 
     609             :     void GroupReportPeriodByType(EnergyPlusData &state, const int nReportPeriods);
     610             : 
     611             :     void GetReportPeriodData(EnergyPlusData &state,
     612             :                              int nReportPeriods, // Total number of Report Periods requested
     613             :                              bool &ErrorsFound);
     614             : 
     615             :     void GetRunPeriodData(EnergyPlusData &state,
     616             :                           int nRunPeriods, // Total number of Run Periods requested
     617             :                           bool &ErrorsFound);
     618             : 
     619             :     void GetRunPeriodDesignData(EnergyPlusData &state, bool &ErrorsFound);
     620             : 
     621             :     void GetSpecialDayPeriodData(EnergyPlusData &state, bool &ErrorsFound); // will be set to true if severe errors are found in inputs
     622             : 
     623             :     void CalcSpecialDayTypes(EnergyPlusData &state);
     624             : 
     625             :     void GetDSTData(EnergyPlusData &state, bool &ErrorsFound); // will be set to true if severe errors are found in inputs
     626             : 
     627             :     void GetDesignDayData(EnergyPlusData &state,
     628             :                           int TotDesDays, // Total number of Design days to Setup
     629             :                           bool &ErrorsFound);
     630             : 
     631             :     void GetLocationInfo(EnergyPlusData &state, bool &ErrorsFound);
     632             : 
     633             :     void GetWeatherProperties(EnergyPlusData &state, bool &ErrorsFound);
     634             : 
     635             :     void GetGroundTemps(EnergyPlusData &state);
     636             : 
     637             :     void GetGroundReflectances(EnergyPlusData &state, bool &ErrorsFound);
     638             : 
     639             :     void GetSnowGroundRefModifiers(EnergyPlusData &state, bool &ErrorsFound);
     640             : 
     641             :     void GetWaterMainsTemperatures(EnergyPlusData &state, bool &ErrorsFound);
     642             : 
     643             :     void CalcWaterMainsTemp(EnergyPlusData &state);
     644             : 
     645             :     Real64 WaterMainsTempFromCorrelation(EnergyPlusData &state,
     646             :                                          Real64 AnnualOAAvgDryBulbTemp,        // annual average OA drybulb temperature
     647             :                                          Real64 MonthlyOAAvgDryBulbTempMaxDiff // monthly daily average OA drybulb temperature maximum difference
     648             :     );
     649             : 
     650             :     void GetWeatherStation(EnergyPlusData &state, bool &ErrorsFound);
     651             : 
     652             :     void DayltgCurrentExtHorizIllum(EnergyPlusData &state);
     653             : 
     654             :     void DayltgLuminousEfficacy(EnergyPlusData &state,
     655             :                                 Real64 &DiffLumEff, // Luminous efficacy of sky diffuse solar radiation (lum/W)
     656             :                                 Real64 &DirLumEff   // Luminous efficacy of beam solar radiation (lum/W)
     657             :     );
     658             : 
     659             :     Real64 GetSTM(Real64 Longitude); // Longitude from user input
     660             : 
     661             :     void ProcessEPWHeader(EnergyPlusData &state, EpwHeaderType const headerType, std::string &Line, bool &ErrorsFound);
     662             : 
     663             :     void SkipEPlusWFHeader(EnergyPlusData &state);
     664             : 
     665             :     void ReportMissing_RangeData(EnergyPlusData &state);
     666             : 
     667             :     void SetupInterpolationValues(EnergyPlusData &state);
     668             : 
     669             :     void SetupEnvironmentTypes(EnergyPlusData &state);
     670             : 
     671             :     bool isLeapYear(int Year);
     672             : 
     673             :     struct GregorianDate
     674             :     {
     675             :         int year = 0;
     676             :         int month = 0;
     677             :         int day = 0;
     678             :     };
     679             : 
     680             :     int computeJulianDate(int gyyyy, int gmm, int gdd);
     681             : 
     682             :     int computeJulianDate(GregorianDate const &gdate);
     683             : 
     684             :     GregorianDate computeGregorianDate(int jdate);
     685             : 
     686             :     ScheduleManager::DayType calculateDayOfWeek(EnergyPlusData &state, int year, int month, int day);
     687             : 
     688             :     int calculateDayOfYear(int Month, int Day, bool leapYear = false);
     689             : 
     690             :     bool validMonthDay(int month, int day, int leapYearAdd = 0);
     691             : 
     692             :     // derived type for processing and storing Dry-bulb weather or stat file
     693             :     struct AnnualMonthlyDryBulbWeatherData
     694             :     {
     695             :         // Members
     696             :         bool OADryBulbWeatherDataProcessed = false;  // if false stat or weather file OA Dry-bulb temp is not processed yet
     697             :         Real64 AnnualAvgOADryBulbTemp = 0.0;         // annual average outdoor air temperature (C)
     698             :         Real64 MonthlyAvgOADryBulbTempMaxDiff = 0.0; // monthly daily average OA drybulb temperature maximum difference (deltaC)
     699             :         Array1D<Real64> MonthlyDailyAverageDryBulbTemp = Array1D<Real64>(12, 0.0); // monthly-daily average outdoor air temperatures (C)
     700             : 
     701             :         void CalcAnnualAndMonthlyDryBulbTemp(EnergyPlusData &state); // true if this is CorrelationFromWeatherFile
     702             :     };
     703             : 
     704             :     void ReportWaterMainsTempParameters(EnergyPlusData &state);
     705             :     void calcSky(EnergyPlusData &state,
     706             :                  Real64 &TmrHorizIRSky,
     707             :                  Real64 &TmrSkyTemp,
     708             :                  Real64 OpaqueSkyCover,
     709             :                  Real64 DryBulb,
     710             :                  Real64 DewPoint,
     711             :                  Real64 RelHum,
     712             :                  Real64 IRHoriz);
     713             : 
     714             :     struct WeatherVars
     715             :     {
     716             :         bool IsRain = false;
     717             :         bool IsSnow = false;
     718             :         Real64 OutDryBulbTemp = 0.0;
     719             :         Real64 OutDewPointTemp = 0.0;
     720             :         Real64 OutBaroPress = 0.0;
     721             :         Real64 OutRelHum = 0.0;
     722             :         Real64 WindSpeed = 0.0;
     723             :         Real64 WindDir = 0.0;
     724             :         Real64 SkyTemp = 0.0;
     725             :         Real64 HorizIRSky = 0.0;
     726             :         Real64 BeamSolarRad = 0.0;
     727             :         Real64 DifSolarRad = 0.0;
     728             :         Real64 Albedo = 0.0;
     729             :         Real64 WaterPrecip = 0.0; // What is the difference between WaterPrecip and LiquidPrecip?
     730             :         Real64 LiquidPrecip = 0.0;
     731             :         Real64 TotalSkyCover = 0.0;
     732             :         Real64 OpaqueSkyCover = 0.0;
     733             :     };
     734             : 
     735             :     // This struct carries the default missing data for those data elements that would be best replaced with the previous hour's data for missing
     736             :     // data.
     737             :     struct ExtWeatherVars : public WeatherVars
     738             :     {
     739             :         // Members
     740             :         Real64 Visibility = 0.0;  // Visibility (km)
     741             :         Real64 Ceiling = 0.0;     // Ceiling Height (m)
     742             :         Real64 AerOptDepth = 0.0; // Aerosol Optical Depth
     743             :         Real64 SnowDepth = 0.0;   // Snow Depth (cm)
     744             :         int DaysLastSnow = 0;     // Number of Days since last snow
     745             :     };
     746             : 
     747             :     struct DesDayMods
     748             :     {
     749             :         Real64 OutDryBulbTemp = 0.0;
     750             :         Real64 OutRelHum = 0.0;
     751             :         Real64 BeamSolarRad = 0.0;
     752             :         Real64 DifSolarRad = 0.0;
     753             :         Real64 SkyTemp = 0.0;
     754             :     };
     755             : 
     756             :     struct SPSiteSchedules
     757             :     {
     758             :         Real64 OutDryBulbTemp = 0.0;
     759             :         Real64 OutRelHum = 0.0;
     760             :         Real64 BeamSolarRad = 0.0;
     761             :         Real64 DifSolarRad = 0.0;
     762             :         Real64 SkyTemp = 0.0;
     763             :     };
     764             : 
     765             :     // Here's a fun little function
     766             :     void ForAllHrTs(EnergyPlusData &state, std::function<void(int, int)> f);
     767             : } // namespace Weather
     768             : 
     769             : struct WeatherManagerData : BaseGlobalStruct
     770             : {
     771             : 
     772             :     // These were static variables within different functions. They were pulled out into the namespace
     773             :     // to facilitate easier unit testing of those functions.
     774             :     // These are purposefully not in the header file as an extern variable. No one outside of this should
     775             :     // use these. They are cleared by clear_state() for use by unit tests, but normal simulations should be unaffected.
     776             :     // This is purposefully in an anonymous namespace so nothing outside this implementation file can use it.
     777             :     bool GetBranchInputOneTimeFlag = true;
     778             :     bool GetEnvironmentFirstCall = true;
     779             :     bool PrntEnvHeaders = true;
     780             :     bool FirstCall = true;                 // Some things should only be done once
     781             :     bool WaterMainsParameterReport = true; // should only be done once
     782             :     bool PrintEnvrnStamp = false;          // Set to true when the environment header should be printed
     783             :     bool PrintDDHeader = true;
     784             : 
     785             :     int YearOfSim = 1;                           // The Present year of Simulation.
     786             :     int NumDaysInYear = 365;                     // TODO: removed const from this until leap year behavior is reviewed
     787             :     int EnvironmentReportNbr = 0;                // Report number for the environment stamp
     788             :     std::string EnvironmentReportChr = "";       // Report number for the environment stamp (character -- for printing)
     789             :     bool WeatherFileExists = false;              // Set to true if a weather file exists
     790             :     std::string LocationTitle = "";              // Location Title from input File
     791             :     bool LocationGathered = false;               // flag to show if Location exists on Input File (we assume one is there and correct on weather file)
     792             :     bool keepUserSiteLocationDefinition = false; // flag based on user input to set whether to keep the user site location definition (true)
     793             :                                                  // or override with the site information given on weather file (false/default)
     794             : 
     795             :     Real64 WeatherFileLatitude = 0.0;
     796             :     Real64 WeatherFileLongitude = 0.0;
     797             :     Real64 WeatherFileTimeZone = 0.0;
     798             :     Real64 WeatherFileElevation = 0.0;
     799             :     Array1D<Real64> GroundTempsFCFromEPWHeader = Array1D<Real64>(12, 0.0); // F or C factor method NOLINT(cert-err58-cpp)
     800             :     Array1D<Real64> GroundReflectances =
     801             :         Array1D<Real64>(12, 0.2);             // User Specified Ground Reflectances !EPTeam: Using DP causes big diffs NOLINT(cert-err58-cpp)
     802             :     Real64 SnowGndRefModifier = 1.0;          // Modifier to ground reflectance during snow
     803             :     Real64 SnowGndRefModifierForDayltg = 1.0; // Modifier to ground reflectance during snow for daylighting
     804             :     Weather::WaterMainsTempCalcMethod WaterMainsTempsMethod =
     805             :         Weather::WaterMainsTempCalcMethod::FixedDefault; // Water mains temperature calculation method
     806             :     int WaterMainsTempsSchedule = 0;                     // Water mains temperature schedule
     807             :     Real64 WaterMainsTempsAnnualAvgAirTemp = 0.0;        // Annual average outdoor air temperature (C)
     808             :     Real64 WaterMainsTempsMaxDiffAirTemp = 0.0;          // Maximum difference in monthly average outdoor air temperatures (deltaC)
     809             :     std::string WaterMainsTempsScheduleName = "";        // water mains tempeature schedule name
     810             :     bool wthFCGroundTemps = false;
     811             : 
     812             :     int TotRunPers = 0;           // Total number of Run Periods (Weather data) to Setup
     813             :     int TotRunDesPers = 0;        // Total number of Run Design Periods (Weather data) to Setup
     814             :     int TotReportPers = 0;        // Total number of reporting periods
     815             :     int TotThermalReportPers = 0; // Total number of thermal reporting periods
     816             :     int TotCO2ReportPers = 0;     // Total number of CO2 reporting periods
     817             :     int TotVisualReportPers = 0;  // Total number of visual reporting periods
     818             : 
     819             :     int NumSpecialDays = 0;
     820             :     Array1D_int SpecialDayTypes = Array1D<int>(366, 0); // To hold holiday types given in input file NOLINT(cert-err58-cpp)
     821             :     Array1D_int WeekDayTypes = Array1D<int>(366, 0);    // To hold Week day types using specified first day NOLINT(cert-err58-cpp)
     822             :     Array1D_int DSTIndex = Array1D<int>(366, 0);        // To hold DST Index based on weather file or input NOLINT(cert-err58-cpp)
     823             : 
     824             :     int NumDataPeriods = 0;
     825             : 
     826             :     int NumIntervalsPerHour = 1;
     827             : 
     828             :     bool UseDaylightSaving = true;       // True if user says to use Weather File specified DaylightSaving Period
     829             :     bool UseSpecialDays = true;          // True if user says to use Weather File specified Special Days for current RunPeriod
     830             :     bool UseRainValues = true;           // True if rain values from weather file are to be used
     831             :     bool UseSnowValues = true;           // True if snow values from weather file are to be used
     832             :     bool EPWDaylightSaving = false;      // True if a DaylightSaving Time Period is input (EPW files)
     833             :     bool IDFDaylightSaving = false;      // True if a DaylightSaving Time Period is input (IDF files)
     834             :     bool DaylightSavingIsActive = false; // True if a DaylightSavingPeriod should be used for Environment
     835             :     bool WFAllowsLeapYears = false;      // True if the Weather File (WF) header has "Yes" for Leap Years
     836             :     int curSimDayForEndOfRunPeriod = 0;  // normal=number days in sim, but different when repeating runperiods or multi-year files
     837             :     int Envrn = 0;                       // Counter for environments
     838             :     int NumOfEnvrn = 0;                  // Number of environments to be simulated
     839             :     int NumEPWTypExtSets = 0;            // Number of Typical/Extreme on weather file.
     840             :     int NumWPSkyTemperatures = 0;        // Number of WeatherProperty:SkyTemperature items in input file
     841             : 
     842             :     Array2D<Weather::WeatherVars> wvarsHrTsToday;
     843             :     Array2D<Weather::WeatherVars> wvarsHrTsTomorrow;
     844             : 
     845             :     EPVector<Array2D<Weather::DesDayMods>> desDayMods;
     846             : 
     847             :     int RptIsRain = 0;  // Rain Report Value
     848             :     int RptIsSnow = 0;  // Snow Report Value
     849             :     int RptDayType = 0; // DayType Report Value
     850             : 
     851             :     Real64 HrAngle = 0.0;            // Current Hour Angle
     852             :     Real64 SolarAltitudeAngle = 0.0; // Angle of Solar Altitude (degrees)
     853             :     Real64 SolarAzimuthAngle = 0.0;  // Angle of Solar Azimuth (degrees)
     854             :     Real64 HorizIRSky = 0.0;         // Horizontal Infrared Radiation Intensity (W/m2)
     855             :     Real64 TimeStepFraction = 0.0;   // Fraction of hour each time step represents
     856             : 
     857             :     EPVector<Weather::SPSiteSchedules> spSiteSchedules;
     858             :     std::vector<int> spSiteSchedNums;
     859             : 
     860             :     // Number of hours of missing data
     861             :     Array1D<Real64> Interpolation;      // Interpolation values based on Number of Time Steps in Hour NOLINT(cert-err58-cpp)
     862             :     Array1D<Real64> SolarInterpolation; // Solar Interpolation values based on Number of Time Steps in Hour NOLINT(cert-err58-cpp)
     863             :     Array1D_int EndDayOfMonth = Array1D_int(12, {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}); // NOLINT(cert-err58-cpp)
     864             :     Array1D_int EndDayOfMonthWithLeapDay =
     865             :         Array1D_int(12, {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}); // end day of the month including Feb 29 for leap years instead of Feb 28
     866             :     int LeapYearAdd = 0;                       // Set during environment if leap year is active (adds 1 to number days in Feb)
     867             :     bool DatesShouldBeReset = false;           // True when weekdays should be reset
     868             :     bool StartDatesCycleShouldBeReset = false; // True when start dates on repeat should be reset
     869             :     bool Jan1DatesShouldBeReset = false;       // True if Jan 1 should signal reset of dates
     870             :     bool RPReadAllWeatherData = false;         // True if need to read all weather data prior to simulation
     871             : 
     872             :     // Object Data
     873             :     // NOLINTNEXTLINE(cert-err58-cpp)
     874             :     Weather::DayWeatherVariables TodayVariables; // Today's daily weather variables | Derived Type for Storing Weather "Header" Data | Day of year for
     875             :                                                  // weather data | Year of weather data | Month of weather data | Day of month for weather data | Day
     876             :                                                  // of week for weather data | Daylight Saving Time Period indicator (0=no,1=yes) | Holiday indicator
     877             :                                                  // (0=no holiday, non-zero=holiday type) | Sine of the solar declination angle | Cosine of the solar
     878             :                                                  // declination angle | Value of the equation of time formula
     879             :     // NOLINTNEXTLINE(cert-err58-cpp)
     880             :     Weather::DayWeatherVariables TomorrowVariables; // Tomorrow's daily weather variables | Derived Type for Storing Weather "Header" Data | Day of
     881             :                                                     // year for weather data | Year of weather data | Month of weather data | Day of month for weather
     882             :                                                     // data | Day of week for weather data | Daylight Saving Time Period indicator (0=no,1=yes) |
     883             :                                                     // Holiday indicator (0=no holiday, non-zero=holiday type) | Sine of the solar declination angle |
     884             :                                                     // Cosine of the solar declination angle | Value of the equation of time formula
     885             :     // NOLINTNEXTLINE(cert-err58-cpp)
     886             :     EPVector<Weather::DayWeatherVariables> DesignDay; // Design day environments
     887             :     // NOLINTNEXTLINE(cert-err58-cpp)
     888             :     Weather::ExtWeatherVars wvarsMissing; // Dry Bulb Temperature (C) | Dew Point Temperature (C) | Relative Humidity (%) | Atmospheric Pressure (Pa)
     889             :                                           // | Wind Direction (deg) | Wind Speed/Velocity (m/s) | Total Sky Cover (tenths) | Opaque Sky Cover (tenths)
     890             :                                           // | Visibility (km) | Ceiling Height (m) | Precipitable Water (mm) | Aerosol Optical Depth | Snow Depth
     891             :                                           // (cm) | Number of Days since last snow | Albedo | Rain/Liquid Precipitation (mm)
     892             :     Weather::WeatherVarCounts wvarsMissedCounts;           // NOLINT(cert-err58-cpp)
     893             :     Weather::WeatherVarCounts wvarsOutOfRangeCounts;       // NOLINT(cert-err58-cpp)
     894             :     EPVector<Weather::DesignDayData> DesDayInput;          // Design day Input Data NOLINT(cert-err58-cpp)
     895             :     Array1D<Weather::EnvironmentData> Environment;         // Environment data NOLINT(cert-err58-cpp)
     896             :     Array1D<Weather::RunPeriodData> RunPeriodInput;        // NOLINT(cert-err58-cpp)
     897             :     EPVector<Weather::RunPeriodData> RunPeriodDesignInput; // NOLINT(cert-err58-cpp)
     898             :     Array1D<Weather::ReportPeriodData> ReportPeriodInput;
     899             :     Array1D<Weather::ReportPeriodData> ThermalReportPeriodInput;
     900             :     Array1D<Weather::ReportPeriodData> CO2ReportPeriodInput;
     901             :     Array1D<Weather::ReportPeriodData> VisualReportPeriodInput;
     902             :     EPVector<Weather::TypicalExtremeData> TypicalExtremePeriods; // NOLINT(cert-err58-cpp)
     903             :     Weather::DSTPeriod EPWDST;                                   // Daylight Saving Period Data from EPW file NOLINT(cert-err58-cpp)
     904             :     Weather::DSTPeriod IDFDST;                                   // Daylight Saving Period Data from IDF file NOLINT(cert-err58-cpp)
     905             :     Weather::DSTPeriod DST;                                      // Daylight Saving Period Data, if active NOLINT(cert-err58-cpp)
     906             :     EPVector<Weather::WeatherProperties> WPSkyTemperature;       // NOLINT(cert-err58-cpp)
     907             :     EPVector<Weather::SpecialDayData> SpecialDays;               // NOLINT(cert-err58-cpp)
     908             :     EPVector<Weather::DataPeriodData> DataPeriods;               // NOLINT(cert-err58-cpp)
     909             : 
     910             :     std::shared_ptr<BaseGroundTempsModel> siteShallowGroundTempsPtr;
     911             :     std::shared_ptr<BaseGroundTempsModel> siteBuildingSurfaceGroundTempsPtr;
     912             :     std::shared_ptr<BaseGroundTempsModel> siteFCFactorMethodGroundTempsPtr;
     913             :     std::shared_ptr<BaseGroundTempsModel> siteDeepGroundTempsPtr;
     914             : 
     915             :     std::vector<Weather::UnderwaterBoundary> underwaterBoundaries;
     916             :     Weather::AnnualMonthlyDryBulbWeatherData OADryBulbAverage; // processes outside air drybulb temperature
     917             : 
     918             :     // SetCurrentWeather static vars
     919             :     int NextHour = 1;
     920             : 
     921             :     // ReadEPlusWeatherForDay static vars
     922             :     int CurDayOfWeek = 1;
     923             :     Real64 ReadEPlusWeatherCurTime = 1.0;
     924             :     bool LastHourSet = false;
     925             : 
     926             :     Weather::WeatherVars wvarsLastHr;
     927             :     Weather::WeatherVars wvarsNextHr;
     928             : 
     929             :     Real64 IsRainThreshold = 0.8; // precipitation threshold (mm) for timestep IsRain (divided later by NumOfTimeStepInHour)
     930             : 
     931             :     // ProcessEPWHeader static vars
     932             :     std::string EPWHeaderTitle = "";
     933             : 
     934         796 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     935             :     {
     936         796 :     }
     937             : 
     938           0 :     void clear_state() override
     939             :     {
     940           0 :         this->siteShallowGroundTempsPtr.reset();
     941           0 :         this->siteBuildingSurfaceGroundTempsPtr.reset();
     942           0 :         this->siteFCFactorMethodGroundTempsPtr.reset();
     943           0 :         this->siteDeepGroundTempsPtr.reset();
     944             : 
     945           0 :         new (this) WeatherManagerData();
     946           0 :     }
     947             : };
     948             : } // namespace EnergyPlus
     949             : 
     950             : #endif

Generated by: LCOV version 1.14