ACAD Scripting Tool.        

A friend of mine asked me for some help with
graphics for a book he is writing concerning the
construction of tube based guitar amplifiers like
TransLucid OD-50.

The images included some sine waves and some
plots of the transfer functions of a simple RC

I decided to use ACAD because of the potential
mathematical precision of the image.

I wrote this tool to calculate the sine waves and
the RC networks and take the results and create
an ACAD script to create the image in a drawing.

The GUI above is for creating Sine wave scripts for placing into an AutoCAD drawing.

The Degrees frame contains the input options for creating the desired number of cycles of the desired frequency and
scaling of the output data.

The text box on the left contains the ACAD script created by the tool.  

The graph window shows the contents of the script file for inspection before calling the script from ACAD,  this display is
generated by reading the script file from disk.  

The Display Settings frame contains options for plotting the contents of the script file.
    The GUI above is for creating the curves of a simple RC network.

    The EQ frame contains the options for creating the network curves.  The Grid frame contains the results of various calculations done for the network.  
There are 13 columns of results,  the first 7 are shown.  The display Settings frame contains options for scripting and plotting the calculated data.  The 13
buttons in the Columns frame are used to select the Y-axis values scripted/plotted against the X-axis values from column #1.

    The parameters of the above script are :
    20 Hz to 10,240 Hz with an Octave step.
    100n Farad and 10,000 Ohms.
    Both X and Y axis are output as Linear with the X-axis scaled by 1.666 and the Y-axis by 0.1.
    The Y-axis data is taken form column #5.
Below is a plot of the data from column #5.  The X-axis output data is now based on the common Log of the X-axis or Frequency value.
    If you want to trace your family tree this utility won't be of much help.  However it may help trace a family of curves.

    Again this tool was motivated by the need to include characteristic curves in a publication. I just didn't find free handing the curves acceptable.  
    I loaded a JPG of the family of curves into a PictureBox control and set the user scales to match the graph scale.  

    This allows me to lay a regular grid system over any image I have.
  The Control grid curves in the above image that are not found with curves in the image below were created from data points taken from the image by mouse click and
stored in a data base.  
  The utility will
interpolate between plate voltage and grid voltage to estimate plate current for the given conditions.  The controls on the right side of the GUI are used
to edit the data base of collected or calculated data points.  
  Data points can be inserted, moved or deleted by a simple mouse click.  The basic idea here was to port tube data into a wmf type file for publication.  
  I use ACAD for most of my regular graphic implementations this utility also writes it's data to a script file so I can load the results easily.
Scripting Tool.
Current Digital Tube Data Bases

Currently I have digitized
characteristics for the
following tubes :

12AT7        [2]
12AU7        [2]
12AX7        [2]
12AY7        [3]
6550A        [7]
6V6          [1]
6CA7/EL34    [1]
6BQ5/EL84    [1]
6L6-GV       [14}
6U10         [4]

Verity of tubes, 10.
Sets of Curves digitized, 37.

[#] = families of curves.
 On the right and below
are the plate characteristics
of a 12AT7 dual triode.  As
produced by 3 different

 I wanted the data on the
right but the aspect ratio  
was the opposite of what
works best with the
digitizing tool.

 So I stretched the image
with my photo editor as
shown below and then
proceeded to digitize it.
I used the digitizing utility to convert the 3 sets of plate characteristics on the right and combine them into one
drawing so that they could be compared.
  Above is an ACAD drawing of the plate characteristics of a 12AU7, constructed from 2 sets of
plate curves.  

  One set is produced by positive control grid voltages, (red).  The other set is produced by negative
control grid voltages,

  I decided to improve on the traditional representation of the control grid curves and expanded them
along the Z-axis by grid voltage.
  The display above shows the results of a plate current
calculation for :
a plate voltage of 300 volts,  and a control grid voltage of -7.5 volts.

The transfer curve for a -7.5 volt grid is not contained in the
reference data.  The program interpolates for values between the
existing reference data to provide the necessary characteristic to
determine the plate current for the supplied grid voltage.

red horizontal line shows the plate current for a -7.5v grid. The
blue horizontal lines show the real values used to create the
virtual data necessary to calculate the plate current.
The text boxes shown above contain the
arguments and results of a plate current
At the left are the
results of combining
Function, (green),  
with the
SPD, (black)
curves of a 3 watt
White Light LED.
The calculations shown :
(T1 = Black : T2 = Green)
T1 * T2
* Inv(T2) (Inverse of T2)
T1 + T2
- T2
More details below.
3-D Plate Characteristics
More views of this drawing are available here.
And now for something completely different.
    The image above is the Luminosity Function along with the inverse of the function.   

    I produced the inverted function by flipping over the JPEG that I was digitiaed for the normal
function.  The function was not centered in the image that I digitized and that resulted in the
horizontal offset noticeable between the 2 curves.

    What to do ?
    I used the script tool to draw the blue Luminosity Function trace in to AutoCAD.

    Then I mirrored it across the unity gain point to produce the inverse function.

    To apply the Luminosity Function to the data I multiply it by the blue curve.

    To remove the function form the data I multiply it by the red curve scale factors.
    Trace 1 is digitized PSD data.  Trace 2 is the Luminosity Function.

    Above is a graphic showing how I interpolate a data point in the reference data based on the digitized PSD of a
light source.
    What I doed was, to turn on the function panel and use the "Offset Points",  text boxes and buttons to add values to the data to offset it
across the screen as seen above. Once it is where I want it,  I save it back to the data base that it came from.

    Half of the data points shown in the function curves above were created by the program.  The "Dup. Pnts." button will double the number of data
points in a trace, by calculating a new point between each of the existing ones.
    Above is the result of applying the inverse luminosity function to the black trace that represents the PSD of a 3 watt
white light LED.
   Above is the result of adding the luminosity function to the black trace that represents the PSD of a 3 watt white light
   Above is the result of subtracting the inverse luminosity function from the black trace that represents the PSD of a 3
watt white light LED.
   Above is the result of applying the luminosity function, green trace to the black trace that represents the PSD of a 3
watt white light LED.
I can turn off the graphics display to show intermediate values used by the Trace Math Functions.  The data grid on the right contains the results of
a calculation.  The resulting data can be plotted or stored to the main data base from this grid.
    Note: The scale of the Y-axis has been doubled from 100% to
    This is to accomidate the posibility of doubling the input data as a
result of the trace value manipulation.  The Image was not rescaled.
Above is the composite overlay of the individual data sets shown previously.
[                    ]
[                  ]