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 and , you can import external architecture descriptions into system composer. for more information, see .
alternatively, you can use matlab programming to create and customize the various architectural elements. for details, see .
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 .
a system composer model is the file that contains architectural information, including 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:
systemcomposer
select architecture model.
use a system composer architecture model to describe systems as a combination of structural elements with underlying behavioral descriptions. use a software architecture model to easily define the execution order of your functions from your components, simulate your design in the architecture level, and generate code by linking your simulink® export-function, rate-based, or jmaab models to components.
for more information about software architecture models, see author software architectures.
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:
archmodel = systemcomposer.createmodel("modelname"); systemcomposer.openmodel(archmodel);
where
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 nontrivial, nearly independent, and 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, a 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
parameters using the
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.
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.
there are different types of ports:
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.
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 port interfaces between components.
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 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.
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 . 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 object, and archport
represents a 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.
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 .
see also
functions
- | | | | |