DDS clock configuration

3 posts / 0 new
Last post
Offline
Last seen: 3 years 11 months ago
Joined: 12/17/2019
Posts: 3
DDS clock configuration

If I understand correctly, DDS use two clocks: internal clock and external clocks. They are both set by defult in "realtime" mode. They are not synchronized by default across Domain Participants, but the DDS can still perform well. Is that correct? 

To synchronize the clocks, I can't use RECEPTION_TIMESTAMP, and I should use SOURCE_TIMESTAMP, is that correct? 

Based on the link, clocks generally track the number of seconds. Does it mean that, even if synchronized, the synchronization resolution is 1s? In the link, "on Windows CE platforms, we use GetTickCount()", what is the scale factor between tick and seconds?

Would appreciate if anyone could help to provide some comments to any one of the questions! 

 

 

 

Organization:
Keywords:
Offline
Last seen: 3 years 11 months ago
Joined: 12/17/2019
Posts: 3

A following question is, does MATLAB DDS blockset has some functionalities to achieve synchronization? 

FYI, the MATLAB DDS support is detailed here (link).

Offline
Last seen: 4 weeks 6 hours ago
Joined: 04/23/2014
Posts: 58

Hi UniLight,

Connext DDS has 2 different clocks as you mentioned, and by default, both of them are set to realtime.

This realtime clock points to the actual time of the system. If we use this clock in the Connext DDS internal and external clocks within the same machine, both Connext DDS clocks show the same timestamp. This means that they both are synchronized. However, if we are communicating 2 different machines, their 2 different realtime clocks might or might not be synchronized. So the timestamp produced from different machines might be different. DDS does not synchronize the real clocks between machines, the user should do it manually or by using one synchronization protocol.

A problem may appear if 2 different machines are not synchronized and we set the destination order to DDS_BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS. In this case, the timestamp of the sample will be set in the origin and it is different from the destination. DDS cannot rely on the times because both machines are not synchronized. Therefore, inconsistent behavior may appear (samples from the past, samples from far in the future...).

In this case, if the synchronization is not possible, you may want to use the monotonic clock. This clock provides times that are monotonic from a clock that is not adjustable. This clock is not subject to changes in the system or realtime clock. However, this clock’s time generally starts from an arbitrary point in time, such as system start-up.

Once explained the Connext DDS clocks, I would like to understand what is the use-case you are implementing.

The resolution of clocks depends on the architecture (OS + hardware). You may want to create a quick test to measure time. Eg. Linux uses this function to measure time http://man7.org/linux/man-pages/man2/gettimeofday.2.htmlThe time representation in DDS uses this data type: https://community.rti.com/static/documentation/connext-dds/6.0.1/doc/api/connext_dds/api_cpp/structDDS__Time__t.html

About MATLAB programs, they behave in the same way that any other Connext DDS program 

For further information about clocks visit: Clock Selection section in our User's Manual

 

I hope this is useful,

Angel