jisotalo / node-red-contrib-ads-client

Beckhoff TwinCAT ADS client library for Node-RED (unofficial). Connects to Beckhoff TwinCAT automation systems using ADS protocol.
https://flows.nodered.org/node/node-red-contrib-ads-client
MIT License
15 stars 4 forks source link

Problem connecting to Beckhoff PLC #24

Closed Sulomus closed 1 year ago

Sulomus commented 1 year ago

First of all I would like to thank you for this library! The examples and documentation is amazing!

Unfortunately I was not able to connect to my Beckhoff PLC. My task is to connect and take data from the PLC - I did not install it nor program it - so I don't know all the internal configuration etc. but I will try to explain our system as best as I can.

What am I using? 1) Beckhoff PLC

2) Linux PC with Node-RED

I enabled ADS and create symbols on the Beckhoff PLC as follow: image

Why did I say AmsNET ID is 5.77.87.208.1.1 or 158.196.119.70.3.1?

One I can find here: Screenshot_14

And second one I can see here: Screenshot_8

The same applies for the PORTS 851 OR 27907

And here: Screenshot_12

This is the error I am getting: Screenshot_9

I do not understand why is it trying to connect to the local IP 127.0.0.1? Shall I also configure something on my Linux PC?

I have tried every combination of AmsNetID and PORTS and none of the worked resulting in same error message (expect for the IP and PORT).

I will appreciate any help! With regards, Jakub Szlaur

Sulomus commented 1 year ago

image

jisotalo commented 1 year ago

Hello, thanks for the feedback!

The AmsNetId 5.77.xxx and port 851 are correct ones. The others would be if you wanted to connect directly to the I/O EtherCAT device.

As you are using Linux PC without any TwinCAT router, you need to create the route manually. As default the library is trying to connect to local router which would pass the messages to the PLC (and that's how it done with router).

See the following: https://github.com/jisotalo/ads-client/#setup-3---connecting-from-any-nodejs-supported-system-to-the-plc https://github.com/jisotalo/ads-client/issues/51#issuecomment-758016428

Sulomus commented 1 year ago

Hello, thanks for the feedback!

The AmsNetId 5.77.xxx and port 851 are correct ones. The others would be if you wanted to connect directly to the I/O EtherCAT device.

As you are using Linux PC without any TwinCAT router, you need to create the route manually. As default the library is trying to connect to local router which would pass the messages to the PLC (and that's how it done with router).

See the following: https://github.com/jisotalo/ads-client/#setup-3---connecting-from-any-nodejs-supported-system-to-the-plc jisotalo/ads-client#51 (comment)

Thank you very much! Will try ASAP.

Sulomus commented 1 year ago

Hello, I have added StaticRoute via Visual Studio TwinCAT3 like this: image

Then I changed the configuration of the notification node as follows: image image

Now when I run the code I get this error: image

In Beckhoff docs there is not much more info: image

Do I need to do something else?

jisotalo commented 1 year ago

I have a feeling that you have done something wrong with the route.

For example, when googling this error I found this comment. Make sure you don't have this unidirectional checked. https://github.com/Beckhoff/ADS/issues/148#issuecomment-882391247

I have never created a route from XAE so I'm not sure if it's correct. Please try as in links I posted earlier.

Sulomus commented 1 year ago

Man you are amazing! Managed to make it work without the unidirectional checked!

jisotalo commented 1 year ago

Awesome! Thanks for reporting that you got it working.