Understanding spice models with kicad and ngspice

I am having trouble understanding how spice models (subcircuits) are integrated in KiCad. I have installed KiCad and ngspice on my Ubuntu system, In the past I have used LTspice under wine using primarilly the Ayumi valve models which are comprised of individual .inc files for each valve. For example the 12AY7 model is…

*
* Generic triode model: 12AY7
* Copyright 2003--2008 by Ayumi Nakabayashi, All rights reserved.
* Version 3.10, Generated on Sat Mar  8 22:41:10 2008
*             Plate
*             | Grid
*             | | Cathode
*             | | |
.SUBCKT 12AY7 A G K
BGG   GG   0 V=V(G,K)+0.71171435
BM1   M1   0 V=(0.0094119714*(URAMP(V(A,K))+1e-10))**-0.68363668
BM2   M2   0 V=(0.68692746*(URAMP(V(GG)+URAMP(V(A,K))/33.263227)+1e-10))**2.1836367
BP    P    0 V=0.00092634255*(URAMP(V(GG)+URAMP(V(A,K))/48.423202)+1e-10)**1.5
BIK   IK   0 V=U(V(GG))*V(P)+(1-U(V(GG)))*0.00054133951*V(M1)*V(M2)
BIG   IG   0 V=0.00046317128*URAMP(V(G,K))**1.5*(URAMP(V(G,K))/(URAMP(V(A,K))+URAMP(V(G,K)))*1.2+0.4)
BIAK  A    K I=URAMP(V(IK,IG)-URAMP(V(IK,IG)-(0.00049201413*URAMP(V(A,K))**1.5)))+1e-10*V(A,K)
BIGK  G    K I=V(IG)
* CAPS
CGA   G    A 1.3p
CGK   G    K 1.3p
CAK   A    K 0.6p
.ENDS

As far as I can tell KiCad wants to see a “.lib” file including multiple .model specifications rather than a .subckt. Where can I find resources to get me straightened out? I need to find out if I can use the subckt as is and how to attach it to the existing triode symbols.

1 Like

A tip for posting code, use triple backtick to enclose the text, e.g.

```
some text
```

is shown as

    some text
2 Likes

Thanks for the tip Bob.

I recently started using Kicad and have tested its simulator with ngspice. Though I prefer LTspice for my needs, ngspice is very usable so, I spent some time reading this Manual. (There is a section on .subckt)

Also, this link is specific to Kicad and ngspice.

1 Like

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