Reference Design Content

cancel
Showing results for 
Search instead for 
Did you mean: 

Distributed Timebase (DTB) Example

Note: This is an older example. Consider using the IEEE 1588 Precision Time Protocol for your synchronization needs.

 

Introduction to Distributed Clock Synchronization and the IEEE 1588 Precision Time Protocol

 

Overview

 

This example describes a library that provides better timing accuracy and precision for distributed LabVIEW applications by distributing the timebase process to the networked nodes. The distributed timebase has several potential applications but it is most commonly used to time stamp data and events at the I/O nodes.

 

Background

 

When data values and events are are to be monitored or logged they must be time stamped so that they can be correlated in time for display or analysis.  For distributed applications, the traditional method is to transmit the data to a central computer where it is time stamped using the computer’s clock.  This centralized approach works well for applications where the timing uncertainty created by network and processing latencies are acceptable.

 

For distributed applications that require millisecond-level precision and accuracy, the distributed timebase (DTB) library provides a simple tool for synchronizing the local timebase on each I/O node.

 

The DTB library also addresses the following requirements for distributed system synchronization:

  • Operation that is relatively insensitive to network delays
  • Behavior that is suited for accurate elapsed-time calculations (no discontinuities, sharp accelerations or reversals of time)
  • Flywheel operation in the absence of a time reference

 

Implementation

 

The distributed timebase (DTB) library is implemented as two processes.  The time reference process can run on any network node.  It generates a UDP packet once per second containing the master time value.

 

 

The timebase process runs wherever a synchronized local timebase is required (typically on I/O nodes).

 

The time reference and timebase processes are based on the LabVIEW millisecond tick timer, which is a relatively stable and reliable timing source that is available on most LabVIEW targets.

 

Programming Interface - Using the DTB

 

The DTB library includes 5 public VIs.

Time Reference Process VIs

  • Time Reference VI – Generates the UDP time packets.
  • Abort Time Reference VI – Terminates the time reference process.

Timebase Process VIs

  • Timebase VI – Receives the UDP packets and synchronizes the local timebase.
  • Abort Timebase VI – Terminates the timebase process.
  • Get Time VI – Gets a current timestamp.  This VI is used in the application code.

 

Examples

 

The following examples demonstrate how to use the DTB library VIs.

 

Time Reference Application

 

The time reference process can run as part of the application on any network node.  There should only be one active time reference process in the system.  The Time Reference VI runs in parallel with other application code.   It can be dropped outside of other programming structures on the diagram of the top level VI.

 

The Abort Time Reference VI is used in the cleanup phase of the application code to terminate the time reference process.

 

 

I/O Node Application

 

The Timebase VI runs in parallel with other I/O node application code.   It can be dropped outside of other programming structures on the diagram of the top level VI.

 

The Abort Time Reference VI is used in the cleanup phase of the application code to terminate the Time Reference process.

 

 

 

Limitations

 

There are a few limitations that you should be aware of when using the DTB library.

 

  1. The time reference must be running to initialize the I/O node timebases and keep them synchronized.  Once initialized the timebase processes can run for short durations without the time reference (flywheel operation) with minimal timebase error.  In flywheel mode, the relative drift between local timebases will be somewhere in the range of +/-0.2% (about +/- 7 seconds per hour)
  2. The time reference and I/O nodes must be on the same subnet.  LabVIEW RT does not support UDP multicast, so the DTB library uses UDP broadcast mode to distribute the time packets.
  3. CPU loading at the I/O node can introduce jitter in the local timebase.  To minimize this effect, the Timebase VI is implemented with a timed loop running at priority = 100.  For data acquisition applications this should work well.  For control applications, you may need to make careful tradeoffs between timebase and control loop jitter.

 

Additional information on features and licensing are available in the ReadMe file.

 

Feedback

 

This example was created by the NI Systems Engineering group. You can give us feedback by posting questions and comments below.

 

References

 

Choosing a CompactRIO Synchronization Technology

Configuring IEEE 1588 Synchronization with the NI PXI-668x Timing and Synchronization Module

Configuring GPS Synchronization with the NI PXI-668x Timing and Synchronization Module

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
Comments
James_McN
Active Participant Active Participant
Active Participant
on

Always interesting to see a new reference design.

What is the advantage of this though over PTP?

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
Christian_L
Active Participant
Active Participant
on

Actually this is an older example that was moved from Developer Zone (ni.com) to NI Community. You are correct that PTP is probably the synchronization preferred method at this point. I will add a note to this effect.

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX