User Guide

Chapter 6 Analog behavioral modeling
170
Example three
A device, EPWR, computes the instantaneous power by
multiplying the voltage across nets 5 and 4 by the current
through VSENSE. Sources are controlled by expressions
which may contain voltages or currents or both. The
ABM2 part (two inputs, current output) in Figure 45 could
represent this.
This part is characterized by the following properties:
EXP1 = V(%IN2,%IN1) *
EXP2 = I(VSENSE)
This produces a PSpice netlist declaration like this:
EPWR 3 0 VALUE = {V(5,4)*I(VSENSE)}
Example four
The output of a component, GRATIO, is a current whose
value (in amps) is equal to the ratio of the voltages at nets
13 and 2. If V(2) = 0, the output depends upon V(13) as
follows:
if V(13) = 0, output = 0
if V(13) > 0, output = MAXREAL
if V(13) < 0, output = -MAXREAL
where MAXREAL is a PSpice internal constant
representing a very large number (on the order of 1e30). In
general, the result of evaluating an expression is limited to
MAXREAL. This is modeled with an ABM2/I (two input,
current output) part like this one in Figure 46.
This part is characterized by the following properties:
EXP1 = V(%IN2)/V(%IN1)
Note that output of GRATIO can be used as part of the
controlling function. This produces a PSpice netlist
declaration like this:
GRATIO 2 3 VALUE = {V(13)/V(2)}
Note
Letting a current approach
±
1e30 will almost certainly cause
convergence problems. To avoid this, use the limit function on the
ratio to keep the current within reasonable limits.
Figure 45
ABM expression part
example three.
Figure 46
ABM expression part
example four.
Pspug.book Page 170 Wednesday, November 11, 1998 1:14 PM