Example C# application?

1,187 views
Skip to first unread message

Kiran Anand

unread,
Feb 9, 2015, 5:07:04 PM2/9/15
to automat...@googlegroups.com
Please do not clobber me, I request your patience.  I am doing a deep dive into DNP3 as part of my PhD Thesis work.  I am in the process of getting hold of the 1815 specs (seems rather expensive at $300-350) so that I can look closely at the nuts and bolts.  I used to represent Intel in the 802.1D working group so I am kinda used to working with the specs and then hunting for answers.

I thought opendnp3 library would be a great tool to learn DNP3.  I am a fairly well-versed C# programmer but I am not good at C++.

Is there hope for me to use the opendn-3 library to write C# applications?

Can I use this library to configure a master on one PC and a slave on another PC and make them talk to each other via ethernet or serial?

Is there an example program that exists?  I notice that one has to do a build of sorts to even access the docs.

Any help would be highly appreaciated.

J Adam Crain

unread,
Feb 9, 2015, 5:38:24 PM2/9/15
to automat...@googlegroups.com
What?! You didn't RTFM?!

I'm just kidding. We don't clobber people here. Answers inline below.

I'd also be very interested in hearing how DNP3 ties into your thesis work.

-Adam


On Monday, February 9, 2015 at 5:07:04 PM UTC-5, Kiran Anand wrote:
Please do not clobber me, I request your patience.  I am doing a deep dive into DNP3 as part of my PhD Thesis work.  I am in the process of getting hold of the 1815 specs (seems rather expensive at $300-350) so that I can look closely at the nuts and bolts.  I used to represent Intel in the 802.1D working group so I am kinda used to working with the specs and then hunting for answers.

Yeah, a copy is pretty indispensable for doing anything with the protocol. Oddly enough, you can get a copy from two places.

1) IEEE (328$ for members or 410$ non-members)
2) www.dnp.org for 300$

Get a copy from 2) by purchasing 1 year basic membership to the users group. The history as to why this is the case is complex, but it's a better deal in that it also grants you access to their forum.

I thought opendnp3 library would be a great tool to learn DNP3.  I am a fairly well-versed C# programmer but I am not good at C++.

Is there hope for me to use the opendn-3 library to write C# applications?

I think so, but I'm biased since I wrote it. We have lots of production C# users on the list. They tell me it's nicer to use than the commercial libraries available.
 

Can I use this library to configure a master on one PC and a slave on another PC and make them talk to each other via ethernet or serial?

Is there an example program that exists?  I notice that one has to do a build of sorts to even access the docs.

Yes, there are example master/outstation programs for both C++ and C# that will allow you to do exactly this:


On Windows, they are both part of the SLN file.

The companion documentation is actually hosted here:


Be advised that there will be inconsistencies in the API, since it hasn't been updated yet for the current version, but it will help you with building, dependencies, and talk about the API from a high level.

Kiran Anand

unread,
Feb 13, 2015, 12:04:34 PM2/13/15
to automat...@googlegroups.com
:-)  Great!  Thanks so much for all the information Adam!  I also read your slides on the C++ myths at that Indianapolis do and enjoyed them!  I don't know if you know Bruce Eckel (Thinking in C++) but I met him once at a company training and he autographed my copy of his book.  So I kind of identify with the context of your slides regarding C++ suitability for embedded systems.  By the way, I am an embedded systems programmer (1994-current).

At this point in time I know that my thesis is going to be on industrial network protocols and I have narrowed down two of them, DNP3 and Ethercat.  I am looking to find techniques to improve data throughput and/or security.  This means I need to really understand the protocols well and hence the start of this journey.  My advisor has a record on split protocols, i.e. improving throughput in TCP/IP by splitting server responses between more than one machine.  I may be looking to apply this in some way to the protocols I have chosen but this is not a given because as you might know, ethernet on industrial protocols currently (Profinet for eg) has differences with our standard IEEE 802.1D definitions.

So this is more or less the start of the journey.  I will definitely keep you posted.

Adam Crain

unread,
Feb 13, 2015, 2:34:56 PM2/13/15
to automat...@googlegroups.com
On Friday, February 13, 2015 at 12:04:34 PM UTC-5, Kiran Anand wrote:
:-)  Great!  Thanks so much for all the information Adam!  I also read your slides on the C++ myths at that Indianapolis do and enjoyed them!  I don't know if you know Bruce Eckel (Thinking in C++) but I met him once at a company training and he autographed my copy of his book.  So I kind of identify with the context of your slides regarding C++ suitability for embedded systems.  By the way, I am an embedded systems programmer (1994-current).

Yeah, I'm hopeful that Clang/LLVM will drive more C++ into embedded over the next 5 years. Manufacturers get better integration and optimization if they invest in this improved future.

The argument in the past has always been "C++ is complex and C guarantees we are supported", but that argument is moot if all you have to do to support MCU xyz is write a language agnostic backend that converts LLVM -> platform.
 

At this point in time I know that my thesis is going to be on industrial network protocols and I have narrowed down two of them, DNP3 and Ethercat.  I am looking to find techniques to improve data throughput and/or security.  This means I need to really understand the protocols well and hence the start of this journey.  My advisor has a record on split protocols, i.e. improving throughput in TCP/IP by splitting server responses between more than one machine.  I may be looking to apply this in some way to the protocols I have chosen but this is not a given because as you might know, ethernet on industrial protocols currently (Profinet for eg) has differences with our standard IEEE 802.1D definitions.

Ok, cool. DNP3's biggest problem is complexity and lack of server-side scalability. The DNP3 server (outstation) maintains unique buffers for each master and a complex song and dance is required to keep everybody synchronized. If I were designing a SCADA protocol from scratch, I'd make the server stateless by having incrementing IDs on all events. This way the state is moved to the client and the server is simple and scalable for embedded systems. It also has the advantage that if you lose events, you know exaclty what you missed and how many.
 

So this is more or less the start of the journey.  I will definitely keep you posted.


Good luck. 

Kiran Anand

unread,
Feb 13, 2015, 6:23:22 PM2/13/15
to automat...@googlegroups.com

Your thoughts about the stateless server are valuable.  Thanks for sharing that.  I will keep that in mind as I work on my thesis.

-Anand 
Reply all
Reply to author
Forward
0 new messages