home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
misc
/
minfuel.nlr
< prev
next >
Wrap
Text File
|
1994-01-24
|
1KB
|
26 lines
/*
* Compute how long to fire horizontal thrusters so that the total fuel
* consumed is minimized. The minimum value of the function is the total
* amount of fuel that will be used. The 'time' parameter is the length
* of time that the horizontal thruster should be fired (in seconds).
*/
Title "Compute fire time for thruster to minimize total fuel consumption";
Constant G=1.67; // Gravitational acceleration on moon (meters/sec^2)
Constant A=1.10; // Acceleration from horizontal thruster (meters/sec^2)
Constant burnrate=2.3; // Kg/sec fuel burn rate to produce 1 G acceleration
Constant dist=200; // Horizontal distance to be moved (meters)
Parameter time; // Number of seconds to fire horizontal thruster
Double hfuel; // Fuel burned by horizontal thrusters
Double vfuel; // Fuel burned by vertical thrusters
/*
* Compute fuel burned by vertical thruster.
*/
vfuel = time * G * burnrate;
/*
* Compute fuel consumed by horizontal thrusters (start and stop).
*/
hfuel = 2 * time * A * burnrate;
Function burnrate*(2*time*A/G + 2*time + (dist - A*time^2)/(A*time));
Data;