SOIL-OPC-UA
Name
OPC UA-Generation from JSON-Files
Description
This project can iterate JSON-Models generated from SOIL-Interfaces and convert them into an OPC UA Server. At the moment everything except enums can be generated. Our code generates the functions as empty bodies, but you get a descripton and a small guide on how to integrate your algorithm.
Installation
-
Clone Project in a Directory of your choice
-
Copy the jsonfile you want to generate in that folder
-
If you want to run the code manually run:
$ pip install -r requirements.txt
Usage:
Usage with Dockerfile
- Change file name of the json file in line 16 of the Dockerfile to the name of the file which you wish to generate
- run the dockerfile
Usage manually
run:
$ python newmodeljsonparse.py <name of your file>
OPC UA Server explanation:
Event Severity Table:
debug = 200
info = 400
warning = 600
error = 800
critical = 1000
Getting events and Streams displayed:
The Events and Streams will get displayed if you subscribe to the component nodes events. This can be done by using left-click on the componentsnode in the opcua client. Then you will be shown a small menu from which you need to choose subscribe to events. If you don't want to see the events anymore just use the same menu and choose unsubscribe to events. On the opcua-client.exe from Git Hub opcua client.
How are those events and streams displayed:
In the window events you will see each event plop up if you drag the bar below the window to the right you will see the message and the severity of each event. On the opcua-client.exe from Git Hub opcua client. For streams the message contains the shown measurement and the value.
How to modify the server
- Functions:
-
To get the value of a node use:
await node.get_value()
-
To change the value of a node use:
await node.set_value()
-
- For everything else it is the easiest to just change your Json-Model accordingly and generate a new server.
Roadmap
One could work on connecting the events and Streams to their respective objecttypes, to make it easier for the user. The dynamic streams also can't be generated at the moment. Ranges are not enforced as of now.