主要内容

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

add

将函数添加到函数组

自 R2026a 起

    说明

    add(functionGroupObj,functionObj) 将指定函数 functionObj 添加到指定函数组 functionGroupObj 中。

    示例

    示例

    全部折叠

    创建名为 mySoftwareArchitecture 的模型,并获取根架构。

    model = systemcomposer.createModel("mySoftwareArchitecture","SoftwareArchitecture");
    rootArch = model.Architecture;

    创建一个软件组件和三个函数。

    newComp = rootArch.addComponent("Component1");
    newFunctions = newComp.Architecture.addFunction({'Function1','Function2','Function3'});
    rootArch

    确定这三个函数的周期。

    fun1 = newFunctions(1);
    fun1.Period = 0.05;
    fun2 = newFunctions(2);
    fun2.Period = 0.05;
    fun3 = newFunctions(3);
    fun3.Period = 0.2;

    创建一个名为 newFunctionGroup 的函数组。

    functionGroup = rootArch.createFunctionGroup("newFunctionGroup", [fun1, fun2])

    创建一个函数,并将其添加到名为 newFunctionGroup 的函数组中。

    fun4 = newComp.Architecture.addFunction('Function4');
    fun4.Period = 0.05;
    functionGroup.add(fun4);

    查看函数组的组件函数。

    {functionGroup.ComponentFunctions.Name}

    输入参数

    全部折叠

    函数组,指定为 systemcomposer.arch.Function 对象。

    函数,指定为 systemcomposer.arch.Function 对象。

    详细信息

    全部折叠

    版本历史记录

    在 R2026a 中推出