freebsd-nq/contrib/ntp/html/drivers/driver36.html
2004-07-20 15:01:56 +00:00

263 lines
41 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>Radio WWV/H Audio Demodulator/Decoder</title>
<link href="../scripts/style.css" type="text/css" rel="stylesheet">
</head>
<body>
<h3>Radio WWV/H Audio Demodulator/Decoder</h3>
<h4>Related Links</h4>
<script type="text/javascript" language="javascript" src="../scripts/links8.txt"></script>
<hr>
<h4>Synopsis</h4>
Address: 127.127.36.<i>u</i><br>
Reference ID: <tt>NONE</tt>, <tt>WV<i>f</i></tt> or <tt>WH<i>f</i></tt><br>
Driver ID: <tt>WWV_AUDIO</tt><br>
Autotune Port: <tt>/dev/icom</tt>; 1200/9600 baud, 8-bits, no parity<br>
Audio Device: <tt>/dev/audio</tt> and <tt>/dev/audioctl</tt>
<h4>Description</h4>
This driver synchronizes the computer time using data encoded in shortwave radio transmissions from NIST time/frequency stations <a href="http://www.bldrdoc.gov/timefreq/stations/wwv.html">WWV</a> in Ft. Collins, CO, and <a href="http://www.bldrdoc.gov/timefreq/stations/wwvh.htm">WWVH</a> in Kauai, HI. Transmissions are made continuously on 2.5, 5, 10 and 15 MHz from both stations and on 20 MHz from WWV. An ordinary shortwave receiver can be tuned manually to one of these frequencies or, in the case of ICOM receivers, the receiver can be tuned automatically by the driver as propagation conditions change throughout the day and night. The performance of this driver when tracking one of the stations is ordinarily better than 1 ms in time with frequency drift less than 0.5 PPM when not tracking either station.
<p>The demodulation and decoding algorithms used by this driver are based on a machine language program developed for the TAPR DSP93 DSP unit, which uses the TI 320C25 DSP chip. The analysis, design and performance of the program running on this unit is described in: Mills, D.L. A precision radio clock for WWV transmissions. Electrical Engineering Report 97-8-1, University of Delaware, August 1997, 25 pp. Available from <a href="http://www.eecis.udel.edu/%7emills/reports.html">www.eecis.udel.edu/~mills/reports.htm</a>. For use in this driver, the original program was rebuilt in the C language and adapted to the NTP driver interface. The algorithms have been modified somewhat to improve performance under weak signal conditions and to provide an automatic station identification feature.</p>
<p>This driver incorporates several features in common with other audio drivers such as described in the <a href="driver7.html">Radio CHU Audio Demodulator/Decoder</a> and the <a href="driver6.html">IRIG Audio Decoder</a> pages. They include automatic gain control (AGC), selectable audio codec port and signal monitoring capabilities. For a discussion of these common features, as well as a guide to hookup, debugging and monitoring, see the <a href="../audio.html">Reference Clock Audio Drivers</a> page.</p>
<p>The WWV signal format is described in NIST Special Publication 432 (Revised 1990). It consists of three elements, a 5-ms, 1000-Hz pulse, which occurs at the beginning of each second, a 800-ms, 1000-Hz pulse, which occurs at the beginning of each minute, and a pulse-width modulated 100-Hz subcarrier for the data bits, one bit per second. The WWVH format is identical, except that the 1000-Hz pulses are sent at 1200 Hz. Each minute encodes nine BCD digits for the time of century plus seven bits for the daylight savings time (DST) indicator, leap warning indicator and DUT1 correction.</p>
<h4>Program Architecture</h4>
<p>As in the original program, the clock discipline is modelled as a Markov process, with probabilistic state transitions corresponding to a conventional clock and the probabilities of received decimal digits. The result is a performance level which results in very high accuracy and reliability, even under conditions when the minute beep of the signal, normally its most prominent feature, can barely be detected by ear with a communications receiver.</p>
<p>The analog audio signal from the shortwave radio is sampled at 8000 Hz and converted to digital representation. The 1000/1200-Hz pulses and 100-Hz subcarrier are first separated using two IIR filters, a 600-Hz bandpass filter centered on 1100 Hz and a 150-Hz lowpass filter. The minute sync pulse is extracted using a 800-ms synchronous matched filter and pulse grooming logic which discriminates between WWV and WWVH signals and noise. The second sync pulse is extracted using a 5-ms FIR matched filter and 8000-stage comb filter.</p>
<p>The phase of the 100-Hz subcarrier relative to the second sync pulse is fixed at the transmitter; however, the audio stage in many radios affects the phase response at 100 Hz in unpredictable ways. The driver adjusts for each radio using two 170-ms synchronous matched filters. The I (in-phase) filter is used to demodulate the subcarrier envelope, while the Q (quadrature-phase) filter is used in a tracking loop to discipline the codec sample clock and thus the demodulator phase.</p>
<p>The data bit probabilities are determined from the subcarrier envelope using a threshold-corrected slicer. The averaged envelope amplitude 30 ms from the beginning of the second establishes the minimum (noise floor) value, while the amplitude 200 ms from the beginning establishes the maximum (signal peak) value. The slice level is midway between these two values. The negative-going envelope transition at the slice level establishes the length of the data pulse, which in turn establish probabilities for binary zero (P0) and binary one (P1). The data values are established by linear interpolation between the pulse lengths for P0 (-1) and P1 (+1). If the driver has not synchronized to the minute pulse, or if the data bit amplitude, signal/noise ratio (SNR) or length are below thresholds, the bit is considered invalid and the data value is ignored.</p>
<p>The difference between the P1 and P0 data values, or likelihood, for each data bit is exponentially averaged in a set of 60 accumulators, one for each second, to determine the semi-static miscellaneous bits, such as DST indicator, leap second warning and DUT1 correction. In this design a data average value larger than a positive threshold is interpreted as +1 (hit) and a value smaller than a negative threshold as a -1 (miss). Values between the two thresholds, which can occur due to signal fades or loss of signal, are interpreted as an erasure and result in no change of indication.</p>
<p>The BCD digit in each digit position of the timecode is represented as four data bits, all of which must be valid for the digit itself to be considered valid. If so, the bits are correlated with the bits corresponding to each of the valid decimal digits in this position. If the digit is invalid, the correlated value for all digits in this position is assumed zero. In either case, the values for all digits are exponentially averaged in a likelihood vector associated with this position. The digit associated with the maximum over all averaged values then becomes the maximum likelihood selection for this position and the ratio of the maximum over the next lower value becomes the likelihood ratio.</p>
<p>The decoding matrix contains nine row vectors, one for each digit position. Each row vector includes the maximum likelihood digit, likelihood vector and other related data. The maximum likelihood digit for each of the nine digit positions becomes the maximum likelihood time of the century. A built-in transition function implements a conventional clock with decimal digits that count the minutes, hours, days and years, as corrected for leap seconds and leap years. The counting operation also rotates the likelihood vector corresponding to each digit as it advances. Thus, once the clock is set, each clock digit should correspond to the maximum likelihood digit as transmitted.</p>
<p>Each row of the decoding matrix also includes a compare counter and the difference (modulo the radix) between the current clock digit and most recently determined maximum likelihood digit. If a digit likelihood exceeds the decision level and the difference is constant for a number of successive minutes in any row, the maximum likelihood digit replaces the clock digit in that row. When this condition is true for all rows and the second epoch has been reliably determined, the clock is set (or verified if it has already been set) and delivers correct time to the integral second. The fraction within the second is derived from the logical master clock, which runs at 8000 Hz and drives all system timing functions.</p>
<p>The logical master clock is derived from the audio codec clock. Its frequency is disciplined by a frequency-lock loop (FLL) which operates independently of the data recovery functions. At averaging intervals determined by the measured jitter, the frequency error is calculated as the difference between the most recent and the current second epoch divided by the interval. The sample clock frequency is then corrected by this amount. When first started, the frequency averaging interval is eight seconds, in order to compensate for intrinsic codec clock frequency offsets up to 125 PPM. Under most conditions, the averaging interval doubles in stages from the initial value to over 1000 seconds, which results in an ultimate frequency precision of 0.125 PPM, or about 11 ms/day.</p>
<p>It is important that the logical clock frequency is stable and accurately determined, since in most applications the shortwave radio will be tuned to a fixed frequency where WWV or WWVH signals are not available throughout the day. In addition, in some parts of the US, especially on the west coast, signals from either or both WWV and WWVH may be available at different times or even at the same time. Since the propagation times from either station are almost always different, each station must be reliably identified before attempting to set the clock.</p>
<p>Station identification uses the 800-ms minute pulse transmitted by each station. In the acquisition phase the entire minute is searched using both the WWV and WWVH matched filters and a pulse gate discriminator similar to that found in radar acquisition and tracking receivers. The peak amplitude found determines a range gate and window where the next pulse is expected to be found. The minute is scanned again to verify the peak is indeed in the window and with acceptable amplitude, SNR and jitter. At this point the receiver begins to track the second sync pulse and operate as above until the clock is set. Once the minute is synchronized, the range gate is fixed and only energy within the window is considered for the minute sync pulse.</p>
<p>It is very important to be able to reliably discriminate between very weak signals in noise and noise alone. The driver very aggresively soaks up every scrap of signal information, but has to be careful to avoid making pseudo-sense of noise alone. The signal quality metric depends on the minute pulse amplitude and SNR together with the data subcarrier amplitude and SNR. If all four values are above defined thresholds a hit is declared, otherwise a miss. The number of hits declared in the last six intervals is the high order bits of the metric value, while the current minute sync pulse amplitude is the low order bits. The metric value is represented on a scale from zero to 100. This is used as a quality indicator and reported in the timecode and also for the autotune function described below.</p>
<h4>Performance</h4>
<p>It is the intent of the design that the accuracy and stability of the indicated time be limited only by the characteristics of the ionospheric propagation medium. Conventional wisdom is that synchronization via the HF medium is good only to a millisecond under the best propagation conditions. The performance of the NTP daemon disciplined by the driver is clearly better than this, even under marginal conditions. Ordinarily, with marginal to good signals and a frequency averaging interval of 1024 s, the frequency is stabilized within 0.1 PPM and the time within 125 <font face="Symbol">m</font>s. The frequency stability characteristic is highly important, since the clock may have to free-run for several hours before reacquiring the WWV/H signal.</p>
<p>The expected accuracy over a typical day was determined using the DSP93 and an oscilloscope and cesium oscillator calibrated with a GPS receiver. With marginal signals and allowing 15 minutes for initial synchronization and frequency compensation, the time accuracy determined from the WWV/H second sync pulse was reliably within 125 <font face="Symbol">m</font>s. In the particular DSP-93 used for program development, the uncorrected CPU clock frequency offset was 45.8&plusmn;0.1 PPM. Over the first hour after initial synchronization, the clock frequency drifted about 1 PPM as the frequency averaging interval increased to the maximum 1024 s. Once reaching the maximum, the frequency wandered over the day up to 1 PPM, but it is not clear whether this is due to the stability of the DSP-93 clock oscillator or the changing height of the ionosphere. Once the frequency had stabilized and after loss of the WWV/H signal, the frequency drift was less than 0.5 PPM, which is equivalent to 1.8 ms/h or 43 ms/d. This resulted in a step phase correction up to several milliseconds when the signal returned.</p>
<p>The measured propagation delay from the WWV transmitter at Boulder, CO, to the receiver at Newark, DE, is 23.5&plusmn;0.1 ms. This is measured to the peak of the pulse after the second sync comb filter and includes components due to the ionospheric propagation delay, nominally 8.9 ms, communications receiver delay and program delay. The propagation delay can be expected to change about 0.2 ms over the day, as the result of changing ionosphere height. The DSP93 program delay was measured at 5.5 ms, most of which is due to the 400-Hz bandpass filter and 5-ms matched filter. Similar delays can be expected of this driver.</p>
<h4>Program Operation</h4>
The driver begins operation immediately upon startup. It first searches for one or both of the stations WWV and WWVH and attempts to acquire minute sync. This may take some fits and starts, as the driver expects to see three consecutive minutes with good signals and low jitter. If the autotune function is active, the driver will rotate over all five frequencies and both WWV and WWVH stations until three good minutes are found.
<p>When a minute sync candidate has been found, the driver acquires second sync, which can take up to several minutes, depending on signal quality. At the same time the driver accumulates likelihood values for each of the nine digits of the clock, plus the seven miscellaneous bits included in the WWV/H transmission format. When five repetitions of all nine digits have decoded correctly, which normally takes 15 minutes with good signals and up to an hour when buried in noise, and the second sync alarm has not been raised for two minutes, the clock is set (or verified) and is selectable to discipline the system clock.</p>
<p>As long as the clock is set or verified, the system clock offsets are provided once each second to the reference clock interface, where they are saved in a buffer. At the end of each minute the buffer samples are groomed by the median filter and trimmed-mean averaging functions. Using these functions, the system clock can in principle be disciplined to a much finer resolution than the 125-<font face="Symbol">m</font>s sample interval would suggest, although the ultimate accuracy is probably limited by propagation delay variations as the ionspheric height varies throughout the day and night.</p>
<p>The codec clock frequency is disciplined during times when WWV/H signals are available. The algorithm refines the frequency offset using increasingly longer averaging intervals to 1024 s, where the precision is about 0.1 PPM. With good signals, it takes well over two hours to reach this degree of precision; however, it can take many more hours than this in case of marginal signals. Once reaching the limit, the algorithm will follow frequency variations due to temperature fluctuations and ionospheric height variations.</p>
<p>It may happen as the hours progress around the clock that WWV and WWVH signals may appear alone, together or not at all. When the driver is first started, the NTP reference identifier appears as <tt>NONE</tt>. When the driver has mitigated which station and frequency is best, it sets the reference identifier to the string WV<i>f</i> for WWV and WH<i>f</i> for WWVH, where <i>f</i> is the frequency in megahertz. If the propagation delays have been properly set with the <tt>fudge time1</tt> (WWV) and <tt>fudge time2</tt> (WWVH) commands in the configuration file, handover from one station to the other is seamless.</p>
<p>Once the clock has been set for the first time, it will appear reachable and selectable to discipline the system clock, even if the broadcast signal fades to obscurity. A consequence of this design is that, once the clock is set, the time and frequency are disciplined only by the second sync pulse and the clock digits themselves are driven by the clock state machine. If for some reason the state machine drifts to the wrong second, it would never reresynchronize. To protect against this most unlikely situation, if after two days with no signals, the clock is considered unset and resumes the synchronization procedure from the beginning.</p>
<p>However, as long as the clock has once been set correctly and allowed to converge on the intrinsic codec clock frequency, it will continue to read correctly after a period of signal loss. Assuming the clock frequency can be disciplined within 1 PPM, it can coast without signals for several days without exceeding that NTP step threshold of 128 ms. During such periods the root dispersion increases at 5 <font face="Symbol">m</font>s per second, which makes the driver appears less likely for selection as time goes on. Eventually, when the dispersion due all causes exceeds 1 s, it is no longer suitable for synchronization at all.</p>
<p>To work well, the driver needs a shortwave receiver with good audio response at 100 Hz. Most shortwave and communications receivers roll off the audio response below 250 Hz, so this can be a problem, especially with receivers using DSP technology, since DSP filters can have very fast rolloff outside the passband. Some DSP transceivers, in particular the ICOM 775, have a programmable low frequency cutoff which can be set as low as 80 Hz. However, this particular radio has a strong low frequency buzz at about 10 Hz which appears in the audio output and can affect data recovery under marginal conditions. Although not tested, it would seem very likely that a cheap shortwave receiver could function just as well as an expensive communications receiver.</p>
<h4>Autotune</h4>
<p>The driver includes provisions to automatically tune the radio in response to changing radio propagation conditions throughout the day and night. The radio interface is compatible with the ICOM CI-V standard, which is a bidirectional serial bus operating at TTL levels. The bus can be connected to a serial port using a level converter such as the CT-17.</p>
<p>Each ICOM radio is assigned a unique 8-bit ID select code, usually expressed in hex format. To activate the CI-V interface, the <tt>mode</tt> keyword of the <tt>server</tt> configuration command specifies a nonzero select code in decimal format. A table of ID select codes for the known ICOM radios is given below. Since all ICOM select codes are less than 128, the high order bit of the code is used by the driver to specify the baud rate. If this bit is not set, the rate is 9600 bps for the newer radios; if set, the rate is 1200 bps for the older radios. A missing <tt>mode</tt> keyword or a zero argument leaves the interface disabled.</p>
<p>If specified, the driver will attempt to open the device <tt>/dev/icom</tt> and, if successful will activate the autotune function and tune the radio to each operating frequency in turn while attempting to acquire minute sync from either WWV or WWVH. However, the driver is liberal in what it assumes of the configuration. If the <tt>/dev/icom</tt> link is not present or the open fails or the CI-V bus or radio is inoperative, the driver quietly gives up with no harm done.</p>
<p>Once acquiring minute sync, the driver operates as described above to set the clock. However, during seconds 59, 0 and 1 of each minute it tunes the radio to one of the five broadcast frequencies to measure the sync pulse and data pulse amplitudes and SNR and update the signal metric. Each of the five frequencies are probed in a five-minute rotation to build a database of current propagation conditions for all signals that can be heard at the time. At the end of each probe a mitigation procedure scans the database and retunes the radio to the best frequency and station found. For this to work well, the radio should be set for a fast AGC recovery time. This is most important while tracking a strong signal, which is normally the case, and then probing another frequency, which may have much weaker signals.</p>
<p>Reception conditions for each frequency and station are evaluated according to the signal metric, which uses the minute sync pulse amplitude and SNR and data subcarrier amplitude and SNR. The minute pulse is evaluated at second 0, while the data pulse is evaluated at second 1. In principle, the data pulse in second 58 is usable, but the AGC in most radios is not fast enough for a reliable measurement.</p>
<p>The results are summarized in a scoreboard which drives the mitigation function.</p>
<dl>
<dt><tt>0x0001</tt>
<dd>Minute pulse error. For the minute sync pulse in second 0, either the amplitude or SNR is below threshold (2000 and 20 dB, respectively).
<dt><tt>0x0002</tt>
<dd>Data pulse error. For the data pulse in second 1, either the amplitude or SNR is below threshold (1000 and 10 dB, respectively).
<dt><tt>0x0004</tt>
<dd>Probe pulse error. Two or more decoding errors have occurred for the data pulses in seconds 58, 59 and 1.
</dl>
<p>If none of the scoreboard bits are set, a hit is declared, otherwise a miss. At the end of each probe, the frequency and station with the maximum metric is chosen, with ties going first to the highest frequency and then to WWV in order. During the acquisition phase a station is considered valid only if the metric is above 13; after the clock is synchronized a station is valid only if the metric is above 50. If no stations are valid, the driver ignores all signals and sets the reference ID field to NONE.</p>
<h4>Diagnostics</h4>
<p>The autotune process produces diagnostic information along with the timecode. This is very useful for evaluating the performance of the algorithms, as well as radio propagation conditions in general. The message is produced once each minute for each frequency in turn after minute sync has been acquired.</p>
<p><tt>wwv5 port status agc epoch count wwv wwvh</tt></p>
<p>where <tt>port</tt> and <tt>agc</tt> are the audio port and gain, respectively, for this frequency and <tt>wwv</tt> and <tt>wwvh</tt> are two sets of fields, one each for WWV and WWVH. Each of the two fields has the format</p>
<p><tt>ident score metric sync/snr</tt></p>
<p>where <tt>ident </tt>encodes the station (<tt>C</tt> for WWV, <tt>H</tt> for WWVH) and frequency (2, 5, 10, 15 or 20), <tt>score</tt> is a 32-bit shift register recording the hits (1) and misses (0) of the last 32 probes (hits and misses enter from the right), <tt>metric</tt> is as described above, <tt>sync</tt> is the minute sync pulse amplitude and <tt>snr</tt> is the SNR. An example is:</p>
<p><tt>wwv5 2 110d 111 5753 2 WV20 bdeff 100 8348/30.0/-3 WH20 0000 1 22/-12.4</tt></p>
<p>Here the radio is tuned to 20 MHz and the line-in port AGC is currently 111 at that frequency. The message contains a report for WWV (<tt>WV20</tt>) and WWVH (<tt>WH20</tt>). The WWV report <tt>score</tt> is <tt>bdeff</tt> and the metric is 100, which suggests very good reception conditions, and the minute sync amplitude and SNR are well above thresholds (2000 and 20 dB, respectively). While the message shows solid reception conditions from WWV, this is not the case for WWVH. Both the minute sync amplitude and SNR are below thresholds and the station has not been heard during the last 160 minutes.</p>
<h4>Debugging Aids</h4>
<p>The most convenient way to track the driver status is using the <tt>ntpq</tt> program and the <tt>clockvar</tt> command. This displays the last determined timecode and related status and error counters, even when the driver is not disciplining the system clock. If the debugging trace feature (<tt>-d</tt> on the <tt>ntpd</tt> command line)is enabled, the driver produces detailed status messages as it operates. If the <tt>fudge flag 4</tt> is set, these messages are written to the <tt>clockstats</tt> file. All messages produced by this driver have the prefix <tt>wwv</tt> for convenient filtering with the Unix <tt>grep</tt> command.</p>
<p>In the following descriptions the units of amplitude, phase, probability and likelihood are normalized to the range 0-6000 for convenience. In addition, the signal/noise ratio (SNR) and likelihood ratio are measured in decibels and the words with bit fields are in hex. Most messages begin with a leader in the following format:</p>
<p><tt>wwvn ss stat sigl</tt></p>
<p>where <tt>wwvn</tt> is the message code, <tt>ss</tt> the second of minute, <tt>stat</tt> the driver status word and <tt>sigl</tt> the second sync pulse amplitude. A full explanation of the status bits is contained in the driver source listing; however, the following are the most useful for debugging.</p>
<dl>
<dt><tt>0x0001</tt>
<dd>Minute sync. Set when the decoder has identified a station and acquired the minute sync pulse.
<dt><tt>0x0002</tt>
<dd>Second sync. Set when the decoder has acquired the second sync pulse and within 125 <font face="Symbol">m</font>s of the correct phase.
<dt><tt>0x0004</tt>
<dd>digit sync. Set when the decoder has reliably determined at least one digit of the minute. <dt><tt>0x0008</tt>
<dd>Clock set. Set when the decoder has reliably determined all nine digits of the timecode and is selectable to discipline the system clock.
</dl>
<p>With debugging enabled the driver produces messages in the following formats:</p>
<p>Format <tt>wwv8</tt> messages are produced once per minute by the WWV and WWVH station processes before minute sync has been acquired. They show the progress of identifying and tracking the minute pulse of each station.</p>
<p><tt>wwv8 port agc ident comp ampl snr epoch jitr offs</tt></p>
<p>where <tt>port</tt> and <tt>agc</tt> are the audio port and gain, respectively. The <tt>ident</tt>encodes the station (<tt>C</tt> for WWV, <tt>H</tt> for WWVH) and frequency (2, 5, 10, 15 or 20). For the encoded frequency, <tt>comp</tt> is the hit counter, <tt>ampl</tt> the pulse amplitude, <tt>snr</tt> the SNR, <tt>epoch</tt> the sample number of the minute pulse in the minute, <tt>jitr</tt> the change since the last <tt>epoch</tt> and <tt>offs</tt> the minute pulse offset relative to the second pulse. An example is:</p>
<p><tt>wwv8 2 127 WV15 2 9247 30.0 18843 -1 1</tt><br>
<tt>wwv8 2 127 WH15 0 134 -2.9 19016 193 174</tt></p>
<p>Here the radio is tuned to WWV at 15 MHz, using the line-in port and the AGC is currently 127. The driver has not yet acquired minute sync, the station has been heard for at least two minutes, and WWVH is in the noise. The WWV minute pulse amplitude and SNR are well above the threshold (2000 and 6 dB, respectively) and the minute epoch has been determined -1 sample relative to the last one and 1 sample relative to the second sync pulse. The hit counter has incrmented to two; when it gets to three, minute sync has been acquired.</p>
<p>Format <tt>wwv3</tt> messages are produced after minute sync has been acquired and until the seconds unit digit is determined. They show the results of decoding each bit of the transmitted timecode.</p>
<p><tt>wwv3 ss stat sigl ssnr ampl dsnr like</tt></p>
<p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above, <tt>ssnr</tt> is the seconds sync SNR, <tt>ampl</tt> the subcarrier amplitude, <tt>dsnr</tt> the subcarrier SNR and <tt>like</tt> the bit likelihood. An example is:</p>
<p><tt>wwv3 28 0123 4122 30.0 4286 24.8 -5545</tt></p>
<p>Here the driver has acquired minute and second sync, but has not yet determined the seconds unit digit. However, it has just decoded bit 28 of the minute. The results show the second sync pulse amplitude well over the threshold (500), subcarrier amplitude well above the threshold (1000), good SNR well above the threshold (10 dB). The bit is almost certainly a zero and the likelihood of a zero in this second is very high.</p>
<p>Format <tt>wwv4</tt> messages are produced for each of the nine BCD timecode digits until the clock has been set or verified. They show the results of decoding each digit of the transmitted timecode.</p>
<p><tt>wwv4 ss stat sigl radx ckdig mldig diff cnt like snr</tt></p>
<p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above, <tt>radx</tt> is the digit radix (3, 4, 6, 10), <tt>ckdig</tt> the current clock digit, <tt>mldig</tt> the maximum likelihood digit, <tt>diff</tt> the difference between these two digits modulo the radix, <tt>cnt</tt> the compare counter, <tt>like</tt> the digit likelihood and <tt>snr</tt> the likelihood ratio. An example is:</p>
<p><tt>wwv4 8 010f 5772 10 9 9 0 6 4615 6.1</tt></p>
<p>Here the driver has previousl set or verified the clock. It has just decoded the digit preceding second 8 of the minute. The digit radix is 10, the current clock and maximum likelihood digits are both 9, the likelihood is well above the threshold (1000) and the likelihood function well above threshold (3.0 dB). Short of a hugely unlikely probability conspiracy, the clock digit is most certainly a 9.</p>
<p>Format <tt>wwv2</tt> messages are produced at each master oscillator frequency update, which starts at 8 s, but eventually climbs to 1024 s. They show the progress of the algorithm as it refines the frequency measurement to a precision of 0.1 PPM.</p>
<p><tt>wwv2 ss stat sigl epoch maxrun jitr avinc avint wiggle freq</tt></p>
<p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above, <tt>epoch</tt> the codec clock at the seconds epoch, <tt>maxrun </tt>the maximum run length, <tt>jitr</tt> the jitter counter, <tt>avinc</tt> the increment counter, <tt>avint</tt> the averaging interval, <tt>phase</tt> the phase correction and <tt>freq</tt> the current frequency (PPM). An example is:</p>
<p><tt>wwv2 22 030f 5795 7433 223 0 3 256 0 49.0</tt></p>
<p>Here the driver has acquired minute and second sync and set the clock. The averaging interval has increased to 256 s on the way to 1024 s, has stayed at that interval for 3 averaging intervals and the current frequency is 49.0 PPM.</p>
<p>If the CI-V interface for ICOM radios is active, a debug level greater than 1 will produce a trace of the CI-V command and response messages. Interpretation of these messages requires knowledge of the CI-V protocol, which is beyond the scope of this document.</p>
<h4>Monitor Data</h4>
When enabled by the <tt>filegen</tt> facility, every received timecode is written to the <tt>clockstats</tt> file in the following format:
<pre>
sq yyyy ddd hh:mm:ss ld du lset agc ident metric errs freq cons
s sync indicator (?&nbsp;or space)
q quality character (see below)
yyyy Gregorian year
ddd day of year
hh hour of day
mm minute of hour
l leap second warning
d DST state
dut DUT sign and magnitude
lset minutes since last set
agc audio gain
ident station identifier and frequency
metric signal metric (0-100)
errs data bit error counter
freq frequency offset
avgt frequency averaging interval
</pre>
The fields beginning with <tt>year</tt> and extending through <tt>dut</tt> are decoded from the received data and are in fixed-length format. The <tt>agc</tt> and <tt>lset</tt> fields, as well as the following driver-dependent fields, are in variable-length format.
<dl>
<dt><tt>s</tt>
<dd>The sync indicator is initially <tt>?</tt> before the clock is set, but turns to space when all nine digits of the timecode are correctly set and the decoder is synchronized to the station within 125 <font face="Symbol">m</font>s. <dt><tt>q</tt>
<dd>The quality character is a four-bit hexadecimal code showing which alarms have been raised. Each bit is associated with a specific alarm condition according to the following: <dl>
<dt><tt>0x8</tt>
<dd>Sync alarm. The decoder is not synchronized to the station within 125 <font face="Symbol">m</font>s. <dt><tt>0x4</tt>
<dd>Error alarm. More than 30 data bit errors occurred in the last minute.
<dt><tt>0x2</tt>
<dd>Symbol alarm. The probability of correct decoding for a digit or miscellaneous bit has fallen below the threshold.
<dt><tt>0x1</tt>
<dd>Decoding alarm. A maximum likelihood digit fails to agree with the current associated clock digit.
</dl>It is important to note that one or more of the above alarms does not necessarily indicate a clock error, but only that the decoder has detected a condition that may eventually result in an error. <dt><tt>yyyy ddd hh:mm:ss</tt>
<dd>The timecode format itself is self explanatory. Since the driver latches the on-time epoch directly from the second sync pulse, the seconds fraction is always zero. Although the transmitted timecode includes only the year of century, the Gregorian year is augmented by 2000. <dt><tt>l</tt>
<dd>The leap second warning is normally space, but changes to <tt>L</tt> if a leap second is to occur at the end of the month of June or December.
<dt><tt>d</tt>
<dd>The DST state is <tt>S</tt> or <tt>D</tt> when standard time or daylight time is in effect, respectively. The state is <tt>I</tt> or <tt>O</tt> when daylight time is about to go into effect or out of effect, respectively.
<dt><tt>dut</tt>
<dd>The DUT sign and magnitude shows the current UT1 offset relative to the displayed UTC time, in deciseconds.
<dt><tt>lset</tt>
<dd>Before the clock is set, the interval since last set is the number of minutes since the driver was started; after the clock is set, this is number of minutes since the decoder was last synchronized to the station within 125 <font face="Symbol">m</font>s. <dt><tt>agc</tt>
<dd>The audio gain shows the current codec gain setting in the range 0 to 255. Ordinarily, the receiver audio gain control or IRIG level control should be set for a value midway in this range.
<dt><tt>ident</tt>
<dd>The station identifier shows the station, <tt>C</tt> for WWV or <tt>H</tt> for WWVH, and frequency being tracked. If neither station is heard on any frequency, the reference identifier shows <tt>NONE</tt>.
<dt><tt>metric</tt>
<dd>The signal metric described above from 0 (no signal) to 100 (best).
<dt><tt>errs</tt>
<dd>The bit error counter is useful to determine the quality of the data signal received in the most recent minute. It is normal to drop a couple of data bits under good signal conditions and increasing numbers as conditions worsen. While the decoder performs moderately well even with half the bits are in error in any minute, usually by that point the metric drops below threshold and the decoder switches to a different frequency. <dt><tt>freq</tt>
<dd>The frequency offset is the current estimate of the codec frequency offset to within 0.1 PPM. This may wander a bit over the day due to local temperature fluctuations and propagation conditions.
<dt><tt>avgt</tt>
<dd>The averaging time is the interval between frequency updates in powers of two to a maximum of 1024 s. Attainment of the maximum indicates the driver is operating at the best possible resolution in time and frequency.
</dl>
<p>An example timecode is:</p>
<p><tt>0 2000 006 22:36:00 S +3 1 115 WV20 86 5 66.4 1024</tt></p>
<p>Here the clock has been set and no alarms are raised. The year, day and time are displayed along with no leap warning, standard time and DUT +0.3 s. The clock was set on the last minute, the AGC is safely in the middle ot the range 0-255, and the receiver is tracking WWV on 20 MHz. Good receiving conditions prevail, as indicated by the metric 86 and 5 bit errors during the last minute. The current frequency is 66.4 PPM and the averaging interval is 1024 s, indicating the maximum precision available.</p>
<h4>Modes</h4>
<p>The <tt>mode</tt> keyword of the <tt>server</tt> configuration command specifies the ICOM ID select code in decimal. A missing or zero argument disables the CI-V interface. Following are the ID select codes for the known radios. These codes are for 9600 baud rate; for 1200 baud rate add 128.</p>
<table width="100%" cols="6">
<tr>
<td>Radio</td>
<td>Hex</td>
<td>Decimal</td>
<td>Radio</td>
<td>Hex</td>
<td>Decimal</td>
</tr>
<tr>
<td>IC725</td>
<td>0x28</td>
<td>40</td>
<td>IC781</td>
<td>0x26</td>
<td>38</td>
</tr>
<tr>
<td>IC726</td>
<td>0x30</td>
<td>48</td>
<td>R7000</td>
<td>0x08</td>
<td>8</td>
</tr>
<tr>
<td>IC735</td>
<td>0x04</td>
<td>4</td>
<td>R71</td>
<td>0x1A</td>
<td>26</td>
</tr>
<tr>
<td>IC751</td>
<td>0x1c</td>
<td>28</td>
<td>R7100</td>
<td>0x34</td>
<td>52</td>
</tr>
<tr>
<td>IC761</td>
<td>0x1e</td>
<td>30</td>
<td>R72</td>
<td>0x32</td>
<td>50</td>
</tr>
<tr>
<td>IC765</td>
<td>0x2c</td>
<td>44</td>
<td>R8500</td>
<td>0x4a</td>
<td>74</td>
</tr>
<tr>
<td>IC775</td>
<td>0x46</td>
<td>68</td>
<td>R9000</td>
<td>0x2a</td>
<td>42</td>
</tr>
</table>
<h4>Fudge Factors</h4>
<dl>
<dt><tt>time1 <i>time</i></tt>
<dd>Specifies the propagation delay for WWV (40:40:49.0N 105:02:27.0W), in seconds and fraction, with default 0.0.
<dt><tt>time2 <i>time</i></tt>
<dd>Specifies the propagation delay for WWVH (21:59:26.0N 159:46:00.0W), in seconds and fraction, with default 0.0.
<dt><tt>stratum <i>number</i></tt>
<dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.
<dt><tt>refid <i>string</i></tt>
<dd>Ordinarily, this field specifies the driver reference identifier; however, the driver sets the reference identifier automatically as described above.
<dt><tt>flag1 0 | 1</tt>
<dd>Not used by this driver.
<dt><tt>flag2 0 | 1</tt>
<dd>Specifies the microphone port if set to zero or the line-in port if set to one. It does not seem useful to specify the compact disc player port.
<dt><tt>flag3 0 | 1</tt>
<dd>Enables audio monitoring of the input signal. For this purpose, the speaker volume must be set before the driver is started.
<dt><tt>flag4 0 | 1</tt>
<dd>Enable verbose <tt>clockstats</tt> recording if set.
</dl>
<hr>
<script type="text/javascript" language="javascript" src="../scripts/footer.txt"></script>
</body>
</html>