src/model/ClimateZones.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_CLIMATEZONES_HPP | ||
| 7 | #define MODEL_CLIMATEZONES_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ModelObject.hpp" | ||
| 11 | #include "ModelExtensibleGroup.hpp" | ||
| 12 | |||
| 13 | namespace openstudio { | ||
| 14 | namespace model { | ||
| 15 | |||
| 16 | class Site; | ||
| 17 | |||
| 18 | namespace detail { | ||
| 19 | class ClimateZones_Impl; | ||
| 20 | } // namespace detail | ||
| 21 | |||
| 22 | /** ClimateZone is a ModelExtensibleGroup that represents a single climate zone definition | ||
| 23 | * contained in the unique ClimateZones ModelObject. */ | ||
| 24 | class MODEL_API ClimateZone : public ModelExtensibleGroup | ||
| 25 | { | ||
| 26 | public: | ||
| 27 | /** @name Getters */ | ||
| 28 | //@{ | ||
| 29 | |||
| 30 | /** The institution that defines this climate zone designation. Typically this is | ||
| 31 | * "ASHRAE" or "CEC". */ | ||
| 32 | std::string institution() const; | ||
| 33 | |||
| 34 | /** The name of the document that defines this climate zone designation. "Standard 169", | ||
| 35 | * etc. */ | ||
| 36 | std::string documentName() const; | ||
| 37 | |||
| 38 | /** The year of the document. Together with institution and documentName, this provides | ||
| 39 | * a fairly complete citation, which implicitly defines the allowable values. */ | ||
| 40 | unsigned year() const; | ||
| 41 | |||
| 42 | /** The actual climate zone designation. "4C", "15", etc. */ | ||
| 43 | std::string value() const; | ||
| 44 | |||
| 45 | //@} | ||
| 46 | /** @name Setters */ | ||
| 47 | //@{ | ||
| 48 | |||
| 49 | bool setValue(const std::string& value); | ||
| 50 | |||
| 51 | bool setType(const std::string& institution, const std::string& documentName, unsigned year); | ||
| 52 | |||
| 53 | bool setTypeAndValue(const std::string& institution, const std::string& documentName, unsigned year, const std::string& value); | ||
| 54 | //@} | ||
| 55 | protected: | ||
| 56 | /// @cond | ||
| 57 | using ImplType = detail::ClimateZones_Impl; | ||
| 58 | |||
| 59 | friend class IdfExtensibleGroup; | ||
| 60 | friend class detail::ClimateZones_Impl; | ||
| 61 | |||
| 62 | ClimateZone(std::shared_ptr<detail::ClimateZones_Impl> impl, unsigned index); | ||
| 63 | |||
| 64 | /// @endcond | ||
| 65 | private: | ||
| 66 | /** Private default constructor. */ | ||
| 67 | ClimateZone(); | ||
| 68 | |||
| 69 | − | REGISTER_LOGGER("openstudio.model.ClimateZones"); | |
| 70 | }; | ||
| 71 | |||
| 72 | /** \relates ClimateZone */ | ||
| 73 | using ClimateZoneVector = std::vector<ClimateZone>; | ||
| 74 | |||
| 75 | /** ClimateZones is a unque ModelObject that wraps the OpenStudio IDD object 'OS:ClimateZones'. | ||
| 76 | * As a location identifier, it is a child of Site. ClimateZones was added to support building | ||
| 77 | * energy standards like Title 24 and ASHRAE 90.1, which list different requirements based on the | ||
| 78 | * climate zone locations of buildings. Since a given building may be evaluated against multiple | ||
| 79 | * standards, multiple climate zones may be specified for a given model. | ||
| 80 | * | ||
| 81 | * \todo Provide methods for setting the ClimateZones for a model based on the data in Site and/or | ||
| 82 | * WeatherFile, and for checking whether the ClimateZones object is consistent with the geospatial | ||
| 83 | * location(s) called out in Site and/or WeatherFile. */ | ||
| 84 | class MODEL_API ClimateZones : public ModelObject | ||
| 85 | { | ||
| 86 | public: | ||
| 87 | /** @name Constructors and Destructors */ | ||
| 88 | //@{ | ||
| 89 | |||
| 90 | 114 | virtual ~ClimateZones() override = default; | |
| 91 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 92 | ✗ | ClimateZones(const ClimateZones& other) = default; | |
| 93 | 51 | ClimateZones(ClimateZones&& other) = default; | |
| 94 | ✗ | ClimateZones& operator=(const ClimateZones&) = default; | |
| 95 | ✗ | ClimateZones& operator=(ClimateZones&&) = default; | |
| 96 | |||
| 97 | //@} | ||
| 98 | /** @name Static Methods */ | ||
| 99 | //@{ | ||
| 100 | |||
| 101 | static std::string ashraeInstitutionName(); | ||
| 102 | |||
| 103 | static std::string ashraeDocumentName(); | ||
| 104 | |||
| 105 | static unsigned ashraeDefaultYear(); | ||
| 106 | |||
| 107 | static std::string cecInstitutionName(); | ||
| 108 | |||
| 109 | static std::string cecDocumentName(); | ||
| 110 | |||
| 111 | static unsigned cecDefaultYear(); | ||
| 112 | |||
| 113 | static std::string getDefaultDocumentName(const std::string& institution); | ||
| 114 | |||
| 115 | static unsigned getDefaultYear(const std::string& institution); | ||
| 116 | |||
| 117 | static std::vector<std::string> validClimateZoneValues(const std::string& institution, unsigned year); | ||
| 118 | |||
| 119 | static IddObjectType iddObjectType(); | ||
| 120 | |||
| 121 | //@} | ||
| 122 | /** @name Getters */ | ||
| 123 | //@{ | ||
| 124 | |||
| 125 | /** Site parents the unique ClimateZones object. */ | ||
| 126 | boost::optional<Site> site() const; | ||
| 127 | |||
| 128 | /** Return the individual climate zone definitions, with each one wrapped up as a ClimateZone | ||
| 129 | * ModelExtensibleGroup. */ | ||
| 130 | std::vector<ClimateZone> climateZones() const; | ||
| 131 | |||
| 132 | /** Return the ClimateZone definition at extensible group index. */ | ||
| 133 | ClimateZone getClimateZone(unsigned index) const; | ||
| 134 | |||
| 135 | // ETH@20110615 Multiple definitions for a particular institution, year combination is not | ||
| 136 | // handled well. Either return a vector or disallow duplicates at this level. Will have | ||
| 137 | // implications for some setters. | ||
| 138 | |||
| 139 | /** Return the ClimateZone definition for institution and year. The return value will be .empty() | ||
| 140 | * if no such ClimateZone is found. */ | ||
| 141 | ClimateZone getClimateZone(const std::string& institution, unsigned year) const; | ||
| 142 | |||
| 143 | /** Return the ClimateZone defintions for institution (e.g. "ASHRAE" or "CEC"). */ | ||
| 144 | std::vector<ClimateZone> getClimateZones(const std::string& institution) const; | ||
| 145 | |||
| 146 | //@} | ||
| 147 | /** @name Setters */ | ||
| 148 | //@{ | ||
| 149 | |||
| 150 | /** Clear all ClimateZone definitions. */ | ||
| 151 | bool clear(); | ||
| 152 | |||
| 153 | /** Sets the ClimateZone definition for institution to value and returns the modified (or | ||
| 154 | * created) ClimateZone. If there are no definitions for institution, this method is equivalent | ||
| 155 | * to appendClimateZone(institution,value). If there are multiple definitions for institution, | ||
| 156 | * the return value is .empty() and a warning is logged. */ | ||
| 157 | ClimateZone setClimateZone(const std::string& institution, const std::string& value); | ||
| 158 | |||
| 159 | /** Sets the ClimateZone definition for institution, year to value and returns the modified (or | ||
| 160 | * created) ClimateZone. If there are no definitions for the given combination of institution | ||
| 161 | * and year, this method is equivalent to appendClimateZone(institution,year,value). */ | ||
| 162 | ClimateZone setClimateZone(const std::string& institution, unsigned year, const std::string& value); | ||
| 163 | |||
| 164 | /** Creates and returns a new climate zone definition for institution. Attempts to provide a | ||
| 165 | * default document name and year, leaves the value blank. */ | ||
| 166 | ClimateZone appendClimateZone(const std::string& institution); | ||
| 167 | |||
| 168 | /** Creates and returns a new climate zone definition for institution, with value. Attempts to | ||
| 169 | * provide a default document name and year. */ | ||
| 170 | ClimateZone appendClimateZone(const std::string& institution, const std::string& value); | ||
| 171 | |||
| 172 | /** Creates and returns a new climate zone definition. Attempts to provide a default document | ||
| 173 | * name. */ | ||
| 174 | ClimateZone appendClimateZone(const std::string& institution, unsigned year, const std::string& value); | ||
| 175 | |||
| 176 | /** Creates and returns a new climate zone definition. */ | ||
| 177 | ClimateZone appendClimateZone(const std::string& institution, const std::string documentName, unsigned year, const std::string& value); | ||
| 178 | |||
| 179 | //@} | ||
| 180 | /** @name Queries */ | ||
| 181 | //@{ | ||
| 182 | |||
| 183 | /** Returns the number of climate zone designations registered with this object. */ | ||
| 184 | unsigned numClimateZones() const; | ||
| 185 | |||
| 186 | //@} | ||
| 187 | |||
| 188 | protected: | ||
| 189 | /// @cond | ||
| 190 | using ImplType = detail::ClimateZones_Impl; | ||
| 191 | |||
| 192 | friend class Model; | ||
| 193 | friend class openstudio::IdfObject; | ||
| 194 | |||
| 195 | explicit ClimateZones(Model& model); | ||
| 196 | |||
| 197 | explicit ClimateZones(std::shared_ptr<detail::ClimateZones_Impl> impl); | ||
| 198 | |||
| 199 | /// @endcond | ||
| 200 | private: | ||
| 201 | REGISTER_LOGGER("openstudio.model.ClimateZones"); | ||
| 202 | }; | ||
| 203 | |||
| 204 | /** \relates ClimateZones */ | ||
| 205 | using OptionalClimateZones = boost::optional<ClimateZones>; | ||
| 206 | |||
| 207 | } // namespace model | ||
| 208 | } // namespace openstudio | ||
| 209 | |||
| 210 | #endif // MODEL_CLIMATEZONES_HPP | ||
| 211 |