APPLICATION NOTE
2
Figure 2: Look-up Tables Sub-circuit
The input to the table is the differential gain formula, but the look-up table has only two entries. The output of the
table is interpolated between these two endpoints and clamped when the input exceeds the table's range. This is
a convenient use of the table look-up form, available in PSpice.
Designing Small Systems
Small systems of behavioral models are easy to design using PSpice. For example, a true-RMS circuit can be
built by decomposing the RMS function:
1. Square the signal
2. Integrate over time
3. Take the square-root of the time average
These three operations can be bundled in a tiny sub-circuit for use as a module:
Figure 3: RMS Sub-circuit
.subckt RMS in out G1 0 1 VALUE {V(IN)*V(IN)}
C1 1 0 1 R1 1 0 1G E1 out 0 VALUE {IF(TIME<=0,
0, SQRT(V(1)/TIME))} .ends
The current source, G1, squares the signal, which is then integrated in the capacitor, C1. The voltage on the
capacitor is time averaged, and the square-root is taken. The resistor is a dummy load that satisfies the algorithm.
The voltage source E1 shows that the value of simulated time is available in Analog Behavioral Modeling, and
may be used as a variable in a formula. Note the if-than-else function; If time is less than or equal to zero