Anthony's VBA Forum Index Anthony's VBA Forum
Where the knowledge is shared
 Anthony's VBA Forum IndexHome Page
 Anthony's VBA Forum IndexForum Index
Log in to check your private messagesMessages
Log inLogin/Out

Quick Search

Advanced Search


Who's Online
[ Administrator ]
[ Moderator ]

Need help in Ballistic Simulation

Post new topic   Reply to topic     Anthony's VBA Forum Index -> Monte Carlo Simulation
View previous topic :: View next topic  
Author Message

Joined: 01 May 2007
Posts: 1

PostPosted: Tue May 01, 2007 11:27 am    Post subject: Need help in Ballistic Simulation Reply with quote

This is the scenario:
You are trapped in a tower by the fiendish General Kash-Mai-Chek*. Through the window you can see a small target on a pedestal some distance away. To gain your freedom you have to push a large rubber ball out the window at such a speed that it bounces and strikes the target. The ball has a measured radius and a certain elasticity, representing the proportion of its vertical velocity retained (with opposite sign) when it bounces. We will assume no loss of horizontal momentum at each bounce, and the ball doesn't spin. The window and target heights are known, as is the horizontal distance to the target.

And because General Kash-Mai-Chek is such a fiend he requires that the magnitude of the ball's velocity at the time it hits the target be the minimum possible, and that it not be rising. In other words, the ball has to bounce enough times to lose vertical momentum, but not too many times that it doesn't bounce as high as the target. It also has to strike the target exactly at the top of a bounce (if feasible), or on the way down. As a result, there is a unique solution for all feasible cases.**

Fortunately you have been allowed a few practice attempts. For the first part of the assignment (where most of the marks are), you are given values for each parameter, including the initial horizontal velocity, and you only have to determine the height of the ball when it reaches the target distance and its final velocity. If it is within a short distance of the target you are FREE, otherwise you are DOOMED. You don't need to confirm General Kash-Mai-Chek's extra fiendish requirement in this case.

The second part tackles the harder problem of determining the optimum initial speed so you can be guaranteed freedom.

The tower window is 15m above the ground, the target is 6m above the ground and 42m away. The initial velocity of 4.8ms–1 bounces the ball three times and just falls below the target on the next bounce. The yellow cells were calculated: number of bounces, final height and final vertical velocity.

[b]Mathematical Background[/b]
Our ball obeys Newton's Laws for the duration of each bounce. Air resistance is ignored, and horizontal velocity is constant throughout. The initial vertical velocity is zero, but under the influence of gravity it increases in magnitude, and is negative (downward). The instantaneous velocity Vy at time t since the ball was pushed out the window is given by

Vy = –G t
where G is acceleration due to gravity, 9.78ms–1 at the Earth's surface.

The position of the ball at any time t before the first bounce is given by:
x = Vx t
y = h + Vy t = h – G t2
where x is the distance from base of window, y is the height of centre of ball, and h is the height of the window.

When does the first bounce occur? When y = R the ball is in contact with the ground. Ignoring deformation (squashing) of the ball, the vertical velocity at that instant is reversed in sign so it's now positive, and its magnitude is multiplied by E, the elasticity of the ball. The ball then sails upward with this initial velocity V1 and the position equation for y becomes:

y = R + V1(t – t1) – G (t – t1)2
where t1 is the time of the bounce.
Part A: Simulation[/b]
The above equations express the situation in instantanous, continuous terms. We want to take a snapshot at successive instants of time, making a what's called a discrete-event simulation. We can chart the sampled positions and analyse them various ways, but the simulation represents an approximation.

The critical parameter is how often we sample the ball's position.

* If it's too large, errors will accumulate at each bounce.
* If it's too small, the list of positions will be inconveniently long.

For the scale of this problem, the time increment is set at 5ms (0.005 seconds, or 200 samples per second).

Your program (throught the simulation subprogram) will need to increment time by this amount, determine where the ball is, and write the values of t, x and y to the associated worksheet.

You detect a bounce when y <= R rather than the exactly equal case, because in the last 5ms y may have dropped just below R.
At the bounce, reset the value of y to R exactly. This is important, otherwise your answers won't be consistent with ours.

And for [b]Part B: Optimisation[/b]

Note: this part is difficult, is worth only 3/20 and should be attempted only by students expecting a high grade in the course, and only when Part A is working perfectly. Other students should skip to the next section.

If the Vx cell is empty or zero, use the remaining parameters (including the iteration limit) to try to converge to a value of Vx that satisfies all requirements, no matter how fiendish. You will need to consider

1. How to produce an initial guess at Vx
2. How to adjust Vx after each simulation attempt
3. Stopping if the iteration limit is reached

For (a), you may find the following useful: Since the bounce heights vary as E2, you can calculate the (real) number of bounces from h, th and E. Calculate the time to the first bounce (t1), ignoring the effect of R. From t1 and nb it is possible to determine the time to reach the target distance, and thus the required Vx. Because this hasn't included R, and doesn't take into account the slight adjustment at each bounce due to the simulation, you answer will be only approximate, but a good start.

For (b), if the ball is a bit low, you can use the distance when it passed the required height to change Vx linearly. This has good convergence characteristics. If it's too high, you could continue the simulation to see where it passes the required height, or some other method. Whatever method you apply should be clearly documented as comments in the submission.

You will need to (carefully) change BounceIt, as it has a safety lock to prevent Part A solutions from spinning (executing indefinitely) when Vx isn't positive.
Back to top
View user's profile Send private message Yahoo Messenger

Joined: 07 Aug 2009
Posts: 1

PostPosted: Sat Aug 08, 2009 5:27 am    Post subject: Reply with quote

Excellent. Thanks for sharing.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Anthony's VBA Forum Index -> Monte Carlo Simulation All times are GMT - 4 Hours
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group