I want to simulate a CoilGun system in python.
Assume The system circuit as a simple RLC circuit
It is the method that I used :
I used FEMM software to get force & inductance data at different slug distances from coil center.
Then I write the program this way :
let t= 0, z = 0, v=0, current = 0, timestep=0.000001
Loop:
1- increase t a timestep
2- get coil force & inductance data based on z
3- current += current change calculation from RLC circuit in timestep
3- a = F(z,current) / m
4- v = v + a * timestep
5- z = z + v * timestep
But I get an efficiency over 50% with some setups with this simulation ! So I think there is a problem in it .
I also tried this method : calculate new slug kinetic energy and decrease it from coil stored energy in every step(by reducing current) , but I get over 50% efficiency again
Can anyone tell me what is wrong with this way of simulation, or suggest me a better method?