Main Content

Declare Component Nodes

Component nodes define the conserving ports of a Simscape™ block generated from the component file. The type of the conserving port (electrical, mechanical rotational, and so on) is determined by the type of its parent domain. The domain defines which Through and Across variables the port can transfer. Conserving ports of Simscape blocks can be connected only to ports associated with the same domain. For more information, see Basic Principles of Modeling Physical Networks.

When declaring nodes in a component, you have to associate them with an existing domain. Once a node is associated with a domain, it:

  • Carries each of the domain Across variables as a measurable quantity

  • Writes a conserving equation for each of the domain Through variables

For more information, see Define Relationship Between Component Variables and Nodes.

You need to refer to the domain name using the full path starting with the top namespace folder. For more information on packaging your Simscape files, see Building Custom Block Libraries.

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 namespace folder is +foundation. It contains a subnamespace +mechanical, with a subnamespace +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 namespace folder +MechanicalElements, the syntax would be:

nodes
    r = MechanicalElements.rotational;
end

Note

Components using your own customized rotational domain cannot be connected with the components using the Simscape Foundation mechanical rotational domain. Use your own customized domain definitions to build complete libraries of components to be connected to each other.

Specifying an optional comment lets you control the port label and location in the block icon. For more information, see Customize the Names and Locations of the Block Ports. In the following example, the electrical conserving port will be labelled + and will be located on the top side of the block icon.

nodes
    p = foundation.electrical.electrical; % +:top
end

Related Examples

More About