src/model/Space_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_SPACE_IMPL_HPP | ||
| 7 | #define MODEL_SPACE_IMPL_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "PlanarSurfaceGroup_Impl.hpp" | ||
| 11 | #include "Surface.hpp" | ||
| 12 | |||
| 13 | #include <boost/geometry/geometries/point_xy.hpp> | ||
| 14 | #include <boost/geometry/geometries/adapted/boost_tuple.hpp> | ||
| 15 | |||
| 16 | namespace openstudio { | ||
| 17 | |||
| 18 | class Polygon3d; | ||
| 19 | class Polyhedron; | ||
| 20 | |||
| 21 | namespace model { | ||
| 22 | |||
| 23 | // forward declarations | ||
| 24 | class SpaceType; | ||
| 25 | class ConstructionBase; | ||
| 26 | class DefaultConstructionSet; | ||
| 27 | class Schedule; | ||
| 28 | class DefaultScheduleType; | ||
| 29 | class DefaultScheduleSet; | ||
| 30 | class ThermalZone; | ||
| 31 | class BuildingStory; | ||
| 32 | class BuildingUnit; | ||
| 33 | class ShadingSurfaceGroup; | ||
| 34 | class InteriorPartitionSurfaceGroup; | ||
| 35 | class PlanarSurface; | ||
| 36 | class Surface; | ||
| 37 | class InternalMass; | ||
| 38 | class People; | ||
| 39 | class Lights; | ||
| 40 | class Luminaire; | ||
| 41 | class ElectricEquipment; | ||
| 42 | class ElectricEquipmentITEAirCooled; | ||
| 43 | class GasEquipment; | ||
| 44 | class HotWaterEquipment; | ||
| 45 | class SteamEquipment; | ||
| 46 | class OtherEquipment; | ||
| 47 | class WaterUseEquipment; | ||
| 48 | class DaylightingControl; | ||
| 49 | class IlluminanceMap; | ||
| 50 | class GlareSensor; | ||
| 51 | class SpaceInfiltrationDesignFlowRate; | ||
| 52 | class SpaceInfiltrationEffectiveLeakageArea; | ||
| 53 | class SpaceInfiltrationFlowCoefficient; | ||
| 54 | class DesignSpecificationOutdoorAir; | ||
| 55 | class Space; | ||
| 56 | class ZoneMixing; | ||
| 57 | |||
| 58 | namespace detail { | ||
| 59 | |||
| 60 | /** Space_Impl is a PlanarSurfaceGroup_Impl that is the implementation class for Space.*/ | ||
| 61 | class MODEL_API Space_Impl : public PlanarSurfaceGroup_Impl | ||
| 62 | { | ||
| 63 | |||
| 64 | public: | ||
| 65 | /** @name Constructors and Destructors */ | ||
| 66 | //@{ | ||
| 67 | |||
| 68 | Space_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); | ||
| 69 | |||
| 70 | Space_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); | ||
| 71 | |||
| 72 | Space_Impl(const Space_Impl& other, Model_Impl* model, bool keepHandle); | ||
| 73 | |||
| 74 | 11716 | virtual ~Space_Impl() override = default; | |
| 75 | |||
| 76 | //@} | ||
| 77 | |||
| 78 | // return the parent object in the hierarchy | ||
| 79 | virtual boost::optional<ParentObject> parent() const override; | ||
| 80 | |||
| 81 | // set the parent, child may have to call methods on the parent | ||
| 82 | virtual bool setParent(ParentObject& newParent) override; | ||
| 83 | |||
| 84 | // return any children objects in the hierarchy | ||
| 85 | virtual std::vector<ModelObject> children() const override; | ||
| 86 | |||
| 87 | /// get a vector of allowable children types | ||
| 88 | virtual std::vector<IddObjectType> allowableChildTypes() const override; | ||
| 89 | |||
| 90 | virtual const std::vector<std::string>& outputVariableNames() const override; | ||
| 91 | |||
| 92 | virtual IddObjectType iddObjectType() const override; | ||
| 93 | |||
| 94 | virtual openstudio::Transformation buildingTransformation() const override; | ||
| 95 | |||
| 96 | virtual bool changeTransformation(const openstudio::Transformation& transformation) override; | ||
| 97 | |||
| 98 | virtual openstudio::BoundingBox boundingBox() const override; | ||
| 99 | |||
| 100 | /** @name Getters */ | ||
| 101 | //@{ | ||
| 102 | |||
| 103 | virtual double directionofRelativeNorth() const override; | ||
| 104 | |||
| 105 | virtual bool isDirectionofRelativeNorthDefaulted() const override; | ||
| 106 | |||
| 107 | virtual double xOrigin() const override; | ||
| 108 | |||
| 109 | virtual bool isXOriginDefaulted() const override; | ||
| 110 | |||
| 111 | virtual double yOrigin() const override; | ||
| 112 | |||
| 113 | virtual bool isYOriginDefaulted() const override; | ||
| 114 | |||
| 115 | virtual double zOrigin() const override; | ||
| 116 | |||
| 117 | virtual bool isZOriginDefaulted() const override; | ||
| 118 | |||
| 119 | bool partofTotalFloorArea() const; | ||
| 120 | |||
| 121 | bool isPartofTotalFloorAreaDefaulted() const; | ||
| 122 | |||
| 123 | //@} | ||
| 124 | /** @name Setters */ | ||
| 125 | //@{ | ||
| 126 | |||
| 127 | virtual bool setDirectionofRelativeNorth(double directionofRelativeNorth, bool driverMethod = true) override; | ||
| 128 | |||
| 129 | virtual void resetDirectionofRelativeNorth() override; | ||
| 130 | |||
| 131 | virtual bool setXOrigin(double xOrigin, bool driverMethod = true) override; | ||
| 132 | |||
| 133 | virtual void resetXOrigin() override; | ||
| 134 | |||
| 135 | virtual bool setYOrigin(double yOrigin, bool driverMethod = true) override; | ||
| 136 | |||
| 137 | virtual void resetYOrigin() override; | ||
| 138 | |||
| 139 | virtual bool setZOrigin(double zOrigin, bool driverMethod = true) override; | ||
| 140 | |||
| 141 | virtual void resetZOrigin() override; | ||
| 142 | |||
| 143 | bool setPartofTotalFloorArea(bool partofTotalFloorArea); | ||
| 144 | |||
| 145 | void resetPartofTotalFloorArea(); | ||
| 146 | |||
| 147 | bool setCeilingHeight(double ceilingHeight); | ||
| 148 | |||
| 149 | void autocalculateCeilingHeight(); | ||
| 150 | |||
| 151 | void resetCeilingHeight(); | ||
| 152 | |||
| 153 | bool setVolume(double volume); | ||
| 154 | |||
| 155 | void autocalculateVolume(); | ||
| 156 | |||
| 157 | void resetVolume(); | ||
| 158 | |||
| 159 | bool setFloorArea(double floorArea); | ||
| 160 | |||
| 161 | void autocalculateFloorArea(); | ||
| 162 | |||
| 163 | void resetFloorArea(); | ||
| 164 | |||
| 165 | //@} | ||
| 166 | |||
| 167 | /// Returns the space type for this space. | ||
| 168 | boost::optional<SpaceType> spaceType() const; | ||
| 169 | |||
| 170 | /// Returns true if space type for this space is inherited from the building. | ||
| 171 | bool isSpaceTypeDefaulted() const; | ||
| 172 | |||
| 173 | /// Sets the space type for this space. | ||
| 174 | bool setSpaceType(const SpaceType& spaceType); | ||
| 175 | |||
| 176 | /// Resets the space type for this space. | ||
| 177 | void resetSpaceType(); | ||
| 178 | |||
| 179 | /// Returns the default construction set that this space references directly. | ||
| 180 | boost::optional<DefaultConstructionSet> defaultConstructionSet() const; | ||
| 181 | |||
| 182 | /// Returns the default construction for this planar surface if available by searching (in order): | ||
| 183 | /// This space's default construction set, search distance = 1 | ||
| 184 | /// This space's space type's default construction set, search distance = 2 | ||
| 185 | /// This space's building story's default construction set, search distance = 3 | ||
| 186 | /// The building's default construction set, search distance = 4 | ||
| 187 | /// The building's space type's default construction set, search distance = 5 | ||
| 188 | boost::optional<ConstructionBase> getDefaultConstruction(const PlanarSurface& planarSurface) const; | ||
| 189 | boost::optional<std::pair<ConstructionBase, int>> getDefaultConstructionWithSearchDistance(const PlanarSurface& planarSurface) const; | ||
| 190 | |||
| 191 | /// Sets the default construction set for this space directly. | ||
| 192 | bool setDefaultConstructionSet(const DefaultConstructionSet& defaultConstructionSet); | ||
| 193 | |||
| 194 | /// Resets the default construction set for this space. | ||
| 195 | void resetDefaultConstructionSet(); | ||
| 196 | |||
| 197 | /// Returns the default schedule set. | ||
| 198 | boost::optional<DefaultScheduleSet> defaultScheduleSet() const; | ||
| 199 | |||
| 200 | /// Returns the default schedule set for the specified type if available by searching (in order): | ||
| 201 | /// This space's default schedule set | ||
| 202 | /// This space's space type's default schedule set | ||
| 203 | /// This space's building story's default schedule set | ||
| 204 | /// This space's building's default schedule set | ||
| 205 | /// This space's building's space type's default schedule set | ||
| 206 | boost::optional<Schedule> getDefaultSchedule(const DefaultScheduleType& defaultScheduleType) const; | ||
| 207 | |||
| 208 | /// Sets the default schedule set. | ||
| 209 | bool setDefaultScheduleSet(const DefaultScheduleSet& defaultScheduleSet); | ||
| 210 | |||
| 211 | /// Resets the default schedule set. | ||
| 212 | void resetDefaultScheduleSet(); | ||
| 213 | |||
| 214 | // returns the thermal zone if set | ||
| 215 | boost::optional<ThermalZone> thermalZone() const; | ||
| 216 | |||
| 217 | // sets the thermal zone | ||
| 218 | bool setThermalZone(ThermalZone& thermalZone); | ||
| 219 | |||
| 220 | // resets the thermal zone | ||
| 221 | void resetThermalZone(); | ||
| 222 | |||
| 223 | // returns the building story if set | ||
| 224 | boost::optional<BuildingStory> buildingStory() const; | ||
| 225 | |||
| 226 | // sets the building story | ||
| 227 | bool setBuildingStory(const BuildingStory& buildingStory); | ||
| 228 | |||
| 229 | // resets the building story | ||
| 230 | void resetBuildingStory(); | ||
| 231 | |||
| 232 | boost::optional<BuildingUnit> buildingUnit() const; | ||
| 233 | |||
| 234 | bool setBuildingUnit(const BuildingUnit& buildingUnit); | ||
| 235 | |||
| 236 | void resetBuildingUnit(); | ||
| 237 | |||
| 238 | /// Returns all \link ShadingSurfaceGroup ShadingSurfaceGroups \endlink in this space. | ||
| 239 | std::vector<ShadingSurfaceGroup> shadingSurfaceGroups() const; | ||
| 240 | |||
| 241 | /// Returns all \link InteriorPartitionSurfaceGroup InteriorPartitionSurfaceGroups \endlink in this space. | ||
| 242 | std::vector<InteriorPartitionSurfaceGroup> interiorPartitionSurfaceGroups() const; | ||
| 243 | |||
| 244 | /// Returns all \link Surface Surfaces \endlink in this space. | ||
| 245 | std::vector<Surface> surfaces() const; | ||
| 246 | |||
| 247 | /// Returns all InternalMass in this space. | ||
| 248 | std::vector<InternalMass> internalMass() const; | ||
| 249 | |||
| 250 | /// Returns all People in this space. | ||
| 251 | std::vector<People> people() const; | ||
| 252 | |||
| 253 | /// Returns all Lights in this space. | ||
| 254 | std::vector<Lights> lights() const; | ||
| 255 | |||
| 256 | /// Returns all \link Luminaire Luminaires \endlink in this space. | ||
| 257 | std::vector<Luminaire> luminaires() const; | ||
| 258 | |||
| 259 | /// Returns all ElectricEquipment in this space. | ||
| 260 | std::vector<ElectricEquipment> electricEquipment() const; | ||
| 261 | |||
| 262 | /// Returns all ElectricEquipmentITEAirCooled in this space. | ||
| 263 | std::vector<ElectricEquipmentITEAirCooled> electricEquipmentITEAirCooled() const; | ||
| 264 | |||
| 265 | /// Returns all GasEquipment in this space. | ||
| 266 | std::vector<GasEquipment> gasEquipment() const; | ||
| 267 | |||
| 268 | /// Returns all HotWaterEquipment in this space. | ||
| 269 | std::vector<HotWaterEquipment> hotWaterEquipment() const; | ||
| 270 | |||
| 271 | /// Returns all SteamEquipment in this space. | ||
| 272 | std::vector<SteamEquipment> steamEquipment() const; | ||
| 273 | |||
| 274 | /// Returns all OtherEquipment in this space. | ||
| 275 | std::vector<OtherEquipment> otherEquipment() const; | ||
| 276 | |||
| 277 | /// Returns all WaterUseEquipment in this space. | ||
| 278 | std::vector<WaterUseEquipment> waterUseEquipment() const; | ||
| 279 | |||
| 280 | /// Returns all DaylightingControls in this space. | ||
| 281 | std::vector<DaylightingControl> daylightingControls() const; | ||
| 282 | |||
| 283 | /// Returns all IlluminanceMaps in this space. | ||
| 284 | std::vector<IlluminanceMap> illuminanceMaps() const; | ||
| 285 | |||
| 286 | /// Returns all GlareSensors in this space. | ||
| 287 | std::vector<GlareSensor> glareSensors() const; | ||
| 288 | |||
| 289 | /// Returns all SpaceInfiltrationDesignFlowRate objects in this space. | ||
| 290 | std::vector<SpaceInfiltrationDesignFlowRate> spaceInfiltrationDesignFlowRates() const; | ||
| 291 | |||
| 292 | /// Returns all SpaceInfiltrationEffectiveLeakageArea objects in this space. | ||
| 293 | std::vector<SpaceInfiltrationEffectiveLeakageArea> spaceInfiltrationEffectiveLeakageAreas() const; | ||
| 294 | |||
| 295 | /// Returns all SpaceInfiltrationFlowCoefficient objects in this space. | ||
| 296 | std::vector<SpaceInfiltrationFlowCoefficient> spaceInfiltrationFlowCoefficients() const; | ||
| 297 | |||
| 298 | /// Returns DesignSpecificationOutdoorAir for this space, if not set directly on this space then | ||
| 299 | /// the SpaceType's DesignSpecificationOutdoorAir will be returned. | ||
| 300 | boost::optional<DesignSpecificationOutdoorAir> designSpecificationOutdoorAir() const; | ||
| 301 | |||
| 302 | /// Returns true if DesignSpecificationOutdoorAir is not directly specified for this space. | ||
| 303 | bool isDesignSpecificationOutdoorAirDefaulted() const; | ||
| 304 | |||
| 305 | /// Sets DesignSpecificationOutdoorAir for this space. | ||
| 306 | bool setDesignSpecificationOutdoorAir(const DesignSpecificationOutdoorAir& designSpecificationOutdoorAir); | ||
| 307 | |||
| 308 | /// Resets DesignSpecificationOutdoorAir for this space. | ||
| 309 | void resetDesignSpecificationOutdoorAir(); | ||
| 310 | |||
| 311 | /// Returns the multiplier for this space, comes from thermal zone, defaults to 1. | ||
| 312 | int multiplier() const; | ||
| 313 | |||
| 314 | double exteriorArea() const; | ||
| 315 | |||
| 316 | double exteriorWallArea() const; | ||
| 317 | |||
| 318 | double ceilingHeight() const; | ||
| 319 | |||
| 320 | bool isCeilingHeightDefaulted() const; | ||
| 321 | |||
| 322 | bool isCeilingHeightAutocalculated() const; | ||
| 323 | |||
| 324 | double volume() const; | ||
| 325 | |||
| 326 | bool isVolumeDefaulted() const; | ||
| 327 | |||
| 328 | bool isVolumeAutocalculated() const; | ||
| 329 | |||
| 330 | double floorArea() const; | ||
| 331 | |||
| 332 | bool isFloorAreaDefaulted() const; | ||
| 333 | |||
| 334 | bool isFloorAreaAutocalculated() const; | ||
| 335 | |||
| 336 | double numberOfPeople() const; | ||
| 337 | |||
| 338 | bool setNumberOfPeople(double numberOfPeople); | ||
| 339 | |||
| 340 | bool setNumberOfPeople(double numberOfPeople, const boost::optional<People>& templatePeople); | ||
| 341 | |||
| 342 | double peoplePerFloorArea() const; | ||
| 343 | |||
| 344 | bool setPeoplePerFloorArea(double peoplePerFloorArea); | ||
| 345 | |||
| 346 | bool setPeoplePerFloorArea(double peoplePerFloorArea, const boost::optional<People>& templatePeople); | ||
| 347 | |||
| 348 | double floorAreaPerPerson() const; | ||
| 349 | |||
| 350 | bool setFloorAreaPerPerson(double floorAreaPerPerson); | ||
| 351 | |||
| 352 | bool setFloorAreaPerPerson(double floorAreaPerPerson, const boost::optional<People>& templatePeople); | ||
| 353 | |||
| 354 | double lightingPower() const; | ||
| 355 | |||
| 356 | bool setLightingPower(double lightingPower); | ||
| 357 | |||
| 358 | bool setLightingPower(double lightingPower, const boost::optional<Lights>& templateLights); | ||
| 359 | |||
| 360 | double lightingPowerPerFloorArea() const; | ||
| 361 | |||
| 362 | bool setLightingPowerPerFloorArea(double lightingPowerPerFloorArea); | ||
| 363 | |||
| 364 | bool setLightingPowerPerFloorArea(double lightingPowerPerFloorArea, const boost::optional<Lights>& templateLights); | ||
| 365 | |||
| 366 | double lightingPowerPerPerson() const; | ||
| 367 | |||
| 368 | bool setLightingPowerPerPerson(double lightingPowerPerPerson); | ||
| 369 | |||
| 370 | bool setLightingPowerPerPerson(double lightingPowerPerPerson, const boost::optional<Lights>& templateLights); | ||
| 371 | |||
| 372 | double electricEquipmentPower() const; | ||
| 373 | |||
| 374 | bool setElectricEquipmentPower(double electricEquipmentPower); | ||
| 375 | |||
| 376 | bool setElectricEquipmentPower(double electricEquipmentPower, const boost::optional<ElectricEquipment>& templateElectricEquipment); | ||
| 377 | |||
| 378 | double electricEquipmentPowerPerFloorArea() const; | ||
| 379 | |||
| 380 | bool setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea); | ||
| 381 | |||
| 382 | bool setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea, | ||
| 383 | const boost::optional<ElectricEquipment>& templateElectricEquipment); | ||
| 384 | |||
| 385 | double electricEquipmentPowerPerPerson() const; | ||
| 386 | |||
| 387 | bool setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson); | ||
| 388 | |||
| 389 | bool setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson, | ||
| 390 | const boost::optional<ElectricEquipment>& templateElectricEquipment); | ||
| 391 | |||
| 392 | double electricEquipmentITEAirCooledPower() const; | ||
| 393 | |||
| 394 | double electricEquipmentITEAirCooledPowerPerFloorArea() const; | ||
| 395 | |||
| 396 | double gasEquipmentPower() const; | ||
| 397 | |||
| 398 | bool setGasEquipmentPower(double gasEquipmentPower); | ||
| 399 | |||
| 400 | bool setGasEquipmentPower(double gasEquipmentPower, const boost::optional<GasEquipment>& templateGasEquipment); | ||
| 401 | |||
| 402 | double gasEquipmentPowerPerFloorArea() const; | ||
| 403 | |||
| 404 | bool setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea); | ||
| 405 | |||
| 406 | bool setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea, const boost::optional<GasEquipment>& templateGasEquipment); | ||
| 407 | |||
| 408 | double gasEquipmentPowerPerPerson() const; | ||
| 409 | |||
| 410 | bool setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson); | ||
| 411 | |||
| 412 | bool setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson, const boost::optional<GasEquipment>& templateGasEquipment); | ||
| 413 | |||
| 414 | double hotWaterEquipmentPower() const; | ||
| 415 | |||
| 416 | bool setHotWaterEquipmentPower(double hotWaterEquipmentPower); | ||
| 417 | |||
| 418 | bool setHotWaterEquipmentPower(double hotWaterEquipmentPower, const boost::optional<HotWaterEquipment>& templateHotWaterEquipment); | ||
| 419 | |||
| 420 | double hotWaterEquipmentPowerPerFloorArea() const; | ||
| 421 | |||
| 422 | bool setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea); | ||
| 423 | |||
| 424 | bool setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea, | ||
| 425 | const boost::optional<HotWaterEquipment>& templateHotWaterEquipment); | ||
| 426 | |||
| 427 | double hotWaterEquipmentPowerPerPerson() const; | ||
| 428 | |||
| 429 | bool setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson); | ||
| 430 | |||
| 431 | bool setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson, | ||
| 432 | const boost::optional<HotWaterEquipment>& templateHotWaterEquipment); | ||
| 433 | |||
| 434 | double infiltrationDesignFlowRate() const; | ||
| 435 | |||
| 436 | double infiltrationDesignFlowPerSpaceFloorArea() const; | ||
| 437 | |||
| 438 | double infiltrationDesignFlowPerExteriorSurfaceArea() const; | ||
| 439 | |||
| 440 | double infiltrationDesignFlowPerExteriorWallArea() const; | ||
| 441 | |||
| 442 | double infiltrationDesignAirChangesPerHour() const; | ||
| 443 | |||
| 444 | // Make the SpaceType unique if it already has SpaceInfiltrationDesignFlowRate (spi) objects AND it's used by more than 1 ParentObject | ||
| 445 | // (Building, Space) | ||
| 446 | // Then return a SpaceInfiltrationDesignObject already assigned to the space | ||
| 447 | // * Create one if the space has none | ||
| 448 | // * Return the first found otherwise and remove all other ones | ||
| 449 | // By the end of this function, Space has ONLY ONE spi assigned (incl. on SpaceType) | ||
| 450 | SpaceInfiltrationDesignFlowRate setInfiltrationDesignFlowRateHelper(); | ||
| 451 | |||
| 452 | bool setInfiltrationDesignFlowRate(double infiltrationDesignFlowRate); | ||
| 453 | |||
| 454 | bool setInfiltrationDesignFlowPerSpaceFloorArea(double infiltrationDesignFlowPerSpaceFloorArea); | ||
| 455 | |||
| 456 | bool setInfiltrationDesignFlowPerExteriorSurfaceArea(double infiltrationDesignFlowPerExteriorSurfaceArea); | ||
| 457 | |||
| 458 | bool setInfiltrationDesignFlowPerExteriorWallArea(double infiltrationDesignFlowPerExteriorWallArea); | ||
| 459 | |||
| 460 | bool setInfiltrationDesignAirChangesPerHour(double infiltrationDesignAirChangesPerHour); | ||
| 461 | |||
| 462 | /** The following functionality is used by the EnergyPlus translator, the primary aim | ||
| 463 | * is to preserve information while putting the space into a state where it can easily | ||
| 464 | * be translated to EnergyPlus: | ||
| 465 | * Clone the space type if there is a space type | ||
| 466 | * Hard apply schedules to space type loads if there is a space type | ||
| 467 | * Move space loads from space type to space if there is a space type | ||
| 468 | * Merge space type default constructions with space default constructions if there is a space type | ||
| 469 | * Hard apply schedules to space loads | ||
| 470 | * If hard sizing loads, make each space load refer to unique definition and hard size it | ||
| 471 | * Remove the cloned space type if there is a space type | ||
| 472 | */ | ||
| 473 | void hardApplySpaceType(bool hardSizeLoads); | ||
| 474 | |||
| 475 | /** Set all schedules for child space loads to their default value if there is one. */ | ||
| 476 | void hardApplySpaceLoadSchedules(); | ||
| 477 | |||
| 478 | /** Set all constructions for child surfaces to their default value if there is one. */ | ||
| 479 | void hardApplyConstructions(); | ||
| 480 | |||
| 481 | /** Unmatch any matched surfaces and sub surfaces in this space. */ | ||
| 482 | void unmatchSurfaces(); | ||
| 483 | |||
| 484 | /** Match surfaces and sub surfaces in this space with those in the other. */ | ||
| 485 | void matchSurfaces(Space& other); | ||
| 486 | |||
| 487 | /** Intersect surfaces in this space with those in the other. */ | ||
| 488 | void intersectSurfaces(Space& other); | ||
| 489 | |||
| 490 | /** Find surfaces within angular range, specified in degrees and in the site coordinate system, an unset optional means no limit. | ||
| 491 | Values for degrees from North are between 0 and 360 and for degrees tilt they are between 0 and 180. | ||
| 492 | Note that maxDegreesFromNorth may be less than minDegreesFromNorth, | ||
| 493 | e.g. to search between NorthWest and NorthEast set minDegreesFromNorth = 315 and maxDegreesFromNorth = 45. | ||
| 494 | The value of maxDegreesTilt must be greater than or equal to minDegreesTilt. A tolerance of one degree is applied by default. | ||
| 495 | */ | ||
| 496 | std::vector<Surface> findSurfaces(boost::optional<double> minDegreesFromNorth, boost::optional<double> maxDegreesFromNorth, | ||
| 497 | boost::optional<double> minDegreesTilt, boost::optional<double> maxDegreesTilt, double tol); | ||
| 498 | |||
| 499 | /** Returns the floor print of the space. | ||
| 500 | Will return empty vector if all floors in space are not on the same x,y plane. | ||
| 501 | */ | ||
| 502 | std::vector<Point3d> floorPrint() const; | ||
| 503 | |||
| 504 | bool isPlenum() const; | ||
| 505 | |||
| 506 | double exposedPerimeter(const Polygon3d& buildingPerimeter) const; | ||
| 507 | |||
| 508 | Polyhedron polyhedron() const; | ||
| 509 | bool isEnclosedVolume() const; | ||
| 510 | |||
| 511 | // Find all surfaces where the outwardNormal does not point towards the outside of the Space | ||
| 512 | std::vector<Surface> findSurfacesWithIncorrectOrientation() const; | ||
| 513 | |||
| 514 | std::vector<Surface> findSurfacesWithIncorrectOrientationRaycasting() const; | ||
| 515 | std::vector<Surface> findSurfacesWithIncorrectOrientationPolyhedron(const Polyhedron& volumePoly) const; | ||
| 516 | |||
| 517 | // Checks the outwardNormal of every surface points towards the outside of the Space | ||
| 518 | bool areAllSurfacesCorrectlyOriented() const; | ||
| 519 | |||
| 520 | // Returns true if the orientation of any surface has been changed | ||
| 521 | bool fixSurfacesWithIncorrectOrientation(); | ||
| 522 | |||
| 523 | /** This method will check the floorPrint of the space, if that can't be computed, it's not convex. If it can, it checks whether that resulting | ||
| 524 | * Surface3d is convex. Note: having a floorPrint that's convex isn't sufficied to deem a space to be convex, the walls could still be non | ||
| 525 | * convex, but it should suit most typical applications */ | ||
| 526 | bool isConvex() const; | ||
| 527 | |||
| 528 | /** Checks if every Surface is convex, returns the Concave ones. | ||
| 529 | * Note: having a non convex surface does not necesarilly mean that the Space is not convex | ||
| 530 | * eg: a box with a wall that is split into two L s would return false, while the Space is actually still convex. */ | ||
| 531 | std::vector<Surface> findNonConvexSurfaces() const; | ||
| 532 | |||
| 533 | void cacheGeometryDiagnostics(); | ||
| 534 | void resetCachedGeometryDiagnostics(); | ||
| 535 | |||
| 536 | std::vector<ZoneMixing> zoneMixing() const; | ||
| 537 | std::vector<ZoneMixing> supplyZoneMixing() const; | ||
| 538 | std::vector<ZoneMixing> exhaustZoneMixing() const; | ||
| 539 | |||
| 540 | private: | ||
| 541 | − | REGISTER_LOGGER("openstudio.model.Space"); | |
| 542 | |||
| 543 | boost::optional<ModelObject> spaceTypeAsModelObject() const; | ||
| 544 | boost::optional<ModelObject> defaultConstructionSetAsModelObject() const; | ||
| 545 | boost::optional<ModelObject> defaultScheduleSetAsModelObject() const; | ||
| 546 | boost::optional<ModelObject> thermalZoneAsModelObject() const; | ||
| 547 | boost::optional<ModelObject> buildingStoryAsModelObject() const; | ||
| 548 | std::vector<ModelObject> shadingSurfaceGroupsAsModelObjects() const; | ||
| 549 | std::vector<ModelObject> interiorPartitionSurfaceGroupsAsModelObjects() const; | ||
| 550 | std::vector<ModelObject> surfacesAsModelObjects() const; | ||
| 551 | std::vector<ModelObject> internalMassAsModelObjects() const; | ||
| 552 | std::vector<ModelObject> peopleAsModelObjects() const; | ||
| 553 | std::vector<ModelObject> lightsAsModelObjects() const; | ||
| 554 | std::vector<ModelObject> luminairesAsModelObjects() const; | ||
| 555 | std::vector<ModelObject> electricEquipmentAsModelObjects() const; | ||
| 556 | std::vector<ModelObject> electricEquipmentITEAirCooledAsModelObjects() const; | ||
| 557 | std::vector<ModelObject> gasEquipmentAsModelObjects() const; | ||
| 558 | std::vector<ModelObject> hotWaterEquipmentAsModelObjects() const; | ||
| 559 | std::vector<ModelObject> steamEquipmentAsModelObjects() const; | ||
| 560 | std::vector<ModelObject> otherEquipmentAsModelObjects() const; | ||
| 561 | std::vector<ModelObject> daylightingControlsAsModelObjects() const; | ||
| 562 | std::vector<ModelObject> illuminanceMapsAsModelObjects() const; | ||
| 563 | std::vector<ModelObject> spaceInfiltrationDesignFlowRatesAsModelObjects() const; | ||
| 564 | std::vector<ModelObject> spaceInfiltrationEffectiveLeakageAreasAsModelObjects() const; | ||
| 565 | std::vector<ModelObject> spaceInfiltrationFlowCoefficientsAsModelObjects() const; | ||
| 566 | std::vector<ModelObject> spaceVentilationDesignFlowRatesAsModelObjects() const; | ||
| 567 | |||
| 568 | bool setSpaceTypeAsModelObject(const boost::optional<ModelObject>& modelObject); | ||
| 569 | bool setDefaultConstructionSetAsModelObject(const boost::optional<ModelObject>& modelObject); | ||
| 570 | bool setDefaultScheduleSetAsModelObject(const boost::optional<ModelObject>& modelObject); | ||
| 571 | bool setThermalZoneAsModelObject(const boost::optional<ModelObject>& modelObject); | ||
| 572 | bool setBuildingStoryAsModelObject(const boost::optional<ModelObject>& modelObject); | ||
| 573 | |||
| 574 | template <typename T, typename TDef> | ||
| 575 | boost::optional<T> getMySpaceLoadInstance(const boost::optional<T>& templateSpaceLoadInstance); | ||
| 576 | |||
| 577 | template <typename T> | ||
| 578 | void removeAllButOneSpaceLoadInstance(std::vector<T>& instances, const T& instanceToKeep); | ||
| 579 | |||
| 580 | // helper function to get a boost polygon point from a Point3d | ||
| 581 | boost::tuple<double, double> point3dToTuple(const Point3d& point3d, std::vector<Point3d>& allPoints, double tol) const; | ||
| 582 | |||
| 583 | mutable boost::optional<std::vector<Surface>> m_cachedNonConvexSurfaces; | ||
| 584 | mutable boost::optional<bool> m_cachedIsConvex; | ||
| 585 | mutable boost::optional<bool> m_cachedIsEnclosed; | ||
| 586 | }; | ||
| 587 | |||
| 588 | } // namespace detail | ||
| 589 | |||
| 590 | } // namespace model | ||
| 591 | } // namespace openstudio | ||
| 592 | |||
| 593 | #endif // MODEL_SPACE_IMPL_HPP | ||
| 594 |