fbarresi / SoftBeckhoff

Virtual Beckhoff PLC for local testing with docker support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please add guidance on how to connect from TwinCAT XAE

RodneyRichardson opened this issue · comments

I have started the docker container, and can connect to the swagger API using a web browser, but I don't know how to add a route to the softBeckhoff PLC.

Please add some guidance on what value to put into the routing, and/or if routes need to be set up on the softBeckhoff via the API.

Hi!

Can you please explain me your use case? Do you want to connect the software to the twincat engineering?

I have TwinCAT Engineering (XAE) installed on Windows 10, and am using it to write my PLC code. I would like to run that PLC code on the softBeckhoff PLC running in docker on the same machine.

The "Broadcast Search" option in the Add Route Dialog in XAE does not find the softBeckhoff. I don't know what route to add manually to my TwinCAT Engineering environment, nor how to add the route from the softBeckhoff back.

If I manually enter route information (e.g. IP Address=127.0.0.1, AmsNetId=192.168.1.20.1.1, Transport=TCP_IP), it asks for Remote credentials (Username/Password) which I don't know.

Hi!
Thank you for your explanation.

Basically you just have to setup a route on your machine (unidirectional).
Then you can setup the other direction of the route for your docker container over the API [/routes].

image

Otherwise the SoftBeckhoff is will not be able to run your code or act like a PLC you can program 😢 .
The software was designed for testing ADS Communication for example for testing software that communicates with a PLC or for CI/CD Agents that have to run automated tests.
Since a fully PLC simulation is still possible out of the box over the installed runtime inside the engineering environment I don't plan to integrate such a function in the software.

Thanks, but I'm having a few problems with this.
Looking at the start-up log in the docker container, I see the following:

Local System: SoftBeckhoff, 192.168.1.20.1.1, 172.17.0.2
Configured routes:
        RemoteSystem1, 10.30.2.124.1.1, RemoteSystem1
  1. In XAE, what value do I put in the AmsNetId and IP Address? I assume 192.168.1.20.1.1 and 127.0.0.1, and the Remove Route set to None..
  2. What's the IP address I use for the "PUT routes" call? I'm assuming 172.17.0.2, with the AmsNetId from my "TwinCAT Info" and an arbitrary name.
  3. When I call "GET routes" (using the swagger "Try it out"), it always returns 204 (no content). Looking at the code, I see this is not implemented (nor can I see a way to easily implement this, as listing doesn't look to be supported by TwinCAT.Ads.TcpRouter.AmsTcpIpRouter).

Hi!

  1. There is a route already configured, that you see in docker log. I put it as default in appsettings.json So everybody can see the default structure if starting from source.
  2. Basing on what I see in you log snippet you need to setup an unidirectional route with 192.168.1.20.1.1 and 172.17.0.2 (Ip of your running container)
  3. In the API you have to setup a route with AMSNetId and Ip Address of your machine and an arbitrary name.
  4. This is still a todo, because the amsTcpIpRouter doesn't expose the list of routes. I wanted to reach the list via reflection, but I'm still working on it.

In you case I would try to start the software from source, so you can use your local router server an all you local routes.
Just start with this flag --add-router=false

Hi, Thank you for your advice, but I'm afraid I still can't get this to work on my setup. For now I'm going to use the Beckhoff XAR on a VMWare VM, but I may come back to this in the future.