Generating SPICE code from vacuum tube curves


Currently there are no simple way to generate SPICE model code for vacuum tubes. A number of people have done quite much work in this area, but most use matlab or similar to match curves and get SPICE data, which may end up with much extra work. Therefore I have written a small C program that can do (almost) everything needed.

I use Stefano Perugini's algorithms for diodes and Norman Koren's for the other tubes.
All SPICE testing have been done by using LTspice.

This program, kurvmatch, will take as input a config file for a tube, run the Nelder-Mead minimization algorithm on it to get parameters for the tube, display the result using gnuplot, generate SPICE output code and also print out a small .dc sweep analysis code blob. Then it can be verified that both the intermediate curve (gnuplot) and final curve (SPICE) matches the original.

Options to kurvmatch

  • -g generates gnuplot output, to visually see (and verify)
  • -h sends the gnuplot output to a file named .png.
  • -s generates SPICE output. You must also have the subcircuits from tubelib.base.
  • -t prints out .dc sweep analysis code for this tube.
  • -u puts the SPICE output in a file called .tsub.

Downloading and running kurvmatch

I have compiled this stuff on my mac, it should probably be trivial to do it on any other Unix/Linux machine. You need libgsl and gnuplot installed. Fetch kurvmatch.tgz and unpack it. You may need to change some paths in the makefile.


The handling of screen grid current is not optimal, mostly because curves on this is usually missing. Due to Norman Koren the simulation results will not be affected by this, but nevertheless I plan to add better handling of it in the future. An uTracer will hopefully help me with finding these parameters.

Pregenerated tube data

I have prepared data for some tubes that I use. All SPICE models are in tubelib.sub which you can fetch if you need. Below are auto-generated information for all these tube types (and their equivalents).