当前位置: 首页>>代码示例>>C++>>正文


C++ Mixer::branchIndexForInletModelObject方法代码示例

本文整理汇总了C++中Mixer::branchIndexForInletModelObject方法的典型用法代码示例。如果您正苦于以下问题:C++ Mixer::branchIndexForInletModelObject方法的具体用法?C++ Mixer::branchIndexForInletModelObject怎么用?C++ Mixer::branchIndexForInletModelObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mixer的用法示例。


在下文中一共展示了Mixer::branchIndexForInletModelObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeFromPlantLoop

bool WaterToAirComponent_Impl::removeFromPlantLoop()
{
    boost::optional<PlantLoop> _loop = plantLoop();

    OptionalNode targetModelObject;
    OptionalNode sourceModelObject;
    OptionalUnsigned targetPort;
    OptionalUnsigned sourcePort;

    OptionalModelObject target2ModelObject;
    OptionalModelObject source2ModelObject;
    OptionalUnsigned target2Port;
    OptionalUnsigned source2Port;

    HVACComponent thisObject = getObject<HVACComponent>();

    if( _loop && _loop->demandComponent(handle()) )
    {
        targetModelObject = waterOutletModelObject()->optionalCast<Node>();
        sourceModelObject = waterInletModelObject()->optionalCast<Node>();
        targetPort = connectedObjectPort(waterOutletPort());
        sourcePort = connectedObjectPort(waterInletPort());

        target2ModelObject = targetModelObject->outletModelObject();
        source2ModelObject = sourceModelObject->inletModelObject();
        target2Port = targetModelObject->connectedObjectPort(targetModelObject->outletPort());
        source2Port = sourceModelObject->connectedObjectPort(sourceModelObject->inletPort());

        boost::optional<Node> demandInletNode = _loop->demandInletNode();
        boost::optional<Node> demandOutletNode = _loop->demandOutletNode();

        Mixer mixer = _loop->demandMixer();
        Splitter splitter = _loop->demandSplitter();

        // If the component is stuck directly between the inlet and outlet node.
        if( demandInletNode->handle() == waterInletModelObject()->handle()
                &&
                demandOutletNode->handle() == waterOutletModelObject()->handle() )
        {
            model().disconnect(thisObject,waterOutletPort());
            model().disconnect(thisObject,waterInletPort());

            model().connect( demandInletNode.get(), demandInletNode->outletPort(),
                             demandOutletNode.get(), demandOutletNode->inletPort() );

            return true;
        }
        // If the component is at the very end of the supply path, but there is another component preceeding this one.
        else if( demandOutletNode->handle() == waterOutletModelObject()->handle() )
        {
            model().disconnect(thisObject,waterOutletPort());
            model().disconnect(thisObject,waterInletPort());

            model().connect( source2ModelObject.get(), source2Port.get(),
                             demandOutletNode.get(), demandOutletNode->inletPort() );
            sourceModelObject->remove();
            return true;
        }
        // If the component is the only component (except nodes) between a splitter mixer pair
        else if( (target2ModelObject.get() == mixer) &&
                 (source2ModelObject.get() == splitter) )
        {
            Model _model = model();

            int i = splitter.branchIndexForOutletModelObject(sourceModelObject.get());
            int j = mixer.branchIndexForInletModelObject(targetModelObject.get());

            BOOST_ASSERT(i == j);

            splitter.removePortForBranch(i);
            mixer.removePortForBranch(i);

            _model.disconnect(thisObject,waterOutletPort());
            _model.disconnect(thisObject,waterInletPort());

            targetModelObject->remove();
            sourceModelObject->remove();

            if( ! splitter.lastOutletModelObject() )
            {
                Node newNode(_model);
                _model.connect(splitter,splitter.nextOutletPort(),newNode,newNode.inletPort());
                _model.connect(newNode,newNode.outletPort(),mixer,mixer.nextInletPort());
            }

            return true;
        }
        // Else remove the component and the outlet node
        else
        {
            model().disconnect(thisObject,waterOutletPort());
            model().disconnect(thisObject,waterInletPort());

            model().connect( sourceModelObject.get(), sourcePort.get(),
                             target2ModelObject.get(), target2Port.get() );
            targetModelObject->remove();
            return true;
        }
    }

//.........这里部分代码省略.........
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:101,代码来源:WaterToAirComponent.cpp


注:本文中的Mixer::branchIndexForInletModelObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。