by Bob McClure

Fly your own spacecraft!

This program interactively demonstrates some of the principles of orbital mechanics. The satellite is launched at a fixed distance from the earth, but with a randomly selected velocity. The orbit can be changed by clicking on "Boost", which gives the satellite a fixed increment of forward velocity for each click. "RetroFire" gives the satellite a fixed decrease in velocity for each click. An elliptical orbit can be circularized at the apogee radius by giving the right amount of "Boost" at apogee. It can be circularized at the perigee radius by applying "RetroFire" at perigee, as examples.

This program assumes that gravitational force varies as 1/R^2, and that the earth is much heavier than the satellite. The satellite obeys Newton's law, f=m*a.

The orbit is calculated by small step iterations of a simple formula. It is not exact because the steps are not indefinitely small. On highly elliptical orbits, you will see some precession, which shouldn't be there. Also, when the satellite gets too close to the earth, the algorithm fails because even smaller steps are needed for accurate computation. This results in the satellite zooming off into space, when it should not really do that.

Once a revolution, the maximum distance from the center of the earth, "apogee", and the minimum distance, "perigee", are displayed. Also displayed are the sum of apogee and perigee, and the period in terms of iteration steps needed to complete a revolution. The display is not necessarily valid unless the orbit has been left undisturbed for one revolution from one positive x axis crossing to the next. See if the period follows the law that period varies as the sum of apogee and perigee to the three-halves power.

A Pause/Resume button is provided so that you can take time out to study the orbit and the readings. Boost and Retro can be applied during time-out. Each click applies a fixed delta-vee.

ClrScreen removes the "smoke trail", but has no effect on the orbit.

The following instructions are iterated to compute the path and velocity of the satellite. Each iteration represents a small step in time.

RadiusSquared = x * x + y * y Radius = Sqr(RadiusSquared) Vx = Vx - GravConst * x / Radius ^ 3 x = x + Vx Vy = Vy - GravConst * y / Radius ^ 3 y = y + Vy

Simple, isn't it?

The instructions which are executed to give the velocity boost are:

v0 = Sqr(Vy ^ 2 + Vx ^ 2) '(boost rocket delta-vee = 0.05) Vy = Vy + 0.05 * Vy / v0 Vx = Vx + 0.05 * Vx / v0

The instructions for decrementing the velocity are the same, except for substitution of -0.05 for +0.05.