Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tube models for circuitmaker spice, regular spice models

595 views
Skip to first unread message

Robert Casey

unread,
Mar 9, 2003, 11:17:36 PM3/9/03
to
I'm just beginning to figure out how to work the student version of
circuit maker. I can edit via notepad the "*.sub" file, which
look like

*======================================
*Triode Pinouts: Plate Grid Cathode
*======================================

*Vacuum Tube Triode (Audio freq.)


*Vacuum Tube Triode (Audio freq.) pkg:VT-9 (A:1,2,3)(B:6,7,8)
.SUBCKT X12AU7 1 3 4
B1 2 4 I=((URAMP((V(2,4)/18)+V(3,4)))^1.5)/1151
C1 3 4 1.6E-12
C2 3 1 1.5E-12
C3 1 4 0.5E-12
R1 3 5 10E+3
D1 1 2 DX
D2 4 2 DX2
D3 5 4 DX
.MODEL DX D(IS=1.0E-12 RS=1.0)
.MODEL DX2 D(IS=1.0E-9 RS=1.0)
.ENDS X12AU7


Now the 12AU7 model I can download looks like:

* 12AU7A Triode PSpice Model 8/96, Rev. 1.0 (fp)
*
* -------------------------------------------------------------------
* This model is provided "as is", with no warranty of any kind,
* either expressed or implied, about the suitability or fitness
* of this model for any particular purpose. Use of this model
* shall be entirely at the user's own risk.
*
* For a discussion about vacuum tube modeling please refer to:
* W. Marshall Leach, jr: "SPICE Models for Vacuum-Tube Amplifiers";
* J. Audio Eng. Soc., Vol 43, No 3, March 1995.
* -------------------------------------------------------------------
*
* This model is valid for the following tubes:
* 12AU7A/ECC82, 6680, 6C4/EC90, 12DW7/7247 (Unit #2);
* at the following conditions:
* Plate voltage : 0..400V
* Grid voltage : 0..-18V
* Cathode current: 0..30mA
*
*
* Connections: Plate
* | Grid
* | | Cathode
* | | |
.SUBCKT 12AU7A P G K
E1 2 0 VALUE={V(P,K)+18.28*V(G,K)}
R1 2 0 1.0K
Gp P K VALUE={10.88E-6*(PWR(V(2),1.5)+PWRS(V(2),1.5))/2}
Cgk G K 1.6P
Cgp G P 1.5P
Cpk P K 0.5P
.ENDS 12AU7A

And a 12AT7 is:

* 12AT7 Triode PSpice Model 8/96, Rev. 1.0 (fp)
*
* -------------------------------------------------------------------
* This model is provided "as is", with no warranty of any kind,
* either expressed or implied, about the suitability or fitness
* of this model for any particular purpose. Use of this model
* shall be entirely at the user's own risk.
*
* For a discussion about vacuum tube modeling please refer to:
* W. Marshall Leach, jr: "SPICE Models for Vacuum-Tube Amplifiers";
* J. Audio Eng. Soc., Vol 43, No 3, March 1995.
* -------------------------------------------------------------------
*
* This model is valid for the following tubes:
* 12AT7/ECC81, 6AB4/EC92, 6201, 6679;
* at the following conditions:
* Plate voltage : 0..500V
* Grid voltage : 0..-8V
* Cathode current: 0..30mA
*
*
* Connections: Plate
* | Grid
* | | Cathode
* | | |
.SUBCKT 12AT7 P G K
E1 2 0 VALUE={V(P,K)+63.19*V(G,K)}
R1 2 0 1.0K
Gp P K VALUE={6.717E-6*(PWR(V(2),1.5)+PWRS(V(2),1.5))/2}
Cgk G K 2.2P
Cgp G P 1.5P
Cpk P K 0.5P
.ENDS 12AT7

Now I can see that the interelectrode capacitence lines are obvious, but

how would I modify the "*.sub" file at the top to change it from a
12AU7 to a 12AT7. It would take more than changing the name,
obviously. Say I know the mu, gm and rp, how do I convert that
to modify the sub file above? Is Circuit maker using a propriety
format?


Gregg

unread,
Mar 10, 2003, 1:08:28 AM3/10/03
to
Behold, Robert Casey scribbled:

> how would I modify the "*.sub" file at the top to change it from a 12AU7
> to a 12AT7. It would take more than changing the name, obviously. Say
> I know the mu, gm and rp, how do I convert that to modify the sub file
> above? Is Circuit maker using a propriety format?

No, circuit maker uses a modified version of the Berkley 3f4 SPICE format.
It is much more common than Pspice.

It is super easy to change any 3f4 format into Circuitmaker. At the
beginning where it has the model number, preceed this with an X, so 12AT7
becomes X12AT7 for example. At the end, where it says ".ENDS", add the
X[model number] after it and it's ready to rock!

The only limitation is you cannot add any more schematic symbols - so
adding an 829B for example is out of the question. But you can add
limitless triodes, tetrodes and pentodes.

That's how to IMPORT a 3f4 model, but how do you make one? Easy. Load your
NFET curve tracer and modify it thusly:

- Find curves for your triode.
- add triode (I haven't figured out pentodes yet) in place of FET
- Change the DC properties of the analasys to match the voltage ratings
for the tube. Say it has a Va of 0 to 600V in 10 volt increments and a
Vg1 of 0 to -100V in 1 (or 5) volt increments. Run the analasys and
notice the curves on the curve tracer.
- Open the model by right clicking on the tube and choose "edit".
- Adjust the part of the SPICE model. This will be mainly the values
after the "/" and "^". In your example of the 12AU7, /18, ^1.5 and
/1151 are really the only three numbers that'll be changed to give you
a new model.
- Save and re-run analasys.
- Keep doing this until you have the closest resulting curve to the
datasheet.

So, on the model, which does what? Need more non-linear curve at low Va,
increase the ^1.5. Need more linearity? Decrease it. All in increments of
0.1. Adjusting the /18 there, will change the individual trace spacing
(use in/decrements of 1) and the /1151 will change the Y position on the
Ia scale (use increments of 50, then 25 for fine-tune). With those
numbers, you can make the model be any tube you want :-)

--
Gregg
*It's probably useful, even if it can't be SPICE'd*

Ian Iveson

unread,
Mar 10, 2003, 1:06:38 AM3/10/03
to
"Robert Casey" <wa2...@ix.netcom.com> wrote

> I'm just beginning to figure out how to work the student version
of
> circuit maker. I can edit via notepad the "*.sub" file, which

> look like...[snip lots]

Gregg will be here soon:-)

CircuitMaker is spice 3f4, as far as I can tell. If it doesn't
recognise Pspice, then it won't run Pspice code.

You have two problems here that you must not confuse.

First, the code you have imported is Pspice, and will need
translating to 3f4.

Second, the models may turn out to use different mathematical
formulae (there are many possible ways of approximating valve
behaviour mathematically, regardless of which spice is used).

You have both of these problems. If you look at the first line of
the CircuitMaker model, detailing the current generator B1, you see
several real numbers: 18, 1.5, and 1151. The URAMP is a function to
force -ve results to zero. The V(a,b) parts are the voltages
between pins, where (a,b) are the pin numbers or connection nodes.
Note you have a dummy node 2. Looking at the Pspice models, the 18
and 1151 don't seem likely substitutions. It is a more
sophisticated model perhaps? Not easy to tell without translating
both to their mathematical expressions.

The stuff with asterisks is ignored by spice but may be significant
to the CircuitMaker interface.

Check Duncan Munro's site for some useable 3f4 models. Translation
from Pspice is not very hard but you do need to know a bit about
both dialects.

The resident CircuitMaker models are *very* primitive, and will only
approximate to the middle portion of characteristics. No model for
+ve grid, probably hard clipping, and infinite current capability.
The good thing about it is that, by just changing the real numbers
in the code, you should be able to get close to any valve. Use the
transfer function graph and fiddle until it looks like what you
want. Then save under a new name.

My simulator is 3f5 but it autotranslates from Pspice and I can get
very confused as a result.

cheers, Ian

Gregg

unread,
Mar 10, 2003, 4:17:10 AM3/10/03
to
I forgot to mention, use a text editor (like Notepad) to duplicate a
triode or tetrode entry BEFORE modification, lest you'll have the new
model and be out your old one :-(

When you duplicate it, rename it the model you are wanting to create ;-)

Robert Casey

unread,
Mar 11, 2003, 11:44:29 PM3/11/03
to
Gregg wrote:

> Behold, Robert Casey scribbled:
>
> > how would I modify the "*.sub" file at the top to change it from a 12AU7
> > to a 12AT7. It would take more than changing the name, obviously. Say
> > I know the mu, gm and rp, how do I convert that to modify the sub file
> > above? Is Circuit maker using a propriety format?
>
> No, circuit maker uses a modified version of the Berkley 3f4 SPICE format.
> It is much more common than Pspice.
>
> It is super easy to change any 3f4 format into Circuitmaker. At the
> beginning where it has the model number, preceed this with an X, so 12AT7
> becomes X12AT7 for example. At the end, where it says ".ENDS", add the
> X[model number] after it and it's ready to rock!
>

Thanks for the advice. I've made some progress, but some of the
3f4 spice models makes circuitmaker barf. Most don't but a few do.
The below 6DJ8 model bombs circuitmaker:

.SUBCKT X6DJ8 A G K
* ANODE MODEL
BLIM LI 0 V=(URAMP(V(A)-V(K))^ 1.5 )* 10
BGG GG 0 V=V(G)-V(K)- 0
BRP1 RP1 0 V=URAMP(-V(GG)* 0.09 )
BRP2 RP2 0 V=V(RP1)-URAMP(V(RP1)-0.999)
BRPF RP 0 V=(1-V(RP2)^ 0.2 )+URAMP(V(GG))* 0
BGR GR 0 V=URAMP(V(GG))-URAMP(-(V(GG)*(1+V(GG)* 0.02 )))
BEM EM 0 V=URAMP(V(A)-V(K)+V(GR)* 33 )
BEP EP 0 V=(V(EM)^ 1.35 )*V(RP)* 0.0000795
BEL1 EL1 0 V=URAMP(V(EP))
BEL EL 0 V=V(EL1)-URAMP(V(EL1)-V(LI))
BLD LD 0 V=URAMP(V(EP)-V(LI))
BAK A K I=V(EL)
* GRID MODEL
BGF GF 0 V=(URAMP(V(G)-V(K)--0.2 )^1.5)* 0
BG G K I=V(GF)+V(LD)
* CAPS
CAK A K 0.0000000000018
CGK G K 0.0000000000033
CGA G A 0.0000000000014
.ENDS X6DJ8

and I get these errors:

Error: 0, -0.8 out of range for ^
Error: 0, -0.8 out of range for ^
Note: starting Gmin stepping
Error: 0, -0.8 out of range for ^
Warning: Gmin step failed
Error: 0, -0.8 out of range for ^
Warning: Gmin stepping failed
Note: starting source stepping
Error: 0, -0.8 out of range for ^
Warning: source stepping failed
doAnalyses: No such parameter on this device

run simulation(s) aborted
Circuit: *Spice netlist for Circuit: C:\Program
Files\cm60s\Circuits\triodecurv.ckt
Date: Tue Mar 11 23:38:52 2003

Total elapsed time: 0.330 seconds.

I haven't figure out what these mean or how to fix yet.

Gregg

unread,
Mar 12, 2003, 5:29:11 AM3/12/03
to
Behold, Robert Casey scribbled:

> Thanks for the advice. I've made some progress, but some of the 3f4
> spice models makes circuitmaker barf. Most don't but a few do. The
> below 6DJ8 model bombs circuitmaker:

<snip>

Tell you what, here's my triode.sub file with tons of funtional goodies
;-)

*======================================
*Triode Pinouts: Plate Grid Cathode
*======================================

*Vacuum Tube Triode (Audio freq.)

.SUBCKT X6SN7 1 3 4
B1 2 4 I=((URAMP((V(2,4)/20)+V(3,4)))^1.5)/1086
C1 3 4 2.6E-12
C2 3 1 4.0E-12
C3 1 4 0.7E-12


R1 3 5 10E+3
D1 1 2 DX
D2 4 2 DX2
D3 5 4 DX
.MODEL DX D(IS=1.0E-12 RS=1.0)
.MODEL DX2 D(IS=1.0E-9 RS=1.0)

.ENDS X6SN7

*Vacuum Tube Triode (Audio freq.) pkg:VT-9 (A:1,2,3)(B:6,7,8)
.SUBCKT X12AU7 1 3 4
B1 2 4 I=((URAMP((V(2,4)/18)+V(3,4)))^1.5)/1151
C1 3 4 1.6E-12
C2 3 1 1.5E-12
C3 1 4 0.5E-12
R1 3 5 10E+3
D1 1 2 DX
D2 4 2 DX2
D3 5 4 DX
.MODEL DX D(IS=1.0E-12 RS=1.0)
.MODEL DX2 D(IS=1.0E-9 RS=1.0)
.ENDS X12AU7

*Vacuum Tube Triode (Audio freq.) pkg:VT-9 (A:1,2,3)(B:6,7,8)

.SUBCKT X12AX7A A G K
*
* Calculate contribution to anode current
*
Bcaca 0V=45+V(A,K)+95.43*V(G,K)
*
* Reduction at low va
*
Brere 0V=URAMP(V(A,K)/5)-URAMP(V(A,K)/5-1)
BaaA KI=V(re)*1.147E-6*(URAMP(V(ca))^1.5)
*
* Grid current
*
BggG KI=5E-6*(URAMP(V(G,K)+0.2)^1.5)
*
* Capacitances
*
Cgk G K 1.6P
Cgp G A 1.7P
Cpk A K 0.46P
.ENDS X12AX7A

*Vacuum Tube Triode (Audio freq.)

.SUBCKT X7199T 1 3 4
B1 2 4 I=((URAMP((V(2,4)/17)+V(3,4)))^1.5)/711
C1 3 4 2.3E-12
C2 3 1 2.0E-12
C3 1 4 0.3E-12
R1 3 5 5E+3


D1 1 2 DX
D2 4 2 DX2
D3 5 4 DX
.MODEL DX D(IS=1.0E-12 RS=1.0)
.MODEL DX2 D(IS=1.0E-9 RS=1.0)

.ENDS X7199T

*Vacuum Tube Triode (Audio freq.) pkg:VT-9 (A:1,2,3)(B:6,7,8)

.SUBCKT X6DJ8 1 3 4
B1 2 4 I=((URAMP((V(2,4)/31)+V(3,4)))^1.5)/120
C1 3 4 3.1E-12
C2 3 1 1.4E-12
C3 1 4 0.18E-12


R1 3 5 10E+3
D1 1 2 DX
D2 4 2 DX2
D3 5 4 DX
.MODEL DX D(IS=1.0E-12 RS=1.0)
.MODEL DX2 D(IS=1.0E-9 RS=1.0)

.ENDS X6DJ8

*Vacuum Tube Triode (Audio freq.) pkg:VT-9 (A:1,2,3)(B:6,7,8)

.SUBCKT X6N1P 1 3 4
B1 2 4 I=((URAMP((V(2,4)/34)+V(3,4)))^2.2)/1400
C1 3 4 3.2E-12
C2 3 1 1.6E-12
C3 1 4 1.5E-12


R1 3 5 10E+3
D1 1 2 DX
D2 4 2 DX2
D3 5 4 DX
.MODEL DX D(IS=1.0E-12 RS=1.0)
.MODEL DX2 D(IS=1.0E-9 RS=1.0)

.ENDS X6N1P

*Vacuum Tube Triode (Audio freq.)

.subckt X6C33C-B a g k
Bout ap k i = ((uramp((v(ap, k)/2.73644)+v(g, k)))^1.5)/85.5547
Cgk g k 36e-12
Cga g a 37e-12
Cak a k 45e-12
Rleak g gp 10e+3
D1 a ap dx
D2 k ap dx2
D3 pg k dx
.model dx D(is=1.0e-12 rs=1.0)
.model dx2 D(is=1.0e-9 rs=1.0)
.ends X6C33C-B

*Vacuum Tube Triode (Audio freq.)

.subckt X6C19C a g k
Bout ap k i = ((uramp((v(ap, k)/2.62419)+v(g, k)))^1.5)/647.903
Cgk g k 5e-12
Cga g a 5e-12
Cak a k 4e-12
Rleak g gp 10e+3
D1 a ap dx
D2 k ap dx2
D3 pg k dx
.model dx D(is=1.0e-12 rs=1.0)
.model dx2 D(is=1.0e-9 rs=1.0)
.ends X6C19C/sop

*Vacuum Tube Triode (Audio freq.)

.subckt X6080 a g k
Bout ap k i = ((uramp((v(ap, k)/2.00735)+v(g, k)))^1.5)/565.063
Cgk g k 5.5e-12
Cga g a 8.6e-12
Cak a k 2.5e-12
Rleak g gp 10e+3
D1 a ap dx
D2 k ap dx2
D3 pg k dx
.model dx D(is=1.0e-12 rs=1.0)
.model dx2 D(is=1.0e-9 rs=1.0)
.ends X6080

*Vacuum Tube Triode Connected Pentode (Audio freq.)
.subckt X807 a g k
Bout ap k i = ((uramp((v(ap, k)/8.9966)+v(g, k)))^1.5)/714.69
Cgk g k 7e-12
Cga g a 0.2e-12
Cak a k 6e-12
Rleak g gp 10e+3
D1 a ap dx
D2 k ap dx2
D3 pg k dx
.model dx D(is=1.0e-12 rs=1.0)
.model dx2 D(is=1.0e-9 rs=1.0)
.ends X807

Robert Casey

unread,
Mar 12, 2003, 5:29:03 PM3/12/03
to
Gregg wrote:
Behold, Robert Casey scribbled:

> Thanks for the advice.  I've made some progress, but some of the 3f4
> spice models makes circuitmaker barf.  Most don't but a few do. The
> below 6DJ8 model bombs circuitmaker:
 

Thanks.   I've done some hacking to make a 50C5 model.  I added
some comments so I could keep track of what variable mostly
did what.

*Vacuum Tube Tetrode (Audio freq.)
.SUBCKT X50C5 A S G K
*
* Calculate contribution to cathode current
*
*the number at the right end determines sharpness of knee
Bat at  0 V=0.636*ATAN(V(A,K)/12)
*the URAMP(V(S,K)/# mostly determines peak plate current, grid line spacing nearly constant
*the number at the right end determines slope of grid lines
Bgs gs  0 V=URAMP(V(S,K)/6.2+V(G,K)+V(A,K)/90)
*the exponent sets the linearity of grid line spacing, and big impact on peak plate currrent
Bgs2 gs2 0 V=V(gs)^1.58
Bcath cc  0 V=V(gs2)*V(at)
*
* Calculate anode current, grid line spacing adjust and peak plate current
*
Ba A   K I=1.35E-3*V(cc)
*
* Calculate screen current
*
Bscrn sc  0 V=V(gs2)*(1.1-V(at))
Bs S   K I=0.6E-3*V(sc)
*
* Grid current (approximation - does not model low va/vs)
*
Bg G   K I=(URAMP(V(G,K)+1)^1.5)*50E-6
*
* Capacitances
*
Cg1 G K 13p
Cak A K 8.5p

Cg1a G A 0.6p

.ENDS X50C5

0 new messages