They are described in the Ngspice User’s Manual under circuit elements (or device instances), chapter 2. PSpice (OrCad), LTspice, etc., have their own schematic symbols usually follow the same conventions while KiCad follows IPC, which notably means the diode symbol is reversed. For subcircuits, it’s basically arbitrary but mostly follows what LTspice (free) or OrCAD ($) do.
It looks like the prices of IPC-2612 and IPC-2612-1 have been reduced to about ⅓ of the previous $300 each (still very restrictive DRM, though): https://shop.ipc.org
Thanks, but a 714-page manual is not what I was looking for. And IPC-2612 does not seem to relate to ngspice/SPICE at all.
I’ll probably have to build my own list moving along.
Well, 2.1.3 alluded to above has a summary table. Don’t know what’s so hard with clicking some links and go back…
Maybe start small with the chapter Circuit Elements and Models of the SPICE 3f4 manual then (NC NB NE would be your CBE, N+ N- your AK)?
If you want to do it a harder way, you could look at existing KiCad symbols. For example, install (and add as described there) my Generic Symbol Library with the Plugin and Content Manager. Then Edit → Pin Table… shows the assignments for a symbol (don’t forget the alternate node sequence Spice_Node_Sequence in File → Symbol Properties… for the diodes).
Thanks for your reply.
The connection betwen symbols, models and alternate sequences is completely clear to me.
The disconnect is not knowing what ngspice expects as pin sequence. For instance what input does it expect for an SCR? N+, G, N-? No one knows.
Or for a Triac? MT+, MT-, G? Again a mystery.
If you tell me that such parts can only be modelled with a .SUBCKT simulation file, I’m OK with that, But I’m missing the overview completely.
Thanks for finally a clear answer.
So the basic semiconductor models (.MODEL) are restricted to:
Diode,
BJT,
JFET,
MESFET,
MOSFET,
according the chapters: 7, 8, 9, 10, 11 (2.1.3 is not helpful in this respect). For all other active devices I should use a .SUBCKT model.
Nice to know, and the first time I see a definite answer on this.
Thank You all, I think I got it now. I’ll mark as solved.
Right, plus the included XSPICE code models (chapter 27, but most all are documented in chapter 12) in analog.cm, digital.cm, spice2poly.cm, table.cm, xtradev.cm, xtraevt.cm.
There is some minimal, but straight to the point help built directly into KiCad.
For example, add a BJT to a schematic, press e to edit it’s properties, and click on the Spice Model button, then there is a Note giving exactly this information:
And when you change the Type to Diode, MOSfet, Jfet or Subcircuit, there is a similar note for each of them for the order of pins that ngSpice expects.
That is the “Note” when the Type is set to Subcircuit. When you change the Type to one of the others, then it shows the Note that fits with the currently selected “Type”. The screenshot I made was for the BJT type, and it shows the Spice pin ordering for a BJT.
I’d accept the “duh” comment, if it wasn’t for the fact that most BJT, FET etc. models are of the “subcircuit” type, unless they’re extremely primitive.
QED.
With a subcircuit model you will have to rely on the model creator’s information given. The node sequence may be arbitrarily chosen.
If you do not have any information, e.g. to be found in the model file, then you either have to do some detective’s work, or you might discard the model and look for a better one.
With the above model some research will reveal that Q1 (with parameter set main) has the same node sequence as the subcircuit, namely 1 2 3. From Q1 we know that it is an intrinsic bipolar device with node sequence C B E, which translates to the subcircuit call by a one-to-one correspondence of its nodes. But what about Q2 then? You have to read the text from the model and do some assumptions (e.g. neglect it when looking for the nodes).
If you look at top of the Nexperia spice model
**********************************************************
*
* BC847
*
* Nexperia
*
* General purpose NPN transistor
* IC = 100 mA
* VCEO = 45 V
* hFE = 110 - 450 @ 5V/2mA
*
*
*
*
* Package pinning does not match Spice model pinning.
* Package: SOT 23
*
* Package Pin 1: Base
* Package Pin 2: Emitter
* Package Pin 3: Collector
*
*
* Extraction date (week/year): 24/2021
* Spicemodel includes temperature dependency
*
**********************************************************
*#
* Please note: Diode D1, Transistor Q2 and resistor RQ
* are dedicated to improve modeling of quasi
* saturation area and reverse mode operation
* and do not reflect physical devices.
*
.SUBCKT BC847 1 2 3
Q1 1 2 3 MAIN 0.8636
Q2 11 2 3 MAIN 0.1364
RQ 11 1 324.8
D1 2 1 DIODE
*
.MODEL MAIN NPN
+ IS = 1.124E-14
you will see the problem. There is no such distinct node info given. So the modellers assume that the user assumes that C B E is the right choice (because it is Spice syntax).
Eeschema/ngspice cannot derive this CBE assumption safely and automatically. The user has to do it.
I agree completely, this is one of the main difficulties for new (and also somewhat experienced) users.
My own approach is to compare the schematic part pin numbering with the default Spice pin sequence (eg, CBE) to have an initial idea of the alternate node sequence. This usually works. If not, I’ll go into the model to check.
But for this you need to know the Spice default pin sequence first…
That’s the reason I suggested the modified comment text.