component
Component model class definition
Parent Section: none (top-level)
Syntax
component ComponentName
... % Declaration section
... % Implementation section
end
Description
component begins the component model class definition, which is
terminated by an end keyword. Only blank lines, comments, and
import statements can precede component. You
must place a component model class definition in a file of the same name with a file
name extension of .ssc.
A component file consists of member declaration sections, followed by implementation sections, such as branches, equations, events, and so on. These sections can be in any order. The file can contain multiple instances of declaration or implementation sections of the same type.
The member declaration sections may include:
nodes— Declarations for all the component nodes, which correspond to the conserving ports of a Simscape™ block generated from the component file.inputs— Declarations for all the inputs, which correspond to the input Physical Signal ports of a Simscape block generated from the component file.outputsoutputs— Declarations for all the outputs, which correspond to the output Physical Signal ports of a Simscape block generated from the component file.parameters— Declarations for component parameters. Parameters appear in the block dialog box of a Simscape block generated from the component file.variables— Declarations for all the variables associated with the component.components— This section, used in composite models only, contains declarations for member components included in the composite component.intermediates— Declarations of intermediate terms that can be reused in anyequationssection of the same component or of an enclosing composite component.
The implementation sections may include:
branches — This section
establishes relationship between the Through variables of the component and the domain.
Relationship between the Across variables is established in the equation section. For
more information, see Define Relationship Between Component Variables and Nodes.
connections — This section,
used in composite models only, contains information on how the constituent components’
ports are connected to one another, and to the external inputs, outputs, and nodes of
the top-level component.
equationsequations — This section contains
the equations that define how the component works.
events — This section
manages the event updates. For more information, see Discrete Event Modeling.
annotations — This section lets you provide annotations in a
component file that control various cosmetic aspects of a Simscape block generated from this component.
For a list of component model and declaration member attributes, see Attribute Lists.
Examples
Version History
Introduced in R2008b