isp = $p_isp; $this->thrust = $p_thrust; $this->name = $p_name; } } class Body { function __construct( $dist, $name ) { $this->dist = $dist; $this->name = $name; } } $secs_per_day = 24*60*60; $g = 9.8; $AU = 149.6e6; $drives = array( "hydroxy" => new Drive( 450, 4, "Hydrogen-Oxygen"), "MH" => new Drive( 1600, 3, "Metallic Hydrogen"), "plasma" => new Drive( 20000, 0.01, "Plasma"), "fusion" => new Drive( 100000, 0.05, "Fusion"), "antimatter" => new Drive( 200000, 0.2, "Anti-Matter") ); $distances = array( "sun" => new Body(0, "Sun"), "mercury" => new Body(0.387, "Mercury"), "venus" => new Body(0.72, "Venus"), "earth" => new Body(1, "Earth"), "mars" => new Body(1.52, "Mars"), "belt" => new Body(2.8, "Astroid belt"), "jupiter" => new Body(5.2, "Jupiter"), "saturn" => new Body(9.58, "Saturn"), "uranus" => new Body(19.2, "Uranus"), "neptune" => new Body(30.1, "Neptune"), "kuiper" => new Body(45,"Kuiper belt") ); if ($_POST["type"] == "simplespeed") { echo(""); foreach( $_POST["time"] as $day ) { if (!is_numeric( $day ) ) { continue; } echo(""); } foreach( $_POST["propel"] as $propel ) { $drive = $drives[$propel]; echo(""); foreach( $_POST["time"] as $day ) { if (!is_numeric( $day ) ) { continue; } $day = floatval( $day ); $v = $day * $secs_per_day * $drive->thrust * $g; // m/s $v = $v / 1000 * $secs_per_day; // km/day printf("", $v, $v / $AU, $v / 2.59020684e10 ); } echo(""); } echo("
Engine type$day day(s)
" . $drive->name . "
%.0f km/day
%.4f AU/day
%.6f c
"); } else if ($_POST["type"] == "simpledistance" ) { echo(""); foreach( $_POST["time"] as $day ) { if (!is_numeric( $day ) ) { continue; } echo(""); } foreach( $_POST["propel"] as $propel ) { $drive = $drives[$propel]; echo(""); foreach( $_POST["time"] as $day ) { if (!is_numeric( $day ) ) { continue; } $day = floatval( $day ); // d = 1/2 * a * t^2 if(isset($_POST["stopatend"])) { $d = ($drive->thrust * $g) * pow($day * $secs_per_day / 2, 2) / 1000; } else { $d = 0.5 * ($drive->thrust * $g) * pow($day * $secs_per_day, 2) / 1000; } printf("", $d, $d / $AU, $d / 299792.458 ); } echo(""); } echo("
Engine type$day day(s)
" . $drive->name . "
%.0f km
%.4f AU
%.2f lightseconds
"); } else if ($_POST["type"] == "simpletime" ) { echo(""); $burnratio = floatval($_POST['burnratio'] ) / 100; if($_POST["disttype"] == "arbitrary") { foreach( $_POST["dist"] as $dist) { if (!is_numeric( $dist) ) { continue; } echo(""); } echo(""); foreach( $_POST["propel"] as $propel ) { $drive = $drives[$propel]; echo(""); foreach( $_POST["dist"] as $dist ) { if (!is_numeric( $dist ) ) { continue; } $dist = floatval( $dist ); if(isset($_POST["stopatend"])) { // d = 1/2 * h * (a+b) // h == t * r * a // a+b = t * (2 - r) // d = 1/2 (t * r * a / 2) (t * (2 - r)) // 2d / (ra / 2) / (2-r) = t^2 $t = sqrt(2 * $dist * $AU * 1000 / ($burnratio * $drive->thrust * $g / 2) / (2 - $burnratio)) / $secs_per_day; } else { // d = 1/2 r t (rta) + (1-r)t * (rta) // d = r a t^2 (1 - r/2) // t^2 = d / (r a (1 - r/2)) $t = sqrt($dist * $AU * 1000 / ($burnratio * $drive->thrust * $g * (1 - $burnratio/2))) / $secs_per_day; // d = 1/2 t * ta // t^2 = 2d / a //$t = sqrt(2 * $dist * $AU * 1000 / ($drive->thrust * $g)) / $secs_per_day; } printf("", $t ); } echo(""); } } else { foreach($_POST["from"] as $source) { $source = $distances[$source]; foreach($_POST["to"] as $dest ) { $dest = $distances[$dest]; printf("", $source->name, $dest->name ); printf("", $source->name, $dest->name ); } } echo(""); foreach( $_POST["propel"] as $propel ) { $drive = $drives[$propel]; echo(""); foreach($_POST["from"] as $source) { $source = $distances[$source]; foreach($_POST["to"] as $dest ) { $dest = $distances[$dest]; $dist = abs( $source->dist - $dest->dist); if(isset($_POST["stopatend"])) { $t = sqrt(2 * $dist * $AU * 1000 / ($burnratio * $drive->thrust * $g / 2) / (2 - $burnratio)) / $secs_per_day; } else { $t = sqrt($dist * $AU * 1000 / ($burnratio * $drive->thrust * $g * (1 - $burnratio/2))) / $secs_per_day; } printf("", $t ); $dist = abs( $source->dist + $dest->dist); if(isset($_POST["stopatend"])) { $t = sqrt(2 * $dist * $AU * 1000 / ($burnratio * $drive->thrust * $g / 2) / (2 - $burnratio)) / $secs_per_day; } else { $t = sqrt($dist * $AU * 1000 / ($burnratio * $drive->thrust * $g * (1 - $burnratio/2))) / $secs_per_day; } printf("", $t ); } } echo(""); } } echo("
Engine type$dist AU
" . $drive->name . "
%.2f days
%s -> %s (near)%s -> %s (far)
" . $drive->name . "
%.2f days
%.2f days
"); } ?>

Simple Speed

Simple Distance

Simple Time

Propulsion types:
  • Hydrogen-Oxygen
  • Metallic Hydrogen
  • Plasma
  • Fusion
  • Anti-Matter
Time periods:
  • days
  • days
  • days
  • days
  • days
Stop at end
Propulsion types:
  • Hydrogen-Oxygen
  • Metallic Hydrogen
  • Plasma
  • Fusion
  • Anti-Matter
Time periods:
  • days
  • days
  • days
  • days
  • days
Stop at end
Burn ratio
Propulsion types:
  • Hydrogen-Oxygen
  • Metallic Hydrogen
  • Plasma
  • Fusion
  • Anti-Matter
Arbitrary distances (AU):
  • AU
  • AU
  • AU
  • AU
  • AU
A to B:
Sun Sun
Mercury Mercury
Venus Venus
Earth Earth
Mars Mars
Astroid belt Astroid belt
Jupiter / Trojans & Greeks Jupiter / Trojans & Greeks
Saturn Saturn
Uranus Uranus
Neptune Neptune
Kuiper Belt Kuiper Belt