How to create a Twincat ADS route in WIndows without the Twincat System application?

2.3k views Asked by At

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?

2

There are 2 answers

0
Daniel Müller Navarro On BEST ANSWER

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

1
Patryk Zadroga On

//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;
        }
    }