Apollo 13 rocket for landing on the moon.
This example illustrates a Rocket landing on the moon. The class CelestialBody can be used to store information about celestial bodies such as the earth and the moon.
The class Rocket embodies the equations of vertical motion for a rocket which is influenced by an external gravitational force field gravity, and the force thrust from the rocket motor, acting in the opposite direction to the gravitational force.
Apollo is an instance of the Rocket class, so we have to use dot notation, apollo.thrust, when refering to its variables. Since no level of visibility is specified for force1 and force2 they are public.
We simulate the MoonLanding model during the time interval 0 to 230.
Figure 1: Altitude of the Apollo rocket over the lunar surface. Since the solution for the altitude is a function of time, it can be plotted in a diagram. It starts at an altitude of 59404 at time zero, gradually reducing it until touchdown at the lunar surface when the altitude is zero.
Figure 2: Thrust from the rocket motor, with an initial high thrust f1 followed by a lower thrust f2. The thrust force from the Rocket is initially high but is reduced to a low level after 43.2 seconds.
Figure 3: Rocket mass decreases when the fuel is consumed.
Figure 4: Gradually increasing gravity when the rocket approaches the lunar surface.
??plot( apollo.gravity, xrange={0,208} );
Figure 5: Vertical velocity relative to the lunar surface. The rocket initially has a high negative velocity when approaching the lunar surface. This is reduced to zero at touchdown giving a smooth landing.