Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behaviour when settings cRIO system clock

I noticed some strange behaviour when setting the cRIO system clock using the function: rt_set_time_sub_second.vi (found in the forums).

 

1. I ask the current time offset from a SNTP server.

2. I set the clock with "system time" + offset ("system time" is retrieved just before setting the time) (this takes 10-30 ms)

3. I ask the current time offset from a SNTP server after 2 minutes (sometime the offset is nearly zero as expected, but sometimes the offset differs up to 2-3 seconds from the previous offset.

 

It seems as if some system service is causing this because changes in order and extra sleeps don't seem to influence this behaviour.

 

Can anyone please shed some light on this issue?

Regards,
André (CLA, CLED)
0 Kudos
Message 1 of 15
(5,106 Views)

Hi André:

 

When using SNTP on a cRIO, it should synchronize with the time server once on power up and then start making incremental changes in the processor clock after that to keep the time synchronized.  From my experience, manually setting the time can cause the cRIO to lose synchronization but I really haven't investigated the behavior too much.  Generally speaking there shouldn't be any need for manually updating the time later on as long as the cRIO stays connected to the time server.

 

Can I ask what your use case for manually adjusting the time is to understand if there are any better methods for your application?

Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 2 of 15
(5,098 Views)

Hello Alex,

 

I don't use the SNTP service available in the cRIO system, because I can't oversee what the it will do when the connection to the server is lost for a period large enough for the cRIO to drift past the boudaries of the SNTP clock diciplining algoritm.

 

I have my own function that requests the offset from the SNTP server, it also checks for response validity as defined in the RFC, taking the best of 5 each request.

Due to this I need to manually update the system clock to account for the drift, but doing this disruptes the time even more than before the update.

 

I hope this sheds some light on my needs and challenges.

Regards,
André (CLA, CLED)
0 Kudos
Message 3 of 15
(5,091 Views)

What CompactRIO are you using along with what version of LV and NI-RIO?

National Instruments
RIO Embedded Hardware PSE

CompactRIO Developers Guide
0 Kudos
Message 4 of 15
(5,087 Views)

Hello Andrew,

 

I use LV 2011 with NI-RIO 4.0 on a NI-9014 controller.

Regards,
André (CLA, CLED)
0 Kudos
Message 5 of 15
(5,083 Views)

Is there already some news regarding the issue?

Regards,
André (CLA, CLED)
0 Kudos
Message 6 of 15
(5,063 Views)

Hi,

 

Did you check that?

http://zone.ni.com/devzone/cda/epd/p/id/5846

 

regards,

 

0 Kudos
Message 7 of 15
(5,049 Views)

The link you gave is the source I got the VI from that I use to set the system time.

 

It doesn't answer my question.

Regards,
André (CLA, CLED)
0 Kudos
Message 8 of 15
(5,047 Views)

Hi Andre,

 

Sorry for asking more questions, without providing a solution, but have you tried other SNTP servers? Also have you tried setting the time stamp manually (either through MAX or just regular date/time write in LV) without using SNTP and measuring the drift?

 

Regards,
Andrew

National Instruments
RIO Embedded Hardware PSE

CompactRIO Developers Guide
0 Kudos
Message 9 of 15
(5,038 Views)

Hello Andrew,

 

I only used the SNTP to show in what context I use the "rt_set_time_sub_second.vi" and to determine the current offset to precise timing source.

 

The behaviour is displayed when I call this particular VI to set the time.

 

Normal behaviour would be:

- set time to current time minus 1 second -> offset relative to time server should be -1 second.

- again set time to current time minus 1 second -> offset relative to time server should be -2 seconds.

- etc.

 

This is not the case, I follows an unpredictive pattern.

 

The attached VI snippet (don't look at the style 😉 it is to get all code in 1 VI for easy posting) contains the functional code required.

Regards,
André (CLA, CLED)
0 Kudos
Message 10 of 15
(5,033 Views)