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/AirLoopHVAC_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_AIRLOOPHVAC_IMPL_HPP
7 #define MODEL_AIRLOOPHVAC_IMPL_HPP
8
9 #include "Loop_Impl.hpp"
10 #include <utilities/idd/IddEnums.hxx>
11
12 namespace openstudio {
13 namespace model {
14
15 class AirLoopHVAC;
16 class Node;
17 class AirLoopHVACOutdoorAirSystem;
18 class AirLoopHVACDedicatedOutdoorAirSystem;
19 class AirLoopHVACZoneSplitter;
20 class AirLoopHVACZoneMixer;
21 class AirLoopHVACSupplyPlenum;
22 class AirLoopHVACReturnPlenum;
23 class ThermalZone;
24 class PlantLoop;
25 class SizingSystem;
26 class StraightComponent;
27 class AvailabilityManagerScheduled;
28 class AvailabilityManager;
29 class AvailabilityManagerAssignmentList;
30
31 namespace detail {
32
33 class Model_Impl;
34
35 class MODEL_API AirLoopHVAC_Impl : public Loop_Impl
36 {
37
38 public:
39 AirLoopHVAC_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle);
40
41 AirLoopHVAC_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle);
42
43 AirLoopHVAC_Impl(const AirLoopHVAC_Impl& other, Model_Impl* model, bool keepHandle);
44
45 1066 virtual ~AirLoopHVAC_Impl() override = default;
46
47 boost::optional<double> designSupplyAirFlowRate() const;
48
49 bool isDesignSupplyAirFlowRateAutosized() const;
50
51 bool setDesignSupplyAirFlowRate(boost::optional<double> designSupplyAirFlowRate);
52
53 void resetDesignSupplyAirFlowRate();
54
55 void autosizeDesignSupplyAirFlowRate();
56
57 double designReturnAirFlowFractionofSupplyAirFlow() const;
58
59 bool setDesignReturnAirFlowFractionofSupplyAirFlow(double designReturnAirFlowFractionofSupplyAirFlow);
60
61 virtual Node supplyInletNode() const override;
62
63 virtual Node supplyOutletNode() const override;
64
65 virtual std::vector<Node> supplyOutletNodes() const override;
66
67 virtual Node demandInletNode() const override;
68
69 virtual std::vector<Node> demandInletNodes() const override;
70
71 virtual Node demandOutletNode() const override;
72
73 boost::optional<Node> outdoorAirNode() const;
74
75 boost::optional<Node> reliefAirNode() const;
76
77 boost::optional<Node> mixedAirNode() const;
78
79 boost::optional<Node> returnAirNode() const;
80
81 std::vector<ModelObject> oaComponents(openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const;
82
83 virtual std::vector<ModelObject> components(openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const override;
84
85 boost::optional<AirLoopHVACOutdoorAirSystem> airLoopHVACOutdoorAirSystem() const;
86
87 boost::optional<AirLoopHVACDedicatedOutdoorAirSystem> airLoopHVACDedicatedOutdoorAirSystem() const;
88
89 boost::optional<Splitter> supplySplitter() const;
90
91 bool setSupplySplitter(Splitter const& splitter);
92
93 void resetSupplySplitter();
94
95 bool removeSupplySplitter();
96
97 bool removeSupplySplitter(HVACComponent& hvacComponent);
98
99 boost::optional<Node> supplySplitterInletNode() const;
100
101 std::vector<Node> supplySplitterOutletNodes() const;
102
103 AirLoopHVACZoneMixer zoneMixer() const;
104
105 bool setZoneMixer(Mixer const& mixer);
106
107 AirLoopHVACZoneSplitter zoneSplitter() const;
108
109 bool setZoneSplitter(Splitter const& splitter, int path);
110
111 void resetZoneSplitter(int path);
112
113 std::vector<AirLoopHVACZoneSplitter> zoneSplitters() const;
114
115 bool removeBranchForZone(openstudio::model::ThermalZone& thermalZone);
116
117 virtual std::vector<openstudio::IdfObject> remove() override;
118
119 /**
120 * This method will clone an AirLoopHVAC with the following rationale:
121 * - Handle all non-branch components from both the supply and the demand side
122 * - On the demand side branches, place one terminal of each IddObjectType that is present on the original AirLoopHVAC
123 * - Clone any SetpointManagers and add them to the correct location
124 * - If the supply component that is cloned is connected to a PlantLoop,
125 * we try to the connect the clone to the same PlantLoop by adding a demand branch
126 */
127 virtual ModelObject clone(Model model) const override;
128
129 virtual const std::vector<std::string>& outputVariableNames() const override;
130
131 virtual IddObjectType iddObjectType() const override;
132
133 virtual std::vector<ScheduleTypeKey> getScheduleTypeKeys(const Schedule& schedule) const override;
134
135 virtual Splitter demandSplitter() const override;
136
137 virtual Mixer demandMixer() const override;
138
139 boost::optional<HVACComponent> supplyFan() const;
140
141 boost::optional<HVACComponent> returnFan() const;
142
143 boost::optional<HVACComponent> reliefFan() const;
144
145 // Helper to enforce that an ATU type (Single or Dual Duct) matches the AirLoopHVAC Type
146 bool isTerminalTypeValid(const HVACComponent& airTerminal);
147
148 bool multiAddBranchForZone(ThermalZone& thermalZone);
149
150 bool multiAddBranchForZone(ThermalZone& thermalZone, HVACComponent& airTerminal);
151
152 bool addBranchForZone(ThermalZone& thermalZone);
153
154 bool addBranchForZone(ThermalZone& thermalZone, HVACComponent& airTerminal);
155
156 bool addBranchForZone(ThermalZone& thermalZone, Splitter& splitter, Mixer& mixer, HVACComponent& airTerminal);
157
158 bool addBranchForZone(ThermalZone& thermalZone, Splitter& splitter, Mixer& mixer);
159
160 // TODO: remove?
161 //bool addBranchForZoneImpl(openstudio::model::ThermalZone & thermalZone,
162 // boost::optional<StraightComponent> & optAirTerminal);
163
164 //bool addBranchForZoneImpl(openstudio::model::ThermalZone & thermalZone,
165 // boost::optional<HVACComponent> & optAirTerminal);
166
167 bool moveBranchForZone(ThermalZone& thermalZone, Splitter& newSplitter);
168
169 bool moveBranchForZone(ThermalZone& thermalZone, Mixer& newMixer);
170
171 bool addBranchForHVACComponent(HVACComponent& airTerminal);
172
173 SizingSystem sizingSystem() const;
174
175 std::vector<ThermalZone> thermalZones() const;
176
177 virtual std::vector<ModelObject> children() const override;
178
179 Schedule availabilitySchedule() const;
180
181 bool setAvailabilitySchedule(Schedule& schedule);
182
183 bool setNightCycleControlType(const std::string& nightCycle);
184
185 std::string nightCycleControlType() const;
186
187 // boost::optional<Schedule> returnAirBypassFlowTemperatureSetpointSchedule() const;
188
189 // bool setReturnAirBypassFlowTemperatureSetpointSchedule(Schedule & temperatureSetpointSchedule);
190
191 // void resetReturnAirBypassFlowTemperatureSetpointSchedule();
192
193 static bool addBranchForZoneImpl(ThermalZone& thermalZone, AirLoopHVAC& airLoopHVAC, Splitter& splitter, Mixer& mixer, bool removeCurrentZones,
194 boost::optional<HVACComponent>& optAirTerminal);
195
196 static boost::optional<ThermalZone> zoneForLastBranch(Mixer& mixer);
197
198 static boost::optional<HVACComponent> terminalForLastBranch(Mixer& mixer);
199
200 static boost::optional<PlantLoop> plantForAirTerminal(HVACComponent& airTerminal);
201
202 static bool setPlantForAirTerminal(HVACComponent& airTerminal, PlantLoop& plantLoop);
203
204 unsigned supplyOutletPortA() const;
205
206 unsigned supplyOutletPortB() const;
207
208 unsigned supplyInletPort() const;
209
210 unsigned demandInletPortA() const;
211
212 unsigned demandInletPortB() const;
213
214 unsigned demandOutletPort() const;
215
216 static bool addDualDuctTerminalToNode(HVACComponent& terminal, const unsigned inletPortA, const unsigned inletPortB, const unsigned outletPort,
217 Node& node);
218
219 static bool removeDualDuctTerminalFromAirLoopHVAC(HVACComponent& terminal, const unsigned inletPortA, const unsigned inletPortB,
220 const unsigned outletPort);
221
222 bool isDualDuct() const;
223
224 // AVM
225 // Impl_only
226 virtual AvailabilityManagerAssignmentList availabilityManagerAssignmentList() const override;
227
228 std::vector<AvailabilityManager> availabilityManagers() const;
229 bool setAvailabilityManagers(const std::vector<AvailabilityManager>& avms);
230 void resetAvailabilityManagers();
231
232 bool addAvailabilityManager(const AvailabilityManager& availabilityManager);
233 bool addAvailabilityManager(const AvailabilityManager& availabilityManager, unsigned priority);
234
235 unsigned availabilityManagerPriority(const AvailabilityManager& availabilityManager) const;
236 bool setAvailabilityManagerPriority(const AvailabilityManager& availabilityManager, unsigned priority);
237
238 bool removeAvailabilityManager(const AvailabilityManager& avm);
239 bool removeAvailabilityManager(unsigned priority);
240
241 boost::optional<double> autosizedDesignSupplyAirFlowRate() const;
242
243 // Not part of the applySizingValues
244 boost::optional<double> autosizedSumMinimumHeatingAirFlowRates() const;
245
246 // Not part of the applySizingValues
247 boost::optional<double> autosizedSumAirTerminalMaxAirFlowRate() const;
248
249 virtual void autosize() override;
250
251 virtual void applySizingValues() override;
252
253 std::vector<HVACComponent> terminals() const;
254
255 /**
256 * This method creates the basic, barebone, AirLoopHVAC topology:
257 * - Supply inlet & oulet nodes,
258 * - Demand inlet & outlet nodes,
259 * - Demand splitter & mixer,
260 * - A demand branch with a node
261 * - A Demand branch with a node (Branch Node)
262 */
263 virtual void createTopology() override;
264
265 virtual std::vector<EMSActuatorNames> emsActuatorNames() const override;
266
267 virtual std::vector<std::string> emsInternalVariableNames() const override;
268
269 private:
270 − REGISTER_LOGGER("openstudio.model.AirLoopHVAC");
271
272 // TODO: Make these const.
273 std::vector<ModelObject> supplyOutletNodesAsModelObjects();
274 std::vector<ModelObject> demandInletNodesAsModelObjects();
275 boost::optional<ModelObject> demandOutletNodeAsModelObject();
276 boost::optional<ModelObject> reliefAirNodeAsModelObject();
277 boost::optional<ModelObject> zoneMixerAsModelObject();
278 boost::optional<ModelObject> zoneSplitterAsModelObject();
279 };
280
281 } // namespace detail
282
283 } // namespace model
284
285 } // namespace openstudio
286
287 #endif
288