Subcircuit expansion |
The subcircuit is defined in the input file by a grouping of element lines; the program then automatically inserts the group of elements wherever the subcircuit is referenced. Most of the time, the user does not need to know how subcircuits are expanded unless the user wants to plot or print node voltages and branch currents inside a subcircuit.
Internal node connected to global node
The internal node name is renamed to the global node name.
Internal node wholly internal to subcircuit
The name of the element that calls the subcircuit is added to the name of the local nodes.
Elements
The name of the element that calls the subcircuit is added to the name of elements.
Models
The name of the element that calls the subcircuit is added to the name of the models.
* subcircuit expansion
V1 1 0 5
XU1 1 2 0 SUBA
*
.SUBCKT SUBA 10 20 30
R1 10 40 1K
R2 20 40 1K
R3 30 40 1K
XU2 10 20 40 SUBB
.MODEL MODN NPN
.ENDS
*
.SUBCKT SUBB 100 200 300
R10 100 400 1K
R20 200 400 1K
R30 300 400 1K
.MODEL MODP PNP
.ENDS
*
.OP
*
.END
after expansion:
v1 1 0 5
r1:xu1 1 40:xu1 1k
r2:xu1 2 40:xu1 1k
r3:xu1 0 40:xu1 1k
r10:xu2:xu1 1 400:xu2:xu1 1k
r20:xu2:xu1 2 400:xu2:xu1 1k
r30:xu2:xu1 40:xu1 400:xu2:xu1 1k
.model modp:xu2:xu1 pnp
.model modn:xu1 npn
.op
.end