// Some plant components air in a containingHVACComponent() and it is that // container which needs to go on the plant operation scheme. Here is a filter to // figure that out. HVACComponent operationSchemeComponent(const HVACComponent & component) { boost::optional<HVACComponent> result; switch(component.iddObject().type().value()) { case openstudio::IddObjectType::OS_WaterHeater_Mixed : { auto waterHeater = component.cast<WaterHeaterMixed>(); if( auto hpwh = waterHeater.containingZoneHVACComponent() ) { result = hpwh; } break; } case openstudio::IddObjectType::OS_WaterHeater_Stratified : { auto waterHeater = component.cast<WaterHeaterStratified>(); if( auto hpwh = waterHeater.containingZoneHVACComponent() ) { result = hpwh; } break; } default: { break; } } if( result ) { return result.get(); } return component; }
bool CoilHeatingWater_Impl::addToNode(Node & node) { bool success = WaterToAirComponent_Impl::addToNode( node ); if( success && (! containingHVACComponent()) && (! containingZoneHVACComponent()) ) { if( boost::optional<ModelObject> _waterInletModelObject = waterInletModelObject() ) { if( auto oldController = controllerWaterCoil() ) { oldController->remove(); } Model _model = model(); ControllerWaterCoil controller(_model); controller.getImpl<detail::ControllerWaterCoil_Impl>()->setWaterCoil(getObject<HVACComponent>()); controller.setAction("Normal"); } } return success; }
bool HVACComponent_Impl::isRemovable() const { if( containingHVACComponent() ) { return false; } else if( containingZoneHVACComponent() ) { return false; } else if( containingStraightComponent() ) { return false; } else { return true; } }
bool CoilCoolingWater_Impl::addToNode(Node & node) { bool success; success = WaterToAirComponent_Impl::addToNode( node ); if( success && (! containingHVACComponent()) && (! containingZoneHVACComponent()) ) { if( boost::optional<ModelObject> _waterInletModelObject = waterInletModelObject() ) { Model _model = model(); boost::optional<ControllerWaterCoil> oldController; oldController = controllerWaterCoil(); if( oldController ) { oldController->remove(); } ControllerWaterCoil controller(_model); boost::optional<Node> coilWaterInletNode = _waterInletModelObject->optionalCast<Node>(); OS_ASSERT(coilWaterInletNode); controller.setActuatorNode(coilWaterInletNode.get()); if( boost::optional<ModelObject> mo = airOutletModelObject() ) { if( boost::optional<Node> coilAirOutletNode = mo->optionalCast<Node>() ) { controller.setSensorNode(coilAirOutletNode.get()); } } controller.setAction("Reverse"); } } return success; }