In time-based synchronization, all system components have a common reference to time. Often there are no additional cables required between the systems. It also scales easily as more targets are added to the system. The data from the new target can be correlated with other targets on the system once the system is synchronized to a time source. However, depending on your application, you may not have access to a given time source. For example, GPS is not accessible underground.
A) IEEE 1588
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.
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. Some profiles are supported in software only, but others require hardware support to achieve higher levels of time synchronization.
1588 with hardware support (IEEE 802.1AS profile and default profile)
Devices and networks with hardware support for IEEE 1588 can provide high accuracy simple synchronization of systems. TSN-enabled CompactRIO controllers provide hardware support for IEEE 1588 and support both the default profile and the IEEE 802.1AS profile. IEEE 802.1AS was selected for time synchronization within Time Sensitive Networking (TSN) infrastructure. 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 common sense of time between network components within the TSN subnet. This profile provides a set of optimizations to assure high reliability and high accuracy in PTP networks. It is the recommended profile for CompactRIO controllers. However, the controllers can also support the IEEE 1588 default profile (layer 3, end to end). To synchronize multiple CompactRIO controllers, you need to connect them using a switch that supports the necessary PTP profile.
The typical accuracy of this type of synchronization between controllers is less than 1 μs, but this can be greatly reduced to the 100s of nanosecond range, depending on the configuration of the system. The controllers that support TSN will automatically servo the Operating System Clock and FPGA clock to the network time. CompactRIO controllers supporting NI-DAQmx will also servo the NI-DAQmx task and DSA modules to network time. You can read the current time in RT and through an I/O node if LabVIEW FPGA allowing you to precisely time stamp events and define start triggers for when an acquisition or task will start, and the NI-DAQmx driver will allow you to configure certain triggers and timestamps to be specified in terms of time of day.
Software-Based IEEE 1588v2
All CompactRIO controllers support a software implementation of IEEE 1588. Once the driver is installed from MAX, multiple CompactRIO controllers can be connected over any standard Ethernet network, and they will automatically synchronize their system clocks. The typical accuracy of this type of synchronization between controllers is about 1ms. While there is no specific network hardware (Ethernet switches) required to support IEEE 1588, an IEEE 1588-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.
Synchronizing to other 1588 devices
In addition to synchronizing a network of CompactRIO controllers, you can also synchronize CompactRIO controllers with other devices that support IEEE 1588. If you are trying to synchronize your CompactRIO controllers with third party products, you will need to ensure that they use the same PTP profile (IEEE 802.1AS or default L3E2E).
To enable IEEE 1588 synchronization on your CompactRIO system, you will need to install NI-TimeSync on each CompactRIO controller. This can be done through the software installation process in NI MAX. IEEE 1588 settings can then be configured through NI MAX for PharLap and VxWorks targets. For NI Linux RT targets, you will need to configure these settings through file modifications. For details on configuring and monitoring the IEEE 1588 synchronization status on Linux RT, please see Using NI-TimeSync to Configure IEEE 1588 and 802.1AS Time References for more information.
*ARM-Based Linux RT targets are currently not supported as IEEE 1588 grandmasters.
B) Global Positioning System (GPS)
Global positioning systems (GPS) determine locations on earth by receiving precisely time-stamped signals from geostationary satellites, determining distance from each satellite, and then triangulating to determine position. Because the GPS satellites provide precise timing information and are accessible anywhere on or near Earth where there is an unobstructed line of sight to four or more GPS satellites, this infrastructure can be used to create largely distributed synchronized systems. GPS is supported on CompactRIO using the NI-9467 module. The module has an SMA antenna connection that can be connected to a GPS antenna placed with a clear view of the sky. The module has a typical synchronization accuracy of 100 nanoseconds.
The NI-9467 I/O and GPS information is only available on the FPGA, and must be passed to the real-time host to synchronize the real-time clock to GPS. The GPS timestamp can be accessed via property nodes which return a timestamp in TIA format. Using these same property nodes, additional parameters about the quality of the synchronization, such as number of satellites and status information, can be obtained. The following image shows a screenshot from the Getting Started example for the NI-9467, which can be found in the Example Finder of LabVIEW.
The NI-9467 GPS Module is typically used with the FPGA Timekeeper API to synchronize the FPGA clock with GPS.
FPGA Timekeeper API
The FPGA Timekeeper API is a set of VIs that allows a developer to synchronize the absolute time of the FPGA target to a time reference. It has the capability to correlate absolute time with system events at an accuracy of ~100 ns. It is commonly used for timestamping I/O, scheduling I/O according to a future time, and getting and sharing accurate time. The FPGA Timekeeper API is available on the Sync Labs NI Community Page.
C) (S)NTP* – (Simple) Network Time Protocol
(S)NTP 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 via Ethernet. Many industries, such as government and oil, prefer (S)NTP because it is a mature and well-tested standard that only requires a network connection. The major tradeoff 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 Linux RT targets, NTP can be enabled through the use of an open source Linux NTP daemon. There is community documentation available on the NI Developer Community that details how to install this daemon to a Linux RT target. One important thing to note is 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.
Because NI-Timesync should not run at the same time as an (S)NTP daemon, and because a IEEE 1588 or IEEE 802.1AS reference is required for NI-DAQmx tasks to start on cRIO-904x controllers using DAQmx 18.1 and later, (S)NTP and other 3rd party time references should not be run on these targets if NI-DAQmx tasks need to be executed.
*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.
IRIG-B is a common time format whereby time of day information is encoded as a serial formatted time code.
IRIG-B dates back to the 1950s and is commonly seen in military applications. The CompactRIO platform does not have a dedicated hardware solution for IRIG-B decoding. To use IRIG-B on CompactRIO, one needs to use a digital C Series Module such as the 9402 to decode the IRIG-B signal. There is an example of an IRIG-B 000 variant implementation in LabVIEW FPGA, which can be used in its entirety, or as a starting point. This code can be combined with the FPGA Timekeeper to provide time on the FPGA.
IRIG-B is supported on the PXI Platform using the PXI-6683(H) module.