Skip to main content
U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

CHRNS: Absolute timing infrastructure


The project relies on being able to attach absolute timestamps to neutron detection, motors, and ancillary equipment events. The instrument control program, NICE, will interface with current (and new) sample environments in a robust fashion (fault tolerant; plug-n-play), these sample environments will be controlled by NICE and participate in the timing infrastructure. This means that only one driver needs to be programmed into NICE for all compatible sample environments to operate (see CHRNS: Stopped flow capabilities for an example). The SECoPs-like environment is flexible (C++, Python, and LabVIEW libraries on Windows, linux, and OSX), and expands the programming capabilities outside of the NICE team and allows for users to program their own equipment and provides a reduced barrier to enabling experiments (CHRNS staff will help as necessary!)

To achieve the highest timing resolution needed for certain experiments (e.g. relaxation microwave excitations on magnetic monopoles on MACS) the timing requirements are in the micro-seconds regime and unsuitable to most operating systems. For these requirements, and also suitable for any other sample environment, we will adapt the real-time capabilities of the National Instrument Compact-RIO (cRIO) to be the primary sample environment control for the Initiative.

Neutron capture events (and all other events) are timestamped using the Precision Time Protocol (PTP) using a master GPS clock at the NCNR ( MACS, CANDOR and VSANS all require modifications to the detection hardware to enable these capabilities. While it is relatively straightforward on MACS (and we have prior experience implementing this on DCS and prototyping for this experiment) the other two instruments required bespoke solutions with the requisite prototyping, testing, troubleshooting, and final design and manufacturing of components. 

An experiment further requires Instrument configurations (defined essentially by motor and servo positions) and other meta-data from NICE (user information, experiment title, measurement intent, start/stop counts etc.). Motor positions are now available from the VIPER program across the facility. 

All events from their respective sources are captured as an information packet that is transmitted to our Redpanda messaging system (based on Apache KAFKA). This scaleable system installed on the newest computer hardware allows us to define a series of self-describing data streams based on common schemas. The near term goal is to add data histogramers and file writers to allow as close to realtime data visualization and histograming for users and traditional file handling.

Required timing resolution

Any neutron and sample environment timed series of event has to be brought in to coincidence using data reduction/analysis. The delay between when the neutron interacts with the sample and the time the neutron is detected needs to be known. Similarly the uncertainty in the neutron time-of-flight but an upper boundary on maximum time resolution obtainable. For velocity selector instruments the resolution is low due to a large δλ/λ while for crystal monochromator/analyzer instruments this depends on the crystal and mosaic properties. A full McStas simulation of MACS was performed to characterize these parameters (and has the added bonus of allowing the full dynamics instrument resolution to be calculated). A summary of results is given in the following table.

MACS McStass
McStas simulation of MACS




t (delay)  (ms)

≈Resolution, δt (ms)






Closest dets.




Furthest det.




(Center of detector)

Converging beam,

6.7 , dl/l=12.5%

Rear: 35.6

Mid: 29.6

Front: 5.9

Rear: 10.2

Mid: 8.5

Front: 2.7


Converging beam, 

medium Q

9 , dl/l=12.5%

Mid: 39.8

Front: 8.0

Mid: 12.2

Front: 2.2


Converging beam, 

large Q

9 , dl/l=12.5%

Mid: 8.0

Front: 2.0

Mid: 2.2

Front: 0.6


High res,

large Q

4.75 , dl/l=1%

Mid: 4.8

Front: 1.2

Mid: 0.1

Front: 0.02

Achievements 2022-2023

  • Received MACS time-stamper from Reuter-Stokers (Jan. 2023)
  • Prototyped and troubleshooting of VSANS/CANDOR (Expected April 2023 for manufacturing)
  • SECoPS successfully deployed on the home-built stopped flow system (Python on any OS)
  • SECoPS for temperature controllers (Windows and Linux; working to build for cRIO)
  • Plug-n-play on cRIO and existing drivers in NICE (operational)
  • VIPER has been re-written for absolute time-stamps of motor readings
  • Prototype streaming data system using Redpanda is functional

Further goals

  • Build SECoPS for cRIO: requires manual compilation of required libraries
  • NICE incorporation of SECoPS
  • Expand SECoPS to more equipment 
  • Incorporate neutron detection absolute timing hardware on all instruments
  • Add needed NICE timing streamed events 
  • Construct data writers for streamed data 
  • Use prior NICE records to stream events to Redpanda and re-write equivalent data file
  • Use prior NICE data files to stress test network for data rates and checking for read/write demands
  • Incorporate streaming of information to key parts of NICE 







Created February 4, 2023, Updated February 9, 2023