MasterDemo

1,379 views
Skip to first unread message

Tommi

unread,
Oct 5, 2015, 6:46:21 PM10/5/15
to automatak-dnp3
So I have compiled opendnp3 on my raspberry pi, also I located the main.cpp from dnp3/cpp/examples/master. I did a few changes on the file like the IP address, and when I tried to compile it, it's telling me I'm missing a library, do I have to manually link the libraries I compiled for dnp3 from /usr/lib?

J Adam Crain

unread,
Oct 6, 2015, 10:33:06 AM10/6/15
to automatak-dnp3
Hi,

The demos build using cmake. This should automatically link the correct libraries. It doesn't link the ones in /usr/lib, it directly links the ones created in the build.

If you creating your own application outside of the opendnp3 build system, you must manually specify the libraries to link. You can see this reflected in the build script for the pifacertu exe:

https://github.com/automatak/pifacertu/blob/master/CMakeLists.txt#L17

The part that says "asiodnp3 opendnp3 asiopal openpal" is the 4 libraries that need to be linked for basic dnp3 support.

This causes cmake to put "-lasiodnp3 -lopendnp3 -lasiopal -lopenpal" on the command line for GCC.

If you're still having trouble, please post the linking error you get.  Part of the problem may be that opendnp3 has optional components (TLS and secure authentication), and if you built the
libraries with support for these, you have to link additional libraries. I could see this causing confusion, and I've made a note to add a section on linking to the guide.

-Adam

Tommi

unread,
Oct 6, 2015, 6:20:15 PM10/6/15
to automatak-dnp3
Hi Adam,

Thank you for updating the guide, that made thing a much more clear. I ran the master-demo executable, and was able to have a connection. What if i want to create my own specific channel? What do I need to do toward the MasterDemo, will changing the IP address from the TCP Client section establish a connection between master and slave? Sorry I'm fairly new to this opendnp3 branch.

J Adam Crain

unread,
Oct 7, 2015, 1:24:28 PM10/7/15
to automatak-dnp3
Hi,

Yes, that's correct. You need to change the IP address:

https://github.com/automatak/dnp3/blob/2.0.x/cpp/examples/master/main.cpp#L51

Change the "127.0.0.1" to the IP address of your raspberry PI.

The other two important parameters are the link layer addresses for the master and outstation. The pifacertu (outstation) is using the default addresses (1/1024 respectively), but the demo is using (1/10). Comments out these two lines:

https://github.com/automatak/dnp3/blob/2.0.x/cpp/examples/master/main.cpp#L71

Alternatively, I would recommend that you install this test graphical test harness:

https://automatak.com/opendnp3/simulator/setup.msi

You can use this to control your RPI more interactively! It will make send the controls as easy as pressing a button.

-Adam

Tommi

unread,
Oct 8, 2015, 4:48:40 PM10/8/15
to automatak-dnp3
Hi Adam,

In the case you explained, does that mean the raspberry pi is the master and piface is the outstation? What if I want to send signal from the piface through RPi to my laptop, will that make my laptop become the master and RPi and Piface become outstations? Will this be the multi drop? Also I was playing around with the demo provided commands, and for some reason I could no longer get the connection from the server. I re-compiled with the original demo file but still no luck. I tried gdb master-demo and here is a screeshot of it.
2015-09-26-130421_1872x1168_scrot.png
Message has been deleted

Davis

unread,
Oct 8, 2015, 6:50:38 PM10/8/15
to automatak-dnp3
actually scratch that connection error problem, I change the port address to 1024 and had a connection between piface and RPi, although I still have question how to get the connection to my laptop as stated from the last comment

J Adam Crain

unread,
Oct 9, 2015, 11:36:58 AM10/9/15
to automatak-dnp3
I am a little confused by making a distinction between the pi and the piface. These are both components of the outstation.

You want this listening on port 20000 on all adapters (0.0.0.0), which is the current default for the pifacertu program.

Then, on your laptop, you want to run a modified masterdemo or the graphical simulator I sent you the link to.

You configure one of these with the IP address of the raspberry pi to connect to it.

Is this making sense? Am I answering the wrong question?

-Adam

Davis

unread,
Oct 9, 2015, 3:01:23 PM10/9/15
to automatak-dnp3
Yea I think I got a little confused when pairing up with the Piface, does this mean i need to run outstation demo on Pi so it will link with pifacertu? And run master demo on my laptop to receive signals?

Correct me if I'm wrong, I assume Piface will send senors data to RPi, and RPi compiled the data into dnp3 protocol which then my laptop will be able to receive it, is this how it works?

J Adam Crain

unread,
Oct 9, 2015, 3:13:57 PM10/9/15
to automatak-dnp3
I think I understand the confusion now. To answer your questions:

1) No, you do not need to run the outstation demo on the RPi. The pifacertu is a fully self-contained DNP3 outstation that executes on the RPi. It does everything the outstation demo does, but with actual I/O.  It uses "libpiface" to communicate to the piface daughter board to read the inputs and toggle relays/outputs. It basically coordinates the piface board with DNP3.  The pifacertu executable is the outstation.

2) You are correct. You run a DNP3 master on another system to receive the signals or send controls.

Davis

unread,
Oct 9, 2015, 3:27:50 PM10/9/15
to automatak-dnp3
Hi Adam,

Thank you for answering my questions, now this make so much more sense now, one more question though. As you mentioned, I will have to run DNP3 master on my laptop, do I have to compile the master-demo on windows or I need to convert the master-demo executable into a windows acceptable format? Or simply just get the cpp file of the demo and run it on windows will do the trick? 

On my laptop, I will have my another program/system listening with DNP3 protocol, will this make any different?

J Adam Crain

unread,
Oct 9, 2015, 3:44:13 PM10/9/15
to automatak-dnp3
The executable you compiled on desktop linux or the RPi will not run on Windows. Yes, you would have to build opendnp3 on windows.

This is why I was recommending that you use the graphical simulator on Windows:

https://automatak.com/opendnp3/simulator/setup.msi

It has an installer like any other Windows software.

Alternatively, you could use any 3rd party DNP3 master software to communicate with your RPi via DNP3.

You can also build opendnp3 for windows, but it will be another learning process.

-Adam

Davis

unread,
Oct 9, 2015, 4:11:43 PM10/9/15
to automatak-dnp3
Hi Adam,

I think there is something wrong with the simulator as when I open it, it will give an error msg. (error msg attached)

As I enter the IP Address to Link with my RPi on my third party software, pifacertu keep giving me this warning.

"WARN outstation - Unsolicited confirm timeout"
"WARN server - Frame w/ unknown route, source : 10, dest 1 - 13"
"WARN outstation - Link status request - response time out"

what does it mean?
errormsg.jpg

Davis

unread,
Oct 9, 2015, 4:13:30 PM10/9/15
to automatak-dnp3
Okay, scratch that, the problem occurred because I was using 1/10 instead of 1/1024, now it's working :)

J Adam Crain

unread,
Oct 9, 2015, 4:15:10 PM10/9/15
to automatak-dnp3
Yup. It's just incorrect address configuration.

To get the simulator working install the C++ runtime for windows:

Reply all
Reply to author
Forward
0 new messages