主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

getAllocatedTo

获取分配目标

    说明

    targetElements = getAllocatedTo(allocScenario,sourceElement) 获取指定源元素 sourceElement 所分配的所有已分配目标元素。

    示例

    示例

    全部折叠

    创建两个新模型,每个模型有一个组件。

    mSource = systemcomposer.createModel("Source_Model_Allocation");
    systemcomposer.openModel("Source_Model_Allocation");
    sourceComp = addComponent(get(mSource,"Architecture"),"Source_Component");
    mTarget = systemcomposer.createModel("Target_Model_Allocation");
    systemcomposer.openModel("Target_Model_Allocation");
    targetComp = addComponent(get(mTarget,"Architecture"),"Target_Component");

    创建一个名为 MyNewAllocation 的分配集。

    allocSet = systemcomposer.allocation.createAllocationSet("MyNewAllocation",...
         "Source_Model_Allocation","Target_Model_Allocation");

    获取默认分配方案。

    defaultScenario = getScenario(allocSet,"Scenario 1");

    在模型之间分配组件。

    allocation = allocate(defaultScenario,sourceComp,targetComp);

    从源组件获取分配给目标组件的资源。

    targetElement = getAllocatedTo(defaultScenario,sourceComp)
    targetElement = 
    
      Component with properties:
    
         IsAdapterComponent: 0
               Architecture: [1×1 systemcomposer.arch.Architecture]
                       Name: 'Target_Component'
                     Parent: [1×1 systemcomposer.arch.Architecture]
                      Ports: [0×0 systemcomposer.arch.ComponentPort]
                 OwnedPorts: [0×0 systemcomposer.arch.ComponentPort]
          OwnedArchitecture: [1×1 systemcomposer.arch.Architecture]
                   Position: [15 15 65 76]
                      Model: [1×1 systemcomposer.arch.Model]
             SimulinkHandle: 5.0001
        SimulinkModelHandle: 3.0001
                       UUID: '15b4e0ba-f236-4f59-9d30-b46cf170cbda'
                ExternalUID: ''

    输入参数

    全部折叠

    分配方案,指定为 systemcomposer.allocation.AllocationScenario 对象。

    输出参量

    全部折叠

    详细信息

    全部折叠

    版本历史记录

    在 R2020b 中推出