| 2173 | } |
| 2174 | |
| 2175 | ModelObject ThermalZone_Impl::clone(Model model) const { |
| 2176 | auto tz = HVACComponent_Impl::clone(model).cast<ThermalZone>(); |
| 2177 | // We need this because "connect" is first going to try to disconnect from anything |
| 2178 | // currently attached. At this point tz is left pointing (through a connection) to the old zone air node, |
| 2179 | // (because of ModelObject::clone behavior) so connecting to the new node will remove the connection joining |
| 2180 | // the original zone and the original node. |
| 2181 | tz.setString(OS_ThermalZoneFields::ZoneAirNodeName, ""); |
| 2182 | |
| 2183 | tz.setString(OS_ThermalZoneFields::ThermostatName, ""); |
| 2184 | tz.setString(OS_ThermalZoneFields::HumidistatName, ""); |
| 2185 | |
| 2186 | Node node(model); |
| 2187 | model.connect(tz, tz.zoneAirPort(), node, node.inletPort()); |
| 2188 | |
| 2189 | PortList inletPortList(tz); |
| 2190 | tz.setPointer(OS_ThermalZoneFields::ZoneAirInletPortList, inletPortList.handle()); |
| 2191 | |
| 2192 | PortList exhaustPortList(tz); |
| 2193 | tz.setPointer(OS_ThermalZoneFields::ZoneAirExhaustPortList, exhaustPortList.handle()); |
| 2194 | |
| 2195 | PortList outletPortList(tz); |
| 2196 | tz.setPointer(OS_ThermalZoneFields::ZoneReturnAirPortList, outletPortList.handle()); |
| 2197 | |
| 2198 | auto sizingZoneClone = sizingZone().clone(model).cast<SizingZone>(); |
| 2199 | sizingZoneClone.getImpl<detail::SizingZone_Impl>()->setThermalZone(tz); |
| 2200 | |
| 2201 | ZoneHVACEquipmentList equipmentList(tz); |
| 2202 | |
| 2203 | if (auto t_thermostat = thermostat()) { |
| 2204 | auto thermostatClone = t_thermostat->clone(model).cast<Thermostat>(); |
| 2205 | tz.setThermostat(thermostatClone); |
| 2206 | } |
| 2207 | |
| 2208 | if (auto t_humidistat = zoneControlHumidistat()) { |
| 2209 | auto humidistatClone = t_humidistat->clone(model).cast<ZoneControlHumidistat>(); |
| 2210 | tz.setZoneControlHumidistat(humidistatClone); |
| 2211 | } |
| 2212 | |
| 2213 | if (auto t_controller = zoneControlContaminantController()) { |
| 2214 | auto controllerClone = t_controller->clone(model).cast<ZoneControlContaminantController>(); |
| 2215 | tz.setZoneControlContaminantController(controllerClone); |
| 2216 | } |
| 2217 | |
| 2218 | // DLM: do not clone zone mixing objects |
| 2219 | |
| 2220 | if (auto t_afnzone = airflowNetworkZone()) { |
| 2221 | auto afnzoneClone = t_afnzone->clone(model).cast<AirflowNetworkZone>(); |
| 2222 | afnzoneClone.setThermalZone(tz); |
| 2223 | } |
| 2224 | |
| 2225 | return std::move(tz); |
| 2226 | } |
| 2227 | |
| 2228 | boost::optional<AirLoopHVACSupplyPlenum> ThermalZone_Impl::airLoopHVACSupplyPlenum() const { |
| 2229 | boost::optional<AirLoopHVACSupplyPlenum> result; |
no test coverage detected