Compose Architecture Visually

Create and edit visual diagrams to represent system architecture in System Composer™. Use visual architecture elements, components, ports, and connections in the system composition. Model hierarchy in architecture by decomposing components. Navigate through the hierarchy.

Create an Architecture Model

Start with a blank architecture model to model physical and logical architecture of a system. An architecture model includes a top-level architecture that holds the composition of the system. This top-level architecture also allows definition of interfaces of this system with other systems. Use one of these methods to create an architecture model:

  • At the command line, type

    systemcomposer

    Select Architecture Model.

    Simulink new selection menu specifying a system composer architecture model create model selection.

  • From a Simulink model or a System Composer architecture model. On the Simulation tab, select New model, and then select Architecture .

  • At the MATLAB command line, type:

    archModel = new_system('ModelName','Architecture');
    open_system(archModel)

    where ModelName is the name of the new model.

    New System Composer model.

Save the architecture model. On the Simulation tab, select Save All . The architecture model is saved as an .slx file.

The architecture model includes a top-level architecture that holds the composition of the system. This top-level architecture also allows definition of interfaces of this system with other systems. The composition represents a structured parts list — a hierarchy of components with their interfaces and interconnections. Edit the composition in the Composition Editor.

System Composer display on Simulink with labels for the Toolstrip on top, the Model browser on the left, the Element palette directly to the left of the model Composition in the center, and the Interface Editor on the right.

This example shows a motion control architecture, where a sensor obtains information from a motor, feeds that information to a controller, which in turn processes this information to send a control signal to the motor so that it moves in a certain way. You can start with this rough description and add component properties, interface definitions, and requirements as the design progresses.

Components

A component is a nontrivial, nearly-independent, and replaceable part of a system that fulfills a clear function in the context of an architecture. The Component element in System Composer can represent a component at any level of the system hierarchy, whether it is a major system component that encompasses many subsystems, such as a controller with its hardware and software, or a component at the lowest level of hierarchy, such as a software module for messaging.

Add Components

Use one of these methods to add components to the architecture:

  • Draw a component — In the canvas, left-click and drag the mouse to create a rectangle. Release the mouse button to see the component outline. Click the light blue outline to commit.

    Clicking and dragging a component and then committing it by clicking on the light blue outline with the mouse.

  • Create a single component from the palette —

    Committing a second component.

  • Create multiple components from the palette —

Name a Component

Each component must have a name that is unique within the same architecture level. The name of the component is highlighted upon creation so you can directly type the name. To change the name of a component, click the component and then click its name.

A component with the name Sensor.

The Sensor component after selecting the name to edit it.

Move a Component

Move a component simply by clicking and dragging it. Blue guidelines may appear to help align the component with other components.

Clicking and dragging a component named Component1 to move it.

Resize a Component

Resize a component by dragging corners.

  1. Hover the pointer over a corner to see the double arrow.

    Pointer is on the bottom right of Component1.

  2. Left-click the corner and drag while holding the mouse button down. If you want to resize the component proportionally, hold the Shift button as well.

    Clicking and dragging the bottom right of Component1 to resize it.

  3. Release the mouse button when the component reaches the size you want.

Delete a Component

Click a component and press Delete to delete it. To delete multiple components, select them while holding the Shift key down, then press Delete or right-click and select Delete from the context menu.

Ports

A port represents the connection point of a component to other components. For example, a sensor might have data ports to communicate with a motor and a controller. Its input port takes data from the motor, and the output port delivers data to the controller. You can specify data properties by defining an interface as described in Define Interfaces.

Add a Component Port

Represent the relationship between components by defining directional interface ports. You can organize the diagram by positioning ports on any edge of the component, in any position.

  1. Pause over the side of a component. A + sign and a port outline appear.

    Adding a component port to the right side of the Sensor component. The port displays as a light blue outline until you commit to it.

  2. Click the port outline. The component is shaded blue and a port arrow appears.

    The port before committing it.

  3. Click the arrow to commit the port. You can also name the port at this point.

    The port named OutBus after commiting the port.

An output port is shown with the icon and an input port is shown with the icon. By default, a port created on the top or left edge of a component is an input port, and a port created on the bottom or right edge is an output port. To designate port direction at creation, after you click the edge, pause over the arrow outline to see direction options. Select Input or Output before committing the port.

Direction options for a port on a component.

You can move any port to any component edge after creation.

Add an Architecture Port

You can also create a port for the architecture that contains components. These system ports carry the interface of the system with other systems. Pause on any edge of the system box and click when the + sign appears. Click the left side to create input ports and click the right side to create output ports.

Model with a connection between Sensor and Component1 and an InBus on the Motor component.

Name a Port

Every port is created with a name. To change the name, click it and edit.

A selected port name ready to be edited.

Ports of a component must have unique names.

Move a Port

You can move a port to any side of a component. Select the port and use arrow keys.

Arrow KeyOriginal Port EdgePort Movement
UpLeft or rightIf below other ports on the same edge, move up, if not, move to the top edge
Top or bottomNo action
RightTop or bottomIf to the left of other ports on the same edge, move right, if not, move to the right edge
Left or rightNo action
DownLeft or rightIf above other ports on the same edge, move down, if not, move to the bottom edge
Top or bottomNo action
LeftTop or bottomIf to the right of other ports on the same edge, move left, if not, move to the left edge
Left or rightNo action

The spacing of the ports on one side is automatic. There can be a combination of input and output ports on the same edge.

Delete a Port

Delete a port by selecting it and pressing the Delete button.

Connections

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 Existing Ports

Connect two ports by dragging a line:

  1. Click one of the ports.

  2. Keep the mouse button down while dragging a line to the other port.

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

The process of connecting two ports.

You can take these steps in both directions — input port to output port, or output port to input port. You cannot connect ports that have the same direction.

A connection between an architecture port and a component port is shown with tags instead of lines.

The Motor component is connected to the architecture.

Connect Components Without Ports

To quickly create ports and connections at the same time, drag a line from one component edge to another. The direction of this connection depends on which edges of the components are used - left and top edges are considered inputs, right and bottom edges are considered outputs. You can also perform this operation from an existing port to a component edge.

Creating a port upon connecting a port to a component without ports.

You can create a connection between an edge that is assumed to be an input only with an edge that is assumed to be an output. For example, you cannot connect a top edge, which is assumed to be an input, with another top edge, unless one of them already has an output port.

Branch Connections

Connect an output port to multiple input ports by branching a connection. To branch, right-click an existing connection and drag to an input port while holding the mouse button down. Release the button to commit the new connection.

Right-clicking on a connection to branch it.

Create New Components Through Connections

If you start a connection from an output port and release the mouse button without a destination port, a new component tentatively appears. Accept the new component by clicking it.

Attempt to make a new connection and a suggested component appears in light blue to be accepted by clicking on it.

Importing Architectures

By combining the programmatic APIs of System Composer with MATLAB® support for loading and parsing many different file and databased formats, you can import external Architecture descriptions into System Composer. You can setup a profile with Stereotypes ahead of time to capture the Architecture properties represented in such descriptions. Subsequently, you can use MATLAB programming to create and customize the various Architectural elements through the set of programmatic APIs.

Related Topics