July 20, 1969, 8:18 p.m. UTC, while a bunch of guys were about to turn blue on Earth, commander Neil A. Armstrong confirms the landing of his Lunar Module (LM), code name Eagle, on the moon. Even though the first footstep on the moon will certainly remain the most memorable moment of the Apollo 11, landing a manned spacecraft on the moon was probably the most challenging part of the mission. To celebrate the 46th anniversary of this extraordinary adventure, I decided to challenge you. Will you be able to manually land Eagle on the Sea of Tranquillity?

In this article I will present my lunar lander simulator. It is a 2D simulation of the basic physics of the landing using GTKAda and Cairo for the graphic front-end. The simulation starts at High-Gate point, altitude 7,500 ft (2.2 km). It is the beginning of the visibility phase, i.e. the astronauts start to see the ground and the target landing site.

Landing phases

You have two controls to maneuver the Lunar Module: Descent Propulsion System (DPS): It is the main engine of the LM. The DPS is on full throttle since the beginning of the landing (about 8 min. before High-Gate). It can only be throttled between 10% and 60%, otherwise it is either off or full throttle. Reaction Control System (RCS): Composed of four pods of four small thrusters that provide attitude control. In the simulation you can control the throttle of opposite RCS to rotate the LM. In the simulator, you have the raw control of throttle for DPS and RCS, the real Apollo Lunar Module was heavily relying on software, the commander would only take manual control (still software assisted) for the very last approach where the Apollo Guidance Computer (AGC) could not evaluate the features of the landing site. For instance, Neil Armstrong had to fly the LM over a boulder field to find a suitable landing area.



Physics engine In the physics engine I use GNAT’s dimensionality checking system. It is a static verification of dimensional correctness of the formulas. For instance if I multiply a speed by a time, GNAT will ensure that I can only put this data in a distance variable. Same goes for magnetic flux, electrical current, pressure, etc. So in the simulator, all the calculi from net forces, acceleration, speed to position are statically checked for physical unit error. In fact, thanks to this system, I realized that I forgot the moment of inertia in my simulation. You can learn more about GNAT dimensionality checking in You can learn more about GNAT dimensionality checking in Gem #136

Panels On the screen you will see the representation of some of the panels of the LM’s cockpit. All the panels can be moved with a left mouse click, and resized with right mouse click. Gauges: Percentage of remaining fuel for DPS and RCS

Attitude: Pitch angle and pitch rate

T/W: Thrust to weight ratio

Alt / Alt Rate: Altitude from lunar surface and altitude rate

X-Pointer: In the real LM the X-pointer displays forward and lateral speed. Since this is a 2D simulator, I chose to display the forward speed on the X axis and vertical speed on Y axis.

Optional help Manually landing Eagle can be tricky, to help you I added three features: Speed vector direction: The speed vector direction is shown by a green line starting at the center of the LM, while the red line represents the LM’s orientation. If you manage to keep those two lines close to each other, you are not far from a good landing.

Forecast: It is a stream of blue dots showing the future positions of the LM if you do not touch the controls.

Overall situation panel: It is the big white panel. It shows the current position in blue, the target landing site in red and the trajectory since beginning of simulation in green. (Of course, this panel was not part of the real LM cockpit...) You can disable those two help features by clicking on the “Help” button on the top-right of the screen.

Source code The code is available on GitHub (here). You can compile it with GNAT GPL on Windows and Linux.



Video To give you a preview or if you don't bother compiling the simulator, here is a video of a landing:





