Cannot use model files with alphanumeric pin/port names

Hi,

I’m trying to make up an SG3525 circuit for simulation in kicad 7.0.5 (both system package or flatpack)
I downloaded a symbol from snapeda and found different models for pspice/ltspice for the device which all look valid to me. However, trying to bind the model to the symbol, I can select the model file but the dropdown menu for model selection cannot be clicked and the model also isn’t shown (field remains empty). Upon any further activity I usually get “failed to read simulation model from fields” dialogs but at random eeschema may even crash for a model “”. All files are editable for me, there is no error message in the shell, I’m not aware of a logfile.

I played around with several other model libraries and found out that the .subckt pins/ports must be pure numbers. As soon as there is a subckt with characters in the file, the model selection won’t work (thus, I also can’t add a wrapper .subctk dummy 1 2 3 to call another .subckt real a b c in the same file.

I assume that named pins/ports are supposed to work? Any clue what can be wrong or how to get around this? It would help to be able to manually enter the model name, but the lineedit doesn’t support that.

I hope there is no need to “anonymize” all signal names by changing them to numbers. Since the wrapper doesn’t work, the next alternative might be to add N 1Ohm resistors inside the subckt to connect each of the N numbered pins to the internal net names? I didn’t try yet if I can include the original model to use the wrapper idea.

thanks
GG

I’m able to use spice models with letter-based pin names without a crash. Perhaps there is something else wrong with the model that is leading to a crash? Generally if you can replicate a crash it is worth making an issue for it on Gitlab so the developers can take a look.

In the meantime, can you provide a link to the model in question, along with your KiCad version info and operating system? (KiCad > About KiCad > Copy Version Info)

Which version do you use?

The crash is not really reproducable, the issue with non-numbers however is - and it behaves the same in two 7.0.5 installations (running on the same machine with opensuse tumbleweed - one rpm and one flatpack. I updated the fp today with no change). I had some freecad trouble where the packaging did make a difference (due to different KDE/gnome interfaces), but here is seems to be something internal related to parsing the subckt statement?

I just checked the same project/model with a 7.0.1 installation on another machine - there it works as expected! I can load it and select the model with alphanumerical names. I’ll use that remotely in the meantime (I’m very glad that kicad works across ssh again :slight_smile: )

I’ve gotten that message myself, and it was related to not being able to find the model file.
But the whole V7 simulation interface is somewhat “messy” and non-intuitive.

I’m on 7.0.5 on Mac OS. My most recent test was using an ADA4062-2 model which comes from Analog Devices as a single op amp model, so I wrote a quick subcircuit to “wrap” two instances into one model for KiCad’s benefit.
My custom subcircuit below includes alphanumeric pin names and appears to work.

.SUBCKT ADA4062x2       1out 1inn 1inp vee 2inp 2inn 2out vcc
.include ADA4062-2.cir
XU1A 1inp 1inn vcc vee 1out ADA4062-2
XU1B 2inp 2inn vcc vee 2out ADA4062-2
.ENDS 2xADA4062

Thanks for the comments! It turns out that my observation was wrong.
I found some time to investigate more and it seems to be an issue of kicad parsing the file for subckts when there is some syntax error inside (well, that should still depend on the simulator settings). I still can’t tell what exactly made it fail, and I also gave up to convert the model from ltspice to ngspice syntax for lack of time, but incrementally removing content from the subckt at some point leads to its recognition so that I could at least create a netlist and start the simulator to learn about the other model issues.

This is a bit odd as it complicates analysis of the problem/model because there is no error message. I would expect that only the simulator analyzes the content. On the other hand, kicad needs to scan for the models in a lib (which may be nested). I suggest that instead of parsing just everything, only non-comment lines with subckt and ends statements should be checked so that the toplevel models can be identified even if their content is not ok, and that there is some feedback on parsing errors if there are still problems

For me there is absolutely no problem to run this OpAmp in KiCad 7.0.6.
However, I did not use a symbol from SnapEDA, but a pin-compatible symbol ADA4075-2 from the KiCad libs and renamed it.
Please see the project attached.
ADA4062.7z (8.0 KB)

1 Like