GCC Code Coverage Report


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

src/model/ZoneHVACComponent.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_ZONEHVACCOMPONENT_HPP
7 #define MODEL_ZONEHVACCOMPONENT_HPP
8
9 #include "ModelAPI.hpp"
10 #include "HVACComponent.hpp"
11
12 namespace openstudio {
13
14 namespace model {
15
16 class ThermalZone;
17 class Node;
18 class AirLoopHVAC;
19 class AirLoopHVACReturnPlenum;
20
21 namespace detail {
22
23 class ZoneHVACComponent_Impl;
24
25 };
26
27 /** ZoneHVACComponent is the base class for HVAC related objects that exclusively condition a single zone.
28 */
29 class MODEL_API ZoneHVACComponent : public HVACComponent
30 {
31 public:
32 2741 virtual ~ZoneHVACComponent() override = default;
33 // Default the copy and move operators because the virtual dtor is explicit
34 298 ZoneHVACComponent(const ZoneHVACComponent& other) = default;
35 821 ZoneHVACComponent(ZoneHVACComponent&& other) = default;
36 ✗ ZoneHVACComponent& operator=(const ZoneHVACComponent&) = default;
37 ✗ ZoneHVACComponent& operator=(ZoneHVACComponent&&) = default;
38
39 /** Returns the inlet port. For a ZoneHVACComponent this port is typically connected
40 * to a zone exhaust node. **/
41 unsigned inletPort() const;
42
43 /** Returns the optional node connected to the inletPort(). **/
44 boost::optional<Node> inletNode() const;
45
46 /** Returns the outlet port. For a ZoneHVACComponent this port is typically connected
47 * to a zone air inlet node **/
48 unsigned outletPort() const;
49
50 /** Returns the optional node connected to the outletPort(). **/
51 boost::optional<Node> outletNode() const;
52
53 /** Returns the optional ThermalZone that this ZoneHVACComponent is attached to
54 **/
55 virtual boost::optional<ThermalZone> thermalZone() const;
56
57 /** Adds this ZoneHVACComponent to the thermal zone while managing all
58 * node connections automatically. Returns true if the operation was
59 * successful.
60 **/
61 bool addToThermalZone(ThermalZone& thermalZone);
62
63 /** Detaches this ZoneHVACComponent from the associated ThermalZone.
64 * If there is no attached ThermalZone there is no effect.
65 * If the ThermalZone is attached via an AirLoopHVAC object (as a result of addToNode()),
66 * then this method will reverse the effects of addToNode, and also detach the ZoneHVACComponent
67 * from the AirLoopHVAC object.
68 **/
69 void removeFromThermalZone();
70
71 /** Establish plenumZone as the return plenum for this ZoneHVACComponent.
72 * ZoneHVACComponent must already be attached to a ThermalZone
73 * The method canBePlenum called on plenumZone must return true.
74 */
75 bool setReturnPlenum(const ThermalZone& plenumZone);
76
77 /** Remove any return plenum attached to this ZoneHVACComponent
78 */
79 void removeReturnPlenum();
80
81 boost::optional<AirLoopHVACReturnPlenum> returnPlenum() const;
82
83 /** Adds this ZoneHVACComponent to a node on an AirLoopHVAC object.
84 * The node must be located between a ThermalZone and a AirTerminalSingleDuctInletSideMixer object.
85 * This is used to feed an AirLoopHVAC structure (such as a DOAS, or any built up system) into a ZoneHVACComponent.
86 * If the ZoneHVACComponent object is already attached to a thermalZone() then it will first be detached using removeFromThermalZone().
87 *
88 * Certain OpenStudio objects derived from the ZoneHVACComponent type,
89 * can be used as AirLoopHVAC supply components.
90 * One example is the AirLoopHVACUnitarySystem, which can be used as both
91 * a ZoneHVACComponent and a AirLoopHVAC component. In these cases
92 * addToNode can be used to add those components to the supply side of an
93 * AirLoopHVAC system.
94 **/
95 bool addToNode(Node& node); // cppcheck-suppress [duplInheritedMember] for documentation purposes
96
97 /** Returns the AirLoopHVAC attached to this ZoneHVACComponent.
98 * The AirLoopHVAC object would have been attached via addToNode */
99 boost::optional<AirLoopHVAC> airLoopHVAC() const; // cppcheck-suppress [duplInheritedMember] for documentation purposes
100
101 /** If this ZoneHVACComponent is used as a supply component
102 * on an AirLoopHVAC system, then this method will detach
103 * this ZoneHVACComponent from the AirLoopHVAC system, otherwise
104 * this method does nothing.
105 *
106 * Certain OpenStudio objects derived from the ZoneHVACComponent type,
107 * can be used as AirLoopHVAC supply components.
108 * One example is the AirLoopHVACUnitarySystem, which can be used as both
109 * a ZoneHVACComponent and a AirLoopHVAC component.
110 *
111 * If this ZoneHVACComponent is on the demand side of AirLoopHVAC,
112 * between a ThermalZone and a AirTerminalSingleDuctInletSideMixer,
113 * then use the method removeFromThermalZone, instead of removeFromAirLoopHVAC
114 * to detach this ZoneHVACComponent from the zone and air system.
115 **/
116 bool removeFromAirLoopHVAC();
117
118 /** Provided for backwards compatibility, use inletNode instead **/
119 boost::optional<ModelObject> airInletModelObject() const;
120
121 /** Provided for backwards compatibility, use outletNode instead **/
122 boost::optional<ModelObject> airOutletModelObject() const;
123
124 protected:
125 ZoneHVACComponent(IddObjectType type, const Model& model);
126
127 using ImplType = detail::ZoneHVACComponent_Impl;
128
129 friend class Model;
130
131 friend class openstudio::IdfObject;
132
133 friend class openstudio::detail::IdfObject_Impl;
134
135 explicit ZoneHVACComponent(std::shared_ptr<ImplType> impl);
136
137 private:
138 REGISTER_LOGGER("openstudio.model.HVACComponent");
139 };
140
141 using OptionalZoneHVACComponent = boost::optional<ZoneHVACComponent>;
142
143 } // namespace model
144
145 } // namespace openstudio
146
147 #endif // MODEL_ZONEHVACCOMPONENT_HPP
148