GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 5 / 1 / 6
Functions: 100.0% 5 / 1 / 6
Branches: -% 0 / 1 / 1

src/model/Space.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_HPP
7 #define MODEL_SPACE_HPP
8
9 #include "ModelAPI.hpp"
10 #include "PlanarSurfaceGroup.hpp"
11
12 namespace openstudio {
13
14 class Polygon3d;
15 class Polyhedron;
16
17 namespace model {
18
19 // forward declarations
20 class SpaceType;
21 class ConstructionBase;
22 class DefaultConstructionSet;
23 class Schedule;
24 class DefaultScheduleType;
25 class DefaultScheduleSet;
26 class ThermalZone;
27 class BuildingStory;
28 class BuildingUnit;
29 class ShadingSurfaceGroup;
30 class InteriorPartitionSurfaceGroup;
31 class PlanarSurface;
32 class Surface;
33 class InternalMass;
34 class People;
35 class Lights;
36 class Luminaire;
37 class ElectricEquipment;
38 class ElectricEquipmentITEAirCooled;
39 class GasEquipment;
40 class HotWaterEquipment;
41 class SteamEquipment;
42 class OtherEquipment;
43 class WaterUseEquipment;
44 class DaylightingControl;
45 class IlluminanceMap;
46 class GlareSensor;
47 class SpaceInfiltrationDesignFlowRate;
48 class SpaceInfiltrationEffectiveLeakageArea;
49 class SpaceInfiltrationFlowCoefficient;
50 class DesignSpecificationOutdoorAir;
51 class ZoneMixing;
52
53 namespace detail {
54
55 class Space_Impl;
56
57 } // namespace detail
58
59 /** Space is a PlanarSurfaceGroup that wraps the OpenStudio IDD object 'OS_Space'. */
60 class MODEL_API Space : public PlanarSurfaceGroup
61 {
62 public:
63 /** @name Constructors and Destructors */
64 //@{
65
66 /// Creates a new space in the model, if a building level space type is defined then
67 /// the space inherits that by default.
68 explicit Space(const Model& model);
69
70 3659341 virtual ~Space() override = default;
71 // Default the copy and move operators because the virtual dtor is explicit
72 10880 Space(const Space& other) = default;
73 2419881 Space(Space&& other) = default;
74 751 Space& operator=(const Space&) = default;
75 7149 Space& operator=(Space&&) = default;
76
77 //@}
78
79 static IddObjectType iddObjectType();
80
81 /// Create a space from a floor print and extrude distance.
82 static boost::optional<Space> fromFloorPrint(const std::vector<Point3d>& floorPrint, double floorHeight, Model& model,
83 const std::string& spaceName = "");
84
85 /** @name Getters */
86 //@{
87
88 bool partofTotalFloorArea() const;
89
90 bool isPartofTotalFloorAreaDefaulted() const;
91
92 //@}
93 /** @name Setters */
94 //@{
95
96 bool setPartofTotalFloorArea(bool partofTotalFloorArea);
97
98 void resetPartofTotalFloorArea();
99
100 bool setCeilingHeight(double ceilingHeight);
101
102 void autocalculateCeilingHeight();
103
104 void resetCeilingHeight();
105
106 bool setVolume(double volume);
107
108 void autocalculateVolume();
109
110 void resetVolume();
111
112 bool setFloorArea(double floorArea);
113
114 void autocalculateFloorArea();
115
116 void resetFloorArea();
117
118 //@}
119 /** @name Other */
120
121 /// Returns the space type for this space.
122 boost::optional<SpaceType> spaceType() const;
123
124 /// Returns true if space type for this space is inherited from the building.
125 bool isSpaceTypeDefaulted() const;
126
127 /// Sets the space type for this space.
128 bool setSpaceType(const SpaceType& spaceType);
129
130 /// Resets the space type for this space.
131 void resetSpaceType();
132
133 /// Returns the default construction set that this space references directly.
134 boost::optional<DefaultConstructionSet> defaultConstructionSet() const;
135
136 /// Returns the default construction for this planar surface if available by searching (in order):
137 /// This space's default construction set, search distance = 1
138 /// This space's space type's default construction set, search distance = 2
139 /// This space's building story's default construction set, search distance = 3
140 /// This space's building's default construction set, search distance = 4
141 /// This space's building's space type's default construction set, search distance = 5
142 boost::optional<ConstructionBase> getDefaultConstruction(const PlanarSurface& planarSurface) const;
143 boost::optional<std::pair<ConstructionBase, int>> getDefaultConstructionWithSearchDistance(const PlanarSurface& planarSurface) const;
144
145 /// Sets the default construction set for this space directly.
146 bool setDefaultConstructionSet(const DefaultConstructionSet& defaultConstructionSet);
147
148 /// Resets the default construction set for this space.
149 void resetDefaultConstructionSet();
150
151 /// Returns the default schedule set that this space references directly.
152 boost::optional<DefaultScheduleSet> defaultScheduleSet() const;
153
154 /// Returns the default schedule set for the specified type if available by searching (in order):
155 /// This space's default schedule set
156 /// This space's space type's default schedule set
157 /// This space's building story's default schedule set
158 /// The building's default schedule set
159 /// The building's space type's default schedule set
160 boost::optional<Schedule> getDefaultSchedule(const DefaultScheduleType& defaultScheduleType) const;
161
162 /// Sets the default schedule set for this space directly.
163 bool setDefaultScheduleSet(const DefaultScheduleSet& defaultScheduleSet);
164
165 /// Resets the default schedule set for this space.
166 void resetDefaultScheduleSet();
167
168 // returns the thermal zone if set
169 boost::optional<ThermalZone> thermalZone() const;
170
171 // sets the thermal zone
172 bool setThermalZone(ThermalZone& thermalZone);
173
174 // resets the thermal zone
175 void resetThermalZone();
176
177 // returns the building story if set
178 boost::optional<BuildingStory> buildingStory() const;
179
180 // sets the building story
181 bool setBuildingStory(const BuildingStory& buildingStory);
182
183 // resets the building story
184 void resetBuildingStory();
185
186 boost::optional<BuildingUnit> buildingUnit() const;
187
188 bool setBuildingUnit(const BuildingUnit& buildingUnit);
189
190 void resetBuildingUnit();
191
192 /// Returns all \link ShadingSurfaceGroup ShadingSurfaceGroups \endlink in this space.
193 std::vector<ShadingSurfaceGroup> shadingSurfaceGroups() const;
194
195 /// Returns all \link InteriorPartitionSurfaceGroup InteriorPartitionSurfaceGroups \endlink in this space.
196 std::vector<InteriorPartitionSurfaceGroup> interiorPartitionSurfaceGroups() const;
197
198 /// Returns all \link Surface Surfaces \endlink in this space.
199 std::vector<Surface> surfaces() const;
200
201 /// Returns all InternalMass in this space.
202 std::vector<InternalMass> internalMass() const;
203
204 /// Returns all People in this space.
205 std::vector<People> people() const;
206
207 /// Returns all Lights in this space.
208 std::vector<Lights> lights() const;
209
210 /// Returns all \link Luminaire Luminaires \endlink in this space.
211 std::vector<Luminaire> luminaires() const;
212
213 /// Returns all ElectricEquipment in this space.
214 std::vector<ElectricEquipment> electricEquipment() const;
215
216 /// Returns all ElectricEquipmentITEAirCooled in this space.
217 std::vector<ElectricEquipmentITEAirCooled> electricEquipmentITEAirCooled() const;
218
219 /// Returns all GasEquipment in this space.
220 std::vector<GasEquipment> gasEquipment() const;
221
222 /// Returns all HotWaterEquipment in this space.
223 std::vector<HotWaterEquipment> hotWaterEquipment() const;
224
225 /// Returns all SteamEquipment in this space.
226 std::vector<SteamEquipment> steamEquipment() const;
227
228 /// Returns all OtherEquipment in this space.
229 std::vector<OtherEquipment> otherEquipment() const;
230
231 /// Returns all WaterUseEquipment in this space.
232 std::vector<WaterUseEquipment> waterUseEquipment() const;
233
234 /// Returns all DaylightingControls in this space.
235 std::vector<DaylightingControl> daylightingControls() const;
236
237 /// Returns all IlluminanceMaps in this space.
238 std::vector<IlluminanceMap> illuminanceMaps() const;
239
240 /// Returns all GlareSensors in this space.
241 std::vector<GlareSensor> glareSensors() const;
242
243 /// Returns all SpaceInfiltrationDesignFlowRate objects in this space.
244 std::vector<SpaceInfiltrationDesignFlowRate> spaceInfiltrationDesignFlowRates() const;
245
246 /// Returns all SpaceInfiltrationEffectiveLeakageArea objects in this space.
247 std::vector<SpaceInfiltrationEffectiveLeakageArea> spaceInfiltrationEffectiveLeakageAreas() const;
248
249 /// Returns all SpaceInfiltrationFlowCoefficient objects in this space.
250 std::vector<SpaceInfiltrationFlowCoefficient> spaceInfiltrationFlowCoefficients() const;
251
252 /// Returns DesignSpecificationOutdoorAir for this space, if not set directly on this space then
253 /// the SpaceType's DesignSpecificationOutdoorAir will be returned.
254 boost::optional<DesignSpecificationOutdoorAir> designSpecificationOutdoorAir() const;
255
256 /// Returns true if DesignSpecificationOutdoorAir is not directly specified for this space.
257 bool isDesignSpecificationOutdoorAirDefaulted() const;
258
259 /// Sets DesignSpecificationOutdoorAir for this space.
260 bool setDesignSpecificationOutdoorAir(const DesignSpecificationOutdoorAir& designSpecificationOutdoorAir);
261
262 /// Resets DesignSpecificationOutdoorAir for this space.
263 void resetDesignSpecificationOutdoorAir();
264
265 /// Returns the multiplier for this space, comes from thermal zone, defaults to 1.
266 int multiplier() const;
267
268 /// Returns the exterior area (gross area of surfaces with outdoor boundary condition) (m^2).
269 /// Does not include space multiplier in calculation.
270 double exteriorArea() const;
271
272 /// Returns the exterior wall area (gross area of surfaces with outdoor boundary condition) (m^2).
273 /// Does not include space multiplier in calculation.
274 double exteriorWallArea() const;
275
276 /// Returns the ceiling height (m).
277 /// Does not include space multiplier in calculation.
278 double ceilingHeight() const;
279
280 bool isCeilingHeightDefaulted() const;
281
282 bool isCeilingHeightAutocalculated() const;
283
284 /// Returns the volume (m^3).
285 /// Does not include space multiplier in calculation.
286 double volume() const;
287
288 bool isVolumeDefaulted() const;
289
290 bool isVolumeAutocalculated() const;
291
292 /// Returns the floor area (m^2).
293 /// Does not include area of floor surfaces which are air walls.
294 /// Does not consider if space is included in building floor area.
295 /// Does not include space multiplier in calculation.
296 double floorArea() const;
297
298 bool isFloorAreaDefaulted() const;
299
300 bool isFloorAreaAutocalculated() const;
301
302 /** Returns the number of people in the space (people). */
303 /// Does not include space multiplier in calculation.
304 /// Does include people multiplier in calculation.
305 double numberOfPeople() const;
306
307 /** Sets the number of people in this space by using people()[0], if it exists, as a template
308 * for the remaining People and People definition parameters. All other people() in this
309 * SpaceType will be removed, the SpaceType will be made unique and modified, if necessary, and
310 * the final People object will be attached directly to this Space, not to a SpaceType. */
311 bool setNumberOfPeople(double numberOfPeople);
312
313 /** Sets the number of people in this space using templatePeople as a template for the remaining
314 * People and People definition parameters. All other people() in this SpaceType will be
315 * removed, the SpaceType will be made unique and modified, if necessary, and the final People
316 * object will be attached directly to this Space, not to a SpaceType. */
317 bool setNumberOfPeople(double numberOfPeople, const People& templatePeople);
318
319 /** Returns the total people per floor area in this space (people/m^2). */
320 /// Does not include space multiplier in calculation.
321 /// Does include people multiplier in calculation.
322 double peoplePerFloorArea() const;
323
324 /** Sets the people per floor area in this space by using people()[0], if it exists, as a
325 * template for the remaining People and People definition parameters. All other people() in
326 * this SpaceType will be removed, the SpaceType will be made unique and modified, if
327 * necessary, and the final People object will be attached directly to this Space, not to a
328 * SpaceType. */
329 bool setPeoplePerFloorArea(double peoplePerFloorArea);
330
331 /** Sets the people per floor area in this space using templatePeople as a template for the
332 * remaining People and People definition parameters. All other people() in this SpaceType will
333 * be removed, the SpaceType will be made unique and modified, if necessary, and the final
334 * People object will be attached directly to this Space, not to a SpaceType. */
335 bool setPeoplePerFloorArea(double peoplePerFloorArea, const People& templatePeople);
336
337 /** Returns the total floor area per person in this space (m^2/person). */
338 /// Does not include space multiplier in calculation.
339 /// Does include people multiplier in calculation.
340 double floorAreaPerPerson() const;
341
342 /** Sets the floor area per person in this space by using people()[0], if it exists, as a
343 * template for the remaining People and People definition parameters. All other people() in
344 * this SpaceType will be removed, the SpaceType will be made unique and modified, if
345 * necessary, and the final People object will be attached directly to this Space, not to a
346 * SpaceType. */
347 bool setFloorAreaPerPerson(double floorAreaPerPerson);
348
349 /** Sets the floor area per person in this Space using templatePeople as a template for the
350 * remaining People and People definition parameters. All other people() in this SpaceType will
351 * be removed, the SpaceType will be made unique and modified, if necessary, and the final
352 * People object will be attached directly to this Space, not to a SpaceType. */
353 bool setFloorAreaPerPerson(double floorAreaPerPerson, const People& templatePeople);
354
355 /** Returns the lighting power (W) of this space. */
356 /// Does not include space multiplier in calculation.
357 /// Does include lighting multiplier in calculation.
358 double lightingPower() const;
359
360 /** Sets the lighting power in this space by using lights()[0], if it exists, as a template
361 * for the remaining Lights and Lights Definition parameters. All other lights() and luminaires()
362 * in this space will be removed, the SpaceType will be made unique and modified, if necessary, and
363 * the final Lights object will be attached directly to this Space, not to a SpaceType. */
364 bool setLightingPower(double lightingPower);
365
366 /** Sets the lighting power in this space using templateLights as a template for the remaining
367 * Lights and Lights Definition parameters. All other lights() and luminaires in this space
368 * will be removed, the SpaceType will be made unique and modified, if necessary, and the final
369 * Lights object will be attached directly to this Space, not to a SpaceType. */
370 bool setLightingPower(double lightingPower, const Lights& templateLights);
371
372 /** Returns the lighting power density (W/m^2) of this zone. */
373 /// Does not include space multiplier in calculation.
374 /// Does include lighting multiplier in calculation.
375 double lightingPowerPerFloorArea() const;
376
377 /** Sets the lighting power per floor area in this space by using lights()[0], if it exists, as a
378 * template for the remaining Lights and Lights Definition parameters. All other lights() and
379 * luminaires() in this space will be removed, the SpaceType will be made unique and modified, if
380 * necessary, and the final Lights object will be attached directly to this Space, not to a
381 * SpaceType. */
382 bool setLightingPowerPerFloorArea(double lightingPowerPerFloorArea);
383
384 /** Sets the lighting power per floor area in this space using templateLights as a template for
385 * the remaining Lights and Lights Definition parameters. All other lights() and luminaires()
386 * in this space will be removed, the SpaceType will be made unique and modified, if necessary,
387 * and the final Lights object will be attached directly to this Space, not to a SpaceType. */
388 bool setLightingPowerPerFloorArea(double lightingPowerPerFloorArea, const Lights& templateLights);
389
390 /** Returns the lighting power per person (W/person) of this zone. */
391 /// Does not include space multiplier in calculation.
392 /// Does include lighting multiplier in calculation.
393 double lightingPowerPerPerson() const;
394
395 /** Sets the lighting power per person in this space by using lights()[0], if it exists, as a
396 * template for the remaining Lights and Lights Definition parameters. All other lights() and
397 * luminaires() in this space will be removed, the SpaceType will be made unique and modified, if
398 * necessary, and the final Lights object will be attached directly to this Space, not to a
399 * SpaceType. */
400 bool setLightingPowerPerPerson(double lightingPowerPerPerson);
401
402 /** Sets the lighting power per person in this space using templateLights as a template for
403 * the remaining Lights and Lights Definition parameters. All other lights() and luminaires()
404 * in this space will be removed, the SpaceType will be made unique and modified, if necessary,
405 * and the final Lights object will be attached directly to this Space, not to a SpaceType. */
406 bool setLightingPowerPerPerson(double lightingPowerPerPerson, const Lights& templateLights);
407
408 /** Returns the electric equipment power (W) of this space. */
409 /// Does not include space multiplier in calculation.
410 /// Does include equipment multiplier in calculation.
411 double electricEquipmentPower() const;
412
413 /** Sets the electric equipment power in this space by using electricEquipment()[0], if it
414 * exists, as a template for the remaining ElectricEquipment and ElectricEquipment Definition
415 * parameters. All other electricEquipment() in this space will be removed, the SpaceType will
416 * be made unique and modified, if necessary, and the final ElectricEquipment object will be
417 * attached directly to this Space, not to a SpaceType. */
418 bool setElectricEquipmentPower(double electricEquipmentPower);
419
420 /** Sets the electric equipment power in this space using templateElectricEquipment as a
421 * template for the remaining ElectricEquipment and ElectricEquipment Definition parameters.
422 * All other electricEquipment() in this space will be removed, the SpaceType will be made
423 * unique and modified, if necessary, and the final ElectricEquipment object will be attached
424 * directly to this Space, not to a SpaceType. */
425 bool setElectricEquipmentPower(double electricEquipmentPower, const ElectricEquipment& templateElectricEquipment);
426
427 /** Returns the electric equipment power density (W/m^2) of this space. */
428 /// Does not include space multiplier in calculation.
429 /// Does include equipment multiplier in calculation.
430 double electricEquipmentPowerPerFloorArea() const;
431
432 /** Sets the electric equipment power per floor area in this space by using
433 * electricEquipment()[0], if it exists, as a template for the remaining ElectricEquipment
434 * and ElectricEquipment Definition parameters. All other electricEquipment() in this space
435 * will be removed, the SpaceType will be made unique and modified, if necessary, and the
436 * final ElectricEquipment object will be attached directly to this Space, not to a
437 * SpaceType. */
438 bool setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea);
439
440 /** Sets the electric equipment power per floor area in this space using
441 * templateElectricEquipment as a template for the remaining ElectricEquipment and
442 * ElectricEquipment Definition parameters. All other electricEquipment() in this space will
443 * be removed, the SpaceType will be made unique and modified, if necessary, and the final
444 * ElectricEquipment object will be attached directly to this Space, not to a SpaceType. */
445 bool setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea, const ElectricEquipment& templateElectricEquipment);
446
447 /** Returns the electric equipment power per person (W/person) of this space. */
448 /// Does not include space multiplier in calculation.
449 /// Does include equipment multiplier in calculation.
450 double electricEquipmentPowerPerPerson() const;
451
452 /** Sets the electric equipment power per person in this space by using electricEquipment()[0],
453 * if it exists, as a template for the remaining ElectricEquipment and ElectricEquipment
454 * Definition parameters. All other electricEquipment() in this space will be removed, the
455 * SpaceType will be made unique and modified, if necessary, and the final ElectricEquipment
456 * object will be attached directly to this Space, not to a SpaceType. */
457 bool setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson);
458
459 /** Sets the electric equipment power per person in this space using templateElectricEquipment
460 * as a template for the remaining ElectricEquipment and ElectricEquipment Definition
461 * parameters. All other electricEquipment() in this space will be removed, the SpaceType will
462 * be made unique and modified, if necessary, and the final ElectricEquipment object will be
463 * attached directly to this Space, not to a SpaceType. */
464 bool setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson, const ElectricEquipment& templateElectricEquipment);
465
466 /** Returns the IT equipment power (W) of this space. */
467 /// Does not include space multiplier in calculation.
468 /// Does include equipment multiplier in calculation.
469 double electricEquipmentITEAirCooledPower() const;
470
471 /** Returns the IT equipment power density (W/m^2) of this space. */
472 /// Does not include space multiplier in calculation.
473 /// Does include equipment multiplier in calculation.
474 double electricEquipmentITEAirCooledPowerPerFloorArea() const;
475
476 /** Returns the gas equipment power (W) of this space. */
477 /// Does not include space multiplier in calculation.
478 /// Does include equipment multiplier in calculation.
479 double gasEquipmentPower() const;
480
481 /** Sets the gas equipment power in this space by using gasEquipment()[0], if it
482 * exists, as a template for the remaining GasEquipment and GasEquipment Definition
483 * parameters. All other gasEquipment() in this space will be removed, the SpaceType will
484 * be made unique and modified, if necessary, and the final GasEquipment object will be
485 * attached directly to this Space, not to a SpaceType. */
486 bool setGasEquipmentPower(double gasEquipmentPower);
487
488 /** Sets the gas equipment power in this space using templateGasEquipment as a
489 * template for the remaining GasEquipment and GasEquipment Definition parameters.
490 * All other gasEquipment() in this space will be removed, the SpaceType will be made
491 * unique and modified, if necessary, and the final GasEquipment object will be attached
492 * directly to this Space, not to a SpaceType. */
493 bool setGasEquipmentPower(double gasEquipmentPower, const GasEquipment& templateGasEquipment);
494
495 /** Returns the gas equipment power density (W/m^2) of this space. */
496 /// Does not include space multiplier in calculation.
497 /// Does include equipment multiplier in calculation.
498 double gasEquipmentPowerPerFloorArea() const;
499
500 /** Sets the gas equipment power per floor area in this space by using
501 * gasEquipment()[0], if it exists, as a template for the remaining GasEquipment
502 * and GasEquipment Definition parameters. All other gasEquipment() in this space
503 * will be removed, the SpaceType will be made unique and modified, if necessary, and the
504 * final GasEquipment object will be attached directly to this Space, not to a
505 * SpaceType. */
506 bool setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea);
507
508 /** Sets the gas equipment power per floor area in this space using
509 * templateGasEquipment as a template for the remaining GasEquipment and
510 * GasEquipment Definition parameters. All other gasEquipment() in this space will
511 * be removed, the SpaceType will be made unique and modified, if necessary, and the final
512 * GasEquipment object will be attached directly to this Space, not to a SpaceType. */
513 bool setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea, const GasEquipment& templateGasEquipment);
514
515 /** Returns the gas equipment power per person (W/person) of this space. */
516 /// Does not include space multiplier in calculation.
517 /// Does include equipment multiplier in calculation.
518 double gasEquipmentPowerPerPerson() const;
519
520 /** Sets the gas equipment power per person in this space by using gasEquipment()[0],
521 * if it exists, as a template for the remaining GasEquipment and GasEquipment
522 * Definition parameters. All other gasEquipment() in this space will be removed, the
523 * SpaceType will be made unique and modified, if necessary, and the final GasEquipment
524 * object will be attached directly to this Space, not to a SpaceType. */
525 bool setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson);
526
527 /** Sets the gas equipment power per person in this space using templateGasEquipment
528 * as a template for the remaining GasEquipment and GasEquipment Definition
529 * parameters. All other gasEquipment() in this space will be removed, the SpaceType will
530 * be made unique and modified, if necessary, and the final GasEquipment object will be
531 * attached directly to this Space, not to a SpaceType. */
532 bool setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson, const GasEquipment& templateGasEquipment);
533
534 /** Returns the hot water equipment power (W) of this space. */
535 /// Does not include space multiplier in calculation.
536 /// Does include equipment multiplier in calculation.
537 double hotWaterEquipmentPower() const;
538
539 /** Sets the hot water equipment power in this space by using hotWaterEquipment()[0], if it
540 * exists, as a template for the remaining HotWaterEquipment and HotWaterEquipment Definition
541 * parameters. All other hotWaterEquipment() in this space will be removed, the SpaceType will
542 * be made unique and modified, if necessary, and the final HotWaterEquipment object will be
543 * attached directly to this Space, not to a SpaceType. */
544 bool setHotWaterEquipmentPower(double hotWaterEquipmentPower);
545
546 /** Sets the hot water equipment power in this space using templateHotWaterEquipment as a
547 * template for the remaining HotWaterEquipment and HotWaterEquipment Definition parameters.
548 * All other hotWaterEquipment() in this space will be removed, the SpaceType will be made
549 * unique and modified, if necessary, and the final HotWaterEquipment object will be attached
550 * directly to this Space, not to a SpaceType. */
551 bool setHotWaterEquipmentPower(double hotWaterEquipmentPower, const HotWaterEquipment& templateHotWaterEquipment);
552
553 /** Returns the hot water equipment power density (W/m^2) of this space. */
554 /// Does not include space multiplier in calculation.
555 /// Does include equipment multiplier in calculation.
556 double hotWaterEquipmentPowerPerFloorArea() const;
557
558 /** Sets the hot water equipment power per floor area in this space by using
559 * hotWaterEquipment()[0], if it exists, as a template for the remaining HotWaterEquipment
560 * and HotWaterEquipment Definition parameters. All other hotWaterEquipment() in this space
561 * will be removed, the SpaceType will be made unique and modified, if necessary, and the
562 * final HotWaterEquipment object will be attached directly to this Space, not to a
563 * SpaceType. */
564 bool setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea);
565
566 /** Sets the hot water equipment power per floor area in this space using
567 * templateHotWaterEquipment as a template for the remaining HotWaterEquipment and
568 * HotWaterEquipment Definition parameters. All other hotWaterEquipment() in this space will
569 * be removed, the SpaceType will be made unique and modified, if necessary, and the final
570 * HotWaterEquipment object will be attached directly to this Space, not to a SpaceType. */
571 bool setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea, const HotWaterEquipment& templateHotWaterEquipment);
572
573 /** Returns the hot water equipment power per person (W/person) of this space. */
574 /// Does not include space multiplier in calculation.
575 /// Does include equipment multiplier in calculation.
576 double hotWaterEquipmentPowerPerPerson() const;
577
578 /** Sets the hot water equipment power per person in this space by using hotWaterEquipment()[0],
579 * if it exists, as a template for the remaining HotWaterEquipment and HotWaterEquipment
580 * Definition parameters. All other hotWaterEquipment() in this space will be removed, the
581 * SpaceType will be made unique and modified, if necessary, and the final HotWaterEquipment
582 * object will be attached directly to this Space, not to a SpaceType. */
583 bool setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson);
584
585 /** Sets the hot water equipment power per person in this space using templateHotWaterEquipment
586 * as a template for the remaining HotWaterEquipment and HotWaterEquipment Definition
587 * parameters. All other hotWaterEquipment() in this space will be removed, the SpaceType will
588 * be made unique and modified, if necessary, and the final HotWaterEquipment object will be
589 * attached directly to this Space, not to a SpaceType. */
590 bool setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson, const HotWaterEquipment& templateHotWaterEquipment);
591
592 /** Returns the infiltration design flow rate (m^3/s) in the space.
593 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */
594 /// Does not include space multiplier in calculation.
595 double infiltrationDesignFlowRate() const;
596
597 /** Returns the infiltration design flow per space floor area (m^3/m^2*s) in the space.
598 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */
599 /// Does not include space multiplier in calculation.
600 double infiltrationDesignFlowPerSpaceFloorArea() const;
601
602 /** Returns the infiltration design flow per exterior surface area (m^3/m^2*s) in the space.
603 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */
604 /// Does not include space multiplier in calculation.
605 double infiltrationDesignFlowPerExteriorSurfaceArea() const;
606
607 /** Returns the infiltration design flow per exterior wall area (m^3/m^2*s) in the space.
608 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */
609 /// Does not include space multiplier in calculation.
610 double infiltrationDesignFlowPerExteriorWallArea() const;
611
612 /** Returns the infiltration design air changes per hour (1/h) in the space.
613 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. */
614 /// Does not include space multiplier in calculation.
615 double infiltrationDesignAirChangesPerHour() const;
616
617 /** Sets the SpaceInfiltrationDesignFlowRate design flow rate (m^3/s) in this space,
618 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects.
619 * All other spaceInfiltrationDesignFlowRate() in this space will be removed.
620 * The SpaceType will be made unique and modified, if necessary, and the final SpaceInfiltrationDesignFlowRate
621 * object will be attached directly to this Space, not to a SpaceType. */
622 bool setInfiltrationDesignFlowRate(double infiltrationDesignFlowRate);
623
624 /** Sets the SpaceInfiltrationDesignFlowRate design flow per space floor area (m^3/m^2*s) in this space,
625 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects.
626 * All other spaceInfiltrationDesignFlowRate() in this space will be removed.
627 * The SpaceType will be made unique and modified, if necessary, and the final SpaceInfiltrationDesignFlowRate
628 * object will be attached directly to this Space, not to a SpaceType. */
629 bool setInfiltrationDesignFlowPerSpaceFloorArea(double infiltrationDesignFlowPerSpaceFloorArea);
630
631 /** Sets the SpaceInfiltrationDesignFlowRate design flow per exterior surface area (m^3/m^2*s) in this space,
632 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects.
633 * All other spaceInfiltrationDesignFlowRate() in this space will be removed.
634 * The SpaceType will be made unique and modified, if necessary, and the final SpaceInfiltrationDesignFlowRate
635 * object will be attached directly to this Space, not to a SpaceType. */
636 bool setInfiltrationDesignFlowPerExteriorSurfaceArea(double infiltrationDesignFlowPerExteriorSurfaceArea);
637
638 /** Sets the SpaceInfiltrationDesignFlowRate design flow per exterior wall area (m^3/m^2*s) in this space,
639 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects.
640 * All other spaceInfiltrationDesignFlowRate() in this space will be removed.
641 * The SpaceType will be made unique and modified, if necessary, and the final SpaceInfiltrationDesignFlowRate
642 * object will be attached directly to this Space, not to a SpaceType. */
643 bool setInfiltrationDesignFlowPerExteriorWallArea(double infiltrationDesignFlowPerExteriorWallArea);
644
645 /** Sets the SpaceInfiltrationDesignFlowRate design air changes per hour (1/h) in this space,
646 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects.
647 * All other spaceInfiltrationDesignFlowRate() in this space will be removed.
648 * The SpaceType will be made unique and modified, if necessary, and the final SpaceInfiltrationDesignFlowRate
649 * object will be attached directly to this Space, not to a SpaceType. */
650 bool setInfiltrationDesignAirChangesPerHour(double infiltrationDesignAirChangesPerHour);
651
652 /** The following functionality is used by the EnergyPlus translator, the primary aim
653 * is to preserve information while putting the space into a state where it can easily
654 * be translated to EnergyPlus:
655 * Clone the space type if there is a space type
656 * Hard apply schedules to space type loads if there is a space type
657 * Move space loads from space type to space if there is a space type
658 * Merge space type default constructions with space default constructions if there is a space type
659 * Hard apply schedules to space loads
660 * If hard sizing loads, make each space load refer to unique definition and hard size it
661 * Remove the cloned space type if there is a space type
662 */
663 void hardApplySpaceType(bool hardSizeLoads);
664
665 /** Set all schedules for child space loads to their default value if there is one. */
666 void hardApplySpaceLoadSchedules();
667
668 /** Set all constructions for child surfaces to their default value if there is one. */
669 void hardApplyConstructions();
670
671 /** Unmatch any matched surfaces and sub surfaces in this space. */
672 void unmatchSurfaces();
673
674 /** Match surfaces and sub surfaces in this space with those in the other. */
675 void matchSurfaces(Space& other);
676
677 /** Intersect surfaces in this space with those in the other. */
678 void intersectSurfaces(Space& other);
679
680 /** Find surfaces within angular range, specified in degrees and in the site coordinate system, an unset optional means no limit.
681 Values for degrees from North are between 0 and 360 and for degrees tilt they are between 0 and 180.
682 Note that maxDegreesFromNorth may be less than minDegreesFromNorth,
683 e.g. to search between NorthWest and NorthEast set minDegreesFromNorth = 315 and maxDegreesFromNorth = 45.
684 The value of maxDegreesTilt must be greater than or equal to minDegreesTilt. A tolerance of one degree is applied by default.
685 */
686 std::vector<Surface> findSurfaces(boost::optional<double> minDegreesFromNorth, boost::optional<double> maxDegreesFromNorth,
687 boost::optional<double> minDegreesTilt, boost::optional<double> maxDegreesTilt, double tol = 1);
688
689 /** Returns the floor print of the space.
690 Will return empty vector if all floors in space are not on the same x,y plane.
691 */
692 std::vector<Point3d> floorPrint() const;
693
694 /** Return true if the ThermalZone is a plenum, otherwise returns false.
695 */
696 bool isPlenum() const;
697
698 // Calculates the exposed perimeter of a space
699 double exposedPerimeter(const Polygon3d& buildingPerimeter) const;
700
701 Polyhedron polyhedron() const;
702 bool isEnclosedVolume() const;
703
704 /** Returns all ZoneMixing objects associated with this space, includes supply and exhaust mixing objects */
705 std::vector<ZoneMixing> zoneMixing() const;
706
707 /** Returns all ZoneMixing objects which supply air to this space */
708 std::vector<ZoneMixing> supplyZoneMixing() const;
709
710 /** Returns all ZoneMixing objects which exhaust air from this space */
711 std::vector<ZoneMixing> exhaustZoneMixing() const;
712
713 // Find all surfaces where the outwardNormal does not point towards the outside of the Space
714 std::vector<Surface> findSurfacesWithIncorrectOrientation() const;
715
716 // Checks the outwardNormal of every surface points towards the outside of the Space
717 bool areAllSurfacesCorrectlyOriented() const;
718
719 // Returns true if the orientation of any surface has been changed
720 bool fixSurfacesWithIncorrectOrientation();
721
722 /** 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
723 * 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
724 * convex, but it should suit most typical applications */
725 bool isConvex() const;
726
727 /** Checks if every Surface is convex, returns the Concave ones.
728 * Note: having a non convex surface does not necesarilly mean that the Space is not convex
729 * eg: a box with a wall that is split into two L s would return false, while the Space is actually still convex. */
730 std::vector<Surface> findNonConvexSurfaces() const;
731
732 /// @cond
733 void cacheGeometryDiagnostics();
734 void resetCachedGeometryDiagnostics();
735 /// @endcond
736
737 //@}
738 protected:
739 /// @cond
740 using ImplType = detail::Space_Impl;
741
742 friend class Model;
743 friend class openstudio::IdfObject;
744 friend class openstudio::detail::IdfObject_Impl;
745
746 explicit Space(std::shared_ptr<detail::Space_Impl> impl);
747
748 /// @endcond
749 private:
750 − REGISTER_LOGGER("openstudio.model.Space");
751 };
752
753 /** Intersect surfaces within spaces. */
754 MODEL_API void intersectSurfaces(std::vector<Space>& spaces);
755
756 /** Match surfaces and sub surfaces within spaces. */
757 MODEL_API void matchSurfaces(std::vector<Space>& spaces);
758
759 /** Un-match surfaces and sub surfaces within spaces. */
760 MODEL_API void unmatchSurfaces(std::vector<Space>& spaces);
761
762 /// Returns a suggested pattern for skylights targeting a skylight to floor ratio with desired sizes.
763 /// Pattern will be generated in the grid coordinate system, specified by directionOfRelativeNorth.
764 /// directionOfRelativeNorth is rotation of grid clockwise from the Building North Axis, in units of degrees.
765 /// If you want to align skylights with building coordinate system pass directionOfRelativeNorth = 0.
766 /// If you want to align skylights with a space's coordinate system pass in that space's directionofRelativeNorth.
767 /// Resulting pattern will be in Building coordinates, on the z = 0 plane, with normal in positive z direction.
768 MODEL_API std::vector<std::vector<Point3d>> generateSkylightPattern(const std::vector<Space>& spaces, double directionOfRelativeNorth,
769 double skylightToProjectedFloorRatio, double desiredWidth,
770 double desiredHeight);
771
772 /** \relates Space*/
773 using OptionalSpace = boost::optional<Space>;
774
775 /** \relates Space*/
776 using SpaceVector = std::vector<Space>;
777
778 } // namespace model
779 } // namespace openstudio
780
781 #endif // MODEL_SPACE_HPP
782