# ScanTesla

### From HvWiki

## Contents |

## ScanTesla Instructions

ScanTesla is a computer program by Terry Fritz designed to do computer modeling of Tesla coils. The program is capable testing millions of combinations of component values and finding the best configurations. The program uses real time linear analysis techniques in an engine from Antonio that actually “runs” virtual Tesla coil models inside the computer at very high speed. Unlike circuit simulators like MicroSim, ScanTesla can iterate through many component values and run hundreds of models per second in a giant search for the very “best” Tesla coil configuration. ScanTesla is designed to model both conventional spark gap type Tesla coils and the new DRSSTC coils. It will not do tube type or CW coils at this time. ScanTesla is free and the source code is in the Public Domain and included in the “zip” file. The “C” program is simple and easy to modify and compile as needed. The free lcc compiler was used to create it. The program will be improved over time as new data becomes available and the program is refined.

## The Input File

ScanTesla reads all of it's data from a simple input file called “input.txt”. This file tells the program all the coil's data and tells the program how to process it. The file has help text in it that start with a “*” which tells the program that the text on that line is not to be used buy the program itself. Lines that do not start with “*” are read into the program as live data. The order and number of live data lines cannot be changed and it is important not to mess this up ;-) The simple pure text file can be modified with any simple text program such as Windows NotePad. A typical input file follows:

* ScanTesla Parameter Input File V-7.50 * * This file should be in the same directory as the program. * * Lines starting with "*" are ignored. * * The program expects these input parameters in order and as shown. * * These parameters define the coil values to be scanned. * * Cprimary (Farads) - start, stop, Inc 150.5e-9 150.5e-9 50.0e-9 * Rprimary (Ohms) - Start, Stop, Inc 0.12 0.12 1.0 * Lprimary (Heneries) - Start, Stop, Inc - If Inc < 0 then automatic Lprimary tuning is used 1.00e-005 2.00e-005 1.0e-7 * Lsecondary (Heneries) - Start, Stop, Inc 73.63e-3 73.63e-3 1.0e-3 * Coupling - Start, Stop, Inc 0.1723 0.1723 0.01 * Rsecondary (Ohms) - Start, Stop, Inc 460.0 460.0 1.0 * Csecondary (Farads) - Start, Stop, Inc 31.085e-12 31.085e-12 1.0e-13 * Cload (Farads) - Start, Stop, Inc - If Inc < 0 then automatic streamer load is used 3.0e-12 3.0e-12 1.0e-12 * Rload (Ohms) - Start, Stop, Inc 220.0e3 220.0e3 1.0e3 * Time (sec) - Start, Stop, Inc - If Inc < 0 then automatic timing is used 0.0e-6 750e-6 1.0e-7 * Vrail - DRSSTC Buss Rail Voltage (volts) - 0.0 for a conventional coil. 0.0 * VCprimary Initial Value (volts) - Primary capacitor voltage for a conventional coil. 0.0 for a DRSSTC. 5400.0 * BPS - Coil Breaks Per Second 120 *Dwell Time (sec) start, stop, inc - DRSSTC T1 time. Ignored for conventional coil. 500.1e-6 500.1e-6 10.0e-6 * DRSSTC Current Limit (Amps) - Set very high for conventional coil. 10000.0 * Coil Power Limit (Watts) 18000.0 * Goal Type - 0=find maximum VCsecondary 1=find maximum streamer power 2=find all 1*

### Cprimary

The primary capacitor value is defined first:

* Cprimary (Farads) - start, stop, Inc 150.5e-9 150.5e-9 50.0e-9

The three live lines after the help line tell the program that the value of the primary capacitor should "start" with the value 150.5e-9 Farads, "end" with the value 150.0e-9 Farads and "increment" the value 50.0e-9 Farads. In this case, the starting and stopping values are the same, so the program will use 150.5e-9 Farads for the value of the primary capacitor and never change it. The “e” means the value following is the standard 10^ exponent value. Thus, 150.5e-9 is the same as 0.0000001505. The program can accept any value in this scientific notation. Since the value of Cprimary is never changed, the increment value 50.0e-9 is ignored. Note: The increment value must be greater than 0.0 or the program gets stuck.

### Rprimary

The “total” resistance of the primary circuit is represented by Rprimary. This resistance is the sum of primary capacitor resistance, spark gap resistance, primary coil resistance, DRSSTC driver resistance, etc. This AC resistance is at the coil's running frequency. If you don't specifically know your coil's Rprimary resistance, use 3 ohms for a conventional spark gap coil or 0.1 ohms for a DRSSTC and SISG. The inputs for this value are formated just like Cprimary as are the rest.

### Lprimary

The coil's primary inductance can be found by “Wheeler's Formula” or with the many other Tesla coil programs available. It can also be directly measured if you have the tools. In this case, the value is “scanned”:

- Lprimary (Heneries) - Start, Stop, Inc - If Inc < 0 then automatic Lprimary tuning is used

1.00e-005 2.00e-005 1.0e-7 The primary inductance is set to start at 1.0e-5 Heneries and goes to 2.0e-5 Heneries. The value will be changed in 1.0e-7 Henery steps. If the Increment value is less than 0.0, the program will automatically "tune" the primary inductance for you.

### Lsecondary

This is the inductance of your secondary coil. It can be found with the formulas, other programs, or by direct measurement.

### Coupling

This is the primary to secondary coil “Coupling Coefficient”. Programs like “MandK” can calculate the value very accurately as can some newer Tesla coiling programs. It can be measured with a little work. It is a fairly important number to know...

### Rsecondary

There are programs now that calculate this number. It can be found by fairly difficult measurement... I would say just set it to like 500 and be happy ;-)) Almost all coil's are in the 300 to 700 range and it is not very critical.

### Csecondary

This is your coil's total secondary capacitance. This would be the sum of the Medhurst and top terminal capacitance. Programs like E-Tesla will calculate it as will many other programs. You really should know this number.

### Cload

This is the streamer capacitance. It is 1e-12 for every foot of streamer you have or expect. If you streamers are 2 feet long, it is 2e-12. If your streamers are 11 feet long it is 11e-12... There is a lot behind that but the rule is just that simple... If the increment value is less than 0.0, the program will use the streamer energy to automatically calculate the load.

### Rload

The value is 220.0e3. It does not change... Trust me ;-)

### Time

This is the time the models all run. It is fairly important! In this case:

* Time (sec) - Start, Stop, Inc - If Inc < 0 then automatic timing is used 0.0e-6 750e-6 1.0e-7

It starts at zero seconds and I cannot think of a case that it would not. It goes to 750uS. It is important to let the model run long enough that all the coil's “stuff” has time to be fully over before the model ends. In many cases, I would put that at 1e-3 seconds. After things are tried, this number may be refined as needed. Just don't ever make it too short ;-) The increment value has a trick. If you make it less than zero, the program will automatically “just fix it”. In most cases, just make it -100e-9 and the program will take care of it. It assigns a time of 100 step per cycle when negative which is really good without waisting a lot of time. If it is a positive number, the program will use it faithfully.

### Vrail

This is the DRSSTC coil's driver rail voltage. If you have a regular spark gap coil, set this value to 0. For DRSSTCs this voltage is like 340.

### VCprimary

This is the coil's initial primary capacitor voltage. Set it to 0 for a DRSSTC. For a conventional coil, it will be 1.414 x your high voltage transformer voltage. For a 15kV NST, it is 21210.

### Dwell Time

This is only for the DRSSTC (T1 time). Set it to 1 for conventional coils.

### DTSSTC Current Limit

This is a primary current limit for DRSSTCs. DRRSTC people can set it to their coils. Conventional coils can be set to 10000 Amps.

### Bang Energy Limit

This the maximum bang energy that is accepted. The program can get kind of crazy at times and give giant sparks if given giant input power levels... If your coil is say 1500 watt at 120 BPS, then the bang energy is 1500 / 120 = 12.5 joule. You can set this really high if you want or use it to limit your coil's input power for the program.

### Goal Type

This is just the number 0, 1, or 2. 0 will tell the program to search for the configuration that give the maximum top terminal voltage. Very useful for tuning... 1 will tell the program to search for maximum streamer power. Useful for long arc configurations... 2 tells to program to dump "every" model's data into a big file called “outputdata.csv” that other programs like Excel, OpenOffice, MathCad, etc. will use to make pretty graphs and do sophisticated analysis.

## Screen Display

The program has a DOS screen display when running. It will first give the input values for verification purposes.

ScanTesla V-7.50 May 31, 2006 Terry Fritz C1 1.505000e-007 1.505000e-007 0.500000e-007 R1 1.200000e-001 1.200000e-001 1.000000e+000 L1 1.000000e-005 2.000000e-005 1.000000e-007 L2 7.363000e-002 7.363000e-002 1.000000e-003 K12 1.723000e-001 1.723000e-001 1.000000e-002 R2 4.600000e+002 4.600000e+002 1.000000e+000 C2 3.108500e-011 3.108500e-011 1.000000e-013 C3 3.000000e-012 3.000000e-012 1.000000e-012 R3 2.200000e+005 2.200000e+005 1.000000e+003 T1 0.000000e+000 7.500000e-004 1.000000e-007 Vrail 0.000000e+000 VCpri_init 5.400000e+003 BPS 1.200000e+002 DwellTime 5.001000e-004 5.001000e-004 1.000000e-005 Current_Limit 1.000000e+004 CoilPower_Limit 1.800000e+004 Goal Type 1

It will then list a host of data for the preset best match found so far. This screen data is also recorded to the file “output.txt”.

ScanTesla V-7.50 May 31, 2006 Terry Fritz Goal = 1.295620e+000 Maxium Load Energy Model Number = 67 Goal Number = 67 Cprimary = 1.505000e-007 Lprimary = 1.660000e-005 Rprimary = 1.200000e-001 Coupling = 0.172300 Csecondary = 3.108500e-011 Lsecondary = 7.363000e-002 Rsecondary = 4.600000e+002 Cload = 3.000000e-012 Rload = 2.200000e+005 BPS = 120.000000 Dwell (T1) Time = 5.001000e-004 Ilprimay Maximum = -510.492685 ICprimary RMS (Arms) = 22.3 ILsecondary RMS (Arms) = 0.32383 VCprimary Maximum = 5388.878082 VCsecondary Maximum = 287774.220565 Coil Power = 263.314800 Primary Bang Energy = 2.194290 Load Power = 155.474418 Load Bang Energy = 1.295620 Leader Length (in) = 29.9 Primary F0 = 100692.665537 Secondary F0 = 105200.376849 Load Energy Rise Time (uSec) = 126.1 Models Tested = 101 / 101

The “goal” is terminal voltage or load energy as defined by the input file. Model number and Goal number keep track of where the program is at. The program shows the present model coil values that are being processed... But the real stuff follows...

Ilprimay Maximum = The maximum primary current ICprimary RMS/sqrt(BPS) = This number times SQRT(BPS) is the primary RMS current VCprimary Maximum = Maximum primary voltage VCsecondary Maximum = maximum secondary voltage Bang Energy = joule of energy per bang Load Energy = joule of energy to the streamer per bang Primary F0 = 75026.359680 Secondary F0 = 68112.027831 Load Energy Rise Time = This is the 10% to 90% rise time of streamer load energy that seems to be very important!

## The Output Files

The program has three output files.

### output.txt

list the input variables and records the best configurations, in order, as the program runs. When the program is finished, the best model will be at the bottom of the file.

### waveforms.csv

is a file that can be taken by Excel, OpenOffice, MathCad, etc. and has all the actual waveform data from the best run. This can be used to plot Vsecondary, Iprimary, ect. as a function of time. The first row in the file lists what the each column of data represents. There are examples and column explanations in these files:

- waveforms-Explanation.txt
- OpenOffice-waveforms-example.ods
- ScanTesla750-MathCad-V6e-waveforms.MCD

### outputdata.csv

is used in mode 2 and lists "all" the input and output data points for every single model in the simulation. It can be used by Excel, OpenOffice, MathCad, etc. to make very pretty graphs and so sophisticated analysis of the coil. There are examples and column explanations in these files:

- outputdata-Explanation.txt
- OpenOffice-outputdata-example.ods
- ScanTesla750-MathCad-V6e-outputdata.MCD

## Example of use

Lets take the following input file:

* ScanTesla Parameter Input File V-7.50 * * This file should be in the same directory as the program. * * Lines starting with "*" are ignored. * * The program expects these input parameters in order and as shown. * * These parameters define the coil values to be scanned. * * Cprimary (Farads) - start, stop, Inc 150.5e-9 150.5e-9 50.0e-9 * Rprimary (Ohms) - Start, Stop, Inc 0.12 0.12 1.0 * Lprimary (Heneries) - Start, Stop, Inc - If Inc < 0 then automatic Lprimary tuning is used 1.00e-005 2.00e-005 1.0e-7 * Lsecondary (Heneries) - Start, Stop, Inc 73.63e-3 73.63e-3 1.0e-3 * Coupling - Start, Stop, Inc 0.1723 0.1723 0.01 * Rsecondary (Ohms) - Start, Stop, Inc 460.0 460.0 1.0 * Csecondary (Farads) - Start, Stop, Inc 31.085e-12 31.085e-12 1.0e-13 * Cload (Farads) - Start, Stop, Inc - If Inc < 0 then automatic streamer load is used 3.0e-12 3.0e-12 1.0e-12 * Rload (Ohms) - Start, Stop, Inc 220.0e3 220.0e3 1.0e3 * Time (sec) - Start, Stop, Inc - If Inc < 0 then automatic timing is used 0.0e-6 750e-6 1.0e-7 * Vrail - DRSSTC Buss Rail Voltage (volts) - 0.0 for a conventional coil. 0.0 * VCprimary Initial Value (volts) - Primary capacitor voltage for a conventional coil. 0.0 for a DRSSTC. 5400.0 * BPS - Coil Breaks Per Second 120 *Dwell Time (sec) start, stop, inc - DRSSTC T1 time. Ignored for conventional coil. 500.1e-6 500.1e-6 10.0e-6 * DRSSTC Current Limit (Amps) - Set very high for conventional coil. 10000.0 * Coil Power Limit (Watts) 18000.0 * Goal Type - 0=find maximum VCsecondary 1=find maximum streamer power 2=find all 1*

It is a SISG coil. All the values are all fixed except Lprimary. The program will search for the best streamer load energy and in effect tell us where to tune Lsecondary for the best output voltage. Once “input.txt” is edited and saved, we just run “ScanTesla750.exe”... The screen will flash by a lot of stuff for a few moments and disappear. The end of the “output.txt” file has the data we want stored. The best last model is at the very bottom of the file.

ScanTesla V-7.50 May 31, 2006 Terry Fritz C1 1.505000e-007 1.505000e-007 0.500000e-007 R1 1.200000e-001 1.200000e-001 1.000000e+000 L1 1.000000e-005 2.000000e-005 1.000000e-007 L2 7.363000e-002 7.363000e-002 1.000000e-003 K12 1.723000e-001 1.723000e-001 1.000000e-002 R2 4.600000e+002 4.600000e+002 1.000000e+000 C2 3.108500e-011 3.108500e-011 1.000000e-013 C3 3.000000e-012 3.000000e-012 1.000000e-012 R3 2.200000e+005 2.200000e+005 1.000000e+003 T1 0.000000e+000 7.500000e-004 1.000000e-007 Vrail 0.000000e+000 VCpri_init 5.400000e+003 BPS 1.200000e+002 DwellTime 5.001000e-004 5.001000e-004 1.000000e-005 Current_Limit 1.000000e+004 CoilPower_Limit 1.800000e+004 Goal Type 1 .............. ScanTesla V-7.50 May 31, 2006 Terry Fritz Goal = 1.295620e+000 Maxium Load Energy Model Number = 67 Goal Number = 67 Cprimary = 1.505000e-007 Lprimary = 1.660000e-005 Rprimary = 1.200000e-001 Coupling = 0.172300 Csecondary = 3.108500e-011 Lsecondary = 7.363000e-002 Rsecondary = 4.600000e+002 Cload = 3.000000e-012 Rload = 2.200000e+005 BPS = 120.000000 Dwell (T1) Time = 5.001000e-004 Ilprimay Maximum = -510.492685 ICprimary RMS (Arms) = 22.3 ILsecondary RMS (Arms) = 0.32383 VCprimary Maximum = 5388.878082 VCsecondary Maximum = 287774.220565 Coil Power = 263.314800 Primary Bang Energy = 2.194290 Load Power = 155.474418 Load Bang Energy = 1.295620 Leader Length (in) = 29.9 Primary F0 = 100692.665537 Secondary F0 = 105200.376849 Load Energy Rise Time (uSec) = 126.1 Models Tested = 101 / 101

It says that when Lprimary was 16.6uH, the streamer energy was the highest at 155.474418 watts. If we open the file “waveforms.csv” with OpenOffice and plot say VCsec, we get: