src/model/ScheduleRuleset_Impl.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #ifndef MODEL_SCHEDULERULESET_IMPL_HPP | ||
| 7 | #define MODEL_SCHEDULERULESET_IMPL_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "Schedule_Impl.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | class Date; | ||
| 15 | |||
| 16 | namespace model { | ||
| 17 | |||
| 18 | class ScheduleDay; | ||
| 19 | class ScheduleRule; | ||
| 20 | |||
| 21 | namespace detail { | ||
| 22 | |||
| 23 | /** ScheduleRuleset_Impl is a Schedule_Impl that is the implementation class for ScheduleRuleset.*/ | ||
| 24 | class MODEL_API ScheduleRuleset_Impl : public Schedule_Impl | ||
| 25 | { | ||
| 26 | public: | ||
| 27 | /** @name Constructors and Destructors */ | ||
| 28 | //@{ | ||
| 29 | |||
| 30 | ScheduleRuleset_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); | ||
| 31 | |||
| 32 | ScheduleRuleset_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); | ||
| 33 | |||
| 34 | ScheduleRuleset_Impl(const ScheduleRuleset_Impl& other, Model_Impl* model, bool keepHandle); | ||
| 35 | |||
| 36 | 4799 | virtual ~ScheduleRuleset_Impl() override = default; | |
| 37 | |||
| 38 | //@} | ||
| 39 | /** @name Virtual Methods */ | ||
| 40 | //@{ | ||
| 41 | |||
| 42 | virtual ModelObject clone(Model model) const override; | ||
| 43 | |||
| 44 | virtual std::vector<ResourceObject> resources() const override; | ||
| 45 | |||
| 46 | virtual std::vector<ModelObject> children() const override; | ||
| 47 | |||
| 48 | virtual const std::vector<std::string>& outputVariableNames() const override; | ||
| 49 | |||
| 50 | virtual IddObjectType iddObjectType() const override; | ||
| 51 | |||
| 52 | virtual boost::optional<ScheduleTypeLimits> scheduleTypeLimits() const override; | ||
| 53 | |||
| 54 | /** Returns empty vector, because individual ScheduleDay objects will check values() against | ||
| 55 | * bounds. */ | ||
| 56 | virtual std::vector<double> values() const override; | ||
| 57 | |||
| 58 | virtual bool setScheduleTypeLimits(const ScheduleTypeLimits& scheduleTypeLimits) override; | ||
| 59 | |||
| 60 | virtual bool resetScheduleTypeLimits() override; | ||
| 61 | |||
| 62 | //@} | ||
| 63 | /** @name Getters */ | ||
| 64 | //@{ | ||
| 65 | |||
| 66 | /// Returns the default day schedule. | ||
| 67 | ScheduleDay defaultDaySchedule() const; | ||
| 68 | |||
| 69 | /// Returns the summer design day schedule. | ||
| 70 | ScheduleDay summerDesignDaySchedule() const; | ||
| 71 | |||
| 72 | /// Returns true if the summer design day is defaulted. | ||
| 73 | bool isSummerDesignDayScheduleDefaulted() const; | ||
| 74 | |||
| 75 | /// Returns the winter design day schedule. | ||
| 76 | ScheduleDay winterDesignDaySchedule() const; | ||
| 77 | |||
| 78 | /// Returns true if the winter design day is defaulted. | ||
| 79 | bool isWinterDesignDayScheduleDefaulted() const; | ||
| 80 | |||
| 81 | /// Returns the holiday schedule. | ||
| 82 | ScheduleDay holidaySchedule() const; | ||
| 83 | |||
| 84 | /// Returns true if the holiday schedule is defaulted. | ||
| 85 | bool isHolidayScheduleDefaulted() const; | ||
| 86 | |||
| 87 | /// Returns the custom day 1 schedule. | ||
| 88 | ScheduleDay customDay1Schedule() const; | ||
| 89 | |||
| 90 | /// Returns true if the custom day 1 schedule is defaulted. | ||
| 91 | bool isCustomDay1ScheduleDefaulted() const; | ||
| 92 | |||
| 93 | /// Returns the custom day 2 schedule. | ||
| 94 | ScheduleDay customDay2Schedule() const; | ||
| 95 | |||
| 96 | /// Returns true if the custom day 2 schedule is defaulted. | ||
| 97 | bool isCustomDay2ScheduleDefaulted() const; | ||
| 98 | |||
| 99 | //@} | ||
| 100 | /** @name Setters */ | ||
| 101 | //@{ | ||
| 102 | |||
| 103 | /// Sets the summer design day schedule. | ||
| 104 | bool setSummerDesignDaySchedule(const ScheduleDay& schedule); | ||
| 105 | |||
| 106 | /// Resets the summer design day schedule. | ||
| 107 | void resetSummerDesignDaySchedule(); | ||
| 108 | |||
| 109 | /// Sets the winter design day schedule. | ||
| 110 | bool setWinterDesignDaySchedule(const ScheduleDay& schedule); | ||
| 111 | |||
| 112 | /// Resets the winter design day schedule. | ||
| 113 | void resetWinterDesignDaySchedule(); | ||
| 114 | |||
| 115 | /// Sets the holiday schedule. | ||
| 116 | bool setHolidaySchedule(const ScheduleDay& schedule); | ||
| 117 | |||
| 118 | /// Resets the holiday schedule. | ||
| 119 | void resetHolidaySchedule(); | ||
| 120 | |||
| 121 | /// Sets the custom day 1 schedule. | ||
| 122 | bool setCustomDay1Schedule(const ScheduleDay& schedule); | ||
| 123 | |||
| 124 | /// Resets the custom day 1 schedule. | ||
| 125 | void resetCustomDay1Schedule(); | ||
| 126 | |||
| 127 | /// Sets the custom day 2 schedule. | ||
| 128 | bool setCustomDay2Schedule(const ScheduleDay& schedule); | ||
| 129 | |||
| 130 | /// Resets the custom day 2 schedule. | ||
| 131 | void resetCustomDay2Schedule(); | ||
| 132 | |||
| 133 | //@} | ||
| 134 | /** @name Other */ | ||
| 135 | //@{ | ||
| 136 | |||
| 137 | /// Returns a vector of the rules associated with this schedule, this may be empty. | ||
| 138 | /// The rules returned are in order from highest priority to lowest priority. | ||
| 139 | std::vector<ScheduleRule> scheduleRules() const; | ||
| 140 | |||
| 141 | /// Sets the index of the given rule, 0 is the highest priority. | ||
| 142 | /// Returns false if this rule is not a child of this rule set or if index > number of rules - 1. | ||
| 143 | bool setScheduleRuleIndex(ScheduleRule& scheduleRule, unsigned index); | ||
| 144 | |||
| 145 | /// Returns a vector of indices into the result of scheduleRules() between start date (inclusive) and end date (inclusive). | ||
| 146 | /// If no rule is in place on a given day then -1 is returned. | ||
| 147 | std::vector<int> getActiveRuleIndices(const openstudio::Date& startDate, const openstudio::Date& endDate) const; | ||
| 148 | |||
| 149 | /// Returns a vector of day schedules between start date (inclusive) and end date (inclusive). | ||
| 150 | std::vector<ScheduleDay> getDaySchedules(const openstudio::Date& startDate, const openstudio::Date& endDate) const; | ||
| 151 | |||
| 152 | // Moves this rule to the last position. Called in ScheduleRule remove. | ||
| 153 | bool moveToEnd(ScheduleRule& scheduleRule); | ||
| 154 | |||
| 155 | // ensure that this object does not contain the date 2/29 | ||
| 156 | virtual void ensureNoLeapDays() override; | ||
| 157 | |||
| 158 | //@} | ||
| 159 | private: | ||
| 160 | − | REGISTER_LOGGER("openstudio.model.ScheduleRuleset"); | |
| 161 | |||
| 162 | boost::optional<ScheduleDay> optionalDefaultDaySchedule() const; | ||
| 163 | }; | ||
| 164 | |||
| 165 | } // namespace detail | ||
| 166 | |||
| 167 | } // namespace model | ||
| 168 | } // namespace openstudio | ||
| 169 | |||
| 170 | #endif // MODEL_SCHEDULERULESET_IMPL_HPP | ||
| 171 |