GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 69.4% 582 / 0 / 839
Functions: 69.1% 132 / 0 / 191
Branches: 63.4% 779 / 0 / 1229

src/model/PlantLoop.cpp
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 #include "PlantLoop.hpp"
7 #include "PlantLoop_Impl.hpp"
8 #include "SizingPlant.hpp"
9 #include "SizingPlant_Impl.hpp"
10 #include "Model.hpp"
11 #include "Node.hpp"
12 #include "Node_Impl.hpp"
13 #include "ConnectorMixer.hpp"
14 #include "ConnectorMixer_Impl.hpp"
15 #include "ConnectorSplitter.hpp"
16 #include "ConnectorSplitter_Impl.hpp"
17 #include "Splitter.hpp"
18 #include "Splitter_Impl.hpp"
19 #include "StraightComponent.hpp"
20 #include "StraightComponent_Impl.hpp"
21 #include "WaterToAirComponent.hpp"
22 #include "WaterToAirComponent_Impl.hpp"
23 #include "WaterToWaterComponent.hpp"
24 #include "WaterToWaterComponent_Impl.hpp"
25 #include "CoilCoolingWater.hpp"
26 #include "CoilCoolingWater_Impl.hpp"
27 #include "CoilHeatingWater.hpp"
28 #include "CoilHeatingWater_Impl.hpp"
29 #include "ControllerWaterCoil.hpp"
30 #include "ControllerWaterCoil_Impl.hpp"
31 #include "PlantEquipmentOperationScheme.hpp"
32 #include "PlantEquipmentOperationScheme_Impl.hpp"
33 #include "PlantEquipmentOperationHeatingLoad.hpp"
34 #include "PlantEquipmentOperationHeatingLoad_Impl.hpp"
35 #include "PlantEquipmentOperationCoolingLoad.hpp"
36 #include "PlantEquipmentOperationCoolingLoad_Impl.hpp"
37 #include "ScheduleTypeRegistry.hpp"
38 #include "Schedule.hpp"
39 #include "Schedule_Impl.hpp"
40 #include "AvailabilityManagerAssignmentList.hpp"
41 #include "AvailabilityManagerAssignmentList_Impl.hpp"
42 #include "AvailabilityManager.hpp"
43 #include "AvailabilityManager_Impl.hpp"
44 #include "SetpointManager.hpp"
45 #include "SetpointManager_Impl.hpp"
46 #include "../utilities/core/Assert.hpp"
47 #include <utilities/idd/OS_PlantLoop_FieldEnums.hxx>
48 #include <utilities/idd/IddEnums.hxx>
49 #include <utilities/idd/IddFactory.hxx>
50 #include <utilities/idd/OS_AvailabilityManagerAssignmentList_FieldEnums.hxx>
51
52 namespace openstudio {
53
54 namespace model {
55
56 namespace detail {
57
58 529 PlantLoop_Impl::PlantLoop_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : Loop_Impl(idfObject, model, keepHandle) {
59
4/6
✓ Branch 1 taken 529 times.
✓ Branch 4 taken 529 times.
✓ Branch 7 taken 529 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 529 times.
✗ Branch 13 not taken.
529 OS_ASSERT(idfObject.iddObject().type() == PlantLoop::iddObjectType());
60 529 }
61
62 14 PlantLoop_Impl::PlantLoop_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
63 14 : Loop_Impl(other, model, keepHandle) {
64
4/6
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 14 times.
✗ Branch 13 not taken.
14 OS_ASSERT(other.iddObject().type() == PlantLoop::iddObjectType());
65 14 }
66
67 279 PlantLoop_Impl::PlantLoop_Impl(const PlantLoop_Impl& other, Model_Impl* model, bool keepHandle) : Loop_Impl(other, model, keepHandle) {}
68
69 ✗ const std::vector<std::string>& PlantLoop_Impl::outputVariableNames() const {
70 static const std::vector<std::string> result{"Plant Supply Side Cooling Demand Rate",
71 "Plant Supply Side Heating Demand Rate",
72 "Plant Supply Side Inlet Mass Flow Rate",
73 "Plant Supply Side Inlet Temperature",
74 "Plant Supply Side Outlet Temperature",
75 "Plant Supply Side Not Distributed Demand Rate",
76 "Plant Supply Side Unmet Demand Rate",
77 "Plant Solver Sub Iteration Count",
78 "Plant Solver Half Loop Calls Count",
79 "Debug Plant Loop Bypass Fraction",
80 "Debug Plant Last Simulated Loop Side",
81 "Plant Common Pipe Mass Flow Rate",
82 "Plant Common Pipe Temperature",
83 "Plant Common Pipe Flow Direction Status",
84 "Plant Common Pipe Primary Mass Flow Rate",
85 "Plant Common Pipe Secondary Mass Flow Rate",
86 "Primary Side Common Pipe Flow Direction",
87 "Secondary Side Common Pipe Flow Direction",
88 "Plant Common Pipe Primary to Secondary Mass Flow Rate",
89 "Plant Common Pipe Secondary to Primary Mass Flow Rate",
90 "Plant System Cycle On Off Status",
91 "Plant Demand Side Loop Pressure Difference",
92 "Plant Supply Side Loop Pressure Difference",
93 ✗ "Plant Loop Pressure Difference"};
94 ✗ return result;
95 ✗ }
96
97 1 std::vector<openstudio::IdfObject> PlantLoop_Impl::remove() {
98
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 sizingPlant().remove();
99
100 1 ModelObjectVector modelObjects;
101 1 ModelObjectVector::iterator it;
102
103
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 availabilityManagerAssignmentList().remove();
104
105
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 modelObjects = supplyComponents();
106
2/2
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 1 time.
6 for (it = modelObjects.begin(); it != modelObjects.end(); ++it) {
107
2/3
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
10 if (boost::optional<WaterToWaterComponent> comp = it->optionalCast<WaterToWaterComponent>()) {
108 ✗ comp->removeFromPlantLoop();
109 ✗ if (!comp->secondaryPlantLoop()) {
110 ✗ comp->remove();
111 }
112 5 }
113 }
114
115
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 modelObjects = demandComponents();
116
2/2
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 1 time.
6 for (it = modelObjects.begin(); it != modelObjects.end(); ++it) {
117
2/3
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
10 if (boost::optional<WaterToWaterComponent> comp = it->optionalCast<WaterToWaterComponent>()) {
118 ✗ comp->removeFromSecondaryPlantLoop();
119 ✗ if (!comp->plantLoop()) {
120 ✗ comp->remove();
121 }
122
2/3
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
10 } else if (boost::optional<WaterToAirComponent> comp = it->optionalCast<WaterToAirComponent>()) {
123 ✗ comp->removeFromPlantLoop();
124 ✗ if (!comp->airLoopHVAC()) {
125 ✗ comp->remove();
126 }
127 10 }
128 }
129
130
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 modelObjects = components();
131
132
1/1
✓ Branch 1 taken 1 time.
1 std::vector<openstudio::IdfObject> idfObjects = ModelObject_Impl::remove();
133
134
2/2
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 1 time.
11 for (it = modelObjects.begin(); it != modelObjects.end(); ++it) {
135
2/3
✓ Branch 2 taken 10 times.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
20 if (boost::optional<HVACComponent> comp = it->optionalCast<HVACComponent>()) {
136
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 comp->disconnect();
137 10 }
138
1/1
✓ Branch 2 taken 10 times.
10 it->remove();
139 }
140
141 2 return idfObjects;
142 1 }
143
144 ✗ IddObjectType PlantLoop_Impl::iddObjectType() const {
145 ✗ return PlantLoop::iddObjectType();
146 }
147
148 2 ModelObject PlantLoop_Impl::clone(Model model) const {
149
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 auto plantLoopClone = Loop_Impl::clone(model).cast<PlantLoop>();
150
151
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
4 plantLoopClone.setString(supplyInletPort(), "");
152
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
4 plantLoopClone.setString(supplyOutletPort(), "");
153
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
4 plantLoopClone.setString(demandInletPort(), "");
154
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 plantLoopClone.setString(demandOutletPort(), "");
155
156 // Sizing:Plant was already cloned because it is declared as a child
157 // And because it has the setParent method overriden, no need to do anything
158
159 {
160 // Perhaps call a clone(Loop loop) instead...
161
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 auto avmListClone = availabilityManagerAssignmentList().clone(model).cast<AvailabilityManagerAssignmentList>();
162
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 avmListClone.setName(plantLoopClone.name().get() + " AvailabilityManagerAssigmentList");
163
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 plantLoopClone.setPointer(OS_PlantLoopFields::AvailabilityManagerListName, avmListClone.handle());
164 2 }
165
166
1/1
✓ Branch 3 taken 2 times.
2 plantLoopClone.getImpl<detail::PlantLoop_Impl>()->createTopology();
167
168 // Declare vectors we'll use to store the nodes in order to check if we have the same number of nodes
169 // and since we store them in the same order, we'll be able to clone the SPMs too
170 2 std::vector<Node> nodes;
171 2 std::vector<Node> nodeClones;
172
173 /*
174 *==========================================
175 * S U P P L Y S I D E
176 *==========================================
177 */
178
179 10 auto outputMessagesAndAssert = [](const std::vector<Node>& nodes, const std::vector<Node>& nodeClones, bool isSupplySide, bool isInlet) {
180 // Before the assert, we give out useful debugging info, or a Trace
181
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
10 if (nodes.size() != nodeClones.size()) {
182 ✗ LOG(Debug, "When cloning with (isSupplySide, isInlet) = (" << isSupplySide << ", " << isInlet << "),"
183 << "found a difference in number of nodes: nodes.size()=" << nodes.size()
184 << ", nodeClones.size()=" << nodeClones.size() << ".\n\nnodes:\n");
185 ✗ for (size_t i = 0; i < nodes.size(); ++i) {
186 ✗ LOG(Debug, "i=" << i << ", node=" << nodes[i].name().get());
187 }
188
189 ✗ LOG(Debug, "\n\nnodeClones:\n");
190 ✗ for (size_t i = 0; i < nodeClones.size(); ++i) {
191 ✗ LOG(Debug, "i=" << i << ", nodeClone=" << nodeClones[i].name().get());
192 }
193 } else {
194
13/13
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 13 taken 10 times.
✓ Branch 16 taken 10 times.
✓ Branch 19 taken 10 times.
✓ Branch 23 taken 10 times.
✓ Branch 26 taken 10 times.
✓ Branch 30 taken 10 times.
✓ Branch 33 taken 10 times.
✓ Branch 36 taken 10 times.
✓ Branch 39 taken 10 times.
10 LOG(Trace, "When cloning with (isSupplySide, isInlet) = (" << isSupplySide << ", " << isInlet << ")," << "nodes.size()=" << nodes.size()
195 << ", nodeClones.size()=" << nodeClones.size());
196
197
2/2
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 10 times.
34 for (size_t i = 0; i < nodes.size(); ++i) {
198
14/14
✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
✓ Branch 7 taken 24 times.
✓ Branch 10 taken 24 times.
✓ Branch 14 taken 24 times.
✓ Branch 17 taken 24 times.
✓ Branch 20 taken 24 times.
✓ Branch 23 taken 24 times.
✓ Branch 27 taken 24 times.
✓ Branch 30 taken 24 times.
✓ Branch 33 taken 24 times.
✓ Branch 38 taken 24 times.
✓ Branch 41 taken 24 times.
✓ Branch 44 taken 24 times.
24 LOG(Trace, "i=" << i << "node=" << nodes[i].name().get() << ", nodeClone=" << nodeClones[i].name().get());
199 }
200 }
201
202 // Assert that we have the same number of nodes
203
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
10 OS_ASSERT(nodes.size() == nodeClones.size());
204 10 };
205
206 // lambda function to deal with non branch components
207 // We capture this (=original plantLoop), model (the target model), the cloned plantLoop,
208 // the vectors we need to store nodes, and the lambda function to output messages and assert
209 8 auto handleNonBranchComps = [this, &model, &plantLoopClone, &nodes, &nodeClones, &outputMessagesAndAssert](bool isSupplySide, bool isInlet) {
210 8 std::vector<ModelObject> components;
211 8 boost::optional<Node> targetNode;
212 // Stores references to the inlet/outlet modelObjects (Node or Splitter or Mixer) so we can coun't the number of cloned Nodes later
213 // to ensure that we end up with the same number
214 8 boost::optional<HVACComponent> inletModelObjectClone;
215 8 boost::optional<HVACComponent> outletModelObjectClone;
216
217 // Initialize the right components and store reference to inlet/outlet objects in the cloned PlantLoop
218
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
8 if (isInlet) {
219
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 if (isSupplySide) {
220
5/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
4 components = this->supplyComponents(this->supplyInletNode(), this->supplySplitter());
221
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 targetNode = plantLoopClone.supplyInletNode();
222
1/1
✓ Branch 1 taken 2 times.
2 inletModelObjectClone = targetNode;
223
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 outletModelObjectClone = plantLoopClone.supplySplitter();
224 } else {
225
5/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
4 components = this->demandComponents(this->demandInletNode(), this->demandSplitter());
226
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 targetNode = plantLoopClone.demandInletNode();
227
1/1
✓ Branch 1 taken 2 times.
2 inletModelObjectClone = targetNode;
228
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 outletModelObjectClone = plantLoopClone.demandSplitter();
229 }
230
231 // We pop the splitter
232 4 components.pop_back();
233 // We are going to add them to the InletNode in reverse order so that they end up correctly ordered
234 // if components are ordered [A, B, C], and "o" is the inlet Node, that's what we'll do:
235 // Loop on [C, B, A]
236 // 0: o---C
237 // 1: o---B---C
238 // 2: o---A---B---C
239
1/1
✓ Branch 3 taken 4 times.
4 std::reverse(components.begin(), components.end());
240
241 } else {
242
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 if (isSupplySide) {
243
5/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
4 components = this->supplyComponents(this->supplyMixer(), this->supplyOutletNode());
244
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 targetNode = plantLoopClone.supplyOutletNode();
245
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 inletModelObjectClone = plantLoopClone.supplyMixer();
246
1/1
✓ Branch 1 taken 2 times.
2 outletModelObjectClone = targetNode;
247 } else {
248
5/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
4 components = this->demandComponents(this->demandMixer(), this->demandOutletNode());
249
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 targetNode = plantLoopClone.demandOutletNode();
250
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 inletModelObjectClone = plantLoopClone.demandMixer();
251
1/1
✓ Branch 1 taken 2 times.
2 outletModelObjectClone = targetNode;
252 }
253 // We erase the mixer
254
1/1
✓ Branch 3 taken 4 times.
4 components.erase(components.begin());
255 // We are going to add them to the outletNode, in the current order, so no need to reverse here
256 // if components are ordered [A, B, C], and "o" is the **outlet** Node, that's what we'll do:
257 // Loop on [A, B, C]
258 // 0: A---o
259 // 1: A---B---o
260 // 2: A---B---C---o
261
262 } // END OF Initialization
263
264 // We loop on the components of the original plant loop
265
2/2
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 8 times.
16 for (auto it = components.begin(); it != components.end(); ++it) {
266
1/1
✓ Branch 2 taken 8 times.
8 ModelObject comp = *it;
267
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
8 if (comp.iddObjectType() == Node::iddObjectType()) {
268 // If a Node, we don't clone, we just push it to the nodes vector
269
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 nodes.push_back(comp.cast<Node>());
270 } else {
271 // We clone the component and add it to the targetNode we initialized above
272 ✗ auto compClone = comp.clone(model).cast<HVACComponent>();
273 ✗ compClone.addToNode(*targetNode);
274
275 // If it's a WaterToWaterComponent, we try to connect it to the other PlantLoop too
276 ✗ if (boost::optional<WaterToWaterComponent> hvacComp = comp.optionalCast<WaterToWaterComponent>()) {
277 ✗ if (isSupplySide) {
278 // If it's supplySide, we check if the component is on a secondaryPlantLoop
279 ✗ if (boost::optional<PlantLoop> pl = hvacComp->secondaryPlantLoop()) {
280 // Connect the clone to the secondary plantLoop too on the demand side
281 ✗ pl->addDemandBranchForComponent(compClone);
282 ✗ }
283 } else {
284 // If demand side, we try to put it on the supply side of the (primary) plantLoop
285 ✗ if (boost::optional<PlantLoop> pl = hvacComp->plantLoop()) {
286 // Connect the clone to the plantLoop too
287 ✗ pl->addSupplyBranchForComponent(compClone);
288 ✗ }
289 }
290 ✗ }
291 ✗ }
292 8 }
293
294 // We get the added nodes in the cloned plant loop
295
6/6
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 8 times.
✓ Branch 13 taken 8 times.
✓ Branch 16 taken 8 times.
16 std::vector<Node> nodeClonesHere = subsetCastVector<Node>(plantLoopClone.supplyComponents(*inletModelObjectClone, *outletModelObjectClone));
296 // Add the new cloned nodes to the vector
297
1/1
✓ Branch 5 taken 8 times.
8 nodeClones.insert(nodeClones.end(), nodeClonesHere.begin(), nodeClonesHere.end());
298
299 // Output Messages and assert that we still have the same number of nodes between the original plantloop and the cloned one
300
1/1
✓ Branch 1 taken 8 times.
8 outputMessagesAndAssert(nodes, nodeClones, isSupplySide, isInlet);
301 8 }; // END OF LAMBDA
302
303 // Ready to start!
304
305 /**
306 * Betwen the supply inlet node and the supply Splitter
307 */
308 // isSupplySide = true, isInlet = true;
309
1/1
✓ Branch 1 taken 2 times.
2 handleNonBranchComps(true, true);
310
311 /**
312 * Betwen the supply Mixer node and the supply Outlet Node
313 */
314
1/1
✓ Branch 1 taken 2 times.
2 handleNonBranchComps(true, false);
315
316 /**
317 * Betwen the Splitter and Mixer: branches
318 */
319
320
1/1
✓ Branch 1 taken 2 times.
2 Splitter splitter = supplySplitter();
321
1/1
✓ Branch 1 taken 2 times.
2 Mixer mixer = supplyMixer();
322
323
1/1
✓ Branch 1 taken 2 times.
2 std::vector<ModelObject> splitterOutletObjects = splitter.outletModelObjects();
324 // std::vector< std::vector<model::ModelObject> > allBranchComponents;
325
326 // We'll use this vector to manually push the cloned nodes as we get them
327 2 std::vector<Node> nodeClonesHere;
328
329 // If there is actually something interesting between the splitter and the mixer...
330
2/3
✓ Branch 2 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 if (!(splitterOutletObjects.front() == mixer)) {
331 // We loop on the splitter outlet objects, that gives us the first nodes on each branch there is
332
2/2
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
4 for (ModelObject& mo : splitterOutletObjects) {
333
334
1/1
✓ Branch 1 taken 2 times.
2 auto comp = mo.optionalCast<model::HVACComponent>();
335
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(comp);
336
337 // We get the components that are on that branch (between the first node of the branch and the mixer)
338
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
4 std::vector<ModelObject> branchComponents = supplyComponents(comp.get(), mixer);
339 // Pop the last component (the mixer)
340 2 branchComponents.pop_back();
341
342 // allBranchComponents.push_back(branchComponents);
343
344 // Note JM 2018-12-17: There's one special case: the branch with the connector node
345 // We want to avoid looping on branchComponents otherwise we'll add the connector node to the nodes vector
346 // while the nodeClones will not, so it'll produce a diff
347
5/11
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 if (branchComponents.size() == 1 && branchComponents[0].optionalCast<Node>()) {
348
5/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
2 LOG(Trace, "On the Connector Node Branch, skipping it.");
349 2 continue;
350 2 }
351
352 // Reference to the lastOutletNode
353 ✗ boost::optional<Node> lastOutletNode;
354
355 // We loop on all the branch components
356 ✗ for (ModelObject& comp : branchComponents) {
357 ✗ if (comp.iddObjectType() == Node::iddObjectType()) {
358 // We don't clone the nodes, just push them the nodes vector
359 ✗ nodes.push_back(comp.cast<Node>());
360 } else {
361 // Otherwise, we clone it
362 ✗ auto compClone = comp.clone(model).cast<HVACComponent>();
363
364 ✗ if (!lastOutletNode) {
365 // If lastOutletNode isn't initialized yet, means we deal with the first component
366 // so we add a supply branch for this component
367 ✗ plantLoopClone.addSupplyBranchForComponent(compClone);
368
369 // We are going to push the created inlet Node to the nodeClonesHere vector
370 ✗ boost::optional<Node> thisInletNode;
371 ✗ if (auto _c = compClone.optionalCast<StraightComponent>()) {
372 ✗ thisInletNode = _c->inletModelObject().get().cast<Node>();
373 ✗ } else if (auto _c = compClone.optionalCast<WaterToAirComponent>()) {
374 ✗ thisInletNode = _c->waterInletModelObject().get().cast<Node>();
375 ✗ } else if (auto _c = compClone.optionalCast<WaterToWaterComponent>()) {
376 ✗ thisInletNode = _c->supplyInletModelObject().get().cast<Node>();
377 } else {
378 // Shouldn't get there
379 ✗ OS_ASSERT(false);
380 ✗ }
381 ✗ if (thisInletNode) {
382 ✗ nodeClonesHere.push_back(*thisInletNode);
383 }
384
385 ✗ } else {
386 // Otherwise, we add the component to the lastOutletNode
387 ✗ compClone.addToNode(lastOutletNode.get());
388 }
389
390 // In both cases, we capture the last outlet node
391 // In order to push it to the vector of nodeClonesHere
392 // And if need be, be able to add the next component to it
393 ✗ if (auto _c = compClone.optionalCast<StraightComponent>()) {
394 ✗ lastOutletNode = _c->outletModelObject().get().cast<Node>();
395 ✗ } else if (auto _c = compClone.optionalCast<WaterToAirComponent>()) {
396 ✗ lastOutletNode = _c->waterOutletModelObject().get().cast<Node>();
397 ✗ } else if (auto _c = compClone.optionalCast<WaterToWaterComponent>()) {
398 ✗ lastOutletNode = _c->supplyOutletModelObject().get().cast<Node>();
399 } else {
400 // Shouldn't get there
401 ✗ OS_ASSERT(false);
402 ✗ }
403 ✗ nodeClonesHere.push_back(*lastOutletNode);
404
405 // Connect to secondary PlantLoop as needed
406 ✗ if (boost::optional<WaterToWaterComponent> hvacComp = comp.optionalCast<WaterToWaterComponent>()) {
407 ✗ if (boost::optional<PlantLoop> pl = hvacComp->secondaryPlantLoop()) {
408 // Connect the clone to the secondary plantLoop too
409 ✗ pl->addDemandBranchForComponent(compClone);
410 ✗ }
411 ✗ }
412 ✗ }
413 } // End of loop on all branchComponents
414 4 } // End of loop splitterOutletModelObjects
415 }
416
417 // Add the new cloned nodes
418
1/1
✓ Branch 5 taken 2 times.
2 nodeClones.insert(nodeClones.end(), nodeClonesHere.begin(), nodeClonesHere.end());
419
1/1
✓ Branch 1 taken 2 times.
2 outputMessagesAndAssert(nodes, nodeClones, false, false);
420
421 /*
422 *==========================================
423 * D E M A N D S I D E
424 *==========================================
425 */
426 // Rationale: here we'll handle everything BUT the stuff that's on the demand branches
427
428 /**
429 * Betwen the demand inlet node and the supply Splitter
430 */
431
432 // isSupplySide = false, isInlet = true;
433
1/1
✓ Branch 1 taken 2 times.
2 handleNonBranchComps(false, true);
434
435 /**
436 * Betwen the demand Mixer node and the demand Outlet Node
437 */
438
1/1
✓ Branch 1 taken 2 times.
2 handleNonBranchComps(false, false);
439
440 /*
441 *==========================================
442 * S E T P O I N T M A N A G E R S
443 *==========================================
444 */
445 // Do another global check: check that number of nodes match
446
9/11
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 2 times.
✓ Branch 17 taken 2 times.
✓ Branch 20 taken 2 times.
✓ Branch 23 taken 2 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 2 times.
✗ Branch 29 not taken.
8 OS_ASSERT(subsetCastVector<Node>(supplyComponents()).size() == subsetCastVector<Node>(plantLoopClone.supplyComponents()).size());
447 // Check that number of components match
448
7/9
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 11 taken 2 times.
✓ Branch 14 taken 2 times.
✓ Branch 17 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 23 not taken.
8 OS_ASSERT(supplyComponents().size() == plantLoopClone.supplyComponents().size());
449
450 // Clone any SPMs: At this point nodes and nodeClones store ALL the nodes we care about in the same order
451
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
10 for (size_t i = 0; i < nodes.size(); ++i) {
452
1/1
✓ Branch 2 taken 8 times.
8 const auto node = nodes[i];
453
1/1
✓ Branch 2 taken 8 times.
8 auto cloneNode = nodeClones[i];
454
455
1/1
✓ Branch 1 taken 8 times.
8 auto spms = node.setpointManagers();
456
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 8 times.
8 for (const auto& spm : spms) {
457 ✗ auto spmclone = spm.clone(model).cast<SetpointManager>();
458 ✗ spmclone.addToNode(cloneNode);
459 ✗ }
460 8 }
461
462 4 return std::move(plantLoopClone);
463 2 }
464
465 7011 unsigned PlantLoop_Impl::supplyInletPort() const {
466 7011 return openstudio::OS_PlantLoopFields::PlantSideInletNodeName;
467 }
468
469 7841 unsigned PlantLoop_Impl::supplyOutletPort() const {
470 7841 return openstudio::OS_PlantLoopFields::PlantSideOutletNodeName;
471 }
472
473 5816 unsigned PlantLoop_Impl::demandInletPort() const {
474 5816 return openstudio::OS_PlantLoopFields::DemandSideInletNodeName;
475 }
476
477 5845 unsigned PlantLoop_Impl::demandOutletPort() const {
478 5845 return openstudio::OS_PlantLoopFields::DemandSideOutletNodeName;
479 }
480
481 6492 Node PlantLoop_Impl::supplyInletNode() const {
482
6/6
✓ Branch 1 taken 6492 times.
✓ Branch 4 taken 6492 times.
✓ Branch 7 taken 6492 times.
✓ Branch 10 taken 6492 times.
✓ Branch 13 taken 6492 times.
✓ Branch 16 taken 6492 times.
6492 return connectedObject(supplyInletPort())->optionalCast<Node>().get();
483 }
484
485 7322 Node PlantLoop_Impl::supplyOutletNode() const {
486
6/6
✓ Branch 1 taken 7322 times.
✓ Branch 4 taken 7322 times.
✓ Branch 7 taken 7322 times.
✓ Branch 10 taken 7322 times.
✓ Branch 13 taken 7322 times.
✓ Branch 16 taken 7322 times.
7322 return connectedObject(supplyOutletPort())->optionalCast<Node>().get();
487 }
488
489 5435 std::vector<Node> PlantLoop_Impl::supplyOutletNodes() const {
490
3/5
✓ Branch 1 taken 5435 times.
✓ Branch 3 taken 5435 times.
✓ Branch 4 taken 5435 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
16305 return std::vector<Node>{supplyOutletNode()};
491 5435 }
492
493 5297 Node PlantLoop_Impl::demandInletNode() const {
494
6/6
✓ Branch 1 taken 5297 times.
✓ Branch 4 taken 5297 times.
✓ Branch 7 taken 5297 times.
✓ Branch 10 taken 5297 times.
✓ Branch 13 taken 5297 times.
✓ Branch 16 taken 5297 times.
5297 return connectedObject(demandInletPort())->optionalCast<Node>().get();
495 }
496
497 4101 std::vector<Node> PlantLoop_Impl::demandInletNodes() const {
498
3/5
✓ Branch 1 taken 4101 times.
✓ Branch 3 taken 4101 times.
✓ Branch 4 taken 4101 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
12303 return std::vector<Node>{demandInletNode()};
499 4101 }
500
501 5326 Node PlantLoop_Impl::demandOutletNode() const {
502
6/6
✓ Branch 1 taken 5326 times.
✓ Branch 4 taken 5326 times.
✓ Branch 7 taken 5326 times.
✓ Branch 10 taken 5326 times.
✓ Branch 13 taken 5326 times.
✓ Branch 16 taken 5326 times.
5326 return connectedObject(demandOutletPort())->optionalCast<Node>().get();
503 }
504
505 161 bool PlantLoop_Impl::addSupplyBranchForComponent(HVACComponent component) {
506
1/1
✓ Branch 1 taken 161 times.
161 Model _model = this->model();
507
508
3/4
✓ Branch 1 taken 161 times.
✓ Branch 4 taken 161 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 161 times.
161 if (component.model() != _model) {
509 ✗ return false;
510 }
511
512
1/1
✓ Branch 1 taken 161 times.
161 Splitter splitter = this->supplySplitter();
513
1/1
✓ Branch 1 taken 161 times.
161 Mixer mixer = this->supplyMixer();
514
515
3/3
✓ Branch 1 taken 161 times.
✓ Branch 5 taken 153 times.
✓ Branch 6 taken 8 times.
161 if (splitter.outletModelObjects().size() == 1u) {
516
2/3
✓ Branch 1 taken 153 times.
✓ Branch 3 taken 153 times.
✗ Branch 4 not taken.
306 if (boost::optional<ModelObject> mo = splitter.lastOutletModelObject()) {
517
3/4
✓ Branch 1 taken 153 times.
✓ Branch 4 taken 153 times.
✓ Branch 6 taken 153 times.
✗ Branch 7 not taken.
306 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
518
16/22
✓ Branch 1 taken 153 times.
✓ Branch 4 taken 153 times.
✓ Branch 7 taken 153 times.
✓ Branch 10 taken 153 times.
✓ Branch 12 taken 129 times.
✓ Branch 13 taken 24 times.
✓ Branch 15 taken 129 times.
✓ Branch 18 taken 129 times.
✓ Branch 21 taken 129 times.
✓ Branch 24 taken 129 times.
✓ Branch 26 taken 129 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 129 times.
✓ Branch 29 taken 24 times.
✓ Branch 31 taken 153 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 129 times.
✓ Branch 35 taken 24 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
153 if ((node->outletModelObject().get() == mixer) && (node->inletModelObject().get() == splitter)) {
519
2/2
✓ Branch 1 taken 129 times.
✓ Branch 4 taken 129 times.
129 return component.addToNode(node.get());
520 }
521 153 }
522 153 }
523 }
524
525 int nextOutletPort;
526 int nextInletPort;
527
528
1/1
✓ Branch 1 taken 32 times.
32 nextOutletPort = splitter.nextOutletPort();
529
1/1
✓ Branch 1 taken 32 times.
32 nextInletPort = mixer.nextInletPort();
530
531
1/1
✓ Branch 1 taken 32 times.
32 Node node(_model);
532
533
4/4
✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
✓ Branch 7 taken 32 times.
✓ Branch 10 taken 32 times.
32 _model.connect(splitter, nextOutletPort, node, node.inletPort());
534
4/4
✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
✓ Branch 7 taken 32 times.
✓ Branch 10 taken 32 times.
32 _model.connect(node, node.outletPort(), mixer, nextInletPort);
535
536
2/3
✓ Branch 1 taken 32 times.
✓ Branch 3 taken 32 times.
✗ Branch 4 not taken.
32 if (component.addToNode(node)) {
537 32 return true;
538 } else {
539 ✗ removeSupplyBranchWithComponent(node);
540
541 ✗ return false;
542 }
543
544 return false;
545 161 }
546
547 3 bool PlantLoop_Impl::removeSupplyBranchWithComponent(HVACComponent component) {
548
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 3 times.
3 if (!supplyComponent(component.handle())) {
549 ✗ return false;
550 }
551
552
4/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
3 return removeBranchWithComponent(component, supplySplitter(), supplyMixer(), true);
553 }
554
555 262 bool PlantLoop_Impl::addDemandBranchForComponent(HVACComponent component, bool tertiary) {
556
1/1
✓ Branch 1 taken 262 times.
262 Model _model = this->model();
557
558
4/4
✓ Branch 1 taken 262 times.
✓ Branch 4 taken 262 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 260 times.
262 if (component.model() != _model) {
559 2 return false;
560 }
561
562
1/1
✓ Branch 1 taken 260 times.
260 Splitter splitter = this->demandSplitter();
563
1/1
✓ Branch 1 taken 260 times.
260 Mixer mixer = this->demandMixer();
564
565
3/3
✓ Branch 1 taken 260 times.
✓ Branch 5 taken 207 times.
✓ Branch 6 taken 53 times.
260 if (splitter.outletModelObjects().size() == 1u) {
566
2/3
✓ Branch 1 taken 207 times.
✓ Branch 3 taken 207 times.
✗ Branch 4 not taken.
414 if (boost::optional<ModelObject> mo = splitter.lastOutletModelObject()) {
567
3/4
✓ Branch 1 taken 207 times.
✓ Branch 4 taken 207 times.
✓ Branch 6 taken 207 times.
✗ Branch 7 not taken.
414 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
568
16/22
✓ Branch 1 taken 207 times.
✓ Branch 4 taken 207 times.
✓ Branch 7 taken 207 times.
✓ Branch 10 taken 207 times.
✓ Branch 12 taken 169 times.
✓ Branch 13 taken 38 times.
✓ Branch 15 taken 169 times.
✓ Branch 18 taken 169 times.
✓ Branch 21 taken 169 times.
✓ Branch 24 taken 169 times.
✓ Branch 26 taken 169 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 169 times.
✓ Branch 29 taken 38 times.
✓ Branch 31 taken 207 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 169 times.
✓ Branch 35 taken 38 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
207 if ((node->outletModelObject().get() == mixer) && (node->inletModelObject().get() == splitter)) {
569
3/3
✓ Branch 1 taken 169 times.
✓ Branch 3 taken 50 times.
✓ Branch 4 taken 119 times.
338 if (auto waterToWater = component.optionalCast<WaterToWaterComponent>()) {
570
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 50 times.
50 if (tertiary) {
571 ✗ return waterToWater->addToTertiaryNode(node.get());
572 } else {
573
3/3
✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
✓ Branch 7 taken 50 times.
50 return waterToWater->addToNode(node.get());
574 }
575 } else {
576
2/2
✓ Branch 1 taken 119 times.
✓ Branch 4 taken 119 times.
119 return component.addToNode(node.get());
577 169 }
578 }
579 207 }
580 207 }
581 }
582
583 int nextOutletPort;
584 int nextInletPort;
585
586
1/1
✓ Branch 1 taken 91 times.
91 nextOutletPort = splitter.nextOutletPort();
587
1/1
✓ Branch 1 taken 91 times.
91 nextInletPort = mixer.nextInletPort();
588
589
1/1
✓ Branch 1 taken 91 times.
91 Node node(_model);
590
591
4/4
✓ Branch 1 taken 91 times.
✓ Branch 4 taken 91 times.
✓ Branch 7 taken 91 times.
✓ Branch 10 taken 91 times.
91 _model.connect(splitter, nextOutletPort, node, node.inletPort());
592
4/4
✓ Branch 1 taken 91 times.
✓ Branch 4 taken 91 times.
✓ Branch 7 taken 91 times.
✓ Branch 10 taken 91 times.
91 _model.connect(node, node.outletPort(), mixer, nextInletPort);
593
594 91 bool result = false;
595
596
3/3
✓ Branch 1 taken 91 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 89 times.
182 if (auto waterToWater = component.optionalCast<WaterToWaterComponent>()) {
597
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (tertiary) {
598 ✗ result = waterToWater->addToTertiaryNode(node);
599 } else {
600
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 result = waterToWater->addToNode(node);
601 }
602 } else {
603
1/1
✓ Branch 1 taken 89 times.
89 result = component.addToNode(node);
604 91 }
605
606
1/2
✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
91 if (result) {
607 91 return true;
608 } else {
609 ✗ _model.disconnect(node, node.outletPort());
610 ✗ _model.disconnect(node, node.inletPort());
611 ✗ node.remove();
612
613 ✗ return false;
614 }
615
616 return false;
617 262 }
618
619 24 bool PlantLoop_Impl::removeBranchWithComponent(HVACComponent component, Splitter splitter, Mixer mixer, bool isSupplyComponent) {
620
1/1
✓ Branch 1 taken 24 times.
24 Model _model = model();
621
622
3/3
✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
✓ Branch 7 taken 24 times.
48 std::vector<ModelObject> backwardComponents = components(splitter, component);
623
3/3
✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
✓ Branch 7 taken 24 times.
48 std::vector<ModelObject> forwardComponents = components(component, mixer);
624
625 // Validate that the component is between the demand splitter and mixer
626
4/5
✓ Branch 1 taken 24 times.
✓ Branch 5 taken 24 times.
✓ Branch 8 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 24 times.
24 if (backwardComponents.front().handle() != splitter.handle()) {
627 ✗ return false;
628 }
629
630
4/5
✓ Branch 1 taken 24 times.
✓ Branch 5 taken 24 times.
✓ Branch 8 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 24 times.
24 if (backwardComponents.back().handle() != component.handle()) {
631 ✗ return false;
632 }
633
634
4/5
✓ Branch 1 taken 24 times.
✓ Branch 5 taken 24 times.
✓ Branch 8 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 24 times.
24 if (forwardComponents.front().handle() != component.handle()) {
635 ✗ return false;
636 }
637
638
4/5
✓ Branch 1 taken 24 times.
✓ Branch 5 taken 24 times.
✓ Branch 8 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 24 times.
24 if (forwardComponents.back().handle() != mixer.handle()) {
639 ✗ return false;
640 }
641
642 // Remove the backwardComponents end because we don't want component twice
643
1/1
✓ Branch 4 taken 24 times.
24 backwardComponents.erase(backwardComponents.end() - 1);
644
645 // Combine forwardComponents and backwardComponents for a complete vector of all components on the branch
646
1/1
✓ Branch 3 taken 24 times.
24 std::vector<ModelObject> allComponents(backwardComponents.begin(), backwardComponents.end());
647
1/1
✓ Branch 5 taken 24 times.
24 allComponents.insert(allComponents.end(), forwardComponents.begin(), forwardComponents.end());
648
649 // Remove the splitter and mixer from the vector
650
1/1
✓ Branch 3 taken 24 times.
24 allComponents.erase(allComponents.begin());
651
1/1
✓ Branch 4 taken 24 times.
24 allComponents.erase(allComponents.end() - 1);
652
653
2/2
✓ Branch 5 taken 72 times.
✓ Branch 6 taken 24 times.
96 for (auto& elem : allComponents) {
654
3/3
✓ Branch 1 taken 72 times.
✓ Branch 5 taken 24 times.
✓ Branch 6 taken 48 times.
72 if (!elem.optionalCast<Node>()) {
655
3/3
✓ Branch 1 taken 24 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 20 times.
48 if (boost::optional<StraightComponent> comp = elem.optionalCast<StraightComponent>()) {
656
1/1
✓ Branch 1 taken 4 times.
4 elem.remove();
657
3/3
✓ Branch 1 taken 20 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 3 times.
40 } else if (boost::optional<WaterToAirComponent> comp = elem.optionalCast<WaterToAirComponent>()) {
658
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 comp->removeFromPlantLoop();
659
660
4/4
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 8 taken 14 times.
✓ Branch 9 taken 3 times.
17 if (!comp->airLoopHVAC()) {
661
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 comp->remove();
662 }
663
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 } else if (boost::optional<WaterToWaterComponent> comp = elem.optionalCast<WaterToWaterComponent>()) {
664
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
3 if (isSupplyComponent) {
665
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 comp->removeFromPlantLoop();
666 } else {
667
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 comp->removeFromSecondaryPlantLoop();
668 }
669
670
9/18
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 3 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 3 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 3 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
3 if ((!comp->plantLoop()) && (!comp->secondaryPlantLoop())) {
671
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 comp->remove();
672 }
673 47 }
674 }
675 }
676
677 24 return true;
678 24 }
679
680 21 bool PlantLoop_Impl::removeDemandBranchWithComponent(HVACComponent component) {
681
3/4
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 21 times.
21 if (!demandComponent(component.handle())) {
682 ✗ return false;
683 }
684
685
4/4
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
21 return removeBranchWithComponent(component, demandSplitter(), demandMixer(), false);
686 }
687
688 ✗ bool PlantLoop_Impl::isDemandBranchEmpty() {
689 ✗ Splitter splitter = this->demandSplitter();
690
691 ✗ if (splitter.lastOutletModelObject()->optionalCast<Mixer>()) {
692 ✗ return true;
693 } else {
694 ✗ return false;
695 }
696 ✗ }
697
698 426 Mixer PlantLoop_Impl::supplyMixer() const {
699
2/2
✓ Branch 1 taken 426 times.
✓ Branch 4 taken 426 times.
426 auto result = getObject<ModelObject>().getModelObjectTarget<Mixer>(OS_PlantLoopFields::SupplyMixerName);
700
2/2
✓ Branch 0 taken 416 times.
✓ Branch 1 taken 10 times.
426 if (result) {
701
2/2
✓ Branch 1 taken 416 times.
✓ Branch 4 taken 416 times.
416 return result.get();
702 }
703
3/3
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 8 taken 10 times.
10 return supplyComponents(IddObjectType::OS_Connector_Mixer).front().cast<Mixer>();
704 426 }
705
706 517 bool PlantLoop_Impl::setSupplyMixer(Mixer const& mixer) {
707
2/2
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
517 auto result = setPointer(OS_PlantLoopFields::SupplyMixerName, mixer.handle());
708
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 517 times.
517 OS_ASSERT(result);
709 517 return result;
710 }
711
712 451 Splitter PlantLoop_Impl::supplySplitter() const {
713
2/2
✓ Branch 1 taken 451 times.
✓ Branch 4 taken 451 times.
451 auto result = getObject<ModelObject>().getModelObjectTarget<Splitter>(OS_PlantLoopFields::SupplySplitterName);
714
2/2
✓ Branch 0 taken 441 times.
✓ Branch 1 taken 10 times.
451 if (result) {
715
2/2
✓ Branch 1 taken 441 times.
✓ Branch 4 taken 441 times.
441 return result.get();
716 }
717
3/3
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 8 taken 10 times.
10 return supplyComponents(IddObjectType::OS_Connector_Splitter).front().cast<Splitter>();
718 451 }
719
720 517 bool PlantLoop_Impl::setSupplySplitter(Splitter const& splitter) {
721
2/2
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
517 auto result = setPointer(OS_PlantLoopFields::SupplySplitterName, splitter.handle());
722
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 517 times.
517 OS_ASSERT(result);
723 517 return result;
724 }
725
726 545 Mixer PlantLoop_Impl::demandMixer() const {
727
2/2
✓ Branch 1 taken 545 times.
✓ Branch 4 taken 545 times.
545 auto result = getObject<ModelObject>().getModelObjectTarget<Mixer>(OS_PlantLoopFields::DemandMixerName);
728
2/2
✓ Branch 0 taken 535 times.
✓ Branch 1 taken 10 times.
545 if (result) {
729
2/2
✓ Branch 1 taken 535 times.
✓ Branch 4 taken 535 times.
535 return result.get();
730 }
731
3/3
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 8 taken 10 times.
10 return demandComponents(IddObjectType::OS_Connector_Mixer).front().cast<Mixer>();
732 545 }
733
734 517 bool PlantLoop_Impl::setDemandMixer(Mixer const& mixer) {
735
2/2
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
517 auto result = setPointer(OS_PlantLoopFields::DemandMixerName, mixer.handle());
736
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 517 times.
517 OS_ASSERT(result);
737 517 return result;
738 }
739
740 548 Splitter PlantLoop_Impl::demandSplitter() const {
741
2/2
✓ Branch 1 taken 548 times.
✓ Branch 4 taken 548 times.
548 auto result = getObject<ModelObject>().getModelObjectTarget<Splitter>(OS_PlantLoopFields::DemandSplitterName);
742
2/2
✓ Branch 0 taken 538 times.
✓ Branch 1 taken 10 times.
548 if (result) {
743
2/2
✓ Branch 1 taken 538 times.
✓ Branch 4 taken 538 times.
538 return result.get();
744 }
745
3/3
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 8 taken 10 times.
10 return demandComponents(IddObjectType::OS_Connector_Splitter).front().cast<Splitter>();
746 548 }
747
748 517 bool PlantLoop_Impl::setDemandSplitter(Splitter const& splitter) {
749
2/2
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
517 auto result = setPointer(OS_PlantLoopFields::DemandSplitterName, splitter.handle());
750
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 517 times.
517 OS_ASSERT(result);
751 517 return result;
752 }
753
754 241 std::string PlantLoop_Impl::loadDistributionScheme() {
755
1/1
✓ Branch 1 taken 241 times.
241 auto value = getString(OS_PlantLoopFields::LoadDistributionScheme, true);
756
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 241 times.
✗ Branch 4 not taken.
241 OS_ASSERT(value);
757
2/2
✓ Branch 1 taken 241 times.
✓ Branch 4 taken 241 times.
482 return value.get();
758 241 }
759
760 515 bool PlantLoop_Impl::setLoadDistributionScheme(const std::string& scheme) {
761
1/1
✓ Branch 1 taken 515 times.
515 auto thisScheme = scheme;
762
3/4
✓ Branch 1 taken 515 times.
✓ Branch 4 taken 515 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 515 times.
1030 if (istringEqual(thisScheme, "Sequential")) {
763 ✗ thisScheme = "SequentialLoad";
764
3/4
✓ Branch 1 taken 515 times.
✓ Branch 4 taken 515 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 515 times.
1030 } else if (istringEqual(thisScheme, "Uniform")) {
765 ✗ thisScheme = "UniformLoad";
766 }
767
1/1
✓ Branch 1 taken 515 times.
1030 return setString(OS_PlantLoopFields::LoadDistributionScheme, thisScheme);
768 515 }
769
770 240 double PlantLoop_Impl::maximumLoopTemperature() {
771
2/2
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
240 return getDouble(OS_PlantLoopFields::MaximumLoopTemperature, true).get();
772 }
773
774 ✗ bool PlantLoop_Impl::setMaximumLoopTemperature(double value) {
775 ✗ return setDouble(OS_PlantLoopFields::MaximumLoopTemperature, value);
776 }
777
778 240 double PlantLoop_Impl::minimumLoopTemperature() {
779
2/2
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
240 return getDouble(OS_PlantLoopFields::MinimumLoopTemperature, true).get();
780 }
781
782 ✗ bool PlantLoop_Impl::setMinimumLoopTemperature(double value) {
783 ✗ return setDouble(OS_PlantLoopFields::MinimumLoopTemperature, value);
784 }
785
786 ✗ boost::optional<double> PlantLoop_Impl::maximumLoopFlowRate() {
787 ✗ return getDouble(OS_PlantLoopFields::MaximumLoopFlowRate, true);
788 }
789
790 4 bool PlantLoop_Impl::setMaximumLoopFlowRate(double value) {
791 4 return setDouble(OS_PlantLoopFields::MaximumLoopFlowRate, value);
792 }
793
794 240 bool PlantLoop_Impl::isMaximumLoopFlowRateAutosized() {
795 240 bool result = false;
796
1/1
✓ Branch 1 taken 240 times.
240 boost::optional<std::string> value = getString(OS_PlantLoopFields::MaximumLoopFlowRate, true);
797
1/2
✓ Branch 0 taken 240 times.
✗ Branch 1 not taken.
240 if (value) {
798
3/3
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
✓ Branch 7 taken 240 times.
480 result = openstudio::istringEqual(value.get(), "Autosize");
799 }
800 240 return result;
801 240 }
802
803 ✗ void PlantLoop_Impl::autosizeMaximumLoopFlowRate() {
804 ✗ bool result = setString(OS_PlantLoopFields::MaximumLoopFlowRate, "Autosize");
805 ✗ OS_ASSERT(result);
806 ✗ }
807
808 240 boost::optional<double> PlantLoop_Impl::minimumLoopFlowRate() {
809 240 return getDouble(OS_PlantLoopFields::MinimumLoopFlowRate, true);
810 }
811
812 ✗ bool PlantLoop_Impl::setMinimumLoopFlowRate(double value) {
813 ✗ return setDouble(OS_PlantLoopFields::MinimumLoopFlowRate, value);
814 }
815
816 240 bool PlantLoop_Impl::isMinimumLoopFlowRateAutosized() {
817 240 bool result = false;
818
1/1
✓ Branch 1 taken 240 times.
240 boost::optional<std::string> value = getString(OS_PlantLoopFields::MinimumLoopFlowRate, true);
819
1/2
✓ Branch 0 taken 240 times.
✗ Branch 1 not taken.
240 if (value) {
820
3/3
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
✓ Branch 7 taken 240 times.
480 result = openstudio::istringEqual(value.get(), "Autosize");
821 }
822 240 return result;
823 240 }
824
825 ✗ void PlantLoop_Impl::autosizeMinimumLoopFlowRate() {
826 ✗ bool result = setString(OS_PlantLoopFields::MinimumLoopFlowRate, "Autosize");
827 ✗ OS_ASSERT(result);
828 ✗ }
829
830 ✗ boost::optional<double> PlantLoop_Impl::plantLoopVolume() {
831 ✗ return getDouble(OS_PlantLoopFields::PlantLoopVolume, true);
832 }
833
834 ✗ bool PlantLoop_Impl::setPlantLoopVolume(double value) {
835 ✗ return setDouble(OS_PlantLoopFields::PlantLoopVolume, value);
836 }
837
838 240 bool PlantLoop_Impl::isPlantLoopVolumeAutocalculated() {
839 240 bool result = false;
840
1/1
✓ Branch 1 taken 240 times.
240 boost::optional<std::string> value = getString(OS_PlantLoopFields::PlantLoopVolume, true);
841
1/2
✓ Branch 0 taken 240 times.
✗ Branch 1 not taken.
240 if (value) {
842
3/3
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
✓ Branch 7 taken 240 times.
480 result = openstudio::istringEqual(value.get(), "Autocalculate");
843 }
844 240 return result;
845 240 }
846
847 515 void PlantLoop_Impl::autocalculatePlantLoopVolume() {
848
2/2
✓ Branch 1 taken 515 times.
✓ Branch 4 taken 515 times.
1030 bool result = setString(OS_PlantLoopFields::PlantLoopVolume, "Autocalculate");
849
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 515 times.
515 OS_ASSERT(result);
850 515 }
851
852 243 std::string PlantLoop_Impl::fluidType() {
853
3/3
✓ Branch 1 taken 243 times.
✓ Branch 4 taken 243 times.
✓ Branch 7 taken 243 times.
243 return getString(OS_PlantLoopFields::FluidType, true).get();
854 }
855
856 92 bool PlantLoop_Impl::setFluidType(const std::string& value) {
857 92 return setString(OS_PlantLoopFields::FluidType, value);
858 }
859
860 58 int PlantLoop_Impl::glycolConcentration() const {
861
2/2
✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
58 return getInt(OS_PlantLoopFields::GlycolConcentration, true).get();
862 }
863
864 573 bool PlantLoop_Impl::setGlycolConcentration(int glycolConcentration) {
865 573 return setInt(OS_PlantLoopFields::GlycolConcentration, glycolConcentration);
866 }
867
868 240 Node PlantLoop_Impl::loopTemperatureSetpointNode() {
869 240 boost::optional<Node> node;
870
871
2/2
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
240 node = getObject<ModelObject>().getModelObjectTarget<Node>(OS_PlantLoopFields::LoopTemperatureSetpointNodeName);
872
873
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 240 times.
✗ Branch 4 not taken.
240 OS_ASSERT(node);
874
875
2/2
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
480 return node.get();
876 240 }
877
878 517 bool PlantLoop_Impl::setLoopTemperatureSetpointNode(Node& node) {
879
4/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 11 taken 517 times.
✗ Branch 12 not taken.
517 if (node.model() == this->model()) {
880
2/2
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
517 return setPointer(OS_PlantLoopFields::LoopTemperatureSetpointNodeName, node.handle());
881 }
882 ✗ return false;
883 }
884
885 242 std::vector<ModelObject> PlantLoop_Impl::children() const {
886 242 std::vector<ModelObject> result;
887
888
2/2
✓ Branch 1 taken 242 times.
✓ Branch 4 taken 242 times.
242 result.push_back(sizingPlant());
889
890 242 return result;
891 ✗ }
892
893 529 SizingPlant PlantLoop_Impl::sizingPlant() const {
894 529 boost::optional<SizingPlant> sizingPlant;
895
896 529 std::vector<SizingPlant> sizingObjects;
897
898
2/2
✓ Branch 1 taken 529 times.
✓ Branch 4 taken 529 times.
529 sizingObjects = model().getConcreteModelObjects<SizingPlant>();
899
900
2/2
✓ Branch 5 taken 1527 times.
✓ Branch 6 taken 529 times.
2056 for (const auto& sizingObject : sizingObjects) {
901
6/6
✓ Branch 1 taken 1527 times.
✓ Branch 4 taken 1527 times.
✓ Branch 7 taken 1527 times.
✓ Branch 10 taken 1527 times.
✓ Branch 13 taken 529 times.
✓ Branch 14 taken 998 times.
1527 if (sizingObject.plantLoop().handle() == this->handle()) {
902
1/1
✓ Branch 1 taken 529 times.
529 sizingPlant = sizingObject;
903 }
904 }
905
906
1/2
✓ Branch 0 taken 529 times.
✗ Branch 1 not taken.
529 if (sizingPlant) {
907
2/2
✓ Branch 1 taken 529 times.
✓ Branch 4 taken 529 times.
1058 return sizingPlant.get();
908 } else {
909 ✗ LOG_AND_THROW("PlantLoop missing SizingPlant object");
910 }
911 529 }
912
913 242 std::string PlantLoop_Impl::commonPipeSimulation() const {
914
1/1
✓ Branch 1 taken 242 times.
242 boost::optional<std::string> value = getString(OS_PlantLoopFields::CommonPipeSimulation, true);
915
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 242 times.
✗ Branch 4 not taken.
242 OS_ASSERT(value);
916
2/2
✓ Branch 1 taken 242 times.
✓ Branch 4 taken 242 times.
484 return value.get();
917 242 }
918
919 3 bool PlantLoop_Impl::isCommonPipeSimulationDefaulted() const {
920 3 return isEmpty(OS_PlantLoopFields::CommonPipeSimulation);
921 }
922
923 1 bool PlantLoop_Impl::setCommonPipeSimulation(const std::string& value) {
924 1 return setString(OS_PlantLoopFields::CommonPipeSimulation, value);
925 }
926
927 1 void PlantLoop_Impl::resetCommonPipeSimulation() {
928
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_PlantLoopFields::CommonPipeSimulation, "");
929
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
930 1 }
931
932 241 boost::optional<PlantEquipmentOperationHeatingLoad> PlantLoop_Impl::plantEquipmentOperationHeatingLoad() const {
933
1/1
✓ Branch 1 taken 241 times.
482 return getObject<ModelObject>().getModelObjectTarget<PlantEquipmentOperationHeatingLoad>(
934
1/1
✓ Branch 1 taken 241 times.
482 OS_PlantLoopFields::PlantEquipmentOperationHeatingLoad);
935 }
936
937 3 bool PlantLoop_Impl::setPlantEquipmentOperationHeatingLoad(
938 const boost::optional<PlantEquipmentOperationHeatingLoad>& plantEquipmentOperationHeatingLoad) {
939 3 bool result(false);
940
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (plantEquipmentOperationHeatingLoad) {
941
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 result = setPointer(OS_PlantLoopFields::PlantEquipmentOperationHeatingLoad, plantEquipmentOperationHeatingLoad.get().handle());
942 } else {
943 ✗ resetPlantEquipmentOperationHeatingLoad();
944 ✗ result = true;
945 }
946 3 return result;
947 }
948
949 ✗ void PlantLoop_Impl::resetPlantEquipmentOperationHeatingLoad() {
950 ✗ bool result = setString(OS_PlantLoopFields::PlantEquipmentOperationHeatingLoad, "");
951 ✗ OS_ASSERT(result);
952 ✗ }
953
954 242 boost::optional<PlantEquipmentOperationCoolingLoad> PlantLoop_Impl::plantEquipmentOperationCoolingLoad() const {
955
1/1
✓ Branch 1 taken 242 times.
484 return getObject<ModelObject>().getModelObjectTarget<PlantEquipmentOperationCoolingLoad>(
956
1/1
✓ Branch 1 taken 242 times.
484 OS_PlantLoopFields::PlantEquipmentOperationCoolingLoad);
957 }
958
959 2 bool PlantLoop_Impl::setPlantEquipmentOperationCoolingLoad(
960 const boost::optional<PlantEquipmentOperationCoolingLoad>& plantEquipmentOperationCoolingLoad) {
961 2 bool result(false);
962
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (plantEquipmentOperationCoolingLoad) {
963
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 result = setPointer(OS_PlantLoopFields::PlantEquipmentOperationCoolingLoad, plantEquipmentOperationCoolingLoad.get().handle());
964 } else {
965 ✗ resetPlantEquipmentOperationCoolingLoad();
966 ✗ result = true;
967 }
968 2 return result;
969 }
970
971 ✗ void PlantLoop_Impl::resetPlantEquipmentOperationCoolingLoad() {
972 ✗ bool result = setString(OS_PlantLoopFields::PlantEquipmentOperationCoolingLoad, "");
973 ✗ OS_ASSERT(result);
974 ✗ }
975
976 241 boost::optional<PlantEquipmentOperationScheme> PlantLoop_Impl::primaryPlantEquipmentOperationScheme() const {
977
2/2
✓ Branch 1 taken 241 times.
✓ Branch 4 taken 241 times.
241 return getObject<ModelObject>().getModelObjectTarget<PlantEquipmentOperationScheme>(OS_PlantLoopFields::PrimaryPlantEquipmentOperationScheme);
978 }
979
980 bool
981 2 PlantLoop_Impl::setPrimaryPlantEquipmentOperationScheme(const boost::optional<PlantEquipmentOperationScheme>& plantEquipmentOperationScheme) {
982 2 bool result(false);
983
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (plantEquipmentOperationScheme) {
984
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 result = setPointer(OS_PlantLoopFields::PrimaryPlantEquipmentOperationScheme, plantEquipmentOperationScheme.get().handle());
985 } else {
986 ✗ resetPrimaryPlantEquipmentOperationScheme();
987 ✗ result = true;
988 }
989 2 return result;
990 }
991
992 ✗ void PlantLoop_Impl::resetPrimaryPlantEquipmentOperationScheme() {
993 ✗ bool result = setString(OS_PlantLoopFields::PrimaryPlantEquipmentOperationScheme, "");
994 ✗ OS_ASSERT(result);
995 ✗ }
996
997 ✗ bool PlantLoop_Impl::setPlantEquipmentOperationHeatingLoadSchedule(Schedule& schedule) {
998 ✗ bool result = setSchedule(OS_PlantLoopFields::PlantEquipmentOperationHeatingLoadSchedule, "PlantLoop",
999 "Plant Equipment Operation Heating Load Schedule", schedule);
1000 ✗ return result;
1001 }
1002
1003 ✗ void PlantLoop_Impl::resetPlantEquipmentOperationHeatingLoadSchedule() {
1004 ✗ bool result = setString(OS_PlantLoopFields::PlantEquipmentOperationHeatingLoadSchedule, "");
1005 ✗ OS_ASSERT(result);
1006 ✗ }
1007
1008 2 boost::optional<Schedule> PlantLoop_Impl::plantEquipmentOperationHeatingLoadSchedule() const {
1009
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_PlantLoopFields::PlantEquipmentOperationHeatingLoadSchedule);
1010 }
1011
1012 1 bool PlantLoop_Impl::setPlantEquipmentOperationCoolingLoadSchedule(Schedule& schedule) {
1013
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
4 bool result = setSchedule(OS_PlantLoopFields::PlantEquipmentOperationCoolingLoadSchedule, "PlantLoop",
1014 "Plant Equipment Operation Cooling Load Schedule", schedule);
1015 1 return result;
1016 }
1017
1018 ✗ boost::optional<Schedule> PlantLoop_Impl::plantEquipmentOperationCoolingLoadSchedule() const {
1019 ✗ return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_PlantLoopFields::PlantEquipmentOperationCoolingLoadSchedule);
1020 }
1021
1022 ✗ void PlantLoop_Impl::resetPlantEquipmentOperationCoolingLoadSchedule() {
1023 ✗ bool result = setString(OS_PlantLoopFields::PlantEquipmentOperationCoolingLoadSchedule, "");
1024 ✗ OS_ASSERT(result);
1025 ✗ }
1026
1027 1 bool PlantLoop_Impl::setPrimaryPlantEquipmentOperationSchemeSchedule(Schedule& schedule) {
1028
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
4 bool result = setSchedule(OS_PlantLoopFields::PrimaryPlantEquipmentOperationSchemeSchedule, "PlantLoop",
1029 "Primary Plant Equipment Operation Scheme Schedule", schedule);
1030 1 return result;
1031 }
1032
1033 ✗ void PlantLoop_Impl::resetPrimaryPlantEquipmentOperationSchemeSchedule() {
1034 ✗ bool result = setString(OS_PlantLoopFields::PlantEquipmentOperationCoolingLoadSchedule, "");
1035 ✗ OS_ASSERT(result);
1036 ✗ }
1037
1038 ✗ boost::optional<Schedule> PlantLoop_Impl::primaryPlantEquipmentOperationSchemeSchedule() const {
1039 ✗ return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_PlantLoopFields::PrimaryPlantEquipmentOperationSchemeSchedule);
1040 }
1041
1042 1 bool PlantLoop_Impl::setComponentSetpointOperationSchemeSchedule(Schedule& schedule) {
1043
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
4 bool result = setSchedule(OS_PlantLoopFields::ComponentSetpointOperationSchemeSchedule, "PlantLoop",
1044 "Component Setpoint Operation Scheme Schedule", schedule);
1045 1 return result;
1046 }
1047
1048 1 boost::optional<Schedule> PlantLoop_Impl::componentSetpointOperationSchemeSchedule() const {
1049
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_PlantLoopFields::ComponentSetpointOperationSchemeSchedule);
1050 }
1051
1052 ✗ void PlantLoop_Impl::resetComponentSetpointOperationSchemeSchedule() {
1053 ✗ bool result = setString(OS_PlantLoopFields::ComponentSetpointOperationSchemeSchedule, "");
1054 ✗ OS_ASSERT(result);
1055 ✗ }
1056
1057 ✗ boost::optional<double> PlantLoop_Impl::autosizedMaximumLoopFlowRate() const {
1058 ✗ return getAutosizedValue("Maximum Loop Flow Rate", "m3/s");
1059 }
1060
1061 ✗ boost::optional<double> PlantLoop_Impl::autosizedPlantLoopVolume() const {
1062 ✗ return getAutosizedValue("Plant Loop Volume", "m3");
1063 }
1064
1065 ✗ void PlantLoop_Impl::autosize() {
1066 ✗ autosizeMaximumLoopFlowRate();
1067 ✗ autocalculatePlantLoopVolume();
1068 ✗ }
1069
1070 ✗ void PlantLoop_Impl::applySizingValues() {
1071 ✗ boost::optional<double> val;
1072 ✗ val = autosizedMaximumLoopFlowRate();
1073 ✗ if (val) {
1074 ✗ setMaximumLoopFlowRate(val.get());
1075 }
1076
1077 ✗ val = autosizedPlantLoopVolume();
1078 ✗ if (val) {
1079 ✗ setPlantLoopVolume(val.get());
1080 }
1081 ✗ }
1082
1083 // AVM section
1084 314 AvailabilityManagerAssignmentList PlantLoop_Impl::availabilityManagerAssignmentList() const {
1085 boost::optional<AvailabilityManagerAssignmentList> avmList =
1086
2/2
✓ Branch 1 taken 314 times.
✓ Branch 4 taken 314 times.
314 getObject<ModelObject>().getModelObjectTarget<AvailabilityManagerAssignmentList>(OS_PlantLoopFields::AvailabilityManagerListName);
1087
1/2
✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
314 if (avmList) {
1088
2/2
✓ Branch 1 taken 314 times.
✓ Branch 4 taken 314 times.
628 return avmList.get();
1089 } else {
1090 ✗ LOG_AND_THROW(briefDescription() << "doesn't have an AvailabilityManagerAssignmentList assigned, which shouldn't happen");
1091 }
1092 314 }
1093
1094 28 bool PlantLoop_Impl::addAvailabilityManager(const AvailabilityManager& availabilityManager) {
1095
1/1
✓ Branch 1 taken 28 times.
28 auto type = availabilityManager.iddObjectType();
1096
1097 // should be all types but NightCycle and NightVentilation (AirLoopHVAC);
1098 // and not HybridVentilation (AirLoop, and special, stand-alone)
1099
3/4
✓ Branch 1 taken 28 times.
✓ Branch 5 taken 27 times.
✓ Branch 8 taken 27 times.
✗ Branch 9 not taken.
55 if (type == IddObjectType::OS_AvailabilityManager_NightCycle || type == IddObjectType::OS_AvailabilityManager_HybridVentilation
1100
7/7
✓ Branch 0 taken 27 times.
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 27 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 25 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 25 times.
55 || type == IddObjectType::OS_AvailabilityManager_NightVentilation) {
1101
7/7
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 14 taken 3 times.
✓ Branch 17 taken 3 times.
✓ Branch 20 taken 3 times.
3 LOG(Warn, "Wrong AVM Type for a PlantLoop: " << availabilityManager.briefDescription());
1102 3 return false;
1103 } else {
1104
2/2
✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
25 return availabilityManagerAssignmentList().addAvailabilityManager(availabilityManager);
1105 }
1106 }
1107
1108 1 bool PlantLoop_Impl::addAvailabilityManager(const AvailabilityManager& availabilityManager, unsigned priority) {
1109
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return availabilityManagerAssignmentList().addAvailabilityManager(availabilityManager, priority);
1110 }
1111
1112 36 std::vector<AvailabilityManager> PlantLoop_Impl::availabilityManagers() const {
1113 // TODO: add the AVM Scheduled
1114
2/2
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
36 return availabilityManagerAssignmentList().availabilityManagers();
1115 }
1116
1117 1 bool PlantLoop_Impl::setAvailabilityManagers(const std::vector<AvailabilityManager>& avms) {
1118
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return availabilityManagerAssignmentList().setAvailabilityManagers(avms);
1119 }
1120
1121 2 void PlantLoop_Impl::resetAvailabilityManagers() {
1122 // TODO: should this affect the AVM Scheduled?
1123
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 availabilityManagerAssignmentList().resetAvailabilityManagers();
1124 2 }
1125
1126 1 bool PlantLoop_Impl::setAvailabilityManagerPriority(const AvailabilityManager& availabilityManager, unsigned priority) {
1127
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return availabilityManagerAssignmentList().setAvailabilityManagerPriority(availabilityManager, priority);
1128 }
1129
1130 2 unsigned PlantLoop_Impl::availabilityManagerPriority(const AvailabilityManager& availabilityManager) const {
1131
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return availabilityManagerAssignmentList().availabilityManagerPriority(availabilityManager);
1132 }
1133
1134 1 bool PlantLoop_Impl::removeAvailabilityManager(const AvailabilityManager& avm) {
1135
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return availabilityManagerAssignmentList().removeAvailabilityManager(avm);
1136 }
1137
1138 1 bool PlantLoop_Impl::removeAvailabilityManager(unsigned priority) {
1139
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return availabilityManagerAssignmentList().removeAvailabilityManager(priority);
1140 }
1141
1142 ✗ std::vector<EMSActuatorNames> PlantLoop_Impl::emsActuatorNames() const {
1143 std::vector<EMSActuatorNames> actuators{{"Plant Loop Overall", "On/Off Supervisory"},
1144 {"Supply Side Half Loop", "On/Off Supervisory"},
1145 {"Demand Side Half Loop", "On/Off Supervisory"},
1146 ✗ {"Plant Equipment Operation", "Distributed Load Rate"}}; //gets plantequipOperationScheme
1147 //DYNAMIC
1148 //{"Supply Side Branch", "On/Off Supervisory"}
1149 //{"Demand Side Branch", "On/Off Supervisory"}
1150 //{"Plant Component *", "On/Off Supervisory"}
1151 ✗ return actuators;
1152 ✗ }
1153
1154 ✗ std::vector<std::string> PlantLoop_Impl::emsInternalVariableNames() const {
1155 //"Component Remaining Current Demand Rate" is dynamic for the plantloop components
1156 ✗ std::vector<std::string> types{"Supply Side Current Demand Rate"};
1157 ✗ return types;
1158 ✗ }
1159
1160 517 void PlantLoop_Impl::createTopology() {
1161
1162
1/1
✓ Branch 1 taken 517 times.
517 auto m = model();
1163
1/1
✓ Branch 1 taken 517 times.
517 auto obj = getObject<model::PlantLoop>();
1164
1165 // supply side
1166
1/1
✓ Branch 1 taken 517 times.
517 Node supplyInletNode(m);
1167
1/1
✓ Branch 1 taken 517 times.
517 Node supplyOutletNode(m);
1168
1/1
✓ Branch 1 taken 517 times.
517 Node connectorNode(m);
1169
1170
1/1
✓ Branch 1 taken 517 times.
517 ConnectorMixer supplyMixer(m);
1171
1/1
✓ Branch 1 taken 517 times.
517 setSupplyMixer(supplyMixer);
1172
1/1
✓ Branch 1 taken 517 times.
517 ConnectorSplitter supplySplitter(m);
1173
1/1
✓ Branch 1 taken 517 times.
517 setSupplySplitter(supplySplitter);
1174
1175
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(obj, supplyInletPort(), supplyInletNode, supplyInletNode.inletPort());
1176
1177
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(supplyInletNode, supplyInletNode.outletPort(), supplySplitter, supplySplitter.inletPort());
1178
1179
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(supplySplitter, supplySplitter.nextOutletPort(), connectorNode, connectorNode.inletPort());
1180
1181
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(connectorNode, connectorNode.outletPort(), supplyMixer, supplyMixer.nextInletPort());
1182
1183
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(supplyMixer, supplyMixer.outletPort(), supplyOutletNode, supplyOutletNode.inletPort());
1184
1185
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(supplyOutletNode, supplyOutletNode.outletPort(), obj, supplyOutletPort());
1186
1187 // demand side
1188
1/1
✓ Branch 1 taken 517 times.
517 Node demandInletNode(m);
1189
1/1
✓ Branch 1 taken 517 times.
517 Node demandOutletNode(m);
1190
1/1
✓ Branch 1 taken 517 times.
517 Node branchNode(m);
1191
1/1
✓ Branch 1 taken 517 times.
517 ConnectorMixer mixer(m);
1192
1/1
✓ Branch 1 taken 517 times.
517 setDemandMixer(mixer);
1193
1/1
✓ Branch 1 taken 517 times.
517 ConnectorSplitter splitter(m);
1194
1/1
✓ Branch 1 taken 517 times.
517 setDemandSplitter(splitter);
1195
1196
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(obj, demandInletPort(), demandInletNode, demandInletNode.inletPort());
1197
1198
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(demandInletNode, demandInletNode.outletPort(), splitter, splitter.inletPort());
1199
1200
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(splitter, splitter.nextOutletPort(), branchNode, branchNode.inletPort());
1201
1202
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(branchNode, branchNode.outletPort(), mixer, mixer.nextInletPort());
1203
1204
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(mixer, mixer.outletPort(), demandOutletNode, demandOutletNode.inletPort());
1205
1206
5/5
✓ Branch 1 taken 517 times.
✓ Branch 4 taken 517 times.
✓ Branch 7 taken 517 times.
✓ Branch 10 taken 517 times.
✓ Branch 13 taken 517 times.
517 m.connect(demandOutletNode, demandOutletNode.outletPort(), obj, demandOutletPort());
1207
1208
1/1
✓ Branch 1 taken 517 times.
517 setLoopTemperatureSetpointNode(supplyOutletNode);
1209 517 }
1210
1211 } // namespace detail
1212
1213 515 PlantLoop::PlantLoop(Model& model) : Loop(PlantLoop::iddObjectType(), model) {
1214 515 auto impl = getImpl<detail::PlantLoop_Impl>();
1215
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 515 times.
✗ Branch 4 not taken.
515 OS_ASSERT(impl);
1216
1217 // Create topology
1218
1/1
✓ Branch 2 taken 515 times.
515 impl->createTopology();
1219
1220
1/1
✓ Branch 1 taken 515 times.
515 SizingPlant sizingPlant(model, *this);
1221
1222
1/1
✓ Branch 1 taken 515 times.
515 autocalculatePlantLoopVolume();
1223
2/2
✓ Branch 1 taken 515 times.
✓ Branch 4 taken 515 times.
515 setLoadDistributionScheme("Optimal");
1224
1225
1/1
✓ Branch 1 taken 515 times.
515 setGlycolConcentration(0);
1226
2/2
✓ Branch 1 taken 515 times.
✓ Branch 4 taken 515 times.
1030 setString(OS_PlantLoopFields::DemandSideConnectorListName, "");
1227
2/2
✓ Branch 1 taken 515 times.
✓ Branch 4 taken 515 times.
1030 setString(OS_PlantLoopFields::PlantLoopDemandCalculationScheme, "");
1228
2/2
✓ Branch 1 taken 515 times.
✓ Branch 4 taken 515 times.
1030 setString(OS_PlantLoopFields::CommonPipeSimulation, "");
1229
2/2
✓ Branch 1 taken 515 times.
✓ Branch 4 taken 515 times.
1030 setString(OS_PlantLoopFields::PressureSimulationType, "");
1230
1231 // AvailabilityManagerAssignmentList
1232
1/1
✓ Branch 1 taken 515 times.
515 AvailabilityManagerAssignmentList avmList(*this);
1233
2/2
✓ Branch 1 taken 515 times.
✓ Branch 4 taken 515 times.
515 setPointer(OS_PlantLoopFields::AvailabilityManagerListName, avmList.handle());
1234 515 }
1235
1236
1/1
✓ Branch 3 taken 8689 times.
8689 PlantLoop::PlantLoop(std::shared_ptr<detail::PlantLoop_Impl> impl) : Loop(std::move(impl)) {}
1237
1238 1 std::vector<IdfObject> PlantLoop::remove() {
1239
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->remove();
1240 }
1241
1242 2 ModelObject PlantLoop::clone(Model model) const {
1243
2/2
✓ Branch 3 taken 2 times.
✓ Branch 6 taken 2 times.
2 return getImpl<detail::PlantLoop_Impl>()->clone(model);
1244 }
1245
1246 ✗ unsigned PlantLoop::supplyInletPort() const {
1247 ✗ return getImpl<detail::PlantLoop_Impl>()->supplyInletPort();
1248 }
1249
1250 ✗ unsigned PlantLoop::supplyOutletPort() const {
1251 ✗ return getImpl<detail::PlantLoop_Impl>()->supplyOutletPort();
1252 }
1253
1254 ✗ unsigned PlantLoop::demandInletPort() const {
1255 ✗ return getImpl<detail::PlantLoop_Impl>()->demandInletPort();
1256 }
1257
1258 ✗ unsigned PlantLoop::demandOutletPort() const {
1259 ✗ return getImpl<detail::PlantLoop_Impl>()->demandOutletPort();
1260 }
1261
1262 1024 Node PlantLoop::supplyInletNode() const {
1263
1/1
✓ Branch 3 taken 1024 times.
1024 return getImpl<detail::PlantLoop_Impl>()->supplyInletNode();
1264 }
1265
1266 1854 Node PlantLoop::supplyOutletNode() const {
1267
1/1
✓ Branch 3 taken 1854 times.
1854 return getImpl<detail::PlantLoop_Impl>()->supplyOutletNode();
1268 }
1269
1270 ✗ std::vector<Node> PlantLoop::supplyOutletNodes() const {
1271 ✗ return getImpl<detail::PlantLoop_Impl>()->supplyOutletNodes();
1272 }
1273
1274 1082 Node PlantLoop::demandInletNode() const {
1275
1/1
✓ Branch 3 taken 1082 times.
1082 return getImpl<detail::PlantLoop_Impl>()->demandInletNode();
1276 }
1277
1278 1 std::vector<Node> PlantLoop::demandInletNodes() const {
1279
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->demandInletNodes();
1280 }
1281
1282 1112 Node PlantLoop::demandOutletNode() const {
1283
1/1
✓ Branch 3 taken 1112 times.
1112 return getImpl<detail::PlantLoop_Impl>()->demandOutletNode();
1284 }
1285
1286 262 bool PlantLoop::addDemandBranchForComponent(HVACComponent component, bool tertiary) {
1287
2/2
✓ Branch 3 taken 262 times.
✓ Branch 6 taken 262 times.
262 return getImpl<detail::PlantLoop_Impl>()->addDemandBranchForComponent(component, tertiary);
1288 }
1289
1290 161 bool PlantLoop::addSupplyBranchForComponent(HVACComponent component) {
1291
2/2
✓ Branch 3 taken 161 times.
✓ Branch 6 taken 161 times.
161 return getImpl<detail::PlantLoop_Impl>()->addSupplyBranchForComponent(component);
1292 }
1293
1294 3 bool PlantLoop::removeSupplyBranchWithComponent(HVACComponent component) {
1295
2/2
✓ Branch 3 taken 3 times.
✓ Branch 6 taken 3 times.
3 return getImpl<detail::PlantLoop_Impl>()->removeSupplyBranchWithComponent(component);
1296 }
1297
1298 21 bool PlantLoop::removeDemandBranchWithComponent(HVACComponent component) {
1299
2/2
✓ Branch 3 taken 21 times.
✓ Branch 6 taken 21 times.
21 return getImpl<detail::PlantLoop_Impl>()->removeDemandBranchWithComponent(component);
1300 }
1301
1302 258 Mixer PlantLoop::supplyMixer() const {
1303
1/1
✓ Branch 3 taken 258 times.
258 return getImpl<detail::PlantLoop_Impl>()->supplyMixer();
1304 }
1305
1306 283 Splitter PlantLoop::supplySplitter() const {
1307
1/1
✓ Branch 3 taken 283 times.
283 return getImpl<detail::PlantLoop_Impl>()->supplySplitter();
1308 }
1309
1310 262 Mixer PlantLoop::demandMixer() {
1311
1/1
✓ Branch 3 taken 262 times.
262 return getImpl<detail::PlantLoop_Impl>()->demandMixer();
1312 }
1313
1314 265 Splitter PlantLoop::demandSplitter() {
1315
1/1
✓ Branch 3 taken 265 times.
265 return getImpl<detail::PlantLoop_Impl>()->demandSplitter();
1316 }
1317
1318 14006 IddObjectType PlantLoop::iddObjectType() {
1319
1/1
✓ Branch 1 taken 14006 times.
14006 IddObjectType result(IddObjectType::OS_PlantLoop);
1320 14006 return result;
1321 }
1322
1323 ✗ std::vector<std::string> PlantLoop::commonPipeSimulationValues() {
1324 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_PlantLoopFields::CommonPipeSimulation);
1325 }
1326
1327 ✗ std::vector<std::string> PlantLoop::validCommonPipeSimulationValues() {
1328 ✗ return commonPipeSimulationValues();
1329 }
1330
1331 240 double PlantLoop::maximumLoopTemperature() {
1332
1/1
✓ Branch 3 taken 240 times.
240 return getImpl<detail::PlantLoop_Impl>()->maximumLoopTemperature();
1333 }
1334
1335 ✗ bool PlantLoop::setMaximumLoopTemperature(double value) {
1336 ✗ return getImpl<detail::PlantLoop_Impl>()->setMaximumLoopTemperature(value);
1337 }
1338
1339 240 double PlantLoop::minimumLoopTemperature() {
1340
1/1
✓ Branch 3 taken 240 times.
240 return getImpl<detail::PlantLoop_Impl>()->minimumLoopTemperature();
1341 }
1342
1343 ✗ bool PlantLoop::setMinimumLoopTemperature(double value) {
1344 ✗ return getImpl<detail::PlantLoop_Impl>()->setMinimumLoopTemperature(value);
1345 }
1346
1347 ✗ boost::optional<double> PlantLoop::maximumLoopFlowRate() {
1348 ✗ return getImpl<detail::PlantLoop_Impl>()->maximumLoopFlowRate();
1349 }
1350
1351 4 bool PlantLoop::setMaximumLoopFlowRate(double value) {
1352
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::PlantLoop_Impl>()->setMaximumLoopFlowRate(value);
1353 }
1354
1355 240 bool PlantLoop::isMaximumLoopFlowRateAutosized() {
1356
1/1
✓ Branch 3 taken 240 times.
240 return getImpl<detail::PlantLoop_Impl>()->isMaximumLoopFlowRateAutosized();
1357 }
1358
1359 ✗ void PlantLoop::autosizeMaximumLoopFlowRate() {
1360 ✗ getImpl<detail::PlantLoop_Impl>()->autosizeMaximumLoopFlowRate();
1361 ✗ }
1362
1363 240 boost::optional<double> PlantLoop::minimumLoopFlowRate() {
1364
1/1
✓ Branch 3 taken 240 times.
240 return getImpl<detail::PlantLoop_Impl>()->minimumLoopFlowRate();
1365 }
1366
1367 ✗ bool PlantLoop::setMinimumLoopFlowRate(double value) {
1368 ✗ return getImpl<detail::PlantLoop_Impl>()->setMinimumLoopFlowRate(value);
1369 }
1370
1371 240 bool PlantLoop::isMinimumLoopFlowRateAutosized() {
1372
1/1
✓ Branch 3 taken 240 times.
240 return getImpl<detail::PlantLoop_Impl>()->isMinimumLoopFlowRateAutosized();
1373 }
1374
1375 ✗ void PlantLoop::autosizeMinimumLoopFlowRate() {
1376 ✗ getImpl<detail::PlantLoop_Impl>()->autosizeMinimumLoopFlowRate();
1377 ✗ }
1378
1379 ✗ boost::optional<double> PlantLoop::plantLoopVolume() {
1380 ✗ return getImpl<detail::PlantLoop_Impl>()->plantLoopVolume();
1381 }
1382
1383 ✗ bool PlantLoop::setPlantLoopVolume(double value) {
1384 ✗ return getImpl<detail::PlantLoop_Impl>()->setPlantLoopVolume(value);
1385 }
1386
1387 240 bool PlantLoop::isPlantLoopVolumeAutocalculated() {
1388
1/1
✓ Branch 3 taken 240 times.
240 return getImpl<detail::PlantLoop_Impl>()->isPlantLoopVolumeAutocalculated();
1389 }
1390
1391 515 void PlantLoop::autocalculatePlantLoopVolume() {
1392
1/1
✓ Branch 3 taken 515 times.
515 getImpl<detail::PlantLoop_Impl>()->autocalculatePlantLoopVolume();
1393 515 }
1394
1395 243 std::string PlantLoop::fluidType() {
1396
1/1
✓ Branch 3 taken 243 times.
243 return getImpl<detail::PlantLoop_Impl>()->fluidType();
1397 }
1398
1399 92 bool PlantLoop::setFluidType(const std::string& value) {
1400
1/1
✓ Branch 3 taken 92 times.
92 return getImpl<detail::PlantLoop_Impl>()->setFluidType(value);
1401 }
1402
1403 ✗ std::vector<std::string> PlantLoop::fluidTypeValues() {
1404 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_PlantLoopFields::FluidType);
1405 }
1406
1407 ✗ std::vector<std::string> PlantLoop::validFluidTypeValues() {
1408 ✗ return fluidTypeValues();
1409 }
1410
1411 58 int PlantLoop::glycolConcentration() const {
1412
1/1
✓ Branch 3 taken 58 times.
58 return getImpl<detail::PlantLoop_Impl>()->glycolConcentration();
1413 }
1414
1415 573 bool PlantLoop::setGlycolConcentration(int glycolConcentration) {
1416
1/1
✓ Branch 3 taken 573 times.
573 return getImpl<detail::PlantLoop_Impl>()->setGlycolConcentration(glycolConcentration);
1417 }
1418
1419 240 Node PlantLoop::loopTemperatureSetpointNode() {
1420
1/1
✓ Branch 3 taken 240 times.
240 return getImpl<detail::PlantLoop_Impl>()->loopTemperatureSetpointNode();
1421 }
1422
1423 ✗ bool PlantLoop::setLoopTemperatureSetpointNode(Node& node) {
1424 ✗ return getImpl<detail::PlantLoop_Impl>()->setLoopTemperatureSetpointNode(node);
1425 }
1426
1427 286 SizingPlant PlantLoop::sizingPlant() const {
1428
1/1
✓ Branch 3 taken 286 times.
286 return getImpl<detail::PlantLoop_Impl>()->sizingPlant();
1429 }
1430
1431 242 std::string PlantLoop::commonPipeSimulation() const {
1432
1/1
✓ Branch 3 taken 242 times.
242 return getImpl<detail::PlantLoop_Impl>()->commonPipeSimulation();
1433 }
1434
1435 3 bool PlantLoop::isCommonPipeSimulationDefaulted() const {
1436
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::PlantLoop_Impl>()->isCommonPipeSimulationDefaulted();
1437 }
1438
1439 1 bool PlantLoop::setCommonPipeSimulation(const std::string& value) {
1440
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->setCommonPipeSimulation(value);
1441 }
1442
1443 1 void PlantLoop::resetCommonPipeSimulation() {
1444
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::PlantLoop_Impl>()->resetCommonPipeSimulation();
1445 1 }
1446
1447 241 boost::optional<PlantEquipmentOperationHeatingLoad> PlantLoop::plantEquipmentOperationHeatingLoad() const {
1448
1/1
✓ Branch 3 taken 241 times.
241 return getImpl<detail::PlantLoop_Impl>()->plantEquipmentOperationHeatingLoad();
1449 }
1450
1451 3 bool PlantLoop::setPlantEquipmentOperationHeatingLoad(const PlantEquipmentOperationHeatingLoad& plantOperation) {
1452
2/2
✓ Branch 3 taken 3 times.
✓ Branch 6 taken 3 times.
3 return getImpl<detail::PlantLoop_Impl>()->setPlantEquipmentOperationHeatingLoad(plantOperation);
1453 }
1454
1455 ✗ void PlantLoop::resetPlantEquipmentOperationHeatingLoad() {
1456 ✗ getImpl<detail::PlantLoop_Impl>()->resetPlantEquipmentOperationHeatingLoad();
1457 ✗ }
1458
1459 242 boost::optional<PlantEquipmentOperationCoolingLoad> PlantLoop::plantEquipmentOperationCoolingLoad() const {
1460
1/1
✓ Branch 3 taken 242 times.
242 return getImpl<detail::PlantLoop_Impl>()->plantEquipmentOperationCoolingLoad();
1461 }
1462
1463 2 bool PlantLoop::setPlantEquipmentOperationCoolingLoad(const PlantEquipmentOperationCoolingLoad& plantOperation) {
1464
2/2
✓ Branch 3 taken 2 times.
✓ Branch 6 taken 2 times.
2 return getImpl<detail::PlantLoop_Impl>()->setPlantEquipmentOperationCoolingLoad(plantOperation);
1465 }
1466
1467 ✗ void PlantLoop::resetPlantEquipmentOperationCoolingLoad() {
1468 ✗ getImpl<detail::PlantLoop_Impl>()->resetPlantEquipmentOperationCoolingLoad();
1469 ✗ }
1470
1471 241 boost::optional<PlantEquipmentOperationScheme> PlantLoop::primaryPlantEquipmentOperationScheme() const {
1472
1/1
✓ Branch 3 taken 241 times.
241 return getImpl<detail::PlantLoop_Impl>()->primaryPlantEquipmentOperationScheme();
1473 }
1474
1475 2 bool PlantLoop::setPrimaryPlantEquipmentOperationScheme(const PlantEquipmentOperationScheme& plantOperation) {
1476
2/2
✓ Branch 3 taken 2 times.
✓ Branch 6 taken 2 times.
2 return getImpl<detail::PlantLoop_Impl>()->setPrimaryPlantEquipmentOperationScheme(plantOperation);
1477 }
1478
1479 ✗ void PlantLoop::resetPrimaryPlantEquipmentOperationScheme() {
1480 ✗ getImpl<detail::PlantLoop_Impl>()->resetPrimaryPlantEquipmentOperationScheme();
1481 ✗ }
1482
1483 241 std::string PlantLoop::loadDistributionScheme() {
1484
1/1
✓ Branch 3 taken 241 times.
241 return getImpl<detail::PlantLoop_Impl>()->loadDistributionScheme();
1485 }
1486
1487 515 bool PlantLoop::setLoadDistributionScheme(const std::string& scheme) {
1488
1/1
✓ Branch 3 taken 515 times.
515 return getImpl<detail::PlantLoop_Impl>()->setLoadDistributionScheme(scheme);
1489 }
1490
1491 ✗ std::vector<std::string> PlantLoop::loadDistributionSchemeValues() {
1492 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_PlantLoopFields::LoadDistributionScheme);
1493 }
1494
1495 ✗ std::vector<std::string> PlantLoop::validLoadDistributionSchemeValues() {
1496 ✗ return loadDistributionSchemeValues();
1497 }
1498
1499 ✗ bool PlantLoop::setPlantEquipmentOperationHeatingLoadSchedule(Schedule& schedule) {
1500 ✗ return getImpl<detail::PlantLoop_Impl>()->setPlantEquipmentOperationHeatingLoadSchedule(schedule);
1501 }
1502
1503 ✗ void PlantLoop::resetPlantEquipmentOperationHeatingLoadSchedule() {
1504 ✗ getImpl<detail::PlantLoop_Impl>()->resetPlantEquipmentOperationHeatingLoadSchedule();
1505 ✗ }
1506
1507 2 boost::optional<Schedule> PlantLoop::plantEquipmentOperationHeatingLoadSchedule() const {
1508
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::PlantLoop_Impl>()->plantEquipmentOperationHeatingLoadSchedule();
1509 }
1510
1511 1 bool PlantLoop::setPlantEquipmentOperationCoolingLoadSchedule(Schedule& schedule) {
1512
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->setPlantEquipmentOperationCoolingLoadSchedule(schedule);
1513 }
1514
1515 ✗ boost::optional<Schedule> PlantLoop::plantEquipmentOperationCoolingLoadSchedule() const {
1516 ✗ return getImpl<detail::PlantLoop_Impl>()->plantEquipmentOperationCoolingLoadSchedule();
1517 }
1518
1519 ✗ void PlantLoop::resetPlantEquipmentOperationCoolingLoadSchedule() {
1520 ✗ getImpl<detail::PlantLoop_Impl>()->resetPlantEquipmentOperationCoolingLoadSchedule();
1521 ✗ }
1522
1523 1 bool PlantLoop::setPrimaryPlantEquipmentOperationSchemeSchedule(Schedule& schedule) {
1524
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->setPrimaryPlantEquipmentOperationSchemeSchedule(schedule);
1525 }
1526
1527 ✗ void PlantLoop::resetPrimaryPlantEquipmentOperationSchemeSchedule() {
1528 ✗ getImpl<detail::PlantLoop_Impl>()->resetPrimaryPlantEquipmentOperationSchemeSchedule();
1529 ✗ }
1530
1531 ✗ boost::optional<Schedule> PlantLoop::primaryPlantEquipmentOperationSchemeSchedule() const {
1532 ✗ return getImpl<detail::PlantLoop_Impl>()->primaryPlantEquipmentOperationSchemeSchedule();
1533 }
1534
1535 1 bool PlantLoop::setComponentSetpointOperationSchemeSchedule(Schedule& schedule) {
1536
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->setComponentSetpointOperationSchemeSchedule(schedule);
1537 }
1538
1539 1 boost::optional<Schedule> PlantLoop::componentSetpointOperationSchemeSchedule() const {
1540
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->componentSetpointOperationSchemeSchedule();
1541 }
1542
1543 ✗ void PlantLoop::resetComponentSetpointOperationSchemeSchedule() {
1544 ✗ getImpl<detail::PlantLoop_Impl>()->resetComponentSetpointOperationSchemeSchedule();
1545 ✗ }
1546
1547 ✗ boost::optional<double> PlantLoop::autosizedMaximumLoopFlowRate() const {
1548 ✗ return getImpl<detail::PlantLoop_Impl>()->autosizedMaximumLoopFlowRate();
1549 }
1550
1551 ✗ boost::optional<double> PlantLoop::autosizedPlantLoopVolume() const {
1552 ✗ return getImpl<detail::PlantLoop_Impl>()->autosizedPlantLoopVolume();
1553 }
1554
1555 /* Prefered way to interact with the Availability Managers */
1556 36 std::vector<AvailabilityManager> PlantLoop::availabilityManagers() const {
1557
1/1
✓ Branch 3 taken 36 times.
36 return getImpl<detail::PlantLoop_Impl>()->availabilityManagers();
1558 }
1559
1560 1 bool PlantLoop::setAvailabilityManagers(const std::vector<AvailabilityManager>& avms) {
1561
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->setAvailabilityManagers(avms);
1562 }
1563
1564 2 void PlantLoop::resetAvailabilityManagers() {
1565
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::PlantLoop_Impl>()->resetAvailabilityManagers();
1566 }
1567
1568 28 bool PlantLoop::addAvailabilityManager(const AvailabilityManager& availabilityManager) {
1569
1/1
✓ Branch 3 taken 28 times.
28 return getImpl<detail::PlantLoop_Impl>()->addAvailabilityManager(availabilityManager);
1570 }
1571 // End prefered way
1572
1573 1 bool PlantLoop::addAvailabilityManager(const AvailabilityManager& availabilityManager, unsigned priority) {
1574
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->addAvailabilityManager(availabilityManager, priority);
1575 }
1576
1577 2 unsigned PlantLoop::availabilityManagerPriority(const AvailabilityManager& availabilityManager) const {
1578
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::PlantLoop_Impl>()->availabilityManagerPriority(availabilityManager);
1579 }
1580
1581 1 bool PlantLoop::setAvailabilityManagerPriority(const AvailabilityManager& availabilityManager, unsigned priority) {
1582
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->setAvailabilityManagerPriority(availabilityManager, priority);
1583 }
1584
1585 1 bool PlantLoop::removeAvailabilityManager(const AvailabilityManager& availabilityManager) {
1586
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->removeAvailabilityManager(availabilityManager);
1587 }
1588
1589 1 bool PlantLoop::removeAvailabilityManager(const unsigned priority) {
1590
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantLoop_Impl>()->removeAvailabilityManager(priority);
1591 }
1592
1593 } // namespace model
1594 } // namespace openstudio
1595