Creating a New Physical Domain

When to Define a New Physical Domain

A physical domain provides an environment, defined primarily by its Across and Through variables, for connecting the components in a Physical Network. Component nodes are typed by domain, that is, each component node is associated with a unique type of domain and can be connected only to nodes associated with the same domain.

You do not need to define a new physical domain to create custom components. Simscape™ software comes with several predefined domains, such as mechanical translational, mechanical rotational, electrical, hydraulic, and so on. These domains are included in the Foundation library, and are the basis of Simscape Foundation blocks, as well as those in Simscape add-on products (for example, SimHydraulics® or SimElectronics® blocks). If you want to create a custom component to be connected to the standard Simscape blocks, use the Foundation domain definitions. For a complete listing of the Foundation domains, see Foundation Domain Types and Directory Structure.

You need to define a new domain only if the Foundation domain definitions do not satisfy your modeling requirements. For example, to enable modeling electrochemical systems, you need to create a new domain with the appropriate Across and Through variables. If you need to model a thermohydraulic system, you can create a custom hydraulic domain that accounts for fluid temperature by supplying a domain-wide parameter (for an example, see Propagation of Domain Parameters).

Once you define a custom physical domain, you can use it for defining nodes in your custom components. These nodes, however, can be connected only to other nodes of the same domain type. For example, if you define a custom hydraulic domain as described above and then use it when creating custom components, you will not be able to connect these nodes with the regular hydraulic ports of the standard Simscape blocks, which use the Foundation hydraulic domain definition.

Defining a New Physical Domain

To define a new physical domain, you must declare the Through and Across variables associated with it. For more information, see Basic Principles of Modeling Physical Networks.

A domain file must begin with the domain keyword, followed by the domain name, and be terminated by the end keyword.

Domain files contain only the declaration section. Two declaration blocks are required:

  • The Across variables declaration block, which begins with the variables keyword and is terminated by the end keyword. It contains declarations for all the Across variables associated with the domain. A domain model class definition can contain multiple Across variables, combined in a single variables block.

  • The Through variables declaration block, which begins with the variables(Balancing = true) keyword and is terminated by the end keyword. It contains declarations for all the Through variables associated with the domain. A domain model class definition can contain multiple Through variables, combined in a single variables(Balancing = true) block.

For more information on declaring the Through and Across variables, see Declaring Through and Across Variables for a Domain.

The parameters declaration block is optional. If present, it must begin with the parameters keyword and be terminated by the end keyword. This block contains declarations for domain parameters. These parameters are associated with the domain and can be propagated through the network to all components connected to the domain. For more information, see Working with Domain Parameters.

For an example of a domain file, see Declare a Mechanical Rotational Domain.

Was this topic helpful?