Has anyone tried and managed to connect an external python script to a VC model? I am aware of Python API, but I want to read and write sensors and actuators’ values using Python (soft PLC) like connecting using PLC.
I think this could be done with OPC UA. Any suggestions?
OPC UA is a good option for this.
Many people also use TCP/IP and UDP communications.
There are many threads on the forum about this:
Here is an example of TCP/IP socket connection using python. We using non-blocking mode of socket connection which needs to be implemented via try-except method. All necessary codes and components attached here by.
168_TCP_IP-Socket-Example.zip (1.26 MB)
I wonder have anyone of you connect VC to a custom-made OPC UA Server. I’ve tried to connect it with a dummy OPC UA server but the connection failed. I made sure the server is up and running, and the server can be connected using UaExpert. Is this approach a dead end or anyone has some experiences with it?
Thank you for your time and I am looking forward to hearing your idea.
Thank you very much for your prompt reply. I will have a look at those posts.
You can write with Python your own OPC UA Server:
Then you can control with your Server the signal-exchange if you connect VC to your OPC UA Server.
But this does not replicate the ability of plugins (C# / Stackless Python) inside VC itself.