PyUAF - Python bindings for the UAF (Unified Architecture Framework)

Introduction

This documentation is part of the UAF (Unified Architecture Framework) project, which is hosted at http://github.com/uaf.

It documents the Python bindings for the UAF, which is supported on both Linux and Microsoft Windows.

The PyUAF bindings provide a very convenient interface to create OPC UA applications. For instance, an OPC UA variable can be read by a UAF client with just a few lines of Python code:

# examples/pyuaf/client/easiest_client_example.py

# Start the demo server ($SDK/bin/uaservercpp) of Unified Automation before running this script!

import pyuaf
from pyuaf.util             import Address, NodeId
from pyuaf.client           import Client
from pyuaf.client.settings  import ClientSettings

# create a client named "myClient", and provide the discovery URL of the server (uaservercpp):
myClient = Client(ClientSettings("myClient", ["opc.tcp://localhost:48010"]))

# specify the address of the node of which we would like to read its Value attribute:
# (here we're using an absolute address, i.e. a NodeId(<identifier>, <namespace URI>) and a <server URI>)
someAddress = Address(NodeId("Demo.SimulationSpeed",                         # NodeId identifier
                             "http://www.unifiedautomation.com/DemoServer"), # NodeId namespace URI
                      "urn:UnifiedAutomation:UaServerCpp")                   # server URI

# read the Value attribute of the node that we just addressed:
result = myClient.read( [someAddress] )
print("The value is %d" %result.targets[0].data.value)

As you can see, all session management is done automatically for you!

More in general, the UAF takes care of some “technical” aspects of the OPC UA communication (such as Session and Subscription management, server discovery, node resolution, ...) so that you can concentrate on the “functional” aspects of your software application.

Project details

Project website: http://github.com/uaf

Author: Wim Pessemier

Contact: Wxx.Pxxxxxxxx@ster.kuleuven.be (replace the x‘es)

Organization: Institute of Astronomy, KU Leuven (http://fys.kuleuven.be/ster)

API

Indices and tables

This documentation was created using Sphinx.