addComponent - Add components to architecture - MATLAB (original) (raw)

Add components to architecture

Syntax

Description

[components](#mw%5F3dce15fe-3bbc-4128-bfae-69ace547b651%5Fsep%5Fmw%5Fcd50e09e-4e0f-412a-ba30-a04f27fcba39) = addComponent([arch](#mw%5F3dce15fe-3bbc-4128-bfae-69ace547b651%5Fsep%5Fmw%5Feac4bd99-f7ec-4b2d-8753-44a4fc3f47d4),[compNames](#mw%5F37531c1e-ec5d-4d35-bcb2-e4e67ccfcd3b)) adds a set of components specified by the names compNames.

To remove a component, use the destroy function.

example

[components](#mw%5F3dce15fe-3bbc-4128-bfae-69ace547b651%5Fsep%5Fmw%5Fcd50e09e-4e0f-412a-ba30-a04f27fcba39) = addComponent([arch](#mw%5F3dce15fe-3bbc-4128-bfae-69ace547b651%5Fsep%5Fmw%5Feac4bd99-f7ec-4b2d-8753-44a4fc3f47d4),[compNames](#mw%5F37531c1e-ec5d-4d35-bcb2-e4e67ccfcd3b),[stereotypes](#mw%5F3dce15fe-3bbc-4128-bfae-69ace547b651%5Fsep%5Fmw%5Fc4092719-8807-42ea-a4e5-e13e709e1455)) applies stereotypes specified in stereotypes to the new components.

[components](#mw%5F3dce15fe-3bbc-4128-bfae-69ace547b651%5Fsep%5Fmw%5Fcd50e09e-4e0f-412a-ba30-a04f27fcba39) = addComponent(___,[Name=Value](#namevaluepairarguments)) specifies options using one or more name-value arguments in addition to the input arguments in previous syntaxes.

Examples

collapse all

Create a model, get the root architecture, and create components. Arrange the layout to view both components.

model = systemcomposer.createModel("archModel"); systemcomposer.openModel("archModel"); arch = get(model,"Architecture"); names = ["Component1","Component2"]; comps = addComponent(arch,names); Simulink.BlockDiagram.arrangeSystem("archModel");

Input Arguments

collapse all

Name of components, specified as a cell array of character vectors or an array of strings. The length of compNames must be the same asstereotypes.

Data Types: char | string

Stereotypes to apply to components, specified as a cell array of character vectors or an array of strings. Each element is the qualified stereotype name for the corresponding component in the form "<profile>.<stereotype>".

Data Types: char | string

Name-Value Arguments

collapse all

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: comps = addComponent(arch,compNames,Position=[100 100 200 300])

Position of component on canvas, specified as a vector of coordinates, in pixels [left top right bottom].

Each vector specifies the location of the top left corner and bottom right corner of the component, specified as a 1-by-4 numeric array. The array denotes the top left corner in terms of its x and y coordinates followed by the x and y coordinates of the bottom right corner.

When adding more than one component, you can specify a matrix of size_N_-by-4, where N is the number of components being added.

Data Types: numeric

Output Arguments

More About

collapse all

Term Definition Application More Information
Architecture 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. Compose Architectures VisuallyAuthor Parameters in System Composer Using Parameter Editor
Root 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. Compose Architectures Visually
Model A System Composer model is the file that contains architectural information, such as components, ports, connectors, interfaces, and behaviors. Perform operations on a model including extracting root-level architecture, applying profiles, linking interface data dictionaries, or generating instances from model architecture. A System Composer model is stored as an SLX file. Create Architecture Model with Interfaces and Requirement Links
Component 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. 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, and parameters using the Parameter Editor. Compose Architectures Visually
Port 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. Compose Architectures Visually
Connector 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. Compose Architectures Visually

Version History

Introduced in R2019a

See Also

Functions

Objects

Blocks

Topics