Skip to content

09. Vertical soft landing on the Moon

A lunar lander must fire its engine to touch down at zero speed. Does it save more fuel by braking gently early, or by waiting and braking hard at the end? This problem has an analytic solution for comparison.

ItemDefinition
StatesAltitude hh, velocity vv (positive upward)
ControlThrust TT
ObjectiveMinimize the thrust integral, proportional to propellant use
PhasesTwo phases, 12 nodes each; free knot and final times
New conceptsAn integral objective and an optimized switching time

The lander starts 100 m above the surface, descending at 10 m/s. Lunar gravity is 1.62 m/s². Its upward engine thrust ranges from zero to 4000 N. Mass is held constant at 1000 kg, approximating a maneuver whose propellant use is small relative to vehicle mass.

Propellant use is proportional to impulse, the time integral of thrust. We split time into a coast phase and a braking phase, leaving the switching time to optimization.

h˙=v,v˙=Tm−g.\dot h=v,\qquad\dot v=\frac Tm-g.

Upward is positive, so descent has v<0v<0. Both phases use the same equations.

At the unknown switch t1t_1, altitude and velocity remain continuous:

h(1)(t1)=h(2)(t1),v(1)(t1)=v(2)(t1).h^{(1)}(t_1)=h^{(2)}(t_1),\qquad v^{(1)}(t_1)=v^{(2)}(t_1).

Thrust may jump. Both t1t_1 and tft_f are free.

h(0)=100,v(0)=−10,h(tf)=v(tf)=0,h(0)=100,\quad v(0)=-10,\qquad h(t_f)=v(t_f)=0, 0≤T≤4000 N,0≤h≤100 m,v≤0.0\le T\le4000\ \mathrm N,\qquad0\le h\le100\ \mathrm m,\qquad v\le0.

The lander cannot go underground, rise above its initial altitude, or reverse into upward flight.

J=1Tmax⁡tu∫0tfT dt,tu=h0/g≈7.86 s.J=\frac1{T_{\max}t_u}\int_0^{t_f}T\,dt,\qquad t_u=\sqrt{h_0/g}\approx7.86\ \mathrm s.

The constant factor makes the objective roughly order one without changing the optimum. This is a running cost (cost forms).

Use h0=100h_0=100 m, v0=−10v_0=-10 m/s, g=1.62g=1.62 m/s², m=1000m=1000 kg, and Tmax⁡=4000T_{\max}=4000 N. Representative units are 100 m, h0g≈12.7\sqrt{h_0g}\approx12.7 m/s, tut_u, and 4000 N.

Use the analytic solution below: free fall followed by maximum thrust, including its switching and final times. This checks whether the numerical solution preserves the analytic answer.

Altitude, velocity, and thrust. Blue and orange identify the two 12-node phases. Black dashed curves are analytic; the vertical dashed line marks ignition, and the red line is maximum thrust.
Altitude, velocity, and thrust. Blue and orange identify the two 12-node phases. Black dashed curves are analytic; the vertical dashed line marks ignition, and the red line is maximum thrust.
Free fall followed by powered braking. Flame indicates thrust; velocity and thrust histories show the current time alongside the analytic solution.
  • Thrust is zero throughout phase 1 and 4000 N throughout phase 2.
  • Ignition time: 3.632 s, at altitude 53.0 m and velocity -15.88 m/s.
  • Touchdown time: 10.305 s; impulse: 26,695 N·s.
  • Analytic ignition and touchdown times are 3.632 s and 10.305 s, matching the numerical result.

Integrate the velocity equation and use the endpoint conditions:

∫0tfT dt=m(∣v0∣+gtf).\int_0^{t_f}T\,dt=m\bigl(|v_0|+gt_f\bigr).

The initial descent speed must be canceled regardless of the thrust schedule. The other term is gravity loss, which increases with time spent airborne. Thus minimizing fuel here is equivalent to minimizing touchdown time.

The fastest safe descent uses zero thrust as long as possible, then maximum upward braking. Intermediate thrust prolongs the maneuver and increases gravity loss. The optimum is bang-bang control.

Let b=Tmax⁡/m−g=2.38b=T_{\max}/m-g=2.38 m/s², and let vsv_s be the positive magnitude of descent velocity at ignition. Free-fall distance plus braking distance equals initial altitude:

vs2−v022g+vs22b=h0.\frac{v_s^2-v_0^2}{2g}+\frac{v_s^2}{2b}=h_0.

Therefore

vs=(v02+2gh0)bb+g,t1=vs−∣v0∣g,tf=t1+vsb.v_s=\sqrt{\frac{(v_0^2+2gh_0)b}{b+g}},\qquad t_1=\frac{v_s-|v_0|}{g},\qquad t_f=t_1+\frac{v_s}{b}.

For comparison, constant gentle braking from the start needs deceleration 0.5 m/s² and takes 20 s. Its impulse is 42 400 N·s, about 1.6 times the optimum.

Thrust jumps from zero to 4000 N at ignition. Putting that jump at a free knot lets each phase use a constant control without polynomial oscillations. Unlike Example 08, the switching time is determined by optimization.

  • Lower max_thrust to 3000 N. Compare the earlier ignition, longer duration, and larger impulse with the formulas.
  • Set initial_velocity to zero and inspect the free-fall phase.
  • Replace the thrust guess [0, p["max_thrust"]] by [2000, 2000] and check whether the solver returns to the same solution.
Terminal window
uv run python examples/09_soft_landing.py

View the Python source on GitHub.