| 206 | } |
| 207 | |
| 208 | bool ZoneHVACComponent_Impl::addToThermalZone(ThermalZone& thermalZone) { |
| 209 | Model m = this->model(); |
| 210 | |
| 211 | if (thermalZone.model() != m) { |
| 212 | return false; |
| 213 | } |
| 214 | |
| 215 | if (thermalZone.isPlenum()) { |
| 216 | return false; |
| 217 | } |
| 218 | |
| 219 | removeFromThermalZone(); |
| 220 | |
| 221 | thermalZone.setUseIdealAirLoads(false); |
| 222 | |
| 223 | // Connect nodes if this is an air based zone hvac component |
| 224 | if (inletPort() != 0u && outletPort() != 0u) { |
| 225 | // Exhaust Node |
| 226 | Node exhaustNode(m); |
| 227 | PortList exhaustPortList = thermalZone.exhaustPortList(); |
| 228 | unsigned nextPort = exhaustPortList.nextPort(); |
| 229 | m.connect(exhaustPortList, nextPort, exhaustNode, exhaustNode.inletPort()); |
| 230 | auto mo = this->getObject<ModelObject>(); |
| 231 | m.connect(exhaustNode, exhaustNode.outletPort(), mo, this->inletPort()); |
| 232 | |
| 233 | // Air Inlet Node |
| 234 | Node airInletNode(m); |
| 235 | PortList inletPortList = thermalZone.inletPortList(); |
| 236 | unsigned nextInletPort = inletPortList.nextPort(); |
| 237 | m.connect(airInletNode, airInletNode.outletPort(), inletPortList, nextInletPort); |
| 238 | m.connect(mo, this->outletPort(), airInletNode, airInletNode.inletPort()); |
| 239 | } |
| 240 | |
| 241 | thermalZone.addEquipment(this->getObject<ZoneHVACComponent>()); |
| 242 | |
| 243 | return true; |
| 244 | } |
| 245 | |
| 246 | void ZoneHVACComponent_Impl::removeFromThermalZone() { |
| 247 | boost::optional<ThermalZone> thermalZone = this->thermalZone(); |
nothing calls this directly
no test coverage detected