Preparing your system

This section describes which tools you ‘ll want to get. They should allow you to follow along nicely. These are:

  • A PC running windows or linux. OPyCua is developped on debian Squeeze. It should run on any platform with support for Python.
  • A fairly recent version of Python . We’re using Python 2.6.6. Python 3 is untested, but might work just fine.
  • The python Construct module . Construct is a parser for binary data. It has some advantages over struct.
  • Wireshark with the OPC ua dissector

Note

  • The OPC ua dissector is included with wireshark as from version 1.6.x
  • Debian squeeze uses wireshark 1.2.11. A possible workaround is running wireshark in a chroot as described on the old wiki: schroot .
  • An OPC ua client and server.

Talking OPC ua

To test the communication with a real world server, we use the following setup:

+-------------+             +-------------+
| Windows Box |             | Debian Box  |
| with OPC UA |<--network-->| with OPC UA |
|   Server    |             |    Client   |
+-------------+             +-------------+

There are some (alot of) free OPC UA servers and clients available. Pick one from this list of OPC UA products at the OPC Foundation website.

We’ll be using the free client and server from Unified Automation GmbH. To download, you’ll have to register. The client is available for both windows and linux. The server is only available for windows.

To configure the client to talk to our experimental server. Go to menu Server > Add and switch to the advanced tab. There you can enter the Endpoint URL. If you are running server and client on the same machine, you can find the endpoint url in the uaExpert server window. If the server runs on a different PC, you should use an endpoint URL like:

opc.tcp://192.168.0.1:4840

where 192.168.0.1 is the IP address of the pc running the server and 4840 the port used by the server.

Note

  • Make sure you use SecurityPolicy None. Otherwise wireshark can’t decode your packets.
  • By default, the server uses port 4841, not the standard 4840. Because of this, wireshark won’t decode the packets correctly. You can either change the port of your server, or (easier) change the port in Wireshark (go to edit > preferences and find the opc ua protocol)

Table Of Contents

Previous topic

Introduction

Next topic

Hello world!

This Page