Optimizing Tube Model Parameters in Real Time


Author: Dmitry Nizhegorodov (dmitrynizh@hotmail.com). My other projects and articles



1.   Abstract

Spartan and raw but useful Java program for interactively optimizing tube SPICE parameters is presented.

2.   Introduction

Several tools exist for computing and optimizing SPICE tube parameters [1][2][3], however I found that it is always useful to manually adjust parameters for the best fit. I wanted to have a real-time tool with mouse slider controls for Mu, Kg1, Kvb, Kp that will instantly show me tube curve changes.

I wrote such tool in Java, and it is at a point where it is really helping me and therefore might help others. I provide the sources for downloads. The code lacks comments and is written in a very straightforward, down-to-earth style. The former helps nothing but the latter might help a casual programmer to get around it; unlike that, a GUI app based on MVC principles and sporting tasty GOF design patterns, counting dozens of tiny classes maybe a great pleasure for an OOP purist but may be not penetratable by an EE person with matlab/excell hacking skills.

3.   Details

The application, including the sources, is here.

The tool reads tube data consisting of two kinds of data: (1) real measurements of a tube representing points on a plate characteristic and (2) Norman Koren tube model parameters. The tool displays the dots representing real data and the curves computed from the model on the same plane. Rarely both arrays of data align perfectly. Slider controls allow to adjust the model parameters and instantly see the changes on the graph.

After a minute or two of iterations I can easily find the best combination of parameters. I like the results much more than what I get with Koren's TUPARAM Matlab packet or what I get with Teodoro Marinucci's Excel tool.

The tool works both as an Applet and as a standalone java application. I prefer to use the tool as an application, though, because in this mode the tool accepts a command-line parameter - a tube data file. An applet needs to find the data somewhere, too, and I provide that in a form of applet PARAMs. However, the latter is less convenient than use of text files.

The format on input data is derived from Norman Koren's format for his tuparam Matlab package, except the parameters become java properties and hence providing several parameters on a single line is not supported.

An example of an input file containing some (rather sloppy) collection of plate measurements for a 2a3 tube and some reasonable but not ideally matching, set of model parameters:

TUBE_NAME = '2a3';
TUBE_SOURCE = 'www.mclink.it/com/audiomatica/tubes/2a3.htm';
TUBE_TYPE = 'triode';
VGP = 0:-12:-72;
MU = 4.2;
EX = 1.4;
KP = 60;
KVB = 300;
KG1 = 1500;

VP = [40.7674942 76.79458618 113.7697525 75.84650421 113.7697525 149.7968445 127.9909744 159.2776489 197.2008972 175.3950348 208.5778809 238.9164734 229.4356689 281.5801392 269.2550659 308.1264038 342.2573242 316.6591492 342.2573242 382.0767517];

VG = [0 0 0 -12 -12 -12 -24 -24 -24 -36 -36 -36 -48 -48 -60 -60 -60 -72 -72 -72];

IP = [0.023487544 0.068754448 0.130676157 0.008967972 0.044839858 0.096939502 0.009822064 0.035871886 0.08797153 0.008540925 0.031174377 0.071743772 0.01024911 0.055516014 0.007259786 0.030747331 0.067900356 0.008113879 0.019217082 0.055088968];

  
Long values of parameters - such as arrays of floats above - can be continued on the next line with a '\' terminator, for example:


IP = [0.023487544 0.068754448 0.130676157 \
0.008967972 0.044839858 0.096939502 0.009822064 \
0.035871886 0.08797153 0.008540925 0.031174377  \
0.071743772 0.01024911 0.055516014 0.007259786 0.030747331 0.067900356 \
0.008113879 0.019217082 0.055088968];
  
Any number of other parameters can be provided as well with no harm. Case matters: Mu = ... will not be recognized as MU = ...

Whitespaces are optional: MU = 4 is the same as MU=4

Characters , ; [ and ] are treated as separators just like whitespaces. Java-style comments are permitted:

// correct parameter syntax
MU = 4.2;
EX = 1.4;

/* incorrect parameter syntax, the value for EX will be lost
 * because it is on the same line where MU starts. */
MU = 4.2; EX = 1.4;
  
Applets have trobles with files, hence each tube data parameter is specified as a value attribute of applet's tag PARAM, Here is the same input provided in applet format:

 <applet align=left hspace=10 code="TubeData.class" archive="tubedata.zip" width=520 height=500>

 <param name="MU" value="4.2">
 <param name="EX" value="1.5">
 <param name="KP" value="60">
 <param name="KVB" value="300">
 <param name="KG1" value="1500">

 <param name="VP" value="[40.7674942 76.79458618 113.7697525 75.84650421 113.7697525 149.7968445 127.9909744 159.2776489 197.2008972 175.3950348 208.5778809 238.9164734 229.4356689 281.5801392 269.2550659 308.1264038 342.2573242 316.6591492 342.2573242 382.0767517]">

 <param name="VG" value="[0 0 0 -12 -12 -12 -24 -24 -24 -36 -36 -36 -48 -48 -60 -60 -60 -72 -72 -72]">

 <param name="IP" value="[0.023487544 0.068754448 0.130676157 0.008967972 0.044839858 0.096939502 0.009822064 0.035871886 0.08797153 0.008540925 0.031174377 0.071743772 0.01024911 0.055516014 0.007259786 0.030747331 0.067900356 0.008113879 0.019217082 0.055088968]">

 </applet></p>

  

4.   Online Example

Click here to see the tool running as an applet with tube data for 2a3 shown above.

5.   References

[1] Teodoro Marinucci's Excel tool

[2] Norman Koren's Matlab TUPARAM tool

[2] Eugene Karpov's programs


Author: Dmitry Nizhegorodov (dmitrynizh@hotmail.com). My other projects and articles