I have a machine learning and advanced control application in Python (TensorFlow + Gekko) that I need to integrate with a Programmable Logic Controller (PLC) that provides the data acquisition and final element control. Can I use a rack-mounted Linux (preferred) or Windows Server as the computational engine, with data transport through OPC-UA (OLE for Process Control - Universal Architecture)?
There is a Python OPC-UA / IEC 62541 Client (and Server) and a Python MODBUS package that I've used on other projects when connecting to Distributed Control Systems (DCS) such as Emerson DeltaV, Honeywell Experion/TDC3000, and Yokogawa DCS. Can I do the same with PLC function blocks such as with the Siemens Simatic S7-300? Siemens has newer PLCs that support TensorFlow such as the SIMATIC S7-1500 NPU (Neural Processing Unit) module but there are a variety of reasons why an external server is desirable. The IEC 61131 standard and PROFINET CBA standard are supported (IEC 61499 standard for Siemens) in the S7-300.
Below is a minimal function block that I'd like to use to communicate with a function block.
from opcua import Client
client = Client("Matrikon.OPC.Simulation")
try:
client.connect()
root = client.get_root_node()
# Get a variable node using browse path
myvar = root.get_child(["0:Objects", "1:MyObject", "2:MyVariable"])
print('Variable is ', myvar)
finally:
client.disconnect()