Rocket Science
Navigation
Time Altitude Vertical Velocity
10 sec 120 mi 4000 ft 3000 mph
Fuel Burn Rate / Acceleration
17000 lb lb/sec
 
Back

Physics Sim

Abstract

This physics simulation is about simplified rocket science. Rocket Science comes along without any sophisticated graphical human machine interface so far. The concept is turn based. On each turn the user enters a numerical value for the fuel burn rate of the excursion module in a valid range.

Objectives

Main objective is to land the excursion module safely. Flight control is by instruments only rather than visually landing the Lunar Excursion Module (LEM). Instrument Landing System (ILS) shows a defect. You are supposed to perform the landing maneuvers manually. An additional objective is to optimise the fuel consumption.

Initial Settings

Initial value for altitude is taken from

TitleApollo 11 mission report
Document ID19710015566
Online SourceClick to View PDF File
AbstractApollo 11 postflight analysis and mission report
Publication Year1970
Document TypeTechnical Report
Report/Patent NumberNASA-SP-238

Since this is a one dimensional physics simulation the initial (vertical component of) velocity is chosen to be zero at time of undocking from command module in circular lunar orbit and lunar module separation maneuver.

Physics and Accuracy

A mapping function is needed to describe the influence of the rocket engine's fuel burn rate onto velocity of the lunar module. The relation between both physical quantities is described by the Tsiolkovsky rocket equation, also referred to as ideal rocket equation.

d v max = v e ln m 0 m 1

where v max is the maximum velocity change of the LEM ignoring external forces, v e is the effective exhaust velocity, m 0 is the initial total mass of LEM including fuel, m 1 is the final total mass.

Mind: In Javascript and Gnuplot logarithmus naturalis is represented by Math.log or log.

In popular predecessors of Rocket Science being developed on slower machines the computation of such logarithmic functions were using the first partial sums of a corresponding Taylor series. Since Rocket Science internally uses an ln(1-x) like function this ought to be a Newton-Mercator series to match a mass change ratio depending on current burn rate onto a velocity change value. Rocket Science simply uses a direct natural logarithm function for this purpose (since central processing units have become faster nowadays). If adapting the source code on your own then please mind that ln(1-x) is defined for x<1 only (and the full Newton-Mercator series will converge to natural logarithm for x in ]-1; 1[ only.

Produced by GNUPLOT 4.4 patchlevel 3 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 -0.2 0 0.2 0.4 0.6 0.8 1 1.2 velocity change technical mass change ratio log(1-x) -x-x**2/2 -x-x**2/2-x**3/3 -x-x**2/2-x**3/3-x**4/4 -x-x**2/2-x**3/3-x**4/4-x**5/5 -15.0/14.0*x
Gnuplot commands
set xlabel "mass change ratio" offset 0, 4;
set ylabel "velocity change technical" offset 10, 0;
set xzeroaxis;
set yzeroaxis;
set xrange [-0.2:1.2];
set yrange [-4:0.5];
plot log(1-x), -x-x**2/2, -x-x**2/2-x**3/3, -x-x**2/2-x**3/3-x**4/4, -x-x**2/2-x**3/3-x**4/4-x**5/5, -15.0/14.0*x;

The human machine interface shows units as United States customary units/British imperial units while the underlying physics engine itself renders International System of Units (SI) units. The underlying physics engine is aware of the fuel mass change over time in relation towards the moving accelerated object. F LEM = d d t p = d d t m v = m d d t v + v d d t m = m a + v d d t m In its current version it neglects the fact that gravitational acceleration depends on the altitude of the object, too. Gravitational acceleration is constant at

this.gravitationalAcceleration = 1.622; // Moon, meter per square second
/*
 * Gravity is relative to the height of an object. With the given altitude
 * range it is quite clear that this simulation is enormously simplifying
 * this aspect.
 */

The formula to match the fuel burn rate value towards a change in velocity caused by the engine is modelled by functions…

var massChangeRatio = burnRate * durationEngineBurning / this.getMassTotal();
// mind: Math.log() has base Math.E, Math.log(Math.E) is 1
var velocityChangeTechnical = 3000 * Math.log(1-massChangeRatio);

With burn rates in range from 0 to 200 lb per second and a typical duration for the engine burning fuel for a full iteration of 10 seconds with…

this.state[this.MASSFUEL] = 16000; // lb
this.state[this.MASSCAPSULEEMPTY] = 16500; // lb

… the mass change ratio will be at 0.125 maximum approximately.

Produced by GNUPLOT 4.4 patchlevel 3 -0.2 -0.15 -0.1 -0.05 0 0.05 -0.02 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 velocity change technical mass change ratio log(1-x) -x-x**2/2 -x-x**2/2-x**3/3 -x-x**2/2-x**3/3-x**4/4 -x-x**2/2-x**3/3-x**4/4-x**5/5 -15.0/14.0*x
Gnuplot commands
set xlabel "mass change ratio" offset 0, 4;
set ylabel "velocity change technical" offset 11, 0;
set xzeroaxis;
set yzeroaxis;
set xrange [-0.02:0.14];
set yrange [-0.2:0.05];
plot log(1-x), -x-x**2/2, -x-x**2/2-x**3/3, -x-x**2/2-x**3/3-x**4/4, -x-x**2/2-x**3/3-x**4/4-x**5/5, -15.0/14.0*x;

In the given range even the first few partial sums of the corresponding Taylor Series would do the trick. And to be honest a simple linear equation would be sufficient, too. Preferably if modifying the capsule mass to extremly low values then the logarithmic model will feel more realistic (in terms of harder to control) and thus be important then.

The altitude change technically caused by the engine uses the integral over the mass change ratio rather than integral over time.

var altitudeChangeTechnical = 3000 * ( -massChangeRatio - Math.log(1-massChangeRatio) * (1-massChangeRatio));

Sure this could be discussed but in fact leads to an acceptable user experience anyway.

Back