LCOV - code coverage report
Current view: top level - EnergyPlus - WeatherManager.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 8 8
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 3 3

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

Generated by: LCOV version 2.0-1