32
$\begingroup$

GPS satellites transmit time values regularly, but if we put in consideration the time delay between the satellite and the receiver, the time value received wouldn't be accurate insofar as I know GPS receivers aren't able to determine their position until they've got accurate time. Our devices don't have any atomic clocks synchronized with GPS.

How do our GPS receivers calculate time from the signals of GPS?

$\endgroup$
  • $\begingroup$ Very good question, all the sources I read didn't explain it. $\endgroup$ – Vlastimil Ovčáčík Aug 12 '16 at 22:18
23
$\begingroup$

"...the time value received wouldn't be accurate insofar as I know GPS receivers aren't able to determine their position until they've got accurate time."

The time value isn't used to tell the receiver what time it is (at least not directly, although that is helpful later). It's used so that the receiver can tell relatively what the distance is to each satellite.

If you hear Sat A say that the time is 0.00000 and Sat B says the time is 0.00010, then if they are in sync, you must be closer to B than to A. You can tell exactly how much closer you are by the specific time difference.

Repeat the calculations with a few other satellites and you will find that there is only one place (and time) that the receiver can be located.

The GPS receiver computes a solution that simultaneously provides Position, Velocity, and Time (PVT). It's not that one is calculated first, then the other is. They all fall out simultaneously.

$\endgroup$
  • 1
    $\begingroup$ More precisely, GPS receivers directly calculate position and time from the timestamps transmitted by the satellites. Given position, velocity can be separately calculated by the Doppler shift of each received signal from the base system frequency. $\endgroup$ – Phil Miller Sep 23 '14 at 20:46
  • 2
    $\begingroup$ Intuitively, it seems to me that time is just a 4th dimension, so determining your position in that dimension should be no harder than determining your position in the other three, right? $\endgroup$ – Jörg W Mittag Sep 23 '14 at 23:09
  • 3
    $\begingroup$ Many GPS receivers are ultimately used to provide time, rather than position. For example, the ones in most cell phone base stations :) $\endgroup$ – hobbs Sep 23 '14 at 23:20
  • 1
    $\begingroup$ Is this answer completely wrong? The sum of points where each point is 0.00010 light seconds closer to Sat B is more or less a plane, because we don't know absolute distance to Sat B (e.g. 11000 km), but only relative distance (e.g. 30 km or 0.00010 light seconds). You can be 30 km closer to Sat B on the other end of the Universe. However all the sources I read about GPS work with absolute distances to satellites, and those are of course illustrated as spheres (not planes). $\endgroup$ – Vlastimil Ovčáčík Aug 12 '16 at 20:29
  • 5
    $\begingroup$ @VlastimilOvčáčík, that's why at least four satellites (not all in a single plane) are required for a solution. The locus for constant absolute difference is a hyperboloid,not a plane. The diagrams showing the intersecting spheres are a simplification to make it easier to understand. $\endgroup$ – BowlOfRed Aug 12 '16 at 23:39
17
$\begingroup$

To give a big picture view of how the GPS solution is determined, consider the following equation:

$\rho_i = \sqrt{(x_i-x_u)^2+(y_i-y_u)^2+(z_i-z_u)^2} +c\Delta t$

where $\rho$ is essentially a range from the user to the GPS satellite, $x,y,z$ are position coordinates, the subscript $i$ indicates the particular satellite, $c$ is the speed of light, and $\Delta t$ is a time delay.

Assuming that you have knowledge of the GPS space vehicle (SV), the $x_i,y_i,z_i$ values are known from the satellite ephemeris (this can be obtained from publically available data, and more accurate ephemeris can be obtained via more secure methods). There are now 4 unknowns, implying that we need 4 GPS SVs to solve for the user location $(x_u,y_u,z_u)$ and time delay. More SVs can be observed, and an over-determined solution can be found from various numerical methods (e.g., a least squares solution), or a best-4 SV solution can be employed.

The time delay is essentially in the $\Delta t$ term. Various errors can be accounted for by augmenting the system of equations to include, but in no way limited to, ionospheric & tropospheric delays, relativity effects, and clock errors present in the receiver.

A multitude of simple and complex differential methods exist to essentially exploit similar delays between measurements and remove them without even solving for them (e.g., differential GPS and real time kinematics

Here is a short paper that discusses the observation equations and, more speficially, the GPS signal and code-generation.

$\endgroup$
  • $\begingroup$ Thanks for references. I see today, on my android phone's time settings, there is an option about synchronizing the time with gps. GPS signal speed is 300.000 km per sec. The distance of the gps around 30.000 km. So the lag is smaller than a second. And it is important to have exact time of the atomic clock of gps on my phone. I'll continue to looking for how gps receivers get rid of time lag and find out the exact atomic clock time. $\endgroup$ – digiogi Sep 23 '14 at 18:24
  • 1
    $\begingroup$ "I'll continue to looking for how gps receivers get rid of time lag". As quite a bit of math can be involved, what kind of answer are you looking for? How is the referenced information inadequate? $\endgroup$ – BowlOfRed Sep 23 '14 at 19:05
  • 1
    $\begingroup$ Hi Digilogi. Do you live in an area where you get ordinary radio reception for radio clocks? (Radio clocks only cost a few dollars now, you should buy one en.wikipedia.org/wiki/Radio_clock ) Note that the "convenience time" displayed on GPS receivers -- I'm not totally clear that that is MEANT TO BE "utterly synchronised" with the world's standard atomic clocks. If it is it's just a "bonus". If that is meant to be official atomic time, and you're asking about adjusting for the distance-to-the-satellites, it would just a trivial calculation in the software. Don't forget ... $\endgroup$ – Fattie Sep 24 '14 at 6:47
  • 1
    $\begingroup$ ...don't forget, when any ordinary ios or android phones syncs its time automatically (using apple's time server or whatever), there are tremendous software problems and "tricks" involved in getting that "as right as possible" allowing for internet delays and stuff. indeed, if you buy a $5 radio watch, I guess, in theory you'd have to consider how far you are from Mainflingen, or the like. $\endgroup$ – Fattie Sep 24 '14 at 6:49
  • 1
    $\begingroup$ And finally BTW ... en.wikipedia.org/wiki/Radio_clock#GPS_clocks $\endgroup$ – Fattie Sep 24 '14 at 6:50
9
$\begingroup$

The problem

The GPS receiver's time has to be synchronized with atomic clocks located in GPS satellites. It is kinda chicken or the egg problem. The receiver needs precise time to calculate precise distance and precise distance to synchronize time (to calculate the time difference).

The answer

It is the fourth satellite that gives your receiver the precise time.

The explanation

  • If you only have distance to satellite A you can be located anywhere on a sphere around A.
  • If you add distance to satellite B, you can be located anywhere in the intersection of spheres around A and B, which is gonna be a circle.
  • If you add distance to satellite C, you can be located in two points, which are the intersection of the circle and sphere around C.
  • If you add distance to satellite D, one of the two points becomes the point.

But this is the perfect scenario - you've got 4 precise distances and they perfectly fit into single point. But precise measurement of distances requires synchronized time on your receiver.

So what if your receiver's time is not synchronized with satellites? In that case the fourth measurement - the distance to satellite D - will be way off. It won't align with neither of the two points, but it will be notably closer to one of them. Let's call the distance between the point and the sphere around satellite D the error.

At this point the receiver solves the problem backwards. We know that if the receiver has precise time and 4 distances it should yield precise position. So by adjusting the unsynchronized time of your receiver and recalculating the error with the adjusted time, the error increases or decreases.

Bottom line

The process of synchronizing time is reduced to the problem of minimizing the error by adjusting local time. Once the error is minimized, the precision of receiver's time is maximized.


What's so special about the fourth measurement?

Imagine you have 4 distances. Pick any 3 distances of them and if their spheres overlap, they will create two points where all of them intersect. No matter how imprecise the 3 distances are, as long as their spheres overlap they will form two perfectly defined points. But that does not mean the points relate to the real world.

The fourth measurement is the one that cannot be loose, in order to the 4 spheres overlap in single point.

What's the purpose of the fourth measurement?

In theory, 3 satellites can give you enough data to reduce your possible location to two points. And one of the points usually will be in absurd distance or moving absurd speed so it could be ruled out.

So the fourth satellite is not required to rule out one of the two points but really to synchronize the time of your receiver. Because without that the two points produced by overlapping only three spheres are not reliable at all.

Does the receiver just assume its time is precise enough for the initial measurements?

Yes.


Notes

  • when I say that the distances perfectly fit into single point, I actually mean that the time error is minimized and other sources of error are not considered (atmospheric etc.)

  • this answers is wrong as @AnthonyX points out below, but still there is little bit of truth (I think) in there

$\endgroup$
  • $\begingroup$ When you read this answer I really want you to imagine it's spring, you stand on meadow with your GPS receiver in palm and there are satellites above you with nice spheres around them :-) $\endgroup$ – Vlastimil Ovčáčík Aug 12 '16 at 22:22
  • 1
    $\begingroup$ The problem with your explanation is that you only know differences between the time references of the satellites being received; you don't know the distances to any of them until you can perform a multilateration on the delta times. It's basically a set of simultaneous equations. See en.wikipedia.org/wiki/Multilateration That requires at least four satellites due to the number of unknowns. $\endgroup$ – Anthony X Sep 3 '16 at 4:21
  • $\begingroup$ @AnthonyX I am aware of it now. Many introductory texts explain GPS as a system that uses absolute ranges, hence they model it as spheres. Such a simplification is imho unexcusable even in introductory materials, as it causes more confusion (to me). Consider this answer as a consequence of someone thinking simplification is fine. However I believe that my point that time synchronization is achieved by minimizing the error of fourth measurement is still valuable. Yet I can't object against any downvotes. $\endgroup$ – Vlastimil Ovčáčík Sep 3 '16 at 9:57
  • $\begingroup$ I believe there is an error mitigation but it requires 5 or more satellites. Four is the minimum just to get a unique solution. Even if you think of it in simplified terms, ranging from only three satellites would yield two possible solutions; the fourth satellite (not coplanar with the other three) would be needed to produce a single solution. $\endgroup$ – Anthony X Sep 3 '16 at 13:46
1
$\begingroup$

Let's say the time on your receiver was way off, let's say off by 10 minutes.

So, the delay for the signal from each of 4 satellites would appear to be 10 minutes plus some small fraction of a second.

The signal from the satellite with the shortest delay would be the satellite that is closest to you.

Subtracting that delay from the delays of the other 3 satellites will let you calculate the difference of the delay between each of the satellites.

Some other information you know as facts:

  1. The absolute location of all 4 satellites relative to earth... latitude, longitude, altitude (orbit height).
  2. Given that the "true" distance from you to the closest satellite cannot be less than that satellites' altitude (if you were directly below it), and cannot be further from you than the next further satellite.
  3. And the "true" distance from you to the furthest satellite cannot be less than the distance of the next closer satellite, and cannot be further from you than a point on the horizon at that satellites' altitude.

With just this information from these 4 satellites it should be possible to fairly accurately calculate your latitude and longitude. Adding data from additional satellites would allow improved accuracy including calculation of your altitude on earth.

$\endgroup$
  • $\begingroup$ So the receiver time is useless actually? $\endgroup$ – digiogi Sep 23 '14 at 20:45
  • 1
    $\begingroup$ If you knew the recevier time was properly syncronized, it would make calculations easier (quicker), so not entirely useless. $\endgroup$ – Kevin Fegan Sep 24 '14 at 3:11
  • $\begingroup$ not to mention that most people don't need remotely near atomic accuracy :) $\endgroup$ – JamesRyan Sep 24 '14 at 12:05
  • $\begingroup$ @KevinFegan Similar to how the receiver can use an approximate position (provided by the user) to determine which satellites should be visible to it. It isn't needed (that data can be figured out eventually) but it helps rule out some possible solutions to the math involved, resulting in a quicker position fix. $\endgroup$ – a CVn Aug 14 '16 at 14:23
  • $\begingroup$ This is incorrect. We need to know the delta time shift between the satellites with atomic accuracy. The "some small fraction of a second" you mention isn't something we can calculate with the on board receiver. It must be computed from the satellites. It is unlikely the receiver could even tell you which of the 4 satellites was closest to you just off of the time delay. See @jah138's answer. $\endgroup$ – chessofnerd Apr 7 at 19:35
-4
$\begingroup$

I'm pretty sure many of the answers above are at least partially off. You don't need 4 GPS satellites for a solution, you need 3. As stated above, 1 gets you a sphere, 2 a circle, and 3 one or most likely two points on the circle. One of those points is far in space or inside the Earth. The GPS receiver uses the mean surface distance of the Earth, the geode, to determine the correct (closer) one. Whichever is the closest to the geode wins. More than 3 satellites just allow better reduction of errors for timing and atmospheric issues, system faults, etc.

In terms of time, I'm not 100% sure, but I would imagine that the actual time of day is not of great importance, but just listening to ephemeris data should get sub-second accuracy for that. To get the receiver to have near-atomic accuracy I believe the system just makes an initial guess based on the data it has (perhaps an average of all the times it has heard from the satellites + a few MS for the mean distance of receivers to sats? Just speculation there) and then computers the error in the position. If the clock is fast, the error is big in one direction; slow produces a large error in the opposite direction. The receiver's clock is continually sped up or slowed down via a type of Phase-Locked Loop (PLL) until the error is as close to zero as possible; this continues for the entire time the device is running. If the clock starts to drift again, the PLL will catch it and push it back on track. By doing this, the clock is kept to nearly the same accuracy as those on the satellite, and thus accurate enough for navigation purposes or other precision timing purposes (NTP, radio transmission synchronization, etc). I suspect that's also (at least partly) why you see a larger error when you first turn on a GPS receiver that gets progressively smaller as the clock gets progressively more in sync.

PLL's have been around for a long time and are used everywhere. A VCXO is commonly used with a PLL to provide a cheap, variable, high frequency source based on the output of a lower speed, high quality fixed oscillator in radios and other communications gear, along with computers and other electronics. Hence where clock multiplier comes from with computing, a slow speed, fixed XO drives a faster bus via PLL to get your FSB speed, your CPU then using another multiplier and PLL for its own speed. PLL's also have been used for clock synchronization and recovery for communications for a very long time in communications networks.

Wikipedia has a decent article on it. It provides an analogy of cars racing around a track, each one under their own control trying to obtain the fastest safe/practical speed. When a pace car comes out, they all must get in line and follow the car in front of them, without passing. The pace car drives a fixed speed based on their speedometer. Each driver behind it tries to keep a similar distance to it or the car in front of them; they speed up to close gaps or slow down to lengthen them. Thus they all end up nearly evenly spaced and traveling at almost exactly the same speed. Remove the reference (pace car), and they're all off at random again.

$\endgroup$
  • 1
    $\begingroup$ I'm pretty sure many of the answers above are at least partially off. You don't need 4 GPS satellites for a solution, you need 3. The other answers have explained correctly why four satellites are needed. You're solving four simultaneous equations for a solution giving four variables: x, y, z, and t. $\endgroup$ – Ben Crowell Sep 3 '16 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.