| 288 | } |
| 289 | |
| 290 | boost::optional<PlantLoop> WaterToWaterComponent_Impl::tertiaryPlantLoop() const { |
| 291 | if (m_tertiaryPlantLoop) { |
| 292 | return m_tertiaryPlantLoop; |
| 293 | } else { |
| 294 | boost::optional<HVACComponent> tertiaryOutletHVACComponent; |
| 295 | |
| 296 | if (auto t_tertiaryOutletModelObject = tertiaryOutletModelObject()) { |
| 297 | tertiaryOutletHVACComponent = t_tertiaryOutletModelObject->optionalCast<HVACComponent>(); |
| 298 | } |
| 299 | |
| 300 | if (tertiaryOutletHVACComponent) { |
| 301 | auto plantLoops = this->model().getConcreteModelObjects<PlantLoop>(); |
| 302 | |
| 303 | // WaterToWaterComponent instances can be connected to tertiary plants |
| 304 | // from the demand or supply side so check for both possibilities |
| 305 | for (const auto& plantLoop : plantLoops) { |
| 306 | if (!plantLoop.supplyComponents(plantLoop.supplyInletNode(), tertiaryOutletHVACComponent.get()).empty()) { |
| 307 | m_tertiaryPlantLoop = plantLoop; |
| 308 | return plantLoop; |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | for (const auto& plantLoop : plantLoops) { |
| 313 | if (!plantLoop.demandComponents(plantLoop.demandInletNode(), tertiaryOutletHVACComponent.get()).empty()) { |
| 314 | m_tertiaryPlantLoop = plantLoop; |
| 315 | return plantLoop; |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | return boost::none; |
| 322 | } |
| 323 | |
| 324 | bool WaterToWaterComponent_Impl::removeFromTertiaryPlantLoop() { |
| 325 | if (auto plant = tertiaryPlantLoop()) { |