1

I have a Windows application with Twincat ADS library to monitor a PLC. As far as I know this library works only after the creation of the ADS route in the Windows computer using the Twincat tool. Do you know if it is possibile to create the route without the Twincat System tool application?

Tobia
  • 9,165
  • 28
  • 114
  • 219
  • 1
    Do you mean something like [pyADS](https://pypi.org/project/pyads/) or the [TwinCAT automation interface](https://infosys.beckhoff.com/english.php?content=../content/1033/TC3_AutomationInterface/index.html&id=)? – Roald May 28 '21 at 13:06
  • Yes I mean something like pyADS. It doesn't need the route configuration and it is defined runtime, is it possibile to do something like this with C#/.NET dll? – Tobia May 28 '21 at 16:19
  • [TwinCAT ADS](https://www.nuget.org/packages/Beckhoff.TwinCAT.Ads/) ? – Roald May 28 '21 at 19:40
  • If I'm not wrong, to use that library, I have to install the full package and create locally the route using the Route editor tool. Am I wrong? – Tobia Jun 01 '21 at 13:13
  • From reading the description it doesn't look like it. Just give it a try with a minimal working example. – Roald Jun 01 '21 at 19:04
  • I have tryied it, from pyADS the connect method has the remote ADS address and the remote ip address. With .NET library, the connect method has only remote ADS address and then, you have to create the route to point that name to a remote ip address. To do so, you need to install the ADS tools from SDK to add/edit the routes. – Tobia Jun 03 '21 at 13:45
  • Ok then I don't know. – Roald Jun 04 '21 at 14:54

2 Answers2

2

There are multiple possibilities. This picture shows them:

ads

The setup 2 is what you are looking for. Without TwinCAT but .NET Core muss be available. Or the setup 3 with NodeJS.

This information comes from:

https://github.com/jisotalo/ads-client

0

//This is example in C# using Beckhoff.TwinCAT.Ads, Beckhoff.TwinCAT.Ads.TcpRouter

    AdsClient ads = new AdsClient();
    public bool SetConnection(tcConnection ConnectionData)
    {
        AmsTcpIpRouter _router = new AmsTcpIpRouter(ConnectionData._localNetId);
        CancellationToken cancel = new CancellationToken();
        try
        {
            _router.AddRoute(new Route(ConnectionData._remoteRouteName, ConnectionData._remoteNetId, new IPAddress[] { ConnectionData._remoteIp }));
            _router.StartAsync(cancel);

            ads.Connect(ConnectionData._remoteNetId, 851);

            return ads.IsConnected;
        }
        catch
        {
            return false;
        }
    }
  • Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?** – Jeremy Caney Aug 14 '23 at 01:22