主要内容

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

getAllocation

获取源元素和目标元素之间的分配

    说明

    allocation = getAllocation(allocScenario,sourceElement,targetElement) 获取源元素 sourceElement 和目标元素 targetElement 之间的分配(如果存在)。

    示例

    示例

    全部折叠

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

    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);

    获取源组件和目标组件之间的分配。

    allocation = getAllocation(defaultScenario,sourceComp,targetComp)
    allocation = 
    
      Allocation with properties:
    
          Source: [1×1 systemcomposer.arch.Component]
          Target: [1×1 systemcomposer.arch.Component]
        Scenario: [1×1 systemcomposer.allocation.AllocationScenario]
            UUID: 'd83d692d-03fa-4186-977c-ce31b9de9630'

    输入参数

    输出参量

    全部折叠

    源元素和目标元素之间的分配,以 systemcomposer.allocation.Allocation 对象的形式返回。

    详细信息

    全部折叠

    版本历史记录

    在 R2020b 中推出