Jump to content

Calculating the time to impact on Kerbin


Recommended Posts

I'm writing a python script using kRPC to propulsively land on Kerbin, but I can't find how to calculate the time to impact. Mechjeb and Kerbal Engineer do this, but I don't think kRPC can interact with them. With kRPC I know my current altitude, surface velocity, verticle velocity, horizontal velocity and terminal velocity. Is there an equation that I can use to get the time to impact?

Link to comment
Share on other sites

I can give you a simplified answer.  Ignoring drag and assuming constant acceleration, the equation is

t = (v + SQRT(v2 – 2*z*(g+a))) / -(g+a)

where v is the current vertical velocity, z is the current altitude, g is the acceleration of gravity, and a is the acceleration from the engines.

Suppose we have v = -100 m/s, z = 1000 m, g = -9.81 m/s2, and a = 14.8 m/s2 (upwards is positive).  The time to impact is,

t = ( -100 + SQRT((-100)2 – 2*1000*(-9.81+14.8))) / -(-9.81+14.8) = 19.14 seconds

Note that if 2*z*(g+a) > v2, the equation will fail because you're trying to take the square root of a negative number.  When this occurs it means that the vehicle will stop and start traveling upward before reaching the ground (i.e. too much upward acceleration).

Of course the time to impact is really "time to impact at the current speed, distance, and acceleration".  As long as you make it so the time to impact constantly updates, the closer you get to the surface, the more accurate the calculation becomes.

If you want to take drag into account, that really complicates things.  There's no simple equation in that case.  But if you're only worried about the final moments of a propulsive descent leading to a soft touchdown, you're probably traveling slow enough that drag isn't really an issue.
 

Edited by OhioBob
Link to comment
Share on other sites

One more thing I forgot to mention.  The variable a is the vertical acceleration.  If the vehicle is pitched over, as might be the case if you are trying to kill both vertical and horizontal velocity, then the vertical component is,

a VERTICAL = a TOTAL * SIN(thrust angle)

where thrust angle = 0 if horizontal, 90o if vertical.  In most cases the thrust angle equals the pitch angle.

Also note that z is altitude above terrain.
 

Edited by OhioBob
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...