Unable to simulate an op-amp using eeschema'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

icad@fedora ~]$ dnf provides */analog.cm
created by dnf config-manager from https://down 488 B/s | 373 B 00:00
Errors during downloading metadata for repository ‘download.docker.com_linux_fedora_docke’:

  • Status code: 404 for https://download.docker.com/linux/fedora/docke/repodata/repomd.xml (IP: 2600:9000:2017:6600:3:db06:4200:93a1)
    Error: Failed to download metadata for repo ‘download.docker.com_linux_fedora_docke’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
    Ignoring repositories: download.docker.com_linux_fedora_docke
    Last metadata expiration check: 18 days, 3:49:48 ago on Mon 31 Oct 2022 01:21:37 PM EET.
    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 : updates
Matched from:
Filename : /usr/lib64/ngspice/analog.cm

ngspice-codemodel-38-1.fc36.x86_64 : ngspice codemodel and some script files
Repo : @System
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
td221 …am instalat ceea ce tu ai recomandat .ianaint de a instala am rulat exemplele de simulare ale lui Holger .Merg dar foarte rau se incarca diagramale osciloscopului.Un joc de strategie merge ,fulger’’ in schimb :))).Oricum multumesc pentru indicatii Mai trebuie sa studiez dircetoarele unde pot instala librariile spice ale producatorilor de semiconductori

/usr/lib64/tclspice/ngspice/analog.cm directory ist ok?

Daca acest director este valid atunci voi incerca aici sa introduc modele spice ale producatorilor

If the diagram loads very badly, try to increase the data points on the plot. Also verify your circuit, ngspice simulations may need some quirks to work well.
Also it would be better to post in English, just paste your comment in any translation service and copy paste the English text here.

De asemenea, ar fi mai bine să postați în limba engleză, doar lipiți comentariul dvs. în orice serviciu de traducere și lipiți aici textul în limba engleză.

While English is the default language the translators can be pretty poor sometimes. Posting in both languages might help overcome some problems if there is a native speaker offering help. I’ll sometimes go the extra step and post the translation for someone in hopes it gets the ball rolling.

In short, I have come to favor the dual language post in some cases over an either/or approach. Basically whatever works best. :wink:

[kicad@fedora share]$ cd /usr
[kicad@fedora usr]$ ls
bin games include lib lib64 libexec local sbin share src tmp
[kicad@fedora usr]$ cd local
[kicad@fedora local]$ ls
bin etc games include lib lib64 libexec sbin share src
[kicad@fedora local]$ which analog.cm
/usr/bin/which: no analog.cm in (/home/kicad/.local/bin:/home/kicad/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin)
The answer ist ::: no analog.cm

This conclusion is wrong. Using command which is not correct.

Use
find /usr -name analog.cm
instead.

usr/share/zoneinfo/EST5EDT
/usr/share/zoneinfo/Egypt
/usr/share/zoneinfo/Eire
/usr/share/zoneinfo/Factory
/usr/share/zoneinfo/GB
/usr/share/zoneinfo/GB-Eire
/usr/share/zoneinfo/GMT
/usr/share/zoneinfo/GMT+0
/usr/share/zoneinfo/GMT-0
/usr/share/zoneinfo/GMT0
/usr/share/zoneinfo/Greenwich
/usr/share/zoneinfo/HST
/usr/share/zoneinfo/Hongkong
/usr/share/zoneinfo/Iceland
/usr/share/zoneinfo/Iran
/usr/share/zoneinfo/Israel
/usr/share/zoneinfo/Jamaica
/usr/share/zoneinfo/Japan
/usr/share/zoneinfo/Kwajalein
/usr/share/zoneinfo/Libya
/usr/share/zoneinfo/MET
/usr/share/zoneinfo/MST
/usr/share/zoneinfo/MST7MDT
/usr/share/zoneinfo/NZ
/usr/share/zoneinfo/NZ-CHAT
/usr/share/zoneinfo/Navajo
/usr/share/zoneinfo/PRC
/usr/share/zoneinfo/PST8PDT
/usr/share/zoneinfo/Poland
/usr/share/zoneinfo/Portugal
/usr/share/zoneinfo/ROC
/usr/share/zoneinfo/ROK
/usr/share/zoneinfo/Singapore
/usr/share/zoneinfo/Turkey
/usr/share/zoneinfo/UCT
/usr/share/zoneinfo/UTC
/usr/share/zoneinfo/Universal
/usr/share/zoneinfo/W-SU
/usr/share/zoneinfo/WET
/usr/share/zoneinfo/Zulu
/usr/share/zoneinfo/iso3166.tab
/usr/share/zoneinfo/leapseconds
/usr/share/zoneinfo/posixrules
/usr/share/zoneinfo/tzdata.zi
/usr/share/zoneinfo/zone.tab
/usr/share/zoneinfo/zone1970.tab
/usr/share/zsh
/usr/share/zsh/site-functions
/usr/share/zsh/site-functions/_bwrap
/usr/share/zsh/site-functions/_curl
/usr/share/zsh/site-functions/_networkctl
/usr/share/zsh/site-functions/_busctl
/usr/share/zsh/site-functions/_hostnamectl
/usr/share/zsh/site-functions/_journalctl
/usr/share/zsh/site-functions/_localectl
/usr/share/zsh/site-functions/_loginctl
/usr/share/zsh/site-functions/_resolvectl
/usr/share/zsh/site-functions/_sd_hosts_or_user_at_host
/usr/share/zsh/site-functions/_sd_machines
/usr/share/zsh/site-functions/_sd_outputmodes
/usr/share/zsh/site-functions/_sd_unit_files
/usr/share/zsh/site-functions/_systemctl
/usr/share/zsh/site-functions/_systemd
/usr/share/zsh/site-functions/_systemd-analyze
/usr/share/zsh/site-functions/_systemd-delta
/usr/share/zsh/site-functions/_systemd-inhibit
/usr/share/zsh/site-functions/_systemd-path
/usr/share/zsh/site-functions/_systemd-run
/usr/share/zsh/site-functions/_systemd-tmpfiles
/usr/share/zsh/site-functions/_timedatectl
/usr/share/zsh/site-functions/_bootctl
/usr/share/zsh/site-functions/_coredumpctl
/usr/share/zsh/site-functions/_kernel-install
/usr/share/zsh/site-functions/_udevadm
/usr/share/zsh/site-functions/_bluetoothctl
/usr/share/zsh/site-functions/_libinput
/usr/share/zsh/site-functions/_flatpak
/usr/share/zsh/site-functions/_firewalld
/usr/share/zsh/site-functions/_machinectl
/usr/share/zsh/site-functions/_systemd-nspawn
/usr/share/zsh/site-functions/_snap
/usr/share/zsh/site-functions/_podman
/usr/share/qt6
/usr/share/qt6/translations
/usr/share/qt6/qtlogging.ini
/usr/share/swcatalog
/usr/share/swcatalog/xml
/usr/share/swcatalog/xml/org.gnome.Software.Featured.xml
/usr/share/swcatalog/xml/org.gnome.Software.Popular.xml
/usr/src
/usr/src/debug
/usr/src/kernels
/usr/tmp
find: ‘name’: No such file or directory
find: ‘analog.cm’: No such file or directory
[mir@fedora ~]$

I received displays from all countries in the world. I’m posting here only part of the response to the command given in the terminal