LCOV - code coverage report
Current view: top level - EnergyPlus - ScheduleManager.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 87.3 % 63 55
Test Date: 2025-06-02 12:03:30 Functions: 81.8 % 22 18

            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 ScheduleManager_hh_INCLUDED
      49              : #define ScheduleManager_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array1D.hh>
      53              : #include <ObjexxFCL/Array1S.hh>
      54              : 
      55              : // EnergyPlus Headers
      56              : #include <EnergyPlus/Data/BaseData.hh>
      57              : #include <EnergyPlus/DataGlobals.hh>
      58              : #include <EnergyPlus/EnergyPlus.hh>
      59              : #include <EnergyPlus/UtilityRoutines.hh>
      60              : 
      61              : namespace EnergyPlus {
      62              : 
      63              : // Forward declarations
      64              : struct EnergyPlusData;
      65              : 
      66              : namespace Sched {
      67              : 
      68              :     constexpr int SchedNum_Invalid = -1;
      69              :     constexpr int SchedNum_AlwaysOff = 0;
      70              :     constexpr int SchedNum_AlwaysOn = 1;
      71              : 
      72              :     enum class DayType
      73              :     {
      74              :         Invalid = -1,
      75              :         Unused, // This is annoying.  Will get rid of it later
      76              :         Sunday,
      77              :         Monday,
      78              :         Tuesday,
      79              :         Wednesday,
      80              :         Thursday,
      81              :         Friday,
      82              :         Saturday,
      83              :         Holiday,
      84              :         SummerDesignDay,
      85              :         WinterDesignDay,
      86              :         CustomDay1,
      87              :         CustomDay2,
      88              :         Num
      89              :     };
      90              : 
      91              :     constexpr int iDayType_Sun = (int)DayType::Sunday;
      92              :     constexpr int iDayType_Mon = (int)DayType::Monday;
      93              :     constexpr int iDayType_Tue = (int)DayType::Tuesday;
      94              :     constexpr int iDayType_Wed = (int)DayType::Wednesday;
      95              :     constexpr int iDayType_Thu = (int)DayType::Thursday;
      96              :     constexpr int iDayType_Fri = (int)DayType::Friday;
      97              :     constexpr int iDayType_Sat = (int)DayType::Saturday;
      98              :     constexpr int iDayType_Hol = (int)DayType::Holiday;
      99              :     constexpr int iDayType_SumDes = (int)DayType::SummerDesignDay;
     100              :     constexpr int iDayType_WinDes = (int)DayType::WinterDesignDay;
     101              :     constexpr int iDayType_Cus1 = (int)DayType::CustomDay1;
     102              :     constexpr int iDayType_Cus2 = (int)DayType::CustomDay2;
     103              : 
     104              :     extern const std::array<std::string_view, (int)DayType::Num> dayTypeNames;
     105              :     extern const std::array<std::string_view, (int)DayType::Num> dayTypeNamesUC;
     106              : 
     107              :     enum class DayTypeGroup
     108              :     {
     109              :         Invalid = -1,
     110              :         Weekday,
     111              :         WeekEndHoliday,
     112              :         SummerDesignDay,
     113              :         WinterDesignDay,
     114              :         Num
     115              :     };
     116              : 
     117              :     enum class SchedType
     118              :     {
     119              :         Invalid = -1,
     120              :         Year,
     121              :         Compact,
     122              :         File,
     123              :         Constant,
     124              :         External,
     125              :         Num
     126              :     };
     127              : 
     128              :     enum class ReportLevel
     129              :     {
     130              :         Invalid = -1,
     131              :         Hourly,
     132              :         TimeStep,
     133              :         Num
     134              :     };
     135              : 
     136              :     enum class Interpolation
     137              :     {
     138              :         Invalid = -1,
     139              :         No,      // no interpolation
     140              :         Average, // interpolation only to resolve time intervals not matching timestep lengths (this was previously interpolate:yes)
     141              :         Linear,  // linear interpolation from the previous time to the current time for the entire schedule
     142              :         Num
     143              :     };
     144              : 
     145              :     enum class LimitUnits
     146              :     {
     147              :         Invalid = -1,
     148              :         Dimensionless,
     149              :         Temperature,
     150              :         DeltaTemperature,
     151              :         PrecipitationRate,
     152              :         Angle,
     153              :         ConvectionCoefficient,
     154              :         ActivityLevel,
     155              :         Velocity,
     156              :         Capacity,
     157              :         Power,
     158              :         Availability,
     159              :         Percent,
     160              :         Control,
     161              :         Mode,
     162              :         Num
     163              :     };
     164              : 
     165              :     struct ScheduleType
     166              :     {
     167              :         // Members
     168              :         std::string Name;       // Schedule Type Name
     169              :         int Num;                // index in vector, useful sometimes
     170              :         bool isLimited = false; // True if this Schedule Type has limits
     171              :         Real64 minVal = 0.0;    // Minimum for limited schedule
     172              :         Real64 maxVal = 0.0;    // Maximum for limited schedule
     173              :         bool isReal = true;     // True if this is a "real" schedule, false if integer
     174              :         LimitUnits limitUnits = LimitUnits::Invalid;
     175              :     };
     176              : 
     177              :     struct ScheduleBase
     178              :     {
     179              :         std::string Name;
     180              :         int Num = SchedNum_Invalid;
     181              :         bool isUsed = false;
     182              : 
     183              :         Real64 maxVal = 0.0; // maximum of all TSValue's
     184              :         Real64 minVal = 0.0; // minimum of all TSValue's
     185              :         bool isMinMaxSet = false;
     186              : 
     187        15012 :         ScheduleBase() = default;
     188              : 
     189              :         virtual void can_instantiate() = 0; // abstract base class
     190              : 
     191              :         virtual void setMinMaxVals(EnergyPlusData &state) = 0;
     192              :         Real64 getMinVal(EnergyPlusData &state);
     193              :         Real64 getMaxVal(EnergyPlusData &state);
     194              : 
     195              :         bool checkMinMaxVals(EnergyPlusData &state, Clusive cluMin, Real64 const min, Clusive cluMax, Real64 const max);
     196              :         bool checkMinVal(EnergyPlusData &state, Clusive cluMin, Real64 const min);
     197              :         bool checkMaxVal(EnergyPlusData &state, Clusive cluMax, Real64 const max);
     198              :     };
     199              : 
     200              :     struct DayOrYearSchedule : ScheduleBase
     201              :     {
     202        10811 :         DayOrYearSchedule() = default;
     203        10683 :         virtual ~DayOrYearSchedule() = default;
     204              : 
     205              :         virtual std::vector<Real64> const &getDayVals([[maybe_unused]] EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1) = 0;
     206              :     };
     207              : 
     208              :     struct DaySchedule : DayOrYearSchedule
     209              :     {
     210              :         int schedTypeNum = SchedNum_Invalid; // Index of Schedule Type
     211              : 
     212              :         Interpolation interpolation = Interpolation::No; // Indicator for interval interpolation. If not "interpolated", False.  Else True
     213              :         std::vector<Real64> tsVals;                      // Value array by simulation timestep
     214              :         Real64 sumTsVals = 0.0;
     215              : 
     216         4733 :         DaySchedule() = default;
     217         9388 :         virtual ~DaySchedule() = default;
     218            0 :         void can_instantiate()
     219              :         {
     220            0 :             assert(false);
     221              :         } // makes class concrete, but don't call this
     222              : 
     223              :         bool checkValsForLimitViolations(EnergyPlusData &state) const;
     224              :         bool checkValsForBadIntegers(EnergyPlusData &state) const;
     225              :         void populateFromMinuteVals(EnergyPlusData &state, std::array<Real64, Constant::iMinutesInDay> const &minuteVals);
     226           48 :         std::vector<Real64> const &getDayVals([[maybe_unused]] EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1)
     227              :         {
     228           48 :             return tsVals;
     229              :         }
     230              :         void setMinMaxVals(EnergyPlusData &state);
     231              :     };
     232              : 
     233              :     struct WeekSchedule : public ScheduleBase
     234              :     {
     235              :         // Members
     236              :         std::array<DaySchedule *, (int)DayType::Num> dayScheds = {nullptr};
     237              : 
     238         4201 :         WeekSchedule() = default;
     239         8358 :         virtual ~WeekSchedule() = default;
     240            0 :         void can_instantiate()
     241              :         {
     242            0 :             assert(false);
     243              :         } // makes class concrete, but don't call this
     244              : 
     245              :         void setMinMaxVals(EnergyPlusData &state);
     246              :     };
     247              : 
     248              :     struct Schedule : public DayOrYearSchedule
     249              :     {
     250              :         SchedType type = SchedType::Invalid;
     251              : 
     252              :         int schedTypeNum = SchedNum_Invalid; // Index of Schedule Type
     253              :         bool EMSActuatedOn = false;          // indicates if EMS computed
     254              :         Real64 EMSVal = 0.0;                 // EMS value
     255              : 
     256              :         Real64 currentVal = 0.0;
     257              : 
     258         6078 :         Schedule()
     259         6078 :         {
     260         6078 :             type = SchedType::Constant;
     261         6078 :         }
     262              : 
     263         5989 :         virtual ~Schedule() = default;
     264              : 
     265      6402426 :         Real64 getCurrentVal() const
     266              :         {
     267      6402426 :             return EMSActuatedOn ? EMSVal : currentVal;
     268              :         }
     269              : 
     270              :         // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not
     271              :         // Negative ts => unspecified, will use TimeStepsInHour
     272              :         virtual Real64 getHrTsVal(EnergyPlusData &state, int hr, int ts = -1) const = 0;
     273              :         virtual bool hasVal(EnergyPlusData &state, Real64 const val) const = 0;
     274              :         virtual bool hasFractionalVal(EnergyPlusData &state) const = 0;
     275              : 
     276              :         virtual std::pair<Real64, Real64> getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days) = 0;
     277              : 
     278              :         Real64 getAverageWeeklyHoursFullLoad(EnergyPlusData &state, int const startDayOfWeek, bool const isLeapYear);
     279              :         virtual Real64 getAnnualHoursFullLoad(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear) = 0;
     280              :         virtual Real64 getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear) = 0;
     281              :         virtual std::tuple<Real64, int, std::string>
     282              :         getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay) = 0;
     283              :     };
     284              : 
     285              :     struct ScheduleConstant : public Schedule
     286              :     {
     287              :         std::vector<Real64> tsVals;
     288              : 
     289         4675 :         ScheduleConstant()
     290         4675 :         {
     291         4675 :             type = SchedType::Constant;
     292         4675 :         }
     293              : 
     294         9204 :         virtual ~ScheduleConstant() = default;
     295              : 
     296            0 :         void can_instantiate()
     297              :         {
     298            0 :             assert(false);
     299              :         } // makes class concrete, but don't call this
     300              : 
     301              :         // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not
     302              :         // Negative ts => unspecified, will use TimeStepsInHour
     303              :         Real64 getHrTsVal(EnergyPlusData &state, int hr, int ts = -1) const;
     304              : 
     305              :         std::vector<Real64> const &getDayVals(EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1);
     306              : 
     307              :         bool hasVal(EnergyPlusData &state, Real64 const val) const;
     308              :         bool hasFractionalVal(EnergyPlusData &state) const;
     309              : 
     310              :         void setMinMaxVals(EnergyPlusData &state);
     311              : 
     312              :         std::pair<Real64, Real64> getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days);
     313              : 
     314              :         Real64 getAnnualHoursFullLoad(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear);
     315              :         Real64 getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear);
     316              : 
     317              :         std::tuple<Real64, int, std::string>
     318              :         getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay);
     319              :     };
     320              : 
     321              :     struct ScheduleDetailed : public Schedule
     322              :     {
     323              :         // Members
     324              :         std::array<WeekSchedule *, 367> weekScheds = {nullptr};           // one created for each day of possible simulation
     325              :         std::array<bool, (int)DayType::Num> MaxMinByDayTypeSet = {false}; // minimum and maximum values by daytype have been stored
     326              :         std::array<Real64, (int)DayType::Num> MinByDayType = {0.0};       // minimum values by daytype for this schedule
     327              :         std::array<Real64, (int)DayType::Num> MaxByDayType = {0.0};       // maximum values by daytype for this schedule
     328              :         bool UseDaylightSaving = true; // Toggles between daylight saving option to be inclused as "No" or "Yes" (default)
     329              : 
     330         1403 :         ScheduleDetailed()
     331         1403 :         {
     332         1403 :             type = SchedType::Year;
     333         1403 :         }
     334              : 
     335         2774 :         virtual ~ScheduleDetailed() = default;
     336              : 
     337            0 :         void can_instantiate()
     338              :         {
     339            0 :             assert(false);
     340              :         } // makes class concrete, but don't call this
     341              : 
     342              :         std::vector<Real64> const &getDayVals(EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1);
     343              : 
     344              :         bool hasVal(EnergyPlusData &state, Real64 const val) const;
     345              :         bool hasFractionalVal(EnergyPlusData &state) const;
     346              : 
     347              :         void setMinMaxVals(EnergyPlusData &state);
     348              : 
     349              :         // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not
     350              :         // Negative ts => unspecified, will use TimeStepsInHour
     351              :         Real64 getHrTsVal(EnergyPlusData &state, int hr, int ts = -1) const;
     352              : 
     353              :         std::pair<Real64, Real64> getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days);
     354              : 
     355              :         Real64 getAnnualHoursFullLoad(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear);
     356              :         Real64 getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear);
     357              : 
     358              :         std::tuple<Real64, int, std::string>
     359              :         getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay);
     360              :     };
     361              : 
     362              :     // Functions
     363              :     ScheduleDetailed *AddScheduleDetailed(EnergyPlusData &state, std::string const &name);
     364              :     ScheduleConstant *AddScheduleConstant(EnergyPlusData &state, std::string const &name, Real64 value = 0.0);
     365              :     DaySchedule *AddDaySchedule(EnergyPlusData &state, std::string const &name);
     366              :     WeekSchedule *AddWeekSchedule(EnergyPlusData &state, std::string const &name);
     367              : 
     368              :     void ProcessScheduleInput(EnergyPlusData &state);
     369              : 
     370              :     void InitConstantScheduleData(EnergyPlusData &state);
     371              : 
     372              :     void ReportScheduleDetails(EnergyPlusData &state, ReportLevel const LevelOfDetail);
     373              : 
     374              :     // Returns the CurrentScheduleValue
     375              :     Real64 GetHrTsScheduleVal(EnergyPlusData &state, int const schedNum, int const hr, int const ts = -1);
     376              :     // Updates each schedule value to the current timestep
     377              : 
     378              :     // Uses EMS value if actuated, otherwise calls LookUpScheduleValue with ThisHour=DataGlobals::HourOfDay, ThisTimeStep=DataGlobals::TimeStep
     379              :     void UpdateScheduleVals(EnergyPlusData &state);
     380              : 
     381              :     int GetScheduleTypeNum(EnergyPlusData &state, std::string const &name);
     382              : 
     383              :     int GetDayScheduleNum(EnergyPlusData &state, std::string const &name);
     384              :     DaySchedule *GetDaySchedule(EnergyPlusData &state, std::string const &name);
     385              : 
     386              :     int GetWeekScheduleNum(EnergyPlusData &state, std::string const &name);
     387              :     WeekSchedule *GetWeekSchedule(EnergyPlusData &state, std::string const &name);
     388              : 
     389              :     int GetScheduleNum(EnergyPlusData &state, std::string const &name);
     390              :     Schedule *GetSchedule(EnergyPlusData &state, std::string const &name);
     391              :     Schedule *GetScheduleAlwaysOn(EnergyPlusData &state);
     392              :     Schedule *GetScheduleAlwaysOff(EnergyPlusData &state);
     393              : 
     394              :     void ExternalInterfaceSetSchedule(EnergyPlusData &state,
     395              :                                       int schedNum,
     396              :                                       Real64 val // The new value for the schedule
     397              :     );
     398              : 
     399              :     void ProcessIntervalFields(EnergyPlusData &state,
     400              :                                Array1S_string const Untils,
     401              :                                Array1S<Real64> const Numbers,
     402              :                                int const NumUntils,
     403              :                                int const NumNumbers,
     404              :                                std::array<Real64, Constant::iMinutesInDay> &minuteVals,
     405              :                                std::array<bool, Constant::iMinutesInDay> &setMinuteVals,
     406              :                                bool &ErrorsFound,
     407              :                                std::string const &DayScheduleName, // Name (used for errors)
     408              :                                std::string const &ErrContext,      // Context (used for errors)
     409              :                                Interpolation interpolation         // enumeration on how to interpolate values in schedule
     410              :     );
     411              : 
     412              :     void DecodeHHMMField(EnergyPlusData &state,
     413              :                          std::string const &FieldVal,        // Input field value
     414              :                          int &RetHH,                         // Returned "hour"
     415              :                          int &RetMM,                         // Returned "minute"
     416              :                          bool &ErrorsFound,                  // True if errors found in this field
     417              :                          std::string const &DayScheduleName, // originating day schedule name
     418              :                          std::string const &FullFieldValue,  // Full Input field value
     419              :                          Interpolation interpolation         // enumeration on how to interpolate values in schedule
     420              :     );
     421              : 
     422              :     bool isMinuteMultipleOfTimestep(int minute, int numMinutesPerTimestep);
     423              : 
     424              :     void ProcessForDayTypes(EnergyPlusData &state,
     425              :                             std::string const &ForDayField,                 // Field containing the "FOR:..."
     426              :                             std::array<bool, (int)DayType::Num> &theseDays, // Array to contain returned "true" days
     427              :                             std::array<bool, (int)DayType::Num> &allDays,   // Array of days already done
     428              :                             bool &ErrorsFound                               // Will be true if error found.
     429              :     );
     430              : 
     431              :     void ReportScheduleVals(EnergyPlusData &state);
     432              : 
     433              :     void ReportOrphanSchedules(EnergyPlusData &state);
     434              : 
     435              :     void ShowSevereBadMin(EnergyPlusData &state,
     436              :                           ErrorObjectHeader const &eoh,
     437              :                           std::string_view schedField,
     438              :                           std::string_view schedName,
     439              :                           Clusive cluMin,
     440              :                           Real64 min,
     441              :                           std::string_view msg = {});
     442              : 
     443              :     void ShowWarningBadMin(EnergyPlusData &state,
     444              :                            ErrorObjectHeader const &eoh,
     445              :                            std::string_view schedField,
     446              :                            std::string_view schedName,
     447              :                            Clusive cluMin,
     448              :                            Real64 min,
     449              :                            std::string_view msg = {});
     450              : 
     451              :     void ShowSevereBadMax(EnergyPlusData &state,
     452              :                           ErrorObjectHeader const &eoh,
     453              :                           std::string_view schedField,
     454              :                           std::string_view schedName,
     455              :                           Clusive cluMax,
     456              :                           Real64 max,
     457              :                           std::string_view msg = {});
     458              : 
     459              :     void ShowWarningBadMax(EnergyPlusData &state,
     460              :                            ErrorObjectHeader const &eoh,
     461              :                            std::string_view schedField,
     462              :                            std::string_view schedName,
     463              :                            Clusive cluMax,
     464              :                            Real64 max,
     465              :                            std::string_view msg = {});
     466              : 
     467              :     void ShowSevereBadMinMax(EnergyPlusData &state,
     468              :                              ErrorObjectHeader const &eoh,
     469              :                              std::string_view schedField,
     470              :                              std::string_view schedName,
     471              :                              Clusive cluMin,
     472              :                              Real64 min,
     473              :                              Clusive cluMax,
     474              :                              Real64 max,
     475              :                              std::string_view msg = {});
     476              : 
     477              :     void ShowWarningBadMinMax(EnergyPlusData &state,
     478              :                               ErrorObjectHeader const &eoh,
     479              :                               std::string_view schedField,
     480              :                               std::string_view schedName,
     481              :                               Clusive cluMin,
     482              :                               Real64 min,
     483              :                               Clusive cluMax,
     484              :                               Real64 max,
     485              :                               std::string_view msg = {});
     486              : 
     487              : } // namespace Sched
     488              : 
     489              : struct ScheduleManagerData : BaseGlobalStruct
     490              : {
     491              :     bool CheckScheduleValMinMaxRunOnceOnly = true;
     492              :     bool DoScheduleReportingSetup = true;
     493              :     std::map<fs::path, nlohmann::json> UniqueProcessedExternalFiles;
     494              : 
     495              :     // Logical Variables for Module
     496              :     bool ScheduleInputProcessed = false;       // This is false until the Schedule Input has been processed.
     497              :     bool ScheduleFileShadingProcessed = false; // This is false unless there is a Schedule:File:Shading object.
     498              : 
     499              :     // Object Data
     500              :     std::vector<Sched::ScheduleType *> scheduleTypes; // Allowed Schedule Types
     501              :     std::vector<Sched::Schedule *> schedules;         // Year schedule
     502              :     std::vector<Sched::DaySchedule *> daySchedules;
     503              :     std::vector<Sched::WeekSchedule *> weekSchedules;
     504              : 
     505              :     std::map<std::string, int> scheduleTypeMap;
     506              :     std::map<std::string, int> scheduleMap;
     507              :     std::map<std::string, int> dayScheduleMap;
     508              :     std::map<std::string, int> weekScheduleMap;
     509              : 
     510         2128 :     void init_constant_state(EnergyPlusData &state) override
     511              :     {
     512         2128 :         Sched::InitConstantScheduleData(state);
     513         2128 :     }
     514              : 
     515         1154 :     void init_state(EnergyPlusData &state) override
     516              :     {
     517         1154 :         Sched::ProcessScheduleInput(state);
     518         1153 :     }
     519              : 
     520         2102 :     void clear_state() override
     521              :     {
     522         2102 :         CheckScheduleValMinMaxRunOnceOnly = true;
     523         2102 :         UniqueProcessedExternalFiles.clear();
     524         2102 :         DoScheduleReportingSetup = true;
     525              : 
     526         2102 :         ScheduleInputProcessed = false;
     527         2102 :         ScheduleFileShadingProcessed = false;
     528              : 
     529         2614 :         for (int i = 0; i < (int)scheduleTypes.size(); ++i) {
     530          512 :             delete scheduleTypes[i];
     531              :         }
     532         2102 :         scheduleTypes.clear(); // Allowed Schedule Types
     533         2102 :         scheduleTypeMap.clear();
     534              : 
     535         8091 :         for (int i = 0; i < (int)schedules.size(); ++i) {
     536         5989 :             delete schedules[i];
     537              :         }
     538         2102 :         schedules.clear(); // Schedule Storage
     539         2102 :         scheduleMap.clear();
     540              : 
     541         6796 :         for (int i = 0; i < (int)daySchedules.size(); ++i) {
     542         4694 :             delete daySchedules[i];
     543              :         }
     544         2102 :         daySchedules.clear();
     545         2102 :         dayScheduleMap.clear();
     546              : 
     547         6281 :         for (int i = 0; i < (int)weekSchedules.size(); ++i) {
     548         4179 :             delete weekSchedules[i];
     549              :         }
     550         2102 :         weekSchedules.clear();
     551         2102 :         weekScheduleMap.clear();
     552         2102 :     }
     553              : };
     554              : 
     555              : } // namespace EnergyPlus
     556              : 
     557              : #endif
        

Generated by: LCOV version 2.0-1