# Nav-Soft an OpenSource Software GNSS company.

Home > GPS Theory

### GPS Theory

The theory behind the equations used by a GPS receiver to calculate the users position are fairly complex and involved, however to make use of the equations an in depth mathematical understanding is not required. Here we will go through the equations in order to calculate a position using the measurements made by a GPS receiver but you may skip ahead to the calculations if you are not interested in the theory.

In order to calculate a Receiver's position several steps are required.

Step One. Information sent by the GPS Satellites needs to be downloaded and translated. See the Data Encoding page for further details.

Step Two. A measurement needs to be made of the signal transmitted from each GPS Satellite, to determine the relative delay of the signal. Information and a pattern are encoded in the signal to allow a determination of the relative delay of the signal to be made. This can be done to an accuracy of approximately 0.005 millionths of a second.

Step Three. The position of the GPS Satellite is calculated using information encoded in the signal from the satellite, equations supplied in the User guide and the time derived from the relative delay of the satellite signal.See the GPS Satellite Position Theory page for further details.

Step Four. A correction factor is applied to the Satellite pseudorange to correct for the estimated signal delay effects of the ionosphere. See the GPS Ionospheric Correction page for further details.

Step Five. A correction factor is applied to the Satellite pseudorange to correct for the estimated signal delay effects of the troposphere. See the GPS Tropospheric Correction page for further details.

Step Six. The position of the GPS Receiver is calculated from the positions of the GPS Satellites and the time of flight of the signal transmitted by each GPS Satellite. This is accomplished by triangulating on the positions of the satellites in 3 dimensions plus time and knowing the range, after correction, to each satellite and the time of transmission. See the User Position Theory page for further details.

### GPS Calculations

The logic used by a GPS Receiver to derive a Users position is involved, but fairly straight forward. It can be broken down as mentioned above into set of steps that can be implemented as seperate functions or subroutines.

However, as mentioned above, before the Receiver can begin this process it needs to have locked onto the signal from at least 4 GPS Satellites (see tracking routines page for details) and decoded the Ephemeris messages for each of those 4 satellites (see Ephemeris page for details).

Once the Ephemeris message is available the position of a GPS Satellite can be calculated using the following code.GPS Satellite Position Calculations
Then the measured range to the satellite needs to be adjusted for delays travelling throught the ionosphere.GPS Ionospheric Delay Calculations
Followed by the correction for delays when travelling through the troposphere.GPS Tropospheric Delay Calculations
At this point all the information is available to solve the equations that lead to the Users position.User Position Calculations

To validate the accuracy of this code without having a GPS Receiver or one that outputs the neccessary detailed information it is possible to download files from the Continuously Operating Reference Station or CORS website. From here files in the RINEX format can be downloaded from a large set of CORS locations thoughout the USA and the world. To validate these or any other programs that calculate the User Position of a GPS Receiver an Observation and a Navigation file are needed for the same time period.

The Observation file contains sets of pseudorange and accumulated doppler range (ADR) measurements from a choosen CORS site. The Navigation file contains the Ephemeris parameters for all GPS Satellites or at least those above the horizon.

The data can then be used as the starting point to validate that the code provides the expected results and the accuracy can be judged as the observation file contains an accurate location of the GPS Receiver at the CORS location. An example program is available here with some example output here.