Beckhoff / ADS

Beckhoff protocol to communicate with TwinCAT devices.
MIT License
513 stars 194 forks source link

ADS,AMS,Net ID architecture #66

Closed Auto-Ken closed 5 years ago

Auto-Ken commented 6 years ago

I'm trying to connect CX2020 to Linux PC. But I'm confusing about relationship ADS, AMS, Net ID.

CX2020 has following 5 different netID. image

ADS service port image

Now I could connect Device2 via ADS, however I coulndn't connect other NetID and Port like 851. As a Question, 1.How Could I change Target NetID? 2.How many Message Router exists in CX2020? 3.If several router are, how is the releationship?

Futhermore, each Device has ADS server. Where it is located?

I would like to make a simple fig for this architecture and put here.

Thank you

Auto-Ken commented 6 years ago

For the firsrt, I'll put current understanding. Maybe it should be wrong. ads2 Square filled by grey is destination which has global variables.

pbruenn commented 6 years ago

I am not an expert on ADS, it's architecture or use cases. All I know and did is this simple ADS client library, so take my response with care.

"I'm trying to connect CX2020 to Linux PC." sounds like you want to connect TwinCAT to your PC running this Open Source library. This will not work. This library is not able to run a ADS device (server), because the "Message Router" is not a real one. It is limited to map destination AmsAddresses (NetId + AmsPort) to TCP/IP connections. It is like a "one-way" routing.

If you run TwinCAT on your CX2020 you have one full functional "Message Router" with multiple ADS devices connected. This might help to understand ADS better: https://infosys.beckhoff.com/content/1033/tcadscommon/html/tcadscommon_intro.htm https://infosys.beckhoff.com/content/1033/tc3_adscommon/html/tcadscommon_introtc3.htm?id=77839136258212880

To answer your questions:

  1. ADS is an application layer on top of AMS. An ADS device is a virtual device node identified by an AMS address (AmsAddr) which consists of an AmsNetId and AmsPort number. A TwinCAT3 PLC is typically an ADS device running on AmsPort 851.
  2. Depends on what you mean by target:
  3. There is only one "Message Router" on your CX2020 (TwinCAT)