Numerical calculations of a railgun yielded disappointing results

Click For Summary
SUMMARY

The forum discussion centers on the simulation of a railgun using MATLAB, focusing on the disappointing performance results. The simulation incorporates parameters such as a 0.1-ohm wire resistance, a 500V capacitor bank, and a projectile mass of 10 grams. Despite discharging approximately 3750 Joules of energy, the projectile only achieves a velocity of 1.3 m/s due to significant energy loss, primarily from friction. Participants suggest exploring the use of inductors to improve efficiency and debate the appropriate magnetic permeability to use in calculations.

PREREQUISITES
  • Understanding of MATLAB programming for simulations
  • Knowledge of electromagnetism principles, specifically magnetic permeability
  • Familiarity with railgun design and electrical properties
  • Basic concepts of energy transfer and efficiency in electrical systems
NEXT STEPS
  • Investigate the effects of magnetic permeability on railgun performance
  • Learn about the skin effect in conductors and its impact on current flow
  • Explore the integration of inductors in railgun circuits to enhance efficiency
  • Research finite element analysis (FEA) programs for advanced railgun simulations
USEFUL FOR

Engineers, physicists, and hobbyists interested in electromagnetism, railgun technology, and simulation modeling will benefit from this discussion.

Aeroflux
Messages
3
Reaction score
2
TL;DR
Simulating a railgun in Matlab with simple numerical methods, with a hypothetical 500V 30mF capacitor and a 5mm wide square projectile, and it barely accelerated at all.
[CODE lang="matlab" title="RG_numerical_sim" highlight="14-25,43,48,49"]clear
clc

u0= 4*pi*1e-7 %magnetic permittivity constant

%simulation settings
n=1000;
v=zeros(1,1000);
t = linspace(0,0.1,n);
%railgun electrical properties
R_wire = 0.1; %0.1 ohms of wire
R_projectile = 2e-6;
R_t = R_wire+R_projectile;
V_cap = zeros(1,n);
V_cap(1) = 500; % capacitor maximum voltage
C_cap = 0.03; % Capacitance in farads

SR_rail = 2*2.488e-4; %specific resistance of rails

%Railgun setup
d=0.005; %rail separation
w=d; %projectile width
r=d/sqrt(2); %projectile radius
m=0.005; %mass in kg
u_s = 0.53; %friction factor between copper and steel
l_rail = 0.5; %length of rail

v(1) = 5; %initial velocity
B0=0; %magnetic field from permenant magnet
s=zeros(1,n); %updated, displacement from initial position
I=zeros(1,n); %current over time
B=zeros(1,n); %magnetic field from rails
a=zeros(1,n); %acceleration
F=zeros(1,n); %magnetic force

warning=0;
for i=1:n
if(s(i)<=l_rail) %rail length of 0.5m
%capacitor discharge
dt=t(2)-t(1);
q=V_cap(i)*C_cap;
R=R_t+SR_rail*s(i);
I(i)=V_cap(i)/R;
dq=-I(i)*dt;
V_cap(i+1) = (q+dq)/C_cap;

%calculate magnetic force
B(i)=B0+abs((u0*I(i))/(2*pi*d)*log((d-r)/r));
friction=m*u_s*10;
F(i)=I(i)*B(i)*w;
if(F(i)<=friction && warning ==0)
disp('Warning: magnetic force unable to overcome friction')
warning = 1;
end
a(i)=(F(i)-friction)/m;
v(i+1) = v(i)+a(i)*dt;
s(i+1) = s(i)+v(i)*dt;
else
v(i+1) = v(i);
V_cap(i+1) = V_cap(i);
s(i+1) = s(i)+v(i)*dt;
end
end
if(s(end)>l_rail)
fprintf('muzzle velocity of %d m/s',v(end))
end
E_cap=0.5*C_cap*(V_cap(1)^2-V_cap(end)^2);
KE_gain=0.5*m*(v(end)^2-v(1)^2);

fprintf('Energy discharged by capacitors: %d Joules\n',E_cap)
fprintf('Kinetic Energy gained by projectile: %d Joules\n', KE_gain)
efficiency = KE_gain/E_cap

tiledlayout(2,2)
nexttile
plot(t,V_cap(1:1000)./R);
xlabel('time(s)')
ylabel('Current(A)')

nexttile
plot(t,B(1:1000));
xlabel('time(s)');
ylabel('Magnetic field (T)');

nexttile
plot(s,V_cap./R)
xlabel('distance along rail (m)')
ylabel('Current(A)')

nexttile
plot(t,v(1:1000))
xlabel('time(s)')
ylabel('velocity(m/s)')[/CODE]
Since my first class in electromagnetism, I have been fascinated by the simple yet powerful railguns. But since building one can be expensive and potentially dangerous, I've opted to simulate one in Matlab for now. I've studied electromagetism in the first year of physics, and I have attempted to derive a formula about the forces on a square railgun projectile, but is confused on whether the projectile's thickness or length have any affect. So I decided to use the formula on this site for my calculations.

1737468099940.png


The basic design (cross section) looks something like this. 2 rectangular copper rails placed 3mm apart, with grooves for the projectile to sit on and maintain electrical contact. The rails would be 0.5m long. The projectile itself would be a square prism 5mm on its side, and assume it weighs 10 grams. The capacitor banks would be 3x 500V 10mF electrolytic capacitors. I made an assumption of the wires having 0.1 ohms, and add it up with the resistance of the rails and projectile. In addition, the projectile will have an initial velocity of 5m/s from a spring that pushes it into the barrel. I also searched up that copper and steel has a friction factor of 0.53. Let the simulation begin:
1737468428792.png

Oh no! It appears that the capacitors gets drained within 10 milliseconds, accelerating the projectile by a measly 1.3m before it starts slowing down due to friction. So the capacitors is going to dump like 3750J of energy into the system, sent sparks flying, only to deliver less impact than a nerf dart. Running the code again with different values, it would take like 4200 volts to accelerate the projectile to 100m/s, 12kV to break the sound barrier (the air between the rails would break down first).
I will attach my code below if anyone is interested in trying it out, and bonus for pointing out any mistakes I made. But if it was correct, should I blame it on the magnetic permittivity being only 1.2*10^-6, give up my fantasies about having a railgun, and start daydreaming about coilguns instead?
 

Attachments

  • Screenshot 2025-01-22 002838.png
    Screenshot 2025-01-22 002838.png
    21.8 KB · Views: 64
  • Like
Likes   Reactions: Dale
Physics news on Phys.org
Cool project! Thanks for sharing it.

It does look like the efficiency is pretty low. If half of the 3750 J gets into the projectile KE then you would get over 600 m/s. So far more than half of the energy is going elsewhere. I wonder if adding an inductor would improve the transfer.
 
Dale said:
I wonder if adding an inductor would improve the transfer.
I was wondering about that too. But my simulation doesn't account for any inductance of the circuit, and the capacitor discharges under ideal circumstances. So, I'm not sure if an inductor is going to help with that, assuming it didn't get obliterated by the huge spike in voltage and current.
I have another question that I'd like to ask though. Should I use the permittivity of magnetic field through a vacuum for the simulation, or should I use the permittivity of magnetic field through the projectile material? Because if I was to use the permittivity of ferritic stainless steel, it would give an astounding 65% efficiency and propel the projectile to mach 2.

1737501395926.png
 

Attachments

  • 1737501191665.png
    1737501191665.png
    14.5 KB · Views: 51
Aeroflux said:
Should I use the permittivity of magnetic field through a vacuum for the simulation, or should I use the permittivity of magnetic field through the projectile material?
Electric permittivity, or magnetic permeability ?
Do you model "skin effect" that will limit the initial current in the copper rails ?
 
Baluncore said:
Electric permittivity, or magnetic permeability ?
Do you model "skin effect" that will limit the initial current in the copper rails ?
Magnetic permeability of course, from the table below.
The simulation is very simple, so skin effect is not modelled. Maybe I can try to simulate it with an FEA program or something like that.
1737504158150.png
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 16 ·
Replies
16
Views
1K
  • · Replies 0 ·
Replies
0
Views
1K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 14 ·
Replies
14
Views
2K
Replies
3
Views
3K