主要内容

Compose Architecture Visually

You can create and edit visual diagrams to represent system architecture 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 functionsimportModel导出模型, 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, seeBuild Architecture Models Programmatically.

Create Architecture Model

A System Composer建筑学represents a system of components and how they interface with each other structurally and behaviorally. You can represent specific architectures using alternate views.

Different types of architectures describe different aspects of systems:

  • 功能架构描述系统中的数据流。

  • Logical architecturedescribes the intended operation of a system.

  • Physical architecturedescribes the platform or hardware in a system.

A System Composermodel是包含架构信息的文件,包括组件,端口,连接器,接口和行为。

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.

从空白体系结构模型开始,以建模系统的物理和逻辑体系结构。使用这三种方法之一创建体系结构模型:

  • 在MATLAB命令窗口中,输入:

    systemcomposer

    SelectArchitecture Model.

    Simulink new selection menu specifying a System Composer architecture model create model selection.

  • From a Simulink®模型或系统作曲家体系结构模型。在“仿真”选项卡上,选择新的model, and then select Architecture.

    新的系统作曲家模型。

  • 在MATLAB命令窗口中,输入:

    archModel = systemcomposer.createModel("ModelName"); systemcomposer.openModel(archModel);

    whereModelNameis the name of the new model.

保存体系结构模型。在模拟tab, select节省. The architecture model is saved as anSLX文件。

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在Simulink上显示金宝app带有顶部工具条的标签,左侧的模型浏览器,中心模型构图左侧的元素调色板以及底部的接口编辑器。

这个例子显示了一个运动控制架构,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

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

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

Add Components

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

  • 绘制一个组件 - 在画布中,左键单击并拖动鼠标以创建矩形。释放鼠标按钮以查看组件大纲。选择Componentblock option to commit.

  • Create a single component from the palette —

    单击并拖动组件,然后进行。

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

具有名称传感器的组件。

The Sensor component after selecting the name to edit it.

Move Component

仅通过单击和拖动来移动组件。蓝色准则似乎有助于将组件与其他组件对齐。

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. 在角落暂停指针以查看双箭头。

    指针位于组件的右下角。

  2. Click the corner and drag while holding the mouse button down. If you want to resize the component proportionally, hold theShiftbutton as well.

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

  3. 当组件达到所需尺寸时,释放鼠标按钮。

删除组件

单击组件和新闻Delete删除它。要删除多个组件,请在持有的同时选择它们Shiftkey down, then pressDelete.

端口

Aport是代表与环境相互作用的组件或体系结构上的节点。一个端口允许从其他组件或系统的信息流进行。

有不同类型的端口:

  • 组件端口are interaction points on the component to other components.

  • 建筑端口are ports on the boundary of the system, whether the boundary is within a component or the overall architecture model.

例如,传感器可能具有与电动机和控制器通信的数据端口。其输入端口从电动机中获取数据,输出端口将数据传递给控制器​​。您可以通过定义接口,如Define Port Interfaces Between Components.

添加组件端口

通过定义方向接口端口来表示组件之间的关系。您可以通过将端口定位在组件的任何边缘,任何位置。

  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输入,Output, orPhysical港口。

    港口提交之前。

  3. SelectOutputto 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 theicon, an input port is shown with theicon, and a physical port is shown with thephysical porticon and is nondirectional.

创建后,您可以将任何端口移至任何组件边缘。

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.

具有三个组件和一个INBUS架构端口和一个Outbus架构端口的型号。

名称端口

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

A selected port name ready to be edited.

组件的端口必须具有唯一的名称。

Move Port

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

箭头键 原始端口边缘 港口运动
Up Left or right If below other ports on the same edge, move up, if not, move to the top edge
上面或者下面 No action
正确的 上面或者下面 如果在同一边缘的其他端口的左侧,请向右移动,如果不是,请移动到右边缘
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
上面或者下面 No action
Left 上面或者下面 如果在同一边缘的其他端口的右侧,请向左移动,如果不是,请移动到左边缘
Left or right No action

端口在一侧的间距是自动的。在同一边缘可以组合输入和输出端口。

Delete Port

Delete a port by selecting it and pressing theDelete按钮。

Connections

连接器是提供端口之间连接的线路。连接器描述信息如何在组件或体系结构之间流动。

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. 将鼠标按钮保持向下,同时将线路拖动到另一个端口。

  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.

连接两个端口的过程。

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.

用标签而不是行显示了体系结构端口和组件端口之间的连接。

The Motor component is connected to the architecture.

连接无端口的组件

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.

分支连接

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.

正确的-clicking on a connection to branch it.

通过连接创建新组件

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 toModeling>环境>Simulink Preferences. InSimulink Preferences, selectEditor,然后选择一个线交叉风格. The default line crossing style,隧道, is shown below.

隧道line crossing style.

另外的选择,Line Hop, is shown below.

Line hop line crossing style.

有关线路交叉样式参数的更多信息,请参见线交叉风格.

See Also

Functions

相关话题