GCC Code Coverage Report


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

src/model/SpaceType.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_SPACETYPE_HPP
7 #define MODEL_SPACETYPE_HPP
8
9 #include "ModelAPI.hpp"
10 #include "ResourceObject.hpp"
11
12 namespace openstudio {
13 namespace model {
14
15 // forward declarations
16 class Schedule;
17 class Space;
18 class InternalMass;
19 class People;
20 class Lights;
21 class Luminaire;
22 class ElectricEquipment;
23 class ElectricEquipmentITEAirCooled;
24 class GasEquipment;
25 class HotWaterEquipment;
26 class SteamEquipment;
27 class OtherEquipment;
28 class SpaceInfiltrationDesignFlowRate;
29 class SpaceInfiltrationEffectiveLeakageArea;
30 class SpaceInfiltrationFlowCoefficient;
31 class DefaultConstructionSet;
32 class DefaultScheduleSet;
33 class DefaultScheduleType;
34 class RenderingColor;
35 class DesignSpecificationOutdoorAir;
36
37 namespace detail {
38
39 class MODEL_API SpaceType_Impl;
40
41 } // namespace detail
42
43 /** SpaceType is a ResourceObject that wraps the OpenStudio IDD object 'OS_SpaceType'. */
44 class MODEL_API SpaceType : public ResourceObject
45 {
46 public:
47 /** @name Constructors and Destructors */
48 //@{
49
50 explicit SpaceType(const Model& model);
51
52 328977 virtual ~SpaceType() override = default;
53 // Default the copy and move operators because the virtual dtor is explicit
54 7882 SpaceType(const SpaceType& other) = default;
55 238414 SpaceType(SpaceType&& other) = default;
56 ✗ SpaceType& operator=(const SpaceType&) = default;
57 3602 SpaceType& operator=(SpaceType&&) = default;
58
59 //@}
60
61 static IddObjectType iddObjectType();
62
63 /** @name Getters */
64 //@{
65
66 /// Returns the default construction set.
67 boost::optional<DefaultConstructionSet> defaultConstructionSet() const;
68
69 /// Returns the default schedule set.
70 boost::optional<DefaultScheduleSet> defaultScheduleSet() const;
71
72 /// Returns the rendering color.
73 boost::optional<RenderingColor> renderingColor() const;
74
75 /// Returns the standards Template. This is a freeform field used to identify the energy standard template for standards.
76 /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc.
77 /// More information can be found at https://github.com/NREL/openstudio-standards.
78 /// If Not set, tries to inherit from the Building
79 boost::optional<std::string> standardsTemplate() const;
80
81 /**
82 * Returns a list of suggestions from the openstudio-standards JSON data.
83 * If standardsTemplate is not empty, and not already present in the suggestions,
84 * it is added to the list of suggestion
85 */
86 std::vector<std::string> suggestedStandardsTemplates() const;
87
88 /// Returns the standards building type. This is a freeform field used to identify the building type for standards.
89 /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc.
90 /// More information can be found at https://github.com/NREL/openstudio-standards.
91 /// If Not set, tries to inherit from the Building
92 boost::optional<std::string> standardsBuildingType() const;
93
94 /**
95 * Returns a list of suggestions from the openstudio-standards JSON data.
96 * If standardsBuildingType is not empty, and not already present in the suggestions,
97 * it is added to the list of suggestion
98 */
99 std::vector<std::string> suggestedStandardsBuildingTypes() const;
100
101 /// Returns the standards space type. This is a freeform field used to identify the space type for standards.
102 /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc.
103 /// More information can be found at https://github.com/NREL/openstudio-standards.
104 boost::optional<std::string> standardsSpaceType() const;
105
106 /**
107 * Returns a list of suggestions from the openstudio-standards JSON data.
108 * If standardsSpaceType is not empty, and not already present in the suggestions,
109 * it is added to the list of suggestion
110 */
111 std::vector<std::string> suggestedStandardsSpaceTypes() const;
112
113 //@}
114 /** @name Setters */
115 //@{
116
117 /// Sets the default construction set.
118 bool setDefaultConstructionSet(const DefaultConstructionSet& defaultConstructionSet);
119
120 /// Resets the default construction set.
121 void resetDefaultConstructionSet();
122
123 /// Sets the default schedule set.
124 bool setDefaultScheduleSet(const DefaultScheduleSet& defaultScheduleSet);
125
126 /// Resets the default schedule set.
127 void resetDefaultScheduleSet();
128
129 /// Sets the rendering color.
130 bool setRenderingColor(const RenderingColor& renderingColor);
131
132 /// Resets the rendering color.
133 void resetRenderingColor();
134
135 /// Sets the standards Template. This is a freeform field used to identify the energy standard template for standards.
136 /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc.
137 /// More information can be found at https://github.com/NREL/openstudio-standards.
138 bool setStandardsTemplate(const std::string& standardsTemplate);
139 void resetStandardsTemplate();
140
141 /// Sets the standards building type. This is a freeform field used to identify the building type for standards.
142 /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc.
143 /// More information can be found at https://github.com/NREL/openstudio-standards.
144 bool setStandardsBuildingType(const std::string& standardsBuildingType);
145 void resetStandardsBuildingType();
146
147 /// Sets the standards space type. This is a freeform field used to identify the space type for standards.
148 /// Standards applied to this model will use this field to determine correct levels for lighting, occupancy, etc.
149 /// More information can be found at https://github.com/NREL/openstudio-standards.
150 bool setStandardsSpaceType(const std::string& standardsSpaceType);
151 void resetStandardsSpaceType();
152
153 //@}
154 /** @name Other */
155 //@{
156
157 /// Get all spaces of this space type, includes spaces that inherit this space type
158 std::vector<Space> spaces() const;
159
160 /// Returns the default schedule set for the specified type if available by searching (in order):
161 /// This space types's default schedule set
162 /// The building's default schedule set
163 /// The building's space type's default schedule set
164 boost::optional<Schedule> getDefaultSchedule(const DefaultScheduleType& defaultScheduleType) const;
165
166 /// Returns all InternalMass in this space type.
167 std::vector<InternalMass> internalMass() const;
168
169 /// Returns all People in this space type.
170 std::vector<People> people() const;
171
172 /// Returns all Lights in this space type.
173 std::vector<Lights> lights() const;
174
175 /// Returns all \link Luminaire Luminaires \endlink in this space type.
176 std::vector<Luminaire> luminaires() const;
177
178 /// Returns all ElectricEquipment in this space type.
179 std::vector<ElectricEquipment> electricEquipment() const;
180
181 /// Returns all ElectricEquipmentITEAirCooled in this space type.
182 std::vector<ElectricEquipmentITEAirCooled> electricEquipmentITEAirCooled() const;
183
184 /// Returns all GasEquipment in this space type.
185 std::vector<GasEquipment> gasEquipment() const;
186
187 /// Returns all HotWaterEquipment in this space type.
188 std::vector<HotWaterEquipment> hotWaterEquipment() const;
189
190 /// Returns all SteamEquipment in this space type.
191 std::vector<SteamEquipment> steamEquipment() const;
192
193 /// Returns all OtherEquipment in this space type.
194 std::vector<OtherEquipment> otherEquipment() const;
195
196 /// Returns all SpaceInfiltrationDesignFlowRate objects in this space type.
197 std::vector<SpaceInfiltrationDesignFlowRate> spaceInfiltrationDesignFlowRates() const;
198
199 /// Returns all SpaceInfiltrationEffectiveLeakageArea objects in this space type.
200 std::vector<SpaceInfiltrationEffectiveLeakageArea> spaceInfiltrationEffectiveLeakageAreas() const;
201
202 /// Returns all SpaceInfiltrationFlowCoefficient objects in this space type.
203 std::vector<SpaceInfiltrationFlowCoefficient> spaceInfiltrationFlowCoefficients() const;
204
205 /// Returns DesignSpecificationOutdoorAir for this space type.
206 boost::optional<DesignSpecificationOutdoorAir> designSpecificationOutdoorAir() const;
207
208 /// Returns true if DesignSpecificationOutdoorAir is not directly specified for this space type.
209 bool isDesignSpecificationOutdoorAirDefaulted() const;
210
211 /// Sets DesignSpecificationOutdoorAir for this space type.
212 bool setDesignSpecificationOutdoorAir(const DesignSpecificationOutdoorAir& designSpecificationOutdoorAir);
213
214 /// Resets DesignSpecificationOutdoorAir for this space type.
215 void resetDesignSpecificationOutdoorAir();
216
217 /** Set all schedules for child space loads to their default value if there is one. */
218 void hardApplySpaceLoadSchedules();
219
220 /** Returns the total people per space floor area in this space type, if it can be calculated
221 * directly from the underlying people() data (without knowing floorArea). */
222 boost::optional<double> peoplePerFloorArea() const;
223
224 /** Sets the peoplePerFloorArea, using people()[0], if it exists, as a template for the
225 * remaining People and PeopleDefinition parameters. All other people() in this SpaceType will
226 * be removed. */
227 bool setPeoplePerFloorArea(double peoplePerFloorArea);
228
229 /** Sets the peoplePerFloorArea, using templatePeople as a template for the remaining
230 * People and PeopleDefinition parameters. All people() in this SpaceType (except for
231 * templatePeople, if applicable), will be removed. */
232 bool setPeoplePerFloorArea(double peoplePerFloorArea, const People& templatePeople);
233
234 /** Returns the floor area per person for this space type, if it can be calculated directly
235 * from the underlying people() data (without knowing floorArea). */
236 boost::optional<double> spaceFloorAreaPerPerson() const;
237
238 /** Sets the spaceFloorAreaPerPerson, using people()[0], if it exists, as a template for the
239 * remaining People and PeopleDefinition parameters. All other people() in this SpaceType will
240 * be removed. */
241 bool setSpaceFloorAreaPerPerson(double spaceFloorAreaPerPerson);
242
243 /** Sets the spaceFloorAreaPerPerson, using templatePeople as a template for the remaining
244 * People and PeopleDefinition parameters. All people() in this SpaceType (except for
245 * templatePeople, if applicable), will be removed. */
246 bool setSpaceFloorAreaPerPerson(double spaceFloorAreaPerPerson, const People& templatePeople);
247
248 double getNumberOfPeople(double floorArea) const;
249
250 double getPeoplePerFloorArea(double floorArea) const;
251
252 double getFloorAreaPerPerson(double floorArea) const;
253
254 /** Returns the total lighting power per space floor area, if possible. Only works if there are
255 * no luminaires in the space type, and if all lights are defined on a per space floor area
256 * basis. */
257 boost::optional<double> lightingPowerPerFloorArea() const;
258
259 /** Sets the lightingPowerPerFloorArea, using lights()[0], if it exists, as a template for
260 * the remaining Lights and LightsDefinition parameters. All other lights() and luminaires()
261 * in this SpaceType will be removed. */
262 bool setLightingPowerPerFloorArea(double lightingPowerPerFloorArea);
263
264 /** Sets the lightingPowerPerFloorArea, using templateLights as a template for the remaining
265 * Lights and LightsDefinition parameters. All lights() and luminaires() in this SpaceType
266 * (except for templateLights, if applicable), will be removed. */
267 bool setLightingPowerPerFloorArea(double lightingPowerPerFloorArea, const Lights& templateLights);
268
269 /** Returns the total lighting power per person, if possible. Only works if there are no
270 * luminaires in the space type, and if all lights are defined on a per person basis. */
271 boost::optional<double> lightingPowerPerPerson() const;
272
273 /** Sets the lightingPowerPerPerson, using lights()[0], if it exists, as a template for
274 * the remaining Lights and LightsDefinition parameters. All other lights() and luminaires()
275 * in this SpaceType will be removed. */
276 bool setLightingPowerPerPerson(double lightingPowerPerPerson);
277
278 /** Sets the lightingPowerPerPerson, using templateLights as a template for the remaining
279 * Lights and LightsDefinition parameters. All lights() and luminaires() in this SpaceType
280 * (except for templateLights, if applicable), will be removed. */
281 bool setLightingPowerPerPerson(double lightingPowerPerPerson, const Lights& templateLights);
282
283 /** Returns total lighting power for this space type, including lights and luminaires, assuming
284 * floorArea (m^2) and numPeople. */
285 double getLightingPower(double floorArea, double numPeople) const;
286
287 /** Returns the total lighting watts per space floor area for this space type, including lights
288 * and luminaires, assuming floorArea (m^2) and numPeople. */
289 double getLightingPowerPerFloorArea(double floorArea, double numPeople) const;
290
291 /** Returns the total lighting watts per person for this space type, including lights and
292 * luminaires, assuming floorArea (m^2) and numPeople. */
293 double getLightingPowerPerPerson(double floorArea, double numPeople) const;
294
295 /** Returns the total electric equipment power per space floor area, if it can be calculated
296 * directly from the underlying electricEquipment() data (without knowing floorArea and
297 * numPeople). */
298 boost::optional<double> electricEquipmentPowerPerFloorArea() const;
299
300 /** Sets the electricEquipmentPowerPerFloorArea, using electricEquipment()[0], if it exists,
301 * as a template for the remaining ElectricEquipment and ElectricEquipmentDefinition parameters.
302 * All other electricEquipment() in this SpaceType will be removed. */
303 bool setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea);
304
305 /** Sets the electricEquipmentPowerPerFloorArea, using templateElectricEquipment as a template
306 * for the remaining ElectricEquipment and ElectricEquipmentDefinition parameters. All other
307 * electricEquipment() in this SpaceType will be removed. */
308 bool setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea, const ElectricEquipment& templateElectricEquipment);
309
310 /** Returns the total electric equipment power per person, if it can be calculated
311 * directly from the underlying electricEquipment() data (without knowing floorArea and
312 * numPeople). */
313 boost::optional<double> electricEquipmentPowerPerPerson() const;
314
315 /** Sets the electricEquipmentPowerPerPerson, using electricEquipment()[0], if it exists,
316 * as a template for the remaining ElectricEquipment and ElectricEquipmentDefinition parameters.
317 * All other electricEquipment() in this SpaceType will be removed. */
318 bool setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson);
319
320 /** Sets the electricEquipmentPowerPerPerson, using templateElectricEquipment as a template
321 * for the remaining ElectricEquipment and ElectricEquipmentDefinition parameters. All other
322 * electricEquipment() in this SpaceType will be removed. */
323 bool setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson, const ElectricEquipment& templateElectricEquipment);
324
325 double getElectricEquipmentDesignLevel(double floorArea, double numPeople) const;
326
327 double getElectricEquipmentPowerPerFloorArea(double floorArea, double numPeople) const;
328
329 double getElectricEquipmentPowerPerPerson(double floorArea, double numPeople) const;
330
331 /** Returns the total IT equipment power per space floor area, if it can be calculated
332 * directly from the underlying electricEquipmentITEAirCooled() data (without knowing floorArea and
333 * numPeople). */
334 boost::optional<double> electricEquipmentITEAirCooledPowerPerFloorArea() const;
335
336 /** Returns the total gas equipment power per space floor area, if it can be calculated
337 * directly from the underlying gasEquipment() data (without knowing floorArea and
338 * numPeople). */
339 boost::optional<double> gasEquipmentPowerPerFloorArea() const;
340
341 /** Sets the gasEquipmentPowerPerFloorArea, using gasEquipment()[0], if it exists,
342 * as a template for the remaining GasEquipment and GasEquipmentDefinition parameters.
343 * All other gasEquipment() in this SpaceType will be removed. */
344 bool setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea);
345
346 /** Sets the gasEquipmentPowerPerFloorArea, using templateGasEquipment as a template
347 * for the remaining GasEquipment and GasEquipmentDefinition parameters. All other
348 * gasEquipment() in this SpaceType will be removed. */
349 bool setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea, const GasEquipment& templateGasEquipment);
350
351 /** Returns the total gas equipment power per person, if it can be calculated directly from
352 * the underlying gasEquipment() data (without knowing floorArea and numPeople). */
353 boost::optional<double> gasEquipmentPowerPerPerson() const;
354
355 /** Sets the gasEquipmentPowerPerPerson, using gasEquipment()[0], if it exists,
356 * as a template for the remaining GasEquipment and GasEquipmentDefinition parameters.
357 * All other gasEquipment() in this SpaceType will be removed. */
358 bool setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson);
359
360 /** Sets the gasEquipmentPowerPerPerson, using templateGasEquipment as a template
361 * for the remaining GasEquipment and GasEquipmentDefinition parameters. All other
362 * gasEquipment() in this SpaceType will be removed. */
363 bool setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson, const GasEquipment& templateGasEquipment);
364
365 double getGasEquipmentDesignLevel(double floorArea, double numPeople) const;
366
367 double getGasEquipmentPowerPerFloorArea(double floorArea, double numPeople) const;
368
369 double getGasEquipmentPowerPerPerson(double floorArea, double numPeople) const;
370
371 /** Returns the total hot water equipment power per space floor area, if it can be calculated
372 * directly from the underlying hotWaterEquipment() data (without knowing floorArea and
373 * numPeople). */
374 boost::optional<double> hotWaterEquipmentPowerPerFloorArea() const;
375
376 /** Sets the hotWaterEquipmentPowerPerFloorArea, using hotWaterEquipment()[0], if it exists,
377 * as a template for the remaining HotWaterEquipment and HotWaterEquipmentDefinition parameters.
378 * All other hotWaterEquipment() in this SpaceType will be removed. */
379 bool setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea);
380
381 /** Sets the hotWaterEquipmentPowerPerFloorArea, using templateHotWaterEquipment as a template
382 * for the remaining HotWaterEquipment and HotWaterEquipmentDefinition parameters. All other
383 * hotWaterEquipment() in this SpaceType will be removed. */
384 bool setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea, const HotWaterEquipment& templateHotWaterEquipment);
385
386 /** Returns the total hot water equipment power per person, if it can be calculated directly from
387 * the underlying hotWaterEquipment() data (without knowing floorArea and numPeople). */
388 boost::optional<double> hotWaterEquipmentPowerPerPerson() const;
389
390 /** Sets the hotWaterEquipmentPowerPerPerson, using hotWaterEquipment()[0], if it exists,
391 * as a template for the remaining HotWaterEquipment and HotWaterEquipmentDefinition parameters.
392 * All other hotWaterEquipment() in this SpaceType will be removed. */
393 bool setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson);
394
395 /** Sets the hotWaterEquipmentPowerPerPerson, using templateHotWaterEquipment as a template
396 * for the remaining HotWaterEquipment and HotWaterEquipmentDefinition parameters. All other
397 * hotWaterEquipment() in this SpaceType will be removed. */
398 bool setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson, const HotWaterEquipment& templateHotWaterEquipment);
399
400 double getHotWaterEquipmentDesignLevel(double floorArea, double numPeople) const;
401
402 double getHotWaterEquipmentPowerPerFloorArea(double floorArea, double numPeople) const;
403
404 double getHotWaterEquipmentPowerPerPerson(double floorArea, double numPeople) const;
405
406 // Returns the floor area in the building using this SpaceType. Includes Space multipliers.
407 double floorArea() const;
408
409 // Will not allow user to set name to protected values such as "Plenum Space Type"
410 boost::optional<std::string> setNameProtected(const std::string& newName);
411
412 //@}
413 protected:
414 /// @cond
415 using ImplType = detail::SpaceType_Impl;
416
417 friend class Model;
418 friend class openstudio::IdfObject;
419 friend class openstudio::detail::IdfObject_Impl;
420 friend class detail::SpaceType_Impl;
421
422 explicit SpaceType(std::shared_ptr<detail::SpaceType_Impl> impl);
423
424 /// @endcond
425 private:
426 REGISTER_LOGGER("openstudio.model.SpaceType");
427 };
428
429 /** \relates SpaceType*/
430 using OptionalSpaceType = boost::optional<SpaceType>;
431
432 /** \relates SpaceType*/
433 using SpaceTypeVector = std::vector<SpaceType>;
434
435 } // namespace model
436 } // namespace openstudio
437
438 #endif // MODEL_SPACETYPE_HPP
439