| 95 | } |
| 96 | |
| 97 | bool AirLoopHVACSupplyPlenum_Impl::addToNode(Node& node) { |
| 98 | bool result = true; |
| 99 | |
| 100 | Model _model = model(); |
| 101 | |
| 102 | // Is the node in this model |
| 103 | if (node.model() != _model) { |
| 104 | result = false; |
| 105 | } |
| 106 | |
| 107 | // Is the node part of an air loop |
| 108 | boost::optional<AirLoopHVAC> nodeAirLoop = node.airLoopHVAC(); |
| 109 | |
| 110 | if (!nodeAirLoop) { |
| 111 | result = false; |
| 112 | } |
| 113 | |
| 114 | // Is this plenum already connected to a different air loop |
| 115 | boost::optional<AirLoopHVAC> currentAirLoopHVAC = airLoopHVAC(); |
| 116 | if (currentAirLoopHVAC && (currentAirLoopHVAC.get() != nodeAirLoop)) { |
| 117 | result = false; |
| 118 | } |
| 119 | |
| 120 | boost::optional<ModelObject> inletObj = node.inletModelObject(); |
| 121 | boost::optional<ModelObject> outletObj = node.outletModelObject(); |
| 122 | boost::optional<AirTerminalSingleDuctConstantVolumeNoReheat> directAirModelObject; |
| 123 | boost::optional<ModelObject> directAirInletModelObject; |
| 124 | |
| 125 | if (inletObj && inletObj->optionalCast<AirTerminalSingleDuctConstantVolumeNoReheat>()) { |
| 126 | directAirModelObject = inletObj->cast<AirTerminalSingleDuctConstantVolumeNoReheat>(); |
| 127 | directAirInletModelObject = directAirModelObject->inletModelObject(); |
| 128 | } |
| 129 | |
| 130 | // Is the immediate upstream object to the node a splitter |
| 131 | // or a direct air terminal (special case since this guy oddly does not have an inlet node) |
| 132 | boost::optional<AirLoopHVACZoneSplitter> splitter; |
| 133 | |
| 134 | if (result) { |
| 135 | splitter = nodeAirLoop->zoneSplitter(); |
| 136 | |
| 137 | if (directAirInletModelObject) { |
| 138 | if (!(splitter && (directAirInletModelObject.get() == splitter.get()))) { |
| 139 | result = false; |
| 140 | } |
| 141 | } else if (!(inletObj && splitter && (inletObj.get() == splitter.get()))) { |
| 142 | result = false; |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | // Is there a zone on this branch |
| 147 | if (result) { |
| 148 | Mixer mixer = nodeAirLoop->zoneMixer(); |
| 149 | if (nodeAirLoop->demandComponents(node, mixer, ThermalZone::iddObjectType()).empty()) { |
| 150 | result = false; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | unsigned oldOutletObjectPort; |
nothing calls this directly
no test coverage detected