Define and Style Stereotypes in Profiles - MATLAB & Simulink (original) (raw)

Author a profile by defining stereotypes, stereotype styling, and properties in the Profile Editor tool. You can later apply stereotypes from your profile to architectural elements to extend your system modeling language.

In this topic, you will learn how to:

  1. Create a profile and define stereotypes with properties.
  2. Define default stereotypes in a profile to be added to any new element in a model with that applied profile.
  3. Use stereotype-based styling that enhances the appearance of the model based upon specific features each element represents.

For information about profile terminology, see Extend System Composer Language Elements Using Profiles.

Create Profile and Add Stereotypes

Create a profile to define a set of component, port, and connection types to be used in an architecture model. For example, a profile for an electromechanical system, such as a robot, could consist of these types.

Define a profile using the Profile Editor by navigating to > . Click New Profile. Select the new profile to start editing.

Note

Before you move, copy, or rename a profile to a different directory, you must close the profile in the Profile Editor or by using the close function. If you rename a profile, follow the example for the renameProfile function.

A new profile in the Profile Editor.

Name the profile and provide a description. Add stereotypes by clicking New Stereotype. You can delete stereotypes by clicking the delete button in their respective menus.

Save the profile. The file name is the same as the profile name.

For more information on optimizing profile design, see Best Practices for Profile Design.

Add Properties with Stereotypes

Select a stereotype in a profile to define it:

Add properties to a stereotype using the plus button. Define these fields for each property:

Profile Editor with profile named 'ProjectProfile' on the left and stereotypes listed underneath.

Use the property toolstrip to add plus icon, delete delete icon, reorder properties up move up icon, and reorder properties down move down icon.

You can create a stereotype that applies to all model element types by setting the Applies to field to . With these stereotypes, you can add properties to elements regardless of whether they are components, ports, connectors, interfaces, functions, requirements, or links.

Stereotype properties section for stereotype named 'General Element' and property name 'Ref Number' of type int8 with a default value of 1.

Define Default Stereotypes

Each profile can have a set of default stereotypes. Use default stereotypes when each new element of a certain type must assume the same stereotype. System Composer™ applies a default stereotype to the root architecture when you import the profile. To set this default in the Profile Editor for the Stereotype applied to root on import field, select ProjectComponent.

For the profile 'Project Profile' using the profile properties section to select 'Stereotype applied to root on import' as 'Project Component'.

This default stereotype is for the top-level architecture. If a model imports multiple profiles, the default component stereotype for all profiles apply to the architecture.

Each component stereotype can also have defaults for the components, ports, and connectors added to its architecture. For example, if you want all new connectors in a project component to be analog connections, for the ProjectComponent stereotype, set Connector stereotype to AnalogConnection.

For the 'Project Component' stereotype the 'Default stereotypes for composition' are defined for a component, port, and connector.

When you import the profile ProjectProfile into a model:

Use Stereotype-Based Styling

Profiles and stereotypes are used to apply custom metadata on the architecture model elements. Element styling is an additional visual cue that indicates applied stereotypes.

You can use provided icons for the component stereotypes or use you own custom icon images. Custom icons support .png, .jpeg, or .svg image files of size 16-by-16 pixels. The custom icons are displayed as badges on the components for which the stereotypes are applied.

Stereotype styling custom icons.

You can associate a color with component stereotypes. Element styling is an additional visual cue that indicates applied stereotypes.

Selecting a custom icon and color for a stereotype on the Profile Editor.

Use a preconfigured set of color options for component stereotypes to style the architecture component headers. See Apply Stereotypes to Extend Model Elements to learn how to use stereotypes in your model.

Components with stereotypes showing icons and colors.

Similarly, you can style architecture connectors using the stereotype settings. You can style connectors by using connector, port, or port interface stereotypes. Customize styling provides various color and line style choices. Connector styles are also reflected in architecture and spotlight views.

Selecting connector colors in the stereotype properties dialog.

Note

Connector styling is sourced from the highest-priority stereotype that defines style information. Connector stereotypes have the highest priority, followed by port stereotypes and then interface stereotypes. When two connectors with different styling merge, if the styling is incompatible, the resulting connector is displayed in black.

Component B has a blue connector style, Component C has a red connector style, and when the connectors merge for Component A, it has a black connector style.

See Also

Tools

Functions

Topics