Skip to content
PDF

OPC UA Server to cloud for visualization

In this example, a sensor is providing temperature and humidity data as an OPC UA Server. Temperature data is displayed at the node while humidity data is presented at the Management System. Data is visualized with the visualization element of the Data Services.

The instructions below cover the following steps:

  • Provisioning an OPC UA Server demo sensor as a Docker workload
  • Deploying the provisioned Docker workload to the target node
  • Configuring the Data Services Gateway
  • Local data visualization at the node
  • Central data visualization in the Management System

Provisioning and deploying an OPC UA Server at the node

First, the temperature sensor simulation OPC UA Server must be deployed to the node as a Docker workload. Download the Data Services OPC UA demo sensor found under Example Applications from the Nerve Software Center. This is the Docker image that is required for provisioning the demo sensor as a Docker workload.

  1. Log in to the Management System. Make sure that the user has the permissions to access the Data Services.
  2. Provision a Docker workload by following Provisioning a Docker workload. This example uses TTTech OPC UA Server - demoSensor as the workload name. Use the following workload version settings:

    Setting Value
    Name Enter any name for the workload version.
    Release name Enter any release name.
    DOCKER IMAGE Select Upload to add the Docker image of the sensor simulation that has been downloaded from the Nerve Software Center.
    DOCKER SPECIFIC INFO Select New port and enter the following settings:
    • Protocol: TCP
    • Host Port: 4848
    • Container Port: 4848
    Container name tttech-opcua-server-demosensor
    Network name bridge
  3. Deploy the provisioned Docker workload by following Deploying a workload.

Configuring the Data Services Gateway

The configuration defines the OPC UA Server demo sensor that was deployed above as a data input. The local NerveDB storage and the cloud NerveDB storage are defined as data outputs. An OPC UA Client connects to the OPC UA Server demo sensor and periodically reads the value of temperature and humidity. Temperature values are forwarded to the storage on the node and humidity values are sent to the Management System.

The configuration can be applied with the graphical configuration tool or by importing a pre-written JSON configuration file. In this example, a pre-written JSON configuration is used to configure the Gateway for the sake of simplicity.

  1. Access the Local UI on the node. This is Nerve Device specific. Refer to the table below for device specific links to the Local UI. The initial login credentials to the Local UI can be found in the customer profile.

    Nerve Device Physical port Local UI
    MFN 100 P1 http://172.20.2.1:3333
    Kontron KBox A-150-APL LAN 1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Kontron KBox A-150-APL chapter of the device guide.
    Kontron KBox A-250 ETH 2 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Kontron KBox A-250 chapter of the device guide.
    Maxtang AXWL10 LAN1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Maxtang AXWL10 chapter of the device guide.
    Siemens SIMATIC IPC127E X1 P1 http://172.20.2.1:3333
    Siemens SIMATIC IPC427E X1 P1 http://172.20.2.1:3333
    Supermicro SuperServer E100-9AP-IA LAN1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Supermicro SuperServer E100-9AP-IA chapter of the device guide.
    Supermicro SuperServer 1019D-16C-FHN13TP LAN3 http://172.20.2.1:3333
    Supermicro SuperServer 5029C-T LAN1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Supermicro SuperServer 5029C-T chapter of the device guide.
    Toshiba FA2100T-700 First rear port http://172.20.2.1:3333
    Vecow SPC-5600-i5-8500 LAN 1 http://172.20.2.1:3333
    Winmate EACIL20 LAN1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Winmate EACIL20 chapter of the device guide.
  2. Select the arrow next to Data to expand the Data Services sub menus in the navigation on the left.

  3. Select Gateway.
  4. Select the Edit configuration icon on the right to enter editing mode.

    !Edit configuration

  5. Create a JSON file out of the following Gateway configuration:

    {
      "inputs": [
        {
          "name": "client_demo_sensor",
          "type": "OPC_UA_CLIENT",
          "serverUrl": "opc.tcp://localhost:4848",
          "pollingInterval_ms": 1000,
          "connectors": [
            {
              "name": "poll",
              "accessType": "polling",
              "nodes": [
                "ns=2;i=2"
              ]
            },
            {
              "name": "subs",
              "accessType": "subscription",
              "publishingIntervalAtServer_ms": 1000,
              "samplingIntervalAtServer_ms": 1000,
              "nodes": [
                "ns=2;i=4"
              ]
            }
          ]
        }
      ],
      "outputs": [
        {
          "type": "NERVE_DB",
          "location": "LOCAL",
          "connectors": [
            {
              "name": "default connector",
              "tableName": "default"
            }
          ]
        },
        {
          "type": "NERVE_DB",
          "location": "CENTRAL",
          "connectors": [
            {
              "tableName": "ms_mqtt_broker_to_cloud_timescale_db"
            }
          ]
        }
      ],
      "connections": [
        {
          "name": "demo_sensor_to_local_db",
          "input": {
            "index": 0,
            "connector": 0
          },
          "output": {
            "index": 0,
            "connector": 0
          }
        },
        {
          "input": {
            "index": 0,
            "connector": 1
          },
          "name": "demo_sensor_to_mgmtsys",
          "output": {
            "index": 1,
            "connector": 0
          }
        }
      ]
    }
    
  6. Select the Import button.

    !Import configuration

  7. Add the JSON configuration file containing the code above from the file browser.

  8. Select the Deploy button. A success message pops up in the upper-right corner.

    !Deploy configuration

The configuration is now deployed. The graphical configuration tool now reflects the contents of the JSON file. Exit editing mode by selecting the arrow on the left. Details of each input and output can be opened by selecting the magnifying glass symbol next to each input and output.

Select the Logs tab to view the Gateway logs for more information.

!Gateway logs

Local data visualization at the node

To visualize temperature data at the node, open the local data visualization element through the Data Services UI on the node.

  1. Select Data in the navigation on the left. The Grafana UI will open.

    Note

    Note that the navigation on the left collapses when Data is selected. Select the burger menu in the top-left to expand the navigation again.

  2. Select + > Dashboard in the navigation on the left. A box will appear.

    !Create dashboard

  3. Select Add Query in the New Panel box.

    !Add query

  4. Select the data source from the drop-down menu. The name of the data source is the serial number of the node.

    !Select data source

  5. Fill in the following query information:

    Setting Value
    FROM demo_sensor_to_local_db

    Time column: "timestamp"
    SELECT Column: temperature
    Format as Time series
  6. Select the save icon in the upper-right corner to save the dashboard.

    !Save dashboard

The dashboard can be accessed from the Grafana home menu.

!Home menu access

Central data visualization in the Management System

To visualize humidity data in the Management System, open the central visualization element through the Data Services UI in the Management System.

  1. Select Data in the navigation on the left. The Grafana UI will open.

    Note

    Note that the navigation on the left collapses when Data is selected. Select the burger menu in the top-left to expand the navigation again.

  2. Select + > Dashboard in the navigation on the left. A box will appear.

    !Create dashboard

  3. Select Add Query in the New Panel box.

    !Add query

  4. Select the data source from the drop-down menu. The name of the data source is the name and serial number of the node, formatted as <nodename> (<serialnumber>).

    !Select data source

    Note

    Note that multiple data sources can be selected in the Grafana instance of the Management System, depending on the number of nodes that are registered. Make sure to remember the serial number of the node that was used for workload deployment before.

  5. Fill in the following query information:

    Setting Value
    FROM ms_mqtt_broker_to_cloud_timescale_db

    Time column: "timestamp"
    SELECT Column: humidity
    Format as Time series
  6. Select the save icon in the upper-right corner to save the dashboard.

    !Save dashboard