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/Loop.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_LOOP_HPP
7 #define MODEL_LOOP_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 namespace detail {
21 class Loop_Impl;
22 };
23
24 class Node;
25
26 class Splitter;
27
28 class Mixer;
29
30 class HVACComponent;
31
32 /** Loop is the base class for HVAC air and water loops.
33 *
34 * This class provides basic functionality to traverse a loop and locate components.
35 * Currently there are two types of loops AirLoopHVAC and PlantLoop. This interface reflects the
36 * commonality between the two. Loops in combination with HVACComponents offer a very simple interface to
37 * create new systems in EnergyPlus.
38 *
39 * The following is an example of building a new HVAC system composed of an AirLoopHVAC with this c++ interface.
40 *
41 @verbatim
42
43 Model model = Model();
44
45 AirLoopHVAC airLoop = AirLoopHVAC(model);
46
47 AirLoopHVACOutdoorAirSystem oaSystem = AirLoopHVACOutdoorAirSystem(model);
48
49 FanConstantVolume fan = FanConstantVolume(model);
50
51 CoilCoolingDXSingleSpeed coolCoil = CoilCoolingDXSingleSpeed(model);
52
53 CoilHeatingGas heatingCoil = CoilHeatingGas(model);
54
55 oaSystem.addToNode( airLoop.supplyOutletNode() );
56
57 fan.addToNode( airLoop.supplyOutletNode() );
58
59 coolCoil.addToNode( airLoop.supplyOutletNode() );
60
61 heatingCoil.addToNode( airLoop.supplyOutletNode() );
62
63 airLoop.addBranchForZone("Zone1");
64
65 @endverbatim
66 *
67 * The interface also allows you to retrieve a ModelObject and clone it into a new model thereby making a new copy.
68 * The clone algorithm is intellegent enough to bring along all of the connected pieces as it is appropriate.
69 *
70 @verbatim
71
72 Model newModel();
73 AirLoopHVAC newAirLoop = model.getModelObject(airLoop.handle())->clone(newModel);
74
75 @endverbatim
76 *
77 * The HVACComponent::addToNode function is intellegent. The add routine is context sensitive so for example
78 * adding a WaterToAirComponent to an air node will connect the air side ports, adding it to a plant loop node
79 * will connect the water side ports.
80 *
81 @verbatim
82
83 Model model = Model();
84
85 AirLoopHVAC airLoop = AirLoopHVAC(model);
86
87 PlantLoop plantLoop = PlantLoop(model);
88
89 CoilCoolingWater waterCoolingCoil = CoilCoolingWater(model);
90
91 waterCoolingCoil.addToNode( airLoop.supplyOutletNode() );
92
93 waterCoolingCoil.addToSplitter( plantLoop.demandSplitter() );
94
95 @endverbatim
96 */
97 class MODEL_API Loop : public ParentObject
98 {
99 public:
100 54196 virtual ~Loop() override = default;
101 // Default the copy and move operators because the virtual dtor is explicit
102 15297 Loop(const Loop& other) = default;
103 18325 Loop(Loop&& other) = default;
104 ✗ Loop& operator=(const Loop&) = default;
105 169 Loop& operator=(Loop&&) = default;
106
107 virtual Node supplyInletNode() const;
108
109 virtual Node supplyOutletNode() const;
110
111 virtual std::vector<Node> supplyOutletNodes() const;
112
113 virtual Node demandInletNode() const;
114
115 virtual Node demandOutletNode() const;
116
117 virtual std::vector<Node> demandInletNodes() const;
118
119 /** Returns all of the supply side hvac equipment between
120 * inletComps and outletComps. If type is given then the results will
121 * be limited to the given IddObjectType. Multiple inlet and outlet nodes
122 * can be provided.
123 */
124 // virtual std::vector<ModelObject> supplyComponents(std::vector<HVACComponent> inletComps, std::vector<HVACComponent> outletComps,
125 // openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const;
126
127 /** Returns all of the supply side hvac equipment between
128 * inletComp and outletComp. If type is given then the results will
129 * be limited to the given IddObjectType. Only one inlet and outlet node
130 * can be given.
131 */
132 virtual std::vector<ModelObject> supplyComponents(const HVACComponent& inletComp, const HVACComponent& outletComp,
133 openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const;
134
135 /** Returns all of the supply side HVAC equipment within the air loop.
136 * If type is given then the results will be limited to the given IddObjectType.
137 */
138 virtual std::vector<ModelObject> supplyComponents(openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const;
139
140 /** Returns all of the demand side hvac equipment between
141 * inletComps and outletComps. If type is given then the results will
142 * be limited to the given IddObjectType. Multiple inlet and outlet nodes
143 * can be provided.
144 */
145 // virtual std::vector<ModelObject> demandComponents(std::vector<HVACComponent> inletComps, std::vector<HVACComponent> outletComps,
146 // openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const;
147
148 /** Returns all of the demand side hvac equipment between
149 * inletComp and outletComp. If type is given then the results will
150 * be limited to the given IddObjectType. Only one inlet and outlet node
151 * can be given.
152 */
153 virtual std::vector<ModelObject> demandComponents(const HVACComponent& inletComp, const HVACComponent& outletComp,
154 openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const;
155
156 /** Returns all of the demand side HVAC equipment within the air loop.
157 * If type is given then the results will be limited to the given IddObjectType.
158 */
159 virtual std::vector<ModelObject> demandComponents(openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const;
160
161 /** Returns all of the HVAC equipment within the air loop including both
162 * the supply and demand sides of the loop.
163 * If type is given then the results will be limited to the given IddObjectType.
164 */
165 virtual std::vector<ModelObject> components(openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const;
166
167 /** Returns supplyComponents() or demandComponents(), depending on if the inlet and
168 * outlet component arugments are on the supply or demand side.
169 * If they are from opposite sides of the loop then an empty vector will be returned.
170 */
171 std::vector<ModelObject> components(const HVACComponent& inletComp, const HVACComponent& outletComp,
172 openstudio::IddObjectType type = openstudio::IddObjectType("Catchall"));
173
174 /** Returns an optional ModelObject with the given handle.
175 * If the handle is not within the Loop then the optional will be false
176 */
177 virtual boost::optional<ModelObject> component(openstudio::Handle handle) const;
178
179 /** Returns an optional ModelObject with the given handle.
180 * If the handle is not within demand side of the Loop then the optional will be false
181 */
182 virtual boost::optional<ModelObject> demandComponent(openstudio::Handle handle) const;
183
184 /** Returns an optional ModelObject with the given handle.
185 * If the handle is not within supply side of the Loop then the optional will be false
186 */
187 virtual boost::optional<ModelObject> supplyComponent(openstudio::Handle handle) const;
188
189 virtual std::vector<openstudio::IdfObject> remove();
190
191 Splitter demandSplitter() const;
192
193 Mixer demandMixer() const;
194
195 virtual ModelObject clone(Model model) const;
196
197 virtual std::vector<ModelObject> children() const;
198
199 void autosize();
200
201 void applySizingValues();
202
203 ComponentType componentType() const;
204 std::vector<FuelType> coolingFuelTypes() const;
205 std::vector<FuelType> heatingFuelTypes() const;
206 std::vector<AppGFuelType> appGHeatingFuelTypes() const;
207
208 protected:
209 friend class Model;
210
211 friend class openstudio::IdfObject;
212
213 /// @cond
214
215 using ImplType = detail::Loop_Impl;
216
217 explicit Loop(std::shared_ptr<ImplType> impl);
218
219 Loop(IddObjectType type, const Model& model);
220
221 private:
222 REGISTER_LOGGER("openstudio.model.Loop");
223
224 /// @endcond
225 };
226
227 using OptionalLoop = boost::optional<Loop>;
228
229 } // namespace model
230 } // namespace openstudio
231
232 #endif // MODEL_LOOP_HPP
233