src/model/WaterToAirComponent.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "WaterToAirComponent.hpp" | ||
| 7 | #include "WaterToAirComponent_Impl.hpp" | ||
| 8 | #include "ControllerWaterCoil.hpp" | ||
| 9 | #include "ControllerWaterCoil_Impl.hpp" | ||
| 10 | #include "Model.hpp" | ||
| 11 | |||
| 12 | #include "AirLoopHVAC.hpp" | ||
| 13 | #include "AirLoopHVAC_Impl.hpp" | ||
| 14 | #include "PlantLoop.hpp" | ||
| 15 | #include "PlantLoop_Impl.hpp" | ||
| 16 | #include "Node.hpp" | ||
| 17 | #include "Node_Impl.hpp" | ||
| 18 | #include "Splitter.hpp" | ||
| 19 | #include "Splitter_Impl.hpp" | ||
| 20 | #include "Mixer.hpp" | ||
| 21 | #include "Mixer_Impl.hpp" | ||
| 22 | #include "../utilities/core/Assert.hpp" | ||
| 23 | |||
| 24 | namespace openstudio { | ||
| 25 | |||
| 26 | namespace model { | ||
| 27 | |||
| 28 | namespace detail { | ||
| 29 | |||
| 30 | ✗ | WaterToAirComponent_Impl::WaterToAirComponent_Impl(IddObjectType type, Model_Impl* model) : HVACComponent_Impl(type, model) {} | |
| 31 | |||
| 32 | 298 | WaterToAirComponent_Impl::WaterToAirComponent_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 33 | 298 | : HVACComponent_Impl(idfObject, model, keepHandle) {} | |
| 34 | |||
| 35 | 30 | WaterToAirComponent_Impl::WaterToAirComponent_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 36 | 30 | : HVACComponent_Impl(other, model, keepHandle) {} | |
| 37 | |||
| 38 | 142 | WaterToAirComponent_Impl::WaterToAirComponent_Impl(const WaterToAirComponent_Impl& other, Model_Impl* model, bool keepHandles) | |
| 39 | 142 | : HVACComponent_Impl(other, model, keepHandles) {} | |
| 40 | |||
| 41 | ✗ | boost::optional<Loop> WaterToAirComponent_Impl::loop() const { | |
| 42 | ✗ | return boost::none; | |
| 43 | } | ||
| 44 | |||
| 45 | 3911 | boost::optional<ModelObject> WaterToAirComponent_Impl::airInletModelObject() const { | |
| 46 | 3911 | return connectedObject(airInletPort()); | |
| 47 | } | ||
| 48 | |||
| 49 | 3852 | boost::optional<ModelObject> WaterToAirComponent_Impl::airOutletModelObject() const { | |
| 50 | 3852 | return connectedObject(airOutletPort()); | |
| 51 | } | ||
| 52 | |||
| 53 | 6133 | boost::optional<ModelObject> WaterToAirComponent_Impl::waterInletModelObject() const { | |
| 54 | 6133 | return connectedObject(waterInletPort()); | |
| 55 | } | ||
| 56 | |||
| 57 | 2322 | boost::optional<ModelObject> WaterToAirComponent_Impl::waterOutletModelObject() const { | |
| 58 | 2322 | return connectedObject(waterOutletPort()); | |
| 59 | } | ||
| 60 | |||
| 61 | 5872 | std::vector<HVACComponent> WaterToAirComponent_Impl::edges(const boost::optional<HVACComponent>& prev) { | |
| 62 | 5872 | std::vector<HVACComponent> edges; | |
| 63 | |||
| 64 | 2174 | auto pushWaterOutletModelObject = [&]() { | |
| 65 |
2/3✓ Branch 1 taken 2174 times.
✓ Branch 3 taken 2174 times.
✗ Branch 4 not taken.
|
4348 | if (auto edgeModelObject = waterOutletModelObject()) { |
| 66 |
2/2✓ Branch 1 taken 2174 times.
✓ Branch 4 taken 2174 times.
|
2174 | auto edgeHVACComponent = edgeModelObject->optionalCast<HVACComponent>(); |
| 67 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 2174 times.
✗ Branch 4 not taken.
|
2174 | OS_ASSERT(edgeHVACComponent); |
| 68 |
2/2✓ Branch 1 taken 2174 times.
✓ Branch 4 taken 2174 times.
|
2174 | edges.push_back(edgeHVACComponent.get()); |
| 69 | 4348 | } | |
| 70 | 2174 | }; | |
| 71 | |||
| 72 | 3717 | auto pushAirOutletModelObject = [&]() { | |
| 73 |
3/3✓ Branch 1 taken 3717 times.
✓ Branch 3 taken 3701 times.
✓ Branch 4 taken 16 times.
|
7434 | if (auto edgeModelObject = airOutletModelObject()) { |
| 74 |
2/2✓ Branch 1 taken 3701 times.
✓ Branch 4 taken 3701 times.
|
3701 | auto edgeHVACComponent = edgeModelObject->optionalCast<HVACComponent>(); |
| 75 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3701 times.
✗ Branch 4 not taken.
|
3701 | OS_ASSERT(edgeHVACComponent); |
| 76 |
2/2✓ Branch 1 taken 3701 times.
✓ Branch 4 taken 3701 times.
|
3701 | edges.push_back(edgeHVACComponent.get()); |
| 77 | 7418 | } | |
| 78 | 9589 | }; | |
| 79 | |||
| 80 |
2/2✓ Branch 0 taken 5853 times.
✓ Branch 1 taken 19 times.
|
5872 | if (prev) { |
| 81 |
3/3✓ Branch 1 taken 5853 times.
✓ Branch 3 taken 5264 times.
✓ Branch 4 taken 589 times.
|
11706 | if (auto inletModelObject = waterInletModelObject()) { |
| 82 |
5/5✓ Branch 1 taken 5264 times.
✓ Branch 4 taken 5264 times.
✓ Branch 7 taken 5264 times.
✓ Branch 9 taken 2155 times.
✓ Branch 10 taken 3109 times.
|
5264 | if (prev.get() == inletModelObject.get()) { |
| 83 |
1/1✓ Branch 1 taken 2155 times.
|
2155 | pushWaterOutletModelObject(); |
| 84 | 2155 | return edges; | |
| 85 | } | ||
| 86 | 5853 | } | |
| 87 |
2/3✓ Branch 1 taken 3698 times.
✓ Branch 3 taken 3698 times.
✗ Branch 4 not taken.
|
7396 | if (auto inletModelObject = airInletModelObject()) { |
| 88 |
4/5✓ Branch 1 taken 3698 times.
✓ Branch 4 taken 3698 times.
✓ Branch 7 taken 3698 times.
✓ Branch 9 taken 3698 times.
✗ Branch 10 not taken.
|
3698 | if (prev.get() == inletModelObject.get()) { |
| 89 |
1/1✓ Branch 1 taken 3698 times.
|
3698 | pushAirOutletModelObject(); |
| 90 | 3698 | return edges; | |
| 91 | } | ||
| 92 | 3698 | } | |
| 93 | } else { | ||
| 94 |
1/1✓ Branch 1 taken 19 times.
|
19 | pushWaterOutletModelObject(); |
| 95 |
1/1✓ Branch 1 taken 19 times.
|
19 | pushAirOutletModelObject(); |
| 96 | 19 | return edges; | |
| 97 | } | ||
| 98 | |||
| 99 | ✗ | return edges; | |
| 100 | ✗ | } | |
| 101 | |||
| 102 | 139 | boost::optional<AirLoopHVAC> WaterToAirComponent_Impl::airLoopHVAC() const { | |
| 103 | 139 | return HVACComponent_Impl::airLoopHVAC(); | |
| 104 | } | ||
| 105 | |||
| 106 | 292 | boost::optional<PlantLoop> WaterToAirComponent_Impl::plantLoop() const { | |
| 107 | 292 | return HVACComponent_Impl::plantLoop(); | |
| 108 | } | ||
| 109 | |||
| 110 | 213 | bool WaterToAirComponent_Impl::addToNode(Node& node) { | |
| 111 |
1/1✓ Branch 1 taken 213 times.
|
213 | auto _model = node.model(); |
| 112 |
1/1✓ Branch 1 taken 213 times.
|
213 | auto thisModelObject = getObject<ModelObject>(); |
| 113 |
1/1✓ Branch 1 taken 213 times.
|
213 | auto t_airLoop = node.airLoopHVAC(); |
| 114 |
1/1✓ Branch 1 taken 213 times.
|
213 | auto t_plantLoop = node.plantLoop(); |
| 115 |
1/1✓ Branch 1 taken 213 times.
|
213 | auto t_oaSystem = node.airLoopHVACOutdoorAirSystem(); |
| 116 | |||
| 117 | 213 | boost::optional<unsigned> componentInletPort; | |
| 118 | 213 | boost::optional<unsigned> componentOutletPort; | |
| 119 | |||
| 120 | 213 | boost::optional<HVACComponent> systemStartComponent; | |
| 121 | 213 | boost::optional<HVACComponent> systemEndComponent; | |
| 122 | |||
| 123 |
2/3✓ Branch 3 taken 213 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 213 times.
|
213 | if (node.getImpl<Node_Impl>()->isConnected(thisModelObject)) { |
| 124 | ✗ | return false; | |
| 125 | } | ||
| 126 | |||
| 127 |
6/6✓ Branch 0 taken 62 times.
✓ Branch 1 taken 151 times.
✓ Branch 3 taken 59 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 59 times.
✓ Branch 6 taken 154 times.
|
213 | if (t_airLoop && !t_oaSystem) { |
| 128 |
5/5✓ Branch 1 taken 59 times.
✓ Branch 4 taken 59 times.
✓ Branch 7 taken 59 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 58 times.
|
118 | if (t_airLoop->demandComponent(node.handle())) { |
| 129 | 1 | return false; | |
| 130 | } | ||
| 131 | |||
| 132 |
3/3✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
✓ Branch 7 taken 58 times.
|
58 | systemStartComponent = t_airLoop->supplyInletNode(); |
| 133 |
2/2✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
|
58 | auto nodes = t_airLoop->supplyOutletNodes(); |
| 134 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 4 not taken.
|
58 | OS_ASSERT(!nodes.empty()); |
| 135 |
16/22✓ Branch 1 taken 14 times.
✓ Branch 2 taken 44 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
✓ Branch 14 taken 14 times.
✓ Branch 17 taken 7 times.
✓ Branch 18 taken 7 times.
✓ Branch 19 taken 14 times.
✓ Branch 20 taken 44 times.
✓ Branch 22 taken 14 times.
✓ Branch 23 taken 44 times.
✓ Branch 25 taken 14 times.
✓ Branch 26 taken 44 times.
✓ Branch 27 taken 7 times.
✓ Branch 28 taken 51 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
|
86 | if ((nodes.size() == 2u) && (!t_airLoop->supplyComponents(node, nodes[1]).empty())) { |
| 136 |
1/1✓ Branch 2 taken 7 times.
|
7 | systemEndComponent = nodes[1]; |
| 137 | } else { | ||
| 138 |
1/1✓ Branch 2 taken 51 times.
|
51 | systemEndComponent = nodes[0]; |
| 139 | } | ||
| 140 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 4 not taken.
|
58 | OS_ASSERT(systemEndComponent); |
| 141 |
2/2✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
|
58 | componentInletPort = airInletPort(); |
| 142 |
2/2✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
|
58 | componentOutletPort = airOutletPort(); |
| 143 | |||
| 144 |
1/1✓ Branch 1 taken 58 times.
|
58 | removeFromAirLoopHVAC(); |
| 145 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 2 taken 147 times.
|
212 | } else if (t_oaSystem) { |
| 146 |
5/5✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 3 times.
|
14 | if (t_oaSystem->oaComponent(node.handle())) { |
| 147 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | systemStartComponent = t_oaSystem->outboardOANode(); |
| 148 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | systemEndComponent = t_oaSystem.get(); |
| 149 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | componentInletPort = airInletPort(); |
| 150 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | componentOutletPort = airOutletPort(); |
| 151 |
4/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
|
6 | } else if (t_oaSystem->reliefComponent(node.handle())) { |
| 152 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | systemStartComponent = t_oaSystem.get(); |
| 153 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | systemEndComponent = t_oaSystem->outboardReliefNode(); |
| 154 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | componentInletPort = airInletPort(); |
| 155 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | componentOutletPort = airOutletPort(); |
| 156 | } | ||
| 157 |
1/1✓ Branch 1 taken 7 times.
|
7 | removeFromAirLoopHVAC(); |
| 158 |
1/2✓ Branch 0 taken 147 times.
✗ Branch 1 not taken.
|
147 | } else if (t_plantLoop) { |
| 159 |
5/5✓ Branch 1 taken 147 times.
✓ Branch 4 taken 147 times.
✓ Branch 7 taken 147 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 146 times.
|
147 | if (!t_plantLoop->demandComponent(node.handle())) { |
| 160 | 1 | return false; | |
| 161 | } | ||
| 162 | |||
| 163 |
3/3✓ Branch 1 taken 146 times.
✓ Branch 4 taken 146 times.
✓ Branch 7 taken 146 times.
|
146 | systemStartComponent = t_plantLoop->demandInletNode(); |
| 164 |
3/3✓ Branch 1 taken 146 times.
✓ Branch 4 taken 146 times.
✓ Branch 7 taken 146 times.
|
146 | systemEndComponent = t_plantLoop->demandOutletNode(); |
| 165 |
2/2✓ Branch 1 taken 146 times.
✓ Branch 4 taken 146 times.
|
146 | componentInletPort = waterInletPort(); |
| 166 |
2/2✓ Branch 1 taken 146 times.
✓ Branch 4 taken 146 times.
|
146 | componentOutletPort = waterOutletPort(); |
| 167 | |||
| 168 |
1/1✓ Branch 1 taken 146 times.
|
146 | removeFromPlantLoop(); |
| 169 | } | ||
| 170 | |||
| 171 |
5/10✓ Branch 0 taken 211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 211 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 211 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 211 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 211 times.
✗ Branch 9 not taken.
|
844 | if (systemStartComponent && systemEndComponent && componentOutletPort && componentInletPort) { |
| 172 |
3/3✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
✓ Branch 7 taken 211 times.
|
211 | return HVACComponent_Impl::addToNode(node, systemStartComponent.get(), systemEndComponent.get(), componentInletPort.get(), |
| 173 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
|
422 | componentOutletPort.get()); |
| 174 | } else { | ||
| 175 | ✗ | return false; | |
| 176 | } | ||
| 177 | 213 | } | |
| 178 | |||
| 179 | 21 | std::vector<openstudio::IdfObject> WaterToAirComponent_Impl::remove() { | |
| 180 |
1/2✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
|
21 | if (isRemovable()) { |
| 181 | 21 | removeFromAirLoopHVAC(); | |
| 182 | |||
| 183 | 21 | removeFromPlantLoop(); | |
| 184 | |||
| 185 | 21 | return HVACComponent_Impl::remove(); | |
| 186 | } | ||
| 187 | |||
| 188 | ✗ | return {}; | |
| 189 | } | ||
| 190 | |||
| 191 | 43 | ModelObject WaterToAirComponent_Impl::clone(Model model) const { | |
| 192 |
3/3✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
✓ Branch 7 taken 43 times.
|
43 | auto mo = HVACComponent_Impl::clone(model).cast<WaterToAirComponent>(); |
| 193 | |||
| 194 |
3/3✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
✓ Branch 7 taken 43 times.
|
86 | mo.setString(mo.airInletPort(), ""); |
| 195 |
3/3✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
✓ Branch 7 taken 43 times.
|
86 | mo.setString(mo.airOutletPort(), ""); |
| 196 | |||
| 197 |
3/3✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
✓ Branch 7 taken 43 times.
|
86 | mo.setString(mo.waterInletPort(), ""); |
| 198 |
3/3✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
✓ Branch 7 taken 43 times.
|
43 | mo.setString(mo.waterOutletPort(), ""); |
| 199 | |||
| 200 | 86 | return std::move(mo); | |
| 201 | 43 | } | |
| 202 | |||
| 203 | ✗ | bool WaterToAirComponent_Impl::addToSplitter(Splitter& /*splitter*/) { | |
| 204 | //Model _model = splitter.model(); | ||
| 205 | //WaterToAirComponent thisModelObject = getObject<ModelObject>().optionalCast<WaterToAirComponent>().get(); | ||
| 206 | //if( splitter.plantLoop() ) | ||
| 207 | //{ | ||
| 208 | // PlantLoop plantLoop = splitter.plantLoop().get(); | ||
| 209 | // if( plantLoop.demandComponent( splitter.handle() ) ) | ||
| 210 | // { | ||
| 211 | // Mixer mixer = plantLoop.demandMixer().get(); | ||
| 212 | // unsigned splitterPort = splitter.newOutletPortAfterBranch( splitter.nextBranchIndex() ); | ||
| 213 | // unsigned mixerPort = mixer.newInletPortAfterBranch( mixer.nextBranchIndex() ); | ||
| 214 | // Node inletNode(_model); | ||
| 215 | // Node outletNode(_model); | ||
| 216 | |||
| 217 | // _model.connect( splitter, splitterPort, | ||
| 218 | // inletNode, inletNode.inletPort() ); | ||
| 219 | // _model.connect( inletNode, inletNode.outletPort(), | ||
| 220 | // thisModelObject, thisModelObject.waterInletPort() ); | ||
| 221 | // _model.connect( thisModelObject, thisModelObject.waterOutletPort(), | ||
| 222 | // outletNode, outletNode.inletPort() ); | ||
| 223 | // _model.connect( outletNode, outletNode.outletPort(), | ||
| 224 | // mixer, mixerPort ); | ||
| 225 | |||
| 226 | // return true; | ||
| 227 | // } | ||
| 228 | // else | ||
| 229 | // { | ||
| 230 | // return false; | ||
| 231 | // } | ||
| 232 | //} | ||
| 233 | //else if( splitter.airLoopHVAC() ) | ||
| 234 | //{ | ||
| 235 | // return false; | ||
| 236 | //} | ||
| 237 | //else | ||
| 238 | //{ | ||
| 239 | // return false; | ||
| 240 | //} | ||
| 241 | ✗ | return false; | |
| 242 | } | ||
| 243 | |||
| 244 | 6 | void WaterToAirComponent_Impl::disconnectWaterSide() { | |
| 245 |
1/1✓ Branch 1 taken 6 times.
|
6 | Model _model = this->model(); |
| 246 | |||
| 247 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto mo = this->getObject<ModelObject>(); |
| 248 | |||
| 249 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | _model.disconnect(mo, this->waterInletPort()); |
| 250 | |||
| 251 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | _model.disconnect(mo, this->waterOutletPort()); |
| 252 | 6 | } | |
| 253 | |||
| 254 | 6 | void WaterToAirComponent_Impl::disconnectAirSide() { | |
| 255 |
1/1✓ Branch 1 taken 6 times.
|
6 | Model _model = this->model(); |
| 256 | |||
| 257 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto mo = this->getObject<ModelObject>(); |
| 258 | |||
| 259 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | _model.disconnect(mo, this->airInletPort()); |
| 260 | |||
| 261 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | _model.disconnect(mo, this->airOutletPort()); |
| 262 | 6 | } | |
| 263 | |||
| 264 | 6 | void WaterToAirComponent_Impl::disconnect() { | |
| 265 | 6 | this->disconnectWaterSide(); | |
| 266 | |||
| 267 | 6 | this->disconnectAirSide(); | |
| 268 | 6 | } | |
| 269 | |||
| 270 | 92 | bool WaterToAirComponent_Impl::removeFromAirLoopHVAC() { | |
| 271 |
2/3✓ Branch 1 taken 92 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 92 times.
|
184 | if (auto t_oaSystem = airLoopHVACOutdoorAirSystem()) { |
| 272 | ✗ | if (t_oaSystem->oaComponent(handle())) { | |
| 273 | ✗ | return HVACComponent_Impl::removeFromLoop(t_oaSystem->outboardOANode().get(), t_oaSystem.get(), airInletPort(), airOutletPort()); | |
| 274 | ✗ | } else if (t_oaSystem->reliefComponent(handle())) { | |
| 275 | ✗ | return HVACComponent_Impl::removeFromLoop(t_oaSystem.get(), t_oaSystem->outboardReliefNode().get(), airInletPort(), airOutletPort()); | |
| 276 | } | ||
| 277 |
3/3✓ Branch 1 taken 92 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 83 times.
|
184 | } else if (auto t_airLoop = airLoopHVAC()) { |
| 278 |
4/5✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
✗ Branch 11 not taken.
|
18 | if (t_airLoop->supplyComponent(handle())) { |
| 279 |
7/7✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
✓ Branch 13 taken 9 times.
✓ Branch 16 taken 9 times.
✓ Branch 19 taken 9 times.
|
9 | return HVACComponent_Impl::removeFromLoop(t_airLoop->supplyInletNode(), t_airLoop->supplyOutletNode(), airInletPort(), airOutletPort()); |
| 280 | } | ||
| 281 | 184 | } | |
| 282 | |||
| 283 | 83 | return false; | |
| 284 | } | ||
| 285 | |||
| 286 | 193 | bool WaterToAirComponent_Impl::removeFromPlantLoop() { | |
| 287 |
3/3✓ Branch 1 taken 193 times.
✓ Branch 3 taken 33 times.
✓ Branch 4 taken 160 times.
|
386 | if (auto plant = plantLoop()) { |
| 288 |
7/7✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
✓ Branch 7 taken 33 times.
✓ Branch 10 taken 33 times.
✓ Branch 13 taken 33 times.
✓ Branch 16 taken 33 times.
✓ Branch 19 taken 33 times.
|
33 | return HVACComponent_Impl::removeFromLoop(plant->demandInletNode(), plant->demandOutletNode(), waterInletPort(), waterOutletPort()); |
| 289 | 193 | } | |
| 290 | |||
| 291 | 160 | return false; | |
| 292 | } | ||
| 293 | |||
| 294 | 323 | boost::optional<ControllerWaterCoil> WaterToAirComponent_Impl::controllerWaterCoil() { | |
| 295 |
2/2✓ Branch 1 taken 323 times.
✓ Branch 4 taken 323 times.
|
323 | auto controllers = model().getConcreteModelObjects<ControllerWaterCoil>(); |
| 296 |
1/1✓ Branch 1 taken 323 times.
|
323 | auto h = handle(); |
| 297 | |||
| 298 |
2/2✓ Branch 5 taken 1094 times.
✓ Branch 6 taken 262 times.
|
1356 | for (const auto& controller : controllers) { |
| 299 |
2/3✓ Branch 3 taken 1094 times.
✓ Branch 7 taken 1094 times.
✗ Branch 8 not taken.
|
2188 | if (auto coil = controller.getImpl<detail::ControllerWaterCoil_Impl>()->waterCoil()) { |
| 300 |
5/5✓ Branch 1 taken 1094 times.
✓ Branch 4 taken 1094 times.
✓ Branch 7 taken 1094 times.
✓ Branch 9 taken 61 times.
✓ Branch 10 taken 1033 times.
|
1094 | if (coil->handle() == h) { |
| 301 |
1/1✓ Branch 1 taken 61 times.
|
61 | return controller.optionalCast<ControllerWaterCoil>(); |
| 302 | } | ||
| 303 | 1094 | } | |
| 304 | } | ||
| 305 | |||
| 306 | 262 | return boost::none; | |
| 307 | 323 | } | |
| 308 | |||
| 309 | } // namespace detail | ||
| 310 | |||
| 311 | 268 | WaterToAirComponent::WaterToAirComponent(IddObjectType type, const Model& model) : HVACComponent(type, model) { | |
| 312 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 268 times.
✗ Branch 5 not taken.
|
268 | OS_ASSERT(getImpl<detail::WaterToAirComponent_Impl>()); |
| 313 | 268 | } | |
| 314 | |||
| 315 |
1/1✓ Branch 3 taken 639 times.
|
639 | WaterToAirComponent::WaterToAirComponent(std::shared_ptr<detail::WaterToAirComponent_Impl> p) : HVACComponent(std::move(p)) {} |
| 316 | |||
| 317 | 213 | boost::optional<ModelObject> WaterToAirComponent::airInletModelObject() const { | |
| 318 |
1/1✓ Branch 3 taken 213 times.
|
213 | return getImpl<detail::WaterToAirComponent_Impl>()->airInletModelObject(); |
| 319 | } | ||
| 320 | |||
| 321 | 135 | boost::optional<ModelObject> WaterToAirComponent::airOutletModelObject() const { | |
| 322 |
1/1✓ Branch 3 taken 135 times.
|
135 | return getImpl<detail::WaterToAirComponent_Impl>()->airOutletModelObject(); |
| 323 | } | ||
| 324 | |||
| 325 | 124 | boost::optional<ModelObject> WaterToAirComponent::waterInletModelObject() const { | |
| 326 |
1/1✓ Branch 3 taken 124 times.
|
124 | return getImpl<detail::WaterToAirComponent_Impl>()->waterInletModelObject(); |
| 327 | } | ||
| 328 | |||
| 329 | 148 | boost::optional<ModelObject> WaterToAirComponent::waterOutletModelObject() const { | |
| 330 |
1/1✓ Branch 3 taken 148 times.
|
148 | return getImpl<detail::WaterToAirComponent_Impl>()->waterOutletModelObject(); |
| 331 | } | ||
| 332 | |||
| 333 | 30 | boost::optional<AirLoopHVAC> WaterToAirComponent::airLoopHVAC() const { | |
| 334 |
1/1✓ Branch 3 taken 30 times.
|
30 | return getImpl<detail::WaterToAirComponent_Impl>()->airLoopHVAC(); |
| 335 | } | ||
| 336 | |||
| 337 | 59 | boost::optional<PlantLoop> WaterToAirComponent::plantLoop() const { | |
| 338 |
1/1✓ Branch 3 taken 59 times.
|
59 | return getImpl<detail::WaterToAirComponent_Impl>()->plantLoop(); |
| 339 | } | ||
| 340 | |||
| 341 | 59 | bool WaterToAirComponent::addToNode(Node& node) { | |
| 342 |
1/1✓ Branch 3 taken 59 times.
|
59 | return getImpl<detail::WaterToAirComponent_Impl>()->addToNode(node); |
| 343 | } | ||
| 344 | |||
| 345 | 26 | std::vector<openstudio::IdfObject> WaterToAirComponent::remove() { | |
| 346 |
1/1✓ Branch 3 taken 26 times.
|
26 | return getImpl<detail::WaterToAirComponent_Impl>()->remove(); |
| 347 | } | ||
| 348 | |||
| 349 | 7 | ModelObject WaterToAirComponent::clone(Model model) const { | |
| 350 |
2/2✓ Branch 3 taken 7 times.
✓ Branch 6 taken 7 times.
|
7 | return getImpl<detail::WaterToAirComponent_Impl>()->clone(model); |
| 351 | } | ||
| 352 | |||
| 353 | 44 | unsigned WaterToAirComponent::airInletPort() const { | |
| 354 |
1/1✓ Branch 3 taken 44 times.
|
44 | return getImpl<detail::WaterToAirComponent_Impl>()->airInletPort(); |
| 355 | } | ||
| 356 | |||
| 357 | 44 | unsigned WaterToAirComponent::airOutletPort() const { | |
| 358 |
1/1✓ Branch 3 taken 44 times.
|
44 | return getImpl<detail::WaterToAirComponent_Impl>()->airOutletPort(); |
| 359 | } | ||
| 360 | |||
| 361 | 44 | unsigned WaterToAirComponent::waterInletPort() const { | |
| 362 |
1/1✓ Branch 3 taken 44 times.
|
44 | return getImpl<detail::WaterToAirComponent_Impl>()->waterInletPort(); |
| 363 | } | ||
| 364 | |||
| 365 | 44 | unsigned WaterToAirComponent::waterOutletPort() const { | |
| 366 |
1/1✓ Branch 3 taken 44 times.
|
44 | return getImpl<detail::WaterToAirComponent_Impl>()->waterOutletPort(); |
| 367 | } | ||
| 368 | |||
| 369 | ✗ | bool WaterToAirComponent::addToSplitter(Splitter& splitter) { | |
| 370 | ✗ | return getImpl<detail::WaterToAirComponent_Impl>()->addToSplitter(splitter); | |
| 371 | } | ||
| 372 | |||
| 373 | ✗ | void WaterToAirComponent::disconnectWaterSide() { | |
| 374 | ✗ | return getImpl<detail::WaterToAirComponent_Impl>()->disconnectWaterSide(); | |
| 375 | } | ||
| 376 | |||
| 377 | ✗ | void WaterToAirComponent::disconnectAirSide() { | |
| 378 | ✗ | return getImpl<detail::WaterToAirComponent_Impl>()->disconnectAirSide(); | |
| 379 | } | ||
| 380 | |||
| 381 | 6 | bool WaterToAirComponent::removeFromAirLoopHVAC() { | |
| 382 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::WaterToAirComponent_Impl>()->removeFromAirLoopHVAC(); |
| 383 | } | ||
| 384 | |||
| 385 | 26 | bool WaterToAirComponent::removeFromPlantLoop() { | |
| 386 |
1/1✓ Branch 3 taken 26 times.
|
26 | return getImpl<detail::WaterToAirComponent_Impl>()->removeFromPlantLoop(); |
| 387 | } | ||
| 388 | |||
| 389 | } // namespace model | ||
| 390 | |||
| 391 | } // namespace openstudio | ||
| 392 |