Welcome to version 1.0 of Bill's Coilgun Simulator. Name: Bill Slade Address: bill dot slade at ieee dot org (Replace the word "dot" with "." and "at" with "@" to reach me.) Version: Version 3.0 Date: 13 Apr. 2005 Last Modified; 13 Apr. 2005. Note to developers: If you would like to help me develop a graphical interface for this code, please contact me. Note to everybody: Please do the ethical thing and acknowledge me if you use this code in any of your projects. Also, feel free to contact me with feedback! --------------------------------------------------------------------------------------------------- Improvements over version 2.0 are: 1) Inclusion of projectile saturation. 2) Slightly modified driver software. 3) Output to a file (instead of to standard output). 4) Computation of some interesting quantities that may be of use to you designers out there! --------------------------------------------------------------------------------------------------- Some things to keep in mind while running your simulations: 1) Effects of eddy currents in projectile are ignored at this stage. Exit velocities may be overestimated as magnetic braking effects and ohmic losses in the armature are not accounted for (yet). 2) We have ignored projectile/barrel friction effects. 3) Assumes that the armature fills the entire coil region (the barrel). If the armature cross-section is not the same as the coil, reduce the saturation magnetisation by M_new = M0 * A_proj / A_coil to fudge this quantity so that force is not overestimated. M0 is the true saturation magnetisation of the material, A_proj is the true cross-section area of the actual projectile and A_coil is the barrel cross-secion area. M_new is the value of saturation magnetisation that you plug into this simulator. 4) Armature must be as long (or longer than) the coil length. 5) An external field-concentrating sheath is assumed. In reality, this will suffer saturation effects too. However, this simulator assumes that the sheath is a perfect magnetic wall (i.e. no saturation, infinite permeability). Future models will correct this shortcoming. -------------------------------------------------------------------------------------------------- Q: How do I compile the source code? A: In order to compile the code, type gcc -O3 MotionWithSat.c gauss.c -o Motion -lm using the Gnu compiler under Linux, sun. Any Posix-like compiler satisfying the ANSI standard should work... After successful compilation, an executable "Motion" should appear in your working directory. The process should also be simple under Windows, if you have a C compiler installed... ------------------------------------------------------------------------------------------------- Q: How do I run the code? A: To run the code with one of the prepackaged input files, type Motion < in_halfbridge After the program completes, there should be a new file entitled "Data.out". Here is where you find the plottable data in column format. There is also some other data included on the run which is "commented" out (with a hash-sign.... Gnuplot ignores these). The columns also are labeled (time, voltage, current, speed, etc.) More on this later in this document. ------------------------------------------------------------------------------------------------ Q: How do we set up a simulation? A: We need to provide a set of parameters to the code. Let's have a look at what the program requests at runtime... 1) *** Input coil length. (m) This is the length of the coil where acceleration of the armature takes place. The examples provided in this package use 0.03m (30 cm). 2) *** Input armature length. The length of the projectile (at least 0.03m in this case). The example files use 0.035m. 3) *** Input end gap length. This is a "fudge factor" used to approximate the presence of air-gaps in the coil sheath and between the coil sheath and the armature. a few millimeters is usually good (here we use 0.007m). 4) *** Input capacitor value (farads). The value of the firing capacitor (in farads). Values of 0.005-0.1F are common in this type of application. 5) *** Input coil core radius. This is the radius of the barrel. The examples here use 0.01m. 6) *** Input number of turns in coil. The number of turns in the coil. The examples use 150. 7) *** Input the initial relative permeability of the armature. (dimensionless) The so-called "low-field" relative permeability of the projectile. Any number above a few thousand gives similar results. Mild steel has a permeability of about 2000. 8) *** Input the core saturation flux density (in T) This is an important parameter. Values for mild steel range from 1.4 to 2.0T. The choice of 0.7 T in the example files is chosen because the fill-factor for the projectile in the core was about 50% (see #2 under the section "Things to keep in mind".) 9) *** Input coil resistance. (in Ohms) This is the resistive loss in the electrical circuit (coil, driving circuitry). 0.1 to 0.2 ohms is typical and can be measured beforehand to some degree of accuracy using voltage-drop techniques. 10) *** Input the mass of the armature (kg). Use a kitchen scale to see how much your projectile weighs. Mine was 0.026kg (26 grams). 11) *** Driving topology (using ideal switches, i.e. reverse currents allowed): *** <0> = LCR circuit (SCR like drive), <1> = halfbridge, *** <2> = `dump-and-quench' drive. This is where the different switching topologies are selected. The LCR Circuit is simple. However, for the halfbridge, we need to indicate the switch-off time (in seconds). Selecting a switch-off time of 0.0 forces the simulation to select the switch-off time automatically (when the armature begins to exit the coil). If "dump-and-quench" is selected, you need to follow this selection with the switch-off time as well as a resistance value for the quenching resistor. (usually 1-2 ohms works well. See the example data files.) 12) *** Input initial state of system. , , and . These are the initial conditions of the system. Here we specify the voltage on the capacitors and any initial coil current. For multistage systems (where we may want to model one stage at a time), we can specify an initial velocity (which may be non-zero). Also, if we wish to study the effects of initial projectile position, we can also indicate a starting "z" position. 13) *** Input time step. The size of the simulation time step (0.0000001 sec is used in the examples). Don't make this too big or too small. Try to keep it such that about 25000-100000 time steps are executed in the simulation. 14) *** Print every timesteps. We don't want to print every timestep... every 100 is usually sufficient. 15) *** Tolerance for solution. 1.0e-8 to 1.0e-9 is a good choice for this. This specifies the convergence error of Newton's method. *******That's all! Now we are ready to simulate! --------------------------------------------------------------------------------------------------- Q: What's in the output file? A: Lots of hopefully useful info! Starting with: 1) A recap of the input data, which looks like this: # Coil Length (m) = 3.000000e-02 # Projectile length (m) = 3.500000e-02 # Effective gap length (m) = 7.000000e-03 # Effective core radius (m) = 1.100000e-02 # Firing capacitance (F) = 3.000000e-02 # Number of turns in coil = 1.5e+02 # Low-field core relative permeability = 1.500000e+04 # Saturation flux density of core (Wb/m^2) = 7.000000e-01 # Saturation magnetisation of core (A/m) = 5.570423e+05 # Coil loss resistance (Ohms) = 2.000000e-01 # Mass of armature (kg) = 2.600000e-02 # Dump-and-quench with ideal switch. # Pulse on-time (sec) = 0.000000e+00 # Quench resistor value (Ohms) = 1.000000e+00 # Initial capacitor voltage = 1.000000e+02 # Initial coil current (A) = 0.000000e+00 # Initial armature speed (m/sec) = 0.000000e+00 # Initial armature position (m) = 0.000000e+00 # Time step (sec) = 1.000000e-07 # Print out every 100 time steps. # Tolerance for the non-linear solution (Newton-Raphson) = 1.000000e-08 2) The results of the timestepping (i.e. the circuit/projectile dynamics) # Time Voltage Current Speed Position Energy B Force 1.000000e-05 9.999932e+01 -4.077062e+00 5.927169e-06 1.483866e-11 1.500000e+02 -1.746609e-02 4.613314e-02 2.000000e-05 9.999729e+01 -8.120825e+00 4.711686e-05 2.361918e-10 1.499999e+02 -3.478953e-02 1.829721e-01 3.000000e-05 9.999391e+01 -1.213150e+01 1.579982e-04 1.189596e-09 1.499997e+02 -5.197124e-02 4.081258e-01 4.000000e-05 9.998920e+01 -1.610931e+01 3.720687e-04 3.740242e-09 1.499993e+02 -6.901213e-02 7.191428e-01 5.000000e-05 9.998317e+01 -2.005446e+01 7.218730e-04 9.083546e-09 1.499986e+02 -8.591314e-02 1.113521e+00 6.000000e-05 9.997584e+01 -2.396717e+01 1.238985e-03 1.873553e-08 1.499977e+02 -1.026752e-01 1.588716e+00 7.000000e-05 9.996720e+01 -2.784764e+01 1.953994e-03 3.452305e-08 1.499963e+02 -1.192991e-01 2.142150e+00 8.000000e-05 9.995727e+01 -3.169609e+01 2.896490e-03 5.857385e-08 1.499946e+02 -1.357859e-01 2.771220e+00 o o o o o 3) Some statistics which may help with coil design. For example, maximum current will give some indication on how big your switching device (transistor or SCR) needs to be. Max voltages are useful for determining the switching device voltage (to avoid release of factory installed transistor smoke :). # Maximum force on projectile (N) = 2.807394e+02 # Minimum force on projectile (N) = -1.362070e+02 # Average force on projectile (N) = 1.162167e+02 # Maximum projectile speed (m/s) = 2.405871e+01 # Projectile exit speed (m/s) = 2.183232e+01 # Minimum projectile speed (m/s) = 8.944880e-12 # Maximum current magnitude (A)= 3.528017e+02 # Maximum capacitor voltage (V)= 1.000000e+02 # Minimum capacitor voltage (V)= 6.879199e+01 # Maximum core flux density magnitude (T)= 1.807055e+00 # Time at which pulse is switched off (sec) = 3.344300e-03 # CPU seconds used in computation. = 0.840000 -----------------------------------------------------------------------------------------------------------