Where it All Comes Together - The Stand Alone Position Calculation

After having defined procedures to calculate satellite positions, to correct pseudoranges and finally to calculate the receivers position it's time to add everything together.

The following steps have to be taken to go from raw data to the stand-alone receiver position.

  1. Calculate SV positions at the SV time of signal transmission.
  2. Correct the SV positions for the earth rotation during the time it takes the signal to go from the SV to the receiver.
  3. Calculate azimuth and elevation of the SVs.
  4. Correct the pseudoranges.
  5. Calculate the receiver position.

This series of steps looks straightforward, but unfortunately it isn't. First I have to make some assumptions (which hold for the majority of GPS receivers).

  1. I assume that the receiver samples all SVs at the same moment. This makes life easy, because inter- or extrapolation of the pseudoranges to one common time is not necessary.
  2. I assume that the receiver time-stamps the measured pseudoranges using the receiver internal clock at the signal time of reception. And this is what makes life difficult, because we have to calculate the SV positions at the signal time of transmission (see step 1 above).

A reasonable guess for the signal time of transmission can be made by taking the signal time of reception and subtracting from it the pseudorange in seconds (the range in meters divided by the speed of light). This works well if the receiver clock error is not too large, e.g. within 1 millisecond from the GPS time. Many receivers keep their internal clock indeed synchronized to GPS time within 1 millisec (see the OEM table), and for these receivers the above steps will do.

Other receivers let their internal clock drift away from the GPS time for ever . In this case, it is advised to make an initial guess for the signal time of transmission of 0.075 sec (which corresponds with the average distance between a receiver at the earth surface and GPS satellites above the horizon), and do a preliminary calculation according the 5 steps above. This gives a good guess for the receivers position which enables a sufficient good re-calculation of the signal time of transmission and a calculation of the iono- and tropo delay. Carry out step 1 to 5 again, now with the proper SV signal transit times and well corrected pseudoranges.


Click here to view or download a sample Turbo Pascal program containing the above steps and the procedures described in the previous pages. The sample program contains also procedures to convert position data from WGS-84 Earth Centered Earth Fixed Cartesian Coordinates (ECEF XYZ) to WGS-84 latitude, longitude and height above the ellipsiod, and vice versa. No explanation of these procedures is provided, you can find the algorithms in any textbook on geodesy. Probably you want to input and output position data in your local reference frame. I leave this task to you ! (many conversion procedures from and to WGS-84 are available on the internet).


  1. The code assumes the availability of a math co-processor. If not available, declare all 'real' variables as 'double' .
  2. Turbo Pascal requires angles in radians for the goniometric functions.
  3. Nobody is perfect. Even I am not ! Please check the info in this page and mail your comment/ corrections to me.
  4. I produced this page and the sample program for demonstration purposes only. There are many ways to do it better. I do know about some ways to improve the algorithms, e.g. by adding a weight factor to each measured pseudorange, or by smoothing pseudoranges with integrated carrier phase measurements. If you like to expand my pages with your input, please send  me an e-mail. 

I also prepared an input file containing actual data. Running the sample program with this data produced an output file. Both files can be viewed or downloaded.

Back to s/w index.
This page was produced on 29 October 1997.