Skip to main content
Version: 3.6.0

OPC-UA Source

The Tributech OPC-UA Source allows to connect to an OPC Unified Architecture (UA) server and receive data. The Tributech OPC-UA Source acts like a OPC-UA Client in a docker environment and enables the forwarding of the data to a Tributech Agent stream.

Setup

The Tributech OPC-UA Source image can be started without any dependencies but will not be functional without a valid Twin Configuration or MessageBroker connect to the Tributech Agent. The TwinConfiguration can be provided via the Tributech Node (recommended) or MessageBroker (see Source Integration). The OPC-UA Source will automatically connect to the Tributech Agent if the Tributech Agent is running and correct MessageBroker settings are set. In the following part we will describe the setup of a Tributech OPC-UA Source:

  • Setup the docker environment by creating a .env file with the following content and replace the placeholder values with your values:
.env
AGENT_TAG=3.6.1
AGENT_ID=00000000-0000-0000-0000-000000000007
SOURCE_TAG=3.6.0
  • Setup the docker-compose.yml file by creating a docker-compose.yml file with the following content in the same folder as the .env file:
docker-compose.yml
version: '3.6'

services:
source-opcua:
restart: unless-stopped
image: ${DOCKER_REGISTRY-tributech.azurecr.io/}tributech-source-opcua:${SOURCE_TAG:-latest}
environment:
- MqttOptions__MQTTHost=mosquitto-server-opcua
- Logging__LogLevel__Default=Debug
- Logging__LogLevel__ADSRouter=Error
networks:
- opcua-net
logging:
driver: "json-file"
options:
max-size: "2m"
max-file: "5"

tributech-agent-opcua:
image: ${DOCKER_REGISTRY-tributech.azurecr.io/}tributech-agent:${AGENT_TAG:-latest}
depends_on:
- mosquitto-server-opcua
environment:
- Logging__LogLevel__Default=Information
- MqttOptions__MQTTHost=mosquitto-server-opcua
# general DSK edge agent configuration
- EdgeDeviceOptions__AgentID=${AGENT_ID:?"The variable AGENT_ID needs to be configured in the .env file."}
networks:
- opcua-net
ports:
- "5000:80" # enable access to agent REST-API (e.g. for configuration with Agent-Companion)
volumes:
- ./volumes/opcua/agent:/app/data # volume mapping for permanent storage of keys and datatwin file
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "2m"
max-file: "5"

mosquitto-server-opcua:
image: eclipse-mosquitto:${MQTT_TAG:-1.6}
restart: unless-stopped
networks:
- opcua-net

networks:
opcua-net:
ipam:
config:
- subnet: 172.24.1.0/24

Configuration

After setting up the Tributech OPC-UA Source we need to link it to the Tributech Node (see QuickStart) and configure the TwinConfiguration.

**"Configure Agent**

We can save the settings by clicking on the SAVE IN WORKSPACE button in the bottom right corner and add a new OPC-UA Stream by right clicking on the OPC-UA Source entry:

**"Add OPCUA Source**

In order to connect to the OPC-UA Server we need to configure the OPC-UA Server settings. The following table contains the description for each setting for our MockClient (later we will describe how to setup a MockServer if you don't have a real OPC-UA Server available, i.e. opc.tcp://off_opcua_server:62541/Quickstarts/ReferenceServer):

**"Add OPCUA Source config**

Next we can add a new OPC-UA Stream by clicking on the Add Streams and OPC UA Stream:

**"Add OPCUA Source stream**

The OPC-UA Stream can be configured with the following settings (the Identifier is specific to the MockServer):

**"Add OPCUA Source stream**

We can save the settings by clicking on the SAVE IN WORKSPACE button in the bottom right corner and continue adding every Identifier we want to read from the OPC-UA Server.

After all streams have been configured, we can apply the configuration to the Tributech Agent by clicking on the APPLY CONFIGURATION button in the top right corner.

Without the MockServer Setup or a real OPC-UA Source we will not receive any data on the Tributech Node.

Value Change Options

The basic handling of Value Change Options (VCO) can be found in Source Integration. This section contains the concrete handling of the Step (Delta) for the simulated source. The following list contains the description for each supported Stream Data Encoding where X represents the value for Step (Delta):

  • Double, Int32, Long, Float: defines the minimum difference between values to be submitted, the change is always compared to the last successful submitted value, e.g. if X= 3 if the double values 1, 2, 5, 8, 10, 11, 14 are received by the Tributech Source only 1, 5, 8, 11, 14 will be submitted.
  • Byte Array: will only be submitted if the current and last submitted value are not equal
  • String UTF 8: will only be submitted if the current and last submitted value are not equal
  • Boolean: will only be submitted if the current and last submitted value are not equal

Providing Data

If a OPC UA Server is used as a source, no specific settings are required, only the settings described in Configuration. If no OPC UA Server is available the Tributech ADS Source can use a OPC-UA Demo Server from Unified Automation to provide data to the Tributech ADS Source.

Mock Server

The following steps describe how to setup a MockServer with the OPC-UA Demo Server from Unified Automation. The Mock Server can be started by downloading the docker-compose.override.yml file into the same folder as the Tributech ADS source.

docker-compose.override.yml
version: "3.6"

services:
official-opcua-server:
image: ghcr.io/opcfoundation/uanetstandard/refserver:1.4.371.91
hostname: off_opcua_server
networks:
- opcua-net
volumes:
- ./volumes/opcua/mock-server:/root/.local/share/OPC Foundation
logging:
driver: "json-file"
options:
max-size: "2m"
max-file: "5"

volumes:
official_opcua:

The Mock Server needs access to the same docker network as the Tributech OPC UA Source. The Mock Server will be started automatically when the Tributech ADS Source is started.

The following table contains the description for each available Identifier path of the Mock Server:

IdentifierDataType
ns=3;i=2822Boolean
ns=3;i=2824Byte Array
ns=3;i=2832Double
ns=3;i=2831Float
ns=3;i=2827Integer
ns=3;i=2829Long
ns=3;i=2833UTF8 String

**"Add OPCUA Mock Server data**