loading

This instructable is about simulation of a linear accelerator for slugs, a.k.a. "coil gun", that consists of a coil that works as an electromagnet for slugs, a capacitor as energy source and an electronic switch like an SCR or Thyristor. This opens a path to optimize slug speed and electrical-to-mechanical energy conversion efficiency.

The software tools are free.

While, electrically, a coil gun is a relatively simple RLC circuit, mechanically it is much more difficult to predict its behavior. This is where the femm ("finite element magnetic method") magnetic simulation tool is an amazing helper.


Find it here:
http://www.femm.info/wiki/download

femm allows to runs scripts written in lua language. See an example here:
http://www.femm.info/wiki/CoilGun

In this instructable I will explain how to set up femm simulations with a lua script to predict the performance of a setup similar to the one in the picture.

Step 1: Electrical Theory

lua allows measurements to be taken from one simulation step and be used as parameters in the next step.
It is straightforward to create a coil/slug setup in femm and then see what the pulling force is for a given current. There are several examples on the web. What is not so straightforward is to determine the current based on capacitor size, charge voltage, coil inductance and coil resistance values.

To get a good start into understanding what influences what in a coil gun,
Barry's coilgun website is a must read.
There, the constant current analysis of a slug accelerator is explained allowing a good understanding of how different parameters affect the force on the slug.
There is also a calculator that shows how voltage and current of an RLC combination behave over time.

In order to get answers to the question of how the combination of capacitor and mechanical coil dimensions affect maximum speed, reverse force or "suck-back", a more sophisticated tool is in order.

CG_1.FEM is the mechanical file that gets loaded by the lua script.
CG_001.lua is started in the femm program.
In the same directory the ...csv files with the results are generated.

Step 2: Schematic and Simplification Thereof

When using a capacitor as energy source, the current is constantly changing during discharge of the cap.
The inductance of the coil varies with the position of the slug. The change in inductance is linked to the force that pulls the slug.
What I am describing here is a simulation with fixed time steps, translating the differential equations for the current of an RLC circuit. This current is then used in the femm simulation to determine the force on the slug. The force is used to calculate the distance travelled during a timestep. Then the calculation is repeated with the new current and the new position of the slug. It ends when the slug has left the coil of when a time limit is met.

The schematic shows how the individual components of the circuit, after the SCR (silicon controlled rectifier) is switched on, can be condensed into the single R and L and C element that is tackled by the differential equation.

You can start using the lua script to input your data, what capacitor(s) you use, how many volts you can charge your cap to, what your slug looks like, coil size and so on without following the theoretical explanations that I present at the end, but they help when expanding the functionality of the script or writing your own programs.

In some forums and in the wikipedia entry about coil guns, there is talk about using IGBTs and "half bridges" as opposed to using a SCR. From a simulation perspective, the differences can easily be accommodated. On the practical side, designing the IGBT gate drive circuits is much more involved than building a simple SCR trigger circuit. An SCR only needs to be switched on by a brief gate pulse and then keeps conducting by itself until the current from anode to cathode becomes too small to hold the conducting state. The SCR switches off and needs another gate pulse to conduct again - in the next shot.
IGBTs ("Insulated Gate Bipolar Transistors") are also switched on by a gate voltage, but they stop conducting when the gate voltage is dropped, like on a regular transistor.
This allows to stop energizing the coil while there is still a large current flowing, which prevents the detrimental "suck back" effect from happening and may help improve the electric-mechanical efficiency of the setup.
IGBTs and their driver circuits are a subject of another instructable.

The three resistive elements of capacitor, switch and coil can be lumped into one resistor. The current-independent voltage drop over the SCR can be subtracted from the start voltage of the capacitor. The spec sheet of an SCR gives an approximation of the current dependent and current independent voltage drop elements.

After switching on the SCR, the voltage of the cap is matched by the voltage over the resistors, internal and external, plus the voltage over the coil.

Step 3: Simulation Parameters; Determining Simulation Inputs

In order to get a simulation started, we need some numbers for a set up with realistic values.

As for the capacitor, it is important to know its internal resistance.
Based on measurements, the big cap used here with 6800uF has an internal resistance of about 40 milliOhm.

Using flash capacitors from recycled disposable cameras, the resistance ("ESR") can be estimated by using the Dissipation factor from the spec sheet:
http://www.rubycon.co.jp/en/products/recommend/r0...

It is listed as 0.06 at a frequency of 120Hz.

The resistance ("ESR" - equivalent series resistance) is then calculated from that as 0.06 over (2 * pi* 120Hz * cap_value) according to the definition here:

https://en.wikipedia.org/wiki/Dissipation_factor

The larger the cap and the more caps you use in parallel, the smaller the overall resistance is. For a 180uF cap, the ESR is 442milliOhm. Putting ten such caps in parallel, the ESR drops to 44.2milliOhm.

The resistance of the wiring other than the coil should be negligible. Let's assume about 1 milliOhm per foot of wiring and 1 milliOhm for every connection. Using thick wires and/or copper sheet strips sure helps.

For the coil, the resistance of the wire can be calculated based on the diameter of the wire. In the lua program, the diameter of the wire is entered as an AWG value ("American Wire Gauge"). From there, the diameter of the wire, the resistance and how much room it takes up in the coil, is calculated. A lower gage means a lower resistance of the coil and a higher current, but the outer turns are farther away from the slug, creating less force. More turns create more force, but also reduce the current due to higher resistance of the winding and they also create more inductance of the coil, preventing the current from rising fast enough to get really big. The current is also on for a longer duration and may cause "suck back" effect, if it is on while the slug moved past the midpoint of the coil.

Getting the maximum speed out of a coil/slug/cap combination is an optimizing process that requires a tool that takes all those parameters into account.

Step 4: A Practical Example

Now I would like to show an example:
The capacitor of 6800microFarad is charged to 350V, the wiring resistance is set to about 10milliOhm, the coil is 50mm long and I tried 3, 4 and 5 layers of magnet wire of 16 AWG. That's about 1.37mm in diameter, including insulation varnish. The resistance per meter I got from tables of magnet wire manufacturers. In this case it is about 13.5milliOhm per meter. The length of the wire for a given coil geometry is calculated in the program. The bobbin used here has a inner diameter of 12mm, the length of the bobbin space is 50mm.

The slug is a 9.6mm diameter steel rod of 50mm length with rounded tip. It weighs 25grams.

Almost there...
The last tidbit to know is the output voltage drop vs. current of a typical SCR: The spec sheets of a useful SCRs contain two numbers we need:
Microsemi datasheet of MSFC110

- the "On state threshold voltage" of 0.9V (V_TO on page 2) and
- the "Value of on-state slope resistance .max" of 2milliOhm per Ampere(T_VJ on page 2).

The resulting forward characteristics is shown as "Fig5." from the data sheet.
This SCR is rated for 110A of average current, but it can take a bit more than 2000A for 10ms without exploding.


The pancake SCR, that is shown in the picture at the top, is rated for 14000Amps for a few milliseconds, it is seriously oversized.


Which leads to the inevitable safety warning:
It could be that something explodes during experiments! Wear eye protection, be super careful with the high voltages of the capacitor and put a sheet of Lexan clear plastic between you and the circuitry. The energy in the capacitor is easily in the kilo-Joule range, very deadly when it flows through your body, while the mechanical energy in the slug is usually less than a few percent of that.
A slug can pierce through soda can metal and wedge themselves into cardboard sheets. Make sure it doesn't wedge itself into your body. Or any body.

Step 5: Results

These graphs were created by importing the data from the .csv files that the lua script generates into OpenOffice calc and turned into pretty pictures. This way we can see how things develop over time, but also how current, force and velocity develop over the length of the coil.
OpenOffice is also free to download.


The first graph shows how the current rises from 0A through the maximum of 1300A back to zero over time.


The second picture shows how the capacitor is discharged and recharged with opposite voltage until the current flow stops. In a practical circuit, this is dangerous to the electrolytic cap (explosive disintegration) and should be prevented by a protection diode parallel to the cap.

The third graph shows the current, dependent on the slug location. It is highest during the first few mm of motion.
The fourth graph show the corresponding acceleration of the slug over location. After the slug passes the midpoint in the coil, acceleration becomes negative. The remaining current brakes the slug down again ("suckback").

This results in the velocity shown in the fifth graph. The velocity goes up to about 35meter per second, but due to the slight suckback, the exit velocity is only about 33m/s.

Step 6: Freewheeling Diode

When the capacitor is discharged, the current does not just stop, but the energy that is now as current in the coil keeps the current flowing until the resistances dissipate that energy as heat. The current starts to charge the capacitor in reverse. In order to protect the electrolytic cap from being charged to -100V, a freewheeling diode in parallel to the capacitor is added to the circuit. The capacitor voltage is kept at about -1V.
In the first graph, the results of 3 simulation runs are shown for a
circuit without diode (yellow graph),
the circuit with the diode (blue graph) and
the diode in series with a 0.3Ohm resistor (red graph).
The diode by itself prolongs the current flow for quite some time, compared to no diode, which leads to more suckback of the slug. By adding the 300milliOhm to the diode, the current drops much faster.


The effect on final speed is shown in the next graph (speed over position). Differences show after about 30mm of slug travel, after the capacitor is discharged and the coil carries the energy.

The yellow trace is of the circuit without diode - the final speed is the highest of all three.
The blue trace shows the results with the diode alone. Due to the prolonged current flow, the suckback effect lowers the final speed considerably.
The red trace shows the effect of diode plus 0.3Ohm. The capacitor sees a little bit more reverse voltage, but the current reduction over time is much better, because the resistor dissipates a lot of energy from the coil.

Step 7: Details...

I was curious about the best timestep to be used. In this graph I tried 0.25ms as timestep, which resulted in the force-over-distance graph on the right curve. It shows the crossover point where the slug gets decelerated at about 60mm into the coil. This cannot be.
Using 0.1ms per timestep, I achieved the result in the left curve, where the crossover point is pretty close to 50mm. That is more like it, because the slug cannot see acceleration past the point where it fully entered the coil.
The downside of using smaller timesteps is the longer runtime of a simulation.
For simulations where a speed optimum is searched, which needs a lot of simulation runs, I would use a bigger timestep to get into the right region of parameters and then refine the results by simulating with a smaller timestep.

.

Step 8: Optimizing Layer Count

This table shows the maximum speed and end speed for different numbers of layers of the coil. No diode was used in these runs.

With 3 layers, the maximum current is very high, but the force generated is not optimal.
Using 4 layers of wire gives a higher maximum velocity and a higher end velocity at a lower current.
Using 5 layers, the maximum velocity is even higher, but the inductance is bigger, which allows the current to flow longer, which leads to suckback and the end velocity is not as high as with 4 layers.
6 layers is too much and decreases the end velocity.
You can also study the effect of different wire thicknesses, starting position of the slug, cap voltage and more parameters.
If you want to improve on the program, it is helpful to understand the underlying math that makes it possible, which I get into in the next step.

Step 9: Calculation of Momentary Current

Step 10: Discrete Time Steps

Step 11: Rearranging for Current Calculations

Step 12: Mechanical Calculations

<p>Cool tutorial. I love it when people include the formulas.</p>

About This Instructable

1,646views

13favorites

License:

More by uses_tools:Coil Gun Simulation with femm4.2 
Add instructable to: