Main Content

Change Stereotypes Based on Stereotype Hierarchy in Portable Blender Architecture

This example shows how to change stereotypes to higher levels of the stereotype hierarchy in a portable blender architecture in System Composer™. Stereotypes that are in a hierarchy inherit properties from base stereotypes. Start by applying a generalized stereotype, then change to a deeper stereotype in the hierarchy to further specify the component.

Open Architecture Model and Import Profile into Model

Open the simpleBlender model or enter this code in the Command Window.

archModel = systemcomposer.openModel("simpleBlender");

This model shows the hardware architecture of a simple portable blender with top-level components that represent physical components to manufacture the blender. Ports represent power sockets that send and receive power to and from these components.

Simple blender platform architecture model.

Import the blenderProfile profile into the model. In the System Composer toolstrip, on the Modeling tab, select Profile Editor > Import, or enter this code in the Command Window.

archModel.applyProfile("blenderProfile");

To view the contents of your imported profile, click Profile Editor to open the Profile Editor, or enter this code in the Command Window.

systemcomposer.profile.editor

The blender profile is selected in the Profile Editor.

In the Profile Editor, you can inspect the structure of the blenderProfile profile. The BaseStereotype stereotype is the top-level stereotype. One level down is the HardwareComponent stereotype that uses BaseStereotype as the base stereotype from which it inherits properties. The PowerConsumer and PowerGenerator stereotypes inherit properties from the HardwareComponent stereotype and are two levels down from the BaseStereotype stereotype.

Apply Stereotypes to All Components

To open the Apply Stereotypes dialog box, in the System Composer toolstrip, on the Modeling tab, select Apply Stereotypes. Set Apply stereotype(s) to as Components. Set Scope as Entire model. Select the blenderProfile.BaseStereotype stereotype.

Apply Stereotypes dialog box with base stereotype selected.

To apply the BaseStereotype stereotype with a default value of 3 kg for the mass property to all components, click Apply.

The Housing component has the stereotype BaseStereotype applied with the value of 3 kg for the mass property.

BaseStereotype now applies to the Housing component.

Change Stereotypes for Multiple Components in Model

Select the Housing component on the canvas. In the Property Inspector, click Select next to BaseStereotype for the Housing component and select ↓ blenderProfile.HardwareComponent. The Housing component is now specified one-level deeper in the BaseStereotype stereotype hierarchy to the HardwareComponent stereotype.The stereotype of the Housing component is now the HardwareComponent stereotype.

Further defining the Housing component as a hardware component adds the additional property, material, which has a default value "titanium".

Double-click the Housing component to view the architecture within it. Select the Battery, Output Shaft, and Blade Assembly components by clicking each of them while pressing Shift. Then, right-click the Battery component, select Change Stereotype, and select the ↓ blenderProfile.HardwareComponent stereotype from the list. The HardwareComponent stereotype is now applied to these three components.

The battery, output shaft, and blade assembly components are now hardware components.

Deselect all components by clicking once in the model canvas. Right-click the Battery component and select Change Stereotype, and then select the ↓ blenderProfile.PowerGenerator stereotype. Repeat for the Output Shaft and Blade Assembly components, but select the ↓ blenderProfile.PowerConsumer stereotype instead.

The Battery component with the PowerGenerator stereotype applied and the PowerOut property value ready to be set.

In the Property Inspector, you can now specify the powerIn and powerOut properties for the Battery, Output Shaft, and Blade Assembly components as necessary.

See Also

Tools

Blocks

Objects

Functions

Related Topics