#Ballistics Algorithm
10 messages in this thread
I am interested in trying to write a program that models the path of
projectiles and would like to know if anyone has an algorithm for
calculating the flight path of an object with different initial
velocities, gravitational forces, and wind resistances.
Thanx
Go to your public library and look for an older book on ballistics, say
1945-1965 and see what it has to offer. It should contain some really
simple algorithms for getting basic understanding, and work up from there.
Most recent books on ballistics that I have looked at are quite advanced,
I think many authors expect students to use the older books for entry
level courses. Which is ok, as there isn't any new info on the simple end
of things, although, at the tweaked end there are some radical changes.
It's pretty easy to do a numerical integration on the motion for an
object:
Take initial X,V and a small time step dt. and some acceleration rate a
(= g/m for the real world)
for(t=0;t<Tmax; t+=dt)
{
V += a*dt
X += v*dt
printf("at time %f, object is at X=%f, travelling at %f m/s\n",t,X,V)
}
You'll have to do this for x,y,z coordinates, and remember that a final
total V is added like a vector not just Vx+Vy+Vz.
You physics major, you. Obviously William wants to properly aim bomb-laden
rockets at his neighbor's house. For that, he wants a 1600s equation known as
"Tartaglia's Law," which is a pretty good way to find the rise and range of
pointing a projectile at a certain angle. However, depending on the
projectile's air resistance and the temperature (air density), it's actually
quite tough to predict the motion of projectiles. Especially with little ones
pointed down the block. 😉
Thanks for the tip. I've picked up some equations describing projectile
motion, but I'm having problems making them work. I can figure out how
far and object will travel given an initial speed and angle or how long it
will take to get there, but I'm having trouble coming up with an algorithm
that describes the projectile's height as a function of distance from the
starting point (assuming constant gravitational force and no air
resistance).
Assuming constant gravitational force and no air resistance, you're talking
about a parabola whose axis passes through the point of maximum height.
Assuming target at the same height as the firing point, that occurs exactly
half way between the two points, or at exactly half the interval of the shell's
travel time.
On these assumptions, given distance d between gun and target and maximum
height achieved as h, we can write;
y = h – b * (x – d/2)^2
where y is the height at any point, x the distance from the firing point.
The value of b is easily obtained, since we know that when x=0, y must equal
zero, too. Thus;
b = 4 * h / (d^2)
Depending on what calculations you have in hand already, the above should
fit nicely into your work.
Of course, if you had a spinning projectile moving through atmosphere with
a cross wind and perhaps light precipitation, you'd need to do other things.
[Like duck, perhaps? 🙂 ]
–Jim
The calculation doesn't consider earth rotation (as you allready
mentioned, in later cases, you also have to consider, atmosphere –
temperature and humidity of the gun powder and more).
While an artillery projectile is flying, the earth is rotating further.
Considering a flying time of 20-60 seconds for a granate to reach a target
(let's say from a M203), the rotation becomes real important if you want
to hit a bridge something from 25 miles away. A task, that is possible
with modern military artillery.
Oh yes, there are more things to take care of… temperatur of the gun
powder, direction of the rotation of the projectily (well, in artillery
this is allways the same 😉 Hmm… I forgot most of that stuff…
— Wolf Faust, Am Dorfgarten 10, 60435 Frankfurt, Germany —
Right .. that are a lot of things that make precise calculation a mighty
complex thing. Happily, the request was for the most basic part of the
calculation, where I felt sufficiently qualified to jump in and suggest the
parabola.
Many long years ago, I was amazed to learn some of the behaviour of a rifle
bullet: that the spin caused first a drift to the right, then a veer to the
left; or that rain *lifted* the trajectory rather than pushing the bullet
downwards. Once you get into gyroscopic and Bernouilli effects, intuitive
thinking goes out the window.
–Jim
Yes, that's why I told the rotation of the bullet is important as the
bullet does form a curve because of the rotation.
I would suggest anyone to actually see and hear shooting such a M203 (or
any other >200mm granade) canon. You simply can't image the sound,
precission, power and destruction of such devices. You won't forget it
your whole life and quickly become a pacifist.
Wich shows: CNN simply isn't life…
— Wolf Faust, Am Dorfgarten 10, 60435 Frankfurt, Germany —
90 mm anti-aircraft guns are the largest I have ever operated. They were
quite loud enough for me. 200 mm? I can imagine.
–Jim