Ignore Pin in Simulation

I am trying to do some simulations for a circuit that includes a differential amplifier (ADA4945 to be precise). I downloaded its SPICE model and got to work designing a circuit. However, I ran into a problem where the symbol that I use has some pins that are duplicate (e.g. pin 6 and 7 are internally connected). Thus, the symbol exposes 17 pins in total whereas the SPICE model accepts only 14 nodes. This is because the footprint has multiple pins with the same function (i.e. internally connected).

Let’s simplify this with an example:

.Subckt DIFFAMP VinPos VinNeg Vout VsPos VsNeg

Now assume that the KiCad symbol has the following pinout:

Pin Name
1 VinPos
2 VinNeg
3 Vout
4 VsPos
5 VsPos (same as pin 4)
6 VsNeg

When I try to run the simulation I get an error as there are too many parameters (6 pins whereas SPICE defines 5 nodes):

Too many parameters for subcircuit type "DIFFAMP" (instance: xxu1)

Taking a look at the generated netlist also reveals that too many pins are passed as parameters:

XU1 +AIN -AIN AOUT +VS +VS -VS DIFFAMP

I tried to edit the alternate node sequence in the SPICE settings for the differential amplifier and added VsPos twice but still get the same error. My question: How do I ignore pin 5 (the duplicate pin that also maps to VsPos) without editing the actual SPICE model?

Currently I see basically three (or four) options.

Modify the symbol: Probably not a good idea when it is linked to a footprint etc.

Modify the model: Seems (as a quick fix) the easiest route, but who wants to tinker with model descriptions. What is to do: Simply add another node to the .subckt line and select it properly during the ‘alternate node sequence’.

Write a wrapper subcircuit, similar to what I have suggested for multi-device chips (KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation), like:

.subckt mywrapper a b c c d e f
.include vendormodel.lib
XU1A a b c d e f vendormodname
.ends

Another idea (not very deeply analyzed so far) might be that you submit a proposal to the bug and issue tracker for KiCad (Issues · KiCad / KiCad Source Code / kicad · GitLab) for enhancing the alternate node list by an pin exclusion mode, e.g. something like:

 1 3 2 8 6 5 !7 !4 

where pins 4 and 7 are excluded from the X line call send to ngspice.

Shouldn’t something like Spice_Node_Sequence="1 2 3 4 6" work (the 5th pin of the symbol would then be n/c)? I think each number is the order number of the pin (the order it is defined in the symbol file, not the actual number assigned to it for the symbol, because it could be any kind of text), and a sequence with n numbers is like n (m-channel or 1-of-m) MUXers for the first n nodes of the .subckt (where m is the number of symbol pins, dependent on which alternate/convert symbol is selected)?

1 Like

Franzee, of course you are right. I did not read my own examples. See here: KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation for an example.

So in the alternate node sequence you have to list only the pins that are relevant for the model.

2 Likes

Thank you for your responses! I think I got Spice_Node_Sequence wrong. Going back to my example, I tried to specify the node sequence as follows:

Spice_Node_Sequence="VinPos VinNeg Vout VsPos VsPos  VsNeg"

Notice where I put VsPos twice. I understood Spice_Node_Sequence the other way around, i.e. that I have a fixed number of pins coming from the symbol definition and all I can do is rearrange them. I also did not know that I can use the symbol’s pin numbering for Spice_Node_Sequence. And indeed, the simulation now works! Thank you @mgyger and @holger!