stlehmann / pyads

Python wrapper for TwinCAT ADS
MIT License
257 stars 95 forks source link

pyads without local TwinCAT install (Win64) #370

Closed chrkuhlmann closed 7 months ago

chrkuhlmann commented 7 months ago

Hi, I could not not find information in the documentation whether the following configuration is possible.

I'm trying to connect to a PC with a TwinCAT 3 install via pyads from a PC that has no local TC3 install. I've copied the TcAdsDll.dll and made sure it is loaded by pyads. Trying to replicate the "setup 2" or "setup 3" from the following article https://stackoverflow.com/a/68601631 I've also tried to run a local router (AdsRouterConsoleApp) built from https://github.com/Beckhoff/TF6000_ADS_DOTNET_V5_Samples/tree/main/Sources/RouterSamples/AdsRouterConsoleApp/src but even after configuring the router to show debug info, I never see any connection attempt when running pyads. Pyads fails with "Failed to open port on AMS router." no matter what configuration I try. The router itself seems to be functional, I see communication logs when I configure the corresponding route on the remote tc3 PC.

Running pyads directly locally on the tc3 PC, I can connect and exchange data as expected, so my script is fine.

Any comment on whether a setup like the two I intent to use can work with pyads and hint on how to achieve this is highly appreciated.

chrisbeardy commented 7 months ago

When on windows as the client you are best installing the TwinCat ADS router on the PC. https://www.beckhoff.com/en-gb/support/download-finder/search-result/?download_group=97028369&download_item=650023582

This is just the router part of TwinCat, no runtime or engineering.

The information outlined in that Stack Overflow answer is specific to the node js ads library. Scenario 2/3 is similar to what pyads does when using Linux as the client. When on windows pyads relies on the Router. The console app you suggest, I have no experience with but may work, however set up and usage of that is outside the scope of pyads.

I suggest trying at first with the router installed then once that is working you could try with the console app if that is preferred.

I am closing this issue as its not a problem with pyads itself but should you require further assistance please post on stack overflow and I'll help there. Thanks.