MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / addToNode

Method addToNode

src/model/ConnectorSplitter.cpp:73–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 }
72
73 bool ConnectorSplitter_Impl::addToNode(Node& node) {
74 auto t_model = model();
75
76 if (node.model() != t_model) {
77 return false;
78 }
79
80 if (loop()) {
81 return false;
82 }
83
84 if (!outletModelObjects().empty()) {
85 LOG(Warn, briefDescription() << " must not have existing outlet connections to use addToNode method.");
86 return false;
87 }
88
89 auto t_nodeAirLoop = node.airLoopHVAC();
90
91 if (!t_nodeAirLoop) {
92 LOG(Warn, briefDescription() << " must be added to an AirLoopHVAC supply node use addToNode method.");
93 return false;
94 }
95
96 if (!t_nodeAirLoop->supplyComponent(node.handle())) {
97 LOG(Warn, briefDescription() << " must be added to an AirLoopHVAC supply node use addToNode method.");
98 return false;
99 }
100
101 if (!t_nodeAirLoop->supplyComponents(iddObjectType()).empty()) {
102 LOG(Warn, briefDescription() << " already has a splitter.");
103 return false;
104 }
105
106 auto supplyInletNode = t_nodeAirLoop->supplyInletNode();
107 auto supplyOutletNode = t_nodeAirLoop->supplyOutletNode();
108
109 // Hook Up Duct "A"
110 auto t_inletPort = inletPort();
111 auto portA = nextOutletPort();
112 HVACComponent_Impl::addToNode(node, supplyInletNode, supplyOutletNode, t_inletPort, portA);
113
114 // Hook Up Duct "B"
115 Node supplyOutletNodeB(t_model);
116 auto thisObject = getObject<model::HVACComponent>();
117 auto portB = nextOutletPort();
118 t_model.connect(thisObject, portB, supplyOutletNodeB, supplyOutletNodeB.inletPort());
119 t_model.connect(supplyOutletNodeB, supplyOutletNodeB.outletPort(), t_nodeAirLoop.get(),
120 t_nodeAirLoop->getImpl<detail::AirLoopHVAC_Impl>()->supplyOutletPortB());
121
122 return true;
123 }
124
125 ModelObject ConnectorSplitter_Impl::clone(Model model) const {
126 return HVACComponent_Impl::clone(model);

Callers

nothing calls this directly

Calls 14

supplyComponentMethod · 0.80
supplyComponentsMethod · 0.80
supplyOutletPortBMethod · 0.80
iddObjectTypeFunction · 0.70
modelMethod · 0.45
emptyMethod · 0.45
airLoopHVACMethod · 0.45
handleMethod · 0.45
supplyInletNodeMethod · 0.45
supplyOutletNodeMethod · 0.45
connectMethod · 0.45
inletPortMethod · 0.45

Tested by

no test coverage detected