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

Method removeReturnPlenum

src/model/ZoneHVACComponent.cpp:125–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 13

inletNodeFunction · 0.85
inletModelObjectsMethod · 0.80
hvacComponentMethod · 0.80
handleMethod · 0.45
inletModelObjectMethod · 0.45
removeMethod · 0.45
getMethod · 0.45
removePortForBranchMethod · 0.45
connectMethod · 0.45
outletPortMethod · 0.45
inletPortMethod · 0.45

Tested by

no test coverage detected