Sync Labs

cancel
Showing results for 
Search instead for 
Did you mean: 

NI TimeSync: Custom Time Reference Getting Started

NI-TimeSync Custom Time Reference (Labs): http://ftp.ni.com/support/softlib/Timing_Sync/Labs/NI-TimeSync/NITimeSync1_2_d15.exe

Description: The NI-TimeSync Custom Time Reference enables you to synchronize your RT target's clock with any custom time reference using LabVIEW.

Installation Instructions:

Warning: This self-extracting executable installs NI-TimeSync 1.2 and will overwrite any previous version of NI-TimeSync installed on your system. If you want to downgrade to a released version of NI-TimeSync, you must uninstall NI-TimeSync 1.2 and reinstall NI-TimeSync from the original media.

    1. Run NITimeSync1_2_d15.exe

    2. Launch Measurement & Automation Explorer (MAX).

    3. Expand your target in the tree view and click Software.

    4. Click the Add/Remove Software button to display the LabVIEW Real-Time Software Wizard.

    5. Follow the prompts to install NI-TimeSync Custom Time Reference 1.2.0 to the target.

0 Kudos
Message 1 of 8
(14,052 Views)

Hello,

Is it possible to have more information (or example) about the use of the custom time reference ?

We are receiving the clock reference  in a UDP packet (proprietary protocol) and we need to synchronize the system time with this clock reference.

We have installed the NI TimeSync 1.2d15 but we don't know what we need to do to use the custom time refrence.

Thanks for your help

Hubert

0 Kudos
Message 2 of 8
(9,396 Views)

Hello Hubert,

I apologize for the lack of detail and the missing example. We previously had an example but it fell out of date and we removed it to avoid confusion. We want to update the example and repost it, but haven't been able to do so yet.

I can try and give you a good explanation of what you need to do to use the custom time reference.

The custom time reference installs an TimeSyncAdjustTime.vi that you use to interface with the system time. This vi is found under Functions/Programming/Structures/Timed Structures/Absolute Time/TimeSyncAdjustTime.vi

The TimeSyncAdjustTime.vi takes two input timestamps.

1. Slave timestamp

2. Master timestamp

These timestamps should record the same instant of time as seen from the slave(system time of the RT controller) and the master(external time reference from over the network)

Typically you will set up a timed loop( 1x second rate) and obtain a time from your external protocol. You then immediatly get a timestamp from the local system, and feed both of these timestamps into the adjustTime.vi

That is all that you need to do to sychronize the system time although I would call out a few things that you need to pay attention to.

1. The latency/jitter between getting the Master timestamp and Slave timestamp will have a large impact on level of sychronization you can acheive. Using a sequence structure with nothing else in that same sequence as these actions may help minimize the impact.

2. Depending on the protocol you are coming from you may need to do some funny conversion to construct a LV timestamp properly. Different time sources often have different Epochs, which means they count time from a different point in time. For example your protocol may be distributing the number of seconds since Jan 1 1970, but LV timestamps use an epoch of Jan 1 1904.

3. Some time references take leap seconds(http://en.wikipedia.org/wiki/Leap_second) into account and some don't. This could lead to a offset by an a handful of seconds.

UTC - does.

GPS, TAI - do not

Message 3 of 8
(9,396 Views)

Here is the basic idea of how to use the custom time reference.UsingCustomTimeReference.png

And here is an example about converting between Epoch. The corrected time will show  Sept 11, 2012, but the uncorrected time will show some date in 1946.

Converting Epochs.png

--Daniel

Message 4 of 8
(9,396 Views)

Hello Daniel,

Thanks for your quick and very clear answer. It is exactly what we need.

At this time, we are using PTP to synchronize the system time between two PXI systems. Now we need to add a synchronization with another system which sends its date and time in UDP packets.

Is it possible to configure one of the PXI system to synchronize to the external reference and to generate a PTP master clock for the second PXI ?

As I mentionned in another discussion (SNTP TimeSync), our last problem is with VeriStand which doesn't accept a too high drift on the system clock (error code: -307732 NI VeriStand : The system has become unresponsive. The primary control loop has been shut down. We will need to add controls before to call the TimeSyncAdjustTime.

Regards,

Hubert

0 Kudos
Message 5 of 8
(9,396 Views)

Hello Hubert,

We might have some possible solutions/options for you, but I think this might be easier/more quickly resolved offline. Could you email me so we can continue the conversation?

--Daniel

0 Kudos
Message 6 of 8
(9,396 Views)

I have been facing an issue with my custom time sync implementation.  For some reason or another, the sync offset never converges reliably to less than +/-6ms, no matter how stable the reference source.  The oiffset just continuously cycles slowly between about +6ms and -6ms (Somewhat sinusoidally).  I am using the recommended sequence structure.

TimeSync_Nonconvergence.png

What does it take to get the plugin to converge?

My time reference (External UDP packet) comes in at 500ms intervals with < 20us of jitter.

0 Kudos
Message 7 of 8
(9,396 Views)

A hint from LindW seems to have cured my Custom Timekeeper convergence issues.  Simply setting the Time Reference Valid plug-in property to write mode and setting it to False appears to reset the timekeeper's internal state and helps it converge in all situations I've been able to test against.

TimeSync_Convergence.png

The VI I use (I had to redact the time souce unfortunately.  It's a UDP message which comes from a very accurate embedded PC).  I found that if a sync is applied when Time Reference Valid = False, this will crash the plug-in requiring a restart of my PXI chassis.

Custom Timekeeper Sync VI.png

This is called from a LabView RT timed loop with fairly high priority (To minimize potential delays being inserted in between the UDP receive and local time stamp generation/application).

I hope this helps anyone else attempting to use the custom sync source.  I am also hoping Sync Labs will make this part of the released version of Time Sync or at least update it for LV 2014+.

Message 8 of 8
(9,396 Views)