GCC Code Coverage Report


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

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