Pentode SPICE

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
The data usually comes from the datasheet, but sometimes, the data comes from traced curves from actual tubes, the formulas then try to describe in mathematical terms how to best describe the tubes' properties (not always successful though).

You are being too modest, you are not a beginner :D uramp(x) = x if x > 0, else 0. I'm not sure if SIMetrix uses it though, in any case, the Ayumi pctube library contains all the models in SIMetrix .MOD format, so you can use them directly.

That's actually the hardest part - around the knees, as shown by Robert in this post.

Great to see you back on the forum!
I don't have any audio DIY activity last year, I was too busy doing other things and I did not participate to any audio DIY forums.

Unfortunately, the tubes datasheets sometime give very few specifications and it is impossible then to make very accurate models, specially for pentode. Sometime, the model are made for a specific screen grid voltage and their current is not correctly modeling, when the plate voltage is under 100V, the screen grid current suppose to raise very high but in most model, this current is linear for any plate voltage.

You are right about the URAMP function, it is just a kind of conditional function returning the argument if it is over 0 and 0 if it is under 0 ... But I think they often use it for nothing in the formula because the argument never fall under 0 ... Yesterday, I make a small model to test the URAMP function :

.SUBCKT TEST_URAMP 1 2
B1 1 2 I=URAMP(V(1,2))
.ENDS

I associate it to a two pins symbol and make a small test circuit with a inline current probe and a DC voltage source. I run a simulation with a sweep DC supply from -1V to 1V and the URAMP function done what I was expected, The current stay at 0A until the sweep reach 0V and raise linearly to 1A when the sweep attain 1V.

I also try this :

.SUBCKT TEST_URAMP 1 2
B1 1 2 I=URAMP(V(1,2)^1.5)
.ENDS

It work with a sweep from 0V to 1V, producing a non-linear curve but not from -1V to 1V because trying to elevate a negative number to a power less than 2 produce a mathematical error ... It don't work in SiMetrix, don't work with my pocket calculator and don't work with a calculator software. However, the model below is working well but don't return 0 under 0 :

.SUBCKT TEST_URAMP 1 2
B1 1 2 I=URAMP(V(1,2)^2)
.ENDS

It produce a nonlinear curve from -1A to 0A followed by a "mirror" curve from 0A to 1A. I also try the function using the absolute function :

.SUBCKT TEST_URAMP 1 2
B1 1 2 I=URAMP(ABS(V(1,2))^1.5)
.ENDS

It give the same mirror result than the last model but it work with an exponent less than 2. At least, I learn something new in mathematics and models using the URAMP function work very well in SiMetrix.

I will continue to experiment with models, maybe one day, I will find a solution to make nice and accurate knees for pentode and beam power (kink less tetrode) ... I don't know anything about advanced mathematics but I have a long software programmer experience and I use to solve many complex calculation problems my own way ... :D

PS. About the Chinese money, I understand now the difference between the "onshore" CNY Renminbi and the "offshore" CNH Renminbi, convertible in Hong Kong and some China provinces since 2010. I also know about the FEC (foreign exchange certificate) used from 1995 to 2005, all that is very interesting ... ;)
 
In my preceding message, I write something wrong about the power of negative number, it work only if the exponent is a integral number, not a real number ...

For instance : 0.5^1.5, 2^1.5, 0.5^2, 2^2, 0.5^2.5, 2^2.5 work normally.
Also : -0,5^2, -2^2 are working even if the value is negative.
But not : -0.5^1.5, -2^1.5, -0.5^2.5, -2^2.5 ...
Because the exponent is not a integer and the value is negative ... :confused:

I look on the net to find a good tutorial about spice models writing and syntax, also about accepted maths operators and functions, but I don't find anything really interesting except maybe this page :

Simulation Models and Analyses Reference | DOCUMENTATION

I found in this page the U(x) function very similar to the URAMP(x) function except it return 1 when the argument is over 0, this function do the same thing as the STP(x) one does (unit step function).

I found many other useful looking functions but I don't have the time yet to try them with my SiMetrix simulator :

LIMIT(x,min,max), MIN(x,y), MAX(x,y), PWRS(x,y), SGN(x), STP(x) or u(x)
TABLE(x,x1,y1,...xn,yn) and IF(t,x,y) are the most useful, I will test them first ...

I already test URAMP(x) and ABS(x) returning the positive value of a negative argument.

I hope the IF(t,x,y) similar to the "If Then Else" in the computer program will work with SiMetrix because it can simplify a lot some complex models, in this case, I will also have to test all the Boolean usual operators for the "t" argument, like IF x==y, x<=y, x>=y, x<>y, !x, and, or, not, etc.

Conditional functions can be useful for pentode models because the big changes in some parts of the curves depend on the area where they occur. From right to left : the almost linear region, the knees region and the so called triode region ... ;)
 
Yesterday, I notice many maths functions I mention in my last message are already used in the models I have and they should work in SiMetrix. I test all other and only the TABLE(x,x1,y1,...xn,yn) function is not recognized by my simulator.

Here are the other models I test :

.SUBCKT TEST_IF 1 2
B1 1 2 I=IF(V(1,2)>0,1,-1)
.ENDS

In a AC circuit, produce a square wave +/- 1A current waveform. I work a long time as a software programmer and I can tell you the IF THEN ELSE conditional operators are very useful in computer programs, they are used everywhere in algorithms and are the most important operators as you can see in any flowchart diagram. So I suppose they can also be very useful in spice models but I never see any model using them yet ... Why ? :confused:

.SUBCKT TEST_U 1 2
B1 1 2 I=U(V(1,2))
.ENDS

OR

.SUBCKT TEST_STP 1 2
B1 1 2 I=STP(V(1,2))
.ENDS

Those two functions does the same thing and in a AC circuit, produce positive pulses of 1A current amplitude

.SUBCKT TEST_MIN 1 2
B1 1 2 I=MIN(V(1,2),1)
.ENDS

.SUBCKT TEST_MAX 1 2
B1 1 2 I=MAX(V(1,2),-1)
.ENDS

I place them in series in a 6V peak to peak AC circuit and they produce sinusoidal current waveforms with "the top chopped" at +/- 1A

The question now is how those conditional functions can be used to simplified a tube (or another device) model ?

I think like a software programmer and I will work on that sometime this year ... :rolleyes:
 
For an example of conditional statement in tube SPICE model, see this page. Also if you post on the sticky Tube SPICE Model thread, you might get more responses.;)
Thank you,

This thread is lost a deep nowhere section where nobody see it ! :D

I just look at your link, the example is in the 6H30 PSpice model. Those IF functions are used exactly like the MIN(x,y) function, if x > y, return x, else, return y ... This is a very simple use of the rarely used IF function.

What I was thinking is "connecting" very different pieces of curves end to end using conditional functions to make a very complex curve, I think this can be possible.
 
Last edited:
Hi everybody,

Last week, I decide to find out by myself how to design pentode models because I am not satisfied by most of those I have in my library. Particularly, their knees don't fit very well the datasheet curves and the current model of the control and screen grids are not accurate. A good pentode model should permit to simulate a screen grid drive amplifier with an appropriate driver or a triode connected pentode ...

I was first thinking some conditionals functions can be used to reproduce the complex curves of a pentode and I made many test with them, some work nice except at the point of transition of the condition. The link between two part of the curve was not smooth.

Then I decide to test every maths function working in my SiMetrix simulator to see what kind of curves I can get with them and here's they are :

An externally hosted image should be here but it was not working when we last tested it.


The curve made with one of them seem to be almost like a pentode or a transistor curve, it is the "hyperbolic tangent function", named TANH(x) in the models. I test this function using the following model :

.SUBCKT TEST_TANH 1 2
B1 1 2 I=TANH(V(1,2))
.ENDS

I associate this model to a small two pins symbol and run a sweep simulation from -4V to 4V :

An externally hosted image should be here but it was not working when we last tested it.


As you can see, this function work also with a negative argument but for most implementation, I will use only the positive part. The current raise gradually from 0V/0A to the "knee" and after 3V the curve is almost horizontal but never reach 1A. This function can be used almost like a conditional function because the three parts of the curve are very different, the "triode area", the "knee area" and the "almost horizontal area". I will post in this thread all what I find out about pentode modeling, I think it is the best place for that in this forum. :D
 
My first pentode model experiment

Now, it is time for me to tell you about my first pentode model experiment. I read in this thread the hard part is modeling the knees, so that's where I start and the mathematical operations I develop will be the base of all my pentode modeling tasks.

I create a special device with 8 pins that can be use to pass any argument to the models I am working on and believe me, this is perfect for "fine tuning" jobs. We often said in Quebec "an image worth thousand words" so here's the image :

An externally hosted image should be here but it was not working when we last tested it.


You understand the voltage of every battery are the argument I pass to the model. For my first tests, I use the 6L6GC because there is a lot of documentation available for this tube, in the GE datasheet, there is ten useful curves graph for plate, control and screen grids currents.

For my first experiment, I choice the necessary argument to make a very accurate curve for a control grid voltage of +24V and a screen grid voltage of 400V. I adjust the curve to get the following IAK/VAK target points :

70 ma for 20V, 250ma for 50V, 530ma for 100V, 600 ma for 135V (in the middle of the knee), 630ma for 200V, 650ma for 400V and 670ma for 700V.

After I finish adjusting all the parameters, I measure the GE graph with a very handy on screen measuring application named "ScreenMeasure.exe" ... and I get 670 x 470 pixels. Then I adjust the zoom and the X,Y ratio of the curve made by my SiMetrix simulator to get the same size and I copy the window image using the "Alt PrintScreen" short keys. I open "MS Paint" with the GE graph image I get the same way from the PDF file, making the background transparent, and I paste (Ctrl V) the SiMetrix curve on top of the GE curves to see how well they fit ...

An externally hosted image should be here but it was not working when we last tested it.


How about that ! :D

The curves are fitting almost perfectly at every points.

Of course, I am still far from a complete pentode model but I think this is a very good beginning. I have hard time to find how to position the knee in the X axis and adjusting is sharpness, also how to make a slightly curved slope after the knee. The next step will be making the curves for any value of control and screen grids voltages and this will also not be easy ... but I like this kind of challenge.

Let see what part of the operations are used for :

.SUBCKT 6L6GC_TEST1 1 2 3 4 5 6 7 G
B1 1 G I=TANH(V(1,G)^V(2,G)*(V(3,G)))*V(4,G)*(1+V(5,G)*TANH(V(1,G)*V(6,G)))
.ENDS

TANH(V(1,G)^V(2,G) make the basic curve, the V2 exponent control the sharpness of the knee.

*(V(3,G) is the X multiplicand to "scale" the VK voltage to the correct curve area

*V(4,G) is the Y multiplicand to "scale" the VK current to the correct curve result, this the principal argument the voltage of the control and screen grids will act on.

*(1+V(5,G) make a slope with the "almost horizontal" part of the curve, the V5 parameter adjust the angle of this slope.

*TANH(V(1,G)*V(6,G))) give a curved shape to the slope if needed, the value of the parameter V6 must be somewhere between 0.01 and 0.0005 to be effective. If the value is under 0.0005, the slope will be almost linear, a straight locking line.

That's about all I have to said about my pentode model experimentation for now. If some of you like to try the effects of my test model parameters on the curve, just try it and have fun. :frosty:

PS : I use the Frosty smilie because it is how I look like today, the temperature outside is actually -30°C and I am pretty sure my car will not start tomorrow morning because the battery will be completely frozen, but I always have a fully charged one in the house for boosting purpose ... Brrrr !
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.