Branches

A branch is a path between two nets. Each branch is associated with the two wires from which it derives a discipline. These wires are referred to as the branch terminals. Only one wire need be specified, in which case the second net defaults to ground and the discipline for the branch is derived from the specified wires. The disciplines for the specified nets must be compatible.

Branches are explicitly declared and named using:

branch (n1, n2) branch1, branch2;

In this case, two branches are created, both of which are connected between wires n1 and n2. If either of the wires is a bus, then the branch becomes a vector branch. If both nets are vectors, they must have the same size.

In addition to explicitly named and declared branches, implicitly declared unnamed branches are also supported. In this case, a pair of wires is used to identify the branch. There is only one unnamed branch between any two wires.

The potential of the branch equals the different in potentials of the two branch terminals. The potential is positive if the potential of the first terminal is greater than the potential of the second terminal. The potential of a branch is accessed by applying the potential access function to the branch. So for example, to access the voltage of an electrical branch named ‘diode’, one would use:

V(diode)

To access the voltage of the unnamed electrical branch that connects ‘out_p’ and ‘out_n’, use:

V(out_p, out_n)

And finally, to access the voltage of the unnamed electrical branch that connects ‘in’ to ground, use:

V(in)

The flows entering the two terminals of a branch always sum to zero. The flow is positive if it enters the first terminal and flows to the second. The flow of a branch is accessed by applying the flow access function to the branch. So for example, to access the current of an electrical branch named ‘diode’, one would use:

I(diode)

To access the current of the unnamed electrical branch that connects ‘out_p’ and ‘out_n’, use:

I(out_p, out_n)

And finally, to access the current of the unnamed electrical branch that connects ‘in’ to ground, use:

I(in)