Python OPC UA Modbus Driver
Elementary implementaion which bridges Modbus RTU data to OPC UA server.
The basic principle is this:
- Start
server_minimal.py
- This will import the
driver_ModbusRTU.py
which will kick off a thread which scans a modbus network - The server will import an XML file which has an Object Type for a hardware device, the example has one device (MyDevice)
- The server will instantiate a python
Device
object which has anupdate
method for getting data from Modbus - The
Device
object subclassesUaObject
which will auto subscribe to all children and keep the python class in sync with the OPC UA object - MyDevice links to the modbus driver via parameters from OPC UA, so it can be configued from an HMI or UA client
This example is not tested and has never been run. It is a generic starting point created from a working implementation.
Dependencies:
python-opcua
modbus_tk