Earth Satellite Demo

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]




Search WWW


As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.


Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 


We receive a few cents from each purchase.  Thanks


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


Feedback:  Send an e-mail with your comments about this program (or anything else).

Search only





Problem Description

To create a program to explore the mechanics and mathematics behind earth orbiting satellites.

Background & Techniques


A satellite with initial altitude of 1000 miles and 15000 mph velocity will circle the earth in 100 minutes at altitudes from 1000 down to 100 miles above surface 

This is a first adventure into Celestial Mechanics to convince myself that satellites can really orbit the earth and, by extension, planets orbit the sun.   I previously thought that if an orbiting satellite dropped just a little closer to the earth gravitational forces would increase and force it into a death spiral..

Web descriptions talk about centripetal force as if that were the another force which held the answer.  But trying to incorporate centripetal force into the explanation didn't help much because it turns out that gravity IS the centripetal force that keeps the satellite from flying out into space. So if there is only one major natural force acting on the satellite to drag it down, what holds it up?  The answer lies in Newton's 1st law of motion - things like to keep moving in a straight line. So if we didn't have gravity (and air drag) we could toss a baseball and hit the
moon (or miss it on the way by). The secret to orbiting is forward velocity, speed at right angles to the radial force of gravity. The speed and direction of our velocity vector is  the result of the satellite falling straight down toward the center of the earth and our  tangential velocity which is trying to keep the satellite moving in a straight line.   

This horizontal component likely came from the rocket that put us into orbit initially but in this simulation it is like a cannon firing from a really tall tower . If the forward (tangential) speed is high enough, we'll miss the earth as we fall toward it and continue on past at which point gravity works to turn us around and drag us back.  So if we don't give the satellite a big enough initial push, it will fall to earth somewhere before it get back around to the start point.  If we give it too big a push, it will fly off into space never to return.  The speed at which this happens is called, naturally enough, the "escape velocity"  and is a function of altitude. In theory as initial velocities increase orbits start when the satellite just clears the earth on the far side and as starting velocities increase,  become circular and then increasingly eccentric  (longer and skinnier)  until escape velocity is reached.. Escape velocity is approximately 1.4 ( square root of 2 ) times the circular orbit velocity.       

The math can be kind of intimidating but the technique I adopted is called Euler "symplectic"  which has the advantage on conserving energy  and therefore keeping the the orbit stable.  The method loops, moving the satellite in small steps for each chosen time step.  Each new position is  calculated in two steps.. First we'll calculate a new velocity vector  based on where we were after the last step at in which  direction we were moving.  We'll then use that new velocity vector to calculate a new position. The most helpful reference I found
is a PDF titled "Orbits" available from  The equations involve vectors which are implemented here in the Cartesian (x,y) domain since we'll need x and ,y coordinates anyway for plotting. 

Here are some program notes:

bulletThe satellite's altitude above earth and its initial velocity and direction define the each case. Satellite masses are assumed to be much smaller than the earth's mass so that the "two-body" effect can be ignored. That is to say, the orbiting satellite has no measurable effect on the earth's position.
bulletThe display is 2 dimensional and arbitrarily starts with the satellite displayed above the earth. The angle of the initial velocity is specified relative to the tangent to the earth and increase the way as trig functions; counterclockwise.  (This is opposite from navigational bearing measurements which increase clockwise.
bulletPositive initial velocities are assumed to be directed in the counterclockwise direction assuming the we are hovering over the North Pole looking down .  This is the same direction that the earth rotates which makes it the preferred direction for real satellites to take advantage of a free boost and makes geosynchronous orbits possible.
bulletGravity is assumed to be from a point at the center of the earth and doesn't know about the earth size. "Just for fun," the program has a "porous earth" option which allows slower satellites to penetrate the earth's surface and complete their orbit about the earth's center..
bulletWe try to draw orbits to scale relative to the earth image. For large orbits, this causes the earth image to disappear.
bulletEnglish or metric unit may be specified for input and output values.
bulletThere are two sampling rates specified: The "calculate time interval" is the time increment used in the loop which is moving the satellite.  The time between plot updates is specified as "number of calculated points per plot update". For large periods it is best to update plots once every 100 or more calculated points. Small calculation time intervals (e.g.. 1 second) improve the accuracy of the orbit, but sampling  at 1 degree intervals seems adequate  (divide  the displayed orbit period seconds  by 360 to get a reasonable estimate of the value to use).  
bulletIt is possible to get a animation running very slowly (when small calc-time interval and small number of points per plot is set for a large orbit.  Just click the Animate check box to deselect it and the simulation should finish within a few seconds.
bulletSeveral predefined cases are included to get you started!      .

Non-programmers are welcome to read on, but may want to jump to bottom of this page to download the executable program now.

Programmer's Notes:

Coming soon.  (How often have you seen this on websites? )  I'm tired this week, write with your questions.

Running/Exploring the Program 

bulletDownload source
bulletDownload  executable

Suggestions for Further Explorations

Simulate earth based rocket injection of satellite into a target orbit.
.Add multi-body simulations. 


Original:  December 18,2011

Modified:  May 15, 2018

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2018, Gary Darby    All rights reserved.