Skip to content

A simple setup for the Lablink OPC UA client, including a simple OPC UA server (Python), a CSV client (data source) and a plotter.

License

Notifications You must be signed in to change notification settings

AIT-Lablink/lablink-opcua-client-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lablink Setup for OPC UA Client Test

image

This project contains a Lablink setup for connecting an OPC UA server with a data source and a plotter:

  • A CSV client acts as a data source, reading CSV data and sending it to the OPC UA client.
  • The OPC UA client is connected to a OPC UA server, and has 2 purposes:
    1. Whenever new input data arrives, the client updates the values of the associated variables on the server
    2. At the same time, the client is subscribed to certain variables on the server. Whenever they change their values, it sends these values to the plotter.
  • The plotter displays all incoming data on the screen.

NOTE: In this specific example, the variables that are updated by the UPC UA client and the variables it listens to are identical. In a real-world setup this would not make a lot of sense, but it is good enough for the purpose of this example.

NOTE: All following instructions are for Windows, using either the command prompt (cmd.exe) or by double-clicking batch scripts (files of type *.cmd). Running the setup on Linux works analogously, using the correspondig commands from a command shell.

Prerequisites

You need to have the following software installed for running this setup:

Make sure that the JAVA_HOME environment variable is set and points to your JDK installation:

  • open the system properties (WinKey + Pause or go to Settings => System => About => System Info => Advanced System Settings)
  • select the Advanced tab, then the Environment Variables button
  • select and edit the JAVA_HOME variable in the user variables, e.g., adding C:\Program Files\Java\jdk-13.0.2.

Installation

Lablink packages download

All required Lablink packages are listed as dependencies in file pom.xml (a Maven project configuration file). To download all required Lablink packages, open the command prompt, change to the project's root directory and type:

  mvnw package

OPC UA server installation

This setup uses a simple OPC UA server, implemented using the FreeOpcUa Python library. To install all required Python dependencies, open the command prompt, change to the project subdirectory setup\1_opcua_server and type:

  pip install -r requirements.txt

Running the test

Step 1: Starting the OPC UA server

To start the OPC UA server, open the command prompt, change to the project subdirectory setup\1_opcua_server and type:

  python test-opcua-server.py

Step 2: Starting the Lablink config server

The configuration for all Lablink clients (incl. the CSV data for the CSV client) is contained in file setup\2_lablink_config\opcua-client-test-config.db. To start the Lablink config server, simply double-click batch script setup\2_lablink_config\run_config.cmd. Alternatively, you can open a new command prompt, change to the project subdirectory setup\2_lablink_config and type:

NOTE: Once the server is running, you can view the available configurations in a web browser via http://localhost:10101.

NOTE: A convenient tool for viewing the content of the database file (and editing it for experimenting with the setup) is DB Browser for SQLite.

Running the Lablink clients

All batch scripts for running the Lablink clients can be found in project subdirectory setup\3_run_test:

To start the Lablink clients, simply double-click the corresponding batch scripts. Alternatively, you can open a new command prompt for each, change to the project subdirectory setup\3_run_test and type the script name.

NOTE: You can start the Lablink clients in arbitrary order.

Results

After running the clients for some time, the plotter output should look similar to this:

image

About

A simple setup for the Lablink OPC UA client, including a simple OPC UA server (Python), a CSV client (data source) and a plotter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published