python - 是否有使用 OPA UA 传输数据的 IEC 61131/IEC 61499 PLC 功能 block ?

标签 python tensorflow automation gekko iec61131-3

我有一个使用 Python (TensorFlow + Gekko) 编写的机器学习和高级控制应用程序,我需要将其与提供数据采集和最终元素控制的可编程逻辑 Controller (PLC) 集成。我可以使用机架式 Linux(首选)或 Windows Server 作为计算引擎,并通过 OPC-UA(用于过程控制的 OLE - 通用架构)进行数据传输吗?

有一个Python OPC-UA / IEC 62541 Client (and Server)和一个 Python MODBUS package在连接到分布式控制系统 (DCS)(例如艾默生 DeltaV、Honeywell Experion/TDC3000 和 Yokogawa DCS)时,我曾在其他项目中使用过它。我可以对 PLC 功能 block (例如 Siemens Simatic S7-300)执行相同的操作吗?西门子拥有支持 TensorFlow 的较新 PLC,例如 SIMATIC S7-1500 NPU(神经处理单元)模块,但出于多种原因需要外部服务器。 S7-300 支持 IEC 61131 标准和 PROFINET CBA 标准(西门子的 IEC 61499 标准)。

下面是我想用来与功能 block 通信的最小功能 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()

最佳答案

我的经验是 ABB Harmony OPC 服务器也不支持“opcua”。因此,我使用了“OpenOPC”包而不是约翰在评论中建议的“opcua”。但是,我不确定特定品牌的 OPC 是否与“opcua”或“OpenOPC”兼容。

请看我用于测试OpenOPC包的代码。

import OpenOPC
import time
import pywintypes

pywintypes.datatime = pywintypes.TimeType
opc = OpenOPC.client()
opc.servers()
opc.connect('Matrikon.OPC.Simulation.1')
tags = ['Random.Int1', 'Random.Real4']

while True:
      try:
          value = OPC.read(tags,group='Simulation Items',update=1)
          print (value)
      except OpenOPC.TimeoutError:
          print ("TimeoutError ocured")

      time.sleep(1)

关于python - 是否有使用 OPA UA 传输数据的 IEC 61131/IEC 61499 PLC 功能 block ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58752942/

相关文章:

Python:如何捕获这种异常?

python - 文件对象 __exit__() 方法的文档

python - Keras try save and load model error You are trying to load a weight file containing 16 layers into a model with 0 层数

python - 如何使用 python 自动化处理弹出窗口

arrays - 我可以在 Protractor by.Repeater 中取回数组而不是字符串吗?

python - 消费者 : Cannot connect to amqp://guest:**@127. 0.0.1:5672//: [Errno 61] 连接被拒绝

python - Scikit Learn roc_auc_score 和 ROC Plot 的正确输入

tensorflow - 如何部署cnn文件

python-3.x - 如何正确地将数组输入 TensorFlow 占位符

java - 使用 Java 使用 Selenium WebDriver 捕获用户输入和操作