Time  Altitude  Vertical Velocity 

10 sec  120 mi 4000 ft  3000 mph 
Fuel  Burn Rate / Acceleration 

17000 lb 

Time  Altitude  Vertical Velocity 

10 sec  120 mi 4000 ft  3000 mph 
Fuel  Burn Rate / Acceleration 

17000 lb 

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.
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 value for altitude is taken from
Title  Apollo 11 mission report 

Document ID  19710015566 
Online Source  Click to View PDF File 
Abstract  Apollo 11 postflight analysis and mission report 
Publication Year  1970 
Document Type  Technical Report 
Report/Patent Number  NASASP238 
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.
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}_{\mathrm{max}}={v}_{\mathrm{e}}\mathrm{ln}\frac{{m}_{0}}{{m}_{1}}$$where ${v}_{\mathrm{max}}$ is the maximum velocity change of the LEM ignoring external forces, ${v}_{\mathrm{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(1x) like function this ought to be a NewtonMercator 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(1x) is defined for x<1 only (and the full NewtonMercator series will converge to natural logarithm for x in ]1; 1[ only.
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(1x), xx**2/2, xx**2/2x**3/3, xx**2/2x**3/3x**4/4, xx**2/2x**3/3x**4/4x**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. $$\begin{array}{rl}{F}_{\mathrm{LEM}}& =\frac{d}{dt}p=\frac{d}{dt}\left(mv\right)\\ & =m\left(\frac{d}{dt}v\right)+v\left(\frac{d}{dt}m\right)\\ & =ma+v\left(\frac{d}{dt}m\right)\end{array}$$ 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(1massChangeRatio);
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.
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(1x), xx**2/2, xx**2/2x**3/3, xx**2/2x**3/3x**4/4, xx**2/2x**3/3x**4/4x**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(1massChangeRatio) * (1massChangeRatio));
Sure this could be discussed but in fact leads to an acceptable user experience anyway.
BackCopyright (c) 2016
@author Oliver Merkel, Merkel(dot)Oliver(at) web(dot)de.
All rights reserved.
Logos, brands, and trademarks belong to their respective owners.
All source code also including code parts written in HMTL, Javascript, CSS is under MIT License.
Copyright (c) 2016 Oliver Merkel, Merkel(dot) Oliver(at) web(dot)de
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
If not otherwise stated all graphics (independent of its format) are licensed under
Creative Commons AttributionNonCommercialShareAlike 4.0
International License.
Rocket Science uses unmodified independent code libraries provided by third parties. Since their licenses might vary the corresponding information is externally linked below. Thus these external links will enable you to reproduce any copyright notice, any related list of conditions, disclaimers, and especially the copyright holders and authors of the corresponding third party functionality.
jQuery: MIT jQuery Mobile: MIT