TwinCAT ADS
Basic structure of ADS devices and ADS symbols
Automation Device Specification (ADS) forms the basis for the LabVIEW™ interface. ADS describes a device- and fieldbus-independent interface and enables communication between ADS devices.
The ADS device concept and the identification of an ADS device are explained below.
The modular system architecture of TwinCAT allows the individual parts of the software (e.g. TwinCAT PLC, TwinCAT NC ...) to be regarded as independent devices: there is a software module for each individual task. The servers in the system are the executing devices that provide certain services. The clients are programs that request the services of the servers. A client initially establishes a connection to the server and requests a service: for example, it requests reading the value of a variable or it requests writing a variable.
![TwinCAT ADS 1:](Images/png/27021597880394123__en-US__Web.png)
The interface for LabVIEW™ provides an ADS client interface, which enables data exchange (read and write) with TwinCAT runtimes. The TwinCAT runtime, or its ADS devices, thus provide their services as ADS servers and can be used from LabVIEW™.
ADS data exchange between ADS devices takes place via the ADS router. As shown in the diagram above, data exchange between ADS devices implemented on the same system takes place via the system memory. If two ADS devices, e.g. LabVIEW™ and the TwinCAT runtime, are on different systems, a route can be created between two ADS routers. When creating the ADS route, the transport type (usually TCP/IP) for communication between the two ADS routers can be defined. Accordingly, an ADS device identifies itself via the AMS NetId of the ADS router and a port number, which then specifies the ADS device on the system. For example, port 851 is the default port for the first PLC instance in the TwinCAT runtime. ADS services of an ADS device are then specified by two parameters, the Index Group and the Index Offset. For example, a PLC variable is accessible for reading or writing under a specific Index Group and Index Offset.
If an application is to be created that is to be used on several target systems and in which LabVIEWTM and TwinCAT run on the same system, the relative AMS NetId can be used. The relative AMS NetId always points to the local system. For this purpose, 0.0.0.0.0.0 is used for the address.
Summary
- AMS NetId: Identifies the ADS router, i.e. the system.
- ADS Routes
- Port: Identifies an ADS device.
- Index Group/Offset: Specifies the ADS system service, e.g. a variable for reading and writing.
In order to make the addressing of variables in a TwinCAT runtime more convenient for the user, TwinCAT creates ADS symbols, which can be searched with the Target Browser, for example. The Target Browser is also integrated into the interface for LabVIEW™ in the VI Symbol Interface so that ADS symbols can be selected easily and quickly. An ADS symbol for a variable in TwinCAT then contains the information mentioned above: AMS NetId, Port, Index Group and Index Offset and furthermore the Bit Size as well as a symbol name and the data type of the variable.
For more information on ADS, please see the following links:
- AMS NetId and Port: ADS device identification
- Index Group and Index Offset: Specification for ADS devices
- ADS Routes: System Node "Routes" and Add Route
- Connecting Devices with same AMS NetId: AmsNAT
- Using MQTT and Message Broker with ADS: ADS-over-MQTT
- TLS encrypted ADS: Secure ADS
- Target Browser
- Record ADS communication: ADS Monitor
Basic ADS data communication
Basically, there are three different possibilities/modes for data communication in ADS.
Synchronous reading or writing
- The ADS client in LabVIEW™ waits for a response from the ADS server before proceeding with code execution.
Asynchronous reading or writing
- The ADS client in LabVIEW™ sends a read or write request to the ADS server but does not wait for a response; instead, it continues to execute other parts of the program (for example, requests to other variables).
![TwinCAT ADS 2:](Images/png/10031685003__Web.png)
Event-based communication (read only)
- An ADS notification is only registered once on the server. The notification can be registered "on change" or "cyclic". After a notification has been registered at the server, it sends requested data to the server without any further requests from the client.
![TwinCAT ADS 3:](Images/png/10031687563__Web.png)
The VIs ADS Read and ADS Write are polymorphic. The desired communication mode (sync, async or notification) can be selected there. The VIs also provide extensions to these basic modes that involve LabVIEW™-side buffering of data and passing it to the LabVIEW™ process.