Author Architecture Models Through Component Diagram Views
You can edit your System Composer™ model from the component diagram canvas in the Architecture Views Gallery. Add, edit, and delete components, ports, and connectors in the model through your view. You can also edit multiple hierarchies at the same time using component diagram views.
In this topic, you will learn how to:
Create a new component diagram view.
Interactively add, edit, and delete components, ports, and connections in your System Composer model from the Architecture Views Gallery.
Apply stereotypes and create custom queries for your views.
Pivot to the composition to modify Simulink® behaviors.
For a roadmap of the views topics, see Create Custom Views Using Architecture Views Gallery.
Create Component Diagram and Architecture Model
A system designed in System Composer for a real application is usually large and complex. The system typically consists of many complex functions working together to fulfill the system requirements. In the process of designing and analyzing architectures, you must understand existing components and what to add to the components.
A component diagram represents a view with components, ports, and connectors based on how the model is structured.
Create Component Diagram View
Create or open your System Composer architecture model. To create a new view:
Navigate to Modeling > Architecture Views to open the Architecture Views Gallery.
Select New > View to create a new view.
In View Properties on the right pane, in the Name text box, enter a name for this view, for example,
Robot Component View
. Choose a color and enter a description, if necessary.
Create and Add Components
Design a mobile robotic arm where a sensor senses position and trajectory planning
computes a path to a location that the robot needs to reach using motion. An
architecture model of such a system could consist of three primary components:
Sensors
, Trajectory Planning
, and
Motion
. You can represent these components in System Composer
using three Component blocks.
To create a component, use one of these methods.
In the canvas, left-click and drag the mouse to create a rectangle. Release the mouse button to see the component outline. Select the Component block option to commit.
Click and drag a Component block from the left-side palette.
To add existing components to the view, drag and drop components from
Model Components. To remove components from the view,
select your component. On the Architecture Views Gallery toolstrip,
from the Components menu, click
Remove
.
An advantage of authoring architecture models from a component diagram view is you can edit multiple hierarchies at the same time. Press the Ctrl key, left-click and drag the mouse inside of a component to create a new child component. You can also add ports and connections to child components from the top-level view.
Add Ports and Connections
Represent the relationship between components by defining interface ports. You can organize the diagram by positioning ports on any edge of the component, in any position.
Pause over the side of a component. A + sign and a port outline appear.
Click the port outline. A set of options appear for an
Input
,Output
, orPhysical
port.Select
Output
to commit the port. You can also name the port at this point.
A connector allows two components to interact without defining the nature of the interaction. Set an interface on a port to define how the components interact.
Connections are visual representations of data flow from an output port to an input port. For example, a connection from a motor to a sensor carries positional information.
Connect two ports by dragging a line:
Click one of the ports.
Keep the mouse button down while dragging a line to the other port.
Release the mouse button at the destination port. A black line indicates the connection is complete. A red-dotted line appears if the connection is incomplete.
For more information on composition editing, see Compose Architectures Visually.
Define Interfaces
Use the Interface Editor in the Architecture Views Gallery to manage interfaces, assign interfaces to ports, add and modify data elements, and delete interfaces. These changes are mirrored in the parent architecture model.
To open the Interface Editor tool from the Architecture Views Gallery toolstrip, in the Design section, click Interface Editor.
For more information, see Create Interfaces and Use Interface Editor in Views.
Import Profiles and Apply Stereotypes
Use profiles to add properties to components, ports, and connectors in System Composer. The Profile Editor is independent from the model that opens it, so you must explicitly import a new profile into a model. Open the Profile Editor by navigating to Modeling > Profile Editor. You can import a profile into any open dictionaries or models.
Open the Property Inspector by navigating to Modeling > Property Inspector. Select a model element and select the stereotype from the Stereotype list. Alternatively, right-click a model element, select Apply Stereotype, and click a stereotype to apply to the element.
When you apply a stereotype to an element, a new set of properties appears in the Property Inspector under the name of the stereotype. To edit the properties, expand this set. You can use profiles, stereotypes, and properties later in the design process to query and analyze the system design.
For more information about profiles, stereotypes, and properties, see Apply Stereotypes to Extend Model Elements.
Create Behavior
Use Simulink model references to describe the implementation of System Composer components.
To create Simulink behavior:
Right-click a component and select
Create Simulink Behavior
.From the Type list, select
Model Reference
. Provide the model nameMotionSimulink
. The default name is the name of the component.Click OK. A new Simulink model file with the provided name is created in the current folder.
For more information, see Implement Component Behavior Using Simulink.
Pivot From Views To Composition
To change from views editing to model editing, right-click a component in a view and use the context menu to pivot from the component in your view to the corresponding component in your architecture model by selecting Pivot > Composition.
Modify Existing Views
Use queries to define custom viewpoints on the architecture model. View filters rely on the constraints defined by queries. Group ports in component diagram views to simplify complex networks of ports and connections.
For more information on component and port filters, see Create Architecture Views Interactively.
Filter Ports
To filter ports on a component in a view in the Architecture Views Gallery, click and highlight your component. A blue box appears above the component. Pause on the ellipsis (…) that appears to select Filter Ports.
Use the check boxes to choose which ports to show and hide on your component in the view.
You can also add components to the view interactively without ports.
See Also
Tools
- Architecture Views Gallery | Interface Editor | Requirements Editor (Requirements Toolbox) | Requirements Manager (Requirements Toolbox)
Functions
Objects
systemcomposer.view.View
|systemcomposer.query.Constraint
|systemcomposer.interface.DataInterface
|systemcomposer.interface.DataElement