stlehmann / pyads

Python wrapper for TwinCAT ADS
MIT License
252 stars 93 forks source link

PLC Connection Problem on Ubuntu #323

Closed asd5425d closed 2 years ago

asd5425d commented 2 years ago

Hello everyone, I am new to PLC and TCP/IP communication and I apologize in advance for my mistakes. I am trying to communicate my Ubuntu computer with Beckhoff CX9020. Pyads has many variables to link to and I can't understand some of them. I installed pyads library from github on my ubuntu workspace. I don't know if I need to do different installations for pyads. And I tried this base code

import pyads plc = pyads.Connection('127.0.0.1.1.1', pyads.PORT_TC3PLC1) plc.open() i = plc.read_by_name("GVL.int_val") plc.write_by_name("GVL.int_val", i) plc.close()

When I run this code the terminal is waiting and after a few minutes I get the error "Error: bind TCP socket: 110". When I try different values ​​for the link address (127.0.0.1.1.1), I get different errors. Do I make any settings on Windows to use Plc on Ubuntu or is only Ubuntu enough?

CLIENT_NETID = "192.168.1.10.1.1" CLIENT_IP = "192.168.1.10" TARGET_IP = "192.168.1.11" TARGET_USERNAME = "Administrator" TARGET_PASSWORD = "1" ROUTE_NAME = "route-to-my-plc" plc = pyads.Connection('127.0.0.1.1.1', pyads.PORT_SPS1)

How can I get these values ​​(CLIENT_NETID,CLIENT_IP,TARGET_IP,TARGET_USERNAME,TARGET_PASSWORD,ROUTE_NAME,127.0.0.1.1.1)? Do I need to set them up beforehand in Windows? Can I see these values ​​in Ubuntu system? Can you help me ? I'm at zero level on this. Thanks in advance for your help.

chrisbeardy commented 2 years ago

Hello, have you created a route? https://pyads.readthedocs.io/en/latest/documentation/routing.html

We try to keep issues for tracking issues and bugs only as it keeps the maintenance of the project a lot easier. For questions, please could you post on forums such as stack overflow.

Therefore can i please ask that you close this issue, I am happy to help you through email. hgl8pjc3k@mozmail.com

Thanks

asd5425d commented 2 years ago

Hello, have you created a route? https://pyads.readthedocs.io/en/latest/documentation/routing.html

We try to keep issues for tracking issues and bugs only as it keeps the maintenance of the project a lot easier. For questions, please could you post on forums such as stack overflow.

Therefore can i please ask that you close this issue, I am happy to help you through email. hgl8pjc3k@mozmail.com

Thanks

I understand you. Thank you for your kindness and help.