by Piotr P. Nikiel piotr@nikiel.info
Quasar is an open-source framework for rapid creation of OPC-UA software components.
Poverty (this project) is an extension module of Quasar. It solves the problem of loading your quasar-made OPC-UA servers from a Python program with a Python interface which supports:
- controlling the server (start it, stop it, etc ...)
- "operate" its Address-Space, i.e. publish data via OPC-UA from that Python program or read the cached data.
Note: tested with quasar version nebula.B1 (shall correspond to 1.5+)
- Steps to do in your quasar project
- add
-fPIC
in theadd_definitions
of your build config - in
ProjectSettings.cmake
(root of your quasar project):- set
BUILD_SERVER_SHARED_LIB
toON
. - add
Poverty
toCUSTOM_SERVER_MODULES
. - add
python3
toADDITIONAL_BOOST_LIBS
. - set
POVERTY_STRICTLY_PYTHON3
in case your system can have both python2 and python3 (most systems). I.e. your system needs to havepython3-config
command visible!
- set
- Poverty current only works with open62541 backend of quasar. Thus if you are with UA-SDK, switch to open62541.
- add
- clone Poverty (this GitHub repo) in your quasar project, or add it as a git submodule,
- build your OPC-UA server (e.g.
./quasar.py build
)
To test it:
- in your quasar project, copy the test python script
Poverty/extra/test.py
intobuild/bin
- copy, or symlink,
build/Poverty.so
intobuild/bin
- run the test program:
python3 test.py
You need the following files in your target application:
- Poverty.so (builds in build/Poverty)
- libOpcUaServer.so (builds in build/bin)
- the particular config file of the server (which has instanced of quasar objects ...), normally called config.xml
- the particular ServerConfig.xml where stuff like endpoints and OPC-UA certificates are defined.
There are reasons to use Poverty rather than a pure-Python OPC-UA solution:
-
by embedding a quasar made server, you enter the quasar ecosystem which will bring you benefits of other quasar modules. For example, you could quickly do WinCC OA integration (Cacophony quasar module) or generate C++ clients (UaObjects for Quasar) or so.
-
by making a quasar-based OPC-UA you use carefully tested OPC-UA components, same as these used in for example LHC experiments controls at CERN.
There are also reasons that might prevent you from using Poverty:
- currently, there is no possibly of any call-backs into Python.
- some data types are not supported from Python yet, for example OPC-UA arrays.