Re: HSPICE to PSPICE Conversion

From: Jim Thompson (thegreatone_at_example.com)
Date: 02/20/05


Date: Sun, 20 Feb 2005 09:57:01 -0700

On 19 Feb 2005 20:25:20 -0800, "Gish" <andrewgish@comcast.net> wrote:

>Ok,
>
>I actually figured everything out except for one line...
>
>E1 out ref in+ in- MAX=5V MIN=-5V opamp_gain
>
>I'm trying to code a VCVS with maximum and minimum output values, but
>PSPICE rejects the MAX and MIN parts. Any ideas?
>
>Thanks
>
>Gish wrote:
>> Hi Guys
>>
>> I have some SPICE code that runs perfectly in HSPICE but will not run
>> in PSPICE due to issues with "subcircuit expansion." If there's any
>> experts out there who could take a quick look at this and let me know
>> what the issue might be I'd appreciate it.
>>
>> Thanks
[snip]

Here are a few of the operators in PSpice BEHAVIORAL elements:

LIMIT(x,min,max) result is min if x < min, max if x > max, and x
                  otherwise

MAX(x,y) maximum of x and y

MIN(x,y) minimum of x and y

In addition you must use the BEHAVIORAL syntax of the E-source

So the correct expression for E1 is:

E1 out ref VALUE = {LIMIT((opamp_gain*V(in+,in-)),MIN,MAX)}

.PARAM MAX=5V MIN=-5V opamp_gain=100K

(Or put the numerics directly in the expression.)

This is convergence risk using mathematical limits, since they are
hard, and derivatives don't exist at the limit points.

I prefer using the TANH expression:

E1 1 0 VALUE {(tanh(A*V(INP,INN))+1)/2}
E2 OUT 0 VALUE {V(1,0)*(VP-VN)+VN}

.PARAM A=100K ; OpAmp Gain
.PARAM VP=+5V ; Positive Limit
.PARAM VN=-5V ; Negative Limit

(Note that exact gain is an interaction between A, VP, and VN (E1
produces 0 ->1), but I'm still too sleepy this morning to make an
exact expression :)

                                        ...Jim Thompson

-- 
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.