| 123 | } |
| 124 | |
| 125 | void ZoneHVACComponent_Impl::removeReturnPlenum() { |
| 126 | Model m = model(); |
| 127 | auto plenum = returnPlenum(); |
| 128 | auto thisObject = getObject<ZoneHVACComponent>(); |
| 129 | |
| 130 | if (plenum) { |
| 131 | auto zone = thermalZone(); |
| 132 | OS_ASSERT(zone); |
| 133 | auto h = zone->handle(); |
| 134 | |
| 135 | auto inlet = inletNode(); |
| 136 | boost::optional<Node> plenumInletNode; |
| 137 | |
| 138 | auto plenumInlets = plenum->inletModelObjects(); |
| 139 | for (auto& plenumInlet : plenumInlets) { |
| 140 | auto node = plenumInlet.optionalCast<Node>(); |
| 141 | if (node) { |
| 142 | auto pl = node->inletModelObject(); |
| 143 | if (pl && pl->optionalCast<PortList>()) { |
| 144 | auto mo = pl->cast<PortList>().getImpl<model::detail::PortList_Impl>()->hvacComponent(); |
| 145 | if (mo.handle() == h) { |
| 146 | plenumInletNode = node; |
| 147 | break; |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | if (inlet && plenumInletNode) { |
| 154 | inlet->remove(); |
| 155 | auto branch = plenum->branchIndexForInletModelObject(plenumInletNode.get()); |
| 156 | plenum->removePortForBranch(branch); |
| 157 | m.connect(plenumInletNode.get(), plenumInletNode->outletPort(), thisObject, thisObject.inletPort()); |
| 158 | plenumInlets = plenum->inletModelObjects(); |
| 159 | if (plenumInlets.empty()) { |
| 160 | plenum->remove(); |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | bool ZoneHVACComponent_Impl::setReturnPlenum(const ThermalZone& plenumZone) { |
| 167 |
nothing calls this directly
no test coverage detected