pythonopc

Connection of python 3.10.9 with Matrikon Server


I am currently working on connecting Python with Matrikon Server Simulation. I am encountering several issues and am not aware of its default port. Nevertheless, I am facing errors in the process.

Python Code:

import opcua
c = opcua.Client("opc.tcp://localhost:53530/Matrikon.OPC.Simulation.1")
c.connect()

Errors:

Discovery Error: [WinError 10061] No connection could be made because the target machine actively refused it

My Matrikon server: enter image description here


Solution

  • There are multiple OPC specifications, and they use different communication protocols. The OPC client library you are using must support the OPC specification provided by the OPC server.

    MatrikonOPC Simulation server supports OPC-DA (COM/DCOM based), but you are apparently using some OPC client library for OPC-UA (Unified Architecture), so that is not ever going to work directly.

    In order to connect to MatrikonOPC Simulation server from Python, use some library that supports OPC-DA, such as: