Main Content

Declare Through and Across Variables for a Domain

In a domain file, you have to declare the Through and Across variables associated with the domain. These variables characterize the energy flow and usually come in pairs, one Through and one Across. Simscape™ language does not require that you have the same number of Through and Across variables in a domain definition, but it is highly recommended. For more information, see Basic Principles of Modeling Physical Networks.

variables begins an Across variables declaration block, which is terminated by an end key word. This block 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. This block is required.

Through variables are semantically distinct in that their values have to balance at a node: for each Through variable, the sum of all its values flowing into a branch point equals the sum of all its values flowing out. Therefore, a domain file must contain a separate declaration block for its Through variables, with the Balancing attribute set to true.

variables(Balancing = true) begins a Through variables definition block, which is terminated by an end key word. This block 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. This block is required.

Each variable is defined as a value with unit:

domain_var1 = { value , 'unit' };

value is the initial value. unit is a valid unit string, defined in the unit registry. See Declare a Mechanical Rotational Domain for more information.

Related Examples

More About