Use NTP for Timestamping Measurements

Überblick

This document provides an overview of using a custom time source to correlate measurement data on time-aware controllers.

 

Time-aware controllers, such as CompactRIO 904x/5x and Industrial Controller 317x, automatically timestamp measurements using the time onboard the controller. Starting in NI-Sync 20.1, synchronization between the onboard time and network time can be disabled. This allows you to set the time onboard the controller (the Linux OS time) directly instead of having it set by the network time as it had been in previous driver versions. This enables the use of NTP and other custom time sources to drive the Linux OS time, which is used for timestamping measurements.

Contents

Why Do I Need NI-Sync 20.1 to Use NTP?

By default, all clocks on time-aware controllers are set by the network time. In the absence of PTP synchronization, the network time will be an arbitrary time. Because the Linux OS time is also set by network time, attempting to directly set or synchronize Linux OS time conflicts with the processes maintaining synchronization with network time.

NI-Sync 20.1 allows you to sever the link between network time and Linux OS time and set the Linux OS time arbitrarily. Since Linux OS time is used for timestamping measurements, you can now arbitrarily set the time you want to use to timestamp measurements.

Will My Timestamps Be Accurate?

NI-Sync has always correlated the Linux OS time to network time for timestamps because Linux OS time is not as precise and stable as network time and all the hardware timing mechanisms behind the scenes. With NI-Sync 20.1, the same mechanisms are used to capture timestamps, so there is no loss in timestamp accuracy.

The accuracy of NTP or any other custom source of time should be considered if high precision is required. NTP, for example, has no accuracy threshold for staying synchronized and may jitter by milliseconds depending on the server used and the network architecture. Please refer to Choosing a CompactRIO Synchronization Technology for more information about different synchronization methods.

Software Requirements

  • NI-Sync 20.1
  • PuTTY or another SSH client

Disable Linux OS Time Synchronization

Linux OS time synchronization can be enabled and disabled using a tool onboard the controller called configGen. The configGen tool can be accessed using PuTTY or any other ssh program. The steps below assume that a 1588 or 802.1AS time reference versioned 20.1 or later is installed. For help installing and understanding time references, refer to Monitor and Configure Time Synchronization on Embedded Devices.

  1. Enable SSH on the target in NI MAX.
  2. Open an SSH session in PuTTY or another SSH client.
  3. The method of enabling or disabling this feature depends on how software has been installed to the target. Determine the software installation method and execute the following commands in an SSH session with the target:

    • If using the Linux RT Base System Image:
      • Disable Linux OS Time Synchronization:
        /usr/lib/x86_64-linux-gnu/ni-timesync/configgen --tsmJsonFile /var/lib/ni-timesync/tsm.json --setTKPluginConfig phc2sysEnable false
      • Enable Linux OS Time Synchronization:
        /usr/lib/x86_64-linux-gnu/ni-timesync/configgen --tsmJsonFile /var/lib/ni-timesync/tsm.json --setTKPluginConfig phc2sysEnable true
    • If using Legacy Installation:
      • Disable Linux OS Time Synchronization:
        /usr/local/natinst/share/TimeSync/Config/configGen --tsmJsonFile /usr/local/natinst/share/TimeSync/tsm.json --setTKPluginConfig phc2sysEnable false
      • Enable Linux OS Time Synchronization:
        /usr/local/natinst/share/TimeSync/Config/configGen --tsmJsonFile /usr/local/natinst/share/TimeSync/tsm.json --setTKPluginConfig phc2sysEnable true

  4. After the setting has been updated from the SSH client, restart the target for the setting to take effect.

 

When Linux OS Time Synchronization has been disabled, Linux OS time can be set arbitrarily or can be synchronized to a custom time source, such as NTP. To install and configure NTP, please refer to Installing and Configuring NTP on NI Linux Real-Time Devices.