Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two application running on the same machine that read a variable from the same plc concurrently #201

Closed
AlessandroMenon opened this issue May 11, 2023 · 8 comments

Comments

@AlessandroMenon
Copy link

Hi, we have the following scenario:

  1. First application that use ads to read a variable from plc
  2. Second application that use https://www.nuget.org/packages/Beckhoff.TwinCAT.Ads to read the same variable from the same plc

Is this a supported scenario ? The behavior we see is that as soon as the second application starts, the first application is closed connection with the plc (" connection closed by remote"). If we start the two applications in reverse order we have the same problem on the other instance. So it seems that they cannot coexist on the same machine.
I attached the example
Example.zip

@pbruenn
Copy link
Member

pbruenn commented May 11, 2023

This is a limitation of TwinCAT on the PLC side. TwinCAT doesn't support multiple ADS connections from the same IP. So you have to either use multiple IPs on your client running the applications or you have to use another protocol such as MQTT https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_over_mqtt/index.html&id=

@AlessandroMenon
Copy link
Author

Thank you for your answer. But I don't understand why if I use two instances of the .NET application I don't encounter this problem. It only happens to me if either application uses https://github.com/Beckhoff/ADS. Could it be because the .NET version has a real Ads Router implemented?

@pbruenn
Copy link
Member

pbruenn commented May 15, 2023

Because the .NET application is "cheating" and implements an ADS router ;-)

@AlessandroMenon
Copy link
Author

Is there any way to use an ADS router in C++? Do I have to compile https://github.com/Beckhoff/ADS with the define USE_TWINCAT_ROUTER set and have TwinCAT installed on the machine?

@pbruenn
Copy link
Member

pbruenn commented May 15, 2023

Yes, on Windows or TC/BSD you can build with -Dtcadsdll_include=c:\TwinCAT\AdsApi\TcAdsDll\Include -Dtcadsdll_lib=c:\TwinCAT\AdsApi\TcAdsDll\x64\lib, which will then use the TwinCAT Router.

Take a look into our internal CI scripts:
TC/BSD:
https://github.com/Beckhoff/ADS/blob/master/.gitlab-ci.yml#L68-L74

Windows (Is essentially the same but looks so complicated because of our CI setup):
https://github.com/Beckhoff/ADS/blob/master/.gitlab-ci.yml#L101-L105

@fengyc
Copy link

fengyc commented Jun 14, 2023

Try this https://github.com/fengyc/ads-proxy , I don't think it is an elegant solution but it works

@pbruenn pbruenn closed this as completed Sep 4, 2023
@bsteenput
Copy link

bsteenput commented Dec 6, 2023

Hello,

Is it possible to have the ads router in linux ? I'm trying to have the same machine to access different tasks running in the PLC the first process on the linux machine gets disconnected when the second process connect. I'm using PyAds on a ubuntu machine.

My problem is the same as the one describe here : stlehmann/pyads#331

Thanks in advance for you help,
Bertrand

@tboegi
Copy link
Contributor

tboegi commented Dec 6, 2023

Did you try the suggestion from stlehmann/pyads#331 ?

Otherwise:
https://github.com/birkenfeld/ads_forwarder_rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants