Simulation - Using external Library Files

Hello fine humans!

First of all, thank you kindly for creating kicad; it is an amazing tool! I am however, having great difficulty with the simulator; may I please have some baby-step assistance.

Software:
Ubuntu: 20.04.1
kicad: 5.1.11
ngspice: hopefully ~30+???

Project Definition:
I am trying to simulate a non-inverting opamp, however, I need to use the opamp model below from ti.com.
https://www.ti.com/product/THS3001?keyMatch=THS3001&tisearch=search-everything&usecase=GPN#design-tools-simulation

Problem = cannot get externally imported sub-circuit models working; .lib files in particular from ti.com.

What I have already done:
I have both the .spiceinit & spice.rc files with “set ngbehavior=ps”. I have both of these files located in my “Home” directory as depicted in the file explorer GUI. I have downloaded and unzipped the model of interest into the folder of my kicad project. I find the .lib file using “edit spice model”, and change the “alternate pin numbering” accordingly. I do not have a “.include” text sting on my schematic with the path to the file.

different kicad outputs:

  1. Too many parameters for subcircuit type “ths3001” (instance: xxu1)
  2. I was able to probe/view the input to the opamp, however, the output was constant at some arbitrary value since kicad could not resolve the model.

Conclusion:
I have confused myself, and I am out of optimism; seeking professional help. This is my first question via online forums, so please be gentle; I’m aware that my post is lacking information.

Thank you in advance peeps! :slight_smile:

Cheers,
Tyler

Please check what ngspice version you have:

Empty Eeschema window, add a text box (right hand side T) with the following text:

.op
.control
version
.endc

Run the simulation.

Some more info at http://ngspice.sourceforge.net/ngspice-eeschema.html#OpAmp .
If that does not help, just ask here.

Hey holger!

Circuit: KiCad schematic
******
** ngspice-31 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Please get your ngspice manual from http://ngspice.sourceforge.net/docs.html
** Please file your bug-reports at http://ngspice.sourceforge.net/bugrep.html
** Creation Date: Sun Oct 27 09:07:06 UTC 2019

Cheers for the response :slight_smile:

This tells me that the model setup is not o.k. What symbol did you choose? The TI model

* CONNECTIONS:      NON-INVERTING INPUT
*                   | INVERTING INPUT
*                   | | POSITIVE POWER SUPPLY
*                   | | | NEGATIVE POWER SUPPLY
*                   | | | | OUTPUT
*                   | | | | | 
*                   | | | | | 
*                   | | | | | 
.SUBCKT THS3001     1 2 3 4 5 

says it has 5 nodes (like the model given in the tutorial, see my last post).

I replicated the tutorial with my model ths3001.lib used as the spice model; it now runs with no apparent errors. However, I do not seem to get any useful output. Do you have any suggestions?

Please post your ngspice netlist here:

Eeschema --> Tools --> Generate Netlist File … --> Spice --> Generate Netlist

Hi holger,

Here is my spice net-list :slightly_smiling_face: .

.title KiCad schematic
.include "sloj001a/ths3001.lib"
V1 3v3 GND dc 3.3 
V2 Net-_U1-Pad3_ GND dc 0 ac 1 sin(0 1 1k)
R2 Net-_C1-Pad1_ Net-_R1-Pad1_ 10k
R1 Net-_R1-Pad1_ GND 10k
XU1 Net-_U1-Pad3_ Net-_R1-Pad1_ 3v3 GND Net-_C1-Pad1_ THS3001
R3 Net-_C1-Pad1_ GND 10k
C1 Net-_C1-Pad1_ GND 10p
.end

My fist impression is that this is not what it should be, however, this is my first spice netlist :smiley: .

Just a first look:

Use a symmetric power supply: +10V, -10V (see the data sheet).

1 Like

holger you absolute legend! ITS ALIVE!!!

Thank you for your help, and creating a safe learning environment for us noobs :smiley: . I have worked with ideal toys for too long, and I now realize that I must pay close attention to the data sheet if it is to function.

Again thank you for your help, and to the kicad community for creating such a wonderful tool for the world to use!