1
\$\begingroup\$

I have an LTspice .asc file that contains a .tran and an .include directive, and one component symbol: the Pentode "U1" that comes with current LTspice. In the SpiceModel field of that U1, it has "6267" - the subcircuit which gets included by the directive - and in the file included, the subckt is named like that also. Yet, when running the schematic, I get "unknown subcircuit called in". The included file is in the same folder as the .asc file, and LTspice seems to find it: if I right-click on the include directive and then on the "Open" button of the dialog that popped up, it opens the correct .inc file.

So why isn't it working?

The .asc file:

Version 4
SHEET 1 920 680
SYMBOL Misc\\pentode 144 176 R0
SYMATTR InstName U1
SYMATTR SpiceModel 6267
TEXT 104 -96 Left 2 !.tran 1m
TEXT 584 48 Left 2 !.inc 6267.inc

The 6267.inc file:

*
* Generic pentode model: 6267
* Copyright 2003--2008 by Ayumi Nakabayashi, All rights reserved.
* Version 3.10, Generated on Sat Mar  8 22:42:16 2008
*            Plate
*            | Screen Grid
*            | | Control Grid
*            | | | Cathode
*            | | | |
.SUBCKT 6267 A G2 G1 K
BGG   GG   0 V=V(G1,K)+0.59868749
BM1   M1   0 V=(0.010782364*(URAMP(V(G2,K))+1e-10))**-0.70765893
BM2   M2   0 V=(0.67945278*(URAMP(V(GG)+URAMP(V(G2,K))/29.728844)))**2.2076589
BP    P    0 V=0.0013378994*(URAMP(V(GG)+URAMP(V(G2,K))/43.754099))**1.5
BIK   IK   0 V=U(V(GG))*V(P)+(1-U(V(GG)))*0.00078620809*V(M1)*V(M2)
BIG   IG   0 V=0.00066894969*URAMP(V(G1,K))**1.5*            (URAMP(V(G1,K))/(URAMP(V(A,K))+URAMP(V(G1,K)))*1.2+0.4)
BIK2  IK2  0 V=V(IK,IG)*(1-0.4*(EXP(-URAMP(V(A,K))/URAMP(V(G2,K))*15)-EXP(-15)))
BIG2T IG2T 0 V=V(IK2)*(0.83966688*(1-URAMP(V(A,K))/(URAMP(V(A,K))+10))**1.5+0.16033312)
BIK3  IK3  0 V=V(IK2)*(URAMP(V(A,K))+7510)/(URAMP(V(G2,K))+7510)
BIK4  IK4  0 V=V(IK3)-URAMP(V(IK3)-(0.00071507731*(URAMP(V(A,K))+URAMP(URAMP(V(G2,K))-    URAMP(V(A,K))))**1.5))
BIP   IP   0 V=URAMP(V(IK4,IG2T)-URAMP(V(IK4,IG2T)-(0.00071507731*URAMP(V(A,K))**1.5)))
BIAK  A    K I=V(IP)+1e-10*V(A,K)
BIG2  G2   K I=URAMP(V(IK4,IP))
BIGK  G1   K I=V(IG)
* CAPS
CGA   G1  A  0.05p
CGK   G1  K  2.3p
C12   G1  G2 1.5p
CAK   A   K  5.3p
.ENDS

EDIT:

The accepted reply does work. Changing the 6267 from SpiceModel field to Value field eliminates the "Unknown subcircuit" error, to produce a "count mismatch error", which is due to:

Most "pentode" SPICE models are actually tetrode models; very few model the pentode's suppressor grid because it is generally assumed to be connected to the cathode, rather than being used as a modulating element. So you should use the LTspice built-in tetrode symbol instead, ignoring the suppressor grid in your LTspice schematic. This should work.

... according to Ray Waters' post in this diyaudio thread

Changing the symbol to tetrode indeed gets rid of that.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ what exactly is the error? \$\endgroup\$
    – Hearth
    Commented Jul 5, 2023 at 2:59
  • 1
    \$\begingroup\$ (incidentally, that's a lot of voltage-mode B sources in that subcircuit... I'd worry about stability, it might be hard to simulate.) \$\endgroup\$
    – Hearth
    Commented Jul 5, 2023 at 3:26

1 Answer 1

3
\$\begingroup\$

You need to enter in 6267 for the Value field, not the SpiceModel field. Leave SpiceModel blank, as shown below:

enter image description here


As Hearth mentions in the comments, it shouldn't matter if SpiceModel or Value are used, but it sounded like your error was due to you leaving Value populated with the default text of Pentrode and then adding 6267 to SpiceModel resulting in the engine looking for something called 6267 pentrode which doesn't exist.

I would avoid using SpiceModel wherever you can since it can be unintentially used in the special corner cases laid out in the built-in LTspice Help sections "Super Expert Mode" and "Adding Attributes". Also, most LTspice symbols which point to subcircuits have Value populated and you should just edit that field and leave SpiceModel blank.


One additional problem you might run into is that your subcircuit takes in 4 nodes, but the pentode symbol requires 5. You might have to solve that by copying the symbol and editing it to fit your needs.

\$\endgroup\$
10
  • \$\begingroup\$ Either should work fine, no? The fields are all just concatenated in the netlist. \$\endgroup\$
    – Hearth
    Commented Jul 5, 2023 at 3:31
  • \$\begingroup\$ @Hearth Whoops. You might be right. I thought the concatenation began at/after Value. \$\endgroup\$
    – Ste Kulov
    Commented Jul 5, 2023 at 3:35
  • \$\begingroup\$ It's always puzzled me why it had all those separate fields anyway, when they're all going to end up concatenated in that order anyway. You can just put all the information in one field and it works out fine. \$\endgroup\$
    – Hearth
    Commented Jul 5, 2023 at 3:36
  • \$\begingroup\$ @Hearth I usually avoid SpiceModel because it can be used in special combinations to do funky things. See these pages in the help: ltwiki.org/LTspiceHelpXVII/LTspiceHelp/html/… ltwiki.org/LTspiceHelp/LTspiceHelp/Adding_Attributes.htm \$\endgroup\$
    – Ste Kulov
    Commented Jul 5, 2023 at 3:37
  • 1
    \$\begingroup\$ @user1847129 I wouldn't say it gets confused. You are adding extra parameters it does not know how to resolve. Instead of adding parameters, you should edit the existing one(s). See my edit to this answer for best practice to avoid problems like this. \$\endgroup\$
    – Ste Kulov
    Commented Jul 5, 2023 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.