Spice2poly(?) not working

Hi,

I just installed KiCad8 on my M2 MacStudio.
Works fine for regular PCB work, but schematic simulation of certain OP-amps such as TL084 does not work.

I found a spice model for TL084, and did all the subckt preparations for the symbol, and designed a simple test circuit.
When I open the sim page, I get:

Error on line:
a$poly$e.xu5.e.xu1a.egnd %vd [ probe_int_vcc_xu5_4 0 probe_int_vee_xu5_11 0 ] %vd ( xu5.xu1a.99 0 ) a$poly$e.xu5.e.xu1a.egnd
MIF-ERROR - unable to find definition of model a$poly$e.xu5.e.xu1a.egnd

I believe this is connected to the following lines in the TL084.301.lib.txt:
EGND 99 0 POLY(2) (3,0) (4,0) 0 .5 .5
FB 7 99 POLY(5) VB VC VE VLP VLN 0 4.715E6 -5E6 5E6 5E6 -5E6

I googled a bit and it seems the plugin spice2poly.cm cannot be accessed properly.
A similar problem was reported as a bug in 2016 or so, and was fixed.

At first I reported it as a bug to GitLab and shared my circuit project, but at least two other MacOS M2 users reported that they did not have any problem simulating my project with KiCad8. A reinstallation of KiCad8 was recommended, but it did not help. At this point the discussion ended, and I expect no further help from GitLab.

This problem does not occur in Windows11 or Ubuntu.

So it must be something specific to my M2 MacOS environment.
I would be very happy to get some suggestions on how I can solve this.
Is there any way I can manually persuade KiCad to access spice2poly properly ?
Or is it some other problem entirely?

Can I use an external ngspace installation instead of the built-in?

bnilsson

Maybe as a first step you describe where (exactly) you have got KiCad, and how you did install it (step by step).

Then you might check with Finder where libngspice.0.dylib is located, and where spice2poly.cm.

I find them in
Programme/KiCad/KiCad.app/Contents/Plugins/sim/libngspice.0.dylib
and
Programme/KiCad/KiCad.app/Contents/Plugins/sim/ngspice/spice2poly.cm

An external installation will go into a completely different place, e.g. usr/local/bin and usr/local/lib/ngspice. It does not interfere with the KiCad/ngspice installation.

Do you have set environmental variables (if there is such thing in macOS)? I did not.

.

Ok.
I got KiCad8 from the regular source, CERN/Europe.
I opened the DMG image, and dragged the KiCad folder to /Applications.
I can confirm that I have
/Applications/KiCad/KiCad.app/Contents/PlugIns/sim/libngspice.0.dylib
and
/Applications/KiCad/KiCad.app/Contents/PlugIns/sim/ngspice/spice2poly.cm

I have installed ngspice 42 for qucs-s at /usr/local, but as you say, it should not interfere(?).

What environmental variables should I check?

I have no idea. Does your other KiCad installation set environmental variables?

Does your other installation set a file spinit? Did you set a file .spiceinit (or spice.rc)? KiCad/ngspice does not use any of them, but may be influenced, if any of them is in the HOME directory. If you have spinit, just rename it temporarily.

MacOS is still BSD-unix like, but my unix command knowledge is a bit shallow.
Can you suggest a terminal command that will show the environmental variables contain “NGSPICE”?

Edit:
I found “env” and “set”, but none of the listings from them showed any “ngspice” connections.
My own ngspice is installed at

/usr/local/bin/ngspice
/usr/local/lib/ngspice
/usr/local/share/qucs-s/examples/ngspice
/usr/local/share/ngspice
/usr/local/share/ngspice/scripts/src/ngspice

As a test, I renamed
/Applications/KiCad/KiCad.app/Contents/PlugIns/sim/ngspice/spice2poly.cm
to
/Applications/KiCad/KiCad.app/Contents/PlugIns/sim/ngspice/_spice2poly.cm
to see if anything changed. It did not, I got exactly the same error message.
This confirms to me that the reference to spice2poly.cm is lost for some reason.
Are there any log files to check?

No spi or .spi files found in my HOME directory…
“…your other KiCad installation”, I guess you mean “your other ngspice installation”?

Ok, I am sad to realise that I will have to give up simulation on my MacOS M2.
For unknown reasons.

Questions:

  1. Is there any path variable I can add to the list of Kicad Environment variables, to help Ngspice find spice2poly.cm file?
  2. Where is the “spinit” file located? I have searched the KiCad.app folder structure but there is no spinit there.
  3. Can I add the path information info to the .spiceinit file?

Found a workaround.
Put the following line in ~/.spiceinit:

codemodel /Applications/KiCad/KiCad.app/Contents/PlugIns/sim/ngspice/spice2poly.cm

Error gone, sim runs. But it is still unknown why it is needed.

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