Main Content


Establish relationship between component Through variables and nodes


branches a : node1.a -> node2.a; end


branches begins the branches section, which is terminated by an end keyword. This section contains one or more branch statements, which establish the relationship between the Through variables of the component and the domain.

For example, a domain declaration contains a Through variable a:

    a = { 0, 'N' }

and a component declares two nodes, node1 and node2, associated with this domain, and a variable a:

    a = { 0, 'N' };    

The name of the component variable does not have to match that of the domain variable, but the units must be commensurate (in this example, 'N', 'kg*m/s^2', 'lbf', and so on).

To establish a connection between the component variable a and the domain Through (balancing) variable a, write a branch statement, such as:

    a : node1.a -> node2.a;    

node1.a and node2.a identify the conserving equations on node1 and node2, and the component variable a is a term participating in those conserving equations. The branch statement declares that a flows from node1 to node2. Therefore, a is subtracted from the conserving equation identified by node1.a, and a is added to the conserving equation identified by node2.a.

A component can use each conserving equation identifier multiple times. For example, the component declares the following variables and branches:

  a1 = { 0, 'N' }
  a2 = { 0, 'N' }
  a3 = { 0, 'N' }

  a1 : node1.a -> node2.a;
  a2 : node1.a -> node2.a;
  a3 : node2.a -> node1.a;

Then, assuming that node1 and node2 are not referenced by any other branch or connect statements, the conserving equations at these nodes are:

  • For node1

    - a1 - a2 + a3 == 0
  • For node2

    a1 + a2 - a3 == 0

The following rules apply:

  • Each conserving equation belongs to a node associated with a domain. All variables participating in that conserving equation must have commensurate units.

  • A node creates one conserving equation for each of the Through (balancing) variables in the associated domain. Branch statements do not create new equations. They add and subtract terms in the existing conserving equations at the nodes.

  • The second and third arguments do not need to be associated with the same domain. For example, one can be associated with a gas domain, and the other with a thermal domain, with the heat flow exchange defined by the branch statement.

  • You can replace either the second or the third argument with * to indicate the reference node. When you use *, the variable indicated by the first argument is still added to or subtracted from the equation indicated by the other identifier, but no equation is affected by the *.


If a component declaration section contains two electrical nodes, p and n, and a variable i = { 0, 'A' }; specifying current, you can establish the following relationship in the branches section:

   i : p.i -> n.i;

This statement defines current i as a Through variable flowing from node p to node n.

For a grounding component, which has one electrical node V, define current i as a Through variable flowing from node V to the reference node:

   i : V.i -> *;

For a mutual inductor or transformer, with primary and secondary windings, the branches section must contain two statements, one for each winding:

    i1 : p1.i -> n1.i;
    i2 : p2.i -> n2.i;

For a component such as a constant volume pneumatic chamber, where you need to establish the heat flow exchange between the pneumatic and the thermal domains, the declaration section contains the two nodes and the heat flow variable:

   A = foundation.pneumatic.pneumatic; 
   H = foundation.thermal.thermal; 
   h = { 0 , 'J/s' };

and the branches section establishes the heat flow exchange between the two domains:

   h : A.Q -> H.Q;

This statement defines the heat flow h as a Through variable flowing from the pneumatic node A, associated with the chamber inlet, to the thermal node H, associated with the thermal mass of gas in the chamber.

Version History

Introduced in R2013b