9 - Frame sync delay handling
Status
Accepted.
Context
Some instruments use a frame sync delay to shift their data acquisition window, relative to the time of the ISIS pulse.
For example, on HRPD, a typical configuration is:
SMP timing is used with a 10Hz chopper to achieve a 100ms frame time
That 100ms window can be shifted in time-of-flight, using a frame sync delay, to cover different time-of-flight ranges, for example:
30_000 - 130_000μs100_000 - 200_000μs180_000 - 280_000μs
What the streaming hardware currently emits is:
The GPS time in the header is the time of the original frame sync (in other words, the GPS time in the header is the time of the ISIS or chopper timing pulse).
The individual event timestamps are offsets from
(gps_time + frame_sync_delay).
This means that what the streaming hardware emits over UDP is not self-consistent: adding the absolute pulse timestamp with the neutron event timestamps will not produce correct absolute timestamps for individual neutron events.
Decision
The decision is:
The hardware will emit an additional
frame_sync_delayfield in the UDP header to tell consumers how long the frame sync was delayed by, relative to the original timing signal which may have been either the ISIS timing pulse or an SMP (chopper) timing pulse.event_udp_to_kafkawill transform neutron event timestamps by adding theframe_sync_delayto each neutron event’s timestamp, which makes these timestamps relative to the pulse time.event_udp_to_kafkadoes not need to perform any manipulation on the GPS timestamps in the UDP headers of streamed packets; those headers already contain the correct pulse times.
frame_sync_delaymay be greater than one frame period.
Alternatives rejected
Make every consumer of the event-stream implement frame sync delay corrections
Rejected because it would be easy to forget to do this, leading to subtly incorrect data: data would appear shifted in time-of-flight, would be a small shift for small frame sync delays.
Implement per-event corrections in hardware/firmware - larger firmware change, hardware has limited resources/ability to do this.
Consequences
Streaming firmware can keep its existing implementation of frame sync delay, only changing to emit an additional
frame_sync_delayfield in the UDP header.event_udp_to_kafkawill gain additional complexity in applying ‘corrections’ for frame-sync delay, for each neutron event, as part of decoding the UDP data.The event timestamps emitted in
ev44s fromevent_udp_to_kafkawill be time-of-flight offsets from the original ISIS or chopper timing pulse, which is what scientists will expect to see in their event data.Adding together the
reference_timeand an individual neutron event timestamp from anev44will give a correct absolute time-of-arrival for that neutron.