Compose Architectures Visually
You can create and edit visual diagrams to represent architectures in System Composer™. Use architectural elements including components, ports, and connections in the system composition. Model hierarchy in architecture by decomposing components. Navigate through the hierarchy.
With MATLAB® code and the functions importModel
and exportModel
, you can import external architecture descriptions into System Composer. For more information, see Import and Export Architecture Models.
Alternatively, you can use MATLAB programming to create and customize the various architectural elements. For details, see Build Architecture Models Programmatically.
Note
When you load existing interface data dictionaries, Simulink® automatically migrates them to the Architectural Data section of the
Simulink data dictionary. In addition to the Interface
Editor, you can also use the Architectural Data
Editor and Simulink.dictionary.ArchitecturalData
programmatic interfaces to manage and
modify interfaces and value types. For more information on managing architectural data, see
Store Shared Data in Architectural Data Section and Store Data in Architectural Data Section Programmatically.
Tip
To learn more about how System Composer concepts apply to systems engineering design, see System Composer Concepts.
Create Architecture Model
A System Composer architecture represents a system of components and how they interface with each other structurally and behaviorally.
Different types of architectures describe different aspects of systems. You can use views to visualize a subset of components in an architecture. You can define parameters on the architecture level using the Parameter Editor.
A System Composer model is the file that contains architectural information, such as components, ports, connectors, interfaces, and behaviors.
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.
Start with a blank architecture model to model the physical and logical architecture of a system. Use one of these three methods to create an architecture model:
At the MATLAB Command Window, enter this command.
systemcomposer
Select Architecture Model.
System Composer provides template architecture models that address different domains in systems engineering and software architecture modeling: Architecture Model and Software Architecture Model. All architecture models provide the same structural capabilities with some domain and platform specific constraints. For more information on architecture templates, see Choose Architecture Template for System Design.
From a Simulink model or a System Composer architecture model. On the Simulation tab, select New , and then select Architecture .
At the MATLAB Command Window, enter this command.
archModel = systemcomposer.createModel("modelName"); systemcomposer.openModel("modelName");
The argument
modelName
is the name of the new model.
Save the architecture model. On the Simulation tab, select Save . 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.
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 replaceable part of a system that fulfills a clear function in the context of an architecture. A component defines an architectural element, such as a function, another system, hardware, software, or other conceptual entity. A component can also be a subsystem or subfunction.
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.
Represented as a block, a component is a part of an architecture model that can be separated into reusable artifacts. Transfer information between components with:
Port interfaces using the Interface Editor
Parameters using the Parameter Editor
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. Select the Component block option to commit.
Create a single component from the palette —
Create multiple components from the palette —
Name 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.
Move Component
Move a component simply by clicking and dragging it. Blue guidelines may appear to help align the component with other components.
Resize Component
Resize a component by dragging corners.
Pause the pointer over a corner to see the double arrow.
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.
Release the mouse button when the component reaches the size you want.
Delete 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.
Add Mask Icon on Component
You can use mask icons to mask System Composer components with an image that covers the component body and header. Mask icons allow for more visually expressive architecture diagrams.
Select a Component or Variant Component block.
To open the Add mask icon image dialog box, from the toolstrip, select Format > Add Image to Block.
To select an image from your file, click Browse. The directory must be on the MATLAB path.
To remove the mask image, from the toolstrip, select Format > Edit Image > Remove Image.
To inspect component names or port names after applying a mask icon,
use the Property
Inspector. To configure additional options such as mask transparency, use
the setMaskImage
function.
For an example of using mask icons on Component and Variant Component blocks, see Calculate Endurance Using Quadcopter Architectural Design.
Change Default Fonts
You can change the default font in your component headers, linked model or subsystem names, port names, and subsystem component line labels. To modify your font choices, open the Font Styles dialog box. From the System Composer toolstrip, select Format > Fonts for Model from the down arrow next to the Font button .
Ports
A port is a node on a component or architecture that represents a point of interaction with its environment. A port permits the flow of information to and from other components or systems.
Component ports are interaction points on the component to other components.
Architecture ports are ports on the boundary of the system, whether the boundary is within a component or the overall architecture model. The root architecture has a boundary defined by its ports.
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 values by defining an interface as described in Define Port Interfaces Between Components.
Note
New ports by default use <inherit>
mode to support unknown
interface specifications in early stages of architectural design. If an interface is
specified on another port, the <inherit>
specification propagates
that interface across connections to your original port.
Add 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.
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.
An output port is shown with the icon, an input port is shown with the icon, and a physical port is shown with the icon and is nondirectional.
You can move any port to any component edge after creation.
Add Architecture Port
You can also create a port for the architecture that contains components. These system ports on the boundary carry the interface of the system to other systems.
A root is at the top of an architecture hierarchy. A root architecture has a boundary defined by its architecture ports that surround the system of interest.
The root architecture has a system boundary surrounding your architecture model. You can add architecture ports that define interfaces across the boundary.
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.
Name Port
Every port is created with a name. To change the name, click it and edit.
Ports of a component must have unique names.
Move Port
You can move a port to any side of a component. Select the port and use arrow keys.
Arrow Key | Original Port Edge | Port Movement |
---|---|---|
Up | Left or right | If below other ports on the same edge, move up, if not, move to the top edge |
Top or bottom | No action | |
Right | Top or bottom | If to the left of other ports on the same edge, move right, if not, move to the right edge |
Left or right | No action | |
Down | Left or right | If above other ports on the same edge, move down, if not, move to the bottom edge |
Top or bottom | No action | |
Left | Top or bottom | If to the right of other ports on the same edge, move left, if not, move to the left edge |
Left or right | No 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 Port
Delete a port by selecting it and pressing the Delete button.
Change Port Type
To change a port type, right-click a port and select Change port action, then select either Input, Output, or Physical. You can also change port types in the Property Inspector. In the Interface section, from the Action list, select the appropriate port action.
Use the systemcomposer.arch.PortDirection
enumeration to change port action. In this example, compPort
represents a systemcomposer.arch.ComponentPort
object, and archPort
represents a systemcomposer.arch.ArchitecturePort
object. Each object uses a Direction
property to identify port action.
compPort.Direction = systemcomposer.arch.PortDirection.Input compPort.Direction = systemcomposer.arch.PortDirection.Physical archPort.Direction = systemcomposer.arch.PortDirection.Output archPort.Direction = systemcomposer.arch.PortDirection.Physical
For an Input
port or an Output
port, you can change a port type to its conjugate after right-clicking a port and selecting Conjugate port
from the context menu. An Input
port is converted into an Output
port, and an Output
port is converted into an Input
port.
Connections
Connectors are lines that provide connections between ports. Connectors describe how information flows between components or architectures.
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 Existing Ports
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.
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.
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.
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.
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.
Auto-Connect Ports With Same Name
You can automatically connect ports with the same name between components on the model canvas.
Highlight a component with the ports to connect from.
Press Ctrl and right-click another component whose ports to which you would like to connect using the same name rule.
For more information, see Connect Blocks.
To connect same name ports using programmatic interfaces, use the connect
function and specify "name"
for the Rule
name-value argument. To identify your ports and components, use the lookup
function with the getQualifiedName
function.
Change Line Crossing Style for Overlapping Connections
In complex architectural diagrams, connectors can overlap. You can improve the readability of your diagram by choosing another line crossing style. Navigate to Modeling > Environment > Simulink Preferences. In Simulink Preferences, select Editor, then select a Line crossing style. The default line crossing style, Tunnel
, is shown below.
Another option, Line Hop
, is shown below.
For more information on line crossing style parameters, see Line crossing style.
See Also
Functions
createModel
|addComponent
|addPort
|connect
|setMaskImage
|exportModel
|importModel