Define component nodes, that is, conserving ports of block
nodes a = package_name.domain_name; end
nodes
begins a nodes declaration block, which
is terminated by an end
keyword. This block contains
declarations for all the component nodes, which correspond to the
conserving ports of a Simscape™ block generated from the component
file. Each node is defined by assignment to an existing domain. See Declare Component Nodes for
more information.
The following syntax defines a node, a
, by
associating it with a domain, domain_name
. package_name
is
the full path to the domain, starting with the top package directory.
For more information on packaging your Simscape files, see Building Custom Block Libraries.
nodes a = package_name.domain_name; end
You can specify the port label and location, the way you want it to appear in the block diagram, as a comment:
nodes a = package_name.domain_name; % label:location end
where label
is a string corresponding to
the port name in the block diagram, location
is
one of the following strings: left
, right
, top
, bottom
.
The following example uses the syntax for the Simscape Foundation mechanical rotational domain:
nodes r = foundation.mechanical.rotational.rotational; 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 domain file rotational.ssc
.
If you want to use your own customized rotational domain called rotational.ssc
and
located at the top level of your custom package directory +MechanicalElements
,
the syntax would be:
nodes r = MechanicalElements.rotational; end
The following example declares an electrical node using the syntax for the Simscape Foundation electrical domain. In the block diagram, this port will be labelled + and will be located on the top side of the block icon.
nodes p = foundation.electrical.electrical; % +:top end