SPICE users: I posted a site on how to build triode models

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Joined
Dec 16, 2006
Messages
24
There is a free program called Curve Captor by Andrei Frolov that will extract the math for plate curves, but there is no documentation, so I thought I'd post a site with some screenshots and a simple walkthrough on how to get it set up, and how to build a triode model from beginning to end.

I use Circuitmaker, but i have tried it with LT Spice, and a few others, and it works pretty much the same.
Here is the link:
http://www.geocities.com/keirkegeerd/spice/makeamodel.html

My bandwidth is horrid, check back later if you get a 'page not available' warning.
 
"Koren" (Norm), not "korean" (twice, near the top). Also Child's law is named for a guy so could be capitalized.

Plot Pd(max), very roughly, and don't go crazy marking above that. The data may or may not be good; but for audio, it is fairly useless. (The ECC99 curves don't go far out; some sweep tubes go places they can't linger for a milliSecond.)

Don't put a lot of marks on the bottom tails of the curves: those were often drawn by hand without a lot of measured data.

Be distrustful. The -10Vg line above 7mA on your ECC99 sample looks like it was drawn with a straight-edge. There's no physical reason for the kink and straight; but it sure saved time on the drawing board.(*) The oldtimers hid that by using a French Curve, a univeral curved-line drawing tool. The tube does not know Prof. French either, so while the older graphs are prettier, they may be low accuracy, especially at the ends of curves. (It looks to me like that ECC99 graph was drawn without a French Curve....)

(*) Note that your Koren model refuses to believe the kink at -10Vg 7mA, and plots a smooth curve. It also declines to believe the straight line above that and adds some Child power.

Let the algorithm focus on the area is semi-valid and that matters for audio: above the bottom 5% of the graph (bogus) and below Pd (we can't stay there).

Yes, we often DO want to work a tube far below 5% on the published show-off graph. That ECC99 is likely to be worked below 5mA, swinging well below 2mA, more often than 50mA.

In theory, all grid curves are asymptotic near the zero point lower-left. (Some tubes will pass many microamps at zero plate voltage, but "zero" compared to normal currents.) If you work tubes at very low current, noting the zero dot may help the analysis give better answers at very low current. And may not: many tubes are in effect two tubes. After the main tube cuts-off, you find a phantom low-Gm low-Mu tube lurking in the background. Simple models can't handle this properly.

A tube model MUST have a grid-cathode diode. Otherwise it is far too easy to drive the grid positive yet have "no" grid current, and get "answers" which can't happen in real world. Given a raw model without a G-K diode I would at least throw a 1N4001 diode on there to wake me up when grid goes way positive. For accurate answers in the grid-clipping region you want a lower-threshold diode and some series resistance (try 1/Gm).

> Vs3 needs to be set to 0 volts. That is just there to flip the curves the right way up

So it is just a probe point? If you probe the other side of it, you will be upside down again? You could probably get the same trick with a zero ohm (or 1u) resistor, or by (non-intuitively) poking the bottom end of the main plate supply battery. Or with a more dirty-hands simulator, by putting a "-" sign in front of the current to be plotted.
 
> My bandwidth is horrid,

GeoCities was the host of last resort 12 years ago, and has come downhill since then.

If you have a "real" ISP, like, oh, say, a Verizon DSL home account, it has a webspace. Often just 10Megs, but a wee bit swifter than GeoCities and no ads. Also if you have a dog, he can have an email box and his own 10Megs. I've lost two dogs but their webspaces live on, sometimes hosting my gal's eBay foto-pix. I admit that it was hard for my dogs to find the sub-account and webspace set-up in Verizon's mess of "help" pages, and they learned to ignore the suggested software and use plain FTP .
 
Thanx PRR.

LOL! 'Korean' I'll fix that.

I usually do throw a junk diode-resistor model into the triode macro, or a more elaborate grid model for my more commonly used truides... I completely forgot about that I should make a note of it on the page somewhere. So you suggest diode+1/gm? Simple enough. Should I bother averaging gm at different op points or is that academic?

I used to use a .00000001 ohm resistor as a probe point, but copy/pasting a zero voltage source was just fewer keystrokes. Putting a "-" sign on the current would be even easier. I feel like an idiot for not thinking of that... hey, i am just a musician here: it is a miracle that I can even turn a computer on.


If you have a "real" ISP, like, oh, say, a Verizon DSL home account
LOL... uh, luckey guess eh? :wink:
 
aletheian-alex said:
Thanx PRR.

LOL! 'Korean' I'll fix that.

I usually do throw a junk diode-resistor model into the triode macro, or a more elaborate grid model for my more commonly used truides... I completely forgot about that I should make a note of it on the page somewhere. So you suggest diode+1/gm? Simple enough. Should I bother averaging gm at different op points or is that academic?

I used to use a .00000001 ohm resistor as a probe point, but copy/pasting a zero voltage source was just fewer keystrokes. Putting a "-" sign on the current would be even easier. I feel like an idiot for not thinking of that... hey, i am just a musician here: it is a miracle that I can even turn a computer on.


If you have a "real" ISP, like, oh, say, a Verizon DSL home account
LOL... uh, luckey guess eh? :wink: I forgot about that webspace... good call.
 
> Should I bother averaging gm at different op points or is that academic?

The Gm of interest is approximately the zero-bias Gm. This does decline at low current, but is often fairly constant at high current.

In truth the grid resistance declines slowly from infinity. It may be asymptotic to hi-current 1/Gm, but in most audio we never go that far.

My main interest is in seeing that the wave does flat-top when the grid goes positive, not really how far into the flat-top zone I can go.

This is a Koren model in a Pspice dialect:

Code:
.SUBCKT 12AX7-X 1 2 3  ; P G C;  NEW MODEL
+ 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 ADJACENT 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
*$

The ".MODEL DX....." is a near-ideal diode, and a SPICE primitive, so should work in most sims perhaps with a little syntax-twist. "RGI" in "PARAMS" is a 2000 resistor, which is a fair approximation of a 12AX7's positive grid if you are not flooding it with current. Nodes 2 and 3 are G and K. Node 5 is an internal node to join the D and RGI. Node 7 is this model's internal node to reflect the effective internal voltage field, enters the formula for conductance G1 between plate and cathode to compute P-K current. Mu is amplification factor and nearly the number on the datasheet (in this case it is) but sometimes a little off. EX is the first approximation for P-K diode current using Child's Law but non-ideal triodes don't do 3/2 or 1.5 exactly; this one is 1.4. I gather the K factors express the corrections needed to get from a Mu-100 EX=1.4 plot to the observed plot.
 
I have been trying to get ahold of the Rydel AES article for a while now, but unfortunately, I ha relegated to second hand information. I do have hard copy of the Koren stuff.

i believe that the more complicated Rydel equations account for zero and positive grid voltages. I have had this survey from Paeng design squirreled away for a while:

"Rydel's Approach [1]

Eq. 4 [Ip= K*(m*Vgk+Vpk)^(1.5)] leaves out parasitic phenomenae existing in triode as the depencence of transconductance gm and internal resistance rp (and therefore m) by Vg, when this potential becomes more an more negative. By allowing to change the perveance K with respect to Vg we can mimic the behaviour of triode caracteristics for Vg<<0.

(5) Ip= K*(1+Vgk/B)*(Vg+(Vpk+Vc)/m)^(1.5)

For a better behaviour of positive grid voltage, we can add a further expression in eq. 5

(6) Ip=K*(1+Vgk/B)*((Vgk+(Vpk+Vc)/m)^(1.5))*(Vpk/(Vpk+c))

Where K,B,Vc,c are parameters for a Non Linear Regression Method as, the above mentioned, LMA. Eq. 6 produces an excellent fitting with the published data. The Resercher also suggests a variant for very-non linear triodes:

(7) Ip=K*(1+Vg/(B-Vg/C))*(Vg+(Vp+Vc)/m)^1.5

An often negleted characteristic of triode behaviour is its capacity to draw grid curren when Vg becomes positive (actually tubes draws current also when Vg is weakly negative). Grid current is not easily determinable because it depends on theoretical grounds and engineering proceedings. The suggested expression for grid current is the following:

(8) Ig=G*(((A+Vpk)/(B+Vpk))^4)*Vgk^1.5

Eq. 8 fits well enough real curves but again a Non Linear Regression Method is necessary to speed-up the model drawing

A Pspice ABM for eq (7) can be easily extracted with the pattern about eq.4's ABM."


I have built up models based on those equations using the trial and error method, and they do seem to work fairly well, but they freak out the simulator big time in more complex circuits... and are not neccessary for simpler circuits...sigh... that leads back to pen and paper, which is as it should be I suppose. SPICE is a good virtual breadboard to experiment with a bunch of circuits in a short period of time, but is also a lying s.o.b... and I STILL have not been able to build up proper suppressor grid or directly heated filament models to work right.
 

Latest posts

Back
Top