NRAO Home  >  Green Bank  |  Wiki Topic:    GB > Software > PlanOfRecordC32007 > ModificationRequest2C307
   Changes | Index | Contents | Search | Statistics | Go

Accelerometer Timestamp fixes

Modification Request #2 (C3 2007)



1. Introduction

The timestamps on the accelerometer data (and by extension all GDAQ based instruments) are buggy. There is a problem in the microcontroller that generates the timestamps causing jumps and skips in time. These problems are causing the timestamps to jump around, wreaking havoc on any analysis attempted.

2. Background

The GDAQ systems keep track of time on their own, and put a timestamp on the data as it is acquired. The timekeeping function of the GDAQ, in addition to being limited to 1/128 second granularity, is buggy. This needs to be corrected.

A related item is the correction of timestamp processing. A bug has been found which causes 1 day time jumps forward or backward due to the GDAQ clock rolling over to the next day before or after the host system clock.

3. Requirements

3.1 The timestamps shall have a resolution of 1/1000th of a second. The timestamps shall be accurate, relative to the local clock, to less than 100 microseconds. The timestamp shall be assigned by the GDAQ at the beginning of the ADC interrupt handler, which should allow extremely repeatable timestamping.

3.2 The M&C software for the GDAQ will need to be changed to use the 1/1000 second resolution instead of the 1/128 second resolution. The M&C software will also need to be able to compensate for the latency, and to check/assign correct UTC times for the timestamps.

3.3 Correct the 24 hour time jumps, and merge the T1 and T2 fields into a DMJD like (i.e. decimal modified julian days) field.

3.4 Compensate the GDAQ time of day value, with a median filtered estimate of the GDAQ/host clock offset.

4. Design

4.1 High-resolution Timestamps

The Accelerometer TimeStamp (TS) format has the following form:

|HH|MM|SS|FFF|, (with no spaces), where:

This MR changes the semantics of the FFF field to indicate the fractional portion of seconds as a number of 1/1000ths of a second.

This change applies to all TS fields of GDAQ messages listed in section 2.5 of the accelerometer manager MR.

The GDAQ uses an internal 16-bit timer to generate its local timestamps. The timer is setup to freerun, which generates interrupts every 62.5ms (1/16th of a second). The counter counts up to 65535 at a clock frequency of approximately 1.048MHz. When the counter reaches 65535, an interrupt is generated. In the interrupt routine, the variables for sixteenths, seconds, minutes, and hours are incremented appropriately. Each time a sample is taken by the GDAQ, it generates a timestamp which is the following:

  hours = current value of hour variable
  minutes = current value of minute variable
  seconds = current value of seconds variable
  milliseconds = ((Timer1_val/65.535)/16) + (sixteenths * 62.5)

     where:
       Timer1_val is the current value of the 16-bit timer1 (0 to 65535)
       sixteenths is the number of times that timer1 has interrupted in the past second (0 to 15).

  The expression ((Timer1_val/65.535)/16) converts the current value of timer1 into milliseconds.
  The expression (sixteenths * 62.5) converts the current value of sixteenths into milliseconds.

4.2 Correcting Timestamp Jumps

This problem will be fixed by emulating the MJD portion of the GDAQ clock on the host. Each time the GDAQ clock is set, the MJD field is updated locally to the host MJD value. On the recept of a message, the host checks to see if the clock has rolled over. When a rollover is detected, the local emulated MJD is incremented. M&C timestamp values are then generated from a combination of the emulated MJD and GDAQ time of day.

4.3 Compensate GDAQ Time of day

On each packet from the GDAQ, an estimate of the host to GDAQ clock offset is estimated and entered into a median filter. M&C time-stamps are then compensated by correcting for the median value of the clock offset and the average link delay measured from the echo transmissions.

5. Deployment Checklist

What has to get done to integrate this completely into the system. This checklist must be completed before Cycle Integration Testing begins.

7. Test Plan

7.1 Internal Testing

These changes can be tested either by:

7.2 Sponsor Testing

The sponsor can verify proper operation by a comparison of data from the accelerometer, with data from both the inclinometers and servo systems.

7.3 Integration/Regression Tests

8. Test Results

This section contains data from the sponsor testing. The tests were conducted by setting up a GDAQ in the lab, with a signal generator which is triggered with a 1 PPS signal. The 1PPS was generated by a laptop parallel port. Pulses were generated on every even numbered second. The Accelerometer detector manager was run in the simulation environment, with sampleRate set to 20, or approximately 53ms sampling interval.

8.1 Sampler Time-tag Synchronization

The tests below show pulses are within a sample time of the GDAQ. For these tests the GDAQ was set to sample at 53ms intervals.
Plot Showing pulses synchronized on even seconds
Plot showing same signal still synchronized

8.2 No Time Swings at Midnight

The following is a plot of the GDAQ timestamp vs. the sampler timestamp. For clarity, 54244 has been subtracted from both fields. Note there are no large swings in the T1 timestamp. The T2 field was checked, but not plotted, since the results were similar. UTC Midnight occurs at 1.0 in the plot.
(Test in progress)
Plot showing midnight transition without glitches

8.3 GDAQ Clock Drift

The following plot shows a strong trend of about ~30ms every 10seconds.

This is far above the limits set forth in the requirements of the MR. Plot on right shows improved/fixed clock drift.

Plot of GDAQ clock drift Plot showing clock drift fixed. Note values are quantized due to limited precision in GDAQ timestamp (1ms).


Signatures

APPROVED: I acknowledge that my request is fully contained in this MR, and if the SDD delivers exactly what I specified, I will be happy.

ACCEPTED: I acknowledge that I have validated the completed code according to the acceptance tests, and I am happy with the results.

Written DONE - JohnFord - 03/30/2007
Checked DONE - JoeBrandt - 12 Apr 2007
Approved by Sponsor DONE - JohnFord - 27 Apr 2007
Approved by CCC DONE - RonMaddalena - 9 May 2007
Accepted/Delivered by Sponsor DONE - JohnFord - 19 Jun 2007

Symbols:


CCC Discussion Area

-- JohnFord - 30 Mar 2007

Attachment: sort Action: Size: Date: Who: Comment:
AclYPlotA.png action 5197 25 May 2007 - 18:15 JoeBrandt  
AclYPlotB.png action 4927 25 May 2007 - 18:16 JoeBrandt  
AclClockDrift.png action 6759 25 May 2007 - 18:17 JoeBrandt  
AccelClkFixed.png action 5633 19 Jun 2007 - 21:45 JoeBrandt  

Topic ModificationRequest2C307 . { Edit | Attach | Ref-By | Printable | Diffs | r1.17 | > | r1.16 | > | r1.15 | More }
Revision r1.17 - 20 Jun 2007 - 02:26 GMT - JohnFord
Parents: PlanOfRecordC32007
Content copyright © 1999-2007 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors.