Jump to content

Some orbital calculations...


Recommended Posts

So I'm working on a programming project which involves simulating some 2D orbital mechanics. I've got everything set up running smoothly for a stable orbit, but now I'd like to be able to change the orbital velocity at any point and for the program to calculate what would then happen to the apoapsis, periapsis, semi-major axis and so on. So let's say I'm orbiting at 2000m/s, and I accelerate to 2100m/s, what would I need to do to find out what my new apoapsis and periapsis are? I'm assuming I'll need the theta angle, and I can calculate that quite easily already. Any equation(s) I should try using?

Link to comment
Share on other sites

Taken from J.R. Wertz, Orbit & constellation design & management. 2001. Microcosm. ISBN 978-1-881883-07-8. pp. 107-108:

Let r be the position vector and V the velocity vector (centred on the planet). (r = |r| and V = |V| denote their magnitudes.) z is the unit vector normal to the equatorial plane. mu denotes the gravitational parameter, G * M, of the central body.

h = r × V is the angular momentum vector.

N = z × h/h is the vector to the ascending node.

e = V × h / mu - r/r is the excentricity vector (it points towards periapsis).

E - (V^2)/2 - mu/r is the orbital energy.

a = - mu/(2E) = (2/r - (V^2)/mu)^-1 is the semimajor axis.

p = |h|^2 / mu is the semi-parameter, if the orbit is a hyperbola instead of an ellipse.

e = |e| is the eccentricity.

Link to comment
Share on other sites

This doesn't really make much sense to me. To clarify: I start with my apoapsis, periapsis, distance and mu values; from there I find the semi-major axis, orbital velocity, orbital energy, theta, and radial velocity, which then increments the total distance. When it reaches apoapsis, a boolean changes from true to false so that its movement reverses, and the opposite occurs at periapsis. I'm not actually simulating any kind of 2D space or vectors. The only indicator of where I am in the orbit is theta. So, I need a way of doing this without vectors. If I'm missing something really obvious and am being really stupid, please explain to me what I should be doing :P

Link to comment
Share on other sites

Just pick a coordinate system and write out the vector operations in terms of their components under that system. r will, for example, be the unit vector in the direction theta times the current altitude. NB: The equations I gave are three-dimensional. The cross product should have clued you in. It is undefined for all other cases*. Some numbers will vanish when you work it out.

If the real problem is that you don't understand vectors, feel free to ask. :) I could be wrong but your method of calculation sounds a little strange.

*There are generalisations but they're not the "real" cross product.

Link to comment
Share on other sites

Indeed, I am not overly familiar with vectors, at least not to the level of complexity that's being used here. I suppose the problem comes with bridging the gap between physics and computing, and translating some of these equations into computer code. This is why I'm not simulating 2D space - the last time I tried that, most of even the most basic equations stopped working, like v = sqrt(GM(2/r - 1/a)). Still not entirely sure why.

However, I could try using actual 2D space with a co-ordinate system again if you think it'll work, since I have the code for it stored elsewhere. I could then start using vectors properly, but yes, a lot of it would need explaining in simpler terms. I believe a lot of my problems came from the fact that I was simulating the actual force of gravity on my object and just letting it go from there - leaving me with no way of accurately figuring out the apoapsis, periapsis, period and so on. So, I would rather avoid using 2D space and vectors if possible but if there is no other way I should be able to get it set up.

Link to comment
Share on other sites

That's understandable.

Working in Euclidean coordinates and setting V_z = r_z = 0, we have:

e_x = 1/mu * V_y * (r_x * V_y - r_y * V_x) - r_x / r

e_y = 1/mu * V_x * (r_x * V_y - r_y * V_x) - r_y/r

where r_x and r_y are the positions in the x and y directions respectively, V_x and V_y the respective velocities and r = sqrt(r_x^2 + r_y^2) is the magnitude of the position vector.

The eccentricity e = sqrt(e_x^2 + e_y^2)

a = 1/(2/r - V^2 / mu) is the magnitude of the semimajor axis.

c = e * a is half the interfocal distance.

The distance (from the centre of the large body) to the periapsis is (a - c)

Periapsis lies in the direction of vector e, that is, x-coordinate e_x / e * (a-c) and y-coordinate e_y/e * (a-c)

You can transform this into polar coordinates if you want (which is probably better anyway).

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...