Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does a GPS receiver synchronize its quartz clock with GPS satellites? [closed]

Tags:

algorithm

gps

I read a lot of tutorials and articles on How GPS works and found that it works on the principle of 3d Trilateration. GPS receivers have normally an ordinary quartz clock and GPS satellites have very costly atomic clock who have very high precision.

In one article it was mentioned that as ordinary quartz clock in GPS receivers have very less accuracy but they periodically reset their clock with GPS satellites clocks. And if both GPS receiver and GPS satellites clocks are synchronized then only GPS receiver can calculate its accurate distance from a GPS satellite.

How does a GPS receiver synchronize its clock with GPS satellites? This I tried to find out from many articles and many calculations, but I could not reach any solution. Could anyone please explain how a normal quartz clock at GPS receiver gets sync with GPS satellites?

like image 775
vicky Avatar asked Nov 17 '11 06:11

vicky


2 Answers

The crystal itself isn't a clock -- a crystal and a counter implement the clock. The counter might represent time with 32-bits for seconds and 32-bits for fractions of a second.

Every clock cycle, the counter is incremented with another value that represents the fractions of a second that passes per clock cycle.

So the clock can be sped up/slowed down by increasing/decreasing the amount of time that is added to the counter every clock cycle.

Relative to some master clocks, your clock will have frequency and phase differences -- usually you have some logic in a small micro-processor that measure these differences and slowly alters your clock to match the master clock -- using the value added to the counter every clock cycle.

To sum it up with an answer: the clock in your GPS receiver (crystal + counter) is sync'ed with the GPS satellite using algorithms called phase locked loops (PLL) and frequency locked loops (FLL).

Phase Mismatch

Phase sync is required because you can have two clocks that are running at the same speed, yet one is ahead of the other. e.g., clock A reads 31337.000000001 seconds and clock B reads 31337.000000002 seconds. One second later, clock A reads 31338.000000001 and clock B reads 31338.000000002 -- both clocks have progressed one second in time, but one clock is still ahead by 1 nanosecond. i.e., clock B is 2*pi*10^(-9) radians/sec out of phase with respect to clock A

Frequency Mismatch

Frequency sync is required because one clock can be running faster than the other. e.g., clock A reads 31337 seconds, and clock B reads 31337 seconds, but one second later, clock A reads 31338 seconds and clock B reads 31338.000000001 seconds -- clock B has run faster than clock A by 1 nanosecond/second.

In practice

In practice you have to account for both of these problems in order to sync one clock to a master clock, because no oscillators are totally precise and stable. So what GPS does is give the clock long term discipline through the use of FLL and PLL algorithms -- the quartz oscillator in the GPS is still relatively unstable compared to a TCXO or atomic oscillator, but at least it can be disciplined to be long term precise.

like image 50
Anthony Blake Avatar answered Oct 11 '22 05:10

Anthony Blake


A common way of syncing clocks over latent networks (you could consider a satellite linkup a "latent network") is the Network Time Protocol. The protocol was designed for a very similar purpose - syncing less stable clocks with atomic clocks.

The NTP probably will deal with more issues than a GPS would, but studying the design of NTP could give you a thorough understanding of how to sync two clocks when you can't determine the latency with 100% accuracy. I.e. when you can't simply measure a wire length, latency of electronic components, and number of system clock cycles involved in the process.

like image 45
Merlyn Morgan-Graham Avatar answered Oct 11 '22 05:10

Merlyn Morgan-Graham