Main Content

Extend Architectural Design Using Stereotypes

You can add the unitPrice property to an electrical component using a stereotype. A stereotype extends the modeling language with domain-specific metadata. A stereotype adds properties to the root-level architecture, component architecture, ports, connectors, data interfaces, value types, functions, requirements, and requirement links. You can also apply a stereotype to only a specific element type, such as component architectures. When a model element has a stereotype applied, you can specify property values as part of its architectural definition. In addition to allowing you to manage properties relevant to the system specification within the architecture model, stereotypes and associated properties also allow you to analyze an architecture model.

A profile contains a set of model element stereotypes with custom properties. Each profile contains a set of stereotypes, and each stereotype contains a set of properties. For more information, see Extend Architecture Modeling Language with Profiles and Stereotypes.

For more information about the model-based systems engineering workflow within System Composer™, see Compose and Analyze Systems Using Architecture Models.

This example will show you how to compute the total cost of the system given the cost of its constituent parts. The example profile is limited to this goal. Start this tutorial with the following mobile robot architecture model without a profile applied. Use the model to follow the steps and populate its elements with stereotypes and properties.

Mobile Robot Architecture Model

This example shows a mobile robot architecture model with no properties defined. You can apply the stereotypes from the profile simpleProfile.xml.

Use the Property Inspector to set the properties on each component.

Load Architecture Model Profile

Load a profile to make stereotypes available for model elements. This procedure uses the model ex_RobotArch.slx. Navigate to Modeling > Profile Editor to open the Profile Editor. Open the profile file simpleProfile.xml to load the profile.

In the Profile Browser, select the sysConnector stereotype. Select Show inherited properties (read-only) to view properties inherited from the base stereotype.

The Profile Editor with a base stereotype.

In the profile, observe these stereotypes.

StereotypeApplicationProperties
sysBaseStereotypecomponents, ports, connectors

unitPrice (double, USD,Default: 5)

totalPrice (double, USD)

sysComponentcomponents

weight (double, kg)

Inherits properties from sysBaseStereotype

sysConnectorconnectors

length (double, m)

weight (double, kg/m)

Inherits properties from sysBaseStereotype

sysGeneralcomponents, ports, connectors

ID (int16)

Note (string)

sysPortports

Inherits properties from sysBaseStereotype

Importing the profile makes stereotypes available to their applicable elements.

  • sysBaseStereotype stereotype, applicable to all element types, includes shared properties such as unitPrice and totalPrice.

  • sysComponent stereotype applies only to components, and includes properties such as weight that contributes to the total weight and properties inherited from the sysBaseStereotype stereotype with cost specifications of the robot system.

  • sysConnector stereotype applies to connectors and includes length and weight properties defined per meter (assuming a physical connector, such as a wire). These properties and the properties inherited from the sysBaseStereotype stereotype help compute the total weight and cost of the design.

  • sysGeneral is a general stereotype, applicable to all element types, that enables adding generic properties such as a Note, which project members can use to track any issues with the element.

  • sysPort stereotype applies to ports and does not include any properties except those inherited from sysBaseStereotype.

Apply Stereotypes to Model Elements

Add custom properties to a model element by applying a stereotype from a loaded profile.

  1. On the toolstrip, navigate to Modeling > Profile Editor > Import import icon.

  2. Select simpleProfile.

  3. On the toolstrip, navigate to Modeling > Apply Stereotypes to open the Apply Stereotypes dialog box.

  4. From Apply stereotype(s) to, select All elements. From Scope, select This layer.

    In the list of available stereotypes, select simpleProfile.sysGeneral.

    Apply Stereotypes dialog with stereotype name displayed.

    Click Apply.

  5. From Apply stereotype(s) to, select Components. From Scope, select Entire model.

    In the list of available stereotypes, select simpleProfile.sysComponent.

    Click Apply.

  6. From Apply stereotype(s) to, select Connectors. From Scope, select Entire model.

    In the list of available stereotypes, select simpleProfile.sysConnector.

    Click Apply.

  7. From Apply stereotype(s) to, select Ports. From Scope, select Entire model.

    In the list of available stereotypes, select simpleProfile.sysPort.

    Click Apply.

Set Properties

Set the property values to enable cost analysis. Follow this example for the GPS module.

  1. In the Sensors component, select the GPS component.

  2. Open the Property Inspector by navigating to Modeling > Property Inspector.

  3. Expand the sysComponent stereotype to see the properties.

  4. Set unitPrice to 10 and press Enter.

  5. Select the GPSData port connector. Check that length is set to 3, weight is set to 12, and that unitPrice is set to 5.

    The GPS Data port connector is selected

  6. Finish defining metadata across the model for each element using desired property values. Pin the Property Inspector to the editor to keep the Property Inspector visible during this operation.

    Note

    You can use the ex_RobotArch_props architecture model for analysis and view generation because the model includes property values. For more information on analysis, see Analyze Architecture Model with Analysis Function. For more information on architecture views, see Inspect Components in Custom Architecture Views.

Related Topics