• Keine Ergebnisse gefunden

Estimating PC Clock Oset and Drift

If a need for correcting the ensemble times has been determined, the user must then establish several parameters:

start header number: This is the header number at which to start applying the time correction. The time correction will be applied to this and all subsequent headers within the le, or until another set of time correction parameters are speci ed.

correct time: This constant is the correct GMT time derived from the satellite clock at some reference point in time, such as the time of the rst ensemble at the beginning of a cruise.

PC time: This constant is the PC clock reading at time equal to correct time.

clock rate: This constant is the PC to satellite clockspeed ratio. A value of one means there is no drift in the PC clock, less (more) than one means the PC clock is faster (slower) than the satellite clock.

recorded time: This variable is the PC clock time of each ensemble as seen in the output of scanping (Figure 2).

corrected time: This variable is the nal correct time of each ensemble.

The time correction is applied as:

corrected time = correct time + clock rate (recorded time;PC time) If a le containing the satellite x times (or the recorded pro le times) and the time dierence (in seconds) between the PC and satellite clocks is available, then the process of estimating the above parameters can be automated using the Matlab script

clkrate.m. For cases where x times are not recorded with the ADCP ensembles, the user is referred to the subsequent section.

For UH buer types 1280 and 1020, theUB_OUTPUT_FILEcontaining the columnar summaryof Transit xes can directlybe used with this script, since the rst and eighth columns of the le contain the x times (in decimal days) and the time dierence (in seconds).

For UH buer types 1320, 2240 and 720, thescanping OUTPUT_FILEalso contains the required information, but needs to be stripped of text and other extraneous lines before it can be loaded into the Matlab workspace. Also, the x times need to be recalculated by adding the PC minus x time back to the pro le times. Unix users can take advantage of a csh script cleanscnto do this automatically:

18

cleanscnscanping output le cleanscn output le

The result will be a two-column le that can be loaded into Matlab by theclkrate.m script.

For other user buer types that contain the necessary information, the user can write his or her own script or program to parse scanping's UB_OUTPUT_FILE and derive the necessary columns. (The rst column must be x time in decimal days.)

Once the proper input le is available, the user can then apply the clkrate.m script under Matlab. All this actually does is t a line to the scatter plot of PC minus x time versus x time (Figure 3). The x-intercept of the line would correspond to the time when both PC and satellite clocks coincided (PC minus x time goes to zero). This directly yields values for two of the required parameters: PC_time and

correct_time(as seen in Figure 4 as PC clock reset). The slope of the line would correspond to the reciprocal of the third required parameter clock_rate. However, in some cases, the correct time( x time when PC minus x is equal to zero ), can be substantially long ago. In this case, it would be preferable just to use the satellite x time (correct time) and PC clock time (PC time) of the rst good ensemble as the reference point in time.

The script takes care of eliminating outliers, including the bad values that occur when a x is unavailable to match against the PC pro le time.

The script also takes care to detect if the PC clock may have been reset over the period, in which case a single linear trend would be inappropriate. Instead, for each detected reset, a new linear estimate is generated. It should be reasonable to expect the slope (hence the PC clock rate) to vary little over the various estimates we generally pick the estimate derived over the longest time span. The x-intercept estimates should roughly correspond to when the resets take place.6

With this background, the user should now be able to edit the relevant section of clkrate.m, as shown in Appendix B.3. The parameter infilespeci es the name of the Matlab-loadable le containing x times in the rst column and the time dierence in seconds between the PC clock and the x time in another column.

The dtcolumn speci es which column in the infile contains this time dierence eld. The outfilespeci es the name of the output le used for logging clkrate's results. The yearbase is the year to use when converting between decimal day and year/month/day hour:minute:second formats. The abs_max_gapis a threshold value in seconds (unsigned) used for detecting a PC clock reset. If the dtcolumn data jumps by a value greater than this threshold, the script concludes that a clock reset has occurred and yields a new linear t over the data starting from that point up to the end or the next reset. The user may need to ddle with this value depending

6Often, the PC clock is not even reset at the beginning of the cruise, and may have drifted signif-icantly over a period of time, so nding the x-intercept may require a rather extended extrapolation.

A bad initial setting (several hours o) may yield an x-intercept that indicates that the last time PC and satellite clocks were synchronized was several years back! Such estimates would also be more sensitive to slight dierences in the slope.

19

224 225 226 227 228 229 230 231 232

10 20 30 40 50 60 70 80

fix time

PC time fix time

Fitting one trend line to the given data:

Figure 3: PC clock drift (ratio of PC to satellite clock speeds) as viewed using

clkrate.mwithin Matlab.

abs_max_gap = 7 abs_max_bad = 1000

Fitting one trend line to the given data:

PC clock rate = 0.99989214915

PC clock reset at 92/08/10 16:48:00

Figure 4: Output ofclkrate . ThePC clock ratecorresponds to the the clock drift rate and thePC clock reset time is when the PC and satellite clocks are equal.

20

on the underlying data. Finally, the abs_max_bad is a threshold value in seconds (unsigned) used for weeding out outliers in the dtcolumndata. This may need to be increased if the PC clock is set too dierently from the satellite clock, or is allowed to drift over a very long cruise. (Bad or missing satellite x times are indicated by a value of 99999 in the dtcolumn).

After editing clkrate.m, the user starts up Matlab and simply types:

>> clkrate

The script loads the input le and rst attempts to t a single line to the entire dataset (less any detected outliers). It then prints a message regarding how many PC clock resets it has detected. The user needs only to press the carriage return in order to see the various ts. If he or she thinks that the clkrate abs_max_gap and/or

abs_max_badparameters need some adjustment, then the script can be interrupted by pressing control-C. In the end, the outfilewill contain a convenient summary ofclkrate's results. Together withscanping'sOUTPUT_FILE, this can guide the user in lling out all the time correction parameters needed for the loading stage.

Examples of setting parameters in the loadping.cnt control le for correcting clock problems are shown in Section 5.2.