Jump to content
Sign in to follow this  
Dragonian

Artillery ballistic trajectory calculations

Recommended Posts

I'm creating my own little piece of artillery script, but I'm having a problem combining the airfriction (drag) to the calculated muzzle velocity. I'm not a mathematician so all these predefined equations are a bit hard for me to understand instantly.

This is where I'm at:

- Muzzle velocity is said to be: _velocity = sqrt (4.9 * _distance / ((sin _angle) * (cos _angle)))

- This is what gets me the airFriction of any shell: _airfriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction")

- Arma drag model is said to be: _drag = _airfriction * _velocity^2

So with my logic I would then have the real muzzle velocity with this: _velocity + _drag

but this actually substracts the overall muzzle velocity because airfriction is a negative value.

Even when I substract the _airfriction from the _velocity the shells still fall short.

Any corrections or general ideas? huh.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]I'm creating my own little piece of artillery script, but I'm having a problem combining the airfriction (drag) to the calculated muzzle velocity.

I'm not exactly sure what you're trying to do. Do you want to vary the velocity a round is fired at, to hit targets at different ranges. As opposed to the games method of keeping a fixed muzzle velocity and varying the elevation?

Quote[/b] ]Muzzle velocity is said to be: _velocity = sqrt (4.9 * _distance / ((sin _angle) * (cos _angle)))

Are you sure that’s correct? It may be for parabola maths, where it's assumed there is no drag factor. But I thought as soon as you include drag, you have to calculate the trajectory across time slices like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;***********************

;This Script By UNN V1.0

;***********************

_TargetHeight= _This select 0

_IntAngle = _This select 1

_CurrCd = _This select 2

_IntVelocity= _This select 3

_CurrRange = _This select 4

_Index = _This Select 5

_Reverse = _This Select 6

;Initialise local variables

_TimeInt = 0.1

_IntRho = 0.1

_Gravity = 9

_XPos = 0

_YPos = 0

_DelX = 0

_DelY = 0

_DelVx = 0

_DelVy = 0

_Angle = 0

_FlightTime = 0

_InFlight = True

_Return = [0,0]

_Rho = _IntRho

_Velocity = _IntVelocity^2

_Angle = _IntAngle

_Vx = _IntVelocity*Cos(_Angle)

_Vy = _IntVelocity*Sin(_Angle)

_CurrCd = _CurrCd / 10000

_XPercentage= (_CurrRange / 100)*80

;Calculate the trajectory

#InFlight

@(True)

;Calculate how much of the velocity is lost to drag and gravity

_DelVx = (-_TimeInt*((_Rho*_CurrCd)))*_Velocity*Cos(_Angle)

_DelVy = -_TimeInt*_Gravity-(_TimeInt*(_Rho*_CurrCd))*_Velocity*Sin(_Angle)

;Over a period of 0.1 seconds

_DelX = _TimeInt*(_Vx+_DelVx)

_DelY = _TimeInt*(_Vy+_DelVy)

;Adjust the velocity

_XPos = _XPos+_DelX

_YPos = _YPos+_DelY

;Increment the time in flight

_FlightTime = _FlightTime+_TimeInt

;The trajectory has hit the ground so store the result and end the loop

If !(_Reverse) Then {If ((_YPos < _TargetHeight) and (_XPos > _XPercentage)) then {_InFlight = False; _Return = [_XPos,_FlightTime]}} Else {if (_YPos < _TargetHeight) then {_InFlight = False; _Return = [_XPos,_FlightTime]}}

;Prepare for the next time slice

_Rho = _IntRho*Exp(-0.000057*_YPos)

_Angle = ATan(_DelY/_DelX)

;Reposition the round according to the new velocity

_Vx = _Vx+_DelVx

_Vy = _Vy+_DelVy

;Calculate the new velocity

_Velocity = (_Vx^2)+(_Vy^2)

;See if the shell has landed

If (_InFlight) Then {goto "InFlight"}

;Save the result to the array

[_Index,+_Return,FCU_TRAJECTORY] Call FCU_SetIndexStatus

;Tell GroupRange.sqs we have a result

[_Index,False,FCU_CALCULATING] Call FCU_SetIndexStatus

This is a script from a Mortar addon I did for OFP. At that time we didn’t have access to the drag coefficients for ammo, so I had to use trial and error to come up with a value for _CurrCd, which in the script, is the variable I use to hold the ammo drag coefficient.

It would be great if you could calculate the impact point with just one quick equation, given muzzle velocity, drag coefficient and barrel elevation e.t.c

The above script is quite time consuming and made my AI Forward Observer very unwieldy.

Share this post


Link to post
Share on other sites
Quote[/b] ]I'm not exactly sure what you're trying to do. Do you want to vary the velocity a round is fired at, to hit targets at different ranges. As opposed to the games method of keeping a fixed muzzle velocity and varying the elevation?

Yes. The script would calculate the needed muzzle velocity to fire the shell to a predefined location with given angle.

Quote[/b] ]Are you sure that’s correct? It may be for parabola maths, where it's assumed there is no drag factor. But I thought as soon as you include drag, you have to calculate the trajectory across time slices like this:

As I said I'm not a mathematician so all of these equations are ripped from someone else's work. This being said, I am not sure at all. biggrin_o.gif

Thanks for the script. I try to wrap my head around it and find some results for this.

Share this post


Link to post
Share on other sites
Quote[/b] ]Yes. The script would calculate the needed muzzle velocity to fire the shell to a predefined location with given angle.

Have you tried setting the ammo drag to 0, to see if it matches your required distance? I know it's not very realistic, but it might help confirm if your initial equation is correct.

Quote[/b] ]As I said I'm not a mathematician so all of these equations are ripped from someone else's work.

Same goes for me, I scavenged the maths off the net, from a ballistics spread sheet example written for some University course. I can’t seem to find it now, but there are other examples in Excel, if you search.

Share this post


Link to post
Share on other sites

Problem with drag coeficients is that they apply to the cross section of the object when the angle of attack is 0. This might work with objects like the GBU (which angle of attack seems to be always close to 0), but other shells dont change their vectorUp as they move in the parabolic trajectory, so the angle of attack is changing "a lot" all the time and any calculations based on drag would be quite buggy (unless the initial angle is quite low).

What you can do is to control all the time until impact the vectorDir, vectorUp and velocity of your "scripted" shell to:

1 - Do no consider the drag

2 - Apply always a fixed one to your calculated velocity independently of the angle of attack of the object (because you are in full control of its velocity vector).

Share this post


Link to post
Share on other sites

I'm trying to determine the approximate muzzle velocity of 18th century muskets. I have data that I think would allow this calculation: a musket ball fired from a gun with the barrel elevated 15 degrees travelled a distance of about 1600 yards. The ball weighed a little over an ounce. I assume it was .69 of pure lead and weighed 495 grains. Given this information is it possible to calculate what muzzle velocity is necessary to throw the ball that far?

I don't want to assume velocities obtained with modern black powder. The powder was weaker in the 18th century. For example, a typical load for a Brown Bess (.75 cal -- they used a .69 ball owing to fouling) was as much as 230 grains. Today 100 grains is typical

I suspect that some form of artillery table might provide the necessary equations. However, I don't know where to begin -- that's why I'm posting this.

If anyone can be of any help, I will very much appreciate it! If someone could do the calculation, (I don't need precision -- simply an estimate of the mv), that would be great!!!

Thanks.

Share this post


Link to post
Share on other sites

take a look at Angle of Reach and accommodate

angle = 1/2 * asin ((g * distance)/velocity^2)

where g = 9.80665 // Arma 2 Gravitic Constant Definition (i don't know if it has been updated)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×