Simulation Error - how to debug?

I have a simple MOSFET circuit with a resistor load and a fuse. I am getting a strange error when I try to run a simulation:

Error on line 0 :
a$poly$e.xf1.e10 %vd [ xf1.14 0 xf1.9 0 ] %vd ( xf1.8 xf1.37 ) a$poly$e.xf1.e10
MIF-ERROR - unable to find definition of model a$poly$e.xf1.e10

I have attached my circuit and the spice models for the MOSFET and fuse.

I don’t know enough to know where to start looking - in what file is line 0? I grepped for a$poly$e.xf1.e10 and didn’t find it.

Mark
MOSFET-test1.kicad_sch (30.8 KB)
fuse_model_2.spi (1.1 KB)
irlz34n.spi (1.7 KB)

MIF-ERROR - unable to find definition of model a$poly$e.xf1.e10

is a hint to an ngspice installation problem. The ‘poly’ code model is required by the Fuse model, but is not found.

What is your operating system? What is your KiCad version? What is the installation source for KiCad?

Ubuntu 20.04

Application: KiCad Schematic Editor
Version: 6.0.8-f2edbf62ab~116~ubuntu20.04.1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Platform: Linux 5.19.13-surface x86_64, 64 bit, Little endian, wxGTK, ubuntu, x11
Build Info:
Date: Sep 30 2022 16:52:13
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.71.0
OCC: 7.5.2
Curl: 7.85.0
ngspice: 36
Compiler: GCC 9.4.0 with C++ ABI 1013
Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON

We have to figure out if this is a KiCad Ubuntu packgae problem or if something went wrong during installation.

How did you install KiCad?

Are you familiar with files and folders in your Linux system? If so, please check if you have a folder containing analog.cm and other *.cm files.

I followed these instructions for 6.0.8 at Install on Ubuntu | KiCad EDA (Not the nightly development build).

sudo add-apt-repository --yes ppa:kicad/kicad-6.0-releases
sudo apt update
sudo apt install --install-recommends kicad

I am very comfortable with the cli. There are no .cm files on my computer.

I looked in the ngspice user manual, and the POLY source is only available when ngspice is compiled with the -XSPICE option. Do you know if the official kicad ngspice is compiled with this option? Not sure how to find out.

Mark

Then the installation is incomplete. I do not know what the Ubuntu package manager is doing. We might search for that information and find out.

The same problem has been there with Fedora Linux. There it helped to additionally install plain ngspice (not libngspice !). As this does not interfere with KiCad, you might give this procedure a try.

Installing ngspice worked.
sudo apt install ngspice
The .cm files are now installed at /usr/lib/x86_64-linux-gnu/ngspice/. Thanks!!

Should this be reported as a bug?

Now I need help understanding how to run the simulator. Any recommendations for a good tutorial? I am getting these messages:

Compatibility modes selected: ps lt
Circuit: KiCad schematic
Reducing trtol to 1 for xspice 'A' devices
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Warning: v1: no DC value, transient time 0 value used
Warning: v.xf1.v1: has no value, DC 0 assumed
 Reference value :  1.00000e-01
No. of Data Rows : 5

Some of my questions:

  • I also don’t quite understand the plot with voltage on the x-axis and current on the y-axis. I was looking for something with time on the x-axis and voltage or current on the y-axis.

  • I wanted V1 to be a square wave over time using this annotation on the schematic - pulse(0,5,0,2u,2u,100m,200m) , but that does not seem to be the case as I have to define V1 in the simulation parameters differently.

Thanks again!

Mark

Tutorials: Ngspice circuit simulator - Tutorials, espicially for KiCad/ngspice: KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation.

Simple examples: KiCad\6.0\share\kicad\demos\simulation (hopefully a similar path in Ubuntu).
More examples: Simulation examples for KiCad/Eeschema/ngspice

it’s a different path on Ubuntu, but you can find the simulation demos on any platform through File → Open Demo Project… in the main KiCad window. On my linux installation they’re in /usr/share/kicad/demos/simulation/.

1 Like

Thanks! Already learned a lot from the first two simulation exercises!

Mark

Mr Holger Simulation examples for KiCad/Eeschema/ngspice
It works but slowly. Anyway, I took a step forward
Hello from Transylvania ( romania country)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.