MIF-ERROR - unable to find definition of model xu1.x_s1:a_s1

Hello,

I am new to KiCad and have been following the tutorial for KiCad Schematic and the ngspice simulation for the OPA1641 op amp.

I found the model library as suggested on TI’s website. The current version is in “sbom627d.zip”

When I run the simulation I keep getting the following error -

Error on line:
a.xu1.x_s1.as_s1 %gd xu1.n2992267 xu1.clamp %gd xu1.n2992267 xu1.clamp xu1.x_s1:a_s1
MIF-ERROR - unable to find definition of model xu1.x_s1:a_s1

After searching the web I found that others had the same problem with KiCad 7 as described below (between the lines of asterisks) -


@DonHaig-k9b

1 year ago

I have been following your tutorials. Thank you for posting them! When I get to the transient simulation in this tutorial it throws the following error: Error on line 0 : a.xu1.x_s1.as_s1 %gd xu1.n2992267 xu1.clamp %gd xu1.n2992267 xu1.clamp xu1.x_s1:a_s1 MIF-ERROR - unable to find definition of model xu1.x_s1:a_s1 Error: circuit not parsed. Error: vector time not found! Error: vector time not found! As I am new to using this tool, I am at a loss. What am I missing? (KiCad 8 on Ubuntu 22.04) Thanks again.

@DonHaig-k9b

1 year ago

For others who may run into this issue. I upgraded from KiCad 7 to Kicad 8 using: sudo add-apt-repository ppa:kicad/kicad-8.0-releases sudo apt update sudo apt install kicad The following commands resolved the issue: sudo apt remove “ngspice” sudo apt install kicad Thank you to dsa-t on the KiCad Info Forum for the answer

@yusufferhatyilman6962

9 months ago

@DonHaig-k9b ran into the same issue, this fixed the problem. thx


Seems the problem was fixed in KiCad 8. The version I am using is the latest -

Version: 9.0.4-9.0.4-0~ubuntu24.04.1, release build

Has the fix in V8 not been applied to V9?

Any help will be appreciated to get past this stumbling block and build confidence in the use of KiCad.

Thanks.

The fix in the quoted section looks like changing the ngspice version to me. Since 9.0.4, KiCad has gone up another ngspice version, which may affect this issue.

Set the compatibility mode to PSPICE and LTSPICE at
Eeschema–>Inspect–>Simulator–>Edit Analysis Tab

If this does not help, it may be the installation problem, as mentioned above. This is neither a KiCad nor a ngspice issue, but a problem with packaging both on Ubuntu.

As you probably have seen, the fix has been to uninstall plain ngspice before installing KiCad. Did you do that with
sudo apt remove ngspice
?

On Ubuntu 24.04 the ngspice location after installing KiCad is:

/usr/lib/libngspice.so.0.0.12
/usr/lib/ngspice/analog.cm
/usr/lib/ngspice/digital.cm
etc.

libngspice.so is ngspice compiled as a shared library, loaded by KiCad/Eeschema. The code model library analog.cm contains the missing model.

I compile standard ngspice myself and install it as

usr/local/bin/ngspice
usr/local/lib/ngspice/analog.cm
...

so the analog.cm etc. from ngspice do not interfere with analog.cm etc. from libngspice in KiCad.

@davidsrsb, @holger,

Thanks for taking the time to help.

I had ngspice-44 installed from the tarball so I did a “make uninstall” which seemed to have removed it. I then installed kicad-9 using apt.

Unfortunately, I am still getting the MIF-ERROR.

I think there’s a problem with the OPA164x model which I downloaded from TI. I tried using the model in QUCS-S and found errors as well.

warning, model type mismatch in line

s1 cap_l cap_r sw_ol_opa164x mid ol_sw

Error: unknown subckt: xx1.x_u1 xx1.esdp xx1.n2991573 xx1.vnse_opa164x xx1.params: xx1.flw=0.1 xx1.glf=0.02246 rnv=30.241

Simulation interrupted due to error!

I am surprised by the poor quality of TI’s resources. I am not going to waste much more time on this problem as I am in the early stages of learning Kicad and ngspice.

Thanks for all your help and recommendations.

*****************************

The model file is as follows for anyone who has the time to follow the logic !! :slight_smile: (Ever line up to the first .SUBCKT line should be commented out.)

*$

  • OPA164x

  • (C) Copyright 2022 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: Online Design Tools, Texas Instruments Inc.

  • Part: OPA164x
  • Date: 09JUN2022
  • Model Type: Generic (suitable for all analysis types)
  • EVM Order Number: N/A
  • EVM Users Guide: N/A
  • Datasheet: SBOS484D -DECEMBER 2009-REVISED APRIL 2016
  • Created with Green-Williams-Lis Op Amp Macro-model Architecture
  • Model Version: Final 1.3

  • Updates:

  • Final 1.3

    1. Moved R_NOISELESS .model inside OPA164x subckt.
    1. Updated PSpice Symbol.
  • Final 1.2

    1. Modified the capacitor(C14) value from 1F to 5uF in GND Float-IQ block
  • to resolve the convergence issue in single and asymmetric supply test.

    1. Updated Aol to match the GBW as per the datasheet.
    1. Updated IOS current as per the datasheet.
    1. Updated the model name from OPA1641 to OPA164x.
  • Final 1.1

  • Added Unique subckt name, removed Claw ABS.

  • Simplified subckt for current noise.

  • Final 1.0

  • Release to Web.


  • Model Usage Notes:
    1. The following parameters are modeled:
  • a. OPEN-LOOP GAIN AND PHASE VS. FREQUENCY WITH RL, CL EFFECTS (Aol)
  • b. UNITY GAIN BANDWIDTH (GBW)
  • c. INPUT COMMON-MODE REJECTION RATIO VS. FREQUENCY (CMRR)
  • d. POWER SUPPLY REJECTION RATIO VS. FREQUENCY (PSRR)
  • e. DIFFERENTIAL INPUT IMPEDANCE (Zid)
  • f. COMMON-MODE INPUT IMPEDANCE (Zic)
  • g. OPEN-LOOP OUTPUT IMPEDANCE VS. FREQUENCY (Zo)
  • h. OUTPUT CURRENT THROUGH THE SUPPLY (Iout)
  • i. INPUT VOLTAGE NOISE DENSITY VS. FREQUENCY (en)
  • j. INPUT CURRENT NOISE DENSITY VS. FREQUENCY (in)
  • k. OUTPUT VOLTAGE SWING vs. OUTPUT CURRENT (Vo)
  • l. SHORT-CIRCUIT OUTPUT CURRENT (Isc)
  • m. QUIESCENT CURRENT (Iq)
  • n. SETTLING TIME VS. CAPACITIVE LOAD (ts)
  • o. SLEW RATE (SR)
  • p. SMALL SIGNAL OVERSHOOT VS. CAPACITIVE LOAD
  • q. LARGE SIGNAL RESPONSE
  • r. OVERLOAD RECOVERY TIME (tor)
  • s. INPUT BIAS CURRENT (Ib)
  • t. INPUT OFFSET CURRENT (Ios)
  • u. INPUT OFFSET VOLTAGE (Vos)
  • v. INPUT COMMON-MODE VOLTAGE RANGE (Vcm)
  • w. INPUT OFFSET VOLTAGE VS. INPUT COMMON-MODE VOLTAGE (Vos vs. Vcm)
  • x. INPUT/OUTPUT ESD CELLS (ESDin, ESDout)
    1. OPA164x model is available in single core(OPA1641), dual core(OPA1642)
  • and quad core(OPA1644).
    1. Model represent the device operating at room temperature only. No
  • temperature dependency is modeled.

.SUBCKT OPA164x IN+ IN- VCC VEE OUT


C_C1 N3294772 N3294776 2.2769P
C_C10 N3294626 N3294630 4.12U
C_C100 N43397161 MID 3.9653P
C_C101 N4572874 N2991553 10.178F
C_C104 N4620279 MID 1.2F
C_C105 N4620995 MID 8.1759E-16
C_C106 N4621736 MID 8.1759E-16
C_C107 N4282910 MID 8.1759E-16
C_C13 N2992397 0 1F
C_C14 0 N2992375 5U
C_C15 N2992413 0 1F
C_C16 N2991741 MID 1F
C_C17 N2991765 MID 1F
C_C18 N2991811 MID 1F
C_C19 N2991831 MID 1F
C_C20 N2991907 MID 1F
C_C21 N2991925 MID 1F
C_C22 MID N2991969 1F
C_C23 N2992033 MID 1F
C_C24 N2992029 MID 1F
C_C25 N2992093 MID 1P
C_C26 N2992099 MID 1P
C_C27 SW_OL_OPA164x MID 100P
C_C29 VIMON MID 1N
C_C30 VOUT_S MID 1N
C_C4 N2991657 MID 1F
C_C5 CLAMP MID 31N
C_C70 VCLP MID 100P
C_C72 N4031911 MID 66.315F
C_C74 N3827259 N3828449 164.22F
C_C77 N3850714 N2991581 1.5877N
C_C89 N4619507 N4619517 5.053P
C_C93 N4243633 N2991579 1.5915N
C_C94 N3294524 MID 2.8937E-16
C_C_COM0 ESDP MID 6P
C_C_COM1 MID ESDN 6P
C_C_DIFF ESDN ESDP 8P
E_E1 MID 0 N2992375 0 1
E_E3 N2992163 MID OUT MID 1
E_E4 N3294618 MID CL_CLAMP MID 1
G_G1 N3294772 MID ESDP MID -2.1692M
G_G12 CLAW_CLAMP MID N3294524 MID -1M
G_G13 CL_CLAMP MID CLAW_CLAMP MID -1M
G_G16 N3201092 MID N3294630 MID -83.6706
G_G18 VCC_B 0 VCC 0 -1
G_G19 VEE_B 0 VEE 0 -1
G_G2 N2991563 N2991555 N2991553 MID -1M
G_G20 VCC_CLP MID N2992033 MID -1M
G_G21 VEE_CLP MID N2992029 MID -1M
G_G22 N2992299 MID N2992295 MID -1
G_G23 N2992323 MID N2992331 MID -1
G_G39 N3294626 MID CL_CLAMP N2992235 -89.0517
G_G4 N3850714 MID VCC_B MID -304.95M
G_G41 N4031911 MID VSENSE MID -1U
G_G5 N2991587 N2991583 N2991581 N2991579 -1M
G_G59 N4619507 MID N4031911 MID -654
G_G6 VSENSE MID CLAMP MID -1M
G_G63 N4243633 MID VEE_B MID -133.45M
G_G64 N3294524 MID N4282910 MID -1U
G_G71 N3827259 MID N4339672 MID -1
G_G72 N4572874 MID N3294776 MID -36.1316
G_G75 N4620279 MID N4619517 MID -1U
G_G76 N4620995 MID N4620279 MID -1U
G_G77 N4621736 MID N4620995 MID -1U
G_G78 N4282910 MID N4621736 MID -1U
I_I_B N2991573 MID DC 2P
I_I_OS ESDN MID DC -1.5F
I_I_Q VCC VEE DC 1.8M
R_R15 N2991583 N2991563 R_NOISELESS 1M
R_R16 N2991587 N2991583 R_NOISELESS 1K
R_R167 N3294618 VCLP R_NOISELESS 100
R_R17 N2991619 ESDN R_NOISELESS 1M
R_R171 MID N4031911 R_NOISELESS 1MEG
R_R176 MID N3827259 R_NOISELESS 1
R_R178 N3828449 N3827259 R_NOISELESS 10K
R_R179 MID N3828449 R_NOISELESS 6.7534
R_R18 MID N2991623 R_NOISELESS 1T
R_R187 N2991581 N3850714 R_NOISELESS 100MEG
R_R189 MID N3850714 R_NOISELESS 1
R_R19 MID N2991635 R_NOISELESS 1T
R_R190 MID N2991581 R_NOISELESS 45.5638
R_R20 N2991643 MID R_NOISELESS 1
R_R21 N2991657 N2991643 R_NOISELESS 1M
R_R22 MID N2991667 R_NOISELESS 1MEG
R_R223 N4619517 N4619507 R_NOISELESS 10K
R_R224 MID N4619507 R_NOISELESS 1
R_R225 MID N4619517 R_NOISELESS 15.31
R_R23 MID CLAMP R_NOISELESS 1MEG
R_R230 N2991579 N4243633 R_NOISELESS 100MEG
R_R233 MID N2991579 R_NOISELESS 33.3333
R_R234 MID N4243633 R_NOISELESS 1
R_R235 MID N3294524 R_NOISELESS 1MEG
R_R24 MID VSENSE R_NOISELESS 1K
R_R250 N4339672 N3201092 R_NOISELESS 165.044552K
R_R251 N43397161 N4339672 R_NOISELESS 10K
R_R252 MID N3201092 R_NOISELESS 1
R_R253 N2991553 N4572874 R_NOISELESS 100MEG
R_R254 MID N4572874 R_NOISELESS 1
R_R255 MID N2991553 R_NOISELESS 2.846444MEG
R_R262 MID N4620279 R_NOISELESS 1MEG
R_R263 MID N4620995 R_NOISELESS 1MEG
R_R264 MID N4621736 R_NOISELESS 1MEG
R_R265 MID N4282910 R_NOISELESS 1MEG
R_R32 MID CLAW_CLAMP R_NOISELESS 1K
R_R33 MID CL_CLAMP R_NOISELESS 1K
R_R34 N3294630 N3294626 R_NOISELESS 10K
R_R35 MID N3294626 R_NOISELESS 1
R_R36 MID N3294630 R_NOISELESS 120.9619
R_R43 MID N3294682 R_NOISELESS 1
R_R46 VCC_B 0 R_NOISELESS 1
R_R47 VCC_B N2992397 R_NOISELESS 1M
R_R48 N2992397 N2992375 R_NOISELESS 1MEG
R_R49 N2992375 0 R_NOISELESS 1T
R_R5 MID N3294772 R_NOISELESS 1
R_R50 N2992375 N2992413 R_NOISELESS 1MEG
R_R51 N2992413 VEE_B R_NOISELESS 1M
R_R52 VEE_B 0 R_NOISELESS 1
R_R53 VCC_CLP MID R_NOISELESS 1T
R_R54 N2991729 MID R_NOISELESS 1
R_R55 N2991741 N2991729 R_NOISELESS 1M
R_R56 VEE_CLP MID R_NOISELESS 1T
R_R57 N2991763 MID R_NOISELESS 1
R_R58 N2991765 N2991763 R_NOISELESS 1M
R_R59 N2991807 MID R_NOISELESS 1T
R_R6 N3294776 N3294772 R_NOISELESS 100MEG
R_R60 N2991809 MID R_NOISELESS 1
R_R61 N2991811 N2991809 R_NOISELESS 1M
R_R62 N2991831 N2991837 R_NOISELESS 1M
R_R63 N2991849 MID R_NOISELESS 1T
R_R64 N2991837 MID R_NOISELESS 1
R_R65 N2991901 MID R_NOISELESS 1T
R_R66 N2991905 MID R_NOISELESS 1
R_R67 N2991907 N2991905 R_NOISELESS 1M
R_R68 N2991925 N2991931 R_NOISELESS 1M
R_R69 N2991943 MID R_NOISELESS 1T
R_R7 MID N3294776 R_NOISELESS 11.367146K
R_R70 N2991931 MID R_NOISELESS 1
R_R71 N2991969 VSENSE R_NOISELESS 1M
R_R72 VCC_B N2991997 R_NOISELESS 1K
R_R73 N2991997 N2992033 R_NOISELESS 1M
R_R74 N2992001 VEE_B R_NOISELESS 1K
R_R75 N2992001 N2992029 R_NOISELESS 1M
R_R76 MID VCC_CLP R_NOISELESS 1K
R_R77 VEE_CLP MID R_NOISELESS 1K
R_R78 N2992323 MID R_NOISELESS 1
R_R79 N2992299 MID R_NOISELESS 1
R_R8 N2991563 N2991555 R_NOISELESS 1K
R_R80 V11 N2992093 R_NOISELESS 100
R_R81 V12 N2992099 R_NOISELESS 100
R_R82 N2992105 MID R_NOISELESS 1
R_R83 N2992105 SW_OL_OPA164x R_NOISELESS 100
R_RDUMMY MID N2992235 R_NOISELESS 1.584893K
R_RS_INN IN- ESDN R_NOISELESS 10M
R_RS_INP IN+ ESDP R_NOISELESS 10M
R_RX N2992235 N3294682 R_NOISELESS 15.84893K
R_RX1 MID N2992151 R_NOISELESS 1T
R_RX2 VIMON N2992151 R_NOISELESS 100
R_RX3 MID N2992163 R_NOISELESS 1T
R_RX4 VOUT_S N2992163 R_NOISELESS 100
R_R_CM1 ESDP MID R_NOISELESS 1T
R_R_CM2 MID ESDN R_NOISELESS 1T
V_VCM_MAX N2991623 VCC_B -3.5
V_VCM_MIN N2991635 VEE_B -100M
V_VOS N2991555 N2991573 997U
V_V_GRN N2991943 MID -60
V_V_GRP N2991901 MID 60
V_V_ISCN N2991849 MID -29
V_V_ISCP N2991807 MID 36.6
V_V_ORN N2992295 VCLP -11.9378
V_V_ORP N2992331 VCLP 11.855
X_H1 N2992235 OUT N2992151 MID BLOCK_DC_H1_OPA164x
X_H2 N2992287 N2992323 V12 MID BLOCK_DC_H2_OPA164x
X_H3 N2992267 N2992299 V11 MID BLOCK_DC_H3_OPA164x
X_S1 N2992267 CLAMP N2992267 CLAMP BLOCK_DC_S1_OPA164x
X_S2 CLAMP N2992287 CLAMP N2992287 BLOCK_DC_S2_OPA164x
X_U1 ESDP N2991573 VNSE_OPA164x PARAMS: FLW=0.1 GLF=0.02246 RNV=30.241
X_U10 VCC_CLP VEE_CLP VOUT_S MID N2991729 N2991763 CLAMP_AMP_LO_OPA164x PARAMS:

  • G=1
    X_U11 N2991807 N2991849 VIMON MID N2991809 N2991837 CLAMP_AMP_LO_OPA164x

  • PARAMS: G=1
    X_U12 N2991901 N2991943 N2991969 MID N2991905 N2991931 CLAMP_AMP_HI_OPA164x

  • PARAMS: G=10
    X_U16 MID N2992105 N2992093 N2992099 OL_SENSE_OPA164x
    X_U18 VIMON MID N2991997 VCC_B CLAWP_OPA164x
    X_U19 MID VIMON VEE_B N2992001 CLAWN_OPA164x
    X_U21 OUT VCC VEE ESD_OUT_OPA164x
    X_U22 N2991811 N2991831 CL_CLAMP MID CL_SRC_OPA164x PARAMS: GAIN=1 IPOS=0.24E1

  • INEG=-0.24E1
    X_U23 N2991907 N2991925 CLAMP MID GR_SRC_OPA164x PARAMS: GAIN=1 IPOS=1.3E1

  • INEG=-1.3E1
    X_U25 SW_OL_OPA164x MID N3294626 N3294630 SW_OL_OPA164x
    X_U26 VIMON MID VCC MID IQ_SRC_OPA164x PARAMS: GAIN=1E-3
    X_U27 MID VIMON MID VEE IQ_SRC_OPA164x PARAMS: GAIN=1E-3
    X_U30 N2991657 N2991619 MID N2991667 AOL_1_OPA164x PARAMS: GAIN=1E-4 IPOS=.5

  • INEG=-.5
    X_U31 N2991667 MID MID CLAMP AOL_2_OPA164x PARAMS: GAIN=0.021535 IPOS=0.6333

  • INEG=-0.6338
    X_U32 N3828449 MID MID N3294682 ZO_SRC_OPA164x PARAMS: GAIN=1481.7407

  • IPOS=1.2E5 INEG=-1.2E5
    X_U35 N2991741 N2991765 CLAW_CLAMP MID CLAW_SRC_OPA164x PARAMS: GAIN=1

  • IPOS=0.12E1 INEG=-0.12E1
    X_U37 MID N2991573 FEMT_OPA164x PARAMS: NVRF=0.8
    X_U38 ESDN MID FEMT_OPA164x PARAMS: NVRF=0.8
    X_U5 ESDN ESDP VCC VEE ESD_IN_OPA164x
    X_U6 N2991587 MID N2991643 MID N2991623 N2991635 VCM_CLAMP_OPA164x PARAMS:

  • GAIN=1
    .MODEL R_NOISELESS RES (T_ABS=-273.15)
    .ENDS OPA164x

.SUBCKT BLOCK_DC_H1_OPA164x 1 2 3 4
H_H1 3 4 VH_H1 1K
VH_H1 1 2 0V
.ENDS BLOCK_DC_H1_OPA164x
*
.SUBCKT BLOCK_DC_H2_OPA164x 1 2 3 4
H_H2 3 4 VH_H2 1
VH_H2 1 2 0V
.ENDS BLOCK_DC_H2_OPA164x
*
.SUBCKT BLOCK_DC_H3_OPA164x 1 2 3 4
H_H3 3 4 VH_H3 -1
VH_H3 1 2 0V
.ENDS BLOCK_DC_H3_OPA164x
*
.SUBCKT BLOCK_DC_S1_OPA164x 1 2 3 4
S_S1 3 4 1 2 _S1
RS_S1 1 2 1G
.MODEL _S1 VSWITCH ROFF=1E12 RON=10M VOFF=0.0V VON=10MV
.ENDS BLOCK_DC_S1_OPA164x
*
.SUBCKT BLOCK_DC_S2_OPA164x 1 2 3 4
S_S2 3 4 1 2 _S2
RS_S2 1 2 1G
.MODEL _S2 VSWITCH ROFF=1E12 RON=10M VOFF=0.0V VON=10MV
.ENDS BLOCK_DC_S2_OPA164x
*
.SUBCKT AOL_1_OPA164x VC+ VC- IOUT+ IOUT- PARAMS: GAIN=1E-4 IPOS=.5 INEG=-.5
G1 IOUT+ IOUT- VALUE={LIMIT(GAINV(VC+,VC-),INEG,IPOS)}
.ENDS AOL_1_OPA164x
*
.SUBCKT AOL_2_OPA164x VC+ VC- IOUT+ IOUT- PARAMS: GAIN=0.021535 IPOS=0.6333 INEG=-0.6338
G1 IOUT+ IOUT- VALUE={LIMIT(GAIN
V(VC+,VC-),INEG,IPOS)}
.ENDS AOL_2_OPA164x
*
.SUBCKT CLAMP_AMP_HI_OPA164x VC+ VC- VIN COM VO+ VO- PARAMS: G=10
GVO+ COM VO+ VALUE = {IF(V(VIN,COM)>V(VC+,COM),((V(VIN,COM)-V(VC+,COM))G),0)}
GVO- COM VO- VALUE = {IF(V(VIN,COM)<V(VC-,COM),((V(VC-,COM)-V(VIN,COM))G),0)}
.ENDS CLAMP_AMP_HI_OPA164x
*
.SUBCKT CLAMP_AMP_LO_OPA164x VC+ VC- VIN COM VO+ VO- PARAMS: G=1
GVO+ COM VO+ VALUE = {IF(V(VIN,COM)>V(VC+,COM),((V(VIN,COM)-V(VC+,COM))G),0)}
GVO- COM VO- VALUE = {IF(V(VIN,COM)<V(VC-,COM),((V(VC-,COM)-V(VIN,COM))G),0)}
.ENDS CLAMP_AMP_LO_OPA164x
*
.SUBCKT CLAWN_OPA164x VC+ VC- IOUT+ IOUT-
G1 IOUT+ IOUT- TABLE {(V(VC+,VC-))} =
+(0, 2.1186E-4)
+(9.66, 0.00036002)
+(19.3199, 0.00036763)
+(25.7599, 0.00037452)
+(26.0819, 0.00037487)
+(26.7259, 0.00037556)
+(27.3699, 0.00037625)
+(28.0139, 0.00037694)
+(28.6579, 0.00072576)
+(29, 0.0018986)
.ENDS CLAWN_OPA164x
*
.SUBCKT CLAWP_OPA164x VC+ VC- IOUT+ IOUT-
G1 IOUT+ IOUT- TABLE {(V(VC+,VC-))} =
+(0, 2.1186E-4)
+(12.1998, 0.0003505)
+(24.3996, 0.00037005)
+(32.5328, 0.00049199)
+(32.9395, 0.00050932)
+(33.7528, 0.00055193)
+(34.5661, 0.0006607)
+(35.3794, 0.00086684)
+(36.1927, 0.0014151)
+(36.6, 0.0018692)
.ENDS CLAWP_OPA164x
*
.SUBCKT CLAW_SRC_OPA164x VC+ VC- IOUT+ IOUT- PARAMS: GAIN=1 IPOS=0.12E1 INEG=-0.12E1
G1 IOUT+ IOUT- VALUE={LIMIT(GAIN
V(VC+,VC-),INEG,IPOS)}
.ENDS CLAW_SRC_OPA164x
*
.SUBCKT CL_SRC_OPA164x VC+ VC- IOUT+ IOUT- PARAMS: GAIN=1 IPOS=0.24E1 INEG=-0.24E1
G1 IOUT+ IOUT- VALUE={LIMIT(GAINV(VC+,VC-),INEG,IPOS)}
.ENDS CL_SRC_OPA164x
*
.SUBCKT ESD_IN_OPA164x ESDN ESDP VCC VEE
.MODEL ESD_SW VSWITCH(RON=50 ROFF=1E12 VON=500E-3 VOFF=450E-3)
S1 ESDN VCC ESDN VCC ESD_SW
S2 ESDP VCC ESDP VCC ESD_SW
S3 VEE ESDN VEE ESDN ESD_SW
S4 VEE ESDP VEE ESDP ESD_SW
.ENDS ESD_IN_OPA164x
*
.SUBCKT ESD_OUT_OPA164x OUT VCC VEE
.MODEL ESD_SW VSWITCH(RON=50 ROFF=1E12 VON=500E-3 VOFF=450E-3)
S1 OUT VCC OUT VCC ESD_SW
S2 VEE OUT VEE OUT ESD_SW
.ENDS ESD_OUT_OPA164x
*
.SUBCKT FEMT_OPA164x 1 2 PARAMS: NVRF=0.8
E1 3 0 5 0 10
R1 5 0 {1.184PWR(NVRF,2)}
R2 5 0 {1.184PWR(NVRF,2)}
G1 1 2 3 0 1E-6
.ENDS FEMT_OPA164x
*
.SUBCKT GR_SRC_OPA164x VC+ VC- IOUT+ IOUT- PARAMS: GAIN=1 IPOS=1.3E1 INEG=-1.3E1
G1 IOUT+ IOUT- VALUE={LIMIT(GAINV(VC+,VC-),INEG,IPOS)}
.ENDS GR_SRC_OPA164x
*
.SUBCKT IQ_SRC_OPA164x VC+ VC- IOUT+ IOUT- PARAMS: GAIN=1E-3
G1 IOUT+ IOUT- VALUE={IF( (V(VC+,VC-)<=0),0,GAIN
V(VC+,VC-) )}
.ENDS IQ_SRC_OPA164x
*
.SUBCKT OL_SENSE_OPA164x COM SW+ OLN OLP
GSW+ COM SW+ VALUE = {IF((V(OLN,COM)>10E-3 | V(OLP,COM)>10E-3),1,0)}
.ENDS OL_SENSE_OPA164x
*
.SUBCKT SW_OL_OPA164x SW_OL_OPA164x MID CAP_L CAP_R
.MODEL OL_SW VSWITCH(RON=1E-3 ROFF=1E12 VON=900E-3 VOFF=800E-3)
S1 CAP_L CAP_R SW_OL_OPA164x MID OL_SW
.ENDS SW_OL_OPA164x
*
.SUBCKT VCM_CLAMP_OPA164x VIN+ VIN- IOUT- IOUT+ VP+ VP- PARAMS: GAIN=1
G1 IOUT+ IOUT- VALUE={LIMIT(GAINV(VIN+,VIN-),V(VP-,VIN-), V(VP+,VIN-))}
.ENDS VCM_CLAMP_OPA164x
*
.SUBCKT VNSE_OPA164x 1 2 PARAMS: FLW=0.1 GLF=0.02246 RNV=30.241
.MODEL DVN D KF={PWR(FLW,0.5)/1E11} IS=1.0E-16
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
.ENDS VNSE_OPA164x
*
.SUBCKT ZO_SRC_OPA164x VC+ VC- IOUT+ IOUT- PARAMS: GAIN=1481.7407 IPOS=1.2E5 INEG=-1.2E5
G1 IOUT+ IOUT- VALUE={LIMIT(GAIN
V(VC+,VC-),INEG,IPOS)}
.ENDS ZO_SRC_OPA164x
*

It would be much better to attach such a model as a file (if the TI copyright rules do allow to do so). Even better to give just the link.

If you post code, mark it as code (pre-formatted text). Otherwise it becomes useless for any reader, as the blog software somehow mangels special characters.

Btw.: Simulate the OPA1641 https://www.youtube.com/watch?v=Wg7uSs4J_0U.

2 Likes

Will remember next time. Thanks.