LCOV - code coverage report
Current view: top level - EnergyPlus - ScheduleManager.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 88.7 % 71 63
Test Date: 2025-05-22 16:09:37 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        15009 :         ScheduleBase(){};
     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        10809 :         DayOrYearSchedule(){};
     203        10681 :         virtual ~DayOrYearSchedule(){};
     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         4732 :         DaySchedule()
     217         4732 :         {
     218         4732 :         }
     219         9386 :         virtual ~DaySchedule()
     220         4693 :         {
     221         9386 :         }
     222            0 :         void can_instantiate()
     223              :         {
     224            0 :             assert(false);
     225              :         } // makes class concrete, but don't call this
     226              : 
     227              :         bool checkValsForLimitViolations(EnergyPlusData &state) const;
     228              :         bool checkValsForBadIntegers(EnergyPlusData &state) const;
     229              :         void populateFromMinuteVals(EnergyPlusData &state, std::array<Real64, Constant::iMinutesInDay> const &minuteVals);
     230           48 :         std::vector<Real64> const &getDayVals([[maybe_unused]] EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1)
     231              :         {
     232           48 :             return tsVals;
     233              :         }
     234              :         void setMinMaxVals(EnergyPlusData &state);
     235              :     };
     236              : 
     237              :     struct WeekSchedule : public ScheduleBase
     238              :     {
     239              :         // Members
     240              :         std::array<DaySchedule *, (int)DayType::Num> dayScheds = {nullptr};
     241              : 
     242         4200 :         WeekSchedule()
     243         4200 :         {
     244         4200 :         }
     245         8356 :         virtual ~WeekSchedule()
     246         4178 :         {
     247         8356 :         }
     248            0 :         void can_instantiate()
     249              :         {
     250            0 :             assert(false);
     251              :         } // makes class concrete, but don't call this
     252              : 
     253              :         void setMinMaxVals(EnergyPlusData &state);
     254              :     };
     255              : 
     256              :     struct Schedule : public DayOrYearSchedule
     257              :     {
     258              :         SchedType type = SchedType::Invalid;
     259              : 
     260              :         int schedTypeNum = SchedNum_Invalid; // Index of Schedule Type
     261              :         bool EMSActuatedOn = false;          // indicates if EMS computed
     262              :         Real64 EMSVal = 0.0;                 // EMS value
     263              : 
     264              :         Real64 currentVal = 0.0;
     265              : 
     266         6077 :         Schedule()
     267         6077 :         {
     268         6077 :             type = SchedType::Constant;
     269         6077 :         }
     270              : 
     271         5988 :         virtual ~Schedule(){};
     272              : 
     273      6367090 :         Real64 getCurrentVal() const
     274              :         {
     275      6367090 :             return EMSActuatedOn ? EMSVal : currentVal;
     276              :         }
     277              : 
     278              :         // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not
     279              :         // Negative ts => unspecified, will use TimeStepsInHour
     280              :         virtual Real64 getHrTsVal(EnergyPlusData &state, int hr, int ts = -1) const = 0;
     281              :         virtual bool hasVal(EnergyPlusData &state, Real64 const val) const = 0;
     282              :         virtual bool hasFractionalVal(EnergyPlusData &state) const = 0;
     283              : 
     284              :         virtual std::pair<Real64, Real64> getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days) = 0;
     285              : 
     286              :         Real64 getAverageWeeklyHoursFullLoad(EnergyPlusData &state, int const startDayOfWeek, bool const isLeapYear);
     287              :         virtual Real64 getAnnualHoursFullLoad(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear) = 0;
     288              :         virtual Real64 getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear) = 0;
     289              :         virtual std::tuple<Real64, int, std::string>
     290              :         getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay) = 0;
     291              :     };
     292              : 
     293              :     struct ScheduleConstant : public Schedule
     294              :     {
     295              :         std::vector<Real64> tsVals;
     296              : 
     297         4675 :         ScheduleConstant()
     298         4675 :         {
     299         4675 :             type = SchedType::Constant;
     300         4675 :         }
     301              : 
     302         9204 :         virtual ~ScheduleConstant(){};
     303              : 
     304            0 :         void can_instantiate()
     305              :         {
     306            0 :             assert(false);
     307              :         } // makes class concrete, but don't call this
     308              : 
     309              :         // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not
     310              :         // Negative ts => unspecified, will use TimeStepsInHour
     311              :         Real64 getHrTsVal(EnergyPlusData &state, int hr, int ts = -1) const;
     312              : 
     313              :         std::vector<Real64> const &getDayVals(EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1);
     314              : 
     315              :         bool hasVal(EnergyPlusData &state, Real64 const val) const;
     316              :         bool hasFractionalVal(EnergyPlusData &state) const;
     317              : 
     318              :         void setMinMaxVals(EnergyPlusData &state);
     319              : 
     320              :         std::pair<Real64, Real64> getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days);
     321              : 
     322              :         Real64 getAnnualHoursFullLoad(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear);
     323              :         Real64 getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear);
     324              : 
     325              :         std::tuple<Real64, int, std::string>
     326              :         getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay);
     327              :     };
     328              : 
     329              :     struct ScheduleDetailed : public Schedule
     330              :     {
     331              :         // Members
     332              :         std::array<WeekSchedule *, 367> weekScheds = {nullptr};           // one created for each day of possible simulation
     333              :         std::array<bool, (int)DayType::Num> MaxMinByDayTypeSet = {false}; // minimum and maximum values by daytype have been stored
     334              :         std::array<Real64, (int)DayType::Num> MinByDayType = {0.0};       // minimum values by daytype for this schedule
     335              :         std::array<Real64, (int)DayType::Num> MaxByDayType = {0.0};       // maximum values by daytype for this schedule
     336              :         bool UseDaylightSaving = true; // Toggles between daylight saving option to be inclused as "No" or "Yes" (default)
     337              : 
     338         1402 :         ScheduleDetailed()
     339         1402 :         {
     340         1402 :             type = SchedType::Year;
     341         1402 :         }
     342              : 
     343         2772 :         virtual ~ScheduleDetailed(){};
     344              : 
     345            0 :         void can_instantiate()
     346              :         {
     347            0 :             assert(false);
     348              :         } // makes class concrete, but don't call this
     349              : 
     350              :         std::vector<Real64> const &getDayVals(EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1);
     351              : 
     352              :         bool hasVal(EnergyPlusData &state, Real64 const val) const;
     353              :         bool hasFractionalVal(EnergyPlusData &state) const;
     354              : 
     355              :         void setMinMaxVals(EnergyPlusData &state);
     356              : 
     357              :         // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not
     358              :         // Negative ts => unspecified, will use TimeStepsInHour
     359              :         Real64 getHrTsVal(EnergyPlusData &state, int hr, int ts = -1) const;
     360              : 
     361              :         std::pair<Real64, Real64> getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days);
     362              : 
     363              :         Real64 getAnnualHoursFullLoad(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear);
     364              :         Real64 getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear);
     365              : 
     366              :         std::tuple<Real64, int, std::string>
     367              :         getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay);
     368              :     };
     369              : 
     370              :     // Functions
     371              :     ScheduleDetailed *AddScheduleDetailed(EnergyPlusData &state, std::string const &name);
     372              :     ScheduleConstant *AddScheduleConstant(EnergyPlusData &state, std::string const &name, Real64 value = 0.0);
     373              :     DaySchedule *AddDaySchedule(EnergyPlusData &state, std::string const &name);
     374              :     WeekSchedule *AddWeekSchedule(EnergyPlusData &state, std::string const &name);
     375              : 
     376              :     void ProcessScheduleInput(EnergyPlusData &state);
     377              : 
     378              :     void InitConstantScheduleData(EnergyPlusData &state);
     379              : 
     380              :     void ReportScheduleDetails(EnergyPlusData &state, ReportLevel const LevelOfDetail);
     381              : 
     382              :     // Returns the CurrentScheduleValue
     383              :     Real64 GetHrTsScheduleVal(EnergyPlusData &state, int const schedNum, int const hr, int const ts = -1);
     384              :     // Updates each schedule value to the current timestep
     385              : 
     386              :     // Uses EMS value if actuated, otherwise calls LookUpScheduleValue with ThisHour=DataGlobals::HourOfDay, ThisTimeStep=DataGlobals::TimeStep
     387              :     void UpdateScheduleVals(EnergyPlusData &state);
     388              : 
     389              :     int GetScheduleTypeNum(EnergyPlusData &state, std::string const &name);
     390              : 
     391              :     int GetDayScheduleNum(EnergyPlusData &state, std::string const &name);
     392              :     DaySchedule *GetDaySchedule(EnergyPlusData &state, std::string const &name);
     393              : 
     394              :     int GetWeekScheduleNum(EnergyPlusData &state, std::string const &name);
     395              :     WeekSchedule *GetWeekSchedule(EnergyPlusData &state, std::string const &name);
     396              : 
     397              :     int GetScheduleNum(EnergyPlusData &state, std::string const &name);
     398              :     Schedule *GetSchedule(EnergyPlusData &state, std::string const &name);
     399              :     Schedule *GetScheduleAlwaysOn(EnergyPlusData &state);
     400              :     Schedule *GetScheduleAlwaysOff(EnergyPlusData &state);
     401              : 
     402              :     void ExternalInterfaceSetSchedule(EnergyPlusData &state,
     403              :                                       int schedNum,
     404              :                                       Real64 val // The new value for the schedule
     405              :     );
     406              : 
     407              :     void ProcessIntervalFields(EnergyPlusData &state,
     408              :                                Array1S_string const Untils,
     409              :                                Array1S<Real64> const Numbers,
     410              :                                int const NumUntils,
     411              :                                int const NumNumbers,
     412              :                                std::array<Real64, Constant::iMinutesInDay> &minuteVals,
     413              :                                std::array<bool, Constant::iMinutesInDay> &setMinuteVals,
     414              :                                bool &ErrorsFound,
     415              :                                std::string const &DayScheduleName, // Name (used for errors)
     416              :                                std::string const &ErrContext,      // Context (used for errors)
     417              :                                Interpolation interpolation         // enumeration on how to interpolate values in schedule
     418              :     );
     419              : 
     420              :     void DecodeHHMMField(EnergyPlusData &state,
     421              :                          std::string const &FieldVal,        // Input field value
     422              :                          int &RetHH,                         // Returned "hour"
     423              :                          int &RetMM,                         // Returned "minute"
     424              :                          bool &ErrorsFound,                  // True if errors found in this field
     425              :                          std::string const &DayScheduleName, // originating day schedule name
     426              :                          std::string const &FullFieldValue,  // Full Input field value
     427              :                          Interpolation interpolation         // enumeration on how to interpolate values in schedule
     428              :     );
     429              : 
     430              :     bool isMinuteMultipleOfTimestep(int minute, int numMinutesPerTimestep);
     431              : 
     432              :     void ProcessForDayTypes(EnergyPlusData &state,
     433              :                             std::string const &ForDayField,                 // Field containing the "FOR:..."
     434              :                             std::array<bool, (int)DayType::Num> &theseDays, // Array to contain returned "true" days
     435              :                             std::array<bool, (int)DayType::Num> &allDays,   // Array of days already done
     436              :                             bool &ErrorsFound                               // Will be true if error found.
     437              :     );
     438              : 
     439              :     void ReportScheduleVals(EnergyPlusData &state);
     440              : 
     441              :     void ReportOrphanSchedules(EnergyPlusData &state);
     442              : 
     443              :     void ShowSevereBadMin(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 ShowWarningBadMin(EnergyPlusData &state,
     452              :                            ErrorObjectHeader const &eoh,
     453              :                            std::string_view schedField,
     454              :                            std::string_view schedName,
     455              :                            Clusive cluMin,
     456              :                            Real64 min,
     457              :                            std::string_view msg = {});
     458              : 
     459              :     void ShowSevereBadMax(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 ShowWarningBadMax(EnergyPlusData &state,
     468              :                            ErrorObjectHeader const &eoh,
     469              :                            std::string_view schedField,
     470              :                            std::string_view schedName,
     471              :                            Clusive cluMax,
     472              :                            Real64 max,
     473              :                            std::string_view msg = {});
     474              : 
     475              :     void ShowSevereBadMinMax(EnergyPlusData &state,
     476              :                              ErrorObjectHeader const &eoh,
     477              :                              std::string_view schedField,
     478              :                              std::string_view schedName,
     479              :                              Clusive cluMin,
     480              :                              Real64 min,
     481              :                              Clusive cluMax,
     482              :                              Real64 max,
     483              :                              std::string_view msg = {});
     484              : 
     485              :     void ShowWarningBadMinMax(EnergyPlusData &state,
     486              :                               ErrorObjectHeader const &eoh,
     487              :                               std::string_view schedField,
     488              :                               std::string_view schedName,
     489              :                               Clusive cluMin,
     490              :                               Real64 min,
     491              :                               Clusive cluMax,
     492              :                               Real64 max,
     493              :                               std::string_view msg = {});
     494              : 
     495              : } // namespace Sched
     496              : 
     497              : struct ScheduleManagerData : BaseGlobalStruct
     498              : {
     499              :     bool CheckScheduleValMinMaxRunOnceOnly = true;
     500              :     bool DoScheduleReportingSetup = true;
     501              :     std::map<fs::path, nlohmann::json> UniqueProcessedExternalFiles;
     502              : 
     503              :     // Logical Variables for Module
     504              :     bool ScheduleInputProcessed = false;       // This is false until the Schedule Input has been processed.
     505              :     bool ScheduleFileShadingProcessed = false; // This is false unless there is a Schedule:File:Shading object.
     506              : 
     507              :     // Object Data
     508              :     std::vector<Sched::ScheduleType *> scheduleTypes; // Allowed Schedule Types
     509              :     std::vector<Sched::Schedule *> schedules;         // Year schedule
     510              :     std::vector<Sched::DaySchedule *> daySchedules;
     511              :     std::vector<Sched::WeekSchedule *> weekSchedules;
     512              : 
     513              :     std::map<std::string, int> scheduleTypeMap;
     514              :     std::map<std::string, int> scheduleMap;
     515              :     std::map<std::string, int> dayScheduleMap;
     516              :     std::map<std::string, int> weekScheduleMap;
     517              : 
     518         2126 :     void init_constant_state(EnergyPlusData &state) override
     519              :     {
     520         2126 :         Sched::InitConstantScheduleData(state);
     521         2126 :     }
     522              : 
     523         1153 :     void init_state(EnergyPlusData &state) override
     524              :     {
     525         1153 :         Sched::ProcessScheduleInput(state);
     526         1152 :     }
     527              : 
     528         2100 :     void clear_state() override
     529              :     {
     530         2100 :         CheckScheduleValMinMaxRunOnceOnly = true;
     531         2100 :         UniqueProcessedExternalFiles.clear();
     532         2100 :         DoScheduleReportingSetup = true;
     533              : 
     534         2100 :         ScheduleInputProcessed = false;
     535         2100 :         ScheduleFileShadingProcessed = false;
     536              : 
     537         2609 :         for (int i = 0; i < (int)scheduleTypes.size(); ++i)
     538          509 :             delete scheduleTypes[i];
     539         2100 :         scheduleTypes.clear(); // Allowed Schedule Types
     540         2100 :         scheduleTypeMap.clear();
     541              : 
     542         8088 :         for (int i = 0; i < (int)schedules.size(); ++i)
     543         5988 :             delete schedules[i];
     544         2100 :         schedules.clear(); // Schedule Storage
     545         2100 :         scheduleMap.clear();
     546              : 
     547         6793 :         for (int i = 0; i < (int)daySchedules.size(); ++i)
     548         4693 :             delete daySchedules[i];
     549         2100 :         daySchedules.clear();
     550         2100 :         dayScheduleMap.clear();
     551              : 
     552         6278 :         for (int i = 0; i < (int)weekSchedules.size(); ++i)
     553         4178 :             delete weekSchedules[i];
     554         2100 :         weekSchedules.clear();
     555         2100 :         weekScheduleMap.clear();
     556         2100 :     }
     557              : };
     558              : 
     559              : } // namespace EnergyPlus
     560              : 
     561              : #endif
        

Generated by: LCOV version 2.0-1