src/model/Timestep.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_TIMESTEP_HPP | ||
| 7 | #define MODEL_TIMESTEP_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ModelObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | namespace model { | ||
| 14 | |||
| 15 | namespace detail { | ||
| 16 | class Timestep_Impl; | ||
| 17 | } // namespace detail | ||
| 18 | |||
| 19 | /** Timestep derives from ModelObject and is an interface to the OpenStudio IDD object named "Timestep". | ||
| 20 | * | ||
| 21 | * Timestep allows the user to set the zone timestep for EnergyPlus simulations. | ||
| 22 | * Timestep does not have a public constructor because it is a unique ModelObject. | ||
| 23 | * To get the Timestep object for a Model or create one if it does not yet exist use model.getUniqueObject<Timestep>(). | ||
| 24 | * To get the Timestep object for a Model but not create one if it does not yet exist use model.getOptionalUniqueObject<Timestep>(). | ||
| 25 | */ | ||
| 26 | class MODEL_API Timestep : public ModelObject | ||
| 27 | { | ||
| 28 | public: | ||
| 29 | /** @name Static Methods */ | ||
| 30 | //@{ | ||
| 31 | |||
| 32 | static IddObjectType iddObjectType(); | ||
| 33 | |||
| 34 | 4125 | virtual ~Timestep() override = default; | |
| 35 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 36 | 154 | Timestep(const Timestep& other) = default; | |
| 37 | 958 | Timestep(Timestep&& other) = default; | |
| 38 | ✗ | Timestep& operator=(const Timestep&) = default; | |
| 39 | ✗ | Timestep& operator=(Timestep&&) = default; | |
| 40 | |||
| 41 | //@} | ||
| 42 | /** @name Getters */ | ||
| 43 | //@{ | ||
| 44 | |||
| 45 | int numberOfTimestepsPerHour() const; | ||
| 46 | |||
| 47 | bool isNumberOfTimestepsPerHourDefaulted() const; | ||
| 48 | |||
| 49 | //@} | ||
| 50 | /** @name Setters */ | ||
| 51 | //@{ | ||
| 52 | |||
| 53 | bool setNumberOfTimestepsPerHour(int numberOfTimestepsPerHour); | ||
| 54 | |||
| 55 | void resetNumberOfTimestepsPerHour(); | ||
| 56 | |||
| 57 | //@} | ||
| 58 | |||
| 59 | protected: | ||
| 60 | /** @name Constructors and Destructors */ | ||
| 61 | //@{ | ||
| 62 | |||
| 63 | /// Constructs a new Timestep object in the model. | ||
| 64 | explicit Timestep(const Model& model); | ||
| 65 | |||
| 66 | //@} | ||
| 67 | |||
| 68 | /// @cond | ||
| 69 | using ImplType = detail::Timestep_Impl; | ||
| 70 | |||
| 71 | friend class Model; | ||
| 72 | |||
| 73 | friend class openstudio::IdfObject; | ||
| 74 | |||
| 75 | // constructor | ||
| 76 | explicit Timestep(std::shared_ptr<detail::Timestep_Impl> impl); | ||
| 77 | |||
| 78 | private: | ||
| 79 | REGISTER_LOGGER("openstudio.model.Timestep"); | ||
| 80 | |||
| 81 | /// @endcond | ||
| 82 | }; | ||
| 83 | |||
| 84 | /** \relates Timestep */ | ||
| 85 | using OptionalTimestep = boost::optional<Timestep>; | ||
| 86 | |||
| 87 | } // namespace model | ||
| 88 | |||
| 89 | } // namespace openstudio | ||
| 90 | |||
| 91 | #endif // MODEL_TIMESTEP_HPP | ||
| 92 |