In time-based synchronization, all system components have a common reference to time. It is more scalable than signal-based synchronization as more devices are added to the system. The data from the new device can be correlated with other devices on the system once the system is synchronized to a time source.
There are two central software APIs for time-based synchronization on CompactDAQ:
- NI-DAQmx is the driver software you use to communicate with and control your NI DAQ devices. The driver includes an extensive library of functions and VIs you can call from your application software, such as LabVIEW or LabWindows™/CVI, to program your devices. Starting in NI-DAQmx 17.1, network-synchronized devices can also take advantage of time-based synchronization features. Certain triggers and timestamps can be specified in terms of time of day.
- NI-TimeSync provides the ability to synchronize the CompactDAQ controller’s system clock to a specified time reference. The only officially supported time reference plug-in is software IEEE 1588; however, there are commonly used community versions of other time reference plug-ins, such as the custom time reference (often used in conjunction with GPS), the SNTP time reference, and the NI-Sync hardware time reference. All community time references are on the Sync Labs NI Community Page. To use one of the time reference plug-ins, install it to the target. Some minor modifications to the configuration files may be required, which are described in the sections below.
The following is a list of time synchronization options for CompactDAQ, many of which use the above software methods.
IEEE 1588, also known as the Precision Time Protocol (PTP), is an Ethernet-based synchronization method designed for cabled, local networks. The benefit of IEEE 1588 is that it allows you to synchronize your targets over a standard network. It works by determining a master clock automatically from the network and having all other clocks slave to this master clock. IEEE 1588 is also a relatively fault-tolerant synchronization option. If the master clock is disconnected from the network, a new master is dynamically determined. For a detailed description of the protocol, refer to the white paper, Introduction to Distributed Clock Synchronization and the IEEE 1588 Precision Time Protocol.
IEEE 1588 has many different profiles, each of which use different features. Because the profiles are not interoperable with each other, make sure you are aware of which profiles your device supports
Software-Based IEEE 1588v2
All CompactDAQ controllers based on NI Linux Real-Time support a software implementation of IEEE 1588v2 through the NI-TimeSync driver. After the driver is installed, you can connect multiple CompactDAQ controllers over any standard Ethernet network, and they automatically synchronize their system clocks. TSN-enabled Ethernet CompactDAQ chassis with firmware 18.1 or later installed also support IEEE 1588v2. The typical accuracy of this type of synchronization between controllers is about 1 ms. Although there is no specific network hardware (Ethernet switches) required to support IEEE 1588v2, an IEEE 1588v2-enabled switch is recommended to obtain the best synchronization performance. These switches mitigate the impact of network loading that can adversely affect synchronization on standard switches.
To enable software-based IEEE 1588v2 synchronization on your CompactDAQ controllers running NI Linux Real-Time, you need to install NI-TimeSync on each controller. This can be done through the software installation process in Measurement & Automation Explorer (MAX). IEEE 1588v2 settings for NI Linux Real-Time targets need to be configured through file modifications. For details on configuring and monitoring the IEEE 1588v2 synchronization status on NI Linux Real-Time, refer to Using NI-TimeSync to Configure IEEE 1588 and 802.1AS Time References.
Hardware-Based IEEE 1588v2 (default profile)
TSN-enabled CompactDAQ chassis with firmware 18.1 and later support HW IEEE 1588v2 (default profile). HW IEEE 1588v2 (default profile) is compatible with SW IEEE 1588v2, but is not compatible with the 802.1AS profile. HW IEEE 1588v2 (default profile) features greater accuracy due to hardware timestamping, but is otherwise the same protocol as SW IEEE 1588v2.
Hardware-Based IEEE 1588v2 (802.1AS profile)
A newer PTP profile within IEEE 1588 is IEEE 802.1AS, which was selected for time synchronization within Time Sensitive Networking (TSN). TSN is a series of additions and updates to the IEEE 802.1 standard, which is a local area networking standard for bridges. One of the aspects of TSN is defining a global sense of time between network components within the TSN subnet. Both the 4-slot cDAQ-9185 Ethernet chassis and the 8-slot cDAQ-9189 Ethernet chassis use this PTP profile to provide time-based synchronization across the network. The typical accuracy of this type of synchronization between chassis is less than 1 μs, but this can be greatly reduced to the 100s of nanosecond range, depending on the configuration of the system. To synchronize these chassis, you can daisy chain them together, creating a line topology, with just Ethernet cables. For other topologies where they are not daisy chained and you want to have all the chassis synchronized, you must use an IEEE 802.1AS-compliant switch between the devices.
These chassis leverage the addition of the time-based synchronization features in NI-DAQmx to be able to now configure certain triggers and timestamps to be specified in terms of time of day. The IEEE 802.1AS-2011 profile is already enabled on these CompactDAQ Ethernet chassis, so to use this feature, all you need to do is install your application software and the NI-DAQmx driver.
Default IEEE 1588v2 profiles are not compatible with the 802.1AS profile.
SNTP is a time synchronization method for clocks located on the Internet. The current time is obtained from public NTP servers. It uses a distributed network of NTP servers and synchronizes clocks within the network to national time standards over Ethernet. NTP and SNTP are indistinguishable from each other on the network level. SNTP has a smaller footprint in terms of memory and CPU usage while still being good enough to achieve system clock synchronization for typical desktop usage. Many industries, such as government and oil, prefer (S)NTP because it is a mature and well-tested standard that requires only a network connection. The major trade-off with (S)NTP is that it is less accurate than the other time-based technologies described in this article. It has typical accuracy on the order of tens of milliseconds. (S)NTP is not officially supported on LabVIEW Real-Time targets, but there are methods to enable it, as described below.
On CompactDAQ controllers based on NI Linux Real-Time, NTP can be enabled using an open-source Linux NTP daemon. Documentation on the NI Developer Community details how to install this daemon to an NI Linux Real-Time target. Note that you should not install NI-TimeSync to your target if you choose to use this daemon. Both NI-TimeSync and this daemon adjust system time, and your systems may not synchronize properly if both NI-TimeSync and the NTP daemon are attempting to modify time on the target
For TSN-enabled Ethernet CompactDAQ chassis using NI-DAQmx 18.1 or later, there must be at least one IEEE 1588 or IEEE 802.1AS time reference running for NI-DAQmx tasks to start. Because running (S)NTP and NI-Timesync cannot run at the same time, (S)NTP time references cannot be used on TSN-enabled Ethernet CompactDAQ chassis using NI-DAQmx 18.1 or later.