Quantcast

Documentation Center

  • Trial Software
  • Product Updates

components

Declare member components included in composite component

Syntax

components(Hidden=true) a = package_name.component_name; end     

Description

components begins a components declaration block, which is terminated by an end keyword. This block, used in composite models only, contains declarations for member components included in the composite component. A components declaration block must have its Hidden attribute value set to true (for more information on member attributes, see Attribute Lists).

Each member component is defined by assignment to an existing component file. See Declaring Member Components for more information.

The following syntax defines a member component, a, by associating it with a component file, component_name. package_name is the full path to the component file, starting with the top package directory. For more information on packaging your Simscape™ files, see Generate Custom Block Libraries from Simscape Component Files.

components(Hidden=true)
    a = package_name.component_name;
end

After you declare all member components, specify how their ports are connected to one another, and to the external inputs, outputs, and nodes of the top-level component. See Specifying Component Connections for more information.

Once you declare a member component, you can use its parameters and variables in the setup section of the composite component file. If you want a parameter of the member component to be adjustable, associate it with the top-level parameter of the composite component. See Parameterizing Composite Components for more information.

Examples

The following example includes a Rotational Spring block from the Simscape Foundation library in your custom component:

components(Hidden=true)
    rot_spring = foundation.mechanical.rotational.spring;
end

The name of the top-level package directory is +foundation. It contains a subpackage +mechanical, with a subpackage +rotational, which in turn contains the component file spring.ssc.

Once you declare a member component, use its identifier (rot_spring) to refer to its parameters, variables, nodes, inputs, and outputs, as they are defined in the member component file. For example, rot_spring.spr_rate refers to the Spring rate parameter of the Rotational Spring block.

Was this topic helpful?