GCC Code Coverage Report


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

src/model/HVACComponent.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_HVACCOMPONENT_HPP
7 #define MODEL_HVACCOMPONENT_HPP
8
9 #include "ModelAPI.hpp"
10 #include "ParentObject.hpp"
11
12 namespace openstudio {
13
14 class AppGFuelType;
15 class ComponentType;
16 class FuelType;
17
18 namespace model {
19
20 class AirLoopHVAC;
21
22 class AirLoopHVACOutdoorAirSystem;
23
24 class PlantLoop;
25
26 class Node;
27
28 class Splitter;
29
30 class Loop;
31
32 class ZoneHVACComponent;
33
34 class StraightComponent;
35
36 namespace detail {
37 class HVACComponent_Impl;
38 };
39
40 /** HVACComponent is the base class for objects related to HVAC systems.
41 *
42 * HVACComponent provides the ability to connect multiple HVACComponents together through ports.
43 * Connections are directional and they are created by identifying a source HVACComponent and port
44 * as well as a target HVACComponent object and port. Once a connection is made, it is easy to access the HVACComponent
45 * connected to a particular port using the member functions of HVACComponent.
46 *
47 * New Connections are made using the openstudio::model::Model::connect function.
48 *
49 * Connections and ports together form similar functionality as EnergyPlus nodes, however a connection between ports is more general
50 * then a node connection in Energyplus. Indeed, in the OpenStudio model connections are used to describe what is a node connection
51 * in EnergyPlus, but connections can be applied to other contexts then just EnergyPlus nodes. OpenStudio's connections and ports
52 * can be used anytime one "component" can be arbitrarily connected to another "component". For example EnergyPlus EMS sensors and
53 * actuaters could be thought of as source and target ports, where a connection can be made between the two.
54 *
55 */
56
57 class MODEL_API HVACComponent : public ParentObject
58 {
59 public:
60 2461333 virtual ~HVACComponent() override = default;
61 // Default the copy and move operators because the virtual dtor is explicit
62 972181 HVACComponent(const HVACComponent& other) = default;
63 943007 HVACComponent(HVACComponent&& other) = default;
64 46 HVACComponent& operator=(const HVACComponent&) = default;
65 5706 HVACComponent& operator=(HVACComponent&&) = default;
66
67 /** Returns the optional Loop object that the HVAC component is attached to.
68 * If the component is part of an outdoor air system, the containing AirLoopHVAC will be returned.
69 * If the component is attached to multiple loops, the optional will be false.
70 */
71 boost::optional<Loop> loop() const;
72
73 /** Returns the optional AirLoopHVAC object that the HVAC component is attached to.
74 * If the component is part of an outdoor air system, the containing AirLoopHVAC will be returned.
75 * If the HVAC component is not associated with an air loop then the optional will be false.
76 */
77 boost::optional<AirLoopHVAC> airLoopHVAC() const;
78
79 /** Returns the optional PlantLoop object that the HVAC component is attached to.
80 *
81 * If the HVAC component is not associated with a plant loop then the optional will be false.
82 */
83 boost::optional<PlantLoop> plantLoop() const;
84
85 /** Returns the optional AirLoopHVACOutdoorAirSystem that the HVAC component is attached to.
86 *
87 * If the HVAC component is not associated with an outdoor air system then the optional will be false.
88 */
89 boost::optional<AirLoopHVACOutdoorAirSystem> airLoopHVACOutdoorAirSystem() const;
90
91 /** EnergyPlus unitary equipment and air terminals are typically composed of other HVAC components.
92 * This method returns any such component containing this component. In OpenStudio, AirLoopHVAC,
93 * PlantLoop, and AirLoopHVACOutdoorAirSystem are treated as systems, not unitary equipment, thus
94 * they are not returned by this method. See plantLoop(), airLoop(), and airLoopHVACOutdoorAirSystem()
95 * to access those systems.
96 */
97 boost::optional<HVACComponent> containingHVACComponent() const;
98
99 /** Returns any ZoneHVACComponent that contains this HVACComponent.
100 */
101 boost::optional<ZoneHVACComponent> containingZoneHVACComponent() const;
102 boost::optional<StraightComponent> containingStraightComponent() const;
103
104 /** Adds this object to a new system node and returns a boolean indicating if the addition was successful.
105 *
106 * This method is reimplemented in many of the derived classes to do the right thing based on the
107 * context of the node a particular object is added to. For example if a specific HVACComoponent is not allowed
108 * on an air loop and this interface is used to attempt to add the HVAC component to a node on an
109 * air loop the method will return false and the object will not be added.
110 *
111 * Normally, this method will add this HVAC component immediatly after the node specified. There are exceptions,
112 * such as when a component is dropped on an outlet node such as the supply outlet node of an air loop. In
113 * this case the method will do the only thing possible and add this component before the outlet node.
114 */
115 bool addToNode(Node& node);
116
117 /** Adds this object to a splitter by creating a new branch.
118 * Returns true if the operation was succesfull.
119 *
120 * This method is reimplemented in many of the derived class to do the right thing based on the
121 * context of the splitter a particular object is added to.
122 */
123 bool addToSplitter(Splitter& splitter);
124
125 /** Removes all connections to other HVACComponent objects
126 */
127 void disconnect();
128
129 /** Indicates if the HVACComponent can be removed from the model.
130 * One reason a component could not be removed is because it is attached to a loop and
131 * removing it would destroy the integrity of the loop. Zone splitters and mixers are
132 * examples of this, since they are required components of an air loop. In such a case,
133 * the HVACComponent must be disconnected before it can be removed.
134 */
135 bool isRemovable() const;
136
137 /** Removes the HVACComponent from the model only if isRemovable() return true.
138 */
139 std::vector<IdfObject> remove(); // cppcheck-suppress [duplInheritedMember] for documentation purposes
140
141 ///** Returns the optional ModelObject connected to this object's port. **/
142 //virtual boost::optional<ModelObject> connectedObject(unsigned port);
143
144 ///** Returns the optional Port on the connected object through which the
145 // * connection to this object's port is made.
146 // */
147 //virtual boost::optional<unsigned> connectedObjectPort(unsigned port);
148
149 void autosize();
150
151 void applySizingValues();
152
153 // This is virtual in the Implementation class
154 ComponentType componentType() const;
155 std::vector<FuelType> coolingFuelTypes() const;
156 std::vector<FuelType> heatingFuelTypes() const;
157 std::vector<AppGFuelType> appGHeatingFuelTypes() const;
158
159 protected:
160 HVACComponent(IddObjectType type, const Model& model);
161
162 using ImplType = detail::HVACComponent_Impl;
163
164 friend class Model;
165
166 friend class openstudio::IdfObject;
167
168 friend class openstudio::detail::IdfObject_Impl;
169
170 explicit HVACComponent(std::shared_ptr<ImplType> impl);
171
172 private:
173 REGISTER_LOGGER("openstudio.model.HVACComponent");
174 };
175
176 using OptionalHVACComponent = boost::optional<HVACComponent>;
177
178 } // namespace model
179 } // namespace openstudio
180
181 #endif // MODEL_HVACCOMPONENT_HPP
182