Model Paint Tools: Trace Tube Parameters over Plate Curves, InteractivelyAuthor: Dmitry Nizhegorodov (dmitrynizh@hotmail.com). My other projects and articles
1.   IntroThe Java tool described in [1] needs a text file containing rows of data representing dots on plate curves. Do not have such data for a particular tube? So am I, except for tubes in [2], [3]. However, we have access to lots of pdf, gif or jpg images displaying plate curves - thanks to maintainers of such great datasheet banks as [6], [7] and many smaller repositories. What to do to derive SPICE models from that? One solution is [4], an Excel macro package incorporating a calibrator and point-and-click converter of curve points into excel table format, used as input to tube model parameter optimizer. A different approach is presented here. It is a tool that displays an image with load curves and allows to PAINT the model curves over it. The model used in the tool is Koren Improved Triode [5]. You have slider controls, each corresponding to a tube parameter such as MU, KG1, KP, etc., to change the model curves, until you fit the parameters to your liking, and generated a complete SPICE model definition. With a bit of training the process becomes natural, frequently entertaining, occasionally captivating and almost never boring. The results easily surpass those obtained with automatic optimizers.
2.   Downloading the ToolDownload java jar file paint_kit.jar by right-clicking on the link, and save it somewhere on the disk. A directory where you'll be collecting tube curve inages is a convenient place for that. No unpacking is needed if you just want to run the tool without modding its code.
3.   Running the ToolMake sure you can run java version 1.3 or later on your computer. Then you can start the tool from a command line (MSDOX box, shell) this way:
java -jar paint_kit.jar <plate-curves-image>Here, <plate-curves-image> is a GIF or JPG image containing tube plate curves. There is plenty of images available on the web. For starters, Audiomatica contains a good selection of most popular audio triode curves. For example, we'd like a model for 6sn7 matching Audiomatica's curves. First, download 2a3crv.gif and do
java -jar paint_kit.jar 2a3crv.gif
4.   Detailed step by step instructionsAfter the application starts, you should see a window displaying the image. On the left you'll see 3 buttons, [Color], [Report], [Exit], a text input window with "600 200 12" displayed in it and several horizontal slider controls that look like scrollbars. You may want to adjust the window size for better layout of the image and controls.Painted over the image, you should see a small red gridbox with tube curves in it. This is the model. Moving the sliders will affect the curves in the small red box in realtime. Your next task is to align the red box and the axis of the plot. You can do that using the mouse, by "rubber-bending" the red box. First, position the mouse precisely over the 0,0 point on the plate plot and press mouse without releasing it. The small red box disappears. Then drag the mouse (move it with the button still pressed) in the direction of the Imax, Vmax point on the image. You'll see that the small red box appears again, growing in size in real time as you drag its max, max point with the mouse. position the mouse at the diagonal point where you wan the plots aligned an release the button. The plot coordinates are geometrically aligned now. Repeat the whole click-drag-drop procedure if the alignment is not precise. After you've aligned the planes, do not click the mouse when it is hovering over the image, it will shrink the box again. if the color of the model lines (default red) collides with the image, use button [Color]. Pressing it iterates over a selection of various colors (red, yellow, black, etc). Now you need to calibrate the model plane. type the values of the Vmax, Imax and grid voltage step in the text box area. For the 6sn7 image from Audiomatica, you need to enter 500, 20, 2. Of course, if you did not drag the model box all the way to 500v,20ma marks, you'll have to enter different values. Note that there is no need to enter a negative sign for grid voltage. Press return when in the box, you'll see that the model re-scales. It is not calibrated in sync with the image plot. With little practice, the above steps take just a couple of seconds of time. Now you are ready to start finding tube parameters. At this point, chances are that the image and the model lines are a complete mismatch. Now you can pay closer attention to the sliders. The sliders are "smart": they rescale "infinitevely". Each slider re-scales when you move the control all the way left or right. . For example, initially the MU slider covers the range from ~ .5 to 10, but after you move it to the left corner, it will re-scale to cover ~ 1 .. 20 range, and if you bump it twice again it will readjust to 4 .. 80 range. Each slider does that in a similar way. This allows to always maintain a good precision yet does not lock a slider in a particular range. Try moving the sliders. Watch the shape of curves changing. Now you are ready to start fitting parameters. Finding the best parameter fit is a hard task at the beginning, but will be easy after little practice. It is absolutely critical to develop a feel of each parameter. Knowing what each parameter does helps to shape the curves very quickly. Below is a little cheat-sheet explaining the impact of each slider.
4.1   Recommendations for finding best fitThe key is to do incremental adjustments.First, find the best MU (distance alone X between first 2-3 curves) then adjust KG1 to get the idea about the curves. Adjust EX to get the best "curving" of most lines, adjust KG1 and MU again. Then try KP. after that, you may want to try KVB and VCT. Remember that the way how you iterate affects the shape of the curves, and that be developing a feel of how the parameters affect the shape you can beat the results of automatic optimizers.
5.   Viewing SPICE model outputSPICE model matching current set of "painted" curves can be generated at any time.When you think you found a good interim curve fit result, press the [Model] button. A separate textual pop-up window will appear, displaying the SPICE model text matching you current parameter values. You can simply observer the text and kill the window and continue. You can keep around as many separate model text windows as you want You can copy&paste the model text and add it to your SPICE tube library: highlight the text with the mouse (drag button1), copy the highlighted selection using the button3 on the mouse or keyboard shortcut C-v, and paste the model into your SPICE tube library. The windows can be used as save-points in your work: you can read the model back into the painting tool from any of currently opened model windows at any time, To do that, press "Update PARAMS" button on a model window you wish to return to. The slider and the curves will change according to the parameters in the text. You can edit the text, entering the values by hand and then press "Update PARAMS". You can import models from your SPICE model lib file via a model window: Paste the model text you've copied from you SPICE library into any model window and then press "Update PARAMS". This is very useful to see how your existing models match particular set of curves. The [Exit] button pops up am exit confirmation dialog. If you pressed "Yes", the tool quits. If you forgot to copy/save the model, you can still capture it after exiting if you have access to your standard output window (a gnu/mks shell window, a DOS Command Box). The text for the model is printed into the log window. An example of the tool's output:
** 12AX7 ************************************************************ * Created on Wed Nov 21 16:22:57 PST 2007 using tube.model.finder.PaintKIT * URL: "http://www.audiomatica.com/ * Tube Curves URL: http://www.audiomatica.com/tubes/img/12ax7crv.gif *------------------------------------------------------------ .SUBCKT TRIODE_12AX7CRV 1 2 3 ; Plate Grid Cathode + PARAMS: CCG=3P CGP=1.4P CCP=1.9P RGI=2000 + MU=92.064 EX=1.3719 KG1=1770.0 + KP=1176.0 KVB=1.9687 VCT=0.392 ; Vp_MAX=405.0 Ip_MAX=0.0080 Vg_step=0.6 *-------------------------------------------------- E1 7 0 VALUE={V(1,3)/KP*LOG(1+EXP(KP*(1/MU+(VCT+V(2,3))/SQRT(KVB+V(1,3)*V(1,3)))))} RE1 7 0 1G ; TO AVOID FLOATING NODES G1 1 3 VALUE={(PWR(V(7),EX)+PWRS(V(7),EX))/KG1} RCP 1 3 1G ; TO AVOID FLOATING NODES C1 2 3 {CCG} ; CATHODE-GRID C2 2 1 {CGP} ; GRID=PLATE C3 1 3 {CCP} ; CATHODE-PLATE D3 5 3 DX ; POSITIVE GRID CURRENT R1 2 5 {RGI} ; POSITIVE GRID CURRENT .MODEL DX D(IS=1N RS=1 CJO=10PF TT=1N) .ENDS *$there, I provided the values for the inter-electrode capacitance and the URL with the curves.
6.   My own ModelsA small yet growing repository of "good matches" can be found in [8].
7.   Tips and SolutionsFrequently you want to set the parameters to values corresponding to some existing model - to check how it fits a plot, for example - or to continue from a save-point data. Earlier we described how model windows can be used for that and how the text box localed just under the label "Max Vp (V), Max Ip, Vg step (V):" can be used to calibrate the model grid with 3 space-separated values Vp_MAX, Ip_MAX, Vg_step. Same text box can be used to set the value of MU, KGP, etc. The format is the same that ise used in your SPICE models, so that you can simply cut&paste the name=value pairs from SPICE lib files. etc to the values matching the TRIODE_12B4A model:If you look closely, you'll see that the model definitions contain SPICE-syntax comments similar to this: ; Vp_MAX=500.0 Ip_MAX=0.07 Vg_step=10.0 this is another way to set the 3 calibration parameters. For example, MU=7.518 EX=1.344 KG1=390.0 KP=45.0 KVB=930.0 VCT=0.328 Vp_MAX=500.0 Ip_MAX=0.07 Vg_step=10.0 sets the sliders and calibrates the model plane. These are saved in model text so that the toll can be instantly restored to any save-point.
8.   Inverse Koren Improved Triode equationThe latest update of my paint_kit.jar contains feature dynamically displaying Vp, Ip, Vg, Mu, Gm and Ra for the position on the plot mouse hovers over. Computing this on fly required knowing the inverse of Koren Improved model. What is the inverse? The Koren Improved equation takes Vp and Vg and returns Ip. The inverse takes Vp and Ip and returns Vg. the following sheet demonstrates derivation.
9.   Possible future extensions
10.   Code sourceThe Java source of the tool, PaintKIT.java, is included in paint_kit.jar. It is just a single file which helps understanding and modding the code. Please send me patches if you come up with improvements and enhancements, and I'll incorporate the code into the tool!Go here to learn how it works.
11.   Other interactive toolsWe provide several other tools, very similar to Koren Improved Triode finder but featuring different tube models. Here is the list of currently available parameter finders.paint_kip.jar Koren Improved Pentode Model, version V2 supports loadlines, PP mode and various advanced controls. The old version V1 is still available, here, paint_ppt.jar Stefano Perugini Polynomial Ex(Ep) Triode model paint_pexgt.jar Polynomial Ex(Eg) Triode model
12.   links[1] tubeparams, a text-input parameter-finding tool[2] http://next-tube.com/data.php NextTube data page [3] http://www.klausmobile.narod.ru/testerfiles/index.htm Klausmobile T-files [4] https://web.archive.org/web/20041127092506/http://digilander.libero.it/teodorom/Simulations/TriodeExcel.htm Teodoro Marinucci Excel image-to-table tool, Also see https://web.archive.org/web/20050209144741/http://digilander.libero.it/teodorom/ [5] http://www.normankoren.com/Audio/Tube_params.html Norman Koren tube parameters [6] http://tdsl.duncanamps.com/ Duncan Amp's tube data [7] http://www.tubedata.org/ Frank's Tube Pages [8] Not finished yet. models-gallery.htm A collection of good matches done with my Paint* java tools, screenshots as well as model text ready to be copied into your SPICE .lib files are provided. Please send me your findings for inclusion.
Author: Dmitry Nizhegorodov (dmitrynizh@hotmail.com). My other projects and articles
|