nodes
Define component nodes, that is, conserving ports of block
Syntax
nodes a = package_name.domain_name; end
Description
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, the way you want it to appear in the block diagram, as a comment:
nodes a = package_name.domain_name; % label end
where label
is a string corresponding to the port name in the block
diagram. You can use Side
annotation to specify the port location on
the block icon. For more information, see Customize the Names and Locations of the Block Ports.
You can also declare nodes as resizable arrays of elements that all belong to the same domain type. For more information, see Arrays of Nodes.
Examples
This 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 is:
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; % + end annotations p : Side = top; end
The next example declares an array of thermal nodes using the syntax for the Simscape Foundation thermal domain. The array size is an adjustable parameter that the block users can modify.
parameters N = 20; % Number of nodes end for i=1:N nodes H(i) = foundation.thermal.thermal; end end
Version History
Introduced in R2008b