src/model/Building.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_BUILDING_HPP | ||
| 7 | #define MODEL_BUILDING_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ParentObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | class Point3d; | ||
| 15 | class Transformation; | ||
| 16 | |||
| 17 | namespace model { | ||
| 18 | |||
| 19 | class Facility; | ||
| 20 | class OutputMeter; | ||
| 21 | class BuildingStory; | ||
| 22 | class ShadingSurfaceGroup; | ||
| 23 | class Surface; | ||
| 24 | class Space; | ||
| 25 | class SpaceType; | ||
| 26 | class DefaultConstructionSet; | ||
| 27 | class DefaultScheduleSet; | ||
| 28 | class DefaultScheduleType; | ||
| 29 | class ThermalZone; | ||
| 30 | |||
| 31 | namespace detail { | ||
| 32 | |||
| 33 | class Building_Impl; | ||
| 34 | |||
| 35 | } // namespace detail | ||
| 36 | |||
| 37 | /** Building derives from ParentObject and is an interface to the OpenStudio IDD object named "Building". | ||
| 38 | * | ||
| 39 | * Building is a unique object which parents all \link Space Spaces\endlink in the model. Conceptually, | ||
| 40 | * the Building object represents the envelope shell and everything inside (lighting, equipment, etc). | ||
| 41 | * The Building is a child of the Facility object which includes the Building as well as exterior equipment, | ||
| 42 | * parking lot lighting, water systems for grounds, etc. | ||
| 43 | * | ||
| 44 | */ | ||
| 45 | class MODEL_API Building : public ParentObject | ||
| 46 | { | ||
| 47 | public: | ||
| 48 | /** @name Constructors and Destructors */ | ||
| 49 | //@{ | ||
| 50 | |||
| 51 | 144826 | virtual ~Building() override = default; | |
| 52 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 53 | 95122 | Building(const Building& other) = default; | |
| 54 | 46574 | Building(Building&& other) = default; | |
| 55 | ✗ | Building& operator=(const Building&) = default; | |
| 56 | 1 | Building& operator=(Building&&) = default; | |
| 57 | |||
| 58 | //@} | ||
| 59 | |||
| 60 | static IddObjectType iddObjectType(); | ||
| 61 | |||
| 62 | /** @name Getters */ | ||
| 63 | //@{ | ||
| 64 | |||
| 65 | double northAxis() const; | ||
| 66 | bool isNorthAxisDefaulted() const; | ||
| 67 | |||
| 68 | boost::optional<double> nominalFloortoFloorHeight() const; | ||
| 69 | |||
| 70 | boost::optional<int> standardsNumberOfStories() const; | ||
| 71 | |||
| 72 | boost::optional<int> standardsNumberOfAboveGroundStories() const; | ||
| 73 | |||
| 74 | boost::optional<int> standardsNumberOfLivingUnits() const; | ||
| 75 | |||
| 76 | boost::optional<double> nominalFloortoCeilingHeight() const; | ||
| 77 | |||
| 78 | /// Returns the standards Template. This is a freeform field used to identify the energy standard template for standards. | ||
| 79 | /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc. | ||
| 80 | /// More information can be found at https://github.com/NREL/openstudio-standards. | ||
| 81 | boost::optional<std::string> standardsTemplate() const; | ||
| 82 | |||
| 83 | /** | ||
| 84 | * Returns a list of suggestions from the openstudio-standards JSON data. | ||
| 85 | * If standardsTemplate is not empty, and not already present in the suggestions, | ||
| 86 | * it is added to the list of suggestion | ||
| 87 | */ | ||
| 88 | std::vector<std::string> suggestedStandardsTemplates() const; | ||
| 89 | |||
| 90 | /// Returns the standards building type. This is a freeform field used to identify the building type for standards. | ||
| 91 | /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc. | ||
| 92 | /// More information can be found at https://github.com/NREL/openstudio-standards. | ||
| 93 | boost::optional<std::string> standardsBuildingType() const; | ||
| 94 | |||
| 95 | /** | ||
| 96 | * Returns a list of suggestions from the openstudio-standards JSON data. | ||
| 97 | * If standardsBuildingType is not empty, and not already present in the suggestions, | ||
| 98 | * it is added to the list of suggestion | ||
| 99 | */ | ||
| 100 | std::vector<std::string> suggestedStandardsBuildingTypes() const; | ||
| 101 | |||
| 102 | bool relocatable() const; | ||
| 103 | bool isRelocatableDefaulted() const; | ||
| 104 | |||
| 105 | /// Returns the default schedule set for the specified type if available by searching (in order): | ||
| 106 | /// The building's default schedule set | ||
| 107 | /// The building's space type's default schedule set | ||
| 108 | boost::optional<Schedule> getDefaultSchedule(const DefaultScheduleType& defaultScheduleType) const; | ||
| 109 | |||
| 110 | //@} | ||
| 111 | /** @name Setters */ | ||
| 112 | //@{ | ||
| 113 | |||
| 114 | bool setNorthAxis(double northAxis); | ||
| 115 | void resetNorthAxis(); | ||
| 116 | |||
| 117 | bool setNominalFloortoFloorHeight(double nominalFloortoFloorHeight); | ||
| 118 | void resetNominalFloortoFloorHeight(); | ||
| 119 | |||
| 120 | bool setStandardsNumberOfStories(int value); | ||
| 121 | void resetStandardsNumberOfStories(); | ||
| 122 | |||
| 123 | bool setStandardsNumberOfAboveGroundStories(int value); | ||
| 124 | void resetStandardsNumberOfAboveGroundStories(); | ||
| 125 | |||
| 126 | bool setStandardsNumberOfLivingUnits(int value); | ||
| 127 | void resetStandardsNumberOfLivingUnits(); | ||
| 128 | |||
| 129 | bool setNominalFloortoCeilingHeight(double nominalFloortoCeilingHeight); | ||
| 130 | void resetNominalFloortoCeilingHeight(); | ||
| 131 | |||
| 132 | /// Sets the standards Template. This is a freeform field used to identify the energy standard template for standards. | ||
| 133 | /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc. | ||
| 134 | /// More information can be found at https://github.com/NREL/openstudio-standards. | ||
| 135 | bool setStandardsTemplate(const std::string& standardsTemplate); | ||
| 136 | void resetStandardsTemplate(); | ||
| 137 | |||
| 138 | /// Sets the standards building type. This is a freeform field used to identify the building type for standards. | ||
| 139 | /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc. | ||
| 140 | /// More information can be found at https://github.com/NREL/openstudio-standards. | ||
| 141 | bool setStandardsBuildingType(const std::string& standardsBuildingType); | ||
| 142 | void resetStandardsBuildingType(); | ||
| 143 | |||
| 144 | bool setRelocatable(bool isRelocatable); | ||
| 145 | void setRelocatableNoFail(bool isRelocatable); | ||
| 146 | void resetRelocatable(); | ||
| 147 | |||
| 148 | //@} | ||
| 149 | /** @name Other */ | ||
| 150 | //@{ | ||
| 151 | |||
| 152 | /// Returns the building's space type. | ||
| 153 | boost::optional<SpaceType> spaceType() const; | ||
| 154 | |||
| 155 | /// Sets the building's space type. | ||
| 156 | bool setSpaceType(const SpaceType& spaceType); | ||
| 157 | |||
| 158 | /// Resets the building's space type. | ||
| 159 | void resetSpaceType(); | ||
| 160 | |||
| 161 | /// Returns the default construction set that this space references directly. | ||
| 162 | boost::optional<DefaultConstructionSet> defaultConstructionSet() const; | ||
| 163 | |||
| 164 | /// Sets the default construction set for this space directly. | ||
| 165 | bool setDefaultConstructionSet(const DefaultConstructionSet& defaultConstructionSet); | ||
| 166 | |||
| 167 | /// Resets the default construction set for this space. | ||
| 168 | void resetDefaultConstructionSet(); | ||
| 169 | |||
| 170 | /// Returns the default schedule set that this space references directly. | ||
| 171 | boost::optional<DefaultScheduleSet> defaultScheduleSet() const; | ||
| 172 | |||
| 173 | /// Sets the default schedule set for this space directly. | ||
| 174 | bool setDefaultScheduleSet(const DefaultScheduleSet& defaultScheduleSet); | ||
| 175 | |||
| 176 | /// Resets the default schedule set for this space. | ||
| 177 | void resetDefaultScheduleSet(); | ||
| 178 | |||
| 179 | /// Returns all OutputMeter objects at the Building level. | ||
| 180 | std::vector<OutputMeter> meters() const; | ||
| 181 | |||
| 182 | /// Returns all \link BuildingStory BuildingStories\endlink objects in the Building | ||
| 183 | std::vector<BuildingStory> buildingStories() const; | ||
| 184 | |||
| 185 | /// Returns the parent Facility object if it exists. | ||
| 186 | boost::optional<Facility> facility() const; | ||
| 187 | |||
| 188 | // ETH@20140115 - Should take a bool as to whether to include spaces marked as | ||
| 189 | // "not in floor area". | ||
| 190 | /// Returns all of the \link Space Spaces\endlink in the Building. | ||
| 191 | std::vector<Space> spaces() const; | ||
| 192 | |||
| 193 | /// Returns all \link ShadingSurfaceGroup ShadingSurfaceGroups\endlink at the Building level. | ||
| 194 | std::vector<ShadingSurfaceGroup> shadingSurfaceGroups() const; | ||
| 195 | |||
| 196 | /// Returns all of the \link ThermalZone ThermalZones\endlink in the Building. | ||
| 197 | std::vector<ThermalZone> thermalZones() const; | ||
| 198 | |||
| 199 | /// Returns all \link Surface Surfaces\endlink which are exterior walls. | ||
| 200 | std::vector<Surface> exteriorWalls() const; | ||
| 201 | |||
| 202 | /// Returns all \link Surface Surfaces\endlink which are roofs. | ||
| 203 | std::vector<Surface> roofs() const; | ||
| 204 | |||
| 205 | // ETH@20140115 - Should take a bool as to whether to include spaces marked as | ||
| 206 | // "not in floor area". | ||
| 207 | /// Returns the total floor area in square meters. | ||
| 208 | /// Includes only spaces marked as included in floor area. | ||
| 209 | /// Includes space multipliers in calculation. | ||
| 210 | double floorArea() const; | ||
| 211 | |||
| 212 | /// Returns the conditioned floor area in square meters. Currently requires EnergyPlus | ||
| 213 | /// simulation output to calculate. | ||
| 214 | boost::optional<double> conditionedFloorArea() const; | ||
| 215 | |||
| 216 | // ETH@20140115 - Should take a bool as to whether to include spaces marked as | ||
| 217 | // "not in floor area". | ||
| 218 | /** Returns the total exterior surface area (m^2). Includes space multipliers in | ||
| 219 | * calculation. */ | ||
| 220 | double exteriorSurfaceArea() const; | ||
| 221 | |||
| 222 | // ETH@20140115 - Should take a bool as to whether to include spaces marked as | ||
| 223 | // "not in floor area". | ||
| 224 | /** Returns the total exterior wall area (m^2). Includes space multipliers in the | ||
| 225 | * calculation. */ | ||
| 226 | double exteriorWallArea() const; | ||
| 227 | |||
| 228 | // ETH@20140115 - Should take a bool as to whether to include spaces marked as | ||
| 229 | // "not in floor area". | ||
| 230 | /** Returns the total air volume (m^3) in the building. Includes space multipliers | ||
| 231 | * in the calculation. */ | ||
| 232 | double airVolume() const; | ||
| 233 | |||
| 234 | // ETH@20140115 - Should take a bool as to whether to include spaces marked as | ||
| 235 | // "not in floor area". (Etc. for the rest of the getters like this.) | ||
| 236 | /** Returns the number of people in the building. */ | ||
| 237 | double numberOfPeople() const; | ||
| 238 | |||
| 239 | /** Returns the number of people per floor area (people/m^2). */ | ||
| 240 | double peoplePerFloorArea() const; | ||
| 241 | |||
| 242 | /** Returns the total floor area per person in this building (m^2/person). */ | ||
| 243 | double floorAreaPerPerson() const; | ||
| 244 | |||
| 245 | /** Returns the lighting power (W) in this building. */ | ||
| 246 | double lightingPower() const; | ||
| 247 | |||
| 248 | /** Returns the lighting power density (W/m^2) of this building. */ | ||
| 249 | double lightingPowerPerFloorArea() const; | ||
| 250 | |||
| 251 | /** Returns the lighting power per person (W/person) of this building. */ | ||
| 252 | double lightingPowerPerPerson() const; | ||
| 253 | |||
| 254 | /** Returns the electric equipment power (W) of this building. */ | ||
| 255 | double electricEquipmentPower() const; | ||
| 256 | |||
| 257 | /** Returns the electric equipment power density (W/m^2) of this building. */ | ||
| 258 | double electricEquipmentPowerPerFloorArea() const; | ||
| 259 | |||
| 260 | /** Returns the electric equipment power per person (W/person) of this building. */ | ||
| 261 | double electricEquipmentPowerPerPerson() const; | ||
| 262 | |||
| 263 | /** Returns the gas equipment power (W) of this building. */ | ||
| 264 | double gasEquipmentPower() const; | ||
| 265 | |||
| 266 | /** Returns the gas equipment power density (W/m^2) of this building. */ | ||
| 267 | double gasEquipmentPowerPerFloorArea() const; | ||
| 268 | |||
| 269 | /** Returns the gas equipment power per person (W/person) of this building. */ | ||
| 270 | double gasEquipmentPowerPerPerson() const; | ||
| 271 | |||
| 272 | /** Returns the hot water equipment power (W) of this building. */ | ||
| 273 | double hotWaterEquipmentPower() const; | ||
| 274 | |||
| 275 | /** Returns the hot water equipment power density (W/m^2) of this building. */ | ||
| 276 | double hotWaterEquipmentPowerPerFloorArea() const; | ||
| 277 | |||
| 278 | /** Returns the hot water equipment power per person (W/person) of this building. */ | ||
| 279 | double hotWaterEquipmentPowerPerPerson() const; | ||
| 280 | |||
| 281 | /** Returns the infiltration design flow rate (m^3/s) of this building. Ignores | ||
| 282 | * SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */ | ||
| 283 | double infiltrationDesignFlowRate() const; | ||
| 284 | |||
| 285 | /** Returns the infiltration design flow per space floor area (m^3/m^2*s) of this building. | ||
| 286 | * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */ | ||
| 287 | double infiltrationDesignFlowPerSpaceFloorArea() const; | ||
| 288 | |||
| 289 | /** Returns the infiltration design flow per exterior surface area (m^3/m^2*s) of this building. | ||
| 290 | * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */ | ||
| 291 | double infiltrationDesignFlowPerExteriorSurfaceArea() const; | ||
| 292 | |||
| 293 | /** Returns the infiltration design flow per exterior wall area (m^3/m^2*s) of this building. | ||
| 294 | * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */ | ||
| 295 | double infiltrationDesignFlowPerExteriorWallArea() const; | ||
| 296 | |||
| 297 | /** Returns the infiltration design air changes per hour (1/h) of this building. | ||
| 298 | * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */ | ||
| 299 | double infiltrationDesignAirChangesPerHour() const; | ||
| 300 | |||
| 301 | /// Returns the Transformation from the Building coordinate system to world coordinates. | ||
| 302 | Transformation transformation() const; | ||
| 303 | |||
| 304 | /// Returns a suggested pattern for skylights targeting a skylight to floor ratio with desired sizes. | ||
| 305 | /// Pattern will be in Building coordinates, on the z = 0 plane, with normal in positive z direction. | ||
| 306 | std::vector<std::vector<Point3d>> generateSkylightPattern(double skylightToProjectedFloorRatio, double desiredWidth, double desiredHeight) const; | ||
| 307 | |||
| 308 | // Calculates the building perimeter | ||
| 309 | double exteriorPerimeter() const; | ||
| 310 | |||
| 311 | //@} | ||
| 312 | protected: | ||
| 313 | explicit Building(Model& model); | ||
| 314 | |||
| 315 | /// @cond | ||
| 316 | using ImplType = detail::Building_Impl; | ||
| 317 | |||
| 318 | friend class Model; | ||
| 319 | friend class openstudio::IdfObject; | ||
| 320 | |||
| 321 | explicit Building(std::shared_ptr<detail::Building_Impl> impl); | ||
| 322 | |||
| 323 | /// @endcond | ||
| 324 | private: | ||
| 325 | REGISTER_LOGGER("openstudio.model.Building"); | ||
| 326 | }; | ||
| 327 | |||
| 328 | /** \relates Building*/ | ||
| 329 | using OptionalBuilding = boost::optional<Building>; | ||
| 330 | |||
| 331 | /** \relates Building*/ | ||
| 332 | using BuildingVector = std::vector<Building>; | ||
| 333 | |||
| 334 | } // namespace model | ||
| 335 | } // namespace openstudio | ||
| 336 | |||
| 337 | #endif // MODEL_BUILDING_HPP | ||
| 338 |