Tutorials¶
Running the demo¶
In order to evaluate some of the OPC UA - DDS Gateway functionnalities, one can simply download the appropriate archives, available after login into in your neoliant.com account, in the “Licenses & Downloads” section of your account. If you’re using a paid version, you can access the released versions directly on your neoliant.cryptlex.app account (request a password change if this is your first login).
You’ll need :
- opctestserver-[latest].zip
- gateway-[latest].zip
- ddstestsubscriber-[latest].zip
This simple demo connects one ddstestsubscriber application to the opctestserver through the gateway.
One can additionaly connect an OPC UA client like UaExpert to the OPC UA server and change the values of the nodes in the OPC UA address space. These changes reflect as notifications displayed by the subscribing ddstestsubscriber application.
This DDS demo application additionnaly presents the transmission of every OPC UA basic types, in every Variant configuration (single value, array or n-dimensions matrix), as well as Events emitted regularly by the OPC UA server.
Ideally, one should first start the OPC UA server, then the OPC UA - DDS Gateway, then the DDS applications. But the OPC UA - DDS gateway can start without OPC UA connection. It will then try to connect to the configured servers every 2 seconds until connected.
- Start the OPC UA demo server in a first terminal :
$ cd opcserver-[version]
$ chmod a+x ./opcserver-[version].AppImage
$ ./opcserver-[version].AppImage
- Start the OPC UA - DDS Gateway in a second terminal :
$ cd gateway-[version]
$ chmod a+x ./gateway-[version].AppImage
$ ./gateway-[version].AppImage
The OPC UA - DDS Gateway starts, analyzes its configuration, generates and makes IDLs available for using the same data classes in future DDS applications, compiles these IDLs and loads the corresponding classes dynamically. Then the OPC UA - DDS Gateway creates its different DDS Outputs, and, depending on the purchased version, starts different services allowing connected DDS applications to perform RPC-style operations on the OPC UA servers. Finaly, constant DDS Outputs set in configuration are published, and the connections to the OPC UA servers are established.
- Start the ddstestsubscriber demo application in a third terminal :
$ cd ddstestsubscriber-[version]
$ chmod a+x ./ddstestsubscriber-[version].AppImage
$ ./ddstestsubscriber-[version].AppImage -DCPSConfigFile ./ddstestsubscriber-[version].AppImage.home/rtps-udp.ini
After a few seconds the ddstestsubscriber application calls for all kind of services on the OPC UA server, through the use of the opcddsservices library and displays the results. You can observe the replies in the ddstestsubscriber output.
If you start the ddstestsubscriber before the OPC UA - DDS Gateway, you’ll see all the notifications obtained when the gateway subscribes to the different OPC UA nodes and emits constants set in configuration.
You can also see the values passing through the OPC UA - DDS Gateway once it has initialized by modifying the data in the OPC UA demo server. For this, you’ll need an OPC UA client like the free UaExpert from Unified Automation GmbH. Simply modify the value of any test node and you’ll see the corresponding data circulating on DDS and being displayed by ddstestsubscriber.
You can leave any of these applications by pressing Ctrl-C.
Compiling the code of the demo DDS application¶
This tutorial demonstrates setting up a development environment, installing and using the opcddsservices library, integrating the IDLs generated by the OPC UA - DDS Gateway, and compiling a typical DDS application that can not only work as any DDS application in its Domain, but can also interact with neighbouring OPC UA servers thanks to the OPC UA - DDS Gateway…
It can be tested by running the opcserver and the gateway, like in the Running Demo tutorial. But this time you’ll be using your own compiled version of the ddstestsubscriber application.
Development Environment Setup¶
Let’s consider an Ubuntu 20.04 or derivative. First install the following dstribution packages :
$ sudo apt-get update
$ sudo apt-get install -y --no-install-recommends build-essential \
gcc \
pkg-config \
cmake \
python \
libmbedtls-dev \
curl \
wget \
appstream \
zip \
file \
libssl-dev \
libicu-dev \
libxerces-c-dev \
rapidjson-dev \
libglib2.0-dev
$ sudo apt-get install -y git
Then compile and install a fresh local version of Xerces-3.2.3 :
$ cd ~
$ git clone -b v3.2.3 https://github.com/apache/xerces-c.git
$ cd xerces-c
$ mkdir build
$ cd build
$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -Dnetwork-accessor=socket -Dtranscoder=icu -Dmessage-loader=icu ..
$ make -j
$ sudo make install
Finaly compile and install a fresh local version of OpenDDS-3.15 with security support :
$ cd ~
$ git clone --branch DDS-3.15 https://github.com/objectcomputing/OpenDDS.git
$ cd OpenDDS
$ ./configure --prefix=/usr/local --no-debug --optimize --security --no-tests --xerces3=/usr/local --openssl=/usr -std=c++11 --verbose --glib --rapidjson
$ make -j
$ sudo make install
Install opctestserver and the OPC UA - DDS Gateway¶
Please proceed like in the former tutorial.
Generate the IDLs of the data classes transmitted by the OPC UA - DDS Gateway¶
On the system where the OPC UA Gateway is installed, proceed to its configuration, thus defining data types in the <types> section, and start it like in the previous tutorial. Choose your license style, then wait for the initialization to complete. At that point, you can access the directory where gateway-[version].AppImage (where you extracted the downloaded release) resides. The OPC UA - DDS Gateway has generated a “types” directory containing IDL files that can be used by your DDS applcations. Simply copy the ones you need directly to the root of your application sources and configure your build system to use them. We demonstrate the use of CMake.
Install libopcddsservices¶
Copy the downloaded libopcddsservices-0.1.zip archive in your home directory.
$ unzip libopcddsservices-0.1.zip
Compile the Demo ddstestsubscriber¶
First get the ddstestsubscriber source code archive :
$ cd ~
$ git clone https://github.com/neoliant/ddstestsubscriber.git
Then compile the project after the creation of a symbolic link to the extracted library location in its root directory.
$ cd ddstestsubscriber $ ln -s ~/libopcddsservices . $ cd build $ cmake .. $ make
You can see in the provided CMakeLists.txt CMake build configuration file that the IDL files can be included directly and automate their compilation by the OpenDDS compilation suite.
Run ddstestsubscriber¶
While still in the build directory, and having opctestserver and the OPC UA - DDS Gateway running, you can now execute :
./ddstestsubscriber -DCPSConfigFile rtps-udp.ini
You should see the same results as in the Demo Tutorial.
Running the demo in Docker¶
Not available in Trial mode, for Paid Licenses only.
The system(s) running the gateway and the ddstestsubscriber images must have access to the Internet where they can register with the Neoliant floating-license server. We can provide you with a small footprint local server if needed. Contact us if this is the case.
You can simply run the former demo in a Docker Swarm :
If you own a paid version of the OPC UA - DDS Gateway, you can run this demo on docker simply by typing
$ docker run neoliant/opcserver:latest
Then in another terminal
$ docker run neoliant/gateway:latest
And finaly in a third terminal
$ docker run neoliant/ddstestsubscriber:latest