| 231 | } |
| 232 | |
| 233 | boost::optional<PlantLoop> WaterToWaterComponent_Impl::secondaryPlantLoop() const { |
| 234 | if (m_secondaryPlantLoop) { |
| 235 | return m_secondaryPlantLoop; |
| 236 | } else { |
| 237 | // JM: Same comment as for plantLoop() above |
| 238 | // Any WaterToWaterComponent that has an Heat Recovery loop could be on the demand side of two plant loops |
| 239 | boost::optional<PlantLoop> tertiaryPlantLoop = this->tertiaryPlantLoop(); |
| 240 | |
| 241 | std::vector<PlantLoop> plantLoops = this->model().getConcreteModelObjects<PlantLoop>(); |
| 242 | |
| 243 | for (const auto& elem : plantLoops) { |
| 244 | OptionalPlantLoop plantLoop = elem.optionalCast<PlantLoop>(); |
| 245 | if (plantLoop) { |
| 246 | if (plantLoop->demandComponent(this->handle())) { |
| 247 | |
| 248 | // Skip the tertiary one |
| 249 | if (tertiaryPlantLoop) { |
| 250 | if (plantLoop->handle() == tertiaryPlantLoop->handle()) { |
| 251 | continue; |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | m_secondaryPlantLoop = plantLoop; |
| 256 | |
| 257 | return plantLoop; |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | return boost::none; |
| 264 | } |
| 265 | |
| 266 | bool WaterToWaterComponent_Impl::removeFromPlantLoop() { |
| 267 | if (auto plant = plantLoop()) { |
nothing calls this directly
no test coverage detected