This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OPA1644 SPICE model problem

Other Parts Discussed in Thread: OPA1644

Hello,

 

I’ve tried to download the PSpice model of OPA1644, and run a simple simulation in Altium. But it always stops, and gives an error message:

XSpice  Error: Syntax error in expression on line: 182    

 

Line 182 contains the following:

E1 VOUT+ VOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),VPOS,VNEG)}  

 

I realise, that Altium uses XSPice and not PSPice. Is it possible, that this causes the problem? If yes, how can I fix this?

 

Please help!

 

Gábor

 

 

  • Gabor,

    I am not sure what causes the error in Altium but some simulators do not recognize the initial state condition (IC=).  

    I removed all such statements from the netlist - please try to re-run your simulation using the attached netlist.

    OPA1644 PSpice macro-model.txt
    * OPA1644
    *$
    *****************************************************************************
    * (C) Copyright 2011 Texas Instruments Incorporated. All rights reserved.                                           
     
    *****************************************************************************
    ** This model is designed as an aid for customers of Texas Instruments.
    ** TI and its licensors and suppliers make no warranties, either expressed
    ** or implied, with respect to this model, including the warranties of 
    ** merchantability or fitness for a particular purpose.  The model is
    ** provided solely on an "as is" basis.  The entire risk as to its quality
    ** and performance is with the customer.
    *****************************************************************************
    *
    * This model is subject to change without notice. Texas Instruments
    * Incorporated is not responsible for updating this model.
    *
    *****************************************************************************
    *
    ** Released by: Analog eLab Design Center, Texas Instruments Inc.
    * Part: OPA1644
    * Date: 13JUN2011
    * Model Type: ALL IN ONE
    * Simulator: TINA
    * Simulator Version: 9.1.30.94 SF-TI
    * EVM Order Number: N/A
    * EVM Users Guide: N/A
    * Datasheet: SBOS484B�DECEMBER 2009�REVISED AUGUST 2010
    *
    * Model Version: 1.0
    *
    *****************************************************************************
    * 
    * Updates:
    *
    * Version 1.0 : 
    * Release to Web
    *
    *****************************************************************************
    * COMMENTS:
    *
    * MODEL FEATURES INCLUDE OUTPUT SWING, OUTPUT CURRENT
    * THROUGH THE SUPPLY RAILS, RAIL-TO-RAIL OUTPUT STAGE,
    * OUTPUT CURRENT LIMIT, OPEN LOOP GAIN AND PHASE WITH
    * RL AND CL EFFECTS, SETTLING TIME, OVERLOAD RECOVERY
    * TIME, COMMON MODE REJECTION WITH FREQUENCY, OUTPUT 
    * IMPEDANCE VS FREQUENCY, POWER SUPPLY REJECTION WITH 
    * FREQUENCY,INPUT VOLTAGE NOISE WITH 1/F, INPUT CURRENT
    * NOISE, INPUT BIAS CURRENT, INPUT IMPEDANCE, 
    * INPUT COMMON MODE RANGE, INPUT VOLTAGE OFFSET,AND 
    * QUIESCENT CURRENT VS VOLTAGE
    *
    * THIS MODEL IS ALSO APPLICABLE TO OPA1641 AND OPA1642
    *****************************************************************************
    .SUBCKT OPA1644 +IN -IN V+ V- Vout
    V4          47 18 1
    V1          18 48 1
    V9          51 21 3.5
    V8          67 V- 162.5M
    V7          V+ 68 162.5M
    IS2         V+ 24 4P
    IS1         V+ V- 1.621657M
    IS3         57 V- -2P
    Vos         54 74 1.006M
    V3          69 15 36
    V2          15 70 30
    R19         25 13 1 
    R5          26 14 1 
    R3          27 28 5K 
    C18         13 15 10P 
    C4          14 15 10P  
    EVCVS2      27 15 15 29  2MEG
    EVCVS1      32 15 30 31  2MEG
    R35         30 15 100K 
    R34         33 15 100K 
    R33         15 34 100K 
    R32         35 15 100K 
    R31         15 36 100K 
    R30         37 15 100K 
    R29         15 38 100K 
    R25         17 15 100K 
    R15         0 15 100MEG 
    XR109       39 15 RNOISE_FREE_0
    GVCCS3      15 39 16 15  1U
    XR109_2     40 15 RNOISE_FREE_0
    GVCCS2      15 40 39 15  1U
    C13         41 15 1F 
    XR109_3     41 15 RNOISE_FREE_0
    GVCCS1      15 41 40 15  1U
    R28         13 15 100 
    R27         14 15 100 
    R16         30 18 10K 
    C9          15 42 300P 
    R26         42 17 1 
    GIsinking   V- 15 43 15  1M
    GIsourcing  V+ 15 44 15  1M
    R23         43 15 1K 
    SW7         42 43 42 15  S_VSWITCH_1
    R21         15 44 1K 
    SW8         42 44 42 15  S_VSWITCH_2
    R6          37 45 1U 
    R4          38 46 1U 
    SW4         20 45 37 15  S_VSWITCH_3
    SW3         46 20 15 38  S_VSWITCH_4
    XU3         47 19 38 15 VCVS_LIMIT_0
    XU1         48 19 37 15 VCVS_LIMIT_0
    SW2         26 49 33 15  S_VSWITCH_5
    SW1         50 26 15 34  S_VSWITCH_6
    XU8         24 V+ IDEAL_D_0
    XU12        V- 24 IDEAL_D_0
    EVCVS6      51 15 V+ 15  1
    R22         52 53 100 
    EVCVS4      52 15 24 15  1
    XU2         53 21 IDEAL_D_1
    XIn11       54 -IN FEMT_0
    XVn11       +IN 54 VNSE_0
    R14         33 49 1U 
    R13         34 50 1U 
    SW6         25 55 35 15  S_VSWITCH_7
    R12         35 55 1U 
    SW5         56 25 15 36  S_VSWITCH_8
    R7          36 56 1U 
    R2          22 15 100K 
    R1          23 15 100K 
    XU26        53 57 15 58 VCCS_LIMIT_0
    XU4         58 15 15 20 VCCS_LIMIT_1
    L1          59 15 70M 
    EVCVS10     60 15 32 28  -1
    R8          60 29 1MEG 
    R9          29 27 1MEG 
    R10         61 29 370.37 
    C1          60 61 114.3N 
    R11         62 27 45.15K 
    C3          29 62 745.29F 
    C2          60 29 4.7P 
    R17         15 31 10MEG 
    R24         31 32 10MEG 
    C14         31 32 11.5N 
    C15         V+ V- 10P 
    LPSR        63 15 100M 
    XU25        64 15 65 66 VCVS_LIMIT_1
    XU24        15 17 22 67 VCVS_LIMIT_2
    XU23        17 15 68 23 VCVS_LIMIT_2
    XU22        69 17 34 15 VCVS_LIMIT_3
    XU21        70 17 33 15 VCVS_LIMIT_3
    XU20        22 Vout 35 15 VCVS_LIMIT_4
    XU19        23 Vout 36 15 VCVS_LIMIT_5
    XU11        V- 57 IDEAL_D_0
    XU10        57 V+ IDEAL_D_0
    C10         71 15 1F 
    C5          16 15 1F  
    XR109_4     71 15 RNOISE_FREE_0
    GVCCS15     15 71 41 15  1U
    GVCCS14     15 14 13 15  10M
    GVCCS13     15 13 71 15  10M
    XR108       16 15 RNOISE_FREE_0
    GVCCS12     15 16 72 15  1U
    XR107       72 15 RNOISE_FREE_0
    C11         72 15 100F 
    GVCCS10     15 72 73 15  1U
    R20         -IN 66 100 
    R18         74 24 100 
    XR106       73 59 RNOISE_FREE_0
    GVCCS6      15 73 19 15  1U
    XR102       75 76 RNOISE_FREE_0
    XR101       77 75 RNOISE_FREE_0
    C6          75 0 1  
    XR105       19 15 RNOISE_FREE_0
    XR104       20 15 RNOISE_FREE_1
    XR103       15 58 RNOISE_FREE_0
    EVCVS34     15 0 75 0  1
    C8          24 15 6P 
    RPSR        63 64 1 
    GVCCS11     15 64 V+ V-  140N
    RCM         78 79 1 
    EVCVS29     77 0 V+ 0  1
    EVCVS28     76 0 V- 0  1
    CinnCM      15 57 6P 
    LCM         78 15 100U 
    EVCVSCM     65 57 79 15  1
    GVCCS7      15 79 24 15  -800N
    C7          57 24 8P 
    VCCVS1_in   28 Vout
    HCCVS1      17 15 VCCVS1_in   1K
    GVCCS5      15 19 20 15  1U
    Ccc         20 15 7U  
    EVCVS3      30 15 14 15  1
    .MODEL S_VSWITCH_1 VSWITCH (RON=1 ROFF=100MEG VON=-10M VOFF=-10U)
    .MODEL S_VSWITCH_2 VSWITCH (RON=1 ROFF=100MEG VON=10M VOFF=10U)
    .MODEL S_VSWITCH_3 VSWITCH (RON=1 ROFF=100MEG VON=10 VOFF=-10)
    .MODEL S_VSWITCH_4 VSWITCH (RON=1 ROFF=100MEG VON=10 VOFF=-10)
    .MODEL S_VSWITCH_5 VSWITCH (RON=1 ROFF=100MEG VON=100 VOFF=-100)
    .MODEL S_VSWITCH_6 VSWITCH (RON=1 ROFF=100MEG VON=100 VOFF=-100)
    .MODEL S_VSWITCH_7 VSWITCH (RON=1 ROFF=100MEG VON=100 VOFF=-100)
    .MODEL S_VSWITCH_8 VSWITCH (RON=1 ROFF=100MEG VON=100 VOFF=-100)
    .ENDS OPA1644
    
    
    * NOISELESS RESISTOR
    .SUBCKT RNOISE_FREE_0  1 2
    *ROHMS = VALUE IN OHMS OF NOISELESS RESISTOR
    .PARAM ROHMS=1E6
    ERES 1 3 VALUE = { I(VSENSE) * ROHMS }
    RDUMMY 30 3 1
    VSENSE 30 2 DC 0V
    .ENDS RNOISE_FREE_0 
    
    
    *VOLTAGE CONTROLLED SOURCE WITH LIMITS
    .SUBCKT VCVS_LIMIT_0  VC+ VC- VOUT+ VOUT-
    *              
    .PARAM GAIN = 100
    .PARAM VPOS = 100E3
    .PARAM VNEG = -100E3
    E1 VOUT+ VOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),VPOS,VNEG)}
    .ENDS VCVS_LIMIT_0 
    
    
    *TG IDEAL DIODE
    .SUBCKT IDEAL_D_0  A C
    D1 A C DNOM
    .MODEL DNOM D (TT=10P CJO=1E-18 IS=1E-15 RS=1E-3)
    .ENDS IDEAL_D_0 
    
    
    *TG IDEAL DIODE
    .SUBCKT IDEAL_D_1  A C
    D1 A C DNOM
    .MODEL DNOM D (TT=10P CJO=1E-18 IS=1E-15 RS=1E-3)
    .ENDS IDEAL_D_1 
    
    
    * BEGIN PROG NSE FEMTO AMP/RT-HZ 
    .SUBCKT FEMT_0  1 2
    * BEGIN SETUP OF NOISE GEN - FEMPTOAMPS/RT-HZ
    * INPUT THREE VARIABLES
    * SET UP INSE 1/F
    * FA/RHZ AT 1/F FREQ
    .PARAM NLFF=.1
    * FREQ FOR 1/F VAL
    .PARAM FLWF=0.001
    * SET UP INSE FB
    * FA/RHZ FLATBAND
    .PARAM NVRF=.1
    * END USER INPUT
    * START CALC VALS
    .PARAM GLFF={PWR(FLWF,0.25)*NLFF/1164}
    .PARAM RNVF={1.184*PWR(NVRF,2)}
    .MODEL DVNF D KF={PWR(FLWF,0.5)/1E11} IS=1.0E-16
    * END CALC VALS
    I1 0 7 10E-3
    I2 0 8 10E-3
    D1 7 0 DVNF
    D2 8 0 DVNF
    E1 3 6 7 8 {GLFF}
    R1 3 0 1E9
    R2 3 0 1E9
    R3 3 6 1E9
    E2 6 4 5 0 10
    R4 5 0 {RNVF}
    R5 5 0 {RNVF}
    R6 3 4 1E9
    R7 4 0 1E9
    G1 1 2 3 4 1E-6
    C1 1 0 1E-15
    C2 2 0 1E-15
    C3 1 2 1E-15
    .ENDS
    * END PROG NSE FEMTO AMP/RT-HZ
    
    
    * BEGIN PROG NSE NANO VOLT/RT-HZ
    .SUBCKT VNSE_0  1 2
    * BEGIN SETUP OF NOISE GEN - NANOVOLT/RT-HZ
    * INPUT THREE VARIABLES
    * SET UP VNSE 1/F
    * NV/RHZ AT 1/F FREQ
    .PARAM NLF=10
    * FREQ FOR 1/F VAL
    .PARAM FLW=4
    * SET UP VNSE FB
    * NV/RHZ FLATBAND
    .PARAM NVR=4.6
    * END USER INPUT
    * START CALC VALS
    .PARAM GLF={PWR(FLW,0.25)*NLF/1164}
    .PARAM RNV={1.184*PWR(NVR,2)}
    .MODEL DVN D KF={PWR(FLW,0.5)/1E11} IS=1.0E-16
    * END CALC VALS
    I1 0 7 10E-3
    I2 0 8 10E-3
    D1 7 0 DVN
    D2 8 0 DVN
    E1 3 6 7 8 {GLF}
    R1 3 0 1E9
    R2 3 0 1E9
    R3 3 6 1E9
    E2 6 4 5 0 10
    R4 5 0 {RNV}
    R5 5 0 {RNV}
    R6 3 4 1E9
    R7 4 0 1E9
    E3 1 2 3 4 1
    C1 1 0 1E-15
    C2 2 0 1E-15
    C3 1 2 1E-15
    .ENDS
    * END PROG NSE NANOV/RT-HZ
    
    
    *VOLTAGE CONTROLLED SOURCE WITH LIMITS
    .SUBCKT VCCS_LIMIT_0  VC+ VC- IOUT+ IOUT-
    *              
    .PARAM GAIN = 100U
    .PARAM IPOS = .5
    .PARAM INEG = -.5
    G1 IOUT+ IOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),IPOS,INEG)}
    .ENDS VCCS_LIMIT_0 
    
    
    *VOLTAGE CONTROLLED SOURCE WITH LIMITS
    .SUBCKT VCCS_LIMIT_1  VC+ VC- IOUT+ IOUT-
    *              
    .PARAM GAIN = 5
    .PARAM IPOS = 140
    .PARAM INEG = -140
    G1 IOUT+ IOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),IPOS,INEG)}
    .ENDS VCCS_LIMIT_1 
    
    
    *VOLTAGE CONTROLLED SOURCE WITH LIMITS
    .SUBCKT VCVS_LIMIT_1  VC+ VC- VOUT+ VOUT-
    *              
    .PARAM GAIN = -1
    .PARAM VPOS = 20M
    .PARAM VNEG = -20M
    E1 VOUT+ VOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),VPOS,VNEG)}
    .ENDS VCVS_LIMIT_1 
    
    
    *VOLTAGE CONTROLLED SOURCE WITH LIMITS
    .SUBCKT VCVS_LIMIT_2  VC+ VC- VOUT+ VOUT-
    *              
    .PARAM GAIN = 20.833M
    .PARAM VPOS = 1
    .PARAM VNEG = 0
    E1 VOUT+ VOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),VPOS,VNEG)}
    .ENDS VCVS_LIMIT_2 
    
    
    *VOLTAGE CONTROLLED SOURCE WITH LIMITS
    .SUBCKT VCVS_LIMIT_3  VC+ VC- VOUT+ VOUT-
    *              
    .PARAM GAIN = 1E2
    .PARAM VPOS = 100E3
    .PARAM VNEG = -100E3
    E1 VOUT+ VOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),VPOS,VNEG)}
    .ENDS VCVS_LIMIT_3 
    
    
    *VOLTAGE CONTROLLED SOURCE WITH LIMITS
    .SUBCKT VCVS_LIMIT_4  VC+ VC- VOUT+ VOUT-
    *              
    .PARAM GAIN = 1E3
    .PARAM VPOS = 100E3
    .PARAM VNEG = -100E3
    E1 VOUT+ VOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),VPOS,VNEG)}
    .ENDS VCVS_LIMIT_4 
    
    
    *VOLTAGE CONTROLLED SOURCE WITH LIMITS
    .SUBCKT VCVS_LIMIT_5  VC+ VC- VOUT+ VOUT-
    *             
    .PARAM GAIN = 1E3
    .PARAM VPOS = 100E3
    .PARAM VNEG = -100E3
    E1 VOUT+ VOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),VPOS,VNEG)}
    .ENDS VCVS_LIMIT_5 
    
    
    * NOISELESS RESISTOR
    .SUBCKT RNOISE_FREE_1  1 2
    *ROHMS = VALUE IN OHMS OF NOISELESS RESISTOR
    .PARAM ROHMS=1E4
    ERES 1 3 VALUE = { I(VSENSE) * ROHMS }
    RDUMMY 30 3 1
    VSENSE 30 2 DC 0V
    .ENDS RNOISE_FREE_1 
    
    .END
    
    *$
    

  • Nope. Didn’t work…

    But in the meantime, I think I have found the solution. I’ve checked some SPICE reference manual, to understand the meaning of that line. It turns out, that an E element is a voltage or current controlled voltage source. It has the following syntax:
    Exxx n+ n- <VCVS> in+ in- gain <MAX=val> <MIN=val> <SCALE=val> <TC1=val> <TC2=val><ABS=1> <IC=val>

    It has to have at least five parameters! So I replaced the original statement with this:
    E1 VOUT+ VOUT- VC+ VC- GAIN MAX = VPOS MIN = VNEG

    It should produce GAIN times the difference of VC+ and VC- between VOUT+ and VOUT-, but is should stay between VPOS and VNEG. I think this is the same as the intention behind the original line…

    And it works!
    Well… kind of…
    The simulation still stops with a syntax error, but at least at another line:
    G1 IOUT+ IOUT- VALUE={LIMIT(GAIN*V(VC+,VC-),IPOS,INEG)}

    Since this is similar to the first one, I think the solution might also be the same… I’ll try it tomorrow… But now I’m off to sleep. It’s getting late. Good night everyone. And sorry for bothering you with my problems.

    Best regards
    Gábor