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.
In the profile, observe these stereotypes.
Stereotype | Application | Properties |
---|---|---|
sysBaseStereotype | components, ports, connectors |
|
sysComponent | components |
Inherits properties from
|
sysConnector | connectors |
Inherits
properties from |
sysGeneral | components, ports, connectors |
|
sysPort | ports | Inherits properties from
|
Importing the profile makes stereotypes available to their applicable elements.
sysBaseStereotype
stereotype, applicable to all element types, includes shared properties such asunitPrice
andtotalPrice
.sysComponent
stereotype applies only to components, and includes properties such asweight
that contributes to the total weight and properties inherited from thesysBaseStereotype
stereotype with cost specifications of the robot system.sysConnector
stereotype applies to connectors and includeslength
andweight
properties defined per meter (assuming a physical connector, such as a wire). These properties and the properties inherited from thesysBaseStereotype
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 aNote
, 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 fromsysBaseStereotype
.
Apply Stereotypes to Model Elements
Add custom properties to a model element by applying a stereotype from a loaded profile.
On the toolstrip, navigate to Modeling > Profile Editor > Import .
Select
simpleProfile
.On the toolstrip, navigate to Modeling > Apply Stereotypes to open the Apply Stereotypes dialog box.
From Apply stereotype(s) to, select
All elements
. From Scope, selectThis layer
.In the list of available stereotypes, select
simpleProfile.sysGeneral
.Click Apply.
From Apply stereotype(s) to, select
Components
. From Scope, selectEntire model
.In the list of available stereotypes, select
simpleProfile.sysComponent
.Click Apply.
From Apply stereotype(s) to, select
Connectors
. From Scope, selectEntire model
.In the list of available stereotypes, select
simpleProfile.sysConnector
.Click Apply.
From Apply stereotype(s) to, select
Ports
. From Scope, selectEntire 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.
In the
Sensors
component, select theGPS
component.Open the Property Inspector by navigating to Modeling > Property Inspector.
Expand the
sysComponent
stereotype to see the properties.Set
unitPrice
to10
and press Enter.Select the
GPSData
port connector. Check thatlength
is set to3
,weight
is set to12
, and thatunitPrice
is set to5
.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.