主要内容

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

createInterface

为端口创建和设置专属接口

自 R2021b 起

    说明

    interface = createInterface(port,kind) 为端口创建并设置一个专属接口。

    示例

    示例

    全部折叠

    创建架构模型 archModel 。获取根架构,然后添加一个新组件 newComponent 和一个新端口 newCompPort。以 ValueType 的形式为端口创建一个专属接口。

    model = systemcomposer.createModel("archModel");
    systemcomposer.openModel("archModel");
    rootArch = get(model,"Architecture");
    newComponent = addComponent(rootArch,"newComponent");
    newPort = addPort(newComponent.Architecture,"newCompPort","in");
    interface = newPort.createInterface("ValueType")
    interface = 
    
      ValueType with properties:
    
               Name: ''
           DataType: 'double'
         Dimensions: '1'
              Units: ''
         Complexity: 'real'
            Minimum: '[]'
            Maximum: '[]'
        Description: ''
              Owner: [1×1 systemcomposer.arch.ArchitecturePort]
              Model: [1×1 systemcomposer.arch.Model]
               UUID: 'd23669e1-f26c-4c64-a482-a27a33ac6541'
        ExternalUID: ''

    创建架构模型 archModel 。获取根架构,然后添加一个新组件 newComponent 和一个新端口 newCompPort。以 DataInterface 的形式为端口创建一个专属接口。

    model = systemcomposer.createModel("archModel");
    rootArch = get(model,"Architecture");
    newComponent = addComponent(rootArch,"newComponent");
    newPort = addPort(newComponent.Architecture,"newCompPort","in");
    interface = newPort.createInterface("DataInterface");

    从端口上删除专属接口。

    newPort.setInterface("");

    创建架构模型 archModel 。获取根架构,然后添加一个新组件 newComponent 和一个新物理端口 newCompPort。为物理端口创建专属接口,并设置物理域 Domain 属性。

    model = systemcomposer.createModel("archModel");
    rootArch = get(model,"Architecture");
    newComponent = addComponent(rootArch,"newComponent");
    newPort = addPort(newComponent.Architecture,"newCompPort","physical");
    port = newComponent.getPort("newCompPort");
    interface = port.createInterface("PhysicalDomain");
    interface.Domain = "rotational.rotational"
    interface = 
    
      PhysicalDomain with properties:
    
             Domain: 'foundation.mechanical.rotational.rotational'
              Owner: [1×1 systemcomposer.arch.ArchitecturePort]
              Model: [1×1 systemcomposer.arch.Model]
               UUID: '65f143cb-ed3a-49e1-bbc9-de89e84aa8e6'
        ExternalUID: ''

    输入参数

    全部折叠

    接口类型,指定为其中一个选项:

    • "DataInterface"

    • "ValueType"

    • "PhysicalDomain"

    数据类型: char | string

    输出参量

    全部折叠

    详细信息

    全部折叠

    版本历史记录

    在 R2021b 中推出