Time Synchronization

390 views
Skip to first unread message

Abhi

unread,
Nov 29, 2017, 3:35:49 PM11/29/17
to automatak-dnp3
Hi Adam,

First of all thanks for all the support you provide here. I have gone through the forum which answered many of my questions but have a few follow-up questions.

  1. SYNCHRONIZED/UNSYNCHRONIZED TIME-STAMP
    When I configure a binary input change to Grp2Var3, I see an unsolicited reply with a Time and Date CTO Object, Grp50Var1. I am assuming that this time is taken from the object itself and the relative time is calculated based on the CTO time selected.
    1. In case of multiple objects, How does opendnp3 select the source of this time object?
    2. Is there a way to trigger the outstation to send Grp50Var2? I set the NEED_TIME bit in the outstation but the outstation still sends Grp50Var1 i.e SYNCHRONIZED time-stamp.

  2. LAN time synchronization
    From the specification, I understand that the master sends a RECORD_CURRENT_TIME request. At this point the master starts a timer and the outstation starts a timer/save current time as soon as possible when it receives this request.
    1. Is this internally taken care by OpenDNP3?
    2. If not, Is there a call back function available when the outstation receives a RECORD_CURRENT_TIME request ?
    3. Is there any bias already added to the time we receive in the outstation application function "writeAbsoluteTime"

  3. NON-LAN time synchronization
    1. I have the same questions for this type of synchronization.
    2. Is there anyway to differentiate writeAbsoluteTime function based on whether it was LAN or NON-LAN time synchronization ?

  4. Outstation Time
    This is just to verify that my understanding is correct.
    The DNP3 outstation doesn't have an internal clock. It uses the time stamp saved with the objects to send unsolicited events.
    The writeAbsoluteTime function should be used to update the clock being used to write the time-stamp to the objects.

Thanks,

Abhi


J Adam Crain

unread,
Dec 1, 2017, 9:47:56 AM12/1/17
to automatak-dnp3
Hi Abhi,


On Wednesday, November 29, 2017 at 3:35:49 PM UTC-5, Abhi wrote:
Hi Adam,

First of all thanks for all the support you provide here. I have gone through the forum which answered many of my questions but have a few follow-up questions.

  1. SYNCHRONIZED/UNSYNCHRONIZED TIME-STAMP
    When I configure a binary input change to Grp2Var3, I see an unsolicited reply with a Time and Date CTO Object, Grp50Var1. I am assuming that this time is taken from the object itself and the relative time is calculated based on the CTO time selected.
    1. In case of multiple objects, How does opendnp3 select the source of this time object?
    2. Is there a way to trigger the outstation to send Grp50Var2? I set the NEED_TIME bit in the outstation but the outstation still sends Grp50Var1 i.e SYNCHRONIZED time-stamp.

This is a limitation of the current implementation, it doesn't track whether the time-stamps are synchronized/unsynchronized. There's been a ticket open for a while:


 

  1. LAN time synchronization
    From the specification, I understand that the master sends a RECORD_CURRENT_TIME request. At this point the master starts a timer and the outstation starts a timer/save current time as soon as possible when it receives this request.
    1. Is this internally taken care by OpenDNP3?
    2. If not, Is there a call back function available when the outstation receives a RECORD_CURRENT_TIME request ?
    3. Is there any bias already added to the time we receive in the outstation application function "writeAbsoluteTime"

It's all taken care of internally. The value you get back for writeAbsoluteTime could come from the LAN or non-LAN proceedures, and is the calculated value for either procedure. We could potentially add a way to differentiate.
 

  1. NON-LAN time synchronization
    1. I have the same questions for this type of synchronization.
    2. Is there anyway to differentiate writeAbsoluteTime function based on whether it was LAN or NON-LAN time synchronization ?

  2. Outstation Time
    This is just to verify that my understanding is correct.
    The DNP3 outstation doesn't have an internal clock. It uses the time stamp saved with the objects to send unsolicited events.
    The writeAbsoluteTime function should be used to update the clock being used to write the time-stamp to the objects.

Correct. It's up to you to apply timestamps and to track "time" in your application.  The stack will never change the system clock.

I wouldn't change the system clock either, it can really mess up other applications. Instead, consider saving an offset from DNP3 time to the system time and use that to calculate your timestamps.

 

Thanks,

Abhi


Abhi

unread,
Dec 5, 2017, 9:37:28 AM12/5/17
to automatak-dnp3
Adam,

Thanks for answering my questions.

I assume the implementation to track whether the time-stamps are synchronized/unsynchronized would be straight forward. The trigger can be put in place in the Outstation application and called to set/reset the synchronized flag. I would like to implement it, but was not able to find where in the code, the CTO is added to the Write buffer. Could you please provide some indication on how to proceed on this?

Best,
Abhi

J Adam Crain

unread,
Dec 5, 2017, 11:46:08 PM12/5/17
to automatak-dnp3
Hi Abhi,

You wouldn't add a synchronized/not-synchronized callback. Instead, you would have a such a flag on each measurement event you load, i.e. here:


Time may currently be synchronized, but a previously loaded event would still need to be reported as "not synchronized at the time of the event".

The code for writing CTO event responses is here:


-Adam

Abhi

unread,
Dec 13, 2017, 7:02:04 PM12/13/17
to automatak-dnp3
Hi Adam,

I noticed that you have this issue open on Github from a long time. I am trying to gauge if it is worth spending time trying to implement this and other DNP3 features and which one to attempt first. Could you please guide me in regard to how widely(never, rarely, most often, often) these features are used in the Industry ? Some of the features I am interested in are :

1. Synchronized/Unsynchronized Time
2. Common local listen ports for multiple masters
3. TCP/UDP hybrid behavior
4. Dual endpoint behavior

Best,
Abhi

Adam Crain

unread,
Dec 13, 2017, 9:07:02 PM12/13/17
to automatak-dnp3
Sure. comments below.


On Wednesday, December 13, 2017 at 7:02:04 PM UTC-5, Abhi wrote:
Hi Adam,

I noticed that you have this issue open on Github from a long time. I am trying to gauge if it is worth spending time trying to implement this and other DNP3 features and which one to attempt first. Could you please guide me in regard to how widely(never, rarely, most often, often) these features are used in the Industry ? Some of the features I am interested in are :

1. Synchronized/Unsynchronized Time

Technically, this is required for inter-operability. It's one of the last couple of interop issues remaining in the library.

In practice, few systems use this feature b/c there's no requirement to even use g2v3 or g4v3.
 
2. Common local listen ports for multiple masters

Not common. Requires TCP server to map incoming IP addresses. Most DNP3 device only support a single connection per port.
 
3. TCP/UDP hybrid behavior

Rare.
 
4. Dual endpoint behavior

Rare. 
Reply all
Reply to author
Forward
0 new messages