|Convert subsystem containing Simscape blocks into equivalent Simscape file or files|
This example shows how to implement a DC motor model by means of a composite component.
This example shows how you can use
to implement a DC motor model by means of a composite component.
This example shows how to implement variants within a component file by using conditional sections.
A composite component is constructed out of other components. To create a composite component, you have to list the names of the member (constituent) components and then specify how the ports of the member components are connected to each other and to the external ports of the composite component. You also specify which parameters of the member components are to be visible, and therefore adjustable, in the block dialog box of the composite component.
components declaration block begins with
components keyword and is terminated by an
This block contains declarations for member components included in
the composite component. A
block must have its
ExternalAccess attribute value
observe (for more information on member
attributes, see Attribute Lists).
Composite component parameters let you adjust the desired parameters of the underlying member components from the top-level block dialog box when building and simulating a model.
Member components have to be declared as hidden, and therefore
their variables do not appear in the Variables tab
of the top-level block dialog box. However, if a certain member component
variable is important for initialization, you can tie its value to
an initialization parameter in the top-level
block. In this case, the block user will be able to adjust the initial
target value of the member component variable from the top-level block
dialog box when building and simulating a model.
The structure section of a Simscape™ file is executed once during compilation. This section contains information on how the constituent components’ ports are connected to one another, as well as to the external inputs, outputs, and nodes of the top-level component.
An import mechanism provides a convenient means to accessing classes defined in different scopes, or namespaces.
Use conditional sections to define variants within component file.
You can generate a composite component from a subsystem consisting entirely of Simscape blocks.