APPLICATION NOTE
3
then the output of E1 is sqrt(v(1)/time). This prevents convergence problems when sqrt(v(1)/time) is
evaluated at time = 0.
Passing Parameters to Sub-Circuits
Parameter passing into sub-circuits also works with Analog Behavioral Modeling, making your models more
flexible. Here is a small system that is a voltage follower with hysteresis, useful in simulating, say, a mechanical
system with gear backlash:
Figure 4: Hysteresis Sub-circuit
.subckt HYS in out params: H=1 G1 0 1 TABLE
{V(IN,1)/(H/2)} (-2,-1G) (-1,0) (1,0) (2,1G) C1 1 0 1
R1 1 0 1G E1 out 0 1 0 1 .ends
In the model, the parameter H defines the size of the hysteresis, and is used in the formula input to the table. The
combination of the formula and table defines a dead-band outside of which the output follows the input with an
offset of H/2. The capacitor serves as memory for the circuit and is nearly ideal except for the DC-bias resistor,
which provides a droop time constant of one billion seconds. The voltage follower, E1, prevents output loading
problems. E1 could also have gain representing the gear ratio of a mechanical system; then voltage would
represent the total turn angle of each gear, and H the amount of angular backlash.
Figure 5: Circuit using RMS and Hysteresis Sub-circuit