Reputation: 215
I'm trying to read some data from a simulated opc server following this video tutorial. The code I'm running in jupyterlab is this:
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'])
returns
[('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']
Indicating it does connect to the server, however when I uncomment the read statements I receive the following error message
Kernel Restarting
The kernel for Downloads/openopc-master/Untitled.ipynb appears to have died. It will restart automatically.
Running the code on spyder does the same, also I added the tags to the simulation server before running the code. I'm using a fresh anaconda x64 install (python 3.x) downloaded today and pywin32-227.win-amd64-py3.7. Any ideas about why it doesn't read anything?
My goal is to connect to an external OPC server located in a different machine to read and write tag data. I already have configured DCOM and tested the connection with OPC expert and other software. Is this possible with OpenOPC?
Thank you beforehand.
Upvotes: 1
Views: 602