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, and value types. 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.

Profile structure with name 'System Standard' and three stereotypes named 'System Element', 'Software Component', and 'Physical Connector', all with some properties

Each profile contains a set of stereotypes, and each stereotype contains a set of properties.

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 > Profiles > Profile Editor to open the Profile Editor. Open the profile file simpleProfile.xml to load the profile in the Profile Editor.

The System Composer Profile Editor with the option to colorize component stereotypes.

In the profile, observe these stereotypes.

StereotypeApplicationProperties
sysGeneralcomponents, ports, connectors

ID (integer, no units)

Note (string, no units)

sysComponentcomponents

weight (double, kg)

unitPrice (double, USD)

sysConnectorconnectors

length (double, m)

weight (double, kg/m)

unitPrice (double, USD/m)

Importing the profile makes stereotypes available to their applicable elements.

  • 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.

  • sysComponent stereotype applies only to components, and includes properties such as weight and cost that contribute to the total weight and cost specifications of the robot system.

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

  • sysPort stereotype applies to ports and does not include any properties.

Note

You can add a stereotype icon to all component-level stereotypes. You can choose from a set of default icons, or you can create your own icons.

Default stereotype icons.

Apply Stereotypes to Model Elements

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

  1. Navigate to Modeling > Profiles > Import import icon.

  2. Select simpleProfile.

  3. Open the Sensors component.

  4. Navigate to Modeling > Profiles > Apply Stereotypes to open the Apply Stereotypes dialog box.

  5. In Apply Stereotypes, 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.

  6. Click Apply and close the window to exit the dialog box.

  7. Select the GPS component. Right-click, then click Apply Stereotype. Select the simpleProfile.sysComponent stereotype.

    Note

    The sysComponent stereotype is used for managing physical properties and cost.

    Repeat these steps for the GyroData and DataProcessing components.

  8. Navigate to the top of the model. Apply the sysComponent stereotype to the Sensors and Trajectory Planning components and the top-level architecture model. Right-click each component or a space in the top-level, then select Apply Stereotype to ensure simpleProfile.sysComponent is selected.

  9. Apply the sysConnector stereotype to all connectors in the Sensors layer, the Trajectory Planning layer, and the top model layer. Press and hold Shift to select multiple connectors. Right-click the selection, click Apply Stereotype, and select the simpleProfile.sysConnector stereotype.

    The connectors have two stereotypes selected

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 > Design > Property Inspector.

  3. Expand the sysComponent stereotype to see the properties.

  4. Set unitPrice to 5 and press Enter.

  5. Select the GPSData port connector. Check that length is set to 0.05 and that unitPrice is set to 0.1.

    The GPS Data port connector is selected

  6. Complete the model using the values in this table. If a property is not in the table, it has no effect on the analysis, so you can leave it blank. Pin the Property Inspector to the editor to keep the Property Inspector visible during this operation.

    LayerElementPropertyValue
    Top layerEncoder connectorlength0.5
    unitPrice0.1
    SensorData connectorlength0.6
    unitPrice0.2
    MotionCommand connectorlength0.5
    unitPrice0.2
    Sensors componentunitPrice5
    Trajectory Planning componentunitPrice500
    Motion componentunitPrice750
    Sensors layerGyroData componentunitPrice50
    DataProcessing componentunitPrice500
    GPS componentunitPrice100
    GPSData connectorlength0.05
    unitPrice0.1
    MotionData connectorlength0.05
    unitPrice0.1
    RawData connectorlength0.05
    unitPrice0.1

The model below reflects the final result of this tutorial. Use this finalized model to perform an analysis and create custom views.

Mobile Robot Architecture Model with Properties

This example shows a mobile robot architecture model with stereotypes applied to components and properties defined.

Related Topics