Nav-Soft an OpenSource Software GNSS company.


Home > GPS Theory > Position Calculation

GPS Receiver Position, Velocity and Time(PVT) Calculation Theory.

The equations used to calculate position, velocity and time by a GPS receiver are relatively simple and are based on the principle of triangulation, only it is extended to 4 dimensions, xyz and t. From a mathematical point of view the use of time as a dimension presents no added difficulties, the only trick is that time is multiplied by the speed of light, c, to transform it to the same units(meters) as the more commonly understood 3 spatial dimensions.

$$\sqrt{ x^2 + y^2 + z^2} = ct$$

This is the equation for the propagation of light or electromagnetic radiation, the RF signal emitted by the GPS Satellite is just electromagnetic radiation of a particular frequency. What this equations says is that the distance travelled by the light is equal to the time taken * speed of light. We all know Pythagoruses theorem about right angled triangles, well it works just as well in 3 dimensions, here x, y & z are all at right angles to each other. The left hand side (LHS) of this equation describes a sphere, so this says a burst of light or an RF signal emitted from a point source will expand in the shape of a sphere with a radius equal to velocity of light(c) multipled by the time since the burst was emitted. So if the speed is constant then the signal spreads out an equal distance in all directions.

Now if we generalise these equations for a GPS receiver at position \( (x,y,z,t) \) when the signal arrives and the ith satellite at position \( (x_i,y_i,z_i,t_i) \) when the signal is emitted. So the distance travelled is equal to the time taken multiplied by the speed. Now when we say position we mean position and time, we get the following set of equations.

$$\sqrt{(x-x_i)^2 + (y-y_i)^2 + (z-z_i)^2} = c(t - t_i)$$

Here i represents a Satellite, so if we have 4 satellites i would take the values 1 to 4, expressed as i=1,4 by mathematicians, giving us 4 similar equations one for each satellite. Now \(R_i\) represents a value called the pseudorange to the satellite, this is the measured time delay multiplied by c, then corrected by two factors to compensate for variations of the speed of light in the earth's atmosphere, to give the true distance travelled by the RF signal from the satellite to the receiver.

In order to solve for 4 unknown variables x, y, z and ct then 4 independent equations are needed. This is were the requirement to have a fix on at least four GPS Satellites comes from. However if we only have a fix on 3 Satellites a position can still be calculated but we need to fix one of the variables to do this. There are 2 easy values to fix, we can take a guess at the time, most receivers have real time clock IC's so this may be feasable. The other approach is to ignore the height of the reciever and assume it is at sea level. Although technically this is not fixing the value of x, y or z, it does fix the value of 1 of the variables if the other 2 are know.

Now before your GPS receiver can solve these equations and tell you were you are it needs to do a couple of things first. First calculate the positions of the satellites and then calculate corrections to the time for the RF signal to reach your GPS Receiver. But for now we will assume they have been done and we can go ahead and work out the position of our GPS receiver

To calculate the position of our GPS receiver we will adopt a successive approximation technique, this means we will start by estimating a position, then calculate how far off this estimate was and then add those corrections to our estimate. Then we keep repeating this process until our corrections are small enough to give the level of accuracy we require. If we have it our last known position is a good estimate to start with, if not I use the centre of the earth, more or less, I offset this by 100 metres and use x = 100, y = 100 and z = 100 to avoid any chance of divide by zero problems.

So let:
    \( x_n, y_n, z_n, t_n \) be our current estimated values of \( x ,y, z, t \).
\( \Delta x, \Delta y, \Delta z, \Delta t \) be our corrections to these estimated values.
\(R_{ni}\) be the estimated pseudorange measurements from the ith satellite; and
\(\Delta R_i\) be the difference between the actual and estimated measured range.

Therefore:
\(x = x_n + \Delta x \)
\(y = y_n + \Delta y \)
\(z = z_n + \Delta z \)
\(t = t_n + \Delta t \)
\(R_i = R_{ni} + \Delta R_i\)

and $$ R_{i} = \sqrt{(x - x_i)^2 + (y -y_i)^2 + (z - z_i)^2} + ct$$
Substituting for the unknown values of x, y, z, and t, the receiver position gives the following equations
$$\sqrt{(x_n + \Delta x - x_i)^2 + (y_n + \Delta y -y_i)^2 + (z_n + \Delta z - z_i)^2} = R_{ni} + \Delta R_i - ct_n - c\Delta t$$
expanding the above equation as a Taylor series and ignoring 2nd order terms,ie \(A \times {\Delta x}^2 \) as they get small enough not to worry about as our estimate nears the true value. $$\sqrt{(x_n - x_i)^2 + (y_n - y_i)^2 + (z_n - z_i)^2} + {(x_n - x_i)\Delta x + (y_n - y_i)\Delta y + (z_n - z_i)\Delta z \over{\sqrt{(x_n - x_i)^2 + (y_n -y_i)^2 + (z_n - z_i)^2 }}} = R_{ni} + \Delta R_i -ct_n -c\Delta t$$ substituting from eqn xx yields $${(x_n - x_i)\over{R_{ni} - ct_n}}\Delta x + {(y_n - y_i)\over{R_{ni} - ct_n}}\Delta y + {(z_n - z_i)\over{R_{ni} - ct_n}}\Delta z + c\Delta t = \Delta R_i$$
The quanties on the Right Hand Side of these equations are the difference between the measured pseudorange and the calculated range from the current estimated receiver position to the known satellite positions. The values on the Left Hand Side are called direction cosines, and are the difference between the receiver and satellite position for each co-ordinate(xyz) divided by the distance between them. The values to be computed \(\Delta x, \Delta y, \Delta z\) and \(\Delta t\) are the corrections to our current position estimate to bring that estimate closer to the true value of the Reciever position.
These equations are of a type known to mathematicians as a set of linear equations and the method to solve them is well known. This can be extended to any number of satellites to produce a solution, so long as there are more than 4, the number of unknowns x, y, z & t. This method is called the least squares fit method and is described in many mathematical text books on linear algebra and is available in several mathematical programming libraries.
They can be conveniently expressed in matrix notation as $$\begin{vmatrix} \alpha_{11} & \alpha_{12} & \alpha_{13} & 1 \\ \alpha_{21} & \alpha_{22} & \alpha_{23} & 1 \\ \alpha_{31} & \alpha_{32} & \alpha_{33} & 1 \\ \alpha_{41} & \alpha_{42} & \alpha_{43} & 1 \\ \end{vmatrix} \times \begin{vmatrix} \Delta x \\ \Delta y \\ \Delta z \\ c \Delta t \\ \end{vmatrix} = \begin{vmatrix} \Delta R_1 \\ \Delta R_2 \\ \Delta R_3 \\ \Delta R_4 \\ \end{vmatrix}$$ where \(\alpha_{11} = {(x_n - x_1) \over{R_{n1} -ct_n}}\) This format of the equation set aligns with that expected by several programming algorithms developed to solve these types of equations. In this example i=1,4 but i can be any number greater than or equal to 4, for Navstar GPS satellites upto 14 can be in view from a GPS receiver at anyone time, although a couple of these will be very close to the horizon and as a result introduce larger errors into the position determination process.

Position Calculation Pre-requisites

Before the GPS receiver can solve the set of position equations it needs to calculate the values for \(x_i, y_i, z_i, ct_i\), this is the position of the ith satellite at time \(t_i\). Time \(t_i\) is the time that the EM signal was transmitted by the ith satellite.Now we know the value of \(ct_i\), that is the pseudorange for that satellite, the distance the signal travelled, or dividing by c the time taken for the signal to travel from the satellite to your GPS receiver.

Now it was said at the beginning of this page that the equations used to calculate the position of your GPS receiver are relatively simple, however what is not so simple are the equations used to calculate the position of each satellite when it transmitted the signals used to solve those equations.

First we will look at the equations needed to calculate the positions of the GPS Satellites used in the receiver position calculation and then we will look at the calculations needed to calculate the various corrections to the satellite range, these corrections are what change the measured range into the pseudorange.

The values used in these satellite position calculations are available in the ephemeris, this is a block of data encoded in the signal from each of the satellites and it's format and how to decode it into meaningful values will be described here. TO BE ADDED LATER

The position calculation starts with taking a best guess at the GPS receiver's current position and time. The receiver time can be guessed at to within a fraction of a second, the signal transmitted has a time signal coded into it which allows the time the satellite sent a signal to be estimated fairly precisely, but the details of this are explained in the Ephemeris section, now the satellites orbit at a height where the minimum time for a signal to travel to the surface is around 60 milliseconds.

Combining this information with the time from the satellite allows a good enough estimate of the time at the GPS receiver to begin the iterative process of solving the position equations and correcting the estimated position until the corrections are small enough to no longer be significant. At this point the NavSoft logic calculates the ionospheric and tropospheric correction factors and again repeats the cycle until changes in the estimated GPS receiver position are minimal.


Back to Top of Page