How to create 12AU7 triode tube symbol and all others symbols for tubes from LTSpice?

In LTSpice working model 12AU7 triode was with:

.SUBCKT 12AU7 A G K
XV1 A G K TRIODENH
+PARAMS: LIP= 1 LIF= 0.0037 RAF= 0.0041813 RAS= 16.48 CDO= 0

  • RAP= 0.032 ERP= 1.35
  • MU0= 14.036 MUR= 0.006488 EMC= 0.0000236
  • GCO= 0 GCF= 0.00012
  • CGA=1.60E-12 CGK=1.80E-12 CAK=4.50E-13
    .ENDS

.SUBCKT TRIODENH A G K
+PARAMS: LIP=1 LIF=3.7E-3 RAF=18E-3 RAS=1 CDO=0 RAP=4E-3

  • ERP=1.5
  • MU0=17.3 MUR=19E-3 EMC=9.6E-6 GCO=0 GCF=213E-6
  • CGA=3.9p CGK=2.4p CAK=0.7p
    .ENDS

How to create qspice triode 12AU7 working symbol?

You would have the simulator import the subcircuit to get the pins and the SPICE order correct. Then you would discard the opaque yellow rectangle and make your own symbol with circles and dashed lines, or you could get creative and use two half circles joined by line segments where the grid comes in. Probably the circle would suffice. Using this method, the subcircuit will be embedded into the symbol.

Did than answer the question or were you asking something else?

No, my problem is when in LTSpice library I have two subroutines - the first to describe valve tube - and that subroutine start with code:
.SUBCKT 12AU7 A G K
XV1 A G K TRIODENH
and the second subroutine is universal for many other triods in that library, and that subroutin start from code:
.SUBCKT TRIODENH A G K

Model .SUBCKT 12AU7 call universal model TRIODENH with parameters, and the result will be ok for selected triode.
The same my problem is how to convert pentodes descibed in LTSpice library, when we have two subroutines to descibe one tube.

If I have simple triode model, I can import them to QSpice without problem. I can draw single symbol and save and this working ok.

˙Ř˙Ű«symbol
  «type: X»
  «description: Machine generated symbol for 12AU7-J»
  «library file: |.subckt 12AU7-j P G K\nGp P K VALUE= {(0.01701593477m)*limit(V(P,K)*ln(1.0+(-0.1251806139)+exp((1.234948774)+ (1.234948774)*((34.50197863)+(-26.60747394m)*V(G,K))*V(G,K)/sqrt((22.53603268)**2+ (V(P,K)-(-4.400778147))**2)))/(1.234948774),0.0,1.0e16)**(1.369425091)}\nCgp G P 1.5pF\nCgk G K 1.6pF\nCpk P K 0.4pF\n.ends»
  «shorted pins: false»
  «line (-150,-200) (-150,-150) 6 0 0x1000000 -1 -1»
  «line (-150,-150) (150,-150) 7 0 0x1000000 -1 -1»
  «line (150,-200) (150,-150) 7 0 0x1000000 -1 -1»
  «line (-100,0) (-50,0) 6 0 0x1000000 -1 -1»
  «line (50,0) (0,0) 7 0 0x1000000 -1 -1»
  «line (100,0) (150,0) 7 0 0x1000000 -1 -1»
  «line (-200,0) (-150,0) 7 0 0x1000000 -1 -1»
  «line (-150,150) (150,150) 7 0 0x1000000 -1 -1»
  «line (0,150) (0,200) 7 0 0x1000000 -1 -1»
  «line (0,-150) (0,-200) 7 0 0x1000000 -1 -1»
  «rect (-200,-200) (200,200) 0 7 0 0xff0000 0x4000000 -1 0 -1»
  «triangle (-150,-150) (0,-100) (150,-150) 7 0 0x1000000 0x2000000 -1 -1»
  «text (350,-100) 1 0 0 0x1000000 -1 -1 "X1"»
  «text (550,100) 1 0 0 0x1000000 -1 -1 "12AU7-J"»
  «pin (0,200) (30,100) 1 7 0 0x0 -1 "P"»
  «pin (-200,0) (-20,110) 1 11 0 0x0 -1 "G"»
  «pin (0,-200) (70,-190) 1 14 0 0x0 -1 "K"»
»

Please, can you try to create a working single triode symbol from such library file like this with two subroutines:

Can you embed the second subcircuit inside the first subcircuit?

.SUBCKT 12AU7 A G K
XV1 A G K TRIODENH
+PARAMS: LIP= 1 LIF= 0.0037 RAF= 0.0041813 RAS= 16.48 CDO= 0

  • RAP= 0.032 ERP= 1.35

  • MU0= 14.036 MUR= 0.006488 EMC= 0.0000236

  • GCO= 0 GCF= 0.00012

  • CGA=1.60E-12 CGK=1.80E-12 CAK=4.50E-13
    .SUBCKT TRIODENH A G K
    +PARAMS: LIP=1 LIF=3.7E-3 RAF=18E-3 RAS=1 CDO=0 RAP=4E-3

  • ERP=1.5

  • MU0=17.3 MUR=19E-3 EMC=9.6E-6 GCO=0 GCF=213E-6

  • CGA=3.9p CGK=2.4p CAK=0.7p
    .ENDS TRIODENH
    .ENDS 12AU7

If this does not work, you should make a library file with all your subcircuits and call out that library file from your custom symbols.

@dekRe

A generic symbol Triode-NoHeater.qsym is created for this purpose.
Triode-NoHeater.qsym (797 Bytes)

You must have vacuum.sub with schematic in same directory to make thing work. These are 2 files require to run this simulation example
Tube-Test.qsch (5.2 KB)
LTSpice-IV-Models/parts/vacuum.sub at master · aempirei/LTSpice-IV-Models (github.com)

The idea to make this library work is simple. You just need the symbol to call the entire library. Think about that, vacuum.sub actually include all .subckt. What you need to call to use is <model name> in .SUBCKT <model name> A G K
Therefore, create one symbol, and <model name> is assigned after you pull this symbol into schematic. For example, if you need ECC82 (no heater model), the subckt is .SUBCKT NH12AU7 A G K (be careful, ECC82 is NOT a subckt name, you have to use NH12AU7), and in schematic, you just assign model name as NH12AU7 and this .subckt and it corresponding .subckt will all be called by this simulation.

3 Likes

Works perfect! Thank You Very Much!!!

I just get an error message: Fatal error: Unresolved subcircuit in: X1 OUT N03 N02 NH12AU7 but I can’t work out the cause, any suggestions please.

I download three files from #6 post and verified still working.
Can you re-download these 3 files and re-try. Or upload your file and let me try that.

I ran a test with these two files in same folder and it work fine so far in latest Qspice version.

  • Tube-Test.qsch
  • vacuum.sub

Kelvin

I put all three files into E:\Users\Steven\Documents\QSPICE\Triode as I wasn’t sure where to put the vacuum.sub file.
Triode-NoHeater.qsym (797 Bytes)
Tube-Test.qsch (5.2 KB)

Downloaded three files again but same error message.

Using latest version of QSPICE.

May be re-try this. I modify .qsch and .qsym with library file as vacuum.txt, in this way, I can upload vacuum.txt in forum.
Don’t change anything in library file of symbol X1, just copy in same folder, run .qsch.
If it still don’t work, it is very weird to me. My concern is that you may have a corrupt library file vacuum.sub

(Make sure you download these three files, and put into same folder. Remark: .qsym is not necessary to run Tube-Test.qsch, only you need to drag a symbol to a new schematic, you need .qsym)
Triode-NoHeater.qsym (794 Bytes)
Tube-Test.qsch (5.2 KB)
vacuum.txt (15.5 KB)

Kelvin

1 Like

Fantastic now it works:
E:\Users\Steven\Documents\QSPICE\Triode\Tube-Test.qsch
Total elapsed time: 0.0173411 seconds.
and I get the same waveforms
Thank you for your help

One thing that is different is that vacuum.sub is a large file full of code (JavaScript?) and URLs but vacuum.txt is human readable and contains obvious .subckt data for a variety of tubes.

Here is download from Github. Possibly something goes wrong when you get vacuum.sub.
This download file should be exactly the same as my upload vacuum.txt.

1 Like

Yes vacuum.sub from GitHub is the same as vacuum.txt it was my mistake I downloaded the GitHub html without opening the web page first as I didn’t spot it was a page link, not a file link.