| 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); |
nothing calls this directly
no test coverage detected