Unable to simulate an op-amp using eeshema's simulator (ngspice)

I want to simulate an RF amplifier using an op amp AD8001AN, however the simulator is not working. It instead says that it couldn’t find symbol library file then the following output:

Note: Compatibility modes selected: ps
Circuit: KiCad schematic
Too many parameters for subcircuit type "ad8001an" (instance: xxu1)
Background thread stopped with timeout = 0
Error: there aren't any circuits loaded.

Did you follow the steps as described in KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation ?

I did, I have another error now:

Note: No compatibility mode selected!
Circuit: KiCad schematic
Error on line 0 or its substitute:
a$poly$g.xu1.gb1 %vd [ net-_u1-pad3_ xu1.100 ] %id ( net-_v1-pad1_ net-_u1-pad3_ ) a$poly$g.xu1.gb1
MIF-ERROR - unable to find definition of model a$poly$g.xu1.gb1
Error: circuit not parsed.

This is my netlist:

.include "SPICE-Models/Operational Amplifier/ad8001an.cir"
C1 Net-_U1-Pad3_ Net-_C1-Pad2_ 10n
V2 Net-_C1-Pad2_ 0 sin(0 1m 900Meg)
R1 Net-_U1-Pad6_ 0 1000
XU1 Net-_U1-Pad3_ 0 Net-_V1-Pad1_ 0 Net-_U1-Pad6_ AD8001AN
V1 Net-_V1-Pad1_ unconnected-_V1-Pad2_ dc(1)
.save @c1[i]
.save @v2[i]
.save @r1[i]
.save @v1[i]
.save V(Net-_C1-Pad2_)
.save V(Net-_U1-Pad3_)
.save V(Net-_U1-Pad6_)
.save V(Net-_V1-Pad1_)
.save V(unconnected-_U1-Pad1_)
.save V(unconnected-_U1-Pad5_)
.save V(unconnected-_U1-Pad8_)
.save V(unconnected-_V1-Pad2_)
.tran 1p 5n
.end

There seems to be a bug in your circuit schematic. ‘Unconnected’ is bad, and having a node only once in a netlist is bad too (connection is missing). V1 is floating.

Did you have a look at the data sheet of the AD8001? Where is your power supply (± 3 V minimum)?

I did almost the same circuit on the spreadsheet, but still I’m getting this:

Note: No compatibility mode selected!
Circuit: KiCad schematic
Error on line 0 or its substitute:
a$poly$g.xu1.gb1 %vd [ net-_u1-pad3_ xu1.100 ] %id ( net-_u1-pad7_ net-_u1-pad3_ ) a$poly$g.xu1.gb1
MIF-ERROR - unable to find definition of model a$poly$g.xu1.gb1
Error: circuit not parsed.

My spice netlist:

.title KiCad schematic
.include "~/SPICE-Models/Operational Amplifier/ad8001an.cir"
R1 Net-_U1-Pad6_ 0 100
C2 0 Net-_U1-Pad7_ 0.001u
V2 Net-_U1-Pad7_ 0 dc(5)
C1 0 Net-_U1-Pad7_ 0.1u
C3 0 Net-_U1-Pad4_ 0.1u
R2 Net-_U1-Pad2_ 0 806
C4 0 Net-_U1-Pad4_ 0.001u
XU1 Net-_U1-Pad3_ Net-_U1-Pad2_ Net-_U1-Pad7_ Net-_U1-Pad4_ Net-_U1-Pad6_ AD8001AN
R3 Net-_U1-Pad6_ Net-_U1-Pad2_ 806
V3 0 Net-_U1-Pad4_ dc(5)
R4 Net-_U1-Pad3_ 0 50
V1 Net-_U1-Pad3_ 0 sin(0 1m 900000k)
.save @r1[i]
.save @c2[i]
.save @v2[i]
.save @c1[i]
.save @c3[i]
.save @r2[i]
.save @c4[i]
.save @r3[i]
.save @v3[i]
.save @r4[i]
.save @v1[i]
.save V(Net-_U1-Pad2_)
.save V(Net-_U1-Pad3_)
.save V(Net-_U1-Pad4_)
.save V(Net-_U1-Pad6_)
.save V(Net-_U1-Pad7_)
.save V(unconnected-_U1-Pad1_)
.save V(unconnected-_U1-Pad5_)
.save V(unconnected-_U1-Pad8_)
.tran 1p 5n
.end

This is the schematic:

Your netlist is running fine with my ngspice.

This points to an Eeschema/ngspice installation problem on your side. ngspice requires certain files, e.g. containing the model a$poly…, which obviously are not found.

A first step to know about your installation is the KiCad version information, to be found by
KiCad → About KiCad → Copy Version Info.

Please post this information here.

This is my version info:

Application: KiCad
Version: 6.0.5-2.fc36, release build
Libraries:
    wxWidgets 3.0.5
    libcurl/7.82.0 OpenSSL/3.0.3 zlib/1.2.11 brotli/1.0.9 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.46.0 OpenLDAP/2.6.2
Platform: Linux 5.18.5-200.fc36.x86_64 x86_64, 64 bit, Little endian, wxGTK, KDE, x11
Build Info:
    Date: May 6 2022 00:00:00
    wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
    Boost: 1.76.0
    OCC: 7.5.0
    Curl: 7.82.0
    ngspice: 36
    Compiler: GCC 12.0.1 with C++ ABI 1017
Build settings:
    KICAD_USE_OCC=ON
    KICAD_SPICE=ON

What is your operating system? Where did you get KiCad (or: How did you install it)?

Fedora workstation 36 (KDE spin), installed via dnf.

Are you familiar with the Linux file system? Could you check if you find a file named analog.cm in /usr or usr/local or one of its subdirectories?

We have to find out if the Fedora packager for KiCad has caught and delivered all dependencies for ngspice.

I’m familiar with Linux file system, been using it for a year now.
No, there is no analog.cm in my /usr or /usr/local
should I reinstall libngspice or install another package?
Edit: Thank you very much for the help! I ran dnf provides */analog.cm
Turns out that I needed to install ngspice package in addition to libngspice

I should report this to kicad fedora package maintainer(s).

I am not sure if re-installing libngspice will include the analog.cm (and some other *.cm as well). However installing standard ngspice should include all of these files. But then I am not sure if they are at the right place for Eeschema/ngspice to be found.

So yes, maybe re-installing libngspice first. If not successful, then installing standard ngspice (I am running these parallel on my SUSE Linux without interference, so there should be no problem).

I will then talk to Steven Falco (Fedora KiCad package manager) and Mamoru Tasaka (ngspice package manager) how to fix this problem.

dnf provides */analog.cm

ngspice-36-1.fc36.1.x86_64 : A mixed level/signal circuit simulator
Repo        : fedora
Matched from:
Filename    : /usr/lib64/ngspice/analog.cm

ngspice-37-1.fc36.x86_64 : A mixed level/signal circuit simulator
Repo        : @System
Matched from:
Filename    : /usr/lib64/ngspice/analog.cm

ngspice-37-1.fc36.x86_64 : A mixed level/signal circuit simulator
Repo        : updates
Matched from:
Filename    : /usr/lib64/ngspice/analog.cm

tclspice-36-1.fc36.1.x86_64 : Tcl/Tk interface for ngspice
Repo        : fedora
Matched from:
Filename    : /usr/lib64/tclspice/ngspice/analog.cm

tclspice-37-1.fc36.x86_64 : Tcl/Tk interface for ngspice
Repo        : updates
Matched from:
Filename    : /usr/lib64/tclspice/ngspice/analog.cm

It is not included in libngspice
Installing the ngspice package fixed the problem for me

1 Like