Improved vacuum tube models for SPICE simulations

Part 2: Listings and PSpice operation

by Norman L. Koren


Updated September 3, 2001
Back to part 1: Models and example | Norman Koren Vacuum tube audio page
Finding SPICE tube model parameters
View image galleries
Google
Search WWW Search www.normankoren.com 
Table of contents Part 1  | Equations for vacuum tubes  |  New equations  |  SPICE  | Parameters
Finding parameters by trial-and-error  |  Plate curves  |  Output transformers
Example: original PAS preamplifier  |  Lessons
Part 2  | Appendix A: Listings  |  Appendix B: Operation with PSpice Schematics
.
Much of the material in here originally appeared in Glass Audio, Vol. 8, No. 5, 1996, p. 18.
As my principal hobby interest is now photography, I won't have much time to update this article or answer difficult questions.
Best viewed in Internet Explorer 5. I have trouble making the Greek letters pi (p) and Omega (W) display in Netscape.
LTspice can apparently be used for these models.

Appendix A: Listings

1. Characteristic plate curve program for triodes

Old program
TRIODE PLATE CHARACTERISTIC CURVES
.DC LIN V_P 0 400 4 ; V_P IS THE SUPPLY VOLTAGE. I(VP) IS OUTPUT.
V_P 101 0 200 ; PLATE VOLTAGE
VP 101 102 0 ; DUMMY V SOURCE FOR POSITIVE PLATE CURRENT PLOT.

VG 1 0 -1 ; GRID VOLTAGE.
R1 0 1 1G ; ASSURES THAT GRID IS NOT FLOATING.

X1 102 1 0 12AX7 ; P G C
.STEP LIN VG 0 -4 .5 ; FOR 12AX7
* X1 102 1 0 12AU7 ; P G C
* .STEP LIN VG 0 -20 4 ; FOR 12AU7
* X1 102 1 0 6DJ8 ; P G C
* .STEP LIN VG 0 -4 .5 ; FOR 6DJ8

.LIB C:\PSPICE\WORK\TUBE.LIB
.PROBE I(VG) I(VP)
.OPTIONS NOPAGE

.END

Triotest.cir
* C:\Audio\TubeShar\Triotest.sch

* Schematics Version 6.3 - April 1996
* Sun Sep 02 10:40:50 2001

** Analysis setup **
.DC LIN V_VP 0 400 4
.STEP LIN V_VG 0 -20 -4
.LIB c:\audio\tubeshar\tube97.lib

* From [SCHEMATICS NETLIST] section of msim.ini:
.lib C:\AUDIO\TubeShar\TUBE.LIB
.lib nom.lib
.INC "Triotest.net"
.INC "Triotest.als"

.probe

.END

Triotest.net
* Schematics Netlist *

V_VG         1G 0 DC 0 AC 0
V_VP         1P 0
X_TU1         1P 1G 0 12AU7

2. Characteristic plate curve program for pentodes

Old program

Set TRIMODE to 0 for pentode mode, 40 for ultra-linear mode (40% tap), or 100 for triode mode. Set VG2NOM to the screen grid voltage in pentode mode or to the quiescent (no ac signal) plate voltage in ultra-linear mode. VG2NOM has no effect in triode mode.

PENTODE CHARACTERISTIC CURVES

* SET THESE TWO PARAMETERS FOR MODE (PENTODE, UL, TRIODE)
.PARAM TRIMODE = 100 ; % TRIODE MODE (0=PENT; 40=UL; 100=TRIODE)
.PARAM VG2NOM = 300 ; NOMINAL VALUE OF GRID 2 VOLTAGE.
.STEP LIN VG1 0 -75 -10 ; 15 -75 -15 ; STEPS FOR PLATE CURVES

.PARAM T1 = {TRIMODE/100}, T2 = {1-T1} ; FRACTION TRIODE MODE...
V_P 101 0 400 ; PLATE VOLTAGE
VP 101 1 0 ; DUMMY V SOURCE FOR POSITIVE PLATE CURRENT PLOT.
EG2 102 0 VALUE={VG2NOM*T2+T1*V(101,0)} ; GRID 2 VOLTAGE
VG2 102 4 0 ; FOR G2 CURRENT MEAS.
VG1 2 0 0 ; CONTROL GRID VOLTAGE
VC 3 0 0 ; FOR CATHODE CURRENT MEAS.
X1 1 2 3 4 KT88 ; P G1 C G2
.DC LIN V_P 0 600 5 ; VB IS THE SUPPLY VOLTAGE. I(VB) IS OUTPUT.
.PROBE I(VC) I(VP) I(VG2) I(VG1)
.OPTIONS NOPAGE LIBRARY
.LIB C:\PSPICE\WORK\TUBE.LIB
.END

Pent_P.cir
* C:\Audio\TubeShar\Pent_P.sch

* Schematics Version 6.3 - April 1996
* Sun Sep 02 12:29:32 2001

** Analysis setup **
.DC LIN V_VP 0 600 5
.STEP LIN V_VG1 0 -50 -10

* From [SCHEMATICS NETLIST] section of msim.ini:
.lib C:\AUDIO\TubeShar\TUBE.LIB
.lib nom.lib
.INC "Pent_P.net"
.INC "Pent_P.als"

.probe

.END

Pent_P.net
* Schematics Netlist *

V_VG1         1G 0 DC 0 AC 0
V_VP         1P 0 DC 0 AC 0
V_VG2NOM         $N_0001 0 DC 300 AC 0
E_E2         2G 0 VALUE { V($N_0001, 0)*1+V(1P)*0 }
X_TU1         1P 1G 0 2G 6550

3. A portion of the tube library (C:\PSPICE\WORK\TUBE.LIB)

Tubes are stored as subcircuits, starting with .SUBCKT and ending with .ENDS. A subcircuit for a toroidal output transformer has been included. To add a tube, copy the entire subcircuit (triode or pentode, as appropriate), replace the name (e.g., 6550 with 6L6GC), and then change the parameters (following PARAMS: on the continuation lines of .SUBCKT) to the appropriate values from TABLE 1 or from your own calculations. Note that the suffixes (K, P, MEG, etc.) are part of the value and are case-insensitive: K = kilo (103); MEG = mega (106); G = giga (109); M = mil (10-3); U = micro (10-6); N = nano (10-9); P = pico (10-12), and so on. Spaces are not allowed between the number and the suffix. Beware confusing M and MEG! In the PSpice PROBE program (for displaying graphs), there is some case sensitivity: m is mil and M is meg. Confusing?
TUBE LIBRARY

.SUBCKT 6550 1 2 3 4 ; P G1 C G2 (PENTODE)
+ PARAMS: MU=7.9 EX=1.35 KG1=890 KG2=4200 KP=60 KVB=24
+ CCG=14P CPG1=.85P CCP=12P RGI=1K
RE1 7 0 1MEG ; DUMMY SO NODE 7 HAS 2 CONNECTIONS
E1 7 0 VALUE= ; E1 BREAKS UP LONG EQUATION FOR G1.
+{V(4,3)/KP*LOG(1+EXP((1/MU+V(2,3)/V(4,3))*KP))}
G1 1 3 VALUE={(PWR(V(7),EX)+PWRS(V(7),EX))/KG1*ATAN(V(1,3)/KVB)}
G2 4 3 VALUE={(EXP(EX*(LOG((V(4,3)/MU)+V(2,3)))))/KG2}
RCP 1 3 1G ; FOR CONVERGENCE
C1 2 3 {CCG} ; CATHODE-GRID 1
C2 1 2 {CPG1} ; GRID 1-PLATE
C3 1 3 {CCP} ; CATHODE-PLATE
R1 2 5 {RGI} ; FOR GRID CURRENT
D3 5 3 DX ; FOR GRID CURRENT
.MODEL DX D(IS=1N RS=1 CJO=10PF TT=1N)
.ENDS

.SUBCKT 12AX7 1 2 3 ; P G C; NEW MODEL (TRIODE)
+ PARAMS: MU=100 EX=1.4 KG1=1060 KP=600 KVB=300 RGI=2000
+ CCG=2.3P CGP=2.4P CCP=.9P ; ADD .7PF TO ADJ PINS, .5 TO OTHERS.
E1 7 0 VALUE=
+{V(1,3)/KP*LOG(1+EXP(KP*(1/MU+V(2,3)/SQRT(KVB+V(1,3)*V(1,3)))))}
RE1 7 0 1G
G1 1 3 VALUE={(PWR(V(7),EX)+PWRS(V(7),EX))/KG1}
RCP 1 3 1G ; TO AVOID FLOATING NODES IN MU-FOLLOWER
C1 2 3 {CCG} ; CATHODE-GRID
C2 2 1 {CGP} ; GRID=PLATE
C3 1 3 {CCP} ; CATHODE-PLATE
D3 5 3 DX ; FOR GRID CURRENT
R1 2 5 {RGI} ; FOR GRID CURRENT
.MODEL DX D(IS=1N RS=1 CJO=10PF TT=1N)
.ENDS

.SUBCKT PAT-4006-CFB 1 2 3 4 5 6 7 8 9 10 11
* PLITRON PAT-4006-CFB OUTPUT TRANSFORMER
* OL NUMBERS CORRESPOND TO TRANSFORMER SCHEMATIC.
* RESISTANCES HAVE BEEN OMITTED FOR SIMPLICITY, BUT MAY BE ADDED.
LP1 1 2 35.325H ; PRIMARY
LP2 2 3 15.7H

LP3 3 4 15.7H
LP4 4 5 35.325H
CP1 1 5 .342NF ; CAPACITANCE FROM SPECS
LP5 8 7 .2453125H ; 1/2 SPEAKER SECONDARY
LP6 7 6 .2453125H ; " "
LP7 11 10 .98125H ; 1/2 FBK WINDING
LP8 10 9 .98125H ; " "
KALL LP1 LP2 LP3 LP4 LP5 LP6 LP7 LP8 .9999987 ; = 1-1/(2*403600)
.ENDS

4. Original PAS line amplifier

A and B are the output of Schematics. C is the output of PSpice. These files are edited for brevity.

A. The control file: PASorgTC.cir

Note that it calls the netlist, PASorgTC.net, using an .INC statement. Commands are not case-sensitive.

* C:\PSPICE\Stphl\PASorgTC.sch

* Schematics Version 6.3 - April 1996  Sat Nov 25 20:09:33 2000

.PARAM         PARTX={(EXP(4.60517*PAR1)-1)/99} PAR1=.5
** Analysis setup **
.ac DEC 20 .01 1MEG
.LIB C:\Pspice\WORK\Tube.lib
.OP
* From [SCHEMATICS NETLIST] section of msim.ini:
.lib nom.lib
.INC "PASorgTC.net"
.INC "PASorgTC.als"

.probe

.END

B. The netlist (circuit description): PASorgTC.net

The typical format is  elemant_name  node_1  node_2  ...  value(s).  The order isn't critical.

* Schematics Netlist *

RT_RVOL         0 3G {(250K*(1-0.5))+.001}
RB_RVOL        3G LINE_IN {(250K*0.5)+.001}
R_R3C         0 3C  4.7k
R_R4G         0 4G  1.2MEG
R_R3P         3P $N_0001  470k
R_R4C         0 4C  1k
R_R4P         4P $N_0001  100k
R_RLFB         3C $N_0002  47k
R_RLOAD         0 LINE_OUT  50k
C_C3P         3P $N_0003  .1UF
C_COUT         $N_0004 LINE_OUT  1UF
C_C4P         4P BC  .22UF
R_R4GS         $N_0003 4G  18k
C_C4F2         SF1 4G  4000PF
C_CLFB         3C $N_0002  33PF
C_C4F1         SF1 $N_0003  1500PF
R_R4F         0 SF1  3.3MEG
RT_RBASS         $N_0004 BC {(750K*(1-(1-PAR1)))+.001}
RB_RBASS        BC $N_0002 {(750K*(1-PAR1))+.001}
RT_RTREB         $N_0006 $N_0007 {(400K*(1-(1-PARTX)))+.001}
RB_RTREB        $N_0007 $N_0005 {(400K*(1-PARTX))+.001}
C_CTR2         $N_0006 0  .02UF
R_RTR1         3C $N_0007  1k
C_CTR1         $N_0005 $N_0002  .002UF
C_CBS1         $N_0002 BC  .0075UF
C_CBS2         BC LINE_OUT  .0075UF
V_VIN         LINE_IN 0 DC 0 AC 1 SIN(0  .5  1K)
V_V+320         V+320 0 DC 320
X_TU3         3P 3G 3C 12AX7
X_TU4         4P 4G 4C 12AX7
v_V10         V+320 $N_0001 0

C. The PSpice output file (edited for brevity) for frequency domain analysis: PASorgTC.out
 
**** 08/18/101 17:12:08 ******** NT Evaluation PSpice (April 1996) ***********

 * C:\PSPICE\Stphl\PASorgTC.sch

(... The .cir file is repeated here... )
 ****     CIRCUIT DESCRIPTION
(The entire netlist is repeated... )
RT_RVOL         0 3G {(250K*(1-0.5))+.001}
...
v_V10         V+320 $N_0001 0

**** RESUMING PASORGTC.CIR ****
.INC "PASorgTC.als"

**** INCLUDING PASorgTC.als ****
* Schematics Aliases *

(Aliases are listed here; not of much interest to the user.)
_    _(V+320=V+320)
.ENDALIASES

...

 ****     Diode MODEL PARAMETERS (... not of much interest; edited out...)

This is the important part: shows voltages and currents at critical locations.
 ****     SMALL SIGNAL BIAS SOLUTION       TEMPERATURE =   27.000 DEG C
******************************************************************************

 NODE   VOLTAGE     NODE   VOLTAGE     NODE   VOLTAGE     NODE   VOLTAGE

(   3C)    1.5171  (   3G) 62.59E-06  (   3P)  168.2900  (   4C)    1.2431
(   4G)     .0012  (   4P)  195.6900  (   BC)    1.5171  (  SF1)    0.0000
(V+320)  320.0000  ($N_0001)  320.0000                   ($N_0002)    1.5171
($N_0003)     .0012                   ($N_0004)    1.5171
($N_0005)    1.5171                   ($N_0006)    1.5171
($N_0007)    1.5171                   (LINE_IN)    0.0000
(X_TU3.5) 64.60E-06                   (X_TU3.7)     .2832
(X_TU4.5)     .0012                   (X_TU4.7)     .7422
(LINE_OUT)    0.0000

    VOLTAGE SOURCE CURRENTS
    NAME         CURRENT

    V_VIN        5.008E-10
    V_V+320     -1.566E-03
    v_V10        1.566E-03

    TOTAL POWER DISSIPATION   5.01E-01  WATTS

(Additional information on voltage and current sources follows; not of much interest... )
          TOTAL JOB TIME             .61

Appendix B: Operation with PSpice Schematics program

Although I started out running Pspice from ASCII data files, entering schematic diagrams via the Pspice Schematics program is the most satisfying, accurate and up-to-date way to operate. Since MicroSim doesn't supply a library of tube symbols, you will need to enter one (from the downloaded models) or create your own. Libraries of schematic symbols are stored in files with the extension .SLB and libraries of SPICE models are stored in files with the extension .LIB. (Each of these files contains symbols or models for several parts: up to 25 for the MicroSim evaluation package.) I use TUBE.SLB and TUBE.LIB for my tube drawings and models.

Adding libraries to Evaluation PSpice


After you've installed PSpice on your computer you must install or create the tube models.  Although PSpice is up to level 9.1 as I write this, I use version 6.3 for this example because I'm familiar with it and because you can also get away with a few more parts than newer versions allow. I assume you've downloaded my models. You'll need to install two files: the tube symbols (TUBE.SLB) and SPICE models (TUBE.LIB). Both are installed from the Schematics program.

Installing the symbol library (TUBE.SLB)--  From the Schematics screen, click Options, Editor Configuration..., Library Settings. The screen on the right appears. Enter the foll pathname of the file containing the schematics symbols, except for the extension, in the Library Name: window, C:\NORMK\AUDIO\TubeShar\TUBE in the example. Check the box to the left of Symbol to get the .slb file extension. Click OK, OK.

Window for entering .slb symbol library

 

Installing the SPICE model library (TUBE.LIB)-- From the Schematics Screen, click Analysis, Library and Include Files... The screen on the right appears. Enter the full pathname of the SPICE model file (including extension) in the File Name: window, C:\NORMK\AUDIO\TubeShar\TUBE.LIB in the example. Click Add Library*, OK, OK.

PSpice should be ready to run with tubes!

Creating your own models

The technique for linking drawings to models is quite complex, and the PSpice tutorial must be studied to grasp it. It would be wise to look it over before continuing! The following steps will bring up a good example that can be adapted for tube models. From Schematics, click on File, Edit Library to get into the Parts Library editor. Click on File, Open..., eval.slb to open a library file that contains some parts useful as examples. (Be patient: Your screen will still be blank at this point.) Click on Part, Get..., IRF9410 to load the drawing for a P-channel mosfet. (Choose another part if you desire, but this MOSFET is as close as you can get to a tube in this library.) Click on Part, Attributes... to see the statements that define this part. For the IRF9410, they are
template=M^@refdes %d %g %s %s @MODEL
refdes=M?

PART=IRF9140
MODEL=IRF9140

Template links the part to the model library: With appropriate substitutions, for example, IRF9140 for @MODEL, it appears in the netlist. A number on the schematic diagram replaces ? in refdes. To alter an attribute, click on it in the box on the right and edit it in the boxes on the upper left. The attributes of the 12AX7 that link it to its subcircuit in TUBE.LIB are:
template=X^@REFDES %P %G %C @MODEL
refdes=TU?
PART=12AX7
MODEL=12AX7
To create a new library file, click on File, New, then File, Save as..., tube.slb (or a full path name of your choice). To insert a part into the new library file, draw it following instructions in the tutorial or modify an existing part (such as the IRF9410), then save it by clicking Part, Save to Library... Either type the library file name or use the usual Windows navigation techniques to locate it. Good luck and please do the tutorial.

Parts are entered into PSpice Schematics drawings by clicking on the little box with the "and" gate. You can enter "R", "L", "C", "BUBBLE", etc. for common parts, or click on Browse... to examine a library of parts. I recommend using the rubberband option, which can be set by clicking Options, Display Options..., Rubberband. Named nodes (1G, 1P, etc.), which are created by double-clicking on lines and entering a name, are required for voltages to be examined in Probe. Input files to Schematics have the three character extension .SCH. Clicking Analysis, Create Netlist creates files with extensions .CIR (the control file), .NET (the netlist), and .ALS (an alias file which speeds up analysis) which are used as inputs to PSpice. The .CIR and .NET files contain ASCII text in SPICE format, as described in Paul Tuinenga's excellent text10. Clicking Analysis, Simulate creates the netlist, runs Pspice, and loads Probe to display results. Press the Insert key to select a voltage or current for Probe display. You can use "VDB" or "VP" to display a voltage in dB or its phase in degrees. There are many more possibilities for controlling the display.

Obtaining plate curves

Figures 3 and 4 on the previous page are schematics diagrams for generating triode and pentode characteristic curves. Their netlists are shown in Appendices A1 and A2. Each of these circuits requires that you perform a few added steps to generate the characteristic curves. We will use the pentode (Fig. 4) as an example.

To step the grid voltage, click on Analysis, Setup..., Parametric... Set Swept Var. Type to Voltage Source, Sweep Type to Linear, Name: to VG1, Start Value to 0, End Value: to -75 (or as appropriate), and Increment: to -15 (or as appropriate), then click OK. You may set the plate voltage sweep while the Analysis Setup... box is still open. Click DC Sweep... Set Swept Var. Type to Voltage Source, Sweep Type to Linear, Name: to VP, Start Value to 0, End Value: to 600 (or as appropriate), and Increment: to 5 (or as appropriate), then click OK. The DC Sweep... and Parametric boxes should contain check marks. Finally, click Close. All voltage sources except VG2NOM are set to DC=0 in the schematic diagram. (Attributes can be viewed and changed by double-clicking on the symbol.) Grid and plate voltages are controlled by the DC Sweep... and Parametric... settings.

VG2NOM is the nominal screen grid voltage. It is 300V in Figure 5 (pentode mode) and 450V in Figure 7 (ultra-linear (UL) mode). (It has no meaning in triode mode, where screen grid voltage equals the plate voltage). E2 is an EVAL voltage-controlled voltage source that controls how the screen grid voltage tracks the plate voltage. For Ultra-Linear mode it is set to V(%IN+, %IN-)*.4+V(1P)*.6 . For pentode mode it is V(%IN+, %IN-). For triode mode it is V(1P). VP is set to zero: -I(VP) is the correct polarity for plate current plotted by Probe. When you have completed entering the schematic, click Analysis, Simulate. This will create a netlist, run PSpice, and then run Probe to display the results. Error messages can appear at any one of several stages of this process. They are unavoidable when you start out. Don't get frustrated. This is where real learning happens.

REFERENCES

  1. Scott Reynolds, "Vacuum-tube models for PSPICE simulations," Glass Audio, vol. 5, no. 4, 4/93 p. 17.
  2. W. Marshall Leach, Jr., "SPICE models for vacuum-tube amplifiers," J. Audio Eng. Soc. Vol 43, No. 3, March 1995, p. 117.
  3. Samuel Seely, "Electron Tube Circuits," McGraw-Hill, 1958, pp. 11-13,15-16; pentode grid current in Fig. B-6, p. 666.
  4. Tom Mitchell, "The Audio Designer's Tube Register Volume 1," Media Concepts, Norwalk, CA.
  5. Eric Pritchard, "Tube-model critique," Glass Audio, vol. 8, no. 1, 1/96, p. 54.
  6. Stereophile, vol 16, no. 11, Nov. 1993, p. 153; vol. 17, no. 3, Mar. 1994, p. 129; vol. 17, no. 5, Apr. 1994, p. 184; vol. 17, no. 6, June 1994, p. 131; vol. 17, no. 10, Oct. 1994, p. 143; vol. 17, no. 12, Dec. 1994, p.163.
  7. Christopher Paul, "The greening of the cascade feedback pair," Glass Audio, vol. 7, no. 5, 5/95, p. 20.
  8. Norman Koren, "A new Dynaco PAS upgrade," Glass Audio, vol. 6 no. 2, 2/94, p. 10.
  9. Menno Vanderveen, "Theory and practice of wide bandwidth toroidal output transformers", presented at the 97th AES convention, Nov. 1994.
  10. Paul W. Tuinenga, "SPICE, A Guide to Circuit Simulation & Analysis using PSpice", Prentice-Hall, 1992 or 1995 editions.


Back to part 1: Models and example | Norman Koren Vacuum tube audio page
Finding SPICE tube model parameters
.

visits to this page
since December 8, 2003
Images and text copyright 2001-2003 by Norman Koren. Norman Koren lives in Boulder, Colorado, where he worked in developing magnetic recording technology for high capacity data storage systems through 2001. He has been involved with photography since 1964. Designing vacuum tube audio amplifiers was his passion between about 1990 to 1998.