python - OpenOPC-内核在试图读取数据时死机
问题描述
我正在尝试按照此视频教程从模拟的 opc 服务器读取一些数据。我在 jupyterlab 中运行的代码是这样的:
import OpenOPC
opc = OpenOPC.client()
# opc.servers()
opc.connect(opc_server = 'Matrikon.OPC.Simulation.1')
print(opc.info())
print(opc.list())
# opc.read('Simulation Items/Random/Random.Int1')
# opc.read(['Random.Int1', 'Random.Real4'])
返回
[('Protocol', 'DCOM'), ('Class', 'Graybox.OPC.DAWrapper'), ('Client Name', 'OpenOPC'), ('OPC Host', 'DESKTOP-H750JUT'), ('OPC Server', 'Matrikon.OPC.Simulation.1'), ('State', 'Running'), ('Version', '1.5 (Build 0)'), ('Browser', 'Hierarchical'), ('Start Time', '2020-05-15 18:56:04.231000+00:00'), ('Current Time', '2020-05-15 20:15:52.009000+00:00'), ('Vendor', 'Matrikon Inc (780) 448-1010 http://www.matrikonopc.com')]
['Simulation Items', 'Configured Aliases']
表明它确实连接到服务器,但是当我取消注释读取语句时,我收到以下错误消息
Kernel Restarting
The kernel for Downloads/openopc-master/Untitled.ipynb appears to have died. It will restart automatically.
在 spyder 上运行代码也是如此,我还在运行代码之前将标签添加到了模拟服务器。我正在使用今天下载的全新 anaconda x64 安装(python 3.x)和 pywin32-227.win-amd64-py3.7。关于为什么它什么都不读的任何想法?
我的目标是连接到位于另一台机器上的外部 OPC 服务器以读取和写入标签数据。我已经配置了 DCOM 并测试了与 OPC Expert 和其他软件的连接。这对 OpenOPC 可行吗?
事先谢谢你。
解决方案
推荐阅读
- android - LinearLayout内部的多个RelativeLayout显示错误
- sql - 在地方之间寻找
- python - 使用 PDFMiner for Python 将 pdf 的所有页面合并为一个文本
- python-3.x - Pandas 中的新出现计数
- javascript - Javascript 在新行上打印
- python - 使用 python 计算数据增强以进行深度学习时内存崩溃
- php - 无法从供应商加载 mailgun 类
- nsis - 如何使用 NSIS 将注册表值从以前版本的安装程序导出和导入到当前版本的安装程序
- flutter - Flutter - 如何从另一个小部件重建未来的小部件
- loops - 使用“rvest”进行多链接网页抓取。错误参数意味着不同的行数