主要内容

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

addStereotype

在配置文件中添加构造型

说明

stereotype = addStereotype(profile,name) 在配置文件 profile 中添加了一个新的构造型,并指定了名称 name

stereotype = addStereotype(___,Name=Value) 使用之前的输入参量添加一个新的构造型,并指定该构造型的属性。

示例

示例

全部折叠

在配置文件中添加组件构造型。

profile = systemcomposer.profile.Profile.createProfile("LatencyProfile");
stereotype = addStereotype(profile,"electricalComponent",AppliesTo="Component")
stereotype = 
  Stereotype with properties:

                  Name: 'electricalComponent'
           Description: ''
                Parent: [0×0 systemcomposer.profile.Stereotype]
             AppliesTo: 'Component'
              Abstract: 0
          ElementStyle: [1×1 systemcomposer.profile.Style]
    FullyQualifiedName: 'LatencyProfile.electricalComponent'
               Profile: [1×1 systemcomposer.profile.Profile]
       OwnedProperties: [0×0 systemcomposer.profile.Property]
            Properties: [0×0 systemcomposer.profile.Property]

close(profile,true)

输入参数

全部折叠

配置文件,指定为 systemcomposer.profile.Profile 对象。

构造型名称,指定为字符向量或字符串。构造型的名称在配置文件中必须是唯一的。

示例: "electricalComponent"

数据类型: char | string

名称-值参数

全部折叠

将可选参量对组指定为 Name1=Value1,...,NameN=ValueN,其中 Name 是参量名称,Value 是对应的值。名称-值参量必须出现在其他参量之后,但对各个参量对组的顺序没有要求。

在 R2021a 之前,需使用逗号分隔每个名称和值,并用引号将 Name 引起来

示例: addStereotype(profile,'electricalComponent',AppliesTo="Component")

构造型的描述文本,指定为字符向量或字符串。

示例: addStereotype(profile,'electricalComponent',Description="These components are electrical")

数据类型: char | string

构造型的图标名称,指定为字符向量或字符串。内置选项包括

  • "default"

  • "application"

  • "channel"

  • "controller"

  • "database"

  • "devicedriver"

  • "memory"

  • "network"

  • "plant"

  • "sensor"

  • "subsystem"

  • "transmitter"

此名称-值参量仅对组件构造型有效。使用 AppliesTo 此名称-值参量设置构造型所适用的元素。

示例: addStereotype(profile,"electricalComponent",Icon="default")

数据类型: char | string

构造型从中继承属性的构造型,指定为 systemcomposer.profile.Stereotype 对象。

示例: addStereotype(profile,"electricalComponent",Parent=baseStereotype)

可应用构造型的元素类型,指定为这些选项之一:

  • "" 所有元素类型。

  • "Component".

  • "Port".

  • "Connector".

  • "Interface".

  • "InterfaceElement".

  • "Allocation".有关详细信息,请参阅交互式创建和管理分配

  • "Function",仅适用于软件架构。有关详细信息,请参阅定义构造型并将其应用于函数

  • "InitializeFunction",仅适用于软件架构。

  • "Requirement",使用 Requirements Toolbox™ 许可证。有关详细信息,请参阅使用原型自定义需求和链接 (Requirements Toolbox)

  • "Link",使用 Requirements Toolbox 许可证。

  • "Action",该功能仅适用于活动图。有关详细信息,请参阅使用构造型设置属性

  • "Parameter Node",该功能仅适用于活动图。

  • "Flow",该功能仅适用于活动图。

示例: addStereotype(profile,"electricalComponent",AppliesTo="Port")

数据类型: char | string

构造型是否为抽象构造型,指定为 1 (true) 或 0 (false)。如果是 true,则该构造型不能直接应用于模型元素,而应作为其他构造型的父构造型。

示例: addStereotype(profile,'electricalComponent','Abstract',true)

数据类型: logical

组件标题颜色,指定为 1x3 uint32 行向量 [Red Green Blue]

此名称-值参量仅对组件构造型有效。使用 AppliesTo 此名称-值参量设置构造型所适用的元素。

示例: addStereotype(profile,'electricalComponent','ComponentHeaderColor',[206 232 246])

数据类型: uint32

连接线颜色,指定为 1x3 uint32 行向量 [Red Green Blue]

此名称-值参量仅对连接器、端口和接口构造型有效。使用 AppliesTo 此名称-值参量设置构造型所适用的元素。

示例: addStereotype(profile,'electricalComponent','ConnectorLineColor',[206 232 246])

数据类型: uint32

连接器线条样式名称,指定为字符向量或字符串。选项包括:

  • "Default"

  • "Dot"

  • "Dash"

  • "Dash Dot"

  • "Dash Dot Dot"

此名称-值参量仅对连接器、端口和接口构造型有效。使用 AppliesTo 此名称-值参量设置构造型所适用的元素。

数据类型: char | string

输出参量

全部折叠

创建的构造型,以 systemcomposer.profile.Stereotype 对象的形式返回。

详细信息

全部折叠

版本历史记录

在 R2019a 中推出