~ubuntu-branches/debian/squeeze/ntp/squeeze-201010051545

« back to all changes in this revision

Viewing changes to html/driver36.htm

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-10-11 16:10:27 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041011161027-icyjbji8ujym633o
Tags: 1:4.2.0a-10ubuntu2
Use ntp.ubuntulinux.org instead of pool.ntp.org

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
2
 
<html>
3
 
<head>
4
 
<meta name="generator" content="HTML Tidy, see www.w3.org">
5
 
<title>Radio WWV/H Audio Demodulator/Decoder</title>
6
 
</head>
7
 
<body>
8
 
<h3>Radio WWV/H Audio Demodulator/Decoder</h3>
9
 
 
10
 
<hr>
11
 
<h4>Synopsis</h4>
12
 
 
13
 
Address: 127.127.36.<i>u</i> <br>
14
 
Reference ID: <tt>WWV</tt> or <tt>WWVH</tt> <br>
15
 
Driver ID: <tt>WWV_AUDIO</tt> <br>
16
 
Autotune Port: <tt>/dev/icom</tt>; 1200/9600 baud, 8-bits, no
17
 
parity <br>
18
 
Audio Device: <tt>/dev/audio</tt> and <tt>/dev/audioctl</tt> 
19
 
 
20
 
<h4>Description</h4>
21
 
 
22
 
This driver synchronizes the computer time using data encoded in
23
 
shortwave radio transmissions from NIST time/frequency stations WWV
24
 
in Ft. Collins, CO, and WWVH in Kauai, HI. Transmissions are made
25
 
continuously on 2.5, 5, 10, 15 and 20 MHz. An ordinary shortwave
26
 
receiver can be tuned manually to one of these frequencies or, in
27
 
the case of ICOM receivers, the receiver can be tuned automatically
28
 
by the driver as propagation conditions change throughout the day
29
 
and night. The performance of this driver when tracking one of the
30
 
stations is ordinarily better than 1 ms in time with frequency
31
 
drift less than 0.5 PPM when not tracking either station. 
32
 
 
33
 
<p>The demodulation and decoding algorithms used by this driver are
34
 
based on a machine language program developed for the TAPR DSP93
35
 
DSP unit, which uses the TI 320C25 DSP chip. The analysis, design
36
 
and performance of the program running on this unit is described
37
 
in: Mills, D.L. A precision radio clock for WWV transmissions.
38
 
Electrical Engineering Report 97-8-1, University of Delaware,
39
 
August 1997, 25 pp. Available from <a href=
40
 
"http://www.eecis.udel.edu/~mills/reports.htm">
41
 
www.eecis.udel.edu/~mills/reports.htm</a>. For use in this driver,
42
 
the original program was rebuilt in the C language and adapted to
43
 
the NTP driver interface. The algorithms have been modified
44
 
somewhat to improve performance under weak signal conditions and to
45
 
provide an automatic station identification feature.</p>
46
 
 
47
 
<p>This driver incorporates several features in common with other
48
 
audio drivers such as described in the <a href="driver7.htm">Radio
49
 
CHU Audio Demodulator/Decoder</a> and the <a href="driver6.htm">
50
 
IRIG Audio Decoder</a> pages. They include automatic gain control
51
 
(AGC), selectable audio codec port and signal monitoring
52
 
capabilities. For a discussion of these common features, as well as
53
 
a guide to hookup, debugging and monitoring, see the <a href=
54
 
"audio.htm">Reference Clock Audio Drivers</a> page.</p>
55
 
 
56
 
<p>The WWV signal format is described in NIST Special Publication
57
 
432 (Revised 1990). It consists of three elements, a 5-ms, 1000-Hz
58
 
pulse, which occurs at the beginning of each second, a 800-ms,
59
 
1000-Hz pulse, which occurs at the beginning of each minute, and a
60
 
pulse-width modulated 100-Hz subcarrier for the data bits, one bit
61
 
per second. The WWVH format is identical, except that the 1000-Hz
62
 
pulses are sent at 1200 Hz. Each minute encodes nine BCD digits for
63
 
the time of century plus seven bits for the daylight savings time
64
 
(DST) indicator, leap warning indicator and DUT1 correction.</p>
65
 
 
66
 
<h4>Program Architecture</h4>
67
 
 
68
 
<p>As in the original program, the clock discipline is modelled as
69
 
a Markov process, with probabilistic state transitions
70
 
corresponding to a conventional clock and the probabilities of
71
 
received decimal digits. The result is a performance level which
72
 
results in very high accuracy and reliability, even under
73
 
conditions when the minute beep of the signal, normally its most
74
 
prominent feature, can barely be detected by ear with a shortwave
75
 
receiver.</p>
76
 
 
77
 
<p>The analog audio signal from the shortwave radio is sampled at
78
 
8000 Hz and converted to digital representation. The 1000/1200-Hz
79
 
pulses and 100-Hz subcarrier are first separated using two IIR
80
 
filters, a 600-Hz bandpass filter centered on 1100 Hz and a 150-Hz
81
 
lowpass filter. The minute sync pulse is extracted using a 800-ms
82
 
synchronous matched filter and pulse grooming logic which
83
 
discriminates between WWV and WWVH signals and noise. The second
84
 
sync pulse is extracted using a 5-ms FIR matched filter and
85
 
8000-stage comb filter.</p>
86
 
 
87
 
<p>The phase of the 100-Hz subcarrier relative to the second sync
88
 
pulse is fixed at the transmitter; however, the audio highpass
89
 
filter in most radios affects the phase response at 100 Hz in
90
 
unpredictable ways. The driver adjusts for each radio using two
91
 
170-ms synchronous matched filters. The I (in-phase) filter is used
92
 
to demodulate the subcarrier envelope, while the Q
93
 
(quadrature-phase) filter is used in a tracking loop to discipline
94
 
the codec sample clock and thus the demodulator phase.</p>
95
 
 
96
 
<p>The data bit probabilities are determined from the subcarrier
97
 
envelope using a threshold-corrected slicer. The averaged envelope
98
 
amplitude 30 ms from the beginning of the second establishes the
99
 
minimum (noise floor) value, while the amplitude 200 ms from the
100
 
beginning establishes the maximum (signal peak) value. The slice
101
 
level is midway between these two values. The negative-going
102
 
envelope transition at the slice level establishes the length of
103
 
the data pulse, which in turn establish probabilities for binary
104
 
zero (P0) or binary one (P1). The values are established by linear
105
 
interpolation between the pulse lengths for P0 (300 ms) and P1 (500
106
 
ms) so that the sum is equal to one. If the driver has not
107
 
synchronized to the minute pulse, or if the data bit amplitude,
108
 
signal/noise ratio (SNR) or length are below thresholds, the bit is
109
 
considered invalid and all three probabilities are set to zero.</p>
110
 
 
111
 
<p>The difference between the P1 and P0 probabilities, or
112
 
likelihood, for each data bit is exponentially averaged in a set of
113
 
60 accumulators, one for each second, to determine the semi-static
114
 
miscellaneous bits, such as DST indicator, leap second warning and
115
 
DUT1 correction. In this design, an average value larger than a
116
 
positive threshold is interpreted as a hit on one and a value
117
 
smaller than a negative threshold as a hit on zero. Values between
118
 
the two thresholds, which can occur due to signal fades or loss of
119
 
signal, are interpreted as a miss, and result in no change of
120
 
indication.</p>
121
 
 
122
 
<p>The BCD digit in each digit position of the timecode is
123
 
represented as four data bits, all of which must be valid for the
124
 
digit itself to be considered valid. If so, the bits are correlated
125
 
with the bits corresponding to each of the valid decimal digits in
126
 
this position. If the digit is invalid, the correlated value for
127
 
all digits in this position is assumed zero. In either case, the
128
 
values for all digits are exponentially averaged in a likelihood
129
 
vector associated with this position. The digit associated with the
130
 
maximum over all of the averaged values then becomes the maximum
131
 
likelihood selection for this position and the ratio of the maximum
132
 
over the next lower value becomes the likelihood ratio.</p>
133
 
 
134
 
<p>The decoding matrix contains nine row vectors, one for each
135
 
digit position. Each row vector includes the maximum likelihood
136
 
digit, likelihood vector and other related data. The maximum
137
 
likelihood digit for each of the nine digit positions becomes the
138
 
maximum likelihood time of the century. A built-in transition
139
 
function implements a conventional clock with decimal digits that
140
 
count the minutes, hours, days and years, as corrected for leap
141
 
seconds and leap years. The counting operation also rotates the
142
 
likelihood vector corresponding to each digit as it advances. Thus,
143
 
once the clock is set, each clock digit should correspond to the
144
 
maximum likelihood digit as transmitted.</p>
145
 
 
146
 
<p>Each row of the decoding matrix also includes a compare counter
147
 
and the difference (modulo the radix) between the current clock
148
 
digit and most recently determined maximum likelihood digit. If a
149
 
digit likelihood exceeds the decision level and the difference is
150
 
constant for a number of successive minutes in any row, the maximum
151
 
likelihood digit replaces the clock digit in that row. When this
152
 
condition is true for all rows and the second epoch has been
153
 
reliably determined, the clock is set (or verified if it has
154
 
already been set) and delivers correct time to the integral second.
155
 
The fraction within the second is derived from the logical master
156
 
clock, which runs at 8000 Hz and drives all system timing
157
 
functions.</p>
158
 
 
159
 
<p>The logical master clock is derived from the audio codec clock.
160
 
Its frequency is disciplined by a frequency-lock loop (FLL) which
161
 
operates independently of the data recovery functions. At averaging
162
 
intervals determined by the measured jitter, the frequency error is
163
 
calculated as the difference between the most recent and the
164
 
current second epoch divided by the interval. The sample clock
165
 
frequency is then corrected by this amount using an exponential
166
 
average. When first started, the frequency averaging interval is
167
 
eight seconds, in order to compensate for intrinsic codec clock
168
 
frequency offsets up to 125 PPM. Under most conditions, the
169
 
averaging interval doubles in stages from the initial value to over
170
 
1000 seconds, which results in an ultimate frequency precision of
171
 
0.125 PPM, or about 11 ms/day.</p>
172
 
 
173
 
<p>It is important that the logical clock frequency is stable and
174
 
accurately determined, since in most applications the shortwave
175
 
radio will be tuned to a fixed frequency where WWV or WWVH signals
176
 
are not available throughout the day. In addition, in some parts of
177
 
the US, especially on the west coast, signals from either or both
178
 
WWV and WWVH may be available at different times or even at the
179
 
same time. Since the propagation times from either station are
180
 
almost always different, each station must be reliably identified
181
 
before attempting to set the clock.</p>
182
 
 
183
 
<p>Station identification uses the 800-ms minute pulse transmitted
184
 
by each station. In the acquisition phase the entire minute is
185
 
searched using both the WWV and WWVH using matched filters and a
186
 
pulse gate discriminator similar to that found in radar acquisition
187
 
and tracking receivers. The peak amplitude found determines a range
188
 
gate and window where the next pulse is expected to be found. The
189
 
minute is scanned again to verify the peak is indeed in the window
190
 
and with acceptable amplitude, SNR and jitter. At this point the
191
 
receiver begins to track the second sync pulse and operate as above
192
 
until the clock is set.</p>
193
 
 
194
 
<p>Once the minute is synchronized, the range gate is fixed and
195
 
only energy within the window is considered for the minute sync
196
 
pulse. A compare counter increments by one if the minute pulse has
197
 
acceptable amplitude, SNR and jitter and decrements otherwise. This
198
 
is used as a quality indicator and reported in the timecode and
199
 
also for the autotune function described below.</p>
200
 
 
201
 
<h4>Performance</h4>
202
 
 
203
 
<p>It is the intent of the design that the accuracy and stability
204
 
of the indicated time be limited only by the characteristics of the
205
 
propagation medium. Conventional wisdom is that synchronization via
206
 
the HF medium is good only to a millisecond under the best
207
 
propagation conditions. The performance of the NTP daemon
208
 
disciplined by the driver is clearly better than this, even under
209
 
marginal conditions. Ordinarily, with marginal to good signals and
210
 
a frequency averaging interval of 1024 s, the frequency is
211
 
stabilized within 0.1 PPM and the time within 125 <font face=
212
 
"Symbol">m</font>s. The frequency stability characteristic is
213
 
highly important, since the clock may have to free-run for several
214
 
hours before reacquiring the WWV/H signal.</p>
215
 
 
216
 
<p>The expected accuracy over a typical day was determined using
217
 
the DSP93 and an oscilloscope and cesium oscillator calibrated with
218
 
a GPS receiver. With marginal signals and allowing 15 minutes for
219
 
initial synchronization and frequency compensation, the time
220
 
accuracy determined from the WWV/H second sync pulse was reliably
221
 
within 125 <font face="Symbol">m</font>s. In the particular DSP-93
222
 
used for program development, the uncorrected CPU clock frequency
223
 
offset was 45.8&plusmn;0.1 PPM. Over the first hour after initial
224
 
synchronization, the clock frequency drifted about 1 PPM as the
225
 
frequency averaging interval increased to the maximum 1024 s. Once
226
 
reaching the maximum, the frequency wandered over the day up to 1
227
 
PPM, but it is not clear whether this is due to the stability of
228
 
the DSP-93 clock oscillator or the changing height of the
229
 
ionosphere. Once the frequency had stabilized and after loss of the
230
 
WWV/H signal, the frequency drift was less than 0.5 PPM, which is
231
 
equivalent to 1.8 ms/h or 43 ms/d. This resulted in a step phase
232
 
correction up to several milliseconds when the signal returned.</p>
233
 
 
234
 
<p>The measured propagation delay from the WWV transmitter at
235
 
Boulder, CO, to the receiver at Newark, DE, is 23.5&plusmn;0.1 ms.
236
 
This is measured to the peak of the pulse after the second sync
237
 
comb filter and includes components due to the ionospheric
238
 
propagation delay, nominally 8.9 ms, communications receiver delay
239
 
and program delay. The propagation delay can be expected to change
240
 
about 0.2 ms over the day, as the result of changing ionosphere
241
 
height. The DSP93 program delay was measured at 5.5 ms, most of
242
 
which is due to the 400-Hz bandpass filter and 5-ms matched filter.
243
 
Similar delays can be expected of this driver.</p>
244
 
 
245
 
<h4>Program Operation</h4>
246
 
 
247
 
The driver begins operation immediately upon startup. It first
248
 
searches for one or both of the stations WWV and WWVH and attempts
249
 
to acquire minute sync. This may take some fits and starts, as the
250
 
driver expects to see three consecutive minutes with good signals
251
 
and low jitter. If the autotune function is active, the driver will
252
 
rotate over all five frequencies and both WWV and WWVH stations
253
 
until three good minutes are found. 
254
 
 
255
 
<p>The driver then acquires second sync, which can take up to
256
 
several minutes, depending on signal quality. At the same time the
257
 
driver accumulates likelihood values for each of the nine digits of
258
 
the clock, plus the seven miscellaneous bits included in the WWV/H
259
 
transmission format. The minute units digit is decoded first and,
260
 
when five repetitions have compared correctly, the remaining eight
261
 
digits are decoded. When five repetitions of all nine digits have
262
 
decoded correctly, which normally takes 15 minutes with good
263
 
signals and up to an hour when buried in noise, and the second sync
264
 
alarm has not been raised for two minutes, the clock is set (or
265
 
verified) and is selectable to discipline the system clock.</p>
266
 
 
267
 
<p>As long as the clock is set or verified, the system clock
268
 
offsets are provided once each second to the reference clock
269
 
interface, where they are saved in a buffer. At the end of each
270
 
minute, the buffer samples are groomed by the median filter and
271
 
trimmed-mean averaging functions. Using these functions, the system
272
 
clock can in principle be disciplined to a much finer resolution
273
 
than the 125-<font face="Symbol">m</font>s sample interval would
274
 
suggest, although the ultimate accuracy is probably limited by
275
 
propagation delay variations as the ionspheric height varies
276
 
throughout the day and night.</p>
277
 
 
278
 
<p>As long as signals are available, the clock frequency is
279
 
disciplined for use during times when the signals are unavailable.
280
 
The algorithm refines the frequency offset using increasingly
281
 
longer averaging intervals to 1024 s, where the precision is about
282
 
0.1 PPM. With good signals, it takes well over two hours to reach
283
 
this degree of precision; however, it can take many more hours than
284
 
this in case of marginal signals. Once reaching the limit, the
285
 
algorithm will follow frequency variations due to temperature
286
 
fluctuations and ionospheric height variations.</p>
287
 
 
288
 
<p>It may happen as the hours progress around the clock that WWV
289
 
and WWVH signals may appear alone, together or not at all. When the
290
 
driver is first started, the NTP reference identifier appears as
291
 
<tt>NONE</tt>. When the driver has acquired one or both stations
292
 
and mitigated which one is best, it sets the station identifier in
293
 
the timecode as described below. In addition, the NTP reference
294
 
identifier is set to the station callsign. If the propagation
295
 
delays has been properly set with the <tt>fudge time1</tt> (WWV)
296
 
and <tt>fudge time2</tt> (WWVH) commands in the configuration file,
297
 
handover from one station to the other will be seamless.</p>
298
 
 
299
 
<p>Once the clock has been set for the first time, it will appear
300
 
reachable and selectable to discipline the system clock, even if
301
 
the broadcast signal fades to obscurity. A consequence of this
302
 
design is that, once the clock is set, the time and frequency are
303
 
disciplined only by the second sync pulse and the clock digits
304
 
themselves are driven by the clock state machine and ordinarily
305
 
never changed. However, as long as the clock is set correctly, it
306
 
will continue to read correctly after a period of signal loss, as
307
 
long as it does not drift more than 500 ms from the correct time.
308
 
Assuming the clock frequency can be disciplined within 1 PPM, the
309
 
clock could coast without signals for some 5.8 days without
310
 
exceeding that limit. If for some reason this did happen, the clock
311
 
would be in the wrong second and would never resynchronize. To
312
 
protect against this most unlikely situation, if after four days
313
 
with no signals, the clock is considered unset and resumes the
314
 
synchronization procedure from the beginning.</p>
315
 
 
316
 
<p>To work well, the driver needs a communications receiver with
317
 
good audio response at 100 Hz. Most shortwave and communications
318
 
receivers roll off the audio response below 250 Hz, so this can be
319
 
a problem, especially with receivers using DSP technology, since
320
 
DSP filters can have very fast rolloff outside the passband. Some
321
 
DSP transceivers, in particular the ICOM 775, have a programmable
322
 
low frequency cutoff which can be set as low as 80 Hz. However,
323
 
this particular radio has a strong low frequency buzz at about 10
324
 
Hz which appears in the audio output and can affect data recovery
325
 
under marginal conditions. Although not tested, it would seem very
326
 
likely that a cheap shortwave receiver could function just as well
327
 
as an expensive communications receiver.</p>
328
 
 
329
 
<h4>Autotune</h4>
330
 
 
331
 
<p>The driver includes provisions to automatically tune the radio
332
 
in response to changing radio propagation conditions throughout the
333
 
day and night. The radio interface is compatible with the ICOM CI-V
334
 
standard, which is a bidirectional serial bus operating at TTL
335
 
levels. The bus can be connected to a serial port using a level
336
 
converter such as the CT-17. The serial port speed is presently
337
 
compiled in the program, but can be changed in the driver source
338
 
file.</p>
339
 
 
340
 
<p>Each ICOM radio is assigned a unique 8-bit ID select code,
341
 
usually expressed in hex format. To activate the CI-V interface,
342
 
the <tt>mode</tt> keyword of the <tt>server</tt> configuration
343
 
command specifies a nonzero select code in decimal format. A table
344
 
of ID select codes for the known ICOM radios is given below. Since
345
 
all ICOM select codes are less than 128, the high order bit of the
346
 
code is used by the driver to specify the baud rate. If this bit is
347
 
not set, the rate is 9600 bps for the newer radios; if set, the
348
 
rate is 1200 bps for the older radios. A missing <tt>mode</tt>
349
 
keyword or a zero argument leaves the interface disabled.</p>
350
 
 
351
 
<p>If specified, the driver will attempt to open the device <tt>
352
 
/dev/icom</tt> and, if successful will activate the autotune
353
 
function and tune the radio to each operating frequency in turn
354
 
while attempting to acquire minute sync from either WWV or WWVH.
355
 
However, the driver is liberal in what it assumes of the
356
 
configuration. If the <tt>/dev/icom</tt> link is not present or the
357
 
open fails or the CI-V bus or radio is inoperative, the driver
358
 
quietly gives up with no harm done.</p>
359
 
 
360
 
<p>Once acquiring minute sync, the driver operates as described
361
 
above to set the clock. However, during seconds 59, 0 and 1 of each
362
 
minute it tunes the radio to one of the five broadcast frequencies
363
 
to measure the sync pulse and data pulse amplitudes and SNR and
364
 
update the compare counter. Each of the five frequencies are probed
365
 
in a five-minute rotation to build a database of current
366
 
propagation conditions for all signals that can be heard at the
367
 
time. At the end of each rotation, a mitigation procedure scans the
368
 
database and retunes the radio to the best frequency and station
369
 
found. For this to work well, the radio should be set for a fast
370
 
AGC recovery time. This is most important while tracking a strong
371
 
signal, which is normally the case, and then probing another
372
 
frequency, which may have much weaker signals.</p>
373
 
 
374
 
<p>Reception conditions for each frequency and station are
375
 
evaluated according to a metric which considers the minute sync
376
 
pulse amplitude, SNR and jitter, as well as, the data pulse
377
 
amplitude and SNR. The minute pulse is evaluated at second 0, while
378
 
the data pulses are evaluated at seconds 59 and 1. The results are
379
 
summarized in a scoreboard of three bits</p>
380
 
 
381
 
<dl>
382
 
<dt><tt>0x0001</tt></dt>
383
 
 
384
 
<dd>Jitter exceeded. The difference in epoches between the last
385
 
minute sync pulse and the current one exceeds 50 ms (400
386
 
samples).</dd>
387
 
 
388
 
<dt><tt>0x0002</tt></dt>
389
 
 
390
 
<dd>Minute pulse error. For the minute sync pulse in second 0,
391
 
either the amplitude or SNR is below threshold (2000 and 20 dB,
392
 
respectively).</dd>
393
 
 
394
 
<dt><tt>0x0004</tt></dt>
395
 
 
396
 
<dd>Minute pulse error. For both of the data pulses in seocnds 59
397
 
and 1, either the amplitude or SNR is below threshold (1000 and 10
398
 
dB, respectively).</dd>
399
 
</dl>
400
 
 
401
 
<p>If none of the scoreboard bits are set, the compare counter is
402
 
increased by one to a maximum of six. If any bits are set, the
403
 
counter is decreased by one to a minimum of zero. At the end of
404
 
each minute, the frequency and station with the maximum compare
405
 
count is chosen, with ties going to the highest frequency.</p>
406
 
 
407
 
<h4>Diagnostics</h4>
408
 
 
409
 
<p>The autotune process produces diagnostic information along with
410
 
the timecode. This is very useful for evaluating the performance of
411
 
the algorithm, as well as radio propagation conditions in general.
412
 
The message is produced once each minute for each frequency in turn
413
 
after minute sync has been acquired.</p>
414
 
 
415
 
<p><tt>wwv5 port agc wwv wwvh</tt></p>
416
 
 
417
 
<p>where <tt>port</tt> and <tt>agc</tt> are the audio port and
418
 
gain, respectively, for this frequency and <tt>wwv</tt> and <tt>
419
 
wwvh</tt> are two sets of fields, one each for WWV and WWVH. Each
420
 
of the two fields has the format</p>
421
 
 
422
 
<p><tt>ident score comp sync/snr/jitr</tt></p>
423
 
 
424
 
<p>where <tt>ident</tt>encodes the station (<tt>C</tt> for WWV,
425
 
<tt>H</tt> for WWVH) and frequency (2, 5, 10, 15 and 20), <tt>
426
 
score</tt> is the scoreboard described above, <tt>comp</tt> is the
427
 
compare counter, <tt>sync</tt> is the minute sync pulse amplitude,
428
 
<tt>snr</tt> the SNR of the pulse and <tt>jitr</tt> is the sample
429
 
difference between the current epoch and the last epoch. An example
430
 
is:</p>
431
 
 
432
 
<p><tt>wwv5 2 111 C20 0100 6 8348/30.0/-3 H20 0203 0
433
 
22/-12.4/8846</tt></p>
434
 
 
435
 
<p>Here the radio is tuned to 20 MHz and the line-in port AGC is
436
 
currently 111 at that frequency. The message contains a report for
437
 
WWV (<tt>C20</tt>) and WWVH (<tt>H20</tt>). The WWV report
438
 
scoreboard is 0100 and the compare count is 6, which suggests very
439
 
good reception conditions, and the minute sync amplitude and SNR
440
 
are well above thresholds (2000 and 20 dB, respectively). Probably
441
 
the most sensitive indicator of reception quality is the jitter, -3
442
 
samples, which is well below threshold (50 ms or 400 samples).
443
 
While the message shows solid reception conditions from WWV, this
444
 
is not the case for WWVH. Both the minute sync amplitude and SNR
445
 
are below thresholds and the jitter is above threshold.</p>
446
 
 
447
 
<p>A sequence of five messages, one for each minute, might appear
448
 
as follows:</p>
449
 
 
450
 
<pre>
451
 
wwv5 2  95 C2 0107 0 164/7.2/8100  H2 0207 0 80/-5.5/7754
452
 
wwv5 2  99 C5 0104 0 3995/21.8/395  H5 0207 0 27/-9.3/18826
453
 
wwv5 2 239 C10 0105 0 9994/30.0/2663 H10 0207 0 54/-16.1/-529
454
 
wwv5 2 155 C15 0103 3 3300/17.8/-1962 H15 0203 0 236/17.0/4873
455
 
wwv5 2 111 C20 0100 6 8348/30.0/-3 H20 0203 0 22/-12.4/8846
456
 
</pre>
457
 
 
458
 
<p>Clearly, the only frequencies that are available are 15 MHz and
459
 
20 MHz and propagation may be failing for 15 MHz. However, minute
460
 
sync pulses are being heard on 5 and 10 MHz, even though the data
461
 
pulses are not. This is typical of late afternoon when the maximum
462
 
usable frequency (MUF) is falling and the ionospheric loss at the
463
 
lower frequencies is beginning to decrease.</p>
464
 
 
465
 
<h4>Debugging Aids</h4>
466
 
 
467
 
<p>The most convenient way to track the driver status is using the
468
 
<tt>ntpq</tt> program and the <tt>clockvar</tt> command. This
469
 
displays the last determined timecode and related status and error
470
 
counters, even when the driver is not discipline the system clock.
471
 
If the debugging trace feature (<tt>-d</tt> on the <tt>ntpd</tt>
472
 
command line)is enabled, the driver produces detailed status
473
 
messages as it operates. If the <tt>fudge flag 4</tt> is set, these
474
 
messages are written to the <tt>clockstats</tt> file. All messages
475
 
produced by this driver have the prefix <tt>chu</tt> for convenient
476
 
filtering with the Unix <tt>grep</tt> command.</p>
477
 
 
478
 
<p>In the following descriptions the units of amplitude, phase,
479
 
probability and likelihood are normalized to the range 0-6000 for
480
 
convenience. In addition, the signal/noise ratio (SNR) and
481
 
likelihood ratio are measured in decibels and the words with bit
482
 
fields are in hex. Most messages begin with a leader in the
483
 
following format:</p>
484
 
 
485
 
<p><tt>wwvn ss stat sigl</tt></p>
486
 
 
487
 
<p>where <tt>wwvn</tt> is the message code, <tt>ss</tt> the second
488
 
of minute, <tt>stat</tt> the driver status word and <tt>sigl</tt>
489
 
the second sync pulse amplitude. A full explanation of the status
490
 
bits is contained in the driver source listing; however, the
491
 
following are the most useful for debugging.</p>
492
 
 
493
 
<dl>
494
 
<dt><tt>0x0001</tt></dt>
495
 
 
496
 
<dd>Minute sync. Set when the decoder has identified a station and
497
 
acquired the minute sync pulse.</dd>
498
 
 
499
 
<dt><tt>0x0002</tt></dt>
500
 
 
501
 
<dd>Second sync. Set when the decoder has acquired the second sync
502
 
pulse and within 125 <font face="Symbol">m</font>s of the correct
503
 
phase.</dd>
504
 
 
505
 
<dt><tt>0x0004</tt></dt>
506
 
 
507
 
<dd>Minute unit sync. Set when the decoder has reliably determined
508
 
the unit digit of the minute.</dd>
509
 
 
510
 
<dt><tt>0x0008</tt></dt>
511
 
 
512
 
<dd>Clock set. Set when the decoder has reliably determined all
513
 
nine digits of the timecode and is selectable to discipline the
514
 
system clock.</dd>
515
 
</dl>
516
 
 
517
 
<p>With debugging enabled the driver produces messages in the
518
 
following formats:</p>
519
 
 
520
 
<p>Format <tt>wwv8</tt> messages are produced once per minute by
521
 
the WWV and WWVH station processes before minute sync has been
522
 
acquired. They show the progress of identifying and tracking the
523
 
minute pulse of each station.</p>
524
 
 
525
 
<p><tt>wwv8 port agc ident comp ampl snr epoch jitr offs</tt></p>
526
 
 
527
 
<p>where <tt>port</tt> and <tt>agc</tt> are the audio port and
528
 
gain, respectively. The <tt>ident</tt>encodes the station
529
 
(<tt>C</tt> for WWV, <tt>H</tt> for WWVH) and frequency (2, 5, 10,
530
 
15 and 20). For the encoded frequency, <tt>comp</tt> is the compare
531
 
counter, <tt>ampl</tt> the pulse amplitude, <tt>snr</tt> the SNR,
532
 
<tt>epoch</tt> the sample number of the minute pulse in the minute,
533
 
<tt>jitr</tt> the change since the last <tt>epoch</tt> and <tt>
534
 
offs</tt> the minute pulse offset relative to the second pulse. An
535
 
example is:</p>
536
 
 
537
 
<p><tt>wwv8 2 127 C15 2 9247 30.0 18843 -1 1</tt><br>
538
 
<tt>wwv8 2 127 H15 0 134 -2.9 19016 193 174</tt></p>
539
 
 
540
 
<p>Here the radio is tuned to 15 MHz and the line-in port AGC is
541
 
currently 127 at that frequency. The driver has not yet acquired
542
 
minute sync, WWV has been heard for at least two minutes, and WWVH
543
 
is in the noise. The WWV minute pulse amplitude and SNR are well
544
 
above the threshold (2000 and 6 dB, respectively) and the minute
545
 
epoch has been determined -1 sample relative to the last one and 1
546
 
sample relative to the second sync pulse. The compare counter has
547
 
incrmented to two; when it gets to three, minute sync has been
548
 
acquired.</p>
549
 
 
550
 
<p>Format <tt>wwv3</tt> messages are produced after minute sync has
551
 
been acquired and until the seconds unit digit is determined. They
552
 
show the results of decoding each bit of the transmitted
553
 
timecode.</p>
554
 
 
555
 
<p><tt>wwv3 ss stat sigl ampl phas snr prob like</tt></p>
556
 
 
557
 
<p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above,
558
 
<tt>ampl</tt> is the subcarrier amplitude, <tt>phas</tt> the
559
 
subcarrier phase, <tt>snr</tt> the subcarrier SNR, <tt>prob</tt>
560
 
the bit probability and <tt>like</tt> the bit likelihood. An
561
 
example is:</p>
562
 
 
563
 
<p><tt>wwv3 28 0123 4122 4286 0 24.8 -5545 -1735</tt></p>
564
 
 
565
 
<p>Here the driver has acquired minute and second sync, but has not
566
 
yet determined the seconds unit digit. However, it has just decoded
567
 
bit 28 of the minute. The results show the second sync pulse
568
 
amplitude well over the threshold (500), subcarrier amplitude well
569
 
above the threshold (1000), good subcarrier tracking phase and SNR
570
 
well above the threshold (10 dB). The bit is almost certainly a
571
 
zero and the likelihood of a zero in this second is very high.</p>
572
 
 
573
 
<p>Format <tt>wwv4</tt> messages are produced for each of the nine
574
 
BCD timecode digits until the clock has been set or verified. They
575
 
show the results of decoding each digit of the transmitted
576
 
timecode.</p>
577
 
 
578
 
<p><tt>wwv4 ss stat sigl radx ckdig mldig diff cnt like
579
 
snr</tt></p>
580
 
 
581
 
<p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above,
582
 
<tt>radx</tt> is the digit radix (3, 4, 6, 10), <tt>ckdig</tt> the
583
 
current clock digit, <tt>mldig</tt> the maximum likelihood digit,
584
 
<tt>diff</tt> the difference between these two digits modulo the
585
 
radix, <tt>cnt</tt> the compare counter, <tt>like</tt> the digit
586
 
likelihood and <tt>snr</tt> the likelihood ratio. An example
587
 
is:</p>
588
 
 
589
 
<p><tt>wwv4 8 010f 5772 10 9 9 0 6 4615 6.1</tt></p>
590
 
 
591
 
<p>Here the driver has previousl set or verified the clock. It has
592
 
just decoded the digit preceding second 8 of the minute. The digit
593
 
radix is 10, the current clock and maximum likelihood digits are
594
 
both 9, the likelihood is well above the threshold (1000) and the
595
 
likelihood function well above threshold (3.0 dB). Short of a
596
 
hugely unlikely probability conspiracy, the clock digit is most
597
 
certainly a 9.</p>
598
 
 
599
 
<p>Format <tt>wwv2</tt> messages are produced at each master
600
 
oscillator frequency update, which starts at 8 s, but eventually
601
 
climbs to 1024 s. They show the progress of the algorithm as it
602
 
refines the frequency measurement to a precision of 0.1 PPM.</p>
603
 
 
604
 
<p><tt>wwv2 ss stat sigl avint avcnt avinc jitr delt freq</tt></p>
605
 
 
606
 
<p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above,
607
 
<tt>avint</tt> is the averaging interval, <tt>avcnt</tt> the
608
 
averaging interval counter, <tt>avinc</tt> the interval increment,
609
 
<tt>jitr</tt> the sample change between the beginning and end of
610
 
the interval, <tt>delt</tt> the computed frequency change and <tt>
611
 
freq</tt> the current frequency (PPM). An example is:</p>
612
 
 
613
 
<p><tt>wwv2 22 030f 5795 256 256 4 0 0.0 66.7</tt></p>
614
 
 
615
 
<p>Here the driver has acquired minute and second sync and set the
616
 
clock. The averaging interval has increased to 256 s on the way to
617
 
1024 s, has stayed at that interval for 4 averaging intervals, has
618
 
measured no change in frequency and the current frequency is 66.7
619
 
PPM.</p>
620
 
 
621
 
<p>If the CI-V interface for ICOM radios is active, a debug level
622
 
greater than 1 will produce a trace of the CI-V command and
623
 
response messages. Interpretation of these messages requires
624
 
knowledge of the CI-V protocol, which is beyond the scope of this
625
 
document.</p>
626
 
 
627
 
<h4>Monitor Data</h4>
628
 
 
629
 
When enabled by the <tt>filegen</tt> facility, every received
630
 
timecode is written to the <tt>clockstats</tt> file in the
631
 
following format: 
632
 
 
633
 
<pre>
634
 
        sq yy ddd hh:mm:ss.fff ld du lset agc stn rfrq errs freq cons
635
 
 
636
 
        s       sync indicator
637
 
        q       quality character
638
 
        yyyy    Gregorian year
639
 
        ddd     day of year
640
 
        hh      hour of day
641
 
        mm      minute of hour
642
 
        fff     millisecond of second
643
 
        l       leap second warning
644
 
        d       DST state
645
 
        dut     DUT sign and magnitude
646
 
        lset    minutes since last set
647
 
        agc     audio gain
648
 
        ident   station identifier and frequency
649
 
        comp    minute sync compare counter
650
 
        errs    bit error counter
651
 
        freq    frequency offset
652
 
        avgt    averaging time
653
 
</pre>
654
 
 
655
 
The fields beginning with <tt>year</tt> and extending through <tt>
656
 
dut</tt> are decoded from the received data and are in fixed-length
657
 
format. The <tt>agc</tt> and <tt>lset</tt> fields, as well as the
658
 
following driver-dependent fields, are in variable-length format. 
659
 
 
660
 
<dl>
661
 
<dt><tt>s</tt></dt>
662
 
 
663
 
<dd>The sync indicator is initially <tt>?</tt> before the clock is
664
 
set, but turns to space when all nine digits of the timecode are
665
 
correctly set.</dd>
666
 
 
667
 
<dt><tt>q</tt></dt>
668
 
 
669
 
<dd>The quality character is a four-bit hexadecimal code showing
670
 
which alarms have been raised. Each bit is associated with a
671
 
specific alarm condition according to the following: 
672
 
 
673
 
<dl>
674
 
<dt><tt>0x8</tt></dt>
675
 
 
676
 
<dd>Sync alarm. The decoder may not be in correct second or minute
677
 
phase relative to the transmitter.</dd>
678
 
 
679
 
<dt><tt>0x4</tt></dt>
680
 
 
681
 
<dd>Error alarm. More than 30 data bit errors occurred in the last
682
 
minute.</dd>
683
 
 
684
 
<dt><tt>0x2</tt></dt>
685
 
 
686
 
<dd>Symbol alarm. The probability of correct decoding for a digit
687
 
or miscellaneous bit has fallen below the threshold.</dd>
688
 
 
689
 
<dt><tt>0x1</tt></dt>
690
 
 
691
 
<dd>Decoding alarm. A maximum likelihood digit fails to agree with
692
 
the current associated clock digit.</dd>
693
 
</dl>
694
 
 
695
 
It is important to note that one or more of the above alarms does
696
 
not necessarily indicate a clock error, but only that the decoder
697
 
has detected a condition that may in future result in an
698
 
error.</dd>
699
 
 
700
 
<dt><tt>yyyy ddd hh:mm:ss.fff</tt></dt>
701
 
 
702
 
<dd>The timecode format itself is self explanatory. Since the
703
 
driver latches the on-time epoch directly from the second sync
704
 
pulse, the fraction <tt>fff</tt>is always zero. Although the
705
 
transmitted timecode includes only the year of century, the
706
 
Gregorian year is augmented 2000 if the indicated year is less than
707
 
72 and 1900 otherwise.</dd>
708
 
 
709
 
<dt><tt>l</tt></dt>
710
 
 
711
 
<dd>The leap second warning is normally space, but changes to <tt>
712
 
L</tt> if a leap second is to occur at the end of the month of June
713
 
or December.</dd>
714
 
 
715
 
<dt><tt>d</tt></dt>
716
 
 
717
 
<dd>The DST state is <tt>S</tt> or <tt>D</tt> when standard time or
718
 
daylight time is in effect, respectively. The state is <tt>I</tt>
719
 
or <tt>O</tt> when daylight time is about to go into effect or out
720
 
of effect, respectively.</dd>
721
 
 
722
 
<dt><tt>dut</tt></dt>
723
 
 
724
 
<dd>The DUT sign and magnitude shows the current UT1 offset
725
 
relative to the displayed UTC time, in deciseconds.</dd>
726
 
 
727
 
<dt><tt>lset</tt></dt>
728
 
 
729
 
<dd>Before the clock is set, the interval since last set is the
730
 
number of minutes since the driver was started; after the clock is
731
 
set, this is number of minutes since the time was last verified
732
 
relative to the broadcast signal.</dd>
733
 
 
734
 
<dt><tt>agc</tt></dt>
735
 
 
736
 
<dd>The audio gain shows the current codec gain setting in the
737
 
range 0 to 255. Ordinarily, the receiver audio gain control or IRIG
738
 
level control should be set for a value midway in this range.</dd>
739
 
 
740
 
<dt><tt>ident</tt></dt>
741
 
 
742
 
<dd>The station identifier shows the station, <tt>C</tt> for WWV or
743
 
<tt>H</tt> for WWVH, and frequency being tracked. If neither
744
 
station is heard on any frequency, the station identifier shows
745
 
<tt>X</tt>.</dd>
746
 
 
747
 
<dt><tt>comp</tt></dt>
748
 
 
749
 
<dd>The minute sync compare counter is useful to determine the
750
 
quality of the minute sync signal and can range from 0 (no signal)
751
 
to 5 (best).</dd>
752
 
 
753
 
<dt><tt>errs</tt></dt>
754
 
 
755
 
<dd>The bit error counter is useful to determine the quality of the
756
 
data signal received in the most recent minute. It is normal to
757
 
drop a couple of data bits under good signal conditions and
758
 
increasing numbers as conditions worsen. While the decoder performs
759
 
moderately well even with half the bits are in error in any minute,
760
 
usually by that point the sync signals are lost and the decoder
761
 
reverts to free-run anyway.</dd>
762
 
 
763
 
<dt><tt>freq</tt></dt>
764
 
 
765
 
<dd>The frequency offset is the current estimate of the codec
766
 
frequency offset to within 0.1 PPM. This may wander a bit over the
767
 
day due to local temperature fluctuations and propagation
768
 
conditions.</dd>
769
 
 
770
 
<dt><tt>avgt</tt></dt>
771
 
 
772
 
<dd>The averaging time is the interval between frequency updates in
773
 
powers of two to a maximum of 1024 s. Attainment of the maximum
774
 
indicates the driver is operating at the best possible resolution
775
 
in time and frequency.</dd>
776
 
</dl>
777
 
 
778
 
<p>An example timecode is:</p>
779
 
 
780
 
<p><tt>0 2000 006 22:36:00.000 S +3 1 115 C20 6 5 66.4
781
 
1024</tt></p>
782
 
 
783
 
<p>Here the clock has been set and no alarms are raised. The year,
784
 
day and time are displayed along with no leap warning, standard
785
 
time and DUT +0.3 s. The clock was set on the last minute, the AGC
786
 
is safely in the middle ot the range 0-255, and the receiver is
787
 
tracking WWV on 20 MHz. Excellent reeiving conditions prevail, as
788
 
indicated by the compare count 6 and 5 bit errors during the last
789
 
minute. The current frequency is 66.4 PPM and the averaging
790
 
interval is 1024 s, indicating the maximum precision available.</p>
791
 
 
792
 
<h4>Modes</h4>
793
 
 
794
 
<p>The <tt>mode</tt> keyword of the <tt>server</tt> configuration
795
 
command specifies the ICOM ID select code. A missing or zero
796
 
argument disables the CI-V interface. Following are the ID select
797
 
codes for the known radios.</p>
798
 
 
799
 
<table cols="6" width="100%">
800
 
<tr>
801
 
<td>Radio</td>
802
 
<td>Hex</td>
803
 
<td>Decimal</td>
804
 
<td>Radio</td>
805
 
<td>Hex</td>
806
 
<td>Decimal</td>
807
 
</tr>
808
 
 
809
 
<tr>
810
 
<td>IC725</td>
811
 
<td>0x28</td>
812
 
<td>40</td>
813
 
<td>IC781</td>
814
 
<td>0x26</td>
815
 
<td>38</td>
816
 
</tr>
817
 
 
818
 
<tr>
819
 
<td>IC726</td>
820
 
<td>0x30</td>
821
 
<td>48</td>
822
 
<td>R7000</td>
823
 
<td>0x08</td>
824
 
<td>8</td>
825
 
</tr>
826
 
 
827
 
<tr>
828
 
<td>IC735</td>
829
 
<td>0x04</td>
830
 
<td>4</td>
831
 
<td>R71</td>
832
 
<td>0x1A</td>
833
 
<td>26</td>
834
 
</tr>
835
 
 
836
 
<tr>
837
 
<td>IC751</td>
838
 
<td>0x1c</td>
839
 
<td>28</td>
840
 
<td>R7100</td>
841
 
<td>0x34</td>
842
 
<td>52</td>
843
 
</tr>
844
 
 
845
 
<tr>
846
 
<td>IC761</td>
847
 
<td>0x1e</td>
848
 
<td>30</td>
849
 
<td>R72</td>
850
 
<td>0x32</td>
851
 
<td>50</td>
852
 
</tr>
853
 
 
854
 
<tr>
855
 
<td>IC765</td>
856
 
<td>0x2c</td>
857
 
<td>44</td>
858
 
<td>R8500</td>
859
 
<td>0x4a</td>
860
 
<td>74</td>
861
 
</tr>
862
 
 
863
 
<tr>
864
 
<td>IC775</td>
865
 
<td>0x46</td>
866
 
<td>68</td>
867
 
<td>R9000</td>
868
 
<td>0x2a</td>
869
 
<td>42</td>
870
 
</tr>
871
 
</table>
872
 
 
873
 
<h4>Fudge Factors</h4>
874
 
 
875
 
<dl>
876
 
<dt><tt>time1 <i>time</i></tt></dt>
877
 
 
878
 
<dd>Specifies the propagation delay for WWV (40:40:49.0N
879
 
105:02:27.0W), in seconds and fraction, with default 0.0.</dd>
880
 
 
881
 
<dt><tt>time2 <i>time</i></tt></dt>
882
 
 
883
 
<dd>Specifies the propagation delay for WWVH (21:59:26.0N
884
 
159:46:00.0W), in seconds and fraction, with default 0.0.</dd>
885
 
 
886
 
<dt><tt>stratum <i>number</i></tt></dt>
887
 
 
888
 
<dd>Specifies the driver stratum, in decimal from 0 to 15, with
889
 
default 0.</dd>
890
 
 
891
 
<dt><tt>refid <i>string</i></tt></dt>
892
 
 
893
 
<dd>Ordinarily, this field specifies the driver reference
894
 
identifier; however, the driver sets the reference identifier
895
 
automatically as described above.</dd>
896
 
 
897
 
<dt><tt>flag1 0 | 1</tt></dt>
898
 
 
899
 
<dd>Not used by this driver.</dd>
900
 
 
901
 
<dt><tt>flag2 0 | 1</tt></dt>
902
 
 
903
 
<dd>Specifies the microphone port if set to zero or the line-in
904
 
port if set to one. It does not seem useful to specify the compact
905
 
disc player port.</dd>
906
 
 
907
 
<dt><tt>flag3 0 | 1</tt></dt>
908
 
 
909
 
<dd>Enables audio monitoring of the input signal. For this purpose,
910
 
the speaker volume must be set before the driver is started.</dd>
911
 
 
912
 
<dt><tt>flag4 0 | 1</tt></dt>
913
 
 
914
 
<dd>Enable verbose <tt>clockstats</tt> recording if set.</dd>
915
 
</dl>
916
 
 
917
 
<h4>Additional Information</h4>
918
 
 
919
 
<a href="refclock.htm">Reference Clock Drivers</a> <br>
920
 
<a href="audio.htm">Reference Clock Audio Drivers</a> 
921
 
 
922
 
<hr>
923
 
<a href="index.htm"><img align="left" src="pic/home.gif" alt=
924
 
"gif"></a> 
925
 
 
926
 
<address><a href="mailto:mills@udel.edu">David L. Mills
927
 
&lt;mills@udel.edu&gt;</a></address>
928
 
</body>
929
 
</html>
930