| 197 | } |
| 198 | |
| 199 | boost::optional<PlantLoop> WaterToWaterComponent_Impl::plantLoop() const { |
| 200 | if (m_plantLoop) { |
| 201 | return m_plantLoop; |
| 202 | } else { |
| 203 | // Note: checking for supply side only isn't sufficient for CentralHeatPumpSystem |
| 204 | // because it is on the supply side of two plant loops: the heating and the cooling plant loop |
| 205 | // We rely on tertiaryPlantLoop() method which checks for actual node connections |
| 206 | boost::optional<PlantLoop> tertiaryPlantLoop = this->tertiaryPlantLoop(); |
| 207 | |
| 208 | std::vector<PlantLoop> plantLoops = this->model().getConcreteModelObjects<PlantLoop>(); |
| 209 | |
| 210 | for (const auto& elem : plantLoops) { |
| 211 | OptionalPlantLoop plantLoop = elem.optionalCast<PlantLoop>(); |
| 212 | if (plantLoop) { |
| 213 | // Check that the component is on the supply side of the PlantLoop |
| 214 | if (plantLoop->supplyComponent(this->handle())) { |
| 215 | // Skip the tertiary one |
| 216 | if (tertiaryPlantLoop) { |
| 217 | if (plantLoop->handle() == tertiaryPlantLoop->handle()) { |
| 218 | continue; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | m_plantLoop = plantLoop; |
| 223 | |
| 224 | return plantLoop; |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | return boost::none; |
| 231 | } |
| 232 | |
| 233 | boost::optional<PlantLoop> WaterToWaterComponent_Impl::secondaryPlantLoop() const { |
| 234 | if (m_secondaryPlantLoop) { |
no test coverage detected