: Understanding and using the Network Time Protocol (A first try on a non-technical Mini-HOWTO and FAQ on NTP) | ||
---|---|---|
Prev | Next |
The NTP software supports different kinds of reference clocks. This section presents various reference clocks. For a more general discussion on the topic see What is a reference clock?.
According to a recent survey[2], the most popular real reference clocks are:
GPS |
DCF77 |
WWVB |
While not the cheapest solution, GPS offers high accuracy without a lot of trickery. DCF77 on the other hand offers very cheap solutions at moderate accuracy.
More information on reference clocks can be found in html/refclock.htm (Reference Clock Drivers), http://www.ntp.org/hardware.html, and http://www.boulder.nist.gov/timefreq/general/receiverlist.htm.
The LCL is no reference clock in reality; instead it simply refers to the system time on the current machine. Therefore it should never be used, except when the system time is synchronized by some means not visible by xntpd.
On an isolated network one might set the time manually from time to time. Together with a frequency adjustment available as a fudge factor (see the driver's documentation) one may achieve an accuracy of a few seconds per week.
If you think you really must use LCL, here is how:
server 127.127.1.1 # LCL, local clock fudge 127.127.1.1 stratum 12 # increase stratum
GPS receivers have high accuracy, are simple to install, rather immune against electromagnetic noise, and they only need an antenna with free view to the sky, preferrably as much of the hemisphere as possible.[1] Most calibration happens automatically.
GPS the Global Positioning System, a satellite based navigation aid originally developed for military use in the USA, can provide the receiver with accurate data about the current position, elevation, and time (See also Section 9.1). Unfortunately many of these receivers were not designed with accurate time-keeping in mind. Therefore the time information provided in a stream of serial data sometimes is freely floating within one second, thereby losing the precision of the receiver (Accurate time is needed in the receiver to calculate the exact position. See also How accurate will my Clock be?).
Fortunately there are also receivers that were designed for precision timekeeping. Among these are:
Table 1. Supported GPS receivers
Manufacturer | Model | Driver/Mode | Interface | PPS available |
---|---|---|---|---|
Arbiter | 1088A/B | 11 | serial; 9600 baud | Y |
Austron | GPS-AS2201 | 10 | serial; 9600 baud | Y |
Garmin | GPS35(25) | 20 | serial, 4800 baud | Y (TTL) |
GPSclock (http://www.gpsclock.com/) | 200 | 20 (patched) | serial; 4800 baud | Y |
Hewlett Packard | 58503A | 26 | serial; 9600 baud | Y |
Magnavox | GPS-MX4200 | 9 | serial; 4800 baud | Y |
Meinberg | GPS166, GPS167 | 8/8 | serial; 9600 baud | Y |
Trak(?) | 8810, 8820 | 2 | serial; 9600 baud | Y |
Trimble | Acutime 2000[a] | 8/10, 29 | TSIP | Y (TTL) |
Trimble | Palisade[b] | 8/10, 29 | serial; | ? |
Trimble | SV6[b] | 8/9, 8/10 | TAIP, TSIP | Y |
Notes: a. This SmartAntenna is the replacement for both, the SV6 and the Palisade. The device is no longer manufactured. |
XXX Note from the editor: The table above is quite incomplete. Contributors for missing entries are very much invited.
These parameters qualify the accuracy of a GPS receiver. The following is a translation of an explanation given by Martin Burnicki: "The dilution values have no units, and they are computed from the position of the satellites relative to the position of the receiver's antenna. Small values express high precision. The values are computed using an inversion of a 4x4 matrix containing the cosinus values of the angles between the antenna and the satellites. There are four values dx, dy, dz, and dt that contribute to the dilution values in the follwoing manner:"
Many GPS receiver use a standardized format of output called NMEA 0183. The acronym stands for National Marine Electronics Association, thus indicating the intended purpose of the protocol, namely the navigation of ships.
NMEA defines several message types, each message being an ASCII string transmitted at 4800 baud. Each message starts with $ char and ends with <CR><LF>. A five-digit message identifier (for instance $GPRMC) specifies source and type of the message. Parameters for that message are separated by ,.
For the purpose of keeping time, the GPRMC (GPS recommended minimum data) message contains the current time in second resolution, receiver status, latitude, longitude, speed over ground, heading (track), date, magnetic variation in degrees, and a checksum. That message is either sent automatically every second, or upon request.
Message type GPGSA contains the receiver's mode, number of satellites, and quality of the solution (dilution of precision, DOP). Precise information about the position can be found in the GPGGA message.
NMEA is commonly used together with PPS, because the messages seem to be sent with low accuracy regarding the start of a second.
TSIP stands for Trimble Standard Interface Protocol, and it is used in products from Trimble. The documented binary protocol exchanges packets over serial lines. This allows embedded devices to be monitored, queried and controlled exclusively by TSIP, not needing any switches or displays.
In comparison to GPS, DCF77 receivers are cheap, and they don't need an antenna with a view at the sky.
Germany has a highly accurate clock and a long-wave transmitter that sends out time data at 77.5kHz. This service is commonly known as DCF77. Time is taken from the German UTC contributor PTB (Physikalisch Technische Bundesanstalt) in Braunschweig. The sender located in Mainflingen (50:01N 9:00E)[2] can be received even in a distance of up to 1000km as the waves easily pass obstacles in the line of sight. The delay of the signal, a few milliseconds, caused by the distance between transmitter and receiver should be compensated manually.
In addition the demodulation of the time signal can be done easily in very cheap receivers (20DEM or similar). Thus these receivers are quite popular in Germany and its neighbourhood. That type of receivers are typically powered from a serial port, just like a serial mouse. The output signal carries pulses of 100 and 200ms, starting at the beginning of a second, and encoding one bit. There is no pulse for the last second of each minute. Those can be feed into an UART that decodes the pulses as characters received at 50 baud. The best signal quality can be achieved if the antenna of the receiver is oriented tangential to the transmitter's antenna.
Because of the simple AM modulation, the demodulation is sensitive to spikes and varying receive conditions. Accuracy is typically only around 3ms. Trying to make the resolution higher will increase the receiver's sensitivity for noise and spikes that are around anyway. There's also a FM[3] modulation (pseudo-random phase noise) in the signal that can be decoded by sophisticated and expensive receivers. These receivers can achieve a resolution of 50µs.
The data format transmits 59 bits per minute. These bits that start every second, only when the minute is complete no bit is transmitted. Therefore it takes at least one minute until the time and date have been successfully transmitted. As the data format has little redundancy, most receivers wait until two consistent time messages have been decoded without error. Typically it takes between two and three minutes until the receiver is synchronized.
Besides the fact that the huge[4] antenna (and its backup) of the sender is turned off for maintenance occasionally, there are a few other reasons why DCF77 reception may be impossible:[5]
The sending antenna may be turned off during thunderstorms to avoid the risk of electrical damage.
Lightning itself may cause spikes on the received signal.
High-power devices like refrigerators, ovens, etc. may cause spikes on the received signal when turning on or off.
Changes in the atmosphere (or is it "ionosphere"?) (especially during sunrise and sunset) are said to have a bad influence on the signal.
Electrical equipment close to the receiver's antenna may distort the signal. Such equipment can be:
metal parts close to the ferrite loopstick may detune it
huge metal constructions can have a negative impact on the signal reception inside (Faraday shield)
XXX Note from the editor: Other types of reference clocks are still to come (are missing now). Contributors invited!
See Q: 7.3.2. for some basics.
Markus Kuhn has set up a page describing low-frequency time standards (WWVB, MSF, DCF77, etc) and receiver designs at http://www.cl.cam.ac.uk/~mgk25/lf-clocks.html.
The easiest way to find a suitable reference clock seems to be the following:
Use one of the models mentioned in the documentation (e.g. Table 1).
Use a model that someone else is already using with success.
Despite of these hints and the information found at http://www.ntp.org/hardware.html, there are some additional resources like http://www.boulder.nist.gov/timefreq/general/receiverlist.htm and http://www.ieee-uffc.org/freqcontrol/piezo.html.
[1] | There is some planning software available at http://www.trimble.com/planningsoftware.html. That software could be used to explain periodic dropouts when only a limited view to the sky is available. An anonymous contributor added: "After installing the software be sure to import the ephemeris file using Almanac->Import->SSF and set your station location using File->Station." |
[2] | Near Frankfurt am Main |
[3] | As Mark Martinec points out, it's actually PSK (phase shift keying) (see http://www.ptb.de/english/org/4/43/433/disse.htm). I'm assuming the typical audience will neither care nor be able to build such a thing, so please forgive me!. |
[4] | Flying above Frankfurt, I once thought I've seen the two huge piles of the antenna. |
[5] | The following list possibly applies to other low-frequency receivers (like MSF) as well. |