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/ThermalZone_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_THERMALZONE_IMPL_HPP
7 #define MODEL_THERMALZONE_IMPL_HPP
8
9 #include "ModelAPI.hpp"
10 #include "HVACComponent_Impl.hpp"
11
12 namespace openstudio {
13 namespace model {
14
15 class Space;
16 class DaylightingControl;
17 class IlluminanceMap;
18 class RenderingColor;
19 class HVACTemplateZoneIdealLoadsAirSystem;
20 class ThermostatSetpointDualSetpoint;
21 class Thermostat;
22 class ZoneControlContaminantController;
23 class ZoneControlHumidistat;
24 class ThermalZone;
25 class SizingZone;
26 class PortList;
27 class ZoneMixing;
28 class ZoneHVACEquipmentList;
29 class AirflowNetworkZone;
30 class ZonePropertyUserViewFactorsBySurfaceName;
31 class ZoneMRTCalculation;
32 class Schedule;
33
34 namespace detail {
35
36 /** ThermalZone_Impl is a HVACComponent_Impl that is the implementation class for ThermalZone.*/
37 class MODEL_API ThermalZone_Impl : public HVACComponent_Impl
38 {
39
40 public:
41 /** @name Constructors and Destructors */
42 //@{
43
44 ThermalZone_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle);
45
46 ThermalZone_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle);
47
48 ThermalZone_Impl(const ThermalZone_Impl& other, Model_Impl* model, bool keepHandle);
49
50 5698 virtual ~ThermalZone_Impl() override = default;
51
52 //@}
53
54 // return the parent object in the hierarchy
55 virtual boost::optional<ParentObject> parent() const override;
56
57 // set the parent, child may have to call methods on the parent
58 virtual bool setParent(ParentObject& newParent) override;
59
60 // return any children objects in the hierarchy
61 virtual std::vector<ModelObject> children() const override;
62
63 /// get a vector of allowable children types
64 virtual std::vector<IddObjectType> allowableChildTypes() const override;
65
66 // Get all output variable names that could be associated with this object.
67 virtual const std::vector<std::string>& outputVariableNames() const override;
68
69 virtual IddObjectType iddObjectType() const override;
70
71 virtual std::vector<HVACComponent> edges(const boost::optional<HVACComponent>& prev) override;
72
73 virtual std::vector<ScheduleTypeKey> getScheduleTypeKeys(const Schedule& schedule) const override;
74
75 virtual ComponentType componentType() const override;
76 virtual std::vector<FuelType> coolingFuelTypes() const override;
77 virtual std::vector<FuelType> heatingFuelTypes() const override;
78 virtual std::vector<AppGFuelType> appGHeatingFuelTypes() const override;
79
80 /** @name Getters */
81 //@{
82
83 int multiplier() const;
84
85 bool isMultiplierDefaulted() const;
86
87 boost::optional<double> ceilingHeight() const;
88
89 bool isCeilingHeightDefaulted() const;
90
91 bool isCeilingHeightAutocalculated() const;
92
93 boost::optional<double> volume() const;
94
95 bool isVolumeDefaulted() const;
96
97 bool isVolumeAutocalculated() const;
98
99 boost::optional<std::string> zoneInsideConvectionAlgorithm() const;
100
101 boost::optional<std::string> zoneOutsideConvectionAlgorithm() const;
102
103 std::string zoneConditioningEquipmentListName() const;
104
105 boost::optional<ThermostatSetpointDualSetpoint> thermostatSetpointDualSetpoint() const;
106
107 boost::optional<Thermostat> thermostat() const;
108
109 boost::optional<ZoneControlContaminantController> zoneControlContaminantController() const;
110
111 boost::optional<ZoneControlHumidistat> zoneControlHumidistat() const;
112
113 double fractionofZoneControlledbyPrimaryDaylightingControl() const;
114
115 bool isFractionofZoneControlledbyPrimaryDaylightingControlDefaulted() const;
116
117 double fractionofZoneControlledbySecondaryDaylightingControl() const;
118
119 bool isFractionofZoneControlledbySecondaryDaylightingControlDefaulted() const;
120
121 virtual std::vector<EMSActuatorNames> emsActuatorNames() const override;
122
123 virtual std::vector<std::string> emsInternalVariableNames() const override;
124
125 ZonePropertyUserViewFactorsBySurfaceName getZonePropertyUserViewFactorsBySurfaceName() const;
126
127 ZoneMRTCalculation getZoneMRTCalculation() const;
128
129 //@}
130 /** @name Setters */
131 //@{
132
133 bool setMultiplier(int multiplier);
134
135 void resetMultiplier();
136
137 bool setCeilingHeight(boost::optional<double> ceilingHeight);
138
139 bool setCeilingHeight(double ceilingHeight);
140
141 void resetCeilingHeight();
142
143 void autocalculateCeilingHeight();
144
145 bool setVolume(boost::optional<double> volume);
146
147 bool setVolume(double volume);
148
149 void resetVolume();
150
151 void autocalculateVolume();
152
153 bool setZoneInsideConvectionAlgorithm(boost::optional<std::string> zoneInsideConvectionAlgorithm);
154
155 bool setZoneInsideConvectionAlgorithm(const std::string& zoneInsideConvectionAlgorithm);
156
157 void resetZoneInsideConvectionAlgorithm();
158
159 bool setZoneOutsideConvectionAlgorithm(boost::optional<std::string> zoneOutsideConvectionAlgorithm);
160
161 bool setZoneOutsideConvectionAlgorithm(const std::string& zoneOutsideConvectionAlgorithm);
162
163 void resetZoneOutsideConvectionAlgorithm();
164
165 bool setZoneConditioningEquipmentListName(const std::string& zoneConditioningEquipmentListName);
166
167 bool setThermostatSetpointDualSetpoint(const ThermostatSetpointDualSetpoint& thermostat);
168
169 void resetThermostatSetpointDualSetpoint();
170
171 bool setThermostat(const Thermostat& thermostat);
172
173 void resetThermostat();
174
175 bool setZoneControlHumidistat(const ZoneControlHumidistat& humidistat);
176
177 void resetZoneControlHumidistat();
178
179 bool setZoneControlContaminantController(const ZoneControlContaminantController& contaminantController);
180
181 void resetZoneControlContaminantController();
182
183 bool setFractionofZoneControlledbyPrimaryDaylightingControl(double fractionofZoneControlledbyPrimaryDaylightingControl);
184
185 void resetFractionofZoneControlledbyPrimaryDaylightingControl();
186
187 bool setFractionofZoneControlledbySecondaryDaylightingControl(double fractionofZoneControlledbySecondaryDaylightingControl);
188
189 void resetFractionofZoneControlledbySecondaryDaylightingControl();
190
191 //@}
192
193 unsigned returnAirPort() const;
194
195 unsigned zoneAirPort() const;
196
197 OptionalModelObject returnAirModelObject() const;
198
199 std::vector<ModelObject> returnAirModelObjects() const;
200
201 Node zoneAirNode() const;
202
203 boost::optional<DaylightingControl> primaryDaylightingControl() const;
204
205 bool setPrimaryDaylightingControl(const DaylightingControl& daylightingControl);
206
207 void resetPrimaryDaylightingControl();
208
209 boost::optional<DaylightingControl> secondaryDaylightingControl() const;
210
211 bool setSecondaryDaylightingControl(const DaylightingControl& daylightingControl);
212
213 void resetSecondaryDaylightingControl();
214
215 boost::optional<IlluminanceMap> illuminanceMap() const;
216
217 bool setIlluminanceMap(const IlluminanceMap& illuminanceMap);
218
219 void resetIlluminanceMap();
220
221 bool setDaylightingControlsAndIlluminanceMaps(const boost::optional<DaylightingControl>& primaryDaylightingControl,
222 const boost::optional<DaylightingControl>& secondaryDaylightingControl,
223 const boost::optional<IlluminanceMap>& illuminanceMap);
224
225 void checkDaylightingControlsAndIlluminanceMaps();
226
227 boost::optional<Schedule> daylightingControlsAvailabilitySchedule() const;
228
229 bool setDaylightingControlsAvailabilitySchedule(Schedule& schedule);
230
231 void resetDaylightingControlsAvailabilitySchedule();
232
233 /// Returns the rendering color.
234 boost::optional<RenderingColor> renderingColor() const;
235
236 /// Sets the rendering color.
237 bool setRenderingColor(const RenderingColor& renderingColor);
238
239 /// Resets the rendering color.
240 void resetRenderingColor();
241
242 std::vector<ModelObject> equipment() const;
243
244 /// returns all spaces in this thermal zone
245 std::vector<Space> spaces() const;
246
247 /// return all spaces that have a design specification outdoor air assigned
248 std::vector<Space> spacesWithDesignSpecificationOutdoorAir() const;
249
250 /** Accumulates the floorArea of spaces. Does not include space multiplier. */
251 double floorArea() const;
252
253 /** Accumulates the exterior surface area (m^2) of spaces. Does not include space
254 * multiplier. */
255 double exteriorSurfaceArea() const;
256
257 /** Accumulates the exterior wall area (m^2) of spaces. Does not include space
258 * multiplier. */
259 double exteriorWallArea() const;
260
261 // TODO: How should this interact with the volume field. If there is an interaction,
262 // how should Building calculate its airVolume and accumulate infiltration design
263 // flow rate?
264 /** Accumulates the air volume (m^3) of spaces. Does not include space multiplier. */
265 double airVolume() const;
266
267 /** Returns the number of people in the thermal zone. Does not include space multiplier. Does include people multiplier. */
268 double numberOfPeople() const;
269
270 /** Returns the number of people per floor area (people/m^2). Does not include space multiplier. Does include people multiplier. */
271 double peoplePerFloorArea() const;
272
273 /** Returns the total floor area per person in this thermal zone (m^2/person). Does not include space multiplier. Does include people multiplier. */
274 double floorAreaPerPerson() const;
275
276 /** Returns the lighting power (W) in this thermal zone. Does not include space multiplier. Does include lighting multiplier. */
277 double lightingPower() const;
278
279 /** Returns the lighting power density (W/m^2) of this thermal zone. Does not include space multiplier. Does include lighting multiplier. */
280 double lightingPowerPerFloorArea() const;
281
282 /** Returns the lighting power per person (W/person) of this thermal zone. Does not include space multiplier. Does include lighting multiplier. */
283 double lightingPowerPerPerson() const;
284
285 /** Returns the electric equipment power (W) of this thermal zone. Does not include space multiplier. */
286 double electricEquipmentPower() const;
287
288 /** Returns the electric equipment power density (W/m^2) of this thermal zone. Does not include space multiplier. Does include equipment multiplier. */
289 double electricEquipmentPowerPerFloorArea() const;
290
291 /** Returns the electric equipment power per person (W/person) of this thermal zone. Does not include space multiplier. Does include equipment multiplier. */
292 double electricEquipmentPowerPerPerson() const;
293
294 /** Returns the gas equipment power (W) of this thermal zone. Does not include space multiplier. Does include equipment multiplier. */
295 double gasEquipmentPower() const;
296
297 /** Returns the gas equipment power density (W/m^2) of this thermal zone. Does not include space multiplier. Does include equipment multiplier. */
298 double gasEquipmentPowerPerFloorArea() const;
299
300 /** Returns the gas equipment power per person (W/person) of this thermal zone. Does not include space multiplier. Does include equipment multiplier. */
301 double gasEquipmentPowerPerPerson() const;
302
303 /** Returns the hot water equipment power (W) of this thermal zone. Does not include space multiplier. Does include equipment multiplier. */
304 double hotWaterEquipmentPower() const;
305
306 /** Returns the hot water equipment power density (W/m^2) of this thermal zone. Does not include space multiplier. Does include equipment multiplier. */
307 double hotWaterEquipmentPowerPerFloorArea() const;
308
309 /** Returns the hot water equipment power per person (W/person) of this thermal zone. Does not include space multiplier. Does include equipment multiplier. */
310 double hotWaterEquipmentPowerPerPerson() const;
311
312 /** Returns the infiltration design flow rate (m^3/s) in this thermal zone.
313 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. Does not include space multiplier. */
314 double infiltrationDesignFlowRate() const;
315
316 /** Returns the infiltration design flow per space floor area (m^3/m^2*s) in this thermal zone.
317 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. Does not include space multiplier. */
318 double infiltrationDesignFlowPerSpaceFloorArea() const;
319
320 /** Returns the infiltration design flow per exterior surface area (m^3/m^2*s) in this thermal zone.
321 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. Does not include space multiplier. */
322 double infiltrationDesignFlowPerExteriorSurfaceArea() const;
323
324 /** Returns the infiltration design flow per exterior wall area (m^3/m^2*s) in this thermal zone.
325 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. Does not include space multiplier. */
326 double infiltrationDesignFlowPerExteriorWallArea() const;
327
328 /** Returns the infiltration design air changes per hour (1/h) in this thermal zone.
329 * Ignores SpaceInfiltrationEffectiveLeakageArea and SpaceInfiltrationFlowCoefficient objects. Does not include space multiplier. */
330 double infiltrationDesignAirChangesPerHour() const;
331
332 /// Returns the HVACTemplateZoneIdealLoadsAirSystem in this ThermalZone if present.
333 boost::optional<HVACTemplateZoneIdealLoadsAirSystem> hvacTemplateZoneIdealLoadsAirSystem() const;
334
335 /** Determines if this zone is conditioned, based on the SqlFile output. Returns 'Yes' if zone is conditioned. */
336 boost::optional<std::string> isConditioned() const;
337
338 /// Combines all spaces referencing this zone into a single space referencing this zone.
339 /// If this zone has no spaces referencing it, then an uninitialized optional space is returned.
340 /// If this zone has one space referencing it, then that space is returned.
341 /// If this zone is referenced by more than one space, then geometry from all spaces is added to a single zone.
342 /// The space origin is at the minimum x, y, z coordinate of all space origins, direction of relative north is preserved if same for all spaces.
343 /// If all spaces reference the same building story then that is preserved, otherwise it is cleared.
344 /// If all spaces reference the same space type then that is preserved, otherwise space loads from the space type are applied to the new space directly.
345 /// Direct child space loads are converted to absolute levels.
346 /// Constructions and schedules are hard applied to all child surfaces and loads.
347 /// Surfaces referencing other surfaces within the space are converted to interior partitions.
348 boost::optional<Space> combineSpaces();
349
350 SizingZone sizingZone() const;
351
352 void disconnect() override;
353
354 bool isRemovable() const override;
355
356 std::vector<IdfObject> remove() override;
357
358 bool useIdealAirLoads() const;
359
360 bool setUseIdealAirLoads(bool useIdealAirLoads);
361
362 // Handles the logic of connecting the thermal zone to a Node: allowing or disallowing, and adding the equipment (AirTerminal) to the
363 // ZoneEquipmentList as appropriate
364 // Only allows connection to a node that's on the demand branch of an AirLoopHVAC, on the node right before the Demand Mixer, and as long as there
365 // are no other ThermalZones already connected on the branch
366 bool addToNodeImpl(Node& node);
367
368 // Calls addToNodeImpl, then removes connections to all pre-existing AirLoopHVAC
369 bool addToNode(Node& node) override;
370
371 // Calls addToNodeImpl, not touching connections to all pre-existing AirLoopHVAC
372 bool multiAddToNode(Node& node);
373
374 PortList inletPortList() const;
375
376 PortList exhaustPortList() const;
377
378 PortList returnPortList() const;
379
380 ZoneHVACEquipmentList zoneHVACEquipmentList() const;
381
382 bool addEquipment(const ModelObject& equipment);
383
384 bool removeEquipment(const ModelObject& equipment);
385
386 std::string loadDistributionScheme() const;
387
388 bool setLoadDistributionScheme(const std::string& scheme);
389
390 bool setCoolingPriority(const ModelObject& equipment, unsigned priority);
391
392 bool setHeatingPriority(const ModelObject& equipment, unsigned priority);
393
394 std::vector<ModelObject> equipmentInHeatingOrder() const;
395
396 std::vector<ModelObject> equipmentInCoolingOrder() const;
397
398 boost::optional<Schedule> sequentialCoolingFractionSchedule(const ModelObject& equipment) const;
399
400 boost::optional<Schedule> sequentialHeatingFractionSchedule(const ModelObject& equipment) const;
401
402 bool setSequentialCoolingFractionSchedule(const ModelObject& equipment, Schedule& schedule);
403
404 bool setSequentialHeatingFractionSchedule(const ModelObject& equipment, Schedule& schedule);
405
406 // Convenience methods
407 boost::optional<double> sequentialCoolingFraction(const ModelObject& equipment) const;
408 boost::optional<double> sequentialHeatingFraction(const ModelObject& equipment) const;
409
410 bool setSequentialCoolingFraction(const ModelObject& equipment, double fraction);
411 bool setSequentialHeatingFraction(const ModelObject& equipment, double fraction);
412
413 virtual ModelObject clone(Model model) const override;
414
415 boost::optional<AirLoopHVACSupplyPlenum> airLoopHVACSupplyPlenum() const;
416
417 boost::optional<AirLoopHVACReturnPlenum> airLoopHVACReturnPlenum() const;
418
419 bool isPlenum() const;
420 bool canBePlenum() const;
421 bool setSupplyPlenum(const ThermalZone& plenumZone);
422 bool setSupplyPlenum(const ThermalZone& plenumZone, unsigned branchIndex);
423 void removeSupplyPlenum();
424 void removeSupplyPlenum(unsigned branchIndex);
425 void removeSupplyPlenum(const AirLoopHVAC& airloop);
426 void removeSupplyPlenum(const AirLoopHVAC& airloop, unsigned branchIndex);
427 bool setReturnPlenum(const ThermalZone& plenumZone);
428 bool setReturnPlenum(const ThermalZone& plenumZone, AirLoopHVAC& airLoop);
429 void removeReturnPlenum();
430 void removeReturnPlenum(AirLoopHVAC& airLoop);
431
432 std::vector<ZoneMixing> zoneMixing() const;
433 std::vector<ZoneMixing> supplyZoneMixing() const;
434 std::vector<ZoneMixing> exhaustZoneMixing() const;
435
436 boost::optional<HVACComponent> airLoopHVACTerminal() const;
437 std::vector<HVACComponent> airLoopHVACTerminals() const;
438
439 AirflowNetworkZone getAirflowNetworkZone();
440 boost::optional<AirflowNetworkZone> airflowNetworkZone() const;
441
442 std::vector<AirLoopHVAC> airLoopHVACs() const;
443
444 // SQL Queries
445 boost::optional<double> getAutosizedValueFromZoneSizes(const std::string& columnName, const std::string& loadType) const;
446
447 boost::optional<double> autosizedMinimumOutdoorAirFlowRate() const;
448 boost::optional<double> autosizedCoolingDesignAirFlowRate() const;
449 boost::optional<double> autosizedHeatingDesignAirFlowRate() const;
450 boost::optional<double> autosizedCoolingDesignLoad() const;
451 boost::optional<double> autosizedDesignAirFlowRate() const;
452 boost::optional<double> autosizedHeatingDesignLoad() const;
453
454 protected:
455 private:
456 − REGISTER_LOGGER("openstudio.model.ThermalZone");
457
458 boost::optional<ModelObject> thermostatSetpointDualSetpointAsModelObject() const;
459 boost::optional<ModelObject> zoneControlHumidistatAsModelObject() const;
460 boost::optional<ModelObject> primaryDaylightingControlAsModelObject() const;
461 boost::optional<ModelObject> secondaryDaylightingControlAsModelObject() const;
462 boost::optional<ModelObject> illuminanceMapAsModelObject() const;
463 boost::optional<ModelObject> renderingColorAsModelObject() const;
464 std::vector<ModelObject> equipmentAsModelObjects();
465 std::vector<ModelObject> spacesAsModelObjects() const;
466
467 bool setThermostatSetpointDualSetpointAsModelObject(const boost::optional<ModelObject>& modelObject);
468 bool setZoneControlHumidistatAsModelObject(const boost::optional<ModelObject>& modelObject);
469 bool setPrimaryDaylightingControlAsModelObject(const boost::optional<ModelObject>& modelObject);
470 bool setSecondaryDaylightingControlAsModelObject(const boost::optional<ModelObject>& modelObject);
471 bool setIlluminanceMapAsModelObject(const boost::optional<ModelObject>& modelObject);
472 bool setRenderingColorAsModelObject(const boost::optional<ModelObject>& modelObject);
473 };
474
475 } // namespace detail
476
477 } // namespace model
478 } // namespace openstudio
479
480 #endif // MODEL_THERMALZONE_IMPL_HPP
481