src/model/RunPeriod.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_RUNPERIOD_HPP | ||
| 7 | #define MODEL_RUNPERIOD_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ParentObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | namespace model { | ||
| 14 | |||
| 15 | namespace detail { | ||
| 16 | class RunPeriod_Impl; | ||
| 17 | } // namespace detail | ||
| 18 | |||
| 19 | /** RunPeriod derives from ParentObject and is an interface to the unique OpenStudio IDD object named "RunPeriod". | ||
| 20 | * | ||
| 21 | * RunPeriod defines a period of time over which to run an EnergyPlus weather file simulation. Some applications | ||
| 22 | * require a full annual EnergyPlus simulation, others do not. | ||
| 23 | */ | ||
| 24 | class MODEL_API RunPeriod : public ParentObject | ||
| 25 | { | ||
| 26 | public: | ||
| 27 | /** @name Constructors and Destructors */ | ||
| 28 | //@{ | ||
| 29 | |||
| 30 | 3141 | virtual ~RunPeriod() override = default; | |
| 31 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 32 | 110 | RunPeriod(const RunPeriod& other) = default; | |
| 33 | 937 | RunPeriod(RunPeriod&& other) = default; | |
| 34 | ✗ | RunPeriod& operator=(const RunPeriod&) = default; | |
| 35 | ✗ | RunPeriod& operator=(RunPeriod&&) = default; | |
| 36 | |||
| 37 | //@} | ||
| 38 | /** @name Getters */ | ||
| 39 | //@{ | ||
| 40 | |||
| 41 | // DLM@20110607: these should all have 'get' removed | ||
| 42 | // DLM@20110614: I would prefer to not abbreviate names like 'NumTimePeriodRepeats' | ||
| 43 | |||
| 44 | int getBeginMonth() const; | ||
| 45 | int getBeginDayOfMonth() const; | ||
| 46 | int getEndMonth() const; | ||
| 47 | int getEndDayOfMonth() const; | ||
| 48 | bool getUseWeatherFileHolidays() const; | ||
| 49 | bool getUseWeatherFileDaylightSavings() const; | ||
| 50 | bool getApplyWeekendHolidayRule() const; | ||
| 51 | bool getUseWeatherFileRainInd() const; | ||
| 52 | bool getUseWeatherFileSnowInd() const; | ||
| 53 | int getNumTimePeriodRepeats() const; | ||
| 54 | |||
| 55 | //@} | ||
| 56 | /** @name Setters */ | ||
| 57 | //@{ | ||
| 58 | |||
| 59 | // DLM@20110607: should all these sets return bool? | ||
| 60 | |||
| 61 | bool setBeginMonth(int month); | ||
| 62 | bool setBeginDayOfMonth(int day); | ||
| 63 | bool setEndMonth(int month); | ||
| 64 | bool setEndDayOfMonth(int day); | ||
| 65 | bool setUseWeatherFileHolidays(bool use); | ||
| 66 | bool setUseWeatherFileDaylightSavings(bool use); | ||
| 67 | bool setApplyWeekendHolidayRule(bool apply); | ||
| 68 | bool setUseWeatherFileRainInd(bool rainInd); | ||
| 69 | bool setUseWeatherFileSnowInd(bool snowInd); | ||
| 70 | bool setNumTimePeriodRepeats(int numRepeats); | ||
| 71 | |||
| 72 | // ensure that this object does not contain the date 2/29 | ||
| 73 | void ensureNoLeapDays(); | ||
| 74 | |||
| 75 | //@} | ||
| 76 | |||
| 77 | /// Returns the IddObjectType. | ||
| 78 | static IddObjectType iddObjectType(); | ||
| 79 | |||
| 80 | /// Returns true if RunPeriod specifies run between 1/1-12/31. | ||
| 81 | bool isAnnual() const; | ||
| 82 | |||
| 83 | /// Returns true if not annual simulation. | ||
| 84 | bool isPartialYear() const; | ||
| 85 | |||
| 86 | /// Returns true if numTimePeriodRepeats is greater than 1. | ||
| 87 | bool isRepeated() const; | ||
| 88 | |||
| 89 | protected: | ||
| 90 | /// @cond | ||
| 91 | |||
| 92 | using ImplType = detail::RunPeriod_Impl; | ||
| 93 | |||
| 94 | friend class Model; | ||
| 95 | friend class openstudio::IdfObject; | ||
| 96 | |||
| 97 | // constructor | ||
| 98 | explicit RunPeriod(std::shared_ptr<detail::RunPeriod_Impl> impl); | ||
| 99 | |||
| 100 | /** Constructor adds a new RunPeriod object to model. */ | ||
| 101 | explicit RunPeriod(const Model& model); | ||
| 102 | |||
| 103 | private: | ||
| 104 | REGISTER_LOGGER("openstudio.model.RunPeriod"); | ||
| 105 | |||
| 106 | /// @endcond | ||
| 107 | }; | ||
| 108 | |||
| 109 | /** \relates RunPeriod */ | ||
| 110 | using OptionalRunPeriod = boost::optional<RunPeriod>; | ||
| 111 | |||
| 112 | /** \relates RunPeriod */ | ||
| 113 | using RunPeriodVector = std::vector<RunPeriod>; | ||
| 114 | |||
| 115 | } // namespace model | ||
| 116 | } // namespace openstudio | ||
| 117 | |||
| 118 | #endif // MODEL_RUNPERIOD_HPP | ||
| 119 |