compose architectures visually -凯发k8网页登录

main content

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.

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

    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 model, and then select architecture .

    new system composer model.

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

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 at the bottom.

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 —

    clicking and dragging a component and then committing it.

  • create multiple components from the palette —

    committing a second component.

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.

a component with the name sensor.

the sensor component after selecting the name to edit it.

move component

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

click and drag a component named component1 to move it and it lines up with other components.

resize component

resize a component by dragging corners.

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

    pointer is on the bottom right of component1.

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

  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. a set of options appear for an input, output, or physical port.

    the port before committing it.

  3. select output to commit the port. you can also name the port at this point.

    the port named outbus after committing the port.

an output port is shown with the icon, an input port is shown with the icon, and a physical port is shown with the physical port 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.

model with three components and one inbus architecture port and one outbus architecture port.

name 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 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 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:

  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.

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.

tunnel line crossing style.

another option, line hop, is shown below.

line hop line crossing style.

for more information on line crossing style parameters, see .

see also

functions

  • | | | | |

blocks

related topics

网站地图